reserve Al for QC-alphabet;
reserve PHI for Consistent Subset of CQC-WFF(Al),
        p,q,r,s for Element of CQC-WFF(Al),
        A for non empty set,
        J for interpretation of Al,A,
        v for Element of Valuations_in(Al,A),
        m,n,i,j,k for Nat,
        l for CQC-variable_list of k,Al,
        P for QC-pred_symbol of k,Al,
        x,y,z for bound_QC-variable of Al,
        b for QC-symbol of Al,
        PR for FinSequence of [:set_of_CQC-WFF-seq(Al),Proof_Step_Kinds:];
reserve Al2 for Al-expanding QC-alphabet,
        J2 for interpretation of Al2,A,
        Jp for interpretation of Al,A,
        v2 for Element of Valuations_in(Al2,A),
        vp for Element of Valuations_in(Al,A);

theorem Th15:
  for p2 being Element of CQC-WFF(Al2), S being CQC_Substitution of Al,
  S2 being CQC_Substitution of Al2, x2 being bound_QC-variable of Al2, x, p
  st p = p2 & S = S2 & x = x2 holds ExpandSub(x,p,RestrictSub(x,All(x,p),S))
  = ExpandSub(x2,p2,RestrictSub(x2,All(x2,p2),S2))
proof
  let p2 be Element of CQC-WFF(Al2), S being CQC_Substitution of Al,
   S2 being CQC_Substitution of Al2, x2 being bound_QC-variable of Al2, x, p
   such that
A1: p = p2 & S = S2 & x = x2;
  set rsub = RestrictSub(x,All(x,p),S);
  set rsub2 = RestrictSub(x2,All(x2,p2),S2);
  set esub = ExpandSub(x,p,rsub);
  set esub2 = ExpandSub(x2,p2,rsub2);
  set uv = upVar(rsub,p);
  set uv2 = upVar(rsub2,p2);
A2: x.uv =[4,uv] by QC_LANG3:def 2 .= [4,uv2] by A1,Th13,Th14
  .= x.uv2 by QC_LANG3:def 2;
  per cases;
  suppose
A3: not x in rng rsub;
    then not x2 in rng rsub2 by A1,Th13;
    hence esub2 = rsub2 \/ {[x2,x2]} by SUBSTUT1:def 13
     .= rsub \/ {[x,x]} by A1,Th13 .= esub by A3,SUBSTUT1:def 13;
  end;
  suppose
A4: x in rng rsub;
    then x2 in rng rsub2 by A1,Th13;
    hence esub2 = rsub2 \/ {[x2,(x.uv2)]} by SUBSTUT1:def 13
    .= rsub \/ {[x,(x.uv)]} by A1,Th13,A2
    .= esub by A4,SUBSTUT1:def 13;
  end;
end;
