Article SUBSTUT2, MML version 4.99.1005

:: SUBSTUT2:th 1
theorem
for b1 being Element of vSUB holds
   ex b2 being Element of CQC-Sub-WFF st
      b2 `1 = VERUM & b2 `2 = b1;

:: SUBSTUT2:th 2
theorem
for b1 being Element of NAT
for b2 being Element of b1 -ary_QC-pred_symbols
for b3 being CQC-variable_list-like QC-variable_list of b1
for b4 being Element of vSUB holds
   ex b5 being Element of CQC-Sub-WFF st
      b5 `1 = b2 ! b3 & b5 `2 = b4;

:: SUBSTUT2:th 3
theorem
for b1 being Element of NAT
for b2 being Element of b1 -ary_QC-pred_symbols
for b3, b4 being Element of NAT
      st b2 is Element of b3 -ary_QC-pred_symbols & b2 is Element of b4 -ary_QC-pred_symbols
   holds b3 = b4;

:: SUBSTUT2:th 4
theorem
for b1 being Element of CQC-WFF
   st for b2 being Element of vSUB holds
        ex b3 being Element of CQC-Sub-WFF st
           b3 `1 = b1 & b3 `2 = b2
for b2 being Element of vSUB holds
   ex b3 being Element of CQC-Sub-WFF st
      b3 `1 = 'not' b1 & b3 `2 = b2;

:: SUBSTUT2:th 5
theorem
for b1, b2 being Element of CQC-WFF
   st (for b3 being Element of vSUB holds
         ex b4 being Element of CQC-Sub-WFF st
            b4 `1 = b1 & b4 `2 = b3) &
      (for b3 being Element of vSUB holds
         ex b4 being Element of CQC-Sub-WFF st
            b4 `1 = b2 & b4 `2 = b3)
for b3 being Element of vSUB holds
   ex b4 being Element of CQC-Sub-WFF st
      b4 `1 = b1 '&' b2 & b4 `2 = b3;

:: SUBSTUT2:funcnot 1 => SUBSTUT2:func 1
definition
  let a1 be Element of CQC-WFF;
  let a2 be Element of vSUB;
  redefine func [a1, a2] -> Element of [:QC-WFF,vSUB:];
end;

:: SUBSTUT2:th 6
theorem
for b1 being Element of CQC-WFF
for b2 being Element of bound_QC-variables
for b3 being Element of vSUB holds
   proj1 RestrictSub(b2,All(b2,b1),b3) misses {b2};

:: SUBSTUT2:th 7
theorem
for b1 being Element of CQC-WFF
for b2 being Element of bound_QC-variables
for b3 being Element of vSUB
      st b2 in proj2 RestrictSub(b2,All(b2,b1),b3)
   holds S_Bound [All(b2,b1),b3] = x. upVar(RestrictSub(b2,All(b2,b1),b3),b1);

:: SUBSTUT2:th 8
theorem
for b1 being Element of CQC-WFF
for b2 being Element of bound_QC-variables
for b3 being Element of vSUB
      st not b2 in proj2 RestrictSub(b2,All(b2,b1),b3)
   holds S_Bound [All(b2,b1),b3] = b2;

:: SUBSTUT2:th 9
theorem
for b1 being Element of CQC-WFF
for b2 being Element of bound_QC-variables
for b3 being Element of vSUB holds
   ExpandSub(b2,b1,RestrictSub(b2,All(b2,b1),b3)) = (@ RestrictSub(b2,All(b2,b1),b3)) +* (b2 | S_Bound [All(b2,b1),b3]);

:: SUBSTUT2:th 10
theorem
for b1 being Element of CQC-WFF
for b2 being Element of bound_QC-variables
for b3 being Element of vSUB
for b4 being Element of CQC-Sub-WFF
      st b4 `2 = (@ RestrictSub(b2,All(b2,b1),b3)) +* (b2 | S_Bound [All(b2,b1),b3]) &
         b4 `1 = b1
   holds [b4,b2] is quantifiable &
    (ex b5 being Element of CQC-Sub-WFF st
       b5 = [All(b2,b1),b3]);

:: SUBSTUT2:th 11
theorem
for b1 being Element of CQC-WFF
for b2 being Element of bound_QC-variables
   st for b3 being Element of vSUB holds
        ex b4 being Element of CQC-Sub-WFF st
           b4 `1 = b1 & b4 `2 = b3
for b3 being Element of vSUB holds
   ex b4 being Element of CQC-Sub-WFF st
      b4 `1 = All(b2,b1) & b4 `2 = b3;

:: SUBSTUT2:th 12
theorem
for b1 being Element of CQC-WFF
for b2 being Element of vSUB holds
   ex b3 being Element of CQC-Sub-WFF st
      b3 `1 = b1 & b3 `2 = b2;

:: SUBSTUT2:funcnot 2 => SUBSTUT2:func 2
definition
  let a1 be Element of CQC-WFF;
  let a2 be Element of vSUB;
  redefine func [a1, a2] -> Element of CQC-Sub-WFF;
end;

:: SUBSTUT2:funcnot 3 => SUBSTUT2:func 3
definition
  let a1, a2 be Element of bound_QC-variables;
  func Sbst(A1,A2) -> Element of vSUB equals
    a1 .--> a2;
end;

:: SUBSTUT2:def 1
theorem
for b1, b2 being Element of bound_QC-variables holds
Sbst(b1,b2) = b1 .--> b2;

:: SUBSTUT2:funcnot 4 => SUBSTUT2:func 4
definition
  let a1 be Element of CQC-WFF;
  let a2, a3 be Element of bound_QC-variables;
  func A1 .(A2,A3) -> Element of CQC-WFF equals
    CQC_Sub [a1,Sbst(a2,a3)];
end;

:: SUBSTUT2:def 2
theorem
for b1 being Element of CQC-WFF
for b2, b3 being Element of bound_QC-variables holds
b1 .(b2,b3) = CQC_Sub [b1,Sbst(b2,b3)];

:: SUBSTUT2:sch 1
scheme SUBSTUT2:sch 1
for b1 being Element of CQC-WFF holds
   P1[b1]
provided
   for b1 being Element of CQC-WFF
         st QuantNbr b1 = 0
      holds P1[b1]
and
   for b1 being Element of NAT
      st for b2 being Element of CQC-WFF
              st QuantNbr b2 = b1
           holds P1[b2]
   for b2 being Element of CQC-WFF
         st QuantNbr b2 = b1 + 1
      holds P1[b2];


:: SUBSTUT2:sch 2
scheme SUBSTUT2:sch 2
for b1 being Element of CQC-WFF holds
   P1[b1]
provided
   for b1 being Element of CQC-WFF
         st QuantNbr b1 <= 0
      holds P1[b1]
and
   for b1 being Element of NAT
      st for b2 being Element of CQC-WFF
              st QuantNbr b2 <= b1
           holds P1[b2]
   for b2 being Element of CQC-WFF
         st QuantNbr b2 <= b1 + 1
      holds P1[b2];


:: SUBSTUT2:th 13
theorem
for b1, b2 being Element of bound_QC-variables holds
VERUM .(b1,b2) = VERUM;

:: SUBSTUT2:th 14
theorem
for b1 being Element of NAT
for b2, b3 being Element of bound_QC-variables
for b4 being Element of b1 -ary_QC-pred_symbols
for b5 being CQC-variable_list-like QC-variable_list of b1 holds
   (b4 ! b5) .(b2,b3) = b4 ! CQC_Subst(b5,Sbst(b2,b3)) &
    QuantNbr (b4 ! b5) = QuantNbr ((b4 ! b5) .(b2,b3));

:: SUBSTUT2:th 15
theorem
for b1 being Element of NAT
for b2 being Element of b1 -ary_QC-pred_symbols
for b3 being CQC-variable_list-like QC-variable_list of b1
for b4 being Element of vSUB holds
   QuantNbr (b2 ! b3) = QuantNbr CQC_Sub [b2 ! b3,b4];

:: SUBSTUT2:funcnot 5 => SUBSTUT2:func 5
definition
  let a1 be Element of QC-Sub-WFF;
  redefine func a1 `2 -> Element of vSUB;
end;

:: SUBSTUT2:th 16
theorem
for b1 being Element of CQC-WFF
for b2 being Element of vSUB holds
   ['not' b1,b2] = Sub_not [b1,b2];

:: SUBSTUT2:th 17
theorem
for b1 being Element of CQC-WFF
for b2, b3 being Element of bound_QC-variables holds
'not' (b1 .(b2,b3)) = 'not' (b1 .(b2,b3)) &
 (QuantNbr b1 = QuantNbr (b1 .(b2,b3)) implies QuantNbr 'not' b1 = QuantNbr 'not' (b1 .(b2,b3)));

:: SUBSTUT2:th 18
theorem
for b1 being Element of CQC-WFF
   st for b2 being Element of vSUB holds
        QuantNbr b1 = QuantNbr CQC_Sub [b1,b2]
for b2 being Element of vSUB holds
   QuantNbr 'not' b1 = QuantNbr CQC_Sub ['not' b1,b2];

:: SUBSTUT2:th 19
theorem
for b1, b2 being Element of CQC-WFF
for b3 being Element of vSUB holds
   [b1 '&' b2,b3] = CQCSub_&([b1,b3],[b2,b3]);

:: SUBSTUT2:th 20
theorem
for b1, b2 being Element of CQC-WFF
for b3, b4 being Element of bound_QC-variables holds
(b1 '&' b2) .(b3,b4) = (b1 .(b3,b4)) '&' (b2 .(b3,b4)) &
 (QuantNbr b1 = QuantNbr (b1 .(b3,b4)) & QuantNbr b2 = QuantNbr (b2 .(b3,b4)) implies QuantNbr (b1 '&' b2) = QuantNbr ((b1 '&' b2) .(b3,b4)));

:: SUBSTUT2:th 21
theorem
for b1, b2 being Element of CQC-WFF
   st (for b3 being Element of vSUB holds
         QuantNbr b1 = QuantNbr CQC_Sub [b1,b3]) &
      (for b3 being Element of vSUB holds
         QuantNbr b2 = QuantNbr CQC_Sub [b2,b3])
for b3 being Element of vSUB holds
   QuantNbr (b1 '&' b2) = QuantNbr CQC_Sub [b1 '&' b2,b3];

:: SUBSTUT2:funcnot 6 => SUBSTUT2:func 6
definition
  func CFQ -> Function-like quasi_total Relation of CQC-Sub-WFF,vSUB equals
    QSub | CQC-Sub-WFF;
end;

:: SUBSTUT2:def 3
theorem
CFQ = QSub | CQC-Sub-WFF;

:: SUBSTUT2:funcnot 7 => SUBSTUT2:func 7
definition
  let a1 be Element of CQC-WFF;
  let a2 be Element of bound_QC-variables;
  let a3 be Element of vSUB;
  func QScope(A1,A2,A3) -> CQC-WFF-like Element of [:QC-Sub-WFF,bound_QC-variables:] equals
    [[a1,CFQ . [All(a2,a1),a3]],a2];
end;

:: SUBSTUT2:def 4
theorem
for b1 being Element of CQC-WFF
for b2 being Element of bound_QC-variables
for b3 being Element of vSUB holds
   QScope(b1,b2,b3) = [[b1,CFQ . [All(b2,b1),b3]],b2];

:: SUBSTUT2:funcnot 8 => SUBSTUT2:func 8
definition
  let a1 be Element of CQC-WFF;
  let a2 be Element of bound_QC-variables;
  let a3 be Element of vSUB;
  func Qsc(A1,A2,A3) -> second_Q_comp of QScope(a1,a2,a3) equals
    a3;
end;

:: SUBSTUT2:def 5
theorem
for b1 being Element of CQC-WFF
for b2 being Element of bound_QC-variables
for b3 being Element of vSUB holds
   Qsc(b1,b2,b3) = b3;

:: SUBSTUT2:th 22
theorem
for b1 being Element of CQC-WFF
for b2 being Element of bound_QC-variables
for b3 being Element of vSUB holds
   [All(b2,b1),b3] = CQCSub_All(QScope(b1,b2,b3),Qsc(b1,b2,b3)) &
    QScope(b1,b2,b3) is quantifiable;

:: SUBSTUT2:th 23
theorem
for b1 being Element of CQC-WFF
for b2 being Element of bound_QC-variables
   st for b3 being Element of vSUB holds
        QuantNbr b1 = QuantNbr CQC_Sub [b1,b3]
for b3 being Element of vSUB holds
   QuantNbr All(b2,b1) = QuantNbr CQC_Sub [All(b2,b1),b3];

:: SUBSTUT2:th 24
theorem
for b1 being Element of vSUB holds
   QuantNbr VERUM = QuantNbr CQC_Sub [VERUM,b1];

:: SUBSTUT2:th 25
theorem
for b1 being Element of CQC-WFF
for b2 being Element of vSUB holds
   QuantNbr b1 = QuantNbr CQC_Sub [b1,b2];

:: SUBSTUT2:th 26
theorem
for b1 being Element of CQC-WFF
      st b1 is atomic
   holds ex b2 being Element of NAT st
      ex b3 being Element of b2 -ary_QC-pred_symbols st
         ex b4 being CQC-variable_list-like QC-variable_list of b2 st
            b1 = b3 ! b4;

:: SUBSTUT2:sch 3
scheme SUBSTUT2:sch 3
for b1 being Element of CQC-WFF
      st QuantNbr b1 = 0
   holds P1[b1]
provided
   for b1, b2 being Element of CQC-WFF
   for b3 being Element of bound_QC-variables
   for b4 being Element of NAT
   for b5 being CQC-variable_list-like QC-variable_list of b4
   for b6 being Element of b4 -ary_QC-pred_symbols holds
      P1[VERUM] & P1[b6 ! b5] & (P1[b1] implies P1['not' b1]) & (P1[b1] & P1[b2] implies P1[b1 '&' b2]);


:: SUBSTUT2:modenot 1 => SUBSTUT2:mode 1
definition
  let a1, a2 be Element of QC-WFF;
  assume a1 is_subformula_of a2;
  mode PATH of A1,A2 -> Relation-like Function-like FinSequence-like set means
    1 <= len it &
     it . 1 = a1 &
     it . len it = a2 &
     (for b1 being Element of NAT
           st 1 <= b1 & b1 < len it
        holds ex b2, b3 being Element of QC-WFF st
           it . b1 = b2 & it . (b1 + 1) = b3 & b2 is_immediate_constituent_of b3);
end;

:: SUBSTUT2:dfs 6
definiens
  let a1, a2 be Element of QC-WFF;
  let a3 be Relation-like Function-like FinSequence-like set;
To prove
     a3 is PATH of a1,a2
it is sufficient to prove
thus a1 is_subformula_of a2;
  thus 1 <= len a3 &
     a3 . 1 = a1 &
     a3 . len a3 = a2 &
     (for b1 being Element of NAT
           st 1 <= b1 & b1 < len a3
        holds ex b2, b3 being Element of QC-WFF st
           a3 . b1 = b2 & a3 . (b1 + 1) = b3 & b2 is_immediate_constituent_of b3);

:: SUBSTUT2:def 6
theorem
for b1, b2 being Element of QC-WFF
   st b1 is_subformula_of b2
for b3 being Relation-like Function-like FinSequence-like set holds
      b3 is PATH of b1,b2
   iff
      1 <= len b3 &
       b3 . 1 = b1 &
       b3 . len b3 = b2 &
       (for b4 being Element of NAT
             st 1 <= b4 & b4 < len b3
          holds ex b5, b6 being Element of QC-WFF st
             b3 . b4 = b5 & b3 . (b4 + 1) = b6 & b5 is_immediate_constituent_of b6);

:: SUBSTUT2:th 27
theorem
for b1 being Element of NAT
for b2, b3 being Element of QC-WFF
for b4 being PATH of b2,b3
      st b2 is_subformula_of b3 & 1 <= b1 & b1 <= len b4
   holds ex b5 being Element of QC-WFF st
      b5 = b4 . b1 & b5 is_subformula_of b3;

:: SUBSTUT2:th 28
theorem
for b1 being Element of NAT
for b2 being Element of CQC-WFF
for b3 being Element of QC-WFF
for b4 being PATH of b3,b2
      st b3 is_subformula_of b2 & 1 <= b1 & b1 <= len b4
   holds b4 . b1 is Element of CQC-WFF;

:: SUBSTUT2:th 29
theorem
for b1, b2 being Element of NAT
for b3, b4 being Element of CQC-WFF
for b5 being PATH of b3,b4
      st QuantNbr b4 <= b1 & b3 is_subformula_of b4 & 1 <= b2 & b2 <= len b5
   holds ex b6 being Element of CQC-WFF st
      b6 = b5 . b2 & QuantNbr b6 <= b1;

:: SUBSTUT2:th 30
theorem
for b1 being Element of NAT
for b2, b3 being Element of CQC-WFF
      st QuantNbr b2 = b1 & b3 is_subformula_of b2
   holds QuantNbr b3 <= b1;

:: SUBSTUT2:th 31
theorem
for b1 being Element of NAT
for b2 being Element of CQC-WFF
      st for b3 being Element of CQC-WFF
              st b3 is_subformula_of b2
           holds QuantNbr b3 = b1
   holds b1 = 0;

:: SUBSTUT2:th 32
theorem
for b1 being Element of CQC-WFF
      st for b2 being Element of CQC-WFF
           st b2 is_subformula_of b1
        for b3 being Element of bound_QC-variables
        for b4 being Element of CQC-WFF holds
           b2 <> All(b3,b4)
   holds QuantNbr b1 = 0;

:: SUBSTUT2:th 33
theorem
for b1 being Element of CQC-WFF
      st for b2 being Element of CQC-WFF
              st b2 is_subformula_of b1
           holds QuantNbr b2 <> 1
   holds QuantNbr b1 = 0;

:: SUBSTUT2:th 34
theorem
for b1 being Element of CQC-WFF
      st 1 <= QuantNbr b1
   holds ex b2 being Element of CQC-WFF st
      b2 is_subformula_of b1 & QuantNbr b2 = 1;