:: TREES_A semantic presentation

theorem Th1: :: TREES_A:1
for b1, b2, b3, b4 being FinSequence st b1 ^ b2 = b4 ^ b3 holds
b1,b4 are_c=-comparable
proof end;

definition
let c1, c2 be Tree;
let c3 be AntiChain_of_Prefixes of c1;
assume E2: c3 <> {} ;
func tree c1,c3,c2 -> Tree means :Def1: :: TREES_A:def 1
for b1 being FinSequence of NAT holds
( b1 in a4 iff ( ( b1 in a1 & ( for b2 being FinSequence of NAT st b2 in a3 holds
not b2 is_a_proper_prefix_of b1 ) ) or ex b2, b3 being FinSequence of NAT st
( b2 in a3 & b3 in a2 & b1 = b2 ^ b3 ) ) );
existence
ex b1 being Tree st
for b2 being FinSequence of NAT holds
( b2 in b1 iff ( ( b2 in c1 & ( for b3 being FinSequence of NAT st b3 in c3 holds
not b3 is_a_proper_prefix_of b2 ) ) or ex b3, b4 being FinSequence of NAT st
( b3 in c3 & b4 in c2 & b2 = b3 ^ b4 ) ) )
proof end;
uniqueness
for b1, b2 being Tree st ( for b3 being FinSequence of NAT holds
( b3 in b1 iff ( ( b3 in c1 & ( for b4 being FinSequence of NAT st b4 in c3 holds
not b4 is_a_proper_prefix_of b3 ) ) or ex b4, b5 being FinSequence of NAT st
( b4 in c3 & b5 in c2 & b3 = b4 ^ b5 ) ) ) ) & ( for b3 being FinSequence of NAT holds
( b3 in b2 iff ( ( b3 in c1 & ( for b4 being FinSequence of NAT st b4 in c3 holds
not b4 is_a_proper_prefix_of b3 ) ) or ex b4, b5 being FinSequence of NAT st
( b4 in c3 & b5 in c2 & b3 = b4 ^ b5 ) ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def1 defines tree TREES_A:def 1 :
for b1, b2 being Tree
for b3 being AntiChain_of_Prefixes of b1 st b3 <> {} holds
for b4 being Tree holds
( b4 = tree b1,b3,b2 iff for b5 being FinSequence of NAT holds
( b5 in b4 iff ( ( b5 in b1 & ( for b6 being FinSequence of NAT st b6 in b3 holds
not b6 is_a_proper_prefix_of b5 ) ) or ex b6, b7 being FinSequence of NAT st
( b6 in b3 & b7 in b2 & b5 = b6 ^ b7 ) ) ) );

theorem Th2: :: TREES_A:2
for b1, b2 being Tree
for b3 being AntiChain_of_Prefixes of b1 st b3 <> {} holds
tree b1,b3,b2 = { b4 where B is Element of b1 : for b1 being FinSequence of NAT st b5 in b3 holds
not b5 is_a_proper_prefix_of b4
}
\/ { (b4 ^ b5) where B is Element of b1, B is Element of b2 : b4 in b3 }
proof end;

theorem Th3: :: TREES_A:3
for b1 being Tree
for b2 being AntiChain_of_Prefixes of b1 holds { b3 where B is Element of b1 : for b1 being FinSequence of NAT st b4 in b2 holds
not b4 is_a_prefix_of b3
}
c= { b3 where B is Element of b1 : for b1 being FinSequence of NAT st b4 in b2 holds
not b4 is_a_proper_prefix_of b3
}
proof end;

theorem Th4: :: TREES_A:4
for b1 being Tree
for b2 being AntiChain_of_Prefixes of b1 holds b2 c= { b3 where B is Element of b1 : for b1 being FinSequence of NAT st b4 in b2 holds
not b4 is_a_proper_prefix_of b3
}
proof end;

theorem Th5: :: TREES_A:5
for b1 being Tree
for b2 being AntiChain_of_Prefixes of b1 holds { b3 where B is Element of b1 : for b1 being FinSequence of NAT st b4 in b2 holds
not b4 is_a_proper_prefix_of b3
}
\ { b3 where B is Element of b1 : for b1 being FinSequence of NAT st b4 in b2 holds
not b4 is_a_prefix_of b3
}
= b2
proof end;

theorem Th6: :: TREES_A:6
for b1, b2 being Tree
for b3 being AntiChain_of_Prefixes of b1 holds b3 c= { (b4 ^ b5) where B is Element of b1, B is Element of b2 : b4 in b3 }
proof end;

theorem Th7: :: TREES_A:7
for b1, b2 being Tree
for b3 being AntiChain_of_Prefixes of b1 st b3 <> {} holds
tree b1,b3,b2 = { b4 where B is Element of b1 : for b1 being FinSequence of NAT st b5 in b3 holds
not b5 is_a_prefix_of b4
}
\/ { (b4 ^ b5) where B is Element of b1, B is Element of b2 : b4 in b3 }
proof end;

theorem Th8: :: TREES_A:8
canceled;

theorem Th9: :: TREES_A:9
for b1, b2 being Tree
for b3 being AntiChain_of_Prefixes of b2
for b4 being FinSequence of NAT st b4 in b3 holds
b1 = (tree b2,b3,b1) | b4
proof end;

registration
let c1 be Tree;
cluster non empty AntiChain_of_Prefixes of a1;
existence
not for b1 being AntiChain_of_Prefixes of c1 holds b1 is empty
proof end;
end;

definition
let c1 be Tree;
let c2 be Element of c1;
redefine func { as {c2} -> non empty AntiChain_of_Prefixes of a1;
correctness
coherence
{c2} is non empty AntiChain_of_Prefixes of c1
;
by TREES_1:74;
end;

theorem Th10: :: TREES_A:10
for b1, b2 being Tree
for b3 being Element of b1 holds tree b1,{b3},b2 = b1 with-replacement b3,b2
proof end;

definition
let c1 be DecoratedTree;
let c2 be AntiChain_of_Prefixes of dom c1;
let c3 be DecoratedTree;
assume E10: c2 <> {} ;
func tree c1,c2,c3 -> DecoratedTree means :Def2: :: TREES_A:def 2
( dom a4 = tree (dom a1),a2,(dom a3) & ( for b1 being FinSequence of NAT holds
( not b1 in tree (dom a1),a2,(dom a3) or for b2 being FinSequence of NAT st b2 in a2 holds
( not b2 is_a_prefix_of b1 & a4 . b1 = a1 . b1 ) or ex b2, b3 being FinSequence of NAT st
( b2 in a2 & b3 in dom a3 & b1 = b2 ^ b3 & a4 . b1 = a3 . b3 ) ) ) );
existence
ex b1 being DecoratedTree st
( dom b1 = tree (dom c1),c2,(dom c3) & ( for b2 being FinSequence of NAT holds
( not b2 in tree (dom c1),c2,(dom c3) or for b3 being FinSequence of NAT st b3 in c2 holds
( not b3 is_a_prefix_of b2 & b1 . b2 = c1 . b2 ) or ex b3, b4 being FinSequence of NAT st
( b3 in c2 & b4 in dom c3 & b2 = b3 ^ b4 & b1 . b2 = c3 . b4 ) ) ) )
proof end;
uniqueness
for b1, b2 being DecoratedTree st dom b1 = tree (dom c1),c2,(dom c3) & ( for b3 being FinSequence of NAT holds
( not b3 in tree (dom c1),c2,(dom c3) or for b4 being FinSequence of NAT st b4 in c2 holds
( not b4 is_a_prefix_of b3 & b1 . b3 = c1 . b3 ) or ex b4, b5 being FinSequence of NAT st
( b4 in c2 & b5 in dom c3 & b3 = b4 ^ b5 & b1 . b3 = c3 . b5 ) ) ) & dom b2 = tree (dom c1),c2,(dom c3) & ( for b3 being FinSequence of NAT holds
( not b3 in tree (dom c1),c2,(dom c3) or for b4 being FinSequence of NAT st b4 in c2 holds
( not b4 is_a_prefix_of b3 & b2 . b3 = c1 . b3 ) or ex b4, b5 being FinSequence of NAT st
( b4 in c2 & b5 in dom c3 & b3 = b4 ^ b5 & b2 . b3 = c3 . b5 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def2 defines tree TREES_A:def 2 :
for b1 being DecoratedTree
for b2 being AntiChain_of_Prefixes of dom b1
for b3 being DecoratedTree st b2 <> {} holds
for b4 being DecoratedTree holds
( b4 = tree b1,b2,b3 iff ( dom b4 = tree (dom b1),b2,(dom b3) & ( for b5 being FinSequence of NAT holds
( not b5 in tree (dom b1),b2,(dom b3) or for b6 being FinSequence of NAT st b6 in b2 holds
( not b6 is_a_prefix_of b5 & b4 . b5 = b1 . b5 ) or ex b6, b7 being FinSequence of NAT st
( b6 in b2 & b7 in dom b3 & b5 = b6 ^ b7 & b4 . b5 = b3 . b7 ) ) ) ) );

theorem Th11: :: TREES_A:11
canceled;

theorem Th12: :: TREES_A:12
canceled;

theorem Th13: :: TREES_A:13
for b1, b2 being DecoratedTree
for b3 being AntiChain_of_Prefixes of dom b1 st b3 <> {} holds
for b4 being FinSequence of NAT holds
( not b4 in dom (tree b1,b3,b2) or for b5 being FinSequence of NAT st b5 in b3 holds
( not b5 is_a_prefix_of b4 & (tree b1,b3,b2) . b4 = b1 . b4 ) or ex b5, b6 being FinSequence of NAT st
( b5 in b3 & b6 in dom b2 & b4 = b5 ^ b6 & (tree b1,b3,b2) . b4 = b2 . b6 ) )
proof end;

theorem Th14: :: TREES_A:14
for b1 being FinSequence of NAT
for b2, b3 being DecoratedTree st b1 in dom b2 holds
for b4 being FinSequence of NAT holds
( not b4 in dom (b2 with-replacement b1,b3) or ( not b1 is_a_prefix_of b4 & (b2 with-replacement b1,b3) . b4 = b2 . b4 ) or ex b5 being FinSequence of NAT st
( b5 in dom b3 & b4 = b1 ^ b5 & (b2 with-replacement b1,b3) . b4 = b3 . b5 ) )
proof end;

theorem Th15: :: TREES_A:15
for b1, b2 being DecoratedTree
for b3 being AntiChain_of_Prefixes of dom b1 st b3 <> {} holds
for b4 being FinSequence of NAT st b4 in dom (tree b1,b3,b2) & b4 in { b5 where B is Element of dom b1 : for b1 being FinSequence of NAT st b6 in b3 holds
not b6 is_a_prefix_of b5
}
holds
(tree b1,b3,b2) . b4 = b1 . b4
proof end;

theorem Th16: :: TREES_A:16
for b1 being FinSequence of NAT
for b2, b3 being DecoratedTree st b1 in dom b2 holds
for b4 being FinSequence of NAT st b4 in dom (b2 with-replacement b1,b3) & b4 in { b5 where B is Element of dom b2 : not b1 is_a_prefix_of b5 } holds
(b2 with-replacement b1,b3) . b4 = b2 . b4
proof end;

theorem Th17: :: TREES_A:17
for b1, b2 being DecoratedTree
for b3 being AntiChain_of_Prefixes of dom b1
for b4 being FinSequence of NAT st b4 in dom (tree b1,b3,b2) & b4 in { (b5 ^ b6) where B is Element of dom b1, B is Element of dom b2 : b5 in b3 } holds
ex b5 being Element of dom b1ex b6 being Element of dom b2 st
( b4 = b5 ^ b6 & b5 in b3 & (tree b1,b3,b2) . b4 = b2 . b6 )
proof end;

theorem Th18: :: TREES_A:18
for b1 being FinSequence of NAT
for b2, b3 being DecoratedTree st b1 in dom b2 holds
for b4 being FinSequence of NAT st b4 in dom (b2 with-replacement b1,b3) & b4 in { (b1 ^ b5) where B is Element of dom b3 : b5 = b5 } holds
ex b5 being Element of dom b3 st
( b4 = b1 ^ b5 & (b2 with-replacement b1,b3) . b4 = b3 . b5 )
proof end;

theorem Th19: :: TREES_A:19
for b1, b2 being DecoratedTree
for b3 being Element of dom b1 holds tree b1,{b3},b2 = b1 with-replacement b3,b2
proof end;

definition
let c1 be non empty set ;
let c2 be DecoratedTree of c1;
let c3 be AntiChain_of_Prefixes of dom c2;
let c4 be DecoratedTree of c1;
assume E17: c3 <> {} ;
func tree c2,c3,c4 -> DecoratedTree of a1 equals :: TREES_A:def 3
tree a2,a3,a4;
coherence
tree c2,c3,c4 is DecoratedTree of c1
proof end;
end;

:: deftheorem Def3 defines tree TREES_A:def 3 :
for b1 being non empty set
for b2 being DecoratedTree of b1
for b3 being AntiChain_of_Prefixes of dom b2
for b4 being DecoratedTree of b1 st b3 <> {} holds
tree b2,b3,b4 = tree b2,b3,b4;