reserve Al for QC-alphabet;
reserve i,j,k for Nat,
  A,D for non empty set;
reserve f1,f2 for Element of Funcs(Valuations_in(Al,A),BOOLEAN),
  x,x1,y for bound_QC-variable of Al,
  v,v1 for Element of Valuations_in(Al,A);
reserve ll for CQC-variable_list of k,Al;
reserve p,q,s,t for Element of CQC-WFF(Al),
  J for interpretation of Al,A,
  P for QC-pred_symbol of k,Al,
  r for Element of relations_on A;
reserve u,w,z for Element of BOOLEAN;
reserve w,v2 for Element of Valuations_in(Al,A),
  z for bound_QC-variable of Al;
reserve u,w for Element of Valuations_in(Al,A);
reserve s9 for QC-formula of Al;

theorem Th31:
  x <> y & not x in still_not-bound_in s9 implies not x in
  still_not-bound_in (s9.y)
proof
  defpred PP[Element of QC-WFF(Al)] means x <> y &
    not x in still_not-bound_in ($1) implies
    not x in still_not-bound_in ($1.y);
A1: now
    let s be Element of QC-WFF(Al);
    thus s is atomic implies PP[s]
    proof
      assume that
A2:   s is atomic and
A3:   x <> y and
A4:   not x in still_not-bound_in s;
      thus not x in still_not-bound_in (s.y)
      proof
        set l = the_arguments_of s;
        set ll = Subst(l,(Al)a.0 .-->y);
A5:     still_not-bound_in s = still_not-bound_in l by A2,QC_LANG3:4
          .= variables_in(l, bound_QC-variables(Al)) by QC_LANG3:2
          .={l.k : 1<=k & k<=len l & l.k in bound_QC-variables(Al)} by
QC_LANG3:def 1;
A6:     x in {ll.k : 1 <= k & k <= len ll & ll.k in bound_QC-variables(Al)}
        implies x in {l.i : 1 <= i & i <= len l &
        l.i in bound_QC-variables(Al)}
        proof
          assume
          x in {ll.k : 1 <= k & k <= len ll & ll.k in bound_QC-variables(Al)};
          then consider k such that
A7:       x = ll.k and
A8:       1 <= k and
A9:       k <= len ll and
          ll.k in bound_QC-variables(Al);
A10:      k <= len l by A9,CQC_LANG:def 1;
          then x = l.k by A3,A7,A8,CQC_LANG:3;
          hence thesis by A8,A10;
        end;
A11:    s.y = (the_pred_symbol_of s)!Subst(l,(Al)a.0 .-->y) by A2,CQC_LANG:16;
A12:    s.y is atomic & the_arguments_of s.y = ll
        proof
          consider k being Nat, p being (QC-pred_symbol of k,Al), l2
          being QC-variable_list of k,Al such that
A13:      s = p!l2 by A2,QC_LANG1:def 18;
          l2 = l by A2,A13,QC_LANG1:def 23;
          then reconsider l3 = Subst(l,(Al)a.0 .-->y)
            as QC-variable_list of k,Al;
A14:      s.y = p!l3 by A2,A11,A13,QC_LANG1:def 22;
          hence s.y is atomic by QC_LANG1:def 18;
          hence thesis by A14,QC_LANG1:def 23;
        end;
        then still_not-bound_in the_arguments_of s.y = variables_in(ll,
        bound_QC-variables(Al)) by QC_LANG3:2
          .={ll.k : 1<=k & k<= len ll & ll.k in bound_QC-variables(Al)} by
QC_LANG3:def 1;
        hence thesis by A4,A5,A12,A6,QC_LANG3:4;
      end;
    end;
    thus PP[VERUM(Al)] by CQC_LANG:15;
    thus s is negative & PP[the_argument_of s] implies PP[s]
    proof
      assume that
A15:  s is negative and
A16:  ( x <> y & not x in still_not-bound_in (the_argument_of s)
implies not x in still_not-bound_in ((the_argument_of s).y))& x <> y & not x in
      still_not-bound_in s;
      not x in still_not-bound_in 'not'((the_argument_of s).y) by A15,A16,
QC_LANG3:6,7;
      hence thesis by A15,CQC_LANG:18;
    end;
    thus s is conjunctive & PP[the_left_argument_of s] & PP[
    the_right_argument_of s] implies PP[s]
    proof
      assume that
A17:  s is conjunctive and
A18:  ( x <> y & not x in still_not-bound_in (the_left_argument_of s)
implies not x in still_not-bound_in ((the_left_argument_of s).y))&( x <> y &
      not x in still_not-bound_in (the_right_argument_of s) implies not x in
      still_not-bound_in ((the_right_argument_of s).y)) & x <> y & not x in
      still_not-bound_in s;
      still_not-bound_in s = (still_not-bound_in (the_left_argument_of s)
      ) \/ (still_not-bound_in (the_right_argument_of s)) by A17,QC_LANG3:9;
      then not x in still_not-bound_in ((the_left_argument_of s).y) \/
      still_not-bound_in ((the_right_argument_of s).y) by A18,XBOOLE_0:def 3;
      then not x in (still_not-bound_in ((the_left_argument_of s).y) '&' ((
      the_right_argument_of s).y)) by QC_LANG3:10;
      hence thesis by A17,CQC_LANG:20;
    end;
    thus s is universal & PP[the_scope_of s] implies PP[s]
    proof
      assume that
A19:  s is universal and
A20:  x <> y & not x in still_not-bound_in (the_scope_of s) implies
      not x in still_not-bound_in ((the_scope_of s).y) and
A21:  x <> y and
A22:  not x in still_not-bound_in s;
A23:  still_not-bound_in s = still_not-bound_in (the_scope_of s) \ {
      bound_in s} by A19,QC_LANG3:11;
      thus not x in still_not-bound_in (s.y)
      proof
A24:    now
          still_not-bound_in All(x,(the_scope_of s).y) =
          still_not-bound_in ((the_scope_of s).y) \ {x} by QC_LANG3:12;
          then
A25:      not x in still_not-bound_in All(x,(the_scope_of s).y) iff not x
in still_not-bound_in ((the_scope_of s).y) or x in {x} by XBOOLE_0:def 5;
          assume x in {bound_in s};
          then x = bound_in s by TARSKI:def 1;
          hence thesis by A19,A21,A25,CQC_LANG:23,TARSKI:def 1;
        end;
        now
          assume not x in still_not-bound_in (the_scope_of s);
          then
          not x in still_not-bound_in ((the_scope_of s).y) \ {bound_in s}
          by A20,A21,XBOOLE_0:def 5;
          then not x in still_not-bound_in All(bound_in s,(the_scope_of s).y)
          by QC_LANG3:12;
          hence thesis by A19,A22,CQC_LANG:22,23;
        end;
        hence thesis by A22,A23,A24,XBOOLE_0:def 5;
      end;
    end;
  end;
  for s being Element of QC-WFF(Al) holds PP[s] from QC_LANG1:sch 2 (A1);
  hence thesis;
end;
