:: HILBERT2 semantic presentation

theorem Th1: :: HILBERT2:1
for b1 being set
for b2 being ManySortedSet of b1 st ( for b3 being set st b3 in b1 holds
b2 . b3 is ManySortedSet of b3 ) holds
for b3 being Function st b3 = Union b2 holds
dom b3 = union b1
proof end;

theorem Th2: :: HILBERT2:2
for b1, b2 being set
for b3, b4 being FinSequence st <*b1*> ^ b3 = <*b2*> ^ b4 holds
b3 = b4
proof end;

theorem Th3: :: HILBERT2:3
for b1, b2 being set st <*b1*> is FinSequence of b2 holds
b1 in b2
proof end;

theorem Th4: :: HILBERT2:4
for b1 being set
for b2 being FinSequence of b1 st b2 <> {} holds
ex b3 being FinSequence of b1ex b4 being Element of b1 st b2 = b3 ^ <*b4*>
proof end;

theorem Th5: :: HILBERT2:5
for b1 being set
for b2, b3 being Tree holds
( <*b1*> in tree b2,b3 iff ( b1 = 0 or b1 = 1 ) )
proof end;

registration
cluster {} -> Tree-yielding ;
coherence
{} is Tree-yielding
by TREES_3:23;
end;

scheme :: HILBERT2:sch 1
s1{ F1() -> Tree, P1[ set ] } :
for b1 being Element of F1() holds P1[b1]
provided
E6: P1[ <*> NAT ] and
E7: for b1 being Element of F1() st P1[b1] holds
for b2 being Nat st b1 ^ <*b2*> in F1() holds
P1[b1 ^ <*b2*>]
proof end;

theorem Th6: :: HILBERT2:6
for b1 being set
for b2, b3 being DecoratedTree holds (b1 -tree b2,b3) . {} = b1
proof end;

theorem Th7: :: HILBERT2:7
for b1 being set
for b2, b3 being DecoratedTree holds
( (b1 -tree b2,b3) . <*0*> = b2 . {} & (b1 -tree b2,b3) . <*1*> = b3 . {} )
proof end;

theorem Th8: :: HILBERT2:8
for b1 being set
for b2, b3 being DecoratedTree holds
( (b1 -tree b2,b3) | <*0*> = b2 & (b1 -tree b2,b3) | <*1*> = b3 )
proof end;

registration
let c1 be set ;
let c2 be non empty DTree-yielding FinSequence;
cluster a1 -tree a2 -> non root ;
coherence
not c1 -tree c2 is root
proof end;
end;

registration
let c1 be set ;
let c2 be DecoratedTree;
cluster a1 -tree a2 -> non root ;
coherence
not c1 -tree c2 is root
proof end;
let c3 be DecoratedTree;
cluster a1 -tree a2,a3 -> non root ;
coherence
not c1 -tree c2,c3 is root
proof end;
end;

definition
let c1 be Nat;
func prop c1 -> Element of HP-WFF equals :: HILBERT2:def 1
<*(3 + a1)*>;
coherence
<*(3 + c1)*> is Element of HP-WFF
by HILBERT1:def 4;
end;

:: deftheorem Def1 defines prop HILBERT2:def 1 :
for b1 being Nat holds prop b1 = <*(3 + b1)*>;

definition
let c1 be set ;
redefine attr a1 is with_VERUM means :: HILBERT2:def 2
VERUM in a1;
compatibility
( c1 is with_VERUM iff VERUM in c1 )
by HILBERT1:def 1;
redefine attr a1 is with_propositional_variables means :: HILBERT2:def 3
for b1 being Nat holds prop b1 in a1;
compatibility
( c1 is with_propositional_variables iff for b1 being Nat holds prop b1 in c1 )
proof end;
end;

:: deftheorem Def2 defines with_VERUM HILBERT2:def 2 :
for b1 being set holds
( b1 is with_VERUM iff VERUM in b1 );

:: deftheorem Def3 defines with_propositional_variables HILBERT2:def 3 :
for b1 being set holds
( b1 is with_propositional_variables iff for b2 being Nat holds prop b2 in b1 );

definition
let c1 be Subset of HP-WFF ;
redefine attr a1 is with_implication means :: HILBERT2:def 4
for b1, b2 being Element of HP-WFF st b1 in a1 & b2 in a1 holds
b1 => b2 in a1;
compatibility
( c1 is with_implication iff for b1, b2 being Element of HP-WFF st b1 in c1 & b2 in c1 holds
b1 => b2 in c1 )
proof end;
redefine attr a1 is with_conjunction means :: HILBERT2:def 5
for b1, b2 being Element of HP-WFF st b1 in a1 & b2 in a1 holds
b1 '&' b2 in a1;
compatibility
( c1 is with_conjunction iff for b1, b2 being Element of HP-WFF st b1 in c1 & b2 in c1 holds
b1 '&' b2 in c1 )
proof end;
end;

:: deftheorem Def4 defines with_implication HILBERT2:def 4 :
for b1 being Subset of HP-WFF holds
( b1 is with_implication iff for b2, b3 being Element of HP-WFF st b2 in b1 & b3 in b1 holds
b2 => b3 in b1 );

:: deftheorem Def5 defines with_conjunction HILBERT2:def 5 :
for b1 being Subset of HP-WFF holds
( b1 is with_conjunction iff for b2, b3 being Element of HP-WFF st b2 in b1 & b3 in b1 holds
b2 '&' b3 in b1 );

definition
let c1 be Element of HP-WFF ;
attr a1 is conjunctive means :Def6: :: HILBERT2:def 6
ex b1, b2 being Element of HP-WFF st a1 = b1 '&' b2;
attr a1 is conditional means :Def7: :: HILBERT2:def 7
ex b1, b2 being Element of HP-WFF st a1 = b1 => b2;
attr a1 is simple means :Def8: :: HILBERT2:def 8
ex b1 being Nat st a1 = prop b1;
end;

:: deftheorem Def6 defines conjunctive HILBERT2:def 6 :
for b1 being Element of HP-WFF holds
( b1 is conjunctive iff ex b2, b3 being Element of HP-WFF st b1 = b2 '&' b3 );

:: deftheorem Def7 defines conditional HILBERT2:def 7 :
for b1 being Element of HP-WFF holds
( b1 is conditional iff ex b2, b3 being Element of HP-WFF st b1 = b2 => b3 );

:: deftheorem Def8 defines simple HILBERT2:def 8 :
for b1 being Element of HP-WFF holds
( b1 is simple iff ex b2 being Nat st b1 = prop b2 );

scheme :: HILBERT2:sch 2
s2{ P1[ set ] } :
for b1 being Element of HP-WFF holds P1[b1]
provided
E12: P1[ VERUM ] and
E13: for b1 being Nat holds P1[ prop b1] and
E14: for b1, b2 being Element of HP-WFF st P1[b1] & P1[b2] holds
( P1[b1 '&' b2] & P1[b1 => b2] )
proof end;

theorem Th9: :: HILBERT2:9
for b1 being Element of HP-WFF holds
( b1 is conjunctive or b1 is conditional or b1 is simple or b1 = VERUM )
proof end;

theorem Th10: :: HILBERT2:10
for b1 being Element of HP-WFF holds len b1 >= 1
proof end;

theorem Th11: :: HILBERT2:11
for b1 being Element of HP-WFF st b1 . 1 = 1 holds
b1 is conditional
proof end;

theorem Th12: :: HILBERT2:12
for b1 being Element of HP-WFF st b1 . 1 = 2 holds
b1 is conjunctive
proof end;

theorem Th13: :: HILBERT2:13
for b1 being Nat
for b2 being Element of HP-WFF st b2 . 1 = 3 + b1 holds
b2 is simple
proof end;

theorem Th14: :: HILBERT2:14
for b1 being Element of HP-WFF st b1 . 1 = 0 holds
b1 = VERUM
proof end;

theorem Th15: :: HILBERT2:15
for b1, b2 being Element of HP-WFF holds
( len b1 < len (b1 '&' b2) & len b2 < len (b1 '&' b2) )
proof end;

theorem Th16: :: HILBERT2:16
for b1, b2 being Element of HP-WFF holds
( len b1 < len (b1 => b2) & len b2 < len (b1 => b2) )
proof end;

theorem Th17: :: HILBERT2:17
for b1, b2 being Element of HP-WFF
for b3 being FinSequence st b1 = b2 ^ b3 holds
b1 = b2
proof end;

theorem Th18: :: HILBERT2:18
for b1, b2, b3, b4 being Element of HP-WFF st b1 ^ b2 = b3 ^ b4 holds
( b1 = b3 & b2 = b4 )
proof end;

theorem Th19: :: HILBERT2:19
for b1, b2, b3, b4 being Element of HP-WFF st b1 '&' b2 = b3 '&' b4 holds
( b1 = b3 & b4 = b2 )
proof end;

theorem Th20: :: HILBERT2:20
for b1, b2, b3, b4 being Element of HP-WFF st b1 => b2 = b3 => b4 holds
( b1 = b3 & b4 = b2 )
proof end;

theorem Th21: :: HILBERT2:21
for b1, b2 being Nat st prop b1 = prop b2 holds
b1 = b2
proof end;

theorem Th22: :: HILBERT2:22
for b1, b2, b3, b4 being Element of HP-WFF holds b1 '&' b2 <> b3 => b4
proof end;

theorem Th23: :: HILBERT2:23
for b1, b2 being Element of HP-WFF holds b1 '&' b2 <> VERUM
proof end;

theorem Th24: :: HILBERT2:24
for b1 being Nat
for b2, b3 being Element of HP-WFF holds b2 '&' b3 <> prop b1
proof end;

theorem Th25: :: HILBERT2:25
for b1, b2 being Element of HP-WFF holds b1 => b2 <> VERUM
proof end;

theorem Th26: :: HILBERT2:26
for b1 being Nat
for b2, b3 being Element of HP-WFF holds b2 => b3 <> prop b1
proof end;

theorem Th27: :: HILBERT2:27
for b1, b2 being Element of HP-WFF holds
( b1 '&' b2 <> b1 & b1 '&' b2 <> b2 )
proof end;

theorem Th28: :: HILBERT2:28
for b1, b2 being Element of HP-WFF holds
( b1 => b2 <> b1 & b1 => b2 <> b2 )
proof end;

theorem Th29: :: HILBERT2:29
for b1 being Nat holds VERUM <> prop b1
proof end;

scheme :: HILBERT2:sch 3
s3{ F1() -> set , F2( Nat) -> set , P1[ Element of HP-WFF , Element of HP-WFF , set , set , set ], P2[ Element of HP-WFF , Element of HP-WFF , set , set , set ] } :
ex b1 being ManySortedSet of HP-WFF st
( b1 . VERUM = F1() & ( for b2 being Nat holds b1 . (prop b2) = F2(b2) ) & ( for b2, b3 being Element of HP-WFF holds
( P1[b2,b3,b1 . b2,b1 . b3,b1 . (b2 '&' b3)] & P2[b2,b3,b1 . b2,b1 . b3,b1 . (b2 => b3)] ) ) )
provided
E31: for b1, b2 being Element of HP-WFF
for b3, b4 being set ex b5 being set st P1[b1,b2,b3,b4,b5] and
E32: for b1, b2 being Element of HP-WFF
for b3, b4 being set ex b5 being set st P2[b1,b2,b3,b4,b5] and
E33: for b1, b2 being Element of HP-WFF
for b3, b4, b5, b6 being set st P1[b1,b2,b3,b4,b5] & P1[b1,b2,b3,b4,b6] holds
b5 = b6 and
E34: for b1, b2 being Element of HP-WFF
for b3, b4, b5, b6 being set st P2[b1,b2,b3,b4,b5] & P2[b1,b2,b3,b4,b6] holds
b5 = b6
proof end;

scheme :: HILBERT2:sch 4
s4{ F1() -> set , F2( Nat) -> set , F3( set , set ) -> set , F4( set , set ) -> set } :
ex b1 being ManySortedSet of HP-WFF st
( b1 . VERUM = F1() & ( for b2 being Nat holds b1 . (prop b2) = F2(b2) ) & ( for b2, b3 being Element of HP-WFF holds
( b1 . (b2 '&' b3) = F3((b1 . b2),(b1 . b3)) & b1 . (b2 => b3) = F4((b1 . b2),(b1 . b3)) ) ) )
proof end;

definition
func HP-Subformulae -> ManySortedSet of HP-WFF means :Def9: :: HILBERT2:def 9
( a1 . VERUM = root-tree VERUM & ( for b1 being Nat holds a1 . (prop b1) = root-tree (prop b1) ) & ( for b1, b2 being Element of HP-WFF ex b3, b4 being DecoratedTree of HP-WFF st
( b3 = a1 . b1 & b4 = a1 . b2 & a1 . (b1 '&' b2) = (b1 '&' b2) -tree b3,b4 & a1 . (b1 => b2) = (b1 => b2) -tree b3,b4 ) ) );
existence
ex b1 being ManySortedSet of HP-WFF st
( b1 . VERUM = root-tree VERUM & ( for b2 being Nat holds b1 . (prop b2) = root-tree (prop b2) ) & ( for b2, b3 being Element of HP-WFF ex b4, b5 being DecoratedTree of HP-WFF st
( b4 = b1 . b2 & b5 = b1 . b3 & b1 . (b2 '&' b3) = (b2 '&' b3) -tree b4,b5 & b1 . (b2 => b3) = (b2 => b3) -tree b4,b5 ) ) )
proof end;
uniqueness
for b1, b2 being ManySortedSet of HP-WFF st b1 . VERUM = root-tree VERUM & ( for b3 being Nat holds b1 . (prop b3) = root-tree (prop b3) ) & ( for b3, b4 being Element of HP-WFF ex b5, b6 being DecoratedTree of HP-WFF st
( b5 = b1 . b3 & b6 = b1 . b4 & b1 . (b3 '&' b4) = (b3 '&' b4) -tree b5,b6 & b1 . (b3 => b4) = (b3 => b4) -tree b5,b6 ) ) & b2 . VERUM = root-tree VERUM & ( for b3 being Nat holds b2 . (prop b3) = root-tree (prop b3) ) & ( for b3, b4 being Element of HP-WFF ex b5, b6 being DecoratedTree of HP-WFF st
( b5 = b2 . b3 & b6 = b2 . b4 & b2 . (b3 '&' b4) = (b3 '&' b4) -tree b5,b6 & b2 . (b3 => b4) = (b3 => b4) -tree b5,b6 ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def9 defines HP-Subformulae HILBERT2:def 9 :
for b1 being ManySortedSet of HP-WFF holds
( b1 = HP-Subformulae iff ( b1 . VERUM = root-tree VERUM & ( for b2 being Nat holds b1 . (prop b2) = root-tree (prop b2) ) & ( for b2, b3 being Element of HP-WFF ex b4, b5 being DecoratedTree of HP-WFF st
( b4 = b1 . b2 & b5 = b1 . b3 & b1 . (b2 '&' b3) = (b2 '&' b3) -tree b4,b5 & b1 . (b2 => b3) = (b2 => b3) -tree b4,b5 ) ) ) );

definition
let c1 be Element of HP-WFF ;
func Subformulae c1 -> DecoratedTree of HP-WFF equals :: HILBERT2:def 10
HP-Subformulae . a1;
correctness
coherence
HP-Subformulae . c1 is DecoratedTree of HP-WFF
;
proof end;
end;

:: deftheorem Def10 defines Subformulae HILBERT2:def 10 :
for b1 being Element of HP-WFF holds Subformulae b1 = HP-Subformulae . b1;

theorem Th30: :: HILBERT2:30
Subformulae VERUM = root-tree VERUM by Def9;

theorem Th31: :: HILBERT2:31
for b1 being Nat holds Subformulae (prop b1) = root-tree (prop b1) by Def9;

theorem Th32: :: HILBERT2:32
for b1, b2 being Element of HP-WFF holds Subformulae (b1 '&' b2) = (b1 '&' b2) -tree (Subformulae b1),(Subformulae b2)
proof end;

theorem Th33: :: HILBERT2:33
for b1, b2 being Element of HP-WFF holds Subformulae (b1 => b2) = (b1 => b2) -tree (Subformulae b1),(Subformulae b2)
proof end;

theorem Th34: :: HILBERT2:34
for b1 being Element of HP-WFF holds (Subformulae b1) . {} = b1
proof end;

theorem Th35: :: HILBERT2:35
for b1 being Element of HP-WFF
for b2 being Element of dom (Subformulae b1) holds (Subformulae b1) | b2 = Subformulae ((Subformulae b1) . b2)
proof end;

theorem Th36: :: HILBERT2:36
for b1, b2 being Element of HP-WFF holds
( not b1 in Leaves (Subformulae b2) or b1 = VERUM or b1 is simple )
proof end;