:: BINTREE2 semantic presentation
theorem E1: :: BINTREE2:1
theorem E2: :: BINTREE2:2
theorem E3: :: BINTREE2:3
proof
let c
1 be
Tree;
assume E4:
c
1 = {0,1} *
;
now
let c
2 be
Element of c
1;
assume
not c
2 in Leaves c
1
;
{ (c2 ^ <*b1*>) where B is Nat : c2 ^ <*b1*> in c1 } = {(c2 ^ <*0*>),(c2 ^ <*1*>)}
proof
thus
{ (c2 ^ <*b1*>) where B is Nat : c2 ^ <*b1*> in c1 } c= {(c2 ^ <*0*>),(c2 ^ <*1*>)}
:: uses XBOOLE_0:def 10
let c
3 be
set ;
:: uses TARSKI:def 3
E5:
c
2 is
FinSequence of
{0,1}
by E4, FINSEQ_1:def 11;
rng <*0*> c= {0,1}
then E6:
<*0*> is
FinSequence of
{0,1}
by FINSEQ_1:def 4;
rng <*1*> c= {0,1}
then E7:
<*1*> is
FinSequence of
{0,1}
by FINSEQ_1:def 4;
c
2 ^ <*0*> is
FinSequence of
{0,1}
by E5, E6, SCMFSA_7:23;
then E8:
c
2 ^ <*0*> in c
1
by E4, FINSEQ_1:def 11;
c
2 ^ <*1*> is
FinSequence of
{0,1}
by E5, E7, SCMFSA_7:23;
then E9:
c
2 ^ <*1*> in c
1
by E4, FINSEQ_1:def 11;
assume
c
3 in {(c2 ^ <*0*>),(c2 ^ <*1*>)}
;
then
( c
3 = c
2 ^ <*0*> or c
3 = c
2 ^ <*1*> )
by TARSKI:def 2;
hence
c
3 in { (c2 ^ <*b1*>) where B is Nat : c2 ^ <*b1*> in c1 }
by E8, E9;
end;
hence
succ c
2 = {(c2 ^ <*0*>),(c2 ^ <*1*>)}
by TREES_2:def 5;
end;
hence
c
1 is
binary
by BINTREE1:def 2;
end;
theorem E4: :: BINTREE2:4
theorem :: BINTREE2:5
theorem :: BINTREE2:6
theorem E5: :: BINTREE2:7
theorem E6: :: BINTREE2:8
scheme :: BINTREE2:sch 1
s1{ F
1()
-> non
empty set , F
2()
-> Element of F
1(), P
1[
set ,
set ,
set ] } :
provided
E7:
for b
1 being
Element of F
1() holds
ex b
2, b
3 being
Element of F
1() st P
1[b
1,b
2,b
3]
proof
defpred S
1[
set ,
set ] means ex b
1, b
2 being
Element of F
1() st
( P
1[a
1,b
1,b
2] & a
2 = [b1,b2] );
E8:
for b
1 being
set holds
not ( b
1 in F
1() & for b
2 being
set holds
not ( b
2 in [:F1(),F1():] & S
1[b
1,b
2] ) )
proof
let c
1 be
set ;
assume
c
1 in F
1()
;
then consider c
2, c
3 being
Element of F
1() such that
E9:
P
1[c
1,c
2,c
3]
by E7;
take c
4 =
[c2,c3];
thus
c
4 in [:F1(),F1():]
;
thus
S
1[c
1,c
4]
by E9;
end;
consider c
1 being
Function such that
E9:
dom c
1 = F
1()
and
E10:
rng c
1 c= [:F1(),F1():]
and
E11:
for b
1 being
set holds
( b
1 in F
1() implies S
1[b
1,c
1 . b
1] )
from WELLORD2:sch 1(E8);
deffunc H
1(
set )
-> set =
IFEQ (a1 `2 ),0,
((c1 . (a1 `1 )) `1 ),
((c1 . (a1 `1 )) `2 );
E12:
for b
1 being
set holds
( b
1 in [:F1(),NAT :] implies H
1(b
1)
in F
1() )
consider c
2 being
Function of
[:F1(),NAT :],F
1() such that
E13:
for b
1 being
set holds
( b
1 in [:F1(),NAT :] implies c
2 . b
1 = H
1(b
1) )
from FUNCT_2:sch 2(E12);
E14:
for b
1 being
set holds
( b
1 in F
1() implies P
1[b
1,c
2 . [b1,0],c
2 . [b1,1]] )
proof
let c
3 be
set ;
assume E15:
c
3 in F
1()
;
then consider c
4, c
5 being
Element of F
1() such that
E16:
P
1[c
3,c
4,c
5]
and
E17:
c
1 . c
3 = [c4,c5]
by E11;
E18:
[c3,0] `2 = 0
by MCART_1:7;
[c3,0] in [:F1(),NAT :]
by E15, ZFMISC_1:106;
then E19: c
2 . [c3,0] =
IFEQ ([c3,0] `2 ),0,
((c1 . ([c3,0] `1 )) `1 ),
((c1 . ([c3,0] `1 )) `2 )
by E13
.=
(c1 . ([c3,0] `1 )) `1
by E18, CQC_LANG:def 1
.=
(c1 . c3) `1
by MCART_1:7
.=
c
4
by E17, MCART_1:7
;
E20:
(
[c3,1] `2 = 1 & 1
<> 0 )
by MCART_1:7;
[c3,1] in [:F1(),NAT :]
by E15, ZFMISC_1:106;
then c
2 . [c3,1] =
IFEQ ([c3,1] `2 ),0,
((c1 . ([c3,1] `1 )) `1 ),
((c1 . ([c3,1] `1 )) `2 )
by E13
.=
(c1 . ([c3,1] `1 )) `2
by E20, CQC_LANG:def 1
.=
(c1 . c3) `2
by MCART_1:7
.=
c
5
by E17, MCART_1:7
;
hence
P
1[c
3,c
2 . [c3,0],c
2 . [c3,1]]
by E16, E19;
end;
deffunc H
2(
set )
-> Element of
NAT = 2;
consider c
3 being
DecoratedTree of F
1() such that
E15:
c
3 . {} = F
2()
and
E16:
for b
1 being
Element of
dom c
3 holds
(
succ b
1 = { (b1 ^ <*b2*>) where B is Nat : b2 < H2(c3 . b1) } & for b
2 being
Nat holds
( b
2 < H
2(c
3 . b
1) implies c
3 . (b1 ^ <*b2*>) = c
2 . [(c3 . b1),b2] ) )
from TREES_2:sch 9();
then
dom c
3 is
binary
by BINTREE1:def 2;
then reconsider c
4 = c
3 as
binary DecoratedTree of F
1()
by BINTREE1:def 3;
take
c
4
;
hence
dom c
4 = {0,1} *
by E6;
thus
c
4 . {} = F
2()
by E15;
let c
5 be
Node of c
4;
P
1[c
4 . c
5,c
2 . [(c4 . c5),0],c
2 . [(c4 . c5),1]]
by E14;
then
P
1[c
4 . c
5,c
4 . (c5 ^ <*0*>),c
2 . [(c4 . c5),1]]
by E16;
hence
P
1[c
4 . c
5,c
4 . (c5 ^ <*0*>),c
4 . (c5 ^ <*1*>)]
by E16;
end;
scheme :: BINTREE2:sch 2
s2{ F
1()
-> non
empty set , F
2()
-> Element of F
1(), P
1[
set ,
set ], P
2[
set ,
set ] } :
provided
E7:
for b
1 being
Element of F
1() holds
ex b
2 being
Element of F
1() st P
1[b
1,b
2]
and
E8:
for b
1 being
Element of F
1() holds
ex b
2 being
Element of F
1() st P
2[b
1,b
2]
proof
defpred S
1[
set ,
set ] means ( ( a
1 `2 = 0 implies P
1[a
1 `1 ,a
2] ) & ( a
1 `2 = 1 implies P
2[a
1 `1 ,a
2] ) );
E9:
for b
1 being
set holds
not ( b
1 in [:F1(),NAT :] & for b
2 being
set holds
not ( b
2 in F
1() & S
1[b
1,b
2] ) )
proof
let c
1 be
set ;
assume
c
1 in [:F1(),NAT :]
;
then reconsider c
2 = c
1 `1 as
Element of F
1()
by MCART_1:10;
consider c
3 being
Element of F
1() such that
E10:
P
1[c
2,c
3]
by E7;
consider c
4 being
Element of F
1() such that
E11:
P
2[c
2,c
4]
by E8;
take c
5 =
IFEQ (c1 `2 ),0,c
3,c
4;
thus
c
5 in F
1()
;
thus
( c
1 `2 = 0 implies P
1[c
1 `1 ,c
5] )
by E10, CQC_LANG:def 1;
thus
( c
1 `2 = 1 implies P
2[c
1 `1 ,c
5] )
by E11, CQC_LANG:def 1;
end;
consider c
1 being
Function such that
E10:
dom c
1 = [:F1(),NAT :]
and
E11:
rng c
1 c= F
1()
and
E12:
for b
1 being
set holds
( b
1 in [:F1(),NAT :] implies S
1[b
1,c
1 . b
1] )
from WELLORD2:sch 1(E9);
reconsider c
2 = c
1 as
Function of
[:F1(),NAT :],F
1()
by E10, E11, FUNCT_2:4;
deffunc H
1(
set )
-> Element of
NAT = 2;
consider c
3 being
DecoratedTree of F
1() such that
E13:
c
3 . {} = F
2()
and
E14:
for b
1 being
Element of
dom c
3 holds
(
succ b
1 = { (b1 ^ <*b2*>) where B is Nat : b2 < H1(c3 . b1) } & for b
2 being
Nat holds
( b
2 < H
1(c
3 . b
1) implies c
3 . (b1 ^ <*b2*>) = c
2 . [(c3 . b1),b2] ) )
from TREES_2:sch 9();
then
dom c
3 is
binary
by BINTREE1:def 2;
then reconsider c
4 = c
3 as
binary DecoratedTree of F
1()
by BINTREE1:def 3;
take
c
4
;
hence
dom c
4 = {0,1} *
by E6;
thus
c
4 . {} = F
2()
by E13;
let c
5 be
Node of c
4;
[(c4 . c5),0] `2 = 0
by MCART_1:7;
then
P
1[
[(c4 . c5),0] `1 ,c
2 . [(c4 . c5),0]]
by E12;
then
P
1[c
4 . c
5,c
2 . [(c4 . c5),0]]
by MCART_1:7;
hence
P
1[c
4 . c
5,c
4 . (c5 ^ <*0*>)]
by E14;
[(c4 . c5),1] `2 = 1
by MCART_1:7;
then
P
2[
[(c4 . c5),1] `1 ,c
2 . [(c4 . c5),1]]
by E12;
then
P
2[c
4 . c
5,c
2 . [(c4 . c5),1]]
by MCART_1:7;
hence
P
2[c
4 . c
5,c
4 . (c5 ^ <*1*>)]
by E14;
end;
E7:
for b1 being non empty set
for b2 being FinSequence of b1 holds
Rev b2 is FinSequence of b1
;
definition
let c
1 be
binary Tree;
let c
2 be non
empty Nat;
func NumberOnLevel a
2,a
1 -> Function of a
1 -level a
2,
NAT means :
E8:
:: BINTREE2:def 1
for b
1 being
Element of a
1 holds
( b
1 in a
1 -level a
2 implies for b
2 being
Tuple of a
2,
BOOLEAN holds
( b
2 = Rev b
1 implies a
3 . b
1 = (Absval b2) + 1 ) );
existence
ex b1 being Function of c1 -level c2, NAT st
for b2 being Element of c1 holds
( b2 in c1 -level c2 implies for b3 being Tuple of c2,BOOLEAN holds
( b3 = Rev b2 implies b1 . b2 = (Absval b3) + 1 ) )
proof
defpred S
1[
set ,
set ] means ex b
1 being
Element of c
1 st
( b
1 = a
1 & for b
2 being
Tuple of c
2,
BOOLEAN holds
( b
2 = Rev b
1 implies a
2 = (Absval b2) + 1 ) );
E8:
for b
1 being
set holds
not ( b
1 in c
1 -level c
2 & for b
2 being
set holds
not ( b
2 in NAT & S
1[b
1,b
2] ) )
consider c
3 being
Function such that
E9:
dom c
3 = c
1 -level c
2
and
E10:
rng c
3 c= NAT
and
E11:
for b
1 being
set holds
( b
1 in c
1 -level c
2 implies S
1[b
1,c
3 . b
1] )
from WELLORD2:sch 1(E8);
reconsider c
4 = c
3 as
Function of c
1 -level c
2,
NAT by E9, E10, FUNCT_2:4;
take
c
4
;
let c
5 be
Element of c
1;
assume
c
5 in c
1 -level c
2
;
then consider c
6 being
Element of c
1 such that
E12:
c
6 = c
5
and
E13:
for b
1 being
Tuple of c
2,
BOOLEAN holds
( b
1 = Rev c
6 implies c
4 . c
5 = (Absval b1) + 1 )
by E11;
let c
7 be
Tuple of c
2,
BOOLEAN ;
assume
c
7 = Rev c
5
;
hence
c
4 . c
5 = (Absval c7) + 1
by E12, E13;
end;
uniqueness
for b1, b2 being Function of c1 -level c2, NAT holds
( ( for b