:: On the Composition of Macro Instructions of Standard Computers
:: by Artur Korni{\l}owicz
::
:: Received April 14, 2000
:: Copyright (c) 2000-2011 Association of Mizar Users


begin

theorem Th17: :: AMISTD_2:1
for N being non empty with_non-empty_elements set
for I being Instruction of (STC N) holds JumpPart I = 0
proof end;

definition
let N be non empty with_non-empty_elements set ;
let S be standard-ins non empty IC-Ins-separated AMI-Struct of N;
let I be Instruction of S;
attr I is with_explicit_jumps means :Def6: :: AMISTD_2:def 1
JUMP I = rng (JumpPart I);
end;

:: deftheorem Def6 defines with_explicit_jumps AMISTD_2:def 1 :
for N being non empty with_non-empty_elements set
for S being standard-ins non empty IC-Ins-separated AMI-Struct of N
for I being Instruction of S holds
( I is with_explicit_jumps iff JUMP I = rng (JumpPart I) );

definition
let N be non empty with_non-empty_elements set ;
let S be standard-ins non empty IC-Ins-separated AMI-Struct of N;
attr S is with_explicit_jumps means :Def8: :: AMISTD_2:def 2
for I being Instruction of S holds I is with_explicit_jumps ;
end;

:: deftheorem Def8 defines with_explicit_jumps AMISTD_2:def 2 :
for N being non empty with_non-empty_elements set
for S being standard-ins non empty IC-Ins-separated AMI-Struct of N holds
( S is with_explicit_jumps iff for I being Instruction of S holds I is with_explicit_jumps );

registration
let N be non empty with_non-empty_elements set ;
cluster standard-ins non empty IC-Ins-separated standard for AMI-Struct of N;
existence
ex b1 being non empty IC-Ins-separated AMI-Struct of N st
( b1 is standard & b1 is standard-ins )
proof end;
end;

theorem Th18: :: AMISTD_2:2
for N being non empty with_non-empty_elements set
for S being non empty IC-Ins-separated standard AMI-Struct of N
for I being Instruction of S st ( for f being Element of NAT holds NIC (I,f) = {(succ f)} ) holds
JUMP I is empty
proof end;

registration
let N be non empty with_non-empty_elements set ;
let I be Instruction of (STC N);
cluster JUMP I -> empty ;
coherence
JUMP I is empty
proof end;
end;

theorem Th19: :: AMISTD_2:3
for N being non empty with_non-empty_elements set
for T being InsType of (STC N) holds JumpParts T = {0}
proof end;

Lm1: for N being non empty with_non-empty_elements set
for I being Instruction of (Trivial-AMI N) holds JumpPart I = 0
proof end;

Lm2: for N being non empty with_non-empty_elements set
for T being InsType of (Trivial-AMI N) holds JumpParts T = {0}
proof end;

registration
let N be non empty with_non-empty_elements set ;
cluster STC N -> homogeneous regular J/A-independent with_explicit_jumps ;
coherence
( STC N is with_explicit_jumps & STC N is homogeneous & STC N is regular & STC N is J/A-independent )
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
cluster standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting standard with_explicit_jumps for AMI-Struct of N;
existence
ex b1 being standard-ins non empty IC-Ins-separated AMI-Struct of N st
( b1 is standard & b1 is regular & b1 is J/A-independent & b1 is homogeneous & b1 is halting & b1 is with_explicit_jumps )
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
cluster Trivial-AMI N -> regular J/A-independent ;
coherence
( Trivial-AMI N is regular & Trivial-AMI N is J/A-independent )
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
cluster standard-ins regular J/A-independent for AMI-Struct of N;
existence
ex b1 being standard-ins AMI-Struct of N st
( b1 is regular & b1 is J/A-independent )
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
let I be Instruction of (Trivial-AMI N);
cluster JUMP I -> empty ;
coherence
JUMP I is empty
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
cluster Trivial-AMI N -> with_explicit_jumps ;
coherence
Trivial-AMI N is with_explicit_jumps
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
cluster standard-ins regular J/A-independent non empty for AMI-Struct of N;
existence
ex b1 being standard-ins non empty AMI-Struct of N st
( b1 is regular & b1 is J/A-independent )
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
cluster standard-ins non empty IC-Ins-separated halting with_explicit_jumps for AMI-Struct of N;
existence
ex b1 being standard-ins non empty IC-Ins-separated AMI-Struct of N st
( b1 is with_explicit_jumps & b1 is halting )
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
let S be standard-ins non empty IC-Ins-separated with_explicit_jumps AMI-Struct of N;
cluster -> with_explicit_jumps for Element of the Instructions of S;
coherence
for b1 being Instruction of S holds b1 is with_explicit_jumps
by Def8;
end;

theorem Th21: :: AMISTD_2:4
for N being non empty with_non-empty_elements set
for S being non empty IC-Ins-separated AMI-Struct of N
for I being Instruction of S st I is halting holds
JUMP I is empty
proof end;

registration
let N be non empty with_non-empty_elements set ;
let S be non empty IC-Ins-separated halting AMI-Struct of N;
let I be halting Instruction of S;
cluster JUMP I -> empty ;
coherence
JUMP I is empty
by Th21;
end;

theorem :: AMISTD_2:5
for N being non empty with_non-empty_elements set
for S being standard-ins non empty IC-Ins-separated halting with_explicit_jumps AMI-Struct of N
for I being Instruction of S st I is ins-loc-free holds
JUMP I is empty
proof end;

registration
let N be non empty with_non-empty_elements set ;
let S be standard-ins non empty IC-Ins-separated with_explicit_jumps AMI-Struct of N;
cluster halting -> ins-loc-free for Element of the Instructions of S;
coherence
for b1 being Instruction of S st b1 is halting holds
b1 is ins-loc-free
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
let S be standard-ins non empty IC-Ins-separated with_explicit_jumps AMI-Struct of N;
cluster sequential -> ins-loc-free for Element of the Instructions of S;
coherence
for b1 being Instruction of S st b1 is sequential holds
b1 is ins-loc-free
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
let S be non empty IC-Ins-separated halting standard AMI-Struct of N;
cluster Stop S -> really-closed ;
coherence
Stop S is really-closed
by AMISTD_1:16;
end;

begin

registration
let N be non empty with_non-empty_elements set ;
let S be standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting with_explicit_jumps AMI-Struct of N;
let I be halting Instruction of S;
let k be natural number ;
cluster IncAddr (I,k) -> halting ;
coherence
IncAddr (I,k) is halting
by COMPOS_1:11;
end;

theorem :: AMISTD_2:6
for k being natural number
for N being non empty with_non-empty_elements set
for S being standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting standard with_explicit_jumps AMI-Struct of N
for I being Instruction of S st I is sequential holds
IncAddr (I,k) is sequential by COMPOS_1:11;

definition
let N be non empty with_non-empty_elements set ;
let S be standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting AMI-Struct of N;
let I be Instruction of S;
attr I is IC-relocable means :Def18: :: AMISTD_2:def 3
for j, k being natural number
for s being State of S holds (IC (Exec ((IncAddr (I,j)),s))) + k = IC (Exec ((IncAddr (I,(j + k))),(IncIC (s,k))));
end;

:: deftheorem Def18 defines IC-relocable AMISTD_2:def 3 :
for N being non empty with_non-empty_elements set
for S being standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting AMI-Struct of N
for I being Instruction of S holds
( I is IC-relocable iff for j, k being natural number
for s being State of S holds (IC (Exec ((IncAddr (I,j)),s))) + k = IC (Exec ((IncAddr (I,(j + k))),(IncIC (s,k)))) );

definition
let N be non empty with_non-empty_elements set ;
let S be standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting AMI-Struct of N;
attr S is IC-relocable means :Def19: :: AMISTD_2:def 4
for I being Instruction of S holds I is IC-relocable ;
end;

:: deftheorem Def19 defines IC-relocable AMISTD_2:def 4 :
for N being non empty with_non-empty_elements set
for S being standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting AMI-Struct of N holds
( S is IC-relocable iff for I being Instruction of S holds I is IC-relocable );

registration
let N be non empty with_non-empty_elements set ;
let S be standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting with_explicit_jumps AMI-Struct of N;
cluster sequential -> IC-relocable for Element of the Instructions of S;
coherence
for b1 being Instruction of S st b1 is sequential holds
b1 is IC-relocable
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
let S be standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting with_explicit_jumps AMI-Struct of N;
cluster halting -> IC-relocable for Element of the Instructions of S;
coherence
for b1 being Instruction of S st b1 is halting holds
b1 is IC-relocable
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
cluster STC N -> IC-relocable ;
coherence
STC N is IC-relocable
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
cluster standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting standard with_explicit_jumps for AMI-Struct of N;
existence
ex b1 being standard-ins regular J/A-independent non empty IC-Ins-separated standard AMI-Struct of N st
( b1 is homogeneous & b1 is halting & b1 is with_explicit_jumps )
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
cluster standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting standard with_explicit_jumps IC-relocable for AMI-Struct of N;
existence
ex b1 being standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting standard with_explicit_jumps AMI-Struct of N st b1 is IC-relocable
proof end;
end;

registration
let N be non empty with_non-empty_elements set ;
let S be standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting IC-relocable AMI-Struct of N;
cluster -> IC-relocable for Element of the Instructions of S;
coherence
for b1 being Instruction of S holds b1 is IC-relocable
by Def19;
end;

registration
let N be non empty with_non-empty_elements set ;
let S be standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting with_explicit_jumps AMI-Struct of N;
cluster with_explicit_jumps IC-relocable for Element of the Instructions of S;
existence
ex b1 being Instruction of S st b1 is IC-relocable
proof end;
end;

theorem Th47: :: AMISTD_2:7
for N being non empty with_non-empty_elements set
for S being standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting with_explicit_jumps AMI-Struct of N
for I being IC-relocable Instruction of S
for k being natural number
for s being State of S holds (IC (Exec (I,s))) + k = IC (Exec ((IncAddr (I,k)),(IncIC (s,k))))
proof end;

registration
let N be non empty with_non-empty_elements set ;
let S be standard-ins homogeneous regular J/A-independent non empty IC-Ins-separated halting standard with_explicit_jumps IC-relocable AMI-Struct of N;
let F, G be NAT -defined the Instructions of S -valued non empty finite initial really-closed Function;
cluster F ';' G -> really-closed ;
coherence
F ';' G is really-closed
proof end;
end;

theorem :: AMISTD_2:8
for N being non empty with_non-empty_elements set
for I being Instruction of (Trivial-AMI N) holds JumpPart I = 0 by Lm1;

theorem :: AMISTD_2:9
for N being non empty with_non-empty_elements set
for T being InsType of (Trivial-AMI N) holds JumpParts T = {0} by Lm2;

theorem :: AMISTD_2:10
for N being non empty with_non-empty_elements set
for n being Element of NAT
for S being non empty IC-Ins-separated AMI-Struct of N
for s being State of S
for I being Program of
for P1, P2 being Instruction-Sequence of S st I c= P1 & I c= P2 & ( for m being Element of NAT st m < n holds
IC (Comput (P2,s,m)) in dom I ) holds
for m being Element of NAT st m <= n holds
Comput (P1,s,m) = Comput (P2,s,m)
proof end;

theorem :: AMISTD_2:11
for N being non empty with_non-empty_elements set
for S being non empty IC-Ins-separated halting AMI-Struct of N
for P being Instruction-Sequence of S
for s being State of S st s = Following (P,s) holds
for n being Element of NAT holds Comput (P,s,n) = s
proof end;