reserve Al for QC-alphabet;
reserve a,b,c,d for object,
  i,k,n for Nat,
  p,q for Element of CQC-WFF(Al),
  x,y,y1 for bound_QC-variable of Al,
  A for non empty set,
  J for interpretation of Al,A,
  v,w for Element of Valuations_in(Al,A),
  f,g for Function,
  P,P9 for QC-pred_symbol of k,Al,
  ll,ll9 for CQC-variable_list of k,Al,
  l1 for FinSequence of QC-variables(Al),
  Sub,Sub9,Sub1 for CQC_Substitution of Al,
  S,S9,S1,S2 for Element of CQC-Sub-WFF(Al),
  s for QC-symbol of Al;
reserve vS,vS1,vS2 for Val_Sub of A,Al;
reserve B for Element of [:QC-Sub-WFF(Al),bound_QC-variables(Al):],
  SQ for second_Q_comp of B;
reserve B for CQC-WFF-like Element of [:QC-Sub-WFF(Al),
  bound_QC-variables(Al):],
  xSQ for second_Q_comp of [S,x],
  SQ for second_Q_comp of B;
reserve B1 for Element of [:QC-Sub-WFF(Al),bound_QC-variables(Al):];
reserve SQ1 for second_Q_comp of B1;

theorem Th38:
  [S,x] is quantifiable & x in rng RestrictSub(x,All(x,S`1),xSQ)
implies not S_Bound(@CQCSub_All([S,x],xSQ)) in rng RestrictSub(x,All(x,S`1),xSQ
  ) & not S_Bound(@CQCSub_All([S,x],xSQ)) in Bound_Vars(S`1)
proof
  set S1 = CQCSub_All([S,x],xSQ);
  assume that
A1: [S,x] is quantifiable and
A2: x in rng RestrictSub(x,All(x,S`1),xSQ);
A3: S1 = Sub_All([S,x],xSQ) by A1,Def5;
  then S1`1 = All([S,x]`2,([S,x]`1)`1) by A1,Th26;
  then
A4: S1`1 = All(x,([S,x]`1)`1);
  then
A5: bound_in S1`1 = x by QC_LANG2:7;
  set finSub = RestrictSub(bound_in S1`1,S1`1,S1`2);
A6: Dom_Bound_Vars(the_scope_of S1`1) = {s : x.s in Bound_Vars(the_scope_of
  S1`1)} by SUBSTUT1:def 9;
  S1`2 = xSQ by A1,A3,Th26;
  then
A7: finSub = RestrictSub(x,All(x,S`1),xSQ) by A4,A5;
  set Y = Dom_Bound_Vars(the_scope_of S1`1) \/ Sub_Var(finSub);
  set n = upVar(finSub,the_scope_of S1`1);
  NSub(the_scope_of S1`1,finSub) = NAT \ Y by SUBSTUT1:def 11;
  then reconsider X = NAT \ Y as non empty Subset of QC-symbols(Al);
A8: n in NSub(the_scope_of S1`1,finSub)
  proof
    upVar(finSub,the_scope_of S1`1) = the Element of
     NSub(the_scope_of S1`1,finSub) by SUBSTUT1:def 12;
    hence thesis;
  end;
  Dom_Bound_Vars(the_scope_of S1`1) c= Dom_Bound_Vars(the_scope_of S1`1)
   \/ Sub_Var(finSub) & n in NAT\(Dom_Bound_Vars(the_scope_of S1`1)
   \/ Sub_Var(finSub)) by A8,SUBSTUT1:def 11,XBOOLE_1:7;
  then not n in Dom_Bound_Vars(the_scope_of S1`1) by XBOOLE_0:def 5;
  then
A9: not x.n in Bound_Vars(the_scope_of S1`1) by A6;
  S1`1 = All(x,S`1) by A4;
  then
A10: not x.upVar(finSub,the_scope_of S1`1) in Bound_Vars(S`1) by A9,QC_LANG2:7;
  Sub_Var(finSub) c= Y & n in NAT\(Dom_Bound_Vars(the_scope_of S1`1)
  \/ Sub_Var(finSub)) by A8,SUBSTUT1:def 11,XBOOLE_1:7;
  then
A11: not n in Sub_Var(finSub) by XBOOLE_0:def 5;
  Sub_Var(finSub) = {s : x.s in rng finSub} by SUBSTUT1:def 10;
  then
A12: not x.upVar(finSub,the_scope_of S1`1) in rng finSub by A11;
  S1 = @S1 by SUBSTUT1:def 35;
  hence thesis by A2,A5,A7,A12,A10,SUBSTUT1:def 36;
end;
