reserve A for QC-alphabet;
reserve i,j,k,l,m,n for Nat;
reserve a,b,e for set;
reserve t,u,v,w,z for QC-symbol of A;
reserve p,q,r,s for Element of CQC-WFF(A);
reserve x for Element of bound_QC-variables(A);
reserve ll for CQC-variable_list of k,A;
reserve P for QC-pred_symbol of k,A;
reserve f,h for Element of Funcs(bound_QC-variables(A),bound_QC-variables(A)),
  K,L for Element of Fin bound_QC-variables(A);

theorem Th20:
  index p = 0(A) iff p is closed
proof
  thus index p = 0(A) implies p is closed
  proof
    assume index p = 0(A);
    then 0(A) in NBI p by QC_LANG1:def 35;
    then
    consider t such that
A1:  t=0(A) & for u st t<=u holds not x.u in still_not-bound_in p;
    now
      set a =the  Element of still_not-bound_in p;
      assume
A2:   still_not-bound_in p <> {};
      then reconsider a as bound_QC-variable of A by TARSKI:def 3;
      consider u such that
A3:    x.u = a by QC_LANG3:30;
      not t <= u by A1,A2,A3;
      hence contradiction by A1,QC_LANG1:def 36;
    end;
    hence thesis by QC_LANG1:def 31;
  end;
  assume p is closed;
  then 0(A)<=t implies not x.t in still_not-bound_in p by QC_LANG1:def 31;
  then
A4: 0(A) in NBI p;
  0(A) = min NBI p
  proof
    assume min NBI p <> 0(A);
    then consider t such that
A5:  0(A) <> t & t = min NBI p;
    t <= 0(A) by A4,A5,QC_LANG1:def 35;
    then t < 0(A) by A5,QC_LANG1:def 34;
    then not 0(A) <= t by QC_LANG1:25;
    hence contradiction by QC_LANG1:def 36;
  end;
  hence thesis;
end;
