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 Th30:
  x <> y & p = s9.x & q = s9.y implies for v st v.x = v.y holds
  Valid(p,J).v = Valid(q,J).v
proof
  defpred PP[Element of QC-WFF(Al)] means
    for x,y,p,q st x <> y & p = $1.x & q =$1.y holds
    for v st v.x = v.y holds Valid(p,J).v = Valid(q,J).v;
A1: now
    let s be Element of QC-WFF(Al);
    thus s is atomic implies PP[s]
    proof
      assume
A2:   s is atomic;
      thus for x,y,p,q st x <> y & p = s.x & q = s.y holds for v st v.x = v.y
      holds Valid(p,J).v = Valid(q,J).v
      proof
        consider k being Nat, P being (QC-pred_symbol of k,Al), l
        being QC-variable_list of k,Al such that
A3:     s = P!l by A2,QC_LANG1:def 18;
        let x,y,p,q such that
        x <> y and
A4:     p = s.x and
A5:     q = s.y;
        set lx = Subst(l, (Al)a.0 .-->x), ly = Subst(l, (Al)a.0 .-->y);
        let v such that
A6:     v.x = v.y;
A7:     p = P!Subst(l, (Al)a.0 .-->x) by A4,A3,CQC_LANG:17;
        then
A8:     {lx.i : 1 <= i & i <= len lx & lx.i in free_QC-variables(Al)} = {} by
CQC_LANG:7;
A9:     q = P!Subst(l, (Al)a.0 .-->y) by A5,A3,CQC_LANG:17;
        then
A10:    {ly.i : 1 <= i & i <= len ly & ly.i in free_QC-variables(Al)} = {} by
CQC_LANG:7;
A11:    {ly.j : 1 <= j & j <= len ly & ly.j in fixed_QC-variables(Al)} = {}
        by A9,CQC_LANG:7;
        {lx.j : 1 <= j & j <= len lx & lx.j in fixed_QC-variables(Al)} = {}
        by A7,CQC_LANG:7;
        then reconsider lx,ly as CQC-variable_list of k,Al by A8,A10,A11,
CQC_LANG:5;
A12:    len (v*'lx) = k by Def3;
A13:    now
          let i be Nat;
          assume that
A14:      1 <= i and
A15:      i <= len (v*'lx);
A16:      i <= len l by A12,A15,CARD_1:def 7;
A17:      now
            assume l.i <> (Al)a.0;
            then
A18:        lx.i = l.i & ly.i = l.i by A14,A16,CQC_LANG:3;
            v.(lx.i) = (v*'lx).i by A12,A14,A15,Def3;
            hence (v*'lx).i = (v*'ly).i by A12,A14,A15,A18,Def3;
          end;
          now
            assume l.i = (Al)a.0;
            then
A19:        lx.i = x & ly.i = y by A14,A16,CQC_LANG:3;
            v.(lx.i) = (v*'lx).i by A12,A14,A15,Def3;
            hence (v*'lx).i = (v*'ly).i by A6,A12,A14,A15,A19,Def3;
          end;
          hence (v*'lx).i = (v*'ly).i by A17;
        end;
        len (v*'ly) = k by Def3;
        then
A20:    v*'lx = v*'ly by A12,A13,FINSEQ_1:14;
A21:    now
          assume Valid(p,J).v = FALSE;
          then not v*'lx in J.P by A7,Th8;
          hence Valid(q,J).v = FALSE by A9,A20,Th8;
        end;
        now
          assume Valid(p,J).v = TRUE;
          then v*'lx in J.P by A7,Th7;
          hence Valid(q,J).v = TRUE by A9,A20,Th7;
        end;
        hence thesis by A21,XBOOLEAN:def 3;
      end;
    end;
    thus PP[VERUM(Al)]
    proof
      let x,y,p,q such that
      x <> y and
A22:  p = VERUM(Al).x and
A23:  q = VERUM(Al).y;
      let v such that
      v.x = v.y;
      p = VERUM(Al) by A22,CQC_LANG:15;
      hence thesis by A23,CQC_LANG:15;
    end;
    thus s is negative & PP[the_argument_of s] implies PP[s]
    proof
      assume that
A24:  s is negative and
A25:  for x,y,p,q st x <> y & p = (the_argument_of s).x & q = (
the_argument_of s).y holds for v st v.x = v.y holds Valid(p,J).v = Valid(q,J).v
      ;
      thus for x,y,p,q st x <> y & p = s.x & q = s.y holds for v st v.x = v.y
      holds Valid(p,J).v = Valid(q,J).v
      proof
        let x,y,p,q such that
        x <> y and
A26:    p = s.x and
A27:    q = s.y;
A28:    s.y = 'not' ((the_argument_of s).y) by A24,CQC_LANG:18;
        then reconsider
        qa = (the_argument_of s).y as Element of CQC-WFF(Al)
          by A27,CQC_LANG:8;
A29:    s.x = 'not'((the_argument_of s).x) by A24,CQC_LANG:18;
        then reconsider
        pa = (the_argument_of s).x as Element of CQC-WFF(Al)
          by A26,CQC_LANG:8;
        let v such that
A30:    v.x = v.y;
A31:    now
          assume Valid(p,J).v = FALSE;
          then 'not'(Valid(pa,J).v) = FALSE by A26,A29,Th10;
          then Valid(pa,J).v = TRUE by MARGREL1:11;
          then Valid(qa,J).v = TRUE by A25,A30;
          then 'not'(Valid(qa,J).v) = FALSE by MARGREL1:11;
          hence Valid(q,J).v = FALSE by A27,A28,Th10;
        end;
        now
          assume Valid(p,J).v = TRUE;
          then 'not'(Valid(pa,J).v) = TRUE by A26,A29,Th10;
          then Valid(pa,J).v = FALSE by MARGREL1:11;
          then Valid(qa,J).v = FALSE by A25,A30;
          then 'not'(Valid(qa,J).v) = TRUE by MARGREL1:11;
          hence Valid(q,J).v = TRUE by A27,A28,Th10;
        end;
        hence thesis by A31,XBOOLEAN:def 3;
      end;
    end;
    thus s is conjunctive & PP[the_left_argument_of s] & PP[
    the_right_argument_of s] implies PP[s]
    proof
      assume that
A32:  s is conjunctive and
A33:  for x,y,p,q st x <> y & p = (the_left_argument_of s).x & q = (
the_left_argument_of s).y holds for v st v.x = v.y holds Valid(p,J).v = Valid(q
      ,J).v and
A34:  for x,y,p,q st x <> y & p = (the_right_argument_of s).x & q = (
the_right_argument_of s).y holds for v st v.x = v.y holds Valid(p,J).v = Valid(
      q,J).v;
      thus for x,y,p,q st x <> y & p = s.x & q = s.y holds for v st v.x = v.y
      holds Valid(p,J).v = Valid(q,J).v
      proof
        let x,y,p,q such that
        x <> y and
A35:    p = s.x and
A36:    q = s.y;
A37:    s.x=((the_left_argument_of s).x) '&' ((the_right_argument_of s).x
        ) by A32,CQC_LANG:20;
        then reconsider pla = (the_left_argument_of s).x, pra = (
        the_right_argument_of s).x as Element of CQC-WFF(Al)
          by A35,CQC_LANG:9;
A38:    s.y=((the_left_argument_of s).y) '&' ((the_right_argument_of s).y
        ) by A32,CQC_LANG:20;
        then reconsider qla = (the_left_argument_of s).y, qra = (
        the_right_argument_of s).y as Element of CQC-WFF(Al)
          by A36,CQC_LANG:9;
        let v such that
A39:    v.x = v.y;
A40:    now
          assume
A41:      Valid(p,J).v = FALSE;
A42:      now
            assume Valid(pla,J).v = FALSE;
            then Valid(qla,J).v = FALSE by A33,A39;
            then (Valid(qla,J).v) '&' (Valid(qra,J).v) = FALSE by MARGREL1:12;
            hence thesis by A36,A38,A41,Th12;
          end;
A43:      now
            assume Valid(pra,J).v = FALSE;
            then Valid(qra,J).v = FALSE by A34,A39;
            then (Valid(qla,J).v) '&' (Valid(qra,J).v) = FALSE by MARGREL1:12;
            hence thesis by A36,A38,A41,Th12;
          end;
          (Valid(pla,J).v) '&' (Valid(pra,J).v) = FALSE by A35,A37,A41,Th12;
          hence thesis by A42,A43,MARGREL1:12;
        end;
        now
          assume Valid(p,J).v = TRUE;
          then
A44:      (Valid(pla,J).v) '&' (Valid(pra,J).v) = TRUE by A35,A37,Th12;
          then Valid(pra,J).v = TRUE by MARGREL1:12;
          then
A45:      Valid(qra,J).v = TRUE by A34,A39;
          Valid(pla,J).v = TRUE by A44,MARGREL1:12;
          then Valid(qla,J).v = TRUE by A33,A39;
          then (Valid(qla,J).v) '&' (Valid(qra,J).v) = TRUE by A45;
          hence Valid(q,J).v = TRUE by A36,A38,Th12;
        end;
        hence thesis by A40,XBOOLEAN:def 3;
      end;
    end;
    thus s is universal & PP[the_scope_of s] implies PP[s]
    proof
      assume that
A46:  s is universal and
A47:  for x,y,p,q st x<>y & p = (the_scope_of s).x & q = (
the_scope_of s).y holds for v st v.x = v.y holds Valid(p,J).v = Valid(q,J).v;
      consider xx being bound_QC-variable of Al,
      pp being Element of QC-WFF(Al) such that
A48:  s = All(xx,pp) by A46,QC_LANG1:def 21;
A49:  xx = bound_in s by A46,A48,QC_LANG1:def 27;
      thus for x,y,p,q st x <> y & p = s.x & q = s.y holds for v st v.x = v.y
      holds Valid(p,J).v = Valid(q,J).v
      proof
        let x,y,p,q such that
        x <> y and
A50:    p = s.x and
A51:    q = s.y;
        let v such that
A52:    v.x = v.y;
A53:    now
          assume
A54:      x <> bound_in s;
          then s.x = All(bound_in s, (the_scope_of s).x) by A46,CQC_LANG:23;
          then reconsider
          ps = (the_scope_of s).x as Element of CQC-WFF(Al) by A50,CQC_LANG:13;
A55:      All(bound_in s, ps) = p by A46,A50,A54,CQC_LANG:23;
A56:      now
            assume
A57:        y <> bound_in s;
            then s.y = All(bound_in s, (the_scope_of s).y) by A46,CQC_LANG:23;
            then reconsider
            qs = (the_scope_of s).y as Element of CQC-WFF(Al)
              by A51,CQC_LANG:13;
A58:        Valid(All(bound_in s, qs),J) = FOR_ALL(bound_in s, Valid(qs,
            J)) by Lm1;
A59:        Valid(All(bound_in s, ps),J) = FOR_ALL(bound_in s, Valid(ps,
            J)) by Lm1;
A60:        All(bound_in s, qs) = q by A46,A51,A57,CQC_LANG:23;
A61:        now
              assume
A62:          Valid(p,J).v = TRUE;
              for v1 st for y st (bound_in s) <> y holds v1.y = v.y
              holds Valid(qs,J).v1 = TRUE
              proof
                let v1;
                assume
A63:            for y st (bound_in s) <> y holds v1.y = v.y;
                then
A64:            v1.x = v.x & v1.y = v.y by A54,A57;
                Valid(ps,J).v1 = TRUE by A55,A59,A62,A63,Th3;
                hence thesis by A47,A52,A64;
              end;
              hence Valid(q,J).v = TRUE by A60,A58,Th3;
            end;
            now
              assume
A65:          Valid(p,J).v = FALSE;
              ex v1 st Valid(qs,J).v1 = FALSE & for y st (bound_in s) <>
              y holds v1.y = v.y
              proof
                consider v1 such that
A66:            Valid(ps,J).v1 = FALSE and
A67:            for y st (bound_in s) <> y holds v1.y = v.y by A55,A59,A65,Th2;
                v1.x = v.x & v1.y = v.y by A54,A57,A67;
                then Valid(qs,J).v1 = FALSE by A47,A52,A66;
                hence thesis by A67;
              end;
              hence Valid(q,J).v = FALSE by A60,A58,Th2;
            end;
            hence thesis by A61,XBOOLEAN:def 3;
          end;
          now
            assume
A68:        y = bound_in s;
            then q = All(y,pp) by A48,A49,A51,CQC_LANG:24;
            hence thesis by A48,A49,A50,A68,CQC_LANG:27;
          end;
          hence thesis by A56;
        end;
        now
          assume
A69:      x = bound_in s;
          then p = All(x,pp) by A48,A49,A50,CQC_LANG:24;
          hence thesis by A48,A49,A51,A69,CQC_LANG:27;
        end;
        hence thesis by A53;
      end;
    end;
  end;
  for s being Element of QC-WFF(Al) holds PP[s] from QC_LANG1:sch 2 (A1);
  hence thesis;
end;
