reserve Al for QC-alphabet;
reserve i,j,n,k,l for Nat;
reserve a for set;
reserve T,S,X,Y for Subset of CQC-WFF(Al);
reserve p,q,r,t,F,H,G for Element of CQC-WFF(Al);
reserve s for QC-formula of Al;
reserve x,y for bound_QC-variable of Al;
reserve f,g for FinSequence of [:CQC-WFF(Al),Proof_Step_Kinds:];

theorem Th24:
  1 <= n & n <= len g & g,n is_a_correct_step_wrt X implies
  (f^g),(n+len f) is_a_correct_step_wrt X
proof
  assume that
A1: 1 <= n and
A2: n <= len g and
A3: g,n is_a_correct_step_wrt X;
 n in Seg(len g) by A1,A2,FINSEQ_1:1;
then  n in dom g by FINSEQ_1:def 3;
then
A4: g.n = (f^g).(n+len f) by FINSEQ_1:def 7;
 n + len f <= len f + len g by A2,XREAL_1:6;
 then  n+len f <= len(f^g) by FINSEQ_1:22;
 then ((f^g).(n+len f))`2 = 0 or ... or ((f^g).(n+len f))`2 = 9
           by A1,Th19,NAT_1:12;
 then per cases;
  case
 ((f^g).(n+len f))`2 = 0;
    hence thesis by A3,A4,Def4;
  end;
  case
 ((f^g).(n+len f))`2 = 1;
    hence thesis by A3,A4,Def4;
  end;
  case
 ((f^g).(n+len f))`2 = 2;
    hence thesis by A3,A4,Def4;
  end;
  case
 ((f^g).(n+len f))`2 = 3;
    hence thesis by A3,A4,Def4;
  end;
  case
 ((f^g).(n+len f))`2 = 4;
    hence thesis by A3,A4,Def4;
  end;
  case
 ((f^g).(n+len f))`2 = 5;
    hence thesis by A3,A4,Def4;
  end;
  case
 ((f^g).(n+len f))`2 = 6;
    hence thesis by A3,A4,Def4;
  end;
  case
 ((f^g).(n+len f))`2 = 7;
    then consider i,j,r,t such that
A5: 1 <= i and
A6: i < n and
A7: 1 <= j and
A8: j < i and
A9: r = (g.j)`1 & t = (g.n)`1 & (g.i)`1 = r => t by A3,A4,Def4;
A10: 1 <= i+len f & i+len f < n+len f by A5,A6,NAT_1:12,XREAL_1:6;
A11: 1 <= j+len f & j+len f < i+len f by A7,A8,NAT_1:12,XREAL_1:6;
A12: i <= len g by A2,A6,XXREAL_0:2;
then A13: j <= len g by A8,XXREAL_0:2;
A14: i in Seg(len g) by A5,A12,FINSEQ_1:1;
A15: j in Seg(len g) by A7,A13,FINSEQ_1:1;
A16: i in dom g by A14,FINSEQ_1:def 3;
A17: j in dom g by A15,FINSEQ_1:def 3;
A18: g.i = (f^g).(i+len f) by A16,FINSEQ_1:def 7;
 g.j = (f^g).(j+len f) by A17,FINSEQ_1:def 7;
    hence thesis by A4,A9,A10,A11,A18;
  end;
  case
 ((f^g).(n+len f))`2 = 8;
    then consider i,r,t,x such that
A19: 1 <= i and
A20: i < n and
A21: (g.i)`1 = r => t & not x in still_not-bound_in r &
    (g.n)`1 = r => All(x,t)
    by A3,A4,Def4;
A22: 1 <= len f+i & len f+i < n+len f by A19,A20,NAT_1:12,XREAL_1:6;
 i <= len g by A2,A20,XXREAL_0:2;
then  i in Seg(len g) by A19,FINSEQ_1:1;
then  i in dom g by FINSEQ_1:def 3;
then  g.i = (f^g).(len f+i) by FINSEQ_1:def 7;
    hence thesis by A4,A21,A22;
  end;
  case
 ((f^g).(n+len f))`2 = 9;
    then consider i,x,y,s such that
A23: 1 <= i and
A24: i < n and
    A25: s
.x in CQC-WFF(Al) & s.y in CQC-WFF(Al) & ( not x in still_not-bound_in s)&
s.x = (g.i)`1 & (g.n)`1 = s.y by A3,A4,Def4;
A26: 1 <= len f+i & len f+i < n+len f by A23,A24,NAT_1:12,XREAL_1:6;
 i <= len g by A2,A24,XXREAL_0:2;
then  i in Seg(len g) by A23,FINSEQ_1:1;
then  i in dom g by FINSEQ_1:def 3;
then  g.i = (f^g).(len f+i) by FINSEQ_1:def 7;
    hence thesis by A4,A25,A26;
  end;
end;
