:: AMISTD_3 semantic presentation

registration
let c1 be set ;
let c2 be PartFunc of c1, NAT ;
let c3 be set ;
cluster a2 . a3 -> natural ;
coherence
c2 . c3 is natural
proof end;
end;

registration
let c1 be empty Relation;
let c2 be set ;
cluster a1 | a2 -> empty ;
coherence
c1 | c2 is empty
proof end;
end;

theorem Th1: :: AMISTD_3:1
for b1, b2 being set
for b3 being Relation st dom b3 = {b1} & rng b3 = {b2} holds
b3 = b1 .--> b2
proof end;

theorem Th2: :: AMISTD_3:2
for b1 being set holds field {[b1,b1]} = {b1}
proof end;

registration
let c1 be infinite set ;
let c2 be set ;
cluster a1 --> a2 -> infinite ;
coherence
not c1 --> c2 is finite
proof end;
end;

registration
cluster infinite set ;
existence
not for b1 being Function holds b1 is finite
proof end;
end;

registration
let c1 be finite Relation;
cluster field a1 -> finite ;
coherence
field c1 is finite
proof end;
end;

theorem Th3: :: AMISTD_3:3
for b1 being Relation st field b1 is finite holds
b1 is finite
proof end;

registration
let c1 be infinite Relation;
cluster field a1 -> infinite ;
coherence
not field c1 is finite
by Th3;
end;

theorem Th4: :: AMISTD_3:4
for b1 being Relation st dom b1 is finite & rng b1 is finite holds
b1 is finite
proof end;

registration
cluster RelIncl {} -> empty ;
coherence
RelIncl {} is empty
proof end;
end;

registration
let c1 be non empty set ;
cluster RelIncl a1 -> non empty ;
coherence
not RelIncl c1 is empty
proof end;
end;

theorem Th5: :: AMISTD_3:5
for b1 being set holds RelIncl {b1} = {[b1,b1]}
proof end;

theorem Th6: :: AMISTD_3:6
for b1 being set holds RelIncl b1 c= [:b1,b1:]
proof end;

registration
let c1 be finite set ;
cluster RelIncl a1 -> finite ;
coherence
RelIncl c1 is finite
proof end;
end;

theorem Th7: :: AMISTD_3:7
for b1 being set st RelIncl b1 is finite holds
b1 is finite
proof end;

registration
let c1 be infinite set ;
cluster RelIncl a1 -> non empty infinite ;
coherence
not RelIncl c1 is finite
by Th7;
end;

theorem Th8: :: AMISTD_3:8
for b1, b2 being Relation st b1,b2 are_isomorphic & b1 is well-ordering holds
b2 is well-ordering
proof end;

theorem Th9: :: AMISTD_3:9
for b1, b2 being Relation st b1,b2 are_isomorphic & b1 is finite holds
b2 is finite
proof end;

theorem Th10: :: AMISTD_3:10
for b1, b2 being set holds b1 .--> b2 is_isomorphism_of {[b1,b1]},{[b2,b2]}
proof end;

theorem Th11: :: AMISTD_3:11
for b1, b2 being set holds {[b1,b1]},{[b2,b2]} are_isomorphic
proof end;

registration
cluster order_type_of {} -> empty ;
coherence
order_type_of {} is empty
proof end;
end;

theorem Th12: :: AMISTD_3:12
for b1 being Ordinal holds order_type_of (RelIncl b1) = b1
proof end;

Lemma9: for b1 being Ordinal
for b2 being finite set st b2 c= b1 holds
order_type_of (RelIncl b2) is finite
proof end;

theorem Th13: :: AMISTD_3:13
for b1 being Ordinal
for b2 being finite set st b2 c= b1 holds
order_type_of (RelIncl b2) = card b2
proof end;

theorem Th14: :: AMISTD_3:14
for b1 being set
for b2 being Ordinal st {b1} c= b2 holds
order_type_of (RelIncl {b1}) = 1
proof end;

theorem Th15: :: AMISTD_3:15
for b1 being set
for b2 being Ordinal st {b1} c= b2 holds
canonical_isomorphism_of (RelIncl (order_type_of (RelIncl {b1}))),(RelIncl {b1}) = 0 .--> b1
proof end;

registration
let c1 be Ordinal;
let c2 be Subset of c1;
let c3 be set ;
cluster (canonical_isomorphism_of (RelIncl (order_type_of (RelIncl a2))),(RelIncl a2)) . a3 -> ordinal ;
coherence
(canonical_isomorphism_of (RelIncl (order_type_of (RelIncl c2))),(RelIncl c2)) . c3 is ordinal
proof end;
end;

registration
let c1 be natural-membered set ;
let c2 be set ;
cluster (canonical_isomorphism_of (RelIncl (order_type_of (RelIncl a1))),(RelIncl a1)) . a2 -> natural ;
coherence
(canonical_isomorphism_of (RelIncl (order_type_of (RelIncl c1))),(RelIncl c1)) . c2 is natural
proof end;
end;

theorem Th16: :: AMISTD_3:16
for b1 being set
for b2, b3 being natural number st b2 |-> b1 = b3 |-> b1 holds
b2 = b3
proof end;

theorem Th17: :: AMISTD_3:17
for b1 being natural number
for b2 being Tree
for b3 being Element of b2 holds b3 | (Seg b1) in b2
proof end;

theorem Th18: :: AMISTD_3:18
for b1, b2 being Tree st ( for b3 being Nat holds b1 -level b3 = b2 -level b3 ) holds
b1 = b2
proof end;

definition
func TrivialInfiniteTree -> set equals :: AMISTD_3:def 1
{ (b1 |-> 0) where B is Nat : verum } ;
coherence
{ (b1 |-> 0) where B is Nat : verum } is set
;
end;

:: deftheorem Def1 defines TrivialInfiniteTree AMISTD_3:def 1 :
TrivialInfiniteTree = { (b1 |-> 0) where B is Nat : verum } ;

registration
cluster TrivialInfiniteTree -> non empty Tree-like ;
coherence
( not TrivialInfiniteTree is empty & TrivialInfiniteTree is Tree-like )
proof end;
end;

theorem Th19: :: AMISTD_3:19
NAT , TrivialInfiniteTree are_equipotent
proof end;

registration
cluster TrivialInfiniteTree -> non empty infinite Tree-like ;
coherence
not TrivialInfiniteTree is finite
by Th19, CARD_1:68;
end;

theorem Th20: :: AMISTD_3:20
for b1 being Nat holds TrivialInfiniteTree -level b1 = {(b1 |-> 0)}
proof end;

definition
let c1 be with_non-empty_elements set ;
let c2 be non empty non void IC-Ins-separated definite standard AMI-Struct of c1;
let c3 be FinPartState of c2;
assume that
E18: not c3 is empty and
E19: c3 is programmed ;
func FirstLoc c3 -> Instruction-Location of a2 means :Def2: :: AMISTD_3:def 2
ex b1 being non empty Subset of NAT st
( b1 = { (locnum b2) where B is Element of the Instruction-Locations of a2 : b2 in dom a3 } & a4 = il. a2,(min b1) );
existence
ex b1 being Instruction-Location of c2ex b2 being non empty Subset of NAT st
( b2 = { (locnum b3) where B is Element of the Instruction-Locations of c2 : b3 in dom c3 } & b1 = il. c2,(min b2) )
proof end;
uniqueness
for b1, b2 being Instruction-Location of c2 st ex b3 being non empty Subset of NAT st
( b3 = { (locnum b4) where B is Element of the Instruction-Locations of c2 : b4 in dom c3 } & b1 = il. c2,(min b3) ) & ex b3 being non empty Subset of NAT st
( b3 = { (locnum b4) where B is Element of the Instruction-Locations of c2 : b4 in dom c3 } & b2 = il. c2,(min b3) ) holds
b1 = b2
;
end;

:: deftheorem Def2 defines FirstLoc AMISTD_3:def 2 :
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being FinPartState of b2 st not b3 is empty & b3 is programmed holds
for b4 being Instruction-Location of b2 holds
( b4 = FirstLoc b3 iff ex b5 being non empty Subset of NAT st
( b5 = { (locnum b6) where B is Element of the Instruction-Locations of b2 : b6 in dom b3 } & b4 = il. b2,(min b5) ) );

theorem Th21: :: AMISTD_3:21
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being non empty programmed FinPartState of b2 holds FirstLoc b3 in dom b3
proof end;

theorem Th22: :: AMISTD_3:22
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3, b4 being non empty programmed FinPartState of b2 st b3 c= b4 holds
FirstLoc b4 <= FirstLoc b3
proof end;

theorem Th23: :: AMISTD_3:23
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being Instruction-Location of b2
for b4 being non empty programmed FinPartState of b2 st b3 in dom b4 holds
FirstLoc b4 <= b3
proof end;

theorem Th24: :: AMISTD_3:24
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being non empty programmed lower FinPartState of b2 holds FirstLoc b3 = il. b2,0
proof end;

definition
let c1 be with_non-empty_elements set ;
let c2 be non empty non void IC-Ins-separated definite standard AMI-Struct of c1;
let c3 be Subset of the Instruction-Locations of c2;
func LocNums c3 -> Subset of NAT equals :: AMISTD_3:def 3
{ (locnum b1) where B is Instruction-Location of a2 : b1 in a3 } ;
coherence
{ (locnum b1) where B is Instruction-Location of c2 : b1 in c3 } is Subset of NAT
proof end;
end;

:: deftheorem Def3 defines LocNums AMISTD_3:def 3 :
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being Subset of the Instruction-Locations of b2 holds LocNums b3 = { (locnum b4) where B is Instruction-Location of b2 : b4 in b3 } ;

theorem Th25: :: AMISTD_3:25
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being Instruction-Location of b2
for b4 being Subset of the Instruction-Locations of b2 holds
( locnum b3 in LocNums b4 iff b3 in b4 )
proof end;

registration
let c1 be with_non-empty_elements set ;
let c2 be non empty non void IC-Ins-separated definite standard AMI-Struct of c1;
let c3 be empty Subset of the Instruction-Locations of c2;
cluster LocNums a3 -> empty ;
coherence
LocNums c3 is empty
proof end;
end;

registration
let c1 be with_non-empty_elements set ;
let c2 be non empty non void IC-Ins-separated definite standard AMI-Struct of c1;
let c3 be non empty Subset of the Instruction-Locations of c2;
cluster LocNums a3 -> non empty ;
coherence
not LocNums c3 is empty
proof end;
end;

theorem Th26: :: AMISTD_3:26
for b1 being natural number
for b2 being with_non-empty_elements set
for b3 being non empty non void IC-Ins-separated definite standard AMI-Struct of b2
for b4 being Subset of the Instruction-Locations of b3 st b4 = {(il. b3,b1)} holds
LocNums b4 = {b1}
proof end;

theorem Th27: :: AMISTD_3:27
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being Subset of the Instruction-Locations of b2 holds b3, LocNums b3 are_equipotent
proof end;

theorem Th28: :: AMISTD_3:28
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being Subset of the Instruction-Locations of b2 holds Card b3 c= order_type_of (RelIncl (LocNums b3))
proof end;

theorem Th29: :: AMISTD_3:29
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being Instruction-Location of b2
for b4 being Instruction of b2 st b2 is realistic & b4 is halting holds
LocNums (NIC b4,b3) = {(locnum b3)}
proof end;

theorem Th30: :: AMISTD_3:30
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being Instruction-Location of b2
for b4 being Instruction of b2 st b2 is realistic & b4 is sequential holds
LocNums (NIC b4,b3) = {(locnum (NextLoc b3))}
proof end;

definition
let c1 be with_non-empty_elements set ;
let c2 be non empty non void IC-Ins-separated definite standard AMI-Struct of c1;
let c3 be Subset of the Instruction-Locations of c2;
deffunc H1( set ) -> Element of the Instruction-Locations of c2 = il. c2,((canonical_isomorphism_of (RelIncl (order_type_of (RelIncl (LocNums c3)))),(RelIncl (LocNums c3))) . a1);
set c4 = the Instruction-Locations of c2;
func LocSeq c3 -> T-Sequence of the Instruction-Locations of a2 means :Def4: :: AMISTD_3:def 4
( dom a4 = Card a3 & ( for b1 being set st b1 in Card a3 holds
a4 . b1 = il. a2,((canonical_isomorphism_of (RelIncl (order_type_of (RelIncl (LocNums a3)))),(RelIncl (LocNums a3))) . b1) ) );
existence
ex b1 being T-Sequence of the Instruction-Locations of c2 st
( dom b1 = Card c3 & ( for b2 being set st b2 in Card c3 holds
b1 . b2 = il. c2,((canonical_isomorphism_of (RelIncl (order_type_of (RelIncl (LocNums c3)))),(RelIncl (LocNums c3))) . b2) ) )
proof end;
uniqueness
for b1, b2 being T-Sequence of the Instruction-Locations of c2 st dom b1 = Card c3 & ( for b3 being set st b3 in Card c3 holds
b1 . b3 = il. c2,((canonical_isomorphism_of (RelIncl (order_type_of (RelIncl (LocNums c3)))),(RelIncl (LocNums c3))) . b3) ) & dom b2 = Card c3 & ( for b3 being set st b3 in Card c3 holds
b2 . b3 = il. c2,((canonical_isomorphism_of (RelIncl (order_type_of (RelIncl (LocNums c3)))),(RelIncl (LocNums c3))) . b3) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def4 defines LocSeq AMISTD_3:def 4 :
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being Subset of the Instruction-Locations of b2
for b4 being T-Sequence of the Instruction-Locations of b2 holds
( b4 = LocSeq b3 iff ( dom b4 = Card b3 & ( for b5 being set st b5 in Card b3 holds
b4 . b5 = il. b2,((canonical_isomorphism_of (RelIncl (order_type_of (RelIncl (LocNums b3)))),(RelIncl (LocNums b3))) . b5) ) ) );

theorem Th31: :: AMISTD_3:31
for b1 being natural number
for b2 being with_non-empty_elements set
for b3 being non empty non void IC-Ins-separated definite standard AMI-Struct of b2
for b4 being Subset of the Instruction-Locations of b3 st b4 = {(il. b3,b1)} holds
LocSeq b4 = 0 .--> (il. b3,b1)
proof end;

registration
let c1 be with_non-empty_elements set ;
let c2 be non empty non void IC-Ins-separated definite standard AMI-Struct of c1;
let c3 be Subset of the Instruction-Locations of c2;
cluster LocSeq a3 -> one-to-one ;
coherence
LocSeq c3 is one-to-one
proof end;
end;

definition
let c1 be with_non-empty_elements set ;
let c2 be non empty non void IC-Ins-separated definite standard AMI-Struct of c1;
let c3 be FinPartState of c2;
func ExecTree c3 -> DecoratedTree of the Instruction-Locations of a2 means :Def5: :: AMISTD_3:def 5
( a4 . {} = FirstLoc a3 & ( for b1 being Element of dom a4 holds
( succ b1 = { (b1 ^ <*b2*>) where B is Nat : b2 in Card (NIC (pi a3,(a4 . b1)),(a4 . b1)) } & ( for b2 being Nat st b2 in Card (NIC (pi a3,(a4 . b1)),(a4 . b1)) holds
a4 . (b1 ^ <*b2*>) = (LocSeq (NIC (pi a3,(a4 . b1)),(a4 . b1))) . b2 ) ) ) );
existence
ex b1 being DecoratedTree of the Instruction-Locations of c2 st
( b1 . {} = FirstLoc c3 & ( for b2 being Element of dom b1 holds
( succ b2 = { (b2 ^ <*b3*>) where B is Nat : b3 in Card (NIC (pi c3,(b1 . b2)),(b1 . b2)) } & ( for b3 being Nat st b3 in Card (NIC (pi c3,(b1 . b2)),(b1 . b2)) holds
b1 . (b2 ^ <*b3*>) = (LocSeq (NIC (pi c3,(b1 . b2)),(b1 . b2))) . b3 ) ) ) )
proof end;
uniqueness
for b1, b2 being DecoratedTree of the Instruction-Locations of c2 st b1 . {} = FirstLoc c3 & ( for b3 being Element of dom b1 holds
( succ b3 = { (b3 ^ <*b4*>) where B is Nat : b4 in Card (NIC (pi c3,(b1 . b3)),(b1 . b3)) } & ( for b4 being Nat st b4 in Card (NIC (pi c3,(b1 . b3)),(b1 . b3)) holds
b1 . (b3 ^ <*b4*>) = (LocSeq (NIC (pi c3,(b1 . b3)),(b1 . b3))) . b4 ) ) ) & b2 . {} = FirstLoc c3 & ( for b3 being Element of dom b2 holds
( succ b3 = { (b3 ^ <*b4*>) where B is Nat : b4 in Card (NIC (pi c3,(b2 . b3)),(b2 . b3)) } & ( for b4 being Nat st b4 in Card (NIC (pi c3,(b2 . b3)),(b2 . b3)) holds
b2 . (b3 ^ <*b4*>) = (LocSeq (NIC (pi c3,(b2 . b3)),(b2 . b3))) . b4 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def5 defines ExecTree AMISTD_3:def 5 :
for b1 being with_non-empty_elements set
for b2 being non empty non void IC-Ins-separated definite standard AMI-Struct of b1
for b3 being FinPartState of b2
for b4 being DecoratedTree of the Instruction-Locations of b2 holds
( b4 = ExecTree b3 iff ( b4 . {} = FirstLoc b3 & ( for b5 being Element of dom b4 holds
( succ b5 = { (b5 ^ <*b6*>) where B is Nat : b6 in Card (NIC (pi b3,(b4 . b5)),(b4 . b5)) } & ( for b6 being Nat st b6 in Card (NIC (pi b3,(b4 . b5)),(b4 . b5)) holds
b4 . (b5 ^ <*b6*>) = (LocSeq (NIC (pi b3,(b4 . b5)),(b4 . b5))) . b6 ) ) ) ) );

theorem Th32: :: AMISTD_3:32
for b1 being with_non-empty_elements set
for b2 being non empty non void halting IC-Ins-separated definite realistic standard AMI-Struct of b1 holds ExecTree (Stop b2) = TrivialInfiniteTree --> (il. b2,0)
proof end;