reserve k,m,n for Element of NAT,
  i, j for Nat,
  a, b, c for object,
  X, Y, Z for set,
  D, D1, D2 for non empty set;
reserve p, q, r, s for FinSequence;
reserve t, u, v, w for GRZ-formula;
reserve R, R1, R2 for GRZ-rule;
reserve A, A1, A2 for non empty Subset of GRZ-formula-set;
reserve B, B1, B2 for Subset of GRZ-formula-set;
reserve P, P1, P2 for GRZ-formula-sequence;
reserve S, S1, S2 for GRZ-formula-finset;

theorem Th48:
  for A, R, t, S st A, R |- S & [S, t] in R holds A, R |- t
proof
  let A, R, t, S;
  assume that
    A1: A, R |- S and
    A2: [S, t] in R;
  consider S1 such that
    A3: S c= S1 and
    A4: S1 is (A, R)-correct by A1, Th47;
  consider P1 such that
    A5: S1 = rng P1 and
    A6: P1 is (A, R)-correct by A4;
  set P2 = P1^<*t*>;
  rng P1 \/ rng <*t*> c= GRZ-formula-set by XBOOLE_1:8;
  then rng P2 c= GRZ-formula-set by FINSEQ_1:31;
  then reconsider P2 as GRZ-formula-sequence by FINSEQ_1:def 4;
  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;
  reconsider j = k as Nat;
  assume k in dom P2;
  then per cases by FINSEQ_1:25;
    suppose A11: j in dom P1;
    then P1, k is_a_correct_step_wrt A, R by A6;
    then P1^<*>GRZ-formula-set, k is_a_correct_step_wrt A, R
        by FINSEQ_1:34;
    hence thesis by A11, Lm41;
    end;
    suppose ex i st i in dom <*t*> & j = len P1+i;
    then consider i such that
      A20: i in dom <*t*> and
      A21: j = len P1+i;
    P2.j = <*t*>.i by A20, A21, FINSEQ_1:def 7;
    then P2.j in rng <*t*> by A20, FUNCT_1:3;
    then P2.j in {t} by FINSEQ_1:38;
    then A22: P2.j = t by TARSKI:def 1;
    i in {1} by A20, FINSEQ_1:2, FINSEQ_1:def 8;
    then A23: j = len P1+1 by A21, TARSKI:def 1;
    for q st q in S ex m st m in dom P2 & m < k & P2.m = q
      proof
      let q;
      assume q in S;
      then consider a such that
        A25: a in dom P1 and
        A26: P1.a = q by A3, A5, FUNCT_1:def 3;
      reconsider m = a as Element of NAT by A25;
      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;
