reserve i, j, k, l, m, n for Nat,
  a, b, c, t, u for object,
  X, Y, Z for set,
  D, D1, D2, Fml for non empty set;
reserve p, q, r, s for FinSequence;
 reserve R, R1, R2 for Rule;
 reserve A, A1, A2 for non empty set;
 reserve B, B1, B2 for set;
 reserve P, P1, P2 for Formula-sequence;
 reserve S, S1, S2 for Formula-finset;
 reserve C for Extension of B;
 reserve E for Extension of R;

theorem Th49:
  for B, R, t, S st (for a st a in S holds B, R |- a) & [S, t] in R
      holds B, R |- t
proof
  let B, R, t, S;
  assume that
    A1: for a st a in S holds B, R |- a and
    A2: [S, t] in R;
  consider S1 such that
    A3: S c= S1 and
    A4: S1 is (B, R)-derivable by A1, Th47;
  consider P1 such that
    A5: S1 = rng P1 and
    A6: P1 is (B, R)-correct by A4;
  set P2 = P1^<*t*>;
  take P2;
  rng <*t*> = {t} by FINSEQ_1:38;
  then t in rng <*t*> by TARSKI:def 1;
  then t in rng P1 \/ rng <*t*> by XBOOLE_0:def 3;
  hence t in rng P2 by FINSEQ_1:31;
  let k;
  assume k in dom P2;
  then per cases by FINSEQ_1:25;
    suppose A11: k in dom P1;
    then P1, k is_a_correct_step_wrt B, R by A6;
    then P1^<*>{}, k is_a_correct_step_wrt B, R by FINSEQ_1:34;
    hence thesis by A11, Lm41;
    end;
    suppose ex i st i in dom <*t*> & k = len P1+i;
    then consider i such that
      A20: i in dom <*t*> and
      A21: k = len P1+i;
    P2.k = <*t*>.i by A20, A21, FINSEQ_1:def 7;
    then P2.k in rng <*t*> by A20, FUNCT_1:3;
    then P2.k in {t} by FINSEQ_1:38;
    then A22: P2.k = t by TARSKI:def 1;
    i in {1} by A20, FINSEQ_1:2, FINSEQ_1:def 8;
    then A23: k = len P1+1 by A21, TARSKI:def 1;
    for t st t in S ex m st m in dom P2 & m < k & P2.m = t
      proof
      let t;
      assume t in S;
      then consider a such that
        A25: a in dom P1 and
        A26: P1.a = t by A3, A5, FUNCT_1:def 3;
      a in Seg len P1 by A25, FINSEQ_1:def 3;
      then reconsider m = a as Nat;
      take m;
      dom P1 c= dom P2 by FINSEQ_1:26;
      hence m in dom P2 by A25;
      m in Seg len P1 by A25, FINSEQ_1:def 3;
      then m <= len P1 by FINSEQ_1:1;
      hence m < k by A23, NAT_1:13;
      thus thesis by A25, A26, FINSEQ_1:def 7;
      end;
    hence thesis by A2, A22;
    end;
end;
