:: SUBSTUT1  semantic presentation
:: deftheorem Def1   defines vSUB SUBSTUT1:def 1 : 
:: deftheorem Def2   defines @ SUBSTUT1:def 2 : 
theorem Th1: :: SUBSTUT1:1
:: deftheorem Def3   defines CQC_Subst SUBSTUT1:def 3 : 
:: deftheorem Def4   defines @ SUBSTUT1:def 4 : 
:: deftheorem Def5   defines CQC_Subst SUBSTUT1:def 5 : 
:: deftheorem Def6   defines RestrictSub SUBSTUT1:def 6 : 
:: deftheorem Def7   defines Bound_Vars SUBSTUT1:def 7 : 
:: deftheorem Def8   defines Bound_Vars SUBSTUT1:def 8 : 
Lemma4: 
for b1 being  QC-formula holds 
 (  Bound_Vars VERUM  =  {} bound_QC-variables  & ( b1 is atomic implies  Bound_Vars b1 =  Bound_Vars (the_arguments_of b1) ) & ( b1 is negative implies  Bound_Vars b1 =  Bound_Vars (the_argument_of b1) ) & ( b1 is conjunctive implies  Bound_Vars b1 = (Bound_Vars (the_left_argument_of b1)) \/ (Bound_Vars (the_right_argument_of b1)) ) & ( b1 is universal implies  Bound_Vars b1 = (Bound_Vars (the_scope_of b1)) \/ {(bound_in b1)} ) )
 
theorem Th2: :: SUBSTUT1:2
theorem Th3: :: SUBSTUT1:3
theorem Th4: :: SUBSTUT1:4
theorem Th5: :: SUBSTUT1:5
theorem Th6: :: SUBSTUT1:6
:: deftheorem Def9   defines Dom_Bound_Vars SUBSTUT1:def 9 : 
:: deftheorem Def10   defines Sub_Var SUBSTUT1:def 10 : 
:: deftheorem Def11   defines NSub SUBSTUT1:def 11 : 
:: deftheorem Def12   defines upVar SUBSTUT1:def 12 : 
definition
let c1 be   
bound_QC-variable;
let c2 be   
QC-formula;
let c3 be  
finite CQC_Substitution;
assume E5: 
ex 
b1 being  
CQC_Substitution st 
c3 =  RestrictSub c1,
(All c1,c2),
b1
 ;
func  ExpandSub c1,
c2,
c3 ->   CQC_Substitution equals :: SUBSTUT1:def 13
a3 \/ {[a1,(x. (upVar a3,a2))]} if a1 in  rng a3 otherwise a3 \/ {[a1,a1]};
coherence 
( ( c1 in  rng c3 implies c3 \/ {[c1,(x. (upVar c3,c2))]} is   CQC_Substitution ) & ( not c1 in  rng c3 implies c3 \/ {[c1,c1]} is   CQC_Substitution ) )
 
consistency 
for b1 being  CQC_Substitution holds  verum
 ;
 
end;
 
:: deftheorem Def13   defines ExpandSub SUBSTUT1:def 13 : 
for 
b1 being  
bound_QC-variable for 
b2 being  
QC-formula for 
b3 being 
finite CQC_Substitution  st ex 
b4 being  
CQC_Substitution st 
b3 =  RestrictSub b1,
(All b1,b2),
b4 holds 
( ( 
b1 in  rng b3 implies  
ExpandSub b1,
b2,
b3 = b3 \/ {[b1,(x. (upVar b3,b2))]} ) & ( not 
b1 in  rng b3 implies  
ExpandSub b1,
b2,
b3 = b3 \/ {[b1,b1]} ) );
:: deftheorem Def14   defines PQSub SUBSTUT1:def 14 : 
definition
func  QSub  ->   Function means :: SUBSTUT1:def 15
for 
b1 being   
set  holds 
 ( 
b1 in a1 iff ex 
b2 being  
QC-formulaex 
b3 being  
CQC_Substitutionex 
b4 being   
set  st 
( 
b1 = [[b2,b3],b4] & 
b2,
b3 PQSub b4 ) );
existence 
ex b1 being  Function st 
for b2 being   set  holds 
 ( b2 in b1 iff ex b3 being  QC-formulaex b4 being  CQC_Substitutionex b5 being   set  st 
( b2 = [[b3,b4],b5] & b3,b4 PQSub b5 ) )
 
uniqueness 
for b1, b2 being  Function  st ( for b3 being   set  holds 
 ( b3 in b1 iff ex b4 being  QC-formulaex b5 being  CQC_Substitutionex b6 being   set  st 
( b3 = [[b4,b5],b6] & b4,b5 PQSub b6 ) ) ) & ( for b3 being   set  holds 
 ( b3 in b2 iff ex b4 being  QC-formulaex b5 being  CQC_Substitutionex b6 being   set  st 
( b3 = [[b4,b5],b6] & b4,b5 PQSub b6 ) ) ) holds 
b1 = b2
 
 
end;
 
:: deftheorem Def15   defines QSub SUBSTUT1:def 15 : 
theorem Th7: :: SUBSTUT1:7
( 
[:QC-WFF ,vSUB :] is   
Subset of 
[:([:NAT ,NAT :] * ),vSUB :] & ( for 
b1 being  
Nat for 
b2 being  
QC-pred_symbol of 
b1 for 
b3 being   
QC-variable_list of 
b1 for 
b4 being   
Element of  
vSUB  holds  
[(<*b2*> ^ b3),b4] in [:QC-WFF ,vSUB :] ) & ( for 
b1 being   
Element of  
vSUB  holds  
[<*[0,0]*>,b1] in [:QC-WFF ,vSUB :] ) & ( for 
b1 being   
FinSequence of 
[:NAT ,NAT :] for 
b2 being   
Element of  
vSUB   st 
[b1,b2] in [:QC-WFF ,vSUB :] holds 
[(<*[1,0]*> ^ b1),b2] in [:QC-WFF ,vSUB :] ) & ( for 
b1, 
b2 being   
FinSequence of 
[:NAT ,NAT :] for 
b3 being   
Element of  
vSUB   st 
[b1,b3] in [:QC-WFF ,vSUB :] & 
[b2,b3] in [:QC-WFF ,vSUB :] holds 
[((<*[2,0]*> ^ b1) ^ b2),b3] in [:QC-WFF ,vSUB :] ) & ( for 
b1 being  
bound_QC-variable for 
b2 being   
FinSequence of 
[:NAT ,NAT :] for 
b3 being   
Element of  
vSUB   st 
[b2,(QSub  . [((<*[3,0]*> ^ <*b1*>) ^ b2),b3])] in [:QC-WFF ,vSUB :] holds 
[((<*[3,0]*> ^ <*b1*>) ^ b2),b3] in [:QC-WFF ,vSUB :] ) )
definition
let c1 be    
set ;
attr a1 is 
QC-Sub-closed means :
Def16: 
:: SUBSTUT1:def 16
( 
a1 is   
Subset of 
[:([:NAT ,NAT :] * ),vSUB :] & ( for 
b1 being  
Nat for 
b2 being  
QC-pred_symbol of 
b1 for 
b3 being   
QC-variable_list of 
b1 for 
b4 being   
Element of  
vSUB  holds  
[(<*b2*> ^ b3),b4] in a1 ) & ( for 
b1 being   
Element of  
vSUB  holds  
[<*[0,0]*>,b1] in a1 ) & ( for 
b1 being   
FinSequence of 
[:NAT ,NAT :] for 
b2 being   
Element of  
vSUB   st 
[b1,b2] in a1 holds 
[(<*[1,0]*> ^ b1),b2] in a1 ) & ( for 
b1, 
b2 being   
FinSequence of 
[:NAT ,NAT :] for 
b3 being   
Element of  
vSUB   st 
[b1,b3] in a1 & 
[b2,b3] in a1 holds 
[((<*[2,0]*> ^ b1) ^ b2),b3] in a1 ) & ( for 
b1 being  
bound_QC-variable for 
b2 being   
FinSequence of 
[:NAT ,NAT :] for 
b3 being   
Element of  
vSUB   st 
[b2,(QSub  . [((<*[3,0]*> ^ <*b1*>) ^ b2),b3])] in a1 holds 
[((<*[3,0]*> ^ <*b1*>) ^ b2),b3] in a1 ) );
 
end;
 
:: deftheorem Def16   defines QC-Sub-closed SUBSTUT1:def 16 : 
for 
b1 being   
set  holds 
 ( 
b1 is 
QC-Sub-closed iff ( 
b1 is   
Subset of 
[:([:NAT ,NAT :] * ),vSUB :] & ( for 
b2 being  
Nat for 
b3 being  
QC-pred_symbol of 
b2 for 
b4 being   
QC-variable_list of 
b2 for 
b5 being   
Element of  
vSUB  holds  
[(<*b3*> ^ b4),b5] in b1 ) & ( for 
b2 being   
Element of  
vSUB  holds  
[<*[0,0]*>,b2] in b1 ) & ( for 
b2 being   
FinSequence of 
[:NAT ,NAT :] for 
b3 being   
Element of  
vSUB   st 
[b2,b3] in b1 holds 
[(<*[1,0]*> ^ b2),b3] in b1 ) & ( for 
b2, 
b3 being   
FinSequence of 
[:NAT ,NAT :] for 
b4 being   
Element of  
vSUB   st 
[b2,b4] in b1 & 
[b3,b4] in b1 holds 
[((<*[2,0]*> ^ b2) ^ b3),b4] in b1 ) & ( for 
b2 being  
bound_QC-variable for 
b3 being   
FinSequence of 
[:NAT ,NAT :] for 
b4 being   
Element of  
vSUB   st 
[b3,(QSub  . [((<*[3,0]*> ^ <*b2*>) ^ b3),b4])] in b1 holds 
[((<*[3,0]*> ^ <*b2*>) ^ b3),b4] in b1 ) ) );
Lemma8: 
for b1 being  bound_QC-variable
 for b2 being   FinSequence of [:NAT ,NAT :] holds  (<*[3,0]*> ^ <*b1*>) ^ b2 is    FinSequence of [:NAT ,NAT :]
 
Lemma9: 
for b1, b2 being  Nat
 for b3 being   Element of  vSUB  holds  [<*[b1,b2]*>,b3] in [:([:NAT ,NAT :] * ),vSUB :]
 
Lemma10: 
for b1 being  Nat
 for b2 being  QC-pred_symbol of b1
 for b3 being   QC-variable_list of b1
 for b4 being   Element of  vSUB  holds  [(<*b2*> ^ b3),b4] in [:([:NAT ,NAT :] * ),vSUB :]
 
:: deftheorem Def17   defines QC-Sub-WFF SUBSTUT1:def 17 : 
theorem Th8: :: SUBSTUT1:8
:: deftheorem Def18   defines Sub_P SUBSTUT1:def 18 : 
theorem Th9: :: SUBSTUT1:9
:: deftheorem Def19   defines Sub_VERUM SUBSTUT1:def 19 : 
theorem Th10: :: SUBSTUT1:10
:: deftheorem Def20   defines Sub_not SUBSTUT1:def 20 : 
:: deftheorem Def21   defines Sub_& SUBSTUT1:def 21 : 
:: deftheorem Def22   defines quantifiable SUBSTUT1:def 22 : 
:: deftheorem Def23   defines second_Q_comp SUBSTUT1:def 23 : 
:: deftheorem Def24   defines Sub_All SUBSTUT1:def 24 : 
:: deftheorem Def25   defines Sub_atomic SUBSTUT1:def 25 : 
theorem Th11: :: SUBSTUT1:11
:: deftheorem Def26   defines Sub_negative SUBSTUT1:def 26 : 
:: deftheorem Def27   defines Sub_conjunctive SUBSTUT1:def 27 : 
:: deftheorem Def28   defines Sub_universal SUBSTUT1:def 28 : 
theorem Th12: :: SUBSTUT1:12
:: deftheorem Def29   defines Sub_the_arguments_of SUBSTUT1:def 29 : 
:: deftheorem Def30   defines Sub_the_argument_of SUBSTUT1:def 30 : 
:: deftheorem Def31   defines Sub_the_left_argument_of SUBSTUT1:def 31 : 
:: deftheorem Def32   defines Sub_the_right_argument_of SUBSTUT1:def 32 : 
:: deftheorem Def33   defines Sub_the_bound_of SUBSTUT1:def 33 : 
:: deftheorem Def34   defines Sub_the_scope_of SUBSTUT1:def 34 : 
theorem Th13: :: SUBSTUT1:13
theorem Th14: :: SUBSTUT1:14
theorem Th15: :: SUBSTUT1:15
theorem Th16: :: SUBSTUT1:16
theorem Th17: :: SUBSTUT1:17
theorem Th18: :: SUBSTUT1:18
theorem Th19: :: SUBSTUT1:19
theorem Th20: :: SUBSTUT1:20
theorem Th21: :: SUBSTUT1:21
theorem Th22: :: SUBSTUT1:22
theorem Th23: :: SUBSTUT1:23
theorem Th24: :: SUBSTUT1:24
theorem Th25: :: SUBSTUT1:25
theorem Th26: :: SUBSTUT1:26
theorem Th27: :: SUBSTUT1:27
scheme  :: SUBSTUT1:sch 4
s4{ 
F1() 
->  non 
empty  set , 
F2() 
->   Function of  
QC-Sub-WFF ,
F1(), 
F3() 
->   Function of  
QC-Sub-WFF ,
F1(), 
F4() 
->    Element of 
F1(), 
F5(   
set ) 
->    Element of 
F1(), 
F6(   
set ) 
->    Element of 
F1(), 
F7(   
set ,   
set ) 
->    Element of 
F1(), 
F8(   
set ,   
set ) 
->    Element of 
F1() } :
provided
 
:: deftheorem Def35   defines @ SUBSTUT1:def 35 : 
definition
let c1 be    
Element of 
[:QC-WFF ,vSUB :];
func  S_Bound c1 ->   bound_QC-variable equals :: SUBSTUT1:def 36
 x. (upVar (RestrictSub (bound_in (a1 `1 )),(a1 `1 ),(a1 `2 )),(the_scope_of (a1 `1 ))) if  bound_in (a1 `1 ) in  rng (RestrictSub (bound_in (a1 `1 )),(a1 `1 ),(a1 `2 )) otherwise  bound_in (a1 `1 );
coherence 
( (  bound_in (c1 `1 ) in  rng (RestrictSub (bound_in (c1 `1 )),(c1 `1 ),(c1 `2 )) implies  x. (upVar (RestrictSub (bound_in (c1 `1 )),(c1 `1 ),(c1 `2 )),(the_scope_of (c1 `1 ))) is   bound_QC-variable ) & ( not  bound_in (c1 `1 ) in  rng (RestrictSub (bound_in (c1 `1 )),(c1 `1 ),(c1 `2 )) implies  bound_in (c1 `1 ) is   bound_QC-variable ) )
 ;
consistency 
for b1 being  bound_QC-variable holds  verum
 ;
 
end;
 
:: deftheorem Def36   defines S_Bound SUBSTUT1:def 36 : 
:: deftheorem Def37   defines Quant SUBSTUT1:def 37 : 
Lemma45: 
for b1, b2 being  Function of  QC-Sub-WFF , QC-WFF   st ( for b3 being   Element of  QC-Sub-WFF  holds 
 ( ( b3 is Sub_VERUM implies b1 . b3 =  VERUM  ) & ( b3 is Sub_atomic implies b1 . b3 = (the_pred_symbol_of (b3 `1 )) ! (CQC_Subst (Sub_the_arguments_of b3),(b3 `2 )) ) & ( b3 is Sub_negative implies b1 . b3 =  'not' (b1 . (Sub_the_argument_of b3)) ) & ( b3 is Sub_conjunctive implies b1 . b3 = (b1 . (Sub_the_left_argument_of b3)) '&' (b1 . (Sub_the_right_argument_of b3)) ) & ( b3 is Sub_universal implies b1 . b3 =  Quant b3,(b1 . (Sub_the_scope_of b3)) ) ) ) & ( for b3 being   Element of  QC-Sub-WFF  holds 
 ( ( b3 is Sub_VERUM implies b2 . b3 =  VERUM  ) & ( b3 is Sub_atomic implies b2 . b3 = (the_pred_symbol_of (b3 `1 )) ! (CQC_Subst (Sub_the_arguments_of b3),(b3 `2 )) ) & ( b3 is Sub_negative implies b2 . b3 =  'not' (b2 . (Sub_the_argument_of b3)) ) & ( b3 is Sub_conjunctive implies b2 . b3 = (b2 . (Sub_the_left_argument_of b3)) '&' (b2 . (Sub_the_right_argument_of b3)) ) & ( b3 is Sub_universal implies b2 . b3 =  Quant b3,(b2 . (Sub_the_scope_of b3)) ) ) ) holds 
b1 = b2
 
definition
let c1 be    
Element of  
QC-Sub-WFF ;
func  CQC_Sub c1 ->    Element of  
QC-WFF  means :
Def38: 
:: SUBSTUT1:def 38
ex 
b1 being  
Function of  
QC-Sub-WFF , 
QC-WFF  st 
( 
a2 = b1 . a1 & ( for 
b2 being   
Element of  
QC-Sub-WFF  holds 
 ( ( 
b2 is 
Sub_VERUM implies 
b1 . b2 =  VERUM  ) & ( 
b2 is 
Sub_atomic implies 
b1 . b2 = (the_pred_symbol_of (b2 `1 )) ! (CQC_Subst (Sub_the_arguments_of b2),(b2 `2 )) ) & ( 
b2 is 
Sub_negative implies 
b1 . b2 =  'not' (b1 . (Sub_the_argument_of b2)) ) & ( 
b2 is 
Sub_conjunctive implies 
b1 . b2 = (b1 . (Sub_the_left_argument_of b2)) '&' (b1 . (Sub_the_right_argument_of b2)) ) & ( 
b2 is 
Sub_universal implies 
b1 . b2 =  Quant b2,
(b1 . (Sub_the_scope_of b2)) ) ) ) );
existence 
ex b1 being   Element of  QC-WFF ex b2 being  Function of  QC-Sub-WFF , QC-WFF  st 
( b1 = b2 . c1 & ( for b3 being   Element of  QC-Sub-WFF  holds 
 ( ( b3 is Sub_VERUM implies b2 . b3 =  VERUM  ) & ( b3 is Sub_atomic implies b2 . b3 = (the_pred_symbol_of (b3 `1 )) ! (CQC_Subst (Sub_the_arguments_of b3),(b3 `2 )) ) & ( b3 is Sub_negative implies b2 . b3 =  'not' (b2 . (Sub_the_argument_of b3)) ) & ( b3 is Sub_conjunctive implies b2 . b3 = (b2 . (Sub_the_left_argument_of b3)) '&' (b2 . (Sub_the_right_argument_of b3)) ) & ( b3 is Sub_universal implies b2 . b3 =  Quant b3,(b2 . (Sub_the_scope_of b3)) ) ) ) )
 
uniqueness 
for b1, b2 being   Element of  QC-WFF   st ex b3 being  Function of  QC-Sub-WFF , QC-WFF  st 
( b1 = b3 . c1 & ( for b4 being   Element of  QC-Sub-WFF  holds 
 ( ( b4 is Sub_VERUM implies b3 . b4 =  VERUM  ) & ( b4 is Sub_atomic implies b3 . b4 = (the_pred_symbol_of (b4 `1 )) ! (CQC_Subst (Sub_the_arguments_of b4),(b4 `2 )) ) & ( b4 is Sub_negative implies b3 . b4 =  'not' (b3 . (Sub_the_argument_of b4)) ) & ( b4 is Sub_conjunctive implies b3 . b4 = (b3 . (Sub_the_left_argument_of b4)) '&' (b3 . (Sub_the_right_argument_of b4)) ) & ( b4 is Sub_universal implies b3 . b4 =  Quant b4,(b3 . (Sub_the_scope_of b4)) ) ) ) ) & ex b3 being  Function of  QC-Sub-WFF , QC-WFF  st 
( b2 = b3 . c1 & ( for b4 being   Element of  QC-Sub-WFF  holds 
 ( ( b4 is Sub_VERUM implies b3 . b4 =  VERUM  ) & ( b4 is Sub_atomic implies b3 . b4 = (the_pred_symbol_of (b4 `1 )) ! (CQC_Subst (Sub_the_arguments_of b4),(b4 `2 )) ) & ( b4 is Sub_negative implies b3 . b4 =  'not' (b3 . (Sub_the_argument_of b4)) ) & ( b4 is Sub_conjunctive implies b3 . b4 = (b3 . (Sub_the_left_argument_of b4)) '&' (b3 . (Sub_the_right_argument_of b4)) ) & ( b4 is Sub_universal implies b3 . b4 =  Quant b4,(b3 . (Sub_the_scope_of b4)) ) ) ) ) holds 
b1 = b2
 by Lemma45;
 
end;
 
:: deftheorem Def38   defines CQC_Sub SUBSTUT1:def 38 : 
theorem Th28: :: SUBSTUT1:28
theorem Th29: :: SUBSTUT1:29
theorem Th30: :: SUBSTUT1:30
theorem Th31: :: SUBSTUT1:31
theorem Th32: :: SUBSTUT1:32
:: deftheorem Def39   defines CQC-Sub-WFF SUBSTUT1:def 39 : 
theorem Th33: :: SUBSTUT1:33
Lemma53: 
for b1 being  Nat
 for b2 being  QC-pred_symbol of b1
 for b3 being  CQC-variable_list of b1 holds   the_pred_symbol_of (b2 ! b3) = b2
 
theorem Th34: :: SUBSTUT1:34
theorem Th35: :: SUBSTUT1:35
theorem Th36: :: SUBSTUT1:36
theorem Th37: :: SUBSTUT1:37
theorem Th38: :: SUBSTUT1:38