let X be Subset of CQC-WFF ; :: thesis: for p being Element of CQC-WFF holds
( X |- p iff not X \/ {('not' p)} is Consistent )

let p be Element of CQC-WFF ; :: thesis: ( X |- p iff not X \/ {('not' p)} is Consistent )
thus ( X |- p implies not X \/ {('not' p)} is Consistent ) :: thesis: ( not X \/ {('not' p)} is Consistent implies X |- p )
proof
assume X |- p ; :: thesis: not X \/ {('not' p)} is Consistent
then consider f being FinSequence of CQC-WFF such that
A1: ( rng f c= X & |- f ^ <*p*> ) by Def2;
A2: |- (f ^ <*('not' p)*>) ^ <*p*> by A1, Th5;
set f1 = (f ^ <*('not' p)*>) ^ <*('not' p)*>;
A3: ( Ant ((f ^ <*('not' p)*>) ^ <*('not' p)*>) = f ^ <*('not' p)*> & Suc ((f ^ <*('not' p)*>) ^ <*('not' p)*>) = 'not' p ) by CALCUL_1:5;
then A4: (Ant ((f ^ <*('not' p)*>) ^ <*('not' p)*>)) . ((len f) + 1) = Suc ((f ^ <*('not' p)*>) ^ <*('not' p)*>) by FINSEQ_1:59;
1 in Seg 1 by FINSEQ_1:3;
then 1 in dom <*('not' p)*> by FINSEQ_1:55;
then (len f) + 1 in dom (Ant ((f ^ <*('not' p)*>) ^ <*('not' p)*>)) by A3, FINSEQ_1:41;
then Suc ((f ^ <*('not' p)*>) ^ <*('not' p)*>) is_tail_of Ant ((f ^ <*('not' p)*>) ^ <*('not' p)*>) by A4, CALCUL_1:def 3;
then |- (f ^ <*('not' p)*>) ^ <*('not' p)*> by CALCUL_1:33;
then A5: not f ^ <*('not' p)*> is Consistent by A2, Def4;
set f2 = f ^ <*('not' p)*>;
A6: ( Ant (f ^ <*('not' p)*>) = f & Suc (f ^ <*('not' p)*>) = 'not' p ) by CALCUL_1:5;
0 + 1 <= len (f ^ <*('not' p)*>) by CALCUL_1:10;
then rng (f ^ <*('not' p)*>) = (rng f) \/ {('not' p)} by A6, CALCUL_1:3;
hence not X \/ {('not' p)} is Consistent by A1, A5, Th4, XBOOLE_1:9; :: thesis: verum
end;
thus ( not X \/ {('not' p)} is Consistent implies X |- p ) :: thesis: verum
proof
assume not X \/ {('not' p)} is Consistent ; :: thesis: X |- p
then X \/ {('not' p)} |- p by Th6;
then consider f being FinSequence of CQC-WFF such that
A7: ( rng f c= X \/ {('not' p)} & |- f ^ <*p*> ) by Def2;
now
assume not rng f c= X ; :: thesis: X |- p
then consider a being set such that
A8: ( a in rng f & not a in X ) by TARSKI:def 3;
reconsider B = dom f as finite set ;
reconsider A = f " {('not' p)} as finite set ;
set n = card A;
set g = f - {('not' p)};
set h = (f - {('not' p)}) ^ (IdFinS ('not' p),(card A));
A9: len (IdFinS ('not' p),(card A)) = card A by FINSEQ_1:def 18;
defpred S1[ Nat, set ] means ( ( $1 in Seg (len (f - {('not' p)})) implies $2 = (Sgm (B \ A)) . $1 ) & ( $1 in seq (len (f - {('not' p)})),(card A) implies $2 = (Sgm A) . ($1 - (len (f - {('not' p)}))) ) );
A12: for k being Nat st k in Seg (len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A)))) holds
ex a being set st S1[k,a]
proof
let k be Nat; :: thesis: ( k in Seg (len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A)))) implies ex a being set st S1[k,a] )
assume k in Seg (len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A)))) ; :: thesis: ex a being set st S1[k,a]
now
assume A13: k in Seg (len (f - {('not' p)})) ; :: thesis: ex a being set st S1[k,a]
A14: Seg (len (f - {('not' p)})) misses seq (len (f - {('not' p)})),(card A) by CALCUL_2:8;
take a = (Sgm (B \ A)) . k; :: thesis: S1[k,a]
thus S1[k,a] by A13, A14, XBOOLE_0:3; :: thesis: verum
end;
hence ex a being set st S1[k,a] ; :: thesis: verum
end;
consider F being FinSequence such that
A15: ( dom F = Seg (len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A)))) & ( for k being Nat st k in Seg (len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A)))) holds
S1[k,F . k] ) ) from FINSEQ_1:sch 1(A12);
A16: len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) = (len (f - {('not' p)})) + (len (IdFinS ('not' p),(card A))) by FINSEQ_1:35
.= ((len f) - (card A)) + (len (IdFinS ('not' p),(card A))) by FINSEQ_3:66
.= ((len f) - (card A)) + (card A) by FINSEQ_1:def 18
.= len f ;
then A17: dom F = B by A15, FINSEQ_1:def 3;
reconsider C = B \ A as finite set ;
now
let b be set ; :: thesis: ( b in C implies b in Seg (len f) )
assume A18: b in C ; :: thesis: b in Seg (len f)
b in dom f by A18;
hence b in Seg (len f) by FINSEQ_1:def 3; :: thesis: verum
end;
then A19: C c= Seg (len f) by TARSKI:def 3;
then A20: dom (Sgm C) = Seg (card C) by FINSEQ_3:45;
A21: card C = (card B) - (card A) by CARD_2:63, RELAT_1:167
.= (card (Seg (len f))) - (card A) by FINSEQ_1:def 3
.= (len f) - (card A) by FINSEQ_1:78
.= len (f - {('not' p)}) by FINSEQ_3:66 ;
A c= B by RELAT_1:167;
then A22: A c= Seg (len f) by FINSEQ_1:def 3;
A23: now
let i be Element of NAT ; :: thesis: ( i in seq (len (f - {('not' p)})),(card A) implies i - (len (f - {('not' p)})) in dom (Sgm A) )
assume A24: i in seq (len (f - {('not' p)})),(card A) ; :: thesis: i - (len (f - {('not' p)})) in dom (Sgm A)
reconsider j = i - (len (f - {('not' p)})) as Integer ;
A25: ( 1 + (len (f - {('not' p)})) <= i & i <= (card A) + (len (f - {('not' p)})) ) by A24, CALCUL_2:1;
then A26: ( 1 <= j & j <= card A ) by XREAL_1:21, XREAL_1:22;
0 <= j by A25, XREAL_1:21;
then reconsider j = j as Element of NAT by INT_1:16;
j in Seg (card A) by A26, FINSEQ_1:3;
hence i - (len (f - {('not' p)})) in dom (Sgm A) by A22, FINSEQ_3:45; :: thesis: verum
end;
A27: rng F = B
proof
now
let a be set ; :: thesis: ( a in rng F implies a in B )
assume A28: a in rng F ; :: thesis: a in B
consider i being Nat such that
A29: ( i in dom F & F . i = a ) by A28, FINSEQ_2:11;
A30: i in (Seg (len (f - {('not' p)}))) \/ (seq (len (f - {('not' p)})),(card A)) by A9, A15, A29, Lm1;
now
assume i in seq (len (f - {('not' p)})),(card A) ; :: thesis: a in B
then A34: ( i - (len (f - {('not' p)})) in dom (Sgm A) & a = (Sgm A) . (i - (len (f - {('not' p)}))) ) by A15, A23, A29;
rng (Sgm A) = A by A22, FINSEQ_1:def 13;
then A35: a in A by A34, FUNCT_1:12;
A c= B by RELAT_1:167;
hence a in B by A35; :: thesis: verum
end;
hence a in B by A30, A31, XBOOLE_0:def 3; :: thesis: verum
end;
hence rng F c= B by TARSKI:def 3; :: according to XBOOLE_0:def 10 :: thesis: B c= rng F
let a be set ; :: according to TARSKI:def 3 :: thesis: ( not a in B or a in rng F )
assume A36: a in B ; :: thesis: a in rng F
A37: now
assume A38: a in A ; :: thesis: a in rng F
rng (Sgm A) = A by A22, FINSEQ_1:def 13;
then consider i being Nat such that
A39: ( i in dom (Sgm A) & (Sgm A) . i = a ) by A38, FINSEQ_2:11;
reconsider i = i as Element of NAT by ORDINAL1:def 13;
set m = i + (len (f - {('not' p)}));
len (Sgm A) = card A by A22, FINSEQ_3:44;
then A40: ( 1 <= i & i <= card A ) by A39, FINSEQ_3:27;
then A41: ( 1 + (len (f - {('not' p)})) <= i + (len (f - {('not' p)})) & i + (len (f - {('not' p)})) <= (card A) + (len (f - {('not' p)})) ) by XREAL_1:8;
then A42: i + (len (f - {('not' p)})) in seq (len (f - {('not' p)})),(card A) by CALCUL_2:1;
i <= i + (len (f - {('not' p)})) by NAT_1:11;
then A43: ( 1 <= i + (len (f - {('not' p)})) & i + (len (f - {('not' p)})) <= (len (f - {('not' p)})) + (len (IdFinS ('not' p),(card A))) ) by A40, A41, FINSEQ_1:def 18, XXREAL_0:2;
then i + (len (f - {('not' p)})) <= len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) by FINSEQ_1:35;
then i + (len (f - {('not' p)})) in dom ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) by A43, FINSEQ_3:27;
then A44: i + (len (f - {('not' p)})) in Seg (len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A)))) by FINSEQ_1:def 3;
a = (Sgm A) . ((i + (len (f - {('not' p)}))) - (len (f - {('not' p)}))) by A39;
then a = F . (i + (len (f - {('not' p)}))) by A15, A42, A44;
hence a in rng F by A15, A44, FUNCT_1:12; :: thesis: verum
end;
now
assume not a in A ; :: thesis: a in rng F
then A45: a in C by A36, XBOOLE_0:def 5;
now
let b be set ; :: thesis: ( b in C implies b in Seg (len f) )
assume A46: b in C ; :: thesis: b in Seg (len f)
b in dom f by A46;
hence b in Seg (len f) by FINSEQ_1:def 3; :: thesis: verum
end;
then C c= Seg (len f) by TARSKI:def 3;
then a in rng (Sgm C) by A45, FINSEQ_1:def 13;
then consider i being Nat such that
A47: ( i in dom (Sgm C) & (Sgm C) . i = a ) by FINSEQ_2:11;
len (Sgm C) = len (f - {('not' p)}) by A20, A21, FINSEQ_1:def 3;
then A48: ( 1 <= i & i <= len (f - {('not' p)}) ) by A47, FINSEQ_3:27;
then A49: i in Seg (len (f - {('not' p)})) by FINSEQ_1:3;
len (f - {('not' p)}) <= len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) by CALCUL_1:6;
then i <= len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) by A48, XXREAL_0:2;
then A50: i in Seg (len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A)))) by A48, FINSEQ_1:3;
then a = F . i by A15, A47, A49;
hence a in rng F by A15, A50, FUNCT_1:12; :: thesis: verum
end;
hence a in rng F by A37; :: thesis: verum
end;
then reconsider F = F as Relation of B,B by A17, RELSET_1:11;
( B = {} implies B = {} ) ;
then reconsider F = F as Function of B,B by A17, FUNCT_2:def 1;
F is one-to-one
proof
let a1 be set ; :: according to FUNCT_1:def 8 :: thesis: for b1 being set holds
( not a1 in dom F or not b1 in dom F or not F . a1 = F . b1 or a1 = b1 )

let a2 be set ; :: thesis: ( not a1 in dom F or not a2 in dom F or not F . a1 = F . a2 or a1 = a2 )
assume A51: ( a1 in dom F & a2 in dom F & F . a1 = F . a2 ) ; :: thesis: a1 = a2
A52: ( a1 in (Seg (len (f - {('not' p)}))) \/ (seq (len (f - {('not' p)})),(card A)) & a2 in (Seg (len (f - {('not' p)}))) \/ (seq (len (f - {('not' p)})),(card A)) ) by A9, A15, A51, Lm1;
A53: now
assume A54: a1 in Seg (len (f - {('not' p)})) ; :: thesis: a1 = a2
A56: F . a1 = (Sgm C) . a1 by A15, A51, A54;
A57: a1 in dom (Sgm C) by A19, A21, A54, FINSEQ_3:45;
then F . a1 in rng (Sgm C) by A56, FUNCT_1:12;
then A58: F . a1 in C by A19, FINSEQ_1:def 13;
A59: now
assume A60: a2 in Seg (len (f - {('not' p)})) ; :: thesis: a1 = a2
A61: F . a2 = (Sgm C) . a2 by A15, A51, A60;
A62: a2 in dom (Sgm C) by A19, A21, A60, FINSEQ_3:45;
A63: (Sgm C) . a1 = (Sgm C) . a2 by A15, A51, A54, A61;
Sgm C is one-to-one by A19, FINSEQ_3:99;
hence a1 = a2 by A57, A62, A63, FUNCT_1:def 8; :: thesis: verum
end;
now
assume A64: a2 in seq (len (f - {('not' p)})),(card A) ; :: thesis: contradiction
then reconsider i = a2 as Element of NAT ;
(Sgm A) . (i - (len (f - {('not' p)}))) in rng (Sgm A) by A23, A64, FUNCT_1:12;
then F . a2 in rng (Sgm A) by A15, A51, A64;
then F . a2 in A by A22, FINSEQ_1:def 13;
hence contradiction by A51, A58, XBOOLE_0:def 5; :: thesis: verum
end;
hence a1 = a2 by A52, A59, XBOOLE_0:def 3; :: thesis: verum
end;
now
assume A65: a1 in seq (len (f - {('not' p)})),(card A) ; :: thesis: a1 = a2
then reconsider i = a1 as Element of NAT ;
A66: i - (len (f - {('not' p)})) in dom (Sgm A) by A23, A65;
(Sgm A) . (i - (len (f - {('not' p)}))) in rng (Sgm A) by A23, A65, FUNCT_1:12;
then F . a1 in rng (Sgm A) by A15, A51, A65;
then A67: F . a1 in A by A22, FINSEQ_1:def 13;
A68: now
assume A69: a2 in seq (len (f - {('not' p)})),(card A) ; :: thesis: a1 = a2
then reconsider i1 = a2 as Element of NAT ;
A70: F . a2 = (Sgm A) . (i1 - (len (f - {('not' p)}))) by A15, A51, A69;
A71: i1 - (len (f - {('not' p)})) in dom (Sgm A) by A23, A69;
A72: (Sgm A) . (i1 - (len (f - {('not' p)}))) = (Sgm A) . (i - (len (f - {('not' p)}))) by A15, A51, A65, A70;
Sgm A is one-to-one by A22, FINSEQ_3:99;
then i1 - (len (f - {('not' p)})) = i - (len (f - {('not' p)})) by A66, A71, A72, FUNCT_1:def 8;
hence a1 = a2 ; :: thesis: verum
end;
hence a1 = a2 by A52, A68, XBOOLE_0:def 3; :: thesis: verum
end;
hence a1 = a2 by A52, A53, XBOOLE_0:def 3; :: thesis: verum
end;
then reconsider F = F as Permutation of (dom f) by A27, FUNCT_2:83;
A75: Per f,F = (f - {('not' p)}) ^ (IdFinS ('not' p),(card A))
proof
A76: dom (Per f,F) = B by CALCUL_2:19
.= dom F by A15, A16, FINSEQ_1:def 3
.= dom ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) by A15, FINSEQ_1:def 3 ;
now
let k be Nat; :: thesis: ( k in dom ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) implies (Per f,F) . k = ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) . k )
assume A77: k in dom ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) ; :: thesis: (Per f,F) . k = ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) . k
A78: k in Seg (len ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A)))) by A77, FINSEQ_1:def 3;
A79: now
assume A80: k in dom (f - {('not' p)}) ; :: thesis: (Per f,F) . k = ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) . k
then A81: k in dom (Sgm C) by A20, A21, FINSEQ_1:def 3;
k in Seg (len (f - {('not' p)})) by A80, FINSEQ_1:def 3;
then A82: F . k = (Sgm C) . k by A15, A78;
k in dom (F * f) by A76, A77, CALCUL_2:def 2;
then (F * f) . k = f . ((Sgm C) . k) by A82, FUNCT_1:22;
hence (Per f,F) . k = f . ((Sgm C) . k) by CALCUL_2:def 2
.= ((Sgm C) * f) . k by A81, FUNCT_1:23
.= (f - {('not' p)}) . k by FINSEQ_3:def 1
.= ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) . k by A80, FINSEQ_1:def 7 ;
:: thesis: verum
end;
now
given i being Nat such that A83: ( i in dom (IdFinS ('not' p),(card A)) & k = (len (f - {('not' p)})) + i ) ; :: thesis: (Per f,F) . k = ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) . k
len (IdFinS ('not' p),(card A)) = card A by FINSEQ_1:def 18;
then A84: ( 1 <= i & i <= card A ) by A83, FINSEQ_3:27;
then ( 1 + (len (f - {('not' p)})) <= k & k <= (card A) + (len (f - {('not' p)})) ) by A83, XREAL_1:8;
then A85: k in seq (len (f - {('not' p)})),(card A) by CALCUL_2:1;
then F . k = (Sgm A) . (k - (len (f - {('not' p)}))) by A15, A78;
then F . k in rng (Sgm A) by A23, A85, FUNCT_1:12;
then F . k in A by A22, FINSEQ_1:def 13;
then f . (F . k) in {('not' p)} by FUNCT_1:def 13;
then A86: f . (F . k) = 'not' p by TARSKI:def 1;
k in dom (F * f) by A76, A77, CALCUL_2:def 2;
then (F * f) . k = 'not' p by A86, FUNCT_1:22;
then A87: (Per f,F) . k = 'not' p by CALCUL_2:def 2;
i in Seg (card A) by A84, FINSEQ_1:3;
hence (Per f,F) . k = (IdFinS ('not' p),(card A)) . i by A87, FUNCOP_1:13
.= ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) . k by A83, FINSEQ_1:def 7 ;
:: thesis: verum
end;
hence (Per f,F) . k = ((f - {('not' p)}) ^ (IdFinS ('not' p),(card A))) . k by A77, A79, FINSEQ_1:38; :: thesis: verum
end;
hence Per f,F = (f - {('not' p)}) ^ (IdFinS ('not' p),(card A)) by A76, FINSEQ_1:17; :: thesis: verum
end;
then reconsider h = (f - {('not' p)}) ^ (IdFinS ('not' p),(card A)) as FinSequence of CQC-WFF ;
A88: |- h ^ <*p*> by A7, A75, CALCUL_2:30;
( a in X or a in {('not' p)} ) by A7, A8, XBOOLE_0:def 3;
then a = 'not' p by A8, TARSKI:def 1;
then consider i being Nat such that
A89: ( i in B & f . i = 'not' p ) by A8, FINSEQ_2:11;
consider j being Nat such that
A90: ( j in dom F & F . j = i ) by A27, A89, FINSEQ_2:11;
(F * f) . j = 'not' p by A89, A90, FUNCT_1:23;
then A91: h . j = 'not' p by A75, CALCUL_2:def 2;
j in dom f by A90;
then j in dom h by A75, CALCUL_2:19;
then consider k being Nat such that
A95: ( k in dom (IdFinS ('not' p),(card A)) & j = (len (f - {('not' p)})) + k ) by A92, FINSEQ_1:38;
reconsider g = f - {('not' p)} as FinSequence of CQC-WFF by FINSEQ_3:93;
( 1 <= k & k <= len (IdFinS ('not' p),(card A)) ) by A95, FINSEQ_3:27;
then 1 <= len (IdFinS ('not' p),(card A)) by XXREAL_0:2;
then 1 <= card A by FINSEQ_1:def 18;
then A96: |- (g ^ <*('not' p)*>) ^ <*p*> by A88, CALCUL_2:32;
|- (g ^ <*p*>) ^ <*p*> by CALCUL_2:21;
then A97: |- g ^ <*p*> by A96, CALCUL_2:26;
A98: rng g = (rng f) \ {('not' p)} by FINSEQ_3:72;
(rng f) \ {('not' p)} c= (X \/ {('not' p)}) \ {('not' p)} by A7, XBOOLE_1:33;
then A99: rng g c= X \ {('not' p)} by A98, XBOOLE_1:40;
X \ {('not' p)} c= X by XBOOLE_1:36;
then rng g c= X by A99, XBOOLE_1:1;
hence X |- p by A97, Def2; :: thesis: verum
end;
hence X |- p by A7, Def2; :: thesis: verum
end;