:: AMI_1 semantic presentation

definition
let N be set ;
attr c2 is strict;
struct AMI-Struct of N -> 1-sorted ;
aggr AMI-Struct(# carrier, Instruction-Counter, Instruction-Locations, Instructions, Object-Kind, Execution #) -> AMI-Struct of N;
sel Instruction-Counter c2 -> Element of the carrier of c2;
sel Instruction-Locations c2 -> Subset of the carrier of c2;
sel Instructions c2 -> non empty set ;
sel Object-Kind c2 -> Function of the carrier of c2,N \/ {the Instructions of c2,the Instruction-Locations of c2};
sel Execution c2 -> Function of the Instructions of c2, Funcs (product the Object-Kind of c2),(product the Object-Kind of c2);
end;

definition
let N be set ;
canceled;
func Trivial-AMI N -> strict AMI-Struct of N means :Def2: :: AMI_1:def 2
( the carrier of it = {0,1} & the Instruction-Counter of it = 0 & the Instruction-Locations of it = {1} & the Instructions of it = {[0,{} ]} & the Object-Kind of it = 0,1 --> {1},{[0,{} ]} & the Execution of it = [0,{} ] .--> (id (product (0,1 --> {1},{[0,{} ]}))) );
existence
ex b1 being strict AMI-Struct of N st
( the carrier of b1 = {0,1} & the Instruction-Counter of b1 = 0 & the Instruction-Locations of b1 = {1} & the Instructions of b1 = {[0,{} ]} & the Object-Kind of b1 = 0,1 --> {1},{[0,{} ]} & the Execution of b1 = [0,{} ] .--> (id (product (0,1 --> {1},{[0,{} ]}))) )
proof end;
uniqueness
for b1, b2 being strict AMI-Struct of N st the carrier of b1 = {0,1} & the Instruction-Counter of b1 = 0 & the Instruction-Locations of b1 = {1} & the Instructions of b1 = {[0,{} ]} & the Object-Kind of b1 = 0,1 --> {1},{[0,{} ]} & the Execution of b1 = [0,{} ] .--> (id (product (0,1 --> {1},{[0,{} ]}))) & the carrier of b2 = {0,1} & the Instruction-Counter of b2 = 0 & the Instruction-Locations of b2 = {1} & the Instructions of b2 = {[0,{} ]} & the Object-Kind of b2 = 0,1 --> {1},{[0,{} ]} & the Execution of b2 = [0,{} ] .--> (id (product (0,1 --> {1},{[0,{} ]}))) holds
b1 = b2
;
end;

:: deftheorem AMI_1:def 1 :
canceled;

:: deftheorem Def2 defines Trivial-AMI AMI_1:def 2 :
for N being set
for b2 being strict AMI-Struct of N holds
( b2 = Trivial-AMI N iff ( the carrier of b2 = {0,1} & the Instruction-Counter of b2 = 0 & the Instruction-Locations of b2 = {1} & the Instructions of b2 = {[0,{} ]} & the Object-Kind of b2 = 0,1 --> {1},{[0,{} ]} & the Execution of b2 = [0,{} ] .--> (id (product (0,1 --> {1},{[0,{} ]}))) ) );

definition
let N be set ;
let S be AMI-Struct of N;
attr S is void means :Def3: :: AMI_1:def 3
the Instruction-Locations of S is empty;
end;

:: deftheorem Def3 defines void AMI_1:def 3 :
for N being set
for S being AMI-Struct of N holds
( S is void iff the Instruction-Locations of S is empty );

registration
let N be set ;
cluster Trivial-AMI N -> non empty strict non void ;
coherence
( not Trivial-AMI N is empty & not Trivial-AMI N is void )
proof end;
end;

registration
let N be set ;
cluster non empty non void AMI-Struct of N;
existence
ex b1 being AMI-Struct of N st
( not b1 is empty & not b1 is void )
proof end;
end;

registration
let N be set ;
let S be non void AMI-Struct of N;
cluster the Instruction-Locations of S -> non empty ;
coherence
not the Instruction-Locations of S is empty
by Def3;
end;

definition
let N be set ;
let S be non empty AMI-Struct of N;
mode Object of S is Element of S;
end;

definition
let N be set ;
let S be non empty non void AMI-Struct of N;
mode Instruction-Location of S -> Element of the Instruction-Locations of S means :Def4: :: AMI_1:def 4
verum;
existence
ex b1 being Element of the Instruction-Locations of S st verum
;
end;

:: deftheorem Def4 defines Instruction-Location AMI_1:def 4 :
for N being set
for S being non empty non void AMI-Struct of N
for b3 being Element of the Instruction-Locations of S holds
( b3 is Instruction-Location of S iff verum );

definition
let N be set ;
let S be AMI-Struct of N;
mode Instruction of S is Element of the Instructions of S;
end;

definition
let N be set ;
let S be non empty AMI-Struct of N;
func IC S -> Object of S equals :: AMI_1:def 5
the Instruction-Counter of S;
correctness
coherence
the Instruction-Counter of S is Object of S
;
;
end;

:: deftheorem defines IC AMI_1:def 5 :
for N being set
for S being non empty AMI-Struct of N holds IC S = the Instruction-Counter of S;

definition
let N be set ;
let S be non empty AMI-Struct of N;
let o be Object of S;
func ObjectKind o -> Element of N \/ {the Instructions of S,the Instruction-Locations of S} equals :: AMI_1:def 6
the Object-Kind of S . o;
correctness
coherence
the Object-Kind of S . o is Element of N \/ {the Instructions of S,the Instruction-Locations of S}
;
;
end;

:: deftheorem defines ObjectKind AMI_1:def 6 :
for N being set
for S being non empty AMI-Struct of N
for o being Object of S holds ObjectKind o = the Object-Kind of S . o;

definition
let N be set ;
let S be AMI-Struct of N;
mode State of S is Element of product the Object-Kind of S;
end;

definition
let N be with_non-empty_elements set ;
let S be non void AMI-Struct of N;
let I be Instruction of S;
let s be State of S;
func Exec I,s -> State of S equals :: AMI_1:def 7
(the Execution of S . I) . s;
coherence
(the Execution of S . I) . s is State of S
proof end;
end;

:: deftheorem defines Exec AMI_1:def 7 :
for N being with_non-empty_elements set
for S being non void AMI-Struct of N
for I being Instruction of S
for s being State of S holds Exec I,s = (the Execution of S . I) . s;

definition
let N be with_non-empty_elements set ;
let S be non void AMI-Struct of N;
let I be Instruction of S;
attr I is halting means :Def8: :: AMI_1:def 8
for s being State of S holds Exec I,s = s;
end;

:: deftheorem Def8 defines halting AMI_1:def 8 :
for N being with_non-empty_elements set
for S being non void AMI-Struct of N
for I being Instruction of S holds
( I is halting iff for s being State of S holds Exec I,s = s );

definition
let N be with_non-empty_elements set ;
let S be non void AMI-Struct of N;
attr S is halting means :Def9: :: AMI_1:def 9
ex I being Instruction of S st I is halting;
end;

:: deftheorem Def9 defines halting AMI_1:def 9 :
for N being with_non-empty_elements set
for S being non void AMI-Struct of N holds
( S is halting iff ex I being Instruction of S st I is halting );

theorem :: AMI_1:1
canceled;

theorem :: AMI_1:2
canceled;

theorem :: AMI_1:3
canceled;

theorem :: AMI_1:4
canceled;

theorem :: AMI_1:5
canceled;

theorem Th6: :: AMI_1:6
for N being with_non-empty_elements set holds Trivial-AMI N is halting
proof end;

registration
let N be with_non-empty_elements set ;
cluster Trivial-AMI N -> strict halting ;
coherence
Trivial-AMI N is halting
by Th6;
end;

registration
let N be with_non-empty_elements set ;
cluster non void halting AMI-Struct of N;
existence
ex b1 being non void AMI-Struct of N st b1 is halting
proof end;
end;

registration
let N be with_non-empty_elements set ;
let S be non void halting AMI-Struct of N;
cluster halting Element of the Instructions of S;
existence
ex b1 being Instruction of S st b1 is halting
by Def9;
end;

definition
let N be with_non-empty_elements set ;
let S be non void halting AMI-Struct of N;
func halt S -> Instruction of S equals :: AMI_1:def 10
choose { I where I is Instruction of S : I is halting } ;
coherence
choose { I where I is Instruction of S : I is halting } is Instruction of S
proof end;
end;

:: deftheorem defines halt AMI_1:def 10 :
for N being with_non-empty_elements set
for S being non void halting AMI-Struct of N holds halt S = choose { I where I is Instruction of S : I is halting } ;

registration
let N be with_non-empty_elements set ;
let S be non void halting AMI-Struct of N;
cluster halt S -> halting ;
coherence
halt S is halting
proof end;
end;

definition
let N be set ;
let IT be non empty AMI-Struct of N;
attr IT is IC-Ins-separated means :Def11: :: AMI_1:def 11
ObjectKind (IC IT) = the Instruction-Locations of IT;
end;

:: deftheorem Def11 defines IC-Ins-separated AMI_1:def 11 :
for N being set
for IT being non empty AMI-Struct of N holds
( IT is IC-Ins-separated iff ObjectKind (IC IT) = the Instruction-Locations of IT );

definition
let N be with_non-empty_elements set ;
let IT be non empty non void AMI-Struct of N;
canceled;
attr IT is steady-programmed means :Def13: :: AMI_1:def 13
for s being State of IT
for i being Instruction of IT
for l being Instruction-Location of IT holds (Exec i,s) . l = s . l;
end;

:: deftheorem AMI_1:def 12 :
canceled;

:: deftheorem Def13 defines steady-programmed AMI_1:def 13 :
for N being with_non-empty_elements set
for IT being non empty non void AMI-Struct of N holds
( IT is steady-programmed iff for s being State of IT
for i being Instruction of IT
for l being Instruction-Location of IT holds (Exec i,s) . l = s . l );

definition
let N be set ;
let IT be non empty non void AMI-Struct of N;
attr IT is definite means :Def14: :: AMI_1:def 14
for l being Instruction-Location of IT holds ObjectKind l = the Instructions of IT;
end;

:: deftheorem Def14 defines definite AMI_1:def 14 :
for N being set
for IT being non empty non void AMI-Struct of N holds
( IT is definite iff for l being Instruction-Location of IT holds ObjectKind l = the Instructions of IT );

theorem Th7: :: AMI_1:7
for E being set holds Trivial-AMI E is IC-Ins-separated
proof end;

theorem :: AMI_1:8
canceled;

theorem Th9: :: AMI_1:9
for E being set
for s1, s2 being State of (Trivial-AMI E) holds s1 = s2
proof end;

theorem Th10: :: AMI_1:10
for N being with_non-empty_elements set holds Trivial-AMI N is steady-programmed
proof end;

theorem Th11: :: AMI_1:11
for E being set holds Trivial-AMI E is definite
proof end;

registration
let E be set ;
cluster Trivial-AMI E -> strict IC-Ins-separated definite ;
coherence
( Trivial-AMI E is IC-Ins-separated & Trivial-AMI E is definite )
by Th7, Th11;
end;

registration
let N be with_non-empty_elements set ;
cluster Trivial-AMI N -> strict steady-programmed ;
coherence
Trivial-AMI N is steady-programmed
by Th10;
end;

registration
let E be set ;
cluster strict AMI-Struct of E;
existence
ex b1 being AMI-Struct of E st b1 is strict
proof end;
end;

registration
let M be set ;
cluster non empty strict non void IC-Ins-separated definite AMI-Struct of M;
existence
ex b1 being non empty non void AMI-Struct of M st
( b1 is IC-Ins-separated & b1 is definite & b1 is strict )
proof end;
end;

registration
let N be with_non-empty_elements set ;
cluster non empty strict non void halting IC-Ins-separated steady-programmed definite AMI-Struct of N;
existence
ex b1 being non empty non void AMI-Struct of N st
( b1 is IC-Ins-separated & b1 is halting & b1 is steady-programmed & b1 is definite & b1 is strict )
proof end;
end;

definition
let N be with_non-empty_elements set ;
let S be non empty non void IC-Ins-separated AMI-Struct of N;
let s be State of S;
func IC s -> Instruction-Location of S equals :: AMI_1:def 15
s . (IC S);
coherence
s . (IC S) is Instruction-Location of S
proof end;
end;

:: deftheorem defines IC AMI_1:def 15 :
for N being with_non-empty_elements set
for S being non empty non void IC-Ins-separated AMI-Struct of N
for s being State of S holds IC s = s . (IC S);

theorem :: AMI_1:12
canceled;

theorem :: AMI_1:13
canceled;

theorem :: AMI_1:14
for x, y, z being set
for f, g being Function st f tolerates g & [x,y] in f & [x,z] in g holds
y = z by CARD_3:65;

theorem :: AMI_1:15
for A being set st ( for x being set st x in A holds
x is Function ) & ( for f, g being Function st f in A & g in A holds
f tolerates g ) holds
union A is Function by CARD_3:66;

definition
canceled;
end;

:: deftheorem AMI_1:def 16 :
canceled;

theorem :: AMI_1:16
canceled;

theorem :: AMI_1:17
canceled;

theorem :: AMI_1:18
canceled;

theorem :: AMI_1:19
canceled;

theorem :: AMI_1:20
canceled;

theorem :: AMI_1:21
canceled;

theorem :: AMI_1:22
canceled;

theorem :: AMI_1:23
canceled;

theorem :: AMI_1:24
canceled;

theorem :: AMI_1:25
for g, f being Function st g in sproduct f holds
( dom g c= dom f & ( for x being set st x in dom g holds
g . x in f . x ) ) by CARD_3:67;

theorem :: AMI_1:26
for f being Function holds {} in sproduct f by CARD_3:68;

theorem :: AMI_1:27
for f being Function holds product f c= sproduct f by CARD_3:69;

theorem :: AMI_1:28
for x being set
for f being Function st x in sproduct f holds
x is PartFunc of dom f, union (rng f) by CARD_3:70;

theorem :: AMI_1:29
for g, f, h being Function st g in product f & h in sproduct f holds
g +* h in product f by CARD_3:71;

theorem :: AMI_1:30
for f, g being Function st product f <> {} holds
( g in sproduct f iff ex h being Function st
( h in product f & g <= h ) ) by CARD_3:72;

theorem :: AMI_1:31
for f being Function holds sproduct f c= PFuncs (dom f),(union (rng f)) by CARD_3:73;

theorem :: AMI_1:32
for f, g being Function st f c= g holds
sproduct f c= sproduct g by CARD_3:74;

theorem :: AMI_1:33
sproduct {} = {{} } by CARD_3:75;

theorem :: AMI_1:34
for A, B being set holds PFuncs A,B = sproduct (A --> B) by CARD_3:76;

theorem :: AMI_1:35
for A, B being non empty set
for f being Function of A,B holds sproduct f = sproduct (f | { x where x is Element of A : f . x <> {} } ) by CARD_3:77;

theorem :: AMI_1:36
for x, y being set
for f being Function st x in dom f & y in f . x holds
x .--> y in sproduct f by CARD_3:78;

theorem :: AMI_1:37
for f being Function holds
( sproduct f = {{} } iff for x being set st x in dom f holds
f . x = {} ) by CARD_3:79;

theorem :: AMI_1:38
for A being set
for f being Function st A c= sproduct f & ( for h1, h2 being Function st h1 in A & h2 in A holds
h1 tolerates h2 ) holds
union A in sproduct f by CARD_3:80;

theorem :: AMI_1:39
for g, h, f being Function st g tolerates h & g in sproduct f & h in sproduct f holds
g \/ h in sproduct f by CARD_3:81;

theorem :: AMI_1:40
for g, h, f being Function st g c= h & h in sproduct f holds
g in sproduct f by CARD_3:82;

theorem :: AMI_1:41
for A being set
for g, f being Function st g in sproduct f holds
g | A in sproduct f by CARD_3:83;

theorem :: AMI_1:42
for A being set
for g, f being Function st g in sproduct f holds
g | A in sproduct (f | A) by CARD_3:84;

theorem :: AMI_1:43
for h, f, g being Function st h in sproduct (f +* g) holds
ex f', g' being Function st
( f' in sproduct f & g' in sproduct g & h = f' +* g' ) by CARD_3:85;

theorem :: AMI_1:44
for g, f, f', g' being Function st dom g misses (dom f') \ (dom g') & f' in sproduct f & g' in sproduct g holds
f' +* g' in sproduct (f +* g) by CARD_3:86;

theorem :: AMI_1:45
for g, f, f', g' being Function st dom f' misses (dom g) \ (dom g') & f' in sproduct f & g' in sproduct g holds
f' +* g' in sproduct (f +* g) by CARD_3:87;

theorem :: AMI_1:46
for g, f, h being Function st g in sproduct f & h in sproduct f holds
g +* h in sproduct f by CARD_3:88;

theorem :: AMI_1:47
for f being Function
for x1, x2, y1, y2 being set st x1 in dom f & y1 in f . x1 & x2 in dom f & y2 in f . x2 holds
x1,x2 --> y1,y2 in sproduct f by CARD_3:89;

definition
let N be with_non-empty_elements set ;
let S be non empty non void IC-Ins-separated definite AMI-Struct of N;
let s be State of S;
func CurInstr s -> Instruction of S equals :: AMI_1:def 17
s . (IC s);
coherence
s . (IC s) is Instruction of S
proof end;
end;

:: deftheorem defines CurInstr AMI_1:def 17 :
for N being with_non-empty_elements set
for S being non empty non void IC-Ins-separated definite AMI-Struct of N
for s being State of S holds CurInstr s = s . (IC s);

definition
let N be with_non-empty_elements set ;
let S be non empty non void IC-Ins-separated definite AMI-Struct of N;
let s be State of S;
func Following s -> State of S equals :: AMI_1:def 18
Exec (CurInstr s),s;
correctness
coherence
Exec (CurInstr s),s is State of S
;
;
end;

:: deftheorem defines Following AMI_1:def 18 :
for N being with_non-empty_elements set
for S being non empty non void IC-Ins-separated definite AMI-Struct of N
for s being State of S holds Following s = Exec (CurInstr s),s;

definition
let N be with_non-empty_elements set ;
let S be non empty non void IC-Ins-separated definite AMI-Struct of N;
let s be State of S;
func Computation s -> Function of NAT , product the Object-Kind of S means :Def19: :: AMI_1:def 19
( it . 0 = s & ( for i being Element of NAT holds it . (i + 1) = Following (it . i) ) );
existence
ex b1 being Function of NAT , product the Object-Kind of S st
( b1 . 0 = s & ( for i being Element of NAT holds b1 . (i + 1) = Following (b1 . i) ) )
proof end;
uniqueness
for b1, b2 being Function of NAT , product the Object-Kind of S st b1 . 0 = s & ( for i being Element of NAT holds b1 . (i + 1) = Following (b1 . i) ) & b2 . 0 = s & ( for i being Element of NAT holds b2 . (i + 1) = Following (b2 . i) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def19 defines Computation AMI_1:def 19 :
for N being with_non-empty_elements set
for S being non empty non void IC-Ins-separated definite AMI-Struct of N
for s being State of S
for b4 being Function of NAT , product the Object-Kind of S holds
( b4 = Computation s iff ( b4 . 0 = s & ( for i being Element of NAT holds b4 . (i + 1) = Following (b4 . i) ) ) );

definition
let N be with_non-empty_elements set ;
let S be non void AMI-Struct of N;
let f be Function of NAT , product the Object-Kind of S;
let k be Element of NAT ;
:: original: .
redefine func f . k -> State of S;
coherence
f . k is State of S
by FUNCT_2:7;
end;

definition
let N be with_non-empty_elements set ;
let S be non empty non void halting IC-Ins-separated definite AMI-Struct of N;
let IT be State of S;
attr IT is halting means :Def20: :: AMI_1:def 20
ex k being Element of NAT st CurInstr ((Computation IT) . k) = halt S;
end;

:: deftheorem Def20 defines halting AMI_1:def 20 :
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite AMI-Struct of N
for IT being State of S holds
( IT is halting iff ex k being Element of NAT st CurInstr ((Computation IT) . k) = halt S );

definition
let N be set ;
let IT be AMI-Struct of N;
attr IT is realistic means :Def21: :: AMI_1:def 21
not the Instruction-Counter of IT in the Instruction-Locations of IT;
end;

:: deftheorem Def21 defines realistic AMI_1:def 21 :
for N being set
for IT being AMI-Struct of N holds
( IT is realistic iff not the Instruction-Counter of IT in the Instruction-Locations of IT );

theorem :: AMI_1:48
for E being set
for S being non empty non void IC-Ins-separated definite AMI-Struct of E st S is realistic holds
for l being Instruction-Location of S holds not IC S = l
proof end;

theorem :: AMI_1:49
canceled;

theorem :: AMI_1:50
canceled;

theorem Th51: :: AMI_1:51
for N being with_non-empty_elements set
for i being Element of NAT
for S being non empty non void IC-Ins-separated definite AMI-Struct of N
for s being State of S
for k being Element of NAT holds (Computation s) . (i + k) = (Computation ((Computation s) . i)) . k
proof end;

theorem Th52: :: AMI_1:52
for i, j being Element of NAT st i <= j holds
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite AMI-Struct of N
for s being State of S st CurInstr ((Computation s) . i) = halt S holds
(Computation s) . j = (Computation s) . i
proof end;

definition
let N be with_non-empty_elements set ;
let S be non empty non void halting IC-Ins-separated definite AMI-Struct of N;
let s be State of S;
assume A1: s is halting ;
func Result s -> State of S means :Def22: :: AMI_1:def 22
ex k being Element of NAT st
( it = (Computation s) . k & CurInstr it = halt S );
uniqueness
for b1, b2 being State of S st ex k being Element of NAT st
( b1 = (Computation s) . k & CurInstr b1 = halt S ) & ex k being Element of NAT st
( b2 = (Computation s) . k & CurInstr b2 = halt S ) holds
b1 = b2
proof end;
correctness
existence
ex b1 being State of S ex k being Element of NAT st
( b1 = (Computation s) . k & CurInstr b1 = halt S )
;
proof end;
end;

:: deftheorem Def22 defines Result AMI_1:def 22 :
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite AMI-Struct of N
for s being State of S st s is halting holds
for b4 being State of S holds
( b4 = Result s iff ex k being Element of NAT st
( b4 = (Computation s) . k & CurInstr b4 = halt S ) );

theorem :: AMI_1:53
for N being with_non-empty_elements set
for S being non empty non void IC-Ins-separated steady-programmed definite AMI-Struct of N
for s being State of S
for i being Instruction-Location of S holds s . i = (Following s) . i by Def13;

definition
let N be with_non-empty_elements set ;
let S be non empty non void definite AMI-Struct of N;
let s be State of S;
let l be Instruction-Location of S;
:: original: .
redefine func s . l -> Instruction of S;
coherence
s . l is Instruction of S
proof end;
end;

theorem Th54: :: AMI_1:54
for N being with_non-empty_elements set
for S being non empty non void IC-Ins-separated steady-programmed definite AMI-Struct of N
for s being State of S
for i being Instruction-Location of S
for k being Element of NAT holds s . i = ((Computation s) . k) . i
proof end;

theorem :: AMI_1:55
for N being with_non-empty_elements set
for k being Element of NAT
for S being non empty non void IC-Ins-separated steady-programmed definite AMI-Struct of N
for s being State of S holds (Computation s) . (k + 1) = Exec (s . (IC ((Computation s) . k))),((Computation s) . k)
proof end;

theorem Th56: :: AMI_1:56
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated steady-programmed definite AMI-Struct of N
for s being State of S
for k being Element of NAT st s . (IC ((Computation s) . k)) = halt S holds
Result s = (Computation s) . k
proof end;

theorem :: AMI_1:57
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated steady-programmed definite AMI-Struct of N
for s being State of S st ex k being Element of NAT st s . (IC ((Computation s) . k)) = halt S holds
for i being Element of NAT holds Result s = Result ((Computation s) . i)
proof end;

registration
let N be with_non-empty_elements set ;
let S be non empty non void AMI-Struct of N;
let o be Object of S;
cluster ObjectKind o -> non empty ;
coherence
not ObjectKind o is empty
;
end;

definition
let N be set ;
let S be AMI-Struct of N;
func FinPartSt S -> Subset of (sproduct the Object-Kind of S) equals :: AMI_1:def 23
{ p where p is Element of sproduct the Object-Kind of S : p is finite } ;
coherence
{ p where p is Element of sproduct the Object-Kind of S : p is finite } is Subset of (sproduct the Object-Kind of S)
proof end;
end;

:: deftheorem defines FinPartSt AMI_1:def 23 :
for N being set
for S being AMI-Struct of N holds FinPartSt S = { p where p is Element of sproduct the Object-Kind of S : p is finite } ;

registration
let N be set ;
let S be AMI-Struct of N;
cluster finite Element of sproduct the Object-Kind of S;
existence
ex b1 being Element of sproduct the Object-Kind of S st b1 is finite
proof end;
end;

Lem: for N being set
for S being AMI-Struct of N
for x being finite Element of sproduct the Object-Kind of S holds x in FinPartSt S
;

registration
let N be set ;
let S be AMI-Struct of N;
cluster FinPartSt S -> non empty functional ;
coherence
( not FinPartSt S is empty & FinPartSt S is functional )
proof end;
end;

definition
let N be set ;
let S be AMI-Struct of N;
mode FinPartState of S is Element of FinPartSt S;
end;

registration
let N be set ;
let S be AMI-Struct of N;
cluster -> finite Element of FinPartSt S;
coherence
for b1 being FinPartState of S holds b1 is finite
proof end;
end;

definition
let N be with_non-empty_elements set ;
canceled;
let S be non empty non void IC-Ins-separated definite AMI-Struct of N;
let IT be FinPartState of S;
attr IT is autonomic means :Def25: :: AMI_1:def 25
for s1, s2 being State of S st IT c= s1 & IT c= s2 holds
for i being Element of NAT holds ((Computation s1) . i) | (dom IT) = ((Computation s2) . i) | (dom IT);
end;

:: deftheorem AMI_1:def 24 :
canceled;

:: deftheorem Def25 defines autonomic AMI_1:def 25 :
for N being with_non-empty_elements set
for S being non empty non void IC-Ins-separated definite AMI-Struct of N
for IT being FinPartState of S holds
( IT is autonomic iff for s1, s2 being State of S st IT c= s1 & IT c= s2 holds
for i being Element of NAT holds ((Computation s1) . i) | (dom IT) = ((Computation s2) . i) | (dom IT) );

definition
let N be with_non-empty_elements set ;
let S be non empty non void halting IC-Ins-separated definite AMI-Struct of N;
let IT be FinPartState of S;
attr IT is halting means :Def26: :: AMI_1:def 26
for s being State of S st IT c= s holds
s is halting;
end;

:: deftheorem Def26 defines halting AMI_1:def 26 :
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite AMI-Struct of N
for IT being FinPartState of S holds
( IT is halting iff for s being State of S st IT c= s holds
s is halting );

definition
let N be with_non-empty_elements set ;
let IT be non empty non void IC-Ins-separated definite AMI-Struct of N;
attr IT is programmable means :Def27: :: AMI_1:def 27
ex s being FinPartState of IT st
( not s is empty & s is autonomic );
end;

:: deftheorem Def27 defines programmable AMI_1:def 27 :
for N being with_non-empty_elements set
for IT being non empty non void IC-Ins-separated definite AMI-Struct of N holds
( IT is programmable iff ex s being FinPartState of IT st
( not s is empty & s is autonomic ) );

theorem Th58: :: AMI_1:58
for N being with_non-empty_elements set
for S being non empty non void IC-Ins-separated definite AMI-Struct of N
for A, B being set
for la, lb being Object of S st ObjectKind la = A & ObjectKind lb = B holds
for a being Element of A
for b being Element of B holds la,lb --> a,b is FinPartState of S
proof end;

theorem Th59: :: AMI_1:59
for N being with_non-empty_elements set
for S being non empty non void IC-Ins-separated definite AMI-Struct of N
for A being set
for la being Object of S st ObjectKind la = A holds
for a being Element of A holds la .--> a is FinPartState of S
proof end;

definition
let N be with_non-empty_elements set ;
let S be non empty non void IC-Ins-separated definite AMI-Struct of N;
let la be Object of S;
let a be Element of ObjectKind la;
:: original: .-->
redefine func la .--> a -> FinPartState of S;
coherence
la .--> a is FinPartState of S
by Th59;
end;

definition
let N be with_non-empty_elements set ;
let S be non empty non void IC-Ins-separated definite AMI-Struct of N;
let la, lb be Object of S;
let a be Element of ObjectKind la;
let b be Element of ObjectKind lb;
:: original: -->
redefine func la,lb --> a,b -> FinPartState of S;
coherence
la,lb --> a,b is FinPartState of S
by Th58;
end;

theorem Th60: :: AMI_1:60
for E being set holds Trivial-AMI E is realistic
proof end;

theorem Th61: :: AMI_1:61
for N being with_non-empty_elements set holds Trivial-AMI N is programmable
proof end;

registration
let E be set ;
cluster Trivial-AMI E -> strict realistic ;
coherence
Trivial-AMI E is realistic
by Th60;
end;

registration
let N be with_non-empty_elements set ;
cluster Trivial-AMI N -> strict programmable ;
coherence
Trivial-AMI N is programmable
by Th61;
end;

registration
let E be set ;
cluster strict realistic AMI-Struct of E;
existence
ex b1 being AMI-Struct of E st
( b1 is realistic & b1 is strict )
proof end;
end;

registration
let M be set ;
cluster non empty strict non void IC-Ins-separated definite realistic AMI-Struct of M;
existence
ex b1 being non empty non void AMI-Struct of M st
( b1 is realistic & b1 is strict & b1 is IC-Ins-separated & b1 is definite )
proof end;
end;

registration
let N be with_non-empty_elements set ;
cluster non empty strict non void halting IC-Ins-separated steady-programmed definite realistic programmable AMI-Struct of N;
existence
ex b1 being non empty non void IC-Ins-separated definite AMI-Struct of N st
( b1 is halting & b1 is steady-programmed & b1 is realistic & b1 is programmable & b1 is strict )
proof end;
end;

theorem Th62: :: AMI_1:62
for N being with_non-empty_elements set
for S being non void AMI-Struct of N
for s being State of S
for p being FinPartState of S holds s | (dom p) is FinPartState of S
proof end;

theorem :: AMI_1:63
for N being set
for S being AMI-Struct of N holds {} is FinPartState of S
proof end;

registration
let N be with_non-empty_elements set ;
let S be non empty non void IC-Ins-separated definite programmable AMI-Struct of N;
cluster non empty finite autonomic Element of FinPartSt S;
existence
ex b1 being FinPartState of S st
( not b1 is empty & b1 is autonomic )
by Def27;
end;

definition
let N be set ;
let S be AMI-Struct of N;
let f, g be FinPartState of S;
:: original: +*
redefine func f +* g -> FinPartState of S;
coherence
f +* g is FinPartState of S
proof end;
end;

theorem Th64: :: AMI_1:64
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for loc being Instruction-Location of S
for l being Element of ObjectKind (IC S) st l = loc holds
for h being Element of ObjectKind loc st h = halt S holds
for s being State of S st (IC S),loc --> l,h c= s holds
CurInstr s = halt S
proof end;

theorem Th65: :: AMI_1:65
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for loc being Instruction-Location of S
for l being Element of ObjectKind (IC S) st l = loc holds
for h being Element of ObjectKind loc st h = halt S holds
(IC S),loc --> l,h is halting
proof end;

theorem Th66: :: AMI_1:66
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for loc being Instruction-Location of S
for l being Element of ObjectKind (IC S) st l = loc holds
for h being Element of ObjectKind loc st h = halt S holds
for s being State of S st (IC S),loc --> l,h c= s holds
for i being Element of NAT holds (Computation s) . i = s
proof end;

theorem Th67: :: AMI_1:67
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for loc being Instruction-Location of S
for l being Element of ObjectKind (IC S) st l = loc holds
for h being Element of ObjectKind loc st h = halt S holds
(IC S),loc --> l,h is autonomic
proof end;

registration
let N be with_non-empty_elements set ;
let S be non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N;
cluster finite autonomic halting Element of FinPartSt S;
existence
ex b1 being FinPartState of S st
( b1 is autonomic & b1 is halting )
proof end;
end;

definition
let N be with_non-empty_elements set ;
let S be non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N;
mode pre-program of S is autonomic halting FinPartState of S;
end;

definition
let N be with_non-empty_elements set ;
let S be non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N;
let s be FinPartState of S;
assume A1: s is pre-program of S ;
func Result s -> FinPartState of S means :: AMI_1:def 28
for s' being State of S st s c= s' holds
it = (Result s') | (dom s);
existence
ex b1 being FinPartState of S st
for s' being State of S st s c= s' holds
b1 = (Result s') | (dom s)
proof end;
correctness
uniqueness
for b1, b2 being FinPartState of S st ( for s' being State of S st s c= s' holds
b1 = (Result s') | (dom s) ) & ( for s' being State of S st s c= s' holds
b2 = (Result s') | (dom s) ) holds
b1 = b2
;
proof end;
end;

:: deftheorem defines Result AMI_1:def 28 :
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for s being FinPartState of S st s is pre-program of S holds
for b4 being FinPartState of S holds
( b4 = Result s iff for s' being State of S st s c= s' holds
b4 = (Result s') | (dom s) );

definition
let N be with_non-empty_elements set ;
let S be non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N;
let p be FinPartState of S;
let F be Function;
pred p computes F means :Def29: :: AMI_1:def 29
for x being set st x in dom F holds
ex s being FinPartState of S st
( x = s & p +* s is pre-program of S & F . s c= Result (p +* s) );
end;

:: deftheorem Def29 defines computes AMI_1:def 29 :
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for p being FinPartState of S
for F being Function holds
( p computes F iff for x being set st x in dom F holds
ex s being FinPartState of S st
( x = s & p +* s is pre-program of S & F . s c= Result (p +* s) ) );

notation
let N be with_non-empty_elements set ;
let S be non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N;
let p be FinPartState of S;
let F be Function;
antonym p does_not_compute F for p computes F;
end;

theorem Th68: :: AMI_1:68
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for p being FinPartState of S holds p computes {}
proof end;

theorem Th69: :: AMI_1:69
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for p being FinPartState of S holds
( p is pre-program of S iff p computes {} .--> (Result p) )
proof end;

theorem Th70: :: AMI_1:70
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for p being FinPartState of S holds
( p is pre-program of S iff p computes {} .--> {} )
proof end;

definition
let N be with_non-empty_elements set ;
let S be non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N;
let IT be PartFunc of FinPartSt S, FinPartSt S;
attr IT is computable means :Def30: :: AMI_1:def 30
ex p being FinPartState of S st p computes IT;
end;

:: deftheorem Def30 defines computable AMI_1:def 30 :
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for IT being PartFunc of FinPartSt S, FinPartSt S holds
( IT is computable iff ex p being FinPartState of S st p computes IT );

theorem Th71: :: AMI_1:71
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for F being PartFunc of FinPartSt S, FinPartSt S st F = {} holds
F is computable
proof end;

theorem Th72: :: AMI_1:72
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for F being PartFunc of FinPartSt S, FinPartSt S st F = {} .--> {} holds
F is computable
proof end;

theorem Th73: :: AMI_1:73
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for p being pre-program of S
for F being PartFunc of FinPartSt S, FinPartSt S st F = {} .--> (Result p) holds
F is computable
proof end;

definition
let N be with_non-empty_elements set ;
let S be non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N;
let F be PartFunc of FinPartSt S, FinPartSt S;
assume A1: F is computable ;
mode Program of F -> FinPartState of S means :: AMI_1:def 31
it computes F;
existence
ex b1 being FinPartState of S st b1 computes F
by A1, Def30;
end;

:: deftheorem defines Program AMI_1:def 31 :
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for F being PartFunc of FinPartSt S, FinPartSt S st F is computable holds
for b4 being FinPartState of S holds
( b4 is Program of F iff b4 computes F );

theorem :: AMI_1:74
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for F being PartFunc of FinPartSt S, FinPartSt S st F = {} holds
for p being FinPartState of S holds p is Program of F
proof end;

theorem :: AMI_1:75
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for F being PartFunc of FinPartSt S, FinPartSt S st F = {} .--> {} holds
for p being pre-program of S holds p is Program of F
proof end;

theorem :: AMI_1:76
for N being with_non-empty_elements set
for S being non empty non void halting IC-Ins-separated definite realistic AMI-Struct of N
for p being pre-program of S
for F being PartFunc of FinPartSt S, FinPartSt S st F = {} .--> (Result p) holds
p is Program of F
proof end;

notation
let x be set ;
synonym InsCode x for x `1 ;
synonym AddressPart x for x `2 ;
end;

definition
let N be set ;
let S be AMI-Struct of N;
attr S is standard-ins means :Def32: :: AMI_1:def 32
the Instructions of S c= [:NAT ,(((union N) \/ the carrier of S) * ):];
end;

:: deftheorem Def32 defines standard-ins AMI_1:def 32 :
for N being set
for S being AMI-Struct of N holds
( S is standard-ins iff the Instructions of S c= [:NAT ,(((union N) \/ the carrier of S) * ):] );

registration
let N be set ;
cluster Trivial-AMI N -> strict standard-ins ;
coherence
Trivial-AMI N is standard-ins
proof end;
end;

registration
let N be set ;
cluster non empty non void standard-ins AMI-Struct of N;
existence
ex b1 being AMI-Struct of N st
( b1 is standard-ins & not b1 is empty & not b1 is void )
proof end;
end;

registration
let N be set ;
let S be standard-ins AMI-Struct of N;
cluster the Instructions of S -> Relation-like non empty ;
coherence
the Instructions of S is Relation-like
proof end;
end;

definition
let N be set ;
let S be standard-ins AMI-Struct of N;
func InsCodes S -> set equals :: AMI_1:def 33
dom the Instructions of S;
correctness
coherence
dom the Instructions of S is set
;
;
end;

:: deftheorem defines InsCodes AMI_1:def 33 :
for N being set
for S being standard-ins AMI-Struct of N holds InsCodes S = dom the Instructions of S;

definition
let N be set ;
let S be standard-ins AMI-Struct of N;
mode InsType of S is Element of InsCodes S;
end;

definition
let N be set ;
let S be standard-ins AMI-Struct of N;
let I be Element of the Instructions of S;
:: original: InsCode
redefine func InsCode I -> InsType of S;
coherence
InsCode I is InsType of S
by MCART_1:91;
end;

theorem :: AMI_1:77
for N being set
for S being AMI-Struct of N
for x being finite Element of sproduct the Object-Kind of S holds x in FinPartSt S ;

definition
let N be set ;
let S be AMI-Struct of N;
mode IL-FinSequence of S -> FinSequence of the Instruction-Locations of S means :Defx: :: AMI_1:def 34
verum;
existence
ex b1 being FinSequence of the Instruction-Locations of S st verum
;
end;

:: deftheorem Defx defines IL-FinSequence AMI_1:def 34 :
for N being set
for S being AMI-Struct of N
for b3 being FinSequence of the Instruction-Locations of S holds
( b3 is IL-FinSequence of S iff verum );

definition
let N be set ;
let S be non empty non void AMI-Struct of N;
let f be IL-FinSequence of S;
let x be set ;
func f /. x -> Instruction-Location of S equals :: AMI_1:def 35
f /. x;
coherence
f /. x is Instruction-Location of S
proof end;
end;

:: deftheorem defines /. AMI_1:def 35 :
for N being set
for S being non empty non void AMI-Struct of N
for f being IL-FinSequence of S
for x being set holds f /. x = f /. x;

definition
let N be set ;
let S be non empty non void AMI-Struct of N;
let l1 be Instruction-Location of S;
:: original: <*
redefine func <*l1*> -> IL-FinSequence of S;
coherence
<*l1*> is IL-FinSequence of S
proof end;
let l2 be Instruction-Location of S;
:: original: <*
redefine func <*l1,l2*> -> IL-FinSequence of S;
coherence
<*l1,l2*> is IL-FinSequence of S
proof end;
end;

registration
let N be set ;
let S be non empty non void AMI-Struct of N;
cluster non empty IL-FinSequence of S;
existence
not for b1 being IL-FinSequence of S holds b1 is empty
proof end;
end;

definition
let N be set ;
let S be non empty non void AMI-Struct of N;
let f1, f2 be IL-FinSequence of S;
:: original: ^'
redefine func f1 ^' f2 -> IL-FinSequence of S;
coherence
f1 ^' f2 is IL-FinSequence of S
proof end;
end;

definition
let D, N be set ;
let S be non empty non void AMI-Struct of N;
mode IL-Function of D,S -> Function of D,the Instruction-Locations of S means :: AMI_1:def 36
verum;
existence
ex b1 being Function of D,the Instruction-Locations of S st verum
;
end;

:: deftheorem defines IL-Function AMI_1:def 36 :
for D, N being set
for S being non empty non void AMI-Struct of N
for b4 being Function of D,the Instruction-Locations of S holds
( b4 is IL-Function of D,S iff verum );

definition
let D be non empty set ;
let N be set ;
let S be non empty non void AMI-Struct of N;
let f be IL-Function of D,S;
let d be Element of D;
:: original: .
redefine func f . d -> Instruction-Location of S;
correctness
coherence
f . d is Instruction-Location of S
;
proof end;
end;

definition
let N be set ;
let S be non empty non void AMI-Struct of N;
mode IL-DecoratedTree of S -> DecoratedTree of the Instruction-Locations of S means :: AMI_1:def 37
verum;
existence
ex b1 being DecoratedTree of the Instruction-Locations of S st verum
;
end;

:: deftheorem defines IL-DecoratedTree AMI_1:def 37 :
for N being set
for S being non empty non void AMI-Struct of N
for b3 being DecoratedTree of the Instruction-Locations of S holds
( b3 is IL-DecoratedTree of S iff verum );

definition
let N be set ;
let S be non empty non void AMI-Struct of N;
let T be IL-DecoratedTree of S;
let x be set ;
assume A: x in dom T ;
func T . x -> Instruction-Location of S equals :: AMI_1:def 38
T . x;
coherence
T . x is Instruction-Location of S
proof end;
end;

:: deftheorem defines . AMI_1:def 38 :
for N being set
for S being non empty non void AMI-Struct of N
for T being IL-DecoratedTree of S
for x being set st x in dom T holds
T . x = T . x;

scheme :: AMI_1:sch 1
ILFraenkelFin{ F1() -> set , F2() -> non empty non void AMI-Struct of F1(), F3() -> set , F4( set ) -> set } :
{ F4(w) where w is Instruction-Location of F2() : w in F3() } is finite
provided
A1: F3() is finite
proof end;

scheme :: AMI_1:sch 2
Sch2{ F1() -> set , F2() -> set , F3() -> non empty non void AMI-Struct of F1(), F4( set ) -> set , F5() -> Instruction-Location of F3(), P1[ set , set ] } :
{ F4(i) where i is Element of F2() : ex l being Instruction-Location of F3() st
( l = F5() & P1[i,l] )
}
= { F4(j) where j is Element of F2() : P1[j,F5()] }
proof end;