set G = F1();
deffunc H3( Symbol of F1(), FinSequence) -> Element of F2() = F4($1,(pr1 (roots $2)),(pr2 (roots $2)));
deffunc H4( set , set ) -> set = $2 \/ { ([o,F4(o,(pr1 (roots p)),(pr2 (roots p)))] -tree p) where o is Symbol of F1(), p is Element of $2 * : ex q being FinSequence of FinTrees [:the carrier of F1(),F2():] st
( p = q & o ==> pr1 (roots q) ) } ;
consider f being Function such that
A1:
dom f = NAT
and
A2:
f . 0 = { (root-tree [t,d]) where t is Symbol of F1(), d is Element of F2() : ( ( t in Terminals F1() & d = F3(t) ) or ( t ==> {} & d = F4(t,{} ,{} ) ) ) }
and
A3:
for n being Nat holds f . (n + 1) = H4(n,f . n)
from NAT_1:sch 11();
A4:
for n being Element of NAT holds f . (n + 1) = (f . n) \/ { ([o,F4(o,(pr1 (roots p)),(pr2 (roots p)))] -tree p) where o is Symbol of F1(), p is Element of (f . n) * : ex q being FinSequence of FinTrees [:the carrier of F1(),F2():] st
( p = q & o ==> pr1 (roots q) ) }
by A3;
ex X1 being Subset of (FinTrees the carrier of F1()) st
( X1 = { (t `1 ) where t is Element of FinTrees [:the carrier of F1(),F2():] : t in Union f } & ( for d being Symbol of F1() st d in Terminals F1() holds
root-tree d in X1 ) & ( for o being Symbol of F1()
for p being FinSequence of X1 st o ==> roots p holds
o -tree p in X1 ) & ( for F being Subset of (FinTrees the carrier of F1()) st ( for d being Symbol of F1() st d in Terminals F1() holds
root-tree d in F ) & ( for o being Symbol of F1()
for p being FinSequence of F st o ==> roots p holds
o -tree p in F ) holds
X1 c= F ) )
from DTCONSTR:sch 4(A1, A2, A4);
then A5:
TS F1() = { (t `1 ) where t is Element of FinTrees [:the carrier of F1(),F2():] : t in Union f }
by Def4;
defpred S1[ set , set ] means for dt being DecoratedTree of st dt in Union f & $1 = dt `1 holds
$2 = (dt `2 ) . {} ;
A6:
for e being set st e in TS F1() holds
ex u being set st
( u in F2() & S1[e,u] )
consider ff being Function such that
A9:
( dom ff = TS F1() & rng ff c= F2() )
and
A10:
for e being set st e in TS F1() holds
S1[e,ff . e]
from WELLORD2:sch 1(A6);
reconsider ff = ff as Function of (TS F1()),F2() by A9, FUNCT_2:def 1, RELSET_1:11;
take
ff
; :: thesis: ( ( for t being Symbol of F1() st t in Terminals F1() holds
ff . (root-tree t) = F3(t) ) & ( for nt being Symbol of F1()
for ts being FinSequence of TS F1() st nt ==> roots ts holds
ff . (nt -tree ts) = F4(nt,(roots ts),(ff * ts)) ) )
consider X being Subset of (FinTrees [:the carrier of F1(),F2():]) such that
A11:
X = Union f
and
A12:
for d being Symbol of F1() st d in Terminals F1() holds
root-tree [d,F3(d)] in X
and
A13:
for o being Symbol of F1()
for p being FinSequence of X st o ==> pr1 (roots p) holds
[o,F4(o,(pr1 (roots p)),(pr2 (roots p)))] -tree p in X
and
for F being Subset of (FinTrees [:the carrier of F1(),F2():]) st ( for d being Symbol of F1() st d in Terminals F1() holds
root-tree [d,F3(d)] in F ) & ( for o being Symbol of F1()
for p being FinSequence of F st o ==> pr1 (roots p) holds
[o,F4(o,(pr1 (roots p)),(pr2 (roots p)))] -tree p in F ) holds
X c= F
from DTCONSTR:sch 3(A1, A2, A4);
hereby :: thesis: for nt being Symbol of F1()
for ts being FinSequence of TS F1() st nt ==> roots ts holds
ff . (nt -tree ts) = F4(nt,(roots ts),(ff * ts))
let t be
Symbol of
F1();
:: thesis: ( t in Terminals F1() implies ff . (root-tree t) = F3(t) )assume A14:
t in Terminals F1()
;
:: thesis: ff . (root-tree t) = F3(t)A15:
(
(root-tree [t,F3(t)]) `1 = root-tree t &
(root-tree [t,F3(t)]) `2 = root-tree F3(
t) )
by TREES_4:25;
root-tree [t,F3(t)] in Union f
by A11, A12, A14;
then
root-tree t in TS F1()
by A5, A15;
hence ff . (root-tree t) =
(root-tree F3(t)) . {}
by A10, A11, A12, A14, A15
.=
F3(
t)
by TREES_4:3
;
:: thesis: verum
end;
let nt be Symbol of F1(); :: thesis: for ts being FinSequence of TS F1() st nt ==> roots ts holds
ff . (nt -tree ts) = F4(nt,(roots ts),(ff * ts))
let ts be FinSequence of TS F1(); :: thesis: ( nt ==> roots ts implies ff . (nt -tree ts) = F4(nt,(roots ts),(ff * ts)) )
set rts = roots ts;
assume A16:
nt ==> roots ts
; :: thesis: ff . (nt -tree ts) = F4(nt,(roots ts),(ff * ts))
set x = ff * ts;
A17:
dom ts = Seg (len ts)
by FINSEQ_1:def 3;
defpred S2[ set , set ] means ex dt being DecoratedTree of st
( dt = $2 & dt `1 = ts . $1 & dt in Union f );
A18:
for k being Nat st k in Seg (len ts) holds
ex x being Element of FinTrees [:the carrier of F1(),F2():] st S2[k,x]
consider dts being FinSequence of FinTrees [:the carrier of F1(),F2():] such that
A19:
dom dts = Seg (len ts)
and
A20:
for k being Nat st k in Seg (len ts) holds
S2[k,dts . k]
from FINSEQ_1:sch 5(A18);
rng dts c= X
then reconsider dts = dts as FinSequence of X by FINSEQ_1:def 4;
A22:
dom (roots ts) = dom ts
by TREES_3:def 18;
A23:
( dom (pr1 (roots dts)) = dom (roots dts) & dom (pr2 (roots dts)) = dom (roots dts) )
by MCART_1:def 12, MCART_1:def 13;
then A24:
( dom (pr1 (roots dts)) = dom ts & dom (pr2 (roots dts)) = dom ts )
by A17, A19, TREES_3:def 18;
now let k be
Nat;
:: thesis: ( k in dom ts implies (roots ts) . k = (pr1 (roots dts)) . k )assume A25:
k in dom ts
;
:: thesis: (roots ts) . k = (pr1 (roots dts)) . kthen consider dt being
DecoratedTree of
such that A26:
(
dt = dts . k &
dt `1 = ts . k &
dt in Union f )
by A17, A20;
reconsider r =
{} as
Node of
dt by TREES_1:47;
ex
T being
DecoratedTree st
(
T = ts . k &
(roots ts) . k = T . {} )
by A25, TREES_3:def 18;
then A27:
(roots ts) . k = (dt . r) `1
by A26, TREES_3:41;
ex
T being
DecoratedTree st
(
T = dts . k &
(roots dts) . k = T . {} )
by A17, A19, A25, TREES_3:def 18;
hence
(roots ts) . k = (pr1 (roots dts)) . k
by A23, A24, A25, A26, A27, MCART_1:def 12;
:: thesis: verum end;
then A28:
roots ts = pr1 (roots dts)
by A22, A24, FINSEQ_1:17;
then A29:
[nt,H3(nt,dts)] -tree dts in X
by A13, A16;
A30:
rng dts c= FinTrees [:the carrier of F1(),F2():]
by FINSEQ_1:def 4;
FinTrees [:the carrier of F1(),F2():] c= Trees [:the carrier of F1(),F2():]
by TREES_3:22;
then
rng dts c= Trees [:the carrier of F1(),F2():]
by A30, XBOOLE_1:1;
then reconsider dts' = dts as FinSequence of Trees [:the carrier of F1(),F2():] by FINSEQ_1:def 4;
A31:
rng ts c= FinTrees the carrier of F1()
by FINSEQ_1:def 4;
FinTrees the carrier of F1() c= Trees the carrier of F1()
by TREES_3:22;
then
rng ts c= Trees the carrier of F1()
by A31, XBOOLE_1:1;
then reconsider ts' = ts as FinSequence of Trees the carrier of F1() by FINSEQ_1:def 4;
then A33:
([nt,H3(nt,dts)] -tree dts') `1 = nt -tree ts'
by A17, A19, TREES_4:27;
A34:
rng ts c= dom ff
by A9, FINSEQ_1:def 4;
then A35:
dom (ff * ts) = dom ts
by RELAT_1:46;
now let k be
Nat;
:: thesis: ( k in dom ts implies (ff * ts) . k = (pr2 (roots dts)) . k )assume A36:
k in dom ts
;
:: thesis: (ff * ts) . k = (pr2 (roots dts)) . kthen consider dt being
DecoratedTree of
such that A37:
(
dt = dts . k &
dt `1 = ts . k &
dt in Union f )
by A17, A20;
reconsider r =
{} as
Node of
dt by TREES_1:47;
A38:
ts . k in rng ts
by A36, FUNCT_1:def 5;
A39:
(ff * ts) . k =
ff . (dt `1 )
by A35, A36, A37, FUNCT_1:22
.=
(dt `2 ) . {}
by A9, A10, A34, A37, A38
.=
(dt . r) `2
by TREES_3:41
;
ex
T being
DecoratedTree st
(
T = dts . k &
(roots dts) . k = T . r )
by A17, A19, A36, TREES_3:def 18;
hence
(ff * ts) . k = (pr2 (roots dts)) . k
by A23, A24, A36, A37, A39, MCART_1:def 13;
:: thesis: verum end;
then A40:
ff * ts = pr2 (roots dts)
by A24, A35, FINSEQ_1:17;
reconsider r = {} as Node of ([nt,F4(nt,(roots ts),(ff * ts))] -tree dts) by TREES_1:47;
nt -tree ts in TS F1()
by A5, A11, A29, A33;
then ff . (nt -tree ts) =
(([nt,F4(nt,(roots ts),(ff * ts))] -tree dts) `2 ) . r
by A10, A11, A13, A16, A28, A33, A40
.=
(([nt,F4(nt,(roots ts),(ff * ts))] -tree dts) . r) `2
by TREES_3:41
.=
[nt,F4(nt,(roots ts),(ff * ts))] `2
by TREES_4:def 4
;
hence
ff . (nt -tree ts) = F4(nt,(roots ts),(ff * ts))
by MCART_1:7; :: thesis: verum