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 Th27:
  f is_a_proof_wrt X & 1 <= l & l <= len f implies (f.l)`1 in Cn(X)
proof
  assume that
A1: f is_a_proof_wrt X and
A2: 1 <= l & l <= len f;
 for n holds 1 <= n & n <= len f implies (f.n)`1 in Cn(X)
  proof
    defpred P[Nat] means 1 <= $1 & $1 <= len f implies (f.$1)`1 in Cn(X);
A3: for n being Nat st for k being Nat st k < n holds P[k] holds P[n]
    proof
      let n be Nat;
      assume
A4:   for k being Nat st k < n holds P[k];
      assume that
A5:   1 <= n and
A6:   n <= len f;
A7:   f,n is_a_correct_step_wrt X by A1,A5,A6;
  now
    (f.n)`2 = 0 or ... or (f.n)`2 = 9 by A5,A6,Th19;
   then per cases;
        suppose
      (f.n)`2 = 0;
then A8:      (f.n)`1 in X by A7,Def4;
      X c= Cn(X) by Th13;
          hence thesis by A8;
        end;
        suppose
      (f.n)`2 = 1;
then       (f.n)`1 = VERUM(Al) by A7,Def4;
          hence thesis by Th2;
        end;
        suppose
      (f.n)`2 = 2;
then       ex p st (f.n)`1 = ('not' p => p) => p by A7,Def4;
          hence thesis by Th3;
        end;
        suppose
      (f.n)`2 = 3;
then       ex p,q st (f.n)`1 = p => ('not' p => q) by A7,Def4;
          hence thesis by Th4;
        end;
        suppose
      (f.n)`2 = 4;
then       ex p,q,r st (f.n)`1 = (p => q) => ('not'(q '&' r) => 'not'
          (p '&' r)) by A7,Def4;
          hence thesis by Th5;
        end;
        suppose
      (f.n)`2 = 5;
then       ex p,q st (f.n)`1 = p '&' q => q '&' p by A7,Def4;
          hence thesis by Th6;
        end;
        suppose
      (f.n)`2 = 6;
then       ex p,x st (f.n)`1 = All(x,p) => p by A7,Def4;
          hence thesis by Th8;
        end;
        suppose
      (f.n)`2 = 7;
          then consider i,j,p,q such that
A9:      1 <= i and
A10:      i < n and
A11:      1 <= j and
A12:      j < i and
A13:      p = (f.j)`1 & q = (f.n)`1 & (f.i)`1 = p => q by A7,Def4;
A14:      j < n by A10,A12,XXREAL_0:2;
A15:      i <= len f by A6,A10,XXREAL_0:2;
then       j <= len f by A12,XXREAL_0:2;
then A16:      (f.j)`1 in Cn(X) by A4,A11,A14;
      (f.i)`1 in Cn(X) by A4,A9,A10,A15;
          hence thesis by A13,A16,Th7;
        end;
        suppose
      (f.n)`2 = 8;
          then consider i,p,q,x such that
A17:      1 <= i and
A18:      i < n and
          A19:      (
f.i)`1 = p => q & not x in still_not-bound_in p & (f.n)`1 = p => All(x,
          q)
          by A7,Def4;
      i <= len f by A6,A18,XXREAL_0:2;
          hence thesis by A4,A17,A18,A19,Th9;
        end;
        suppose
      (f.n)`2 = 9;
          then consider i,x,y,s such that
A20:      1 <= i and
A21:      i < n and
          A22:      s
.x in CQC-WFF(Al) & s.y in CQC-WFF(Al) & ( not x in still_not-bound_in s)&
s.x = (f.i)`1 & (f.n)`1 = s.y by A7,Def4;
      i <= len f by A6,A21,XXREAL_0:2;
          hence thesis by A4,A20,A21,A22,Th10;
        end;
      end;
      hence thesis;
    end;
 for n being Nat holds P[n] from NAT_1:sch 4(A3);
    hence thesis;
  end;
  hence thesis by A2;
end;
