Article SCM_COMP, MML version 4.99.1005
:: SCM_COMP:th 1
theorem
for b1, b2 being FinSequence of the Instructions of SCM
for b3 being FinSequence of INT
for b4, b5, b6 being Element of NAT
for b7 being State-consisting of b4,b5,b6,b1 ^ b2,b3 holds
b7 is State-consisting of b4,b5,b6,b1,b3 & b7 is State-consisting of b4,b5 + len b1,b6,b2,b3;
:: SCM_COMP:th 2
theorem
for b1, b2 being FinSequence of the Instructions of SCM
for b3, b4, b5, b6, b7 being Element of NAT
for b8 being State-consisting of b3,b4,b5,b1 ^ b2,<*> INT
for b9 being Element of product the Object-Kind of SCM
st b9 = Computation(b8,b6) & il. b7 = IC b9
holds b9 is State-consisting of b7,b4 + len b1,b5,b2,<*> INT;
:: SCM_COMP:funcnot 1 => SCM_COMP:func 1
definition
func SCM-AE -> non empty strict with_terminals with_nonterminals with_useful_nonterminals binary DTConstrStr means
Terminals it = SCM-Data-Loc &
NonTerminals it = [:1,5:] &
(for b1, b2, b3 being Element of the carrier of it holds
b1 ==> <*b2,b3*>
iff
b1 in [:1,5:]);
end;
:: SCM_COMP:def 1
theorem
for b1 being non empty strict with_terminals with_nonterminals with_useful_nonterminals binary DTConstrStr holds
b1 = SCM-AE
iff
Terminals b1 = SCM-Data-Loc &
NonTerminals b1 = [:1,5:] &
(for b2, b3, b4 being Element of the carrier of b1 holds
b2 ==> <*b3,b4*>
iff
b2 in [:1,5:]);
:: SCM_COMP:modenot 1
definition
mode bin-term is Element of TS SCM-AE;
end;
:: SCM_COMP:funcnot 2 => SCM_COMP:func 2
definition
let a1 be Element of NonTerminals SCM-AE;
let a2, a3 be Element of TS SCM-AE;
redefine func a1 -tree(a2,a3) -> Element of TS SCM-AE;
end;
:: SCM_COMP:funcnot 3 => SCM_COMP:func 3
definition
let a1 be Element of Terminals SCM-AE;
redefine func root-tree a1 -> Element of TS SCM-AE;
end;
:: SCM_COMP:funcnot 4 => SCM_COMP:func 4
definition
let a1 be Element of Terminals SCM-AE;
func @ A1 -> Data-Location equals
a1;
end;
:: SCM_COMP:def 2
theorem
for b1 being Element of Terminals SCM-AE holds
@ b1 = b1;
:: SCM_COMP:th 3
theorem
for b1 being Element of NonTerminals SCM-AE
st b1 <> [0,0] & b1 <> [0,1] & b1 <> [0,2] & b1 <> [0,3]
holds b1 = [0,4];
:: SCM_COMP:th 4
theorem
[0,0] is Element of NonTerminals SCM-AE &
[0,1] is Element of NonTerminals SCM-AE &
[0,2] is Element of NonTerminals SCM-AE &
[0,3] is Element of NonTerminals SCM-AE &
[0,4] is Element of NonTerminals SCM-AE;
:: SCM_COMP:funcnot 5 => SCM_COMP:func 5
definition
let a1, a2 be Element of TS SCM-AE;
func A1 + A2 -> Element of TS SCM-AE equals
[0,0] -tree(a1,a2);
end;
:: SCM_COMP:def 3
theorem
for b1, b2 being Element of TS SCM-AE holds
b1 + b2 = [0,0] -tree(b1,b2);
:: SCM_COMP:funcnot 6 => SCM_COMP:func 6
definition
let a1, a2 be Element of TS SCM-AE;
func A1 - A2 -> Element of TS SCM-AE equals
[0,1] -tree(a1,a2);
end;
:: SCM_COMP:def 4
theorem
for b1, b2 being Element of TS SCM-AE holds
b1 - b2 = [0,1] -tree(b1,b2);
:: SCM_COMP:funcnot 7 => SCM_COMP:func 7
definition
let a1, a2 be Element of TS SCM-AE;
func A1 * A2 -> Element of TS SCM-AE equals
[0,2] -tree(a1,a2);
end;
:: SCM_COMP:def 5
theorem
for b1, b2 being Element of TS SCM-AE holds
b1 * b2 = [0,2] -tree(b1,b2);
:: SCM_COMP:funcnot 8 => SCM_COMP:func 8
definition
let a1, a2 be Element of TS SCM-AE;
func A1 div A2 -> Element of TS SCM-AE equals
[0,3] -tree(a1,a2);
end;
:: SCM_COMP:def 6
theorem
for b1, b2 being Element of TS SCM-AE holds
b1 div b2 = [0,3] -tree(b1,b2);
:: SCM_COMP:funcnot 9 => SCM_COMP:func 9
definition
let a1, a2 be Element of TS SCM-AE;
func A1 mod A2 -> Element of TS SCM-AE equals
[0,4] -tree(a1,a2);
end;
:: SCM_COMP:def 7
theorem
for b1, b2 being Element of TS SCM-AE holds
b1 mod b2 = [0,4] -tree(b1,b2);
:: SCM_COMP:th 5
theorem
for b1 being Element of TS SCM-AE
st for b2 being Element of Terminals SCM-AE holds
b1 <> root-tree b2
holds ex b2, b3 being Element of TS SCM-AE st
(b1 <> b2 + b3 & b1 <> b2 - b3 & b1 <> b2 * b3 & b1 <> b2 div b3 implies b1 = b2 mod b3);
:: SCM_COMP:funcnot 10 => SCM_COMP:func 10
definition
let a1 be Element of NonTerminals SCM-AE;
let a2, a3 be integer set;
func A1 -Meaning_on(A2,A3) -> integer set equals
a2 + a3
if a1 = [0,0],
a2 - a3
if a1 = [0,1],
a2 * a3
if a1 = [0,2],
a2 div a3
if a1 = [0,3]
otherwise case a1 = [0,4];
thus a2 mod a3;
end;
;
end;
:: SCM_COMP:def 8
theorem
for b1 being Element of NonTerminals SCM-AE
for b2, b3 being integer set holds
(b1 = [0,0] implies b1 -Meaning_on(b2,b3) = b2 + b3) &
(b1 = [0,1] implies b1 -Meaning_on(b2,b3) = b2 - b3) &
(b1 = [0,2] implies b1 -Meaning_on(b2,b3) = b2 * b3) &
(b1 = [0,3] implies b1 -Meaning_on(b2,b3) = b2 div b3) &
(b1 = [0,4] implies b1 -Meaning_on(b2,b3) = b2 mod b3);
:: SCM_COMP:funcnot 11 => SCM_COMP:func 11
definition
let a1 be Element of product the Object-Kind of SCM;
let a2 be Element of Terminals SCM-AE;
redefine func a1 . a2 -> integer set;
end;
:: SCM_COMP:funcnot 12 => SCM_COMP:func 12
definition
let a1 be non empty set;
let a2 be Function-like quasi_total Relation of INT,a1;
let a3 be integer set;
redefine func a2 . a3 -> Element of a1;
end;
:: SCM_COMP:funcnot 13 => SCM_COMP:func 13
definition
let a1 be Element of product the Object-Kind of SCM;
let a2 be Element of TS SCM-AE;
func A2 @ A1 -> integer set means
ex b1 being Function-like quasi_total Relation of TS SCM-AE,INT st
it = b1 . a2 &
(for b2 being Element of Terminals SCM-AE holds
b1 . root-tree b2 = a1 . b2) &
(for b2 being Element of NonTerminals SCM-AE
for b3, b4 being Element of TS SCM-AE
for b5, b6 being Element of the carrier of SCM-AE
st b5 = root-label b3 & b6 = root-label b4 & b2 ==> <*b5,b6*>
for b7, b8 being Element of INT
st b7 = b1 . b3 & b8 = b1 . b4
holds b1 . (b2 -tree(b3,b4)) = b2 -Meaning_on(b7,b8));
end;
:: SCM_COMP:def 9
theorem
for b1 being Element of product the Object-Kind of SCM
for b2 being Element of TS SCM-AE
for b3 being integer set holds
b3 = b2 @ b1
iff
ex b4 being Function-like quasi_total Relation of TS SCM-AE,INT st
b3 = b4 . b2 &
(for b5 being Element of Terminals SCM-AE holds
b4 . root-tree b5 = b1 . b5) &
(for b5 being Element of NonTerminals SCM-AE
for b6, b7 being Element of TS SCM-AE
for b8, b9 being Element of the carrier of SCM-AE
st b8 = root-label b6 & b9 = root-label b7 & b5 ==> <*b8,b9*>
for b10, b11 being Element of INT
st b10 = b4 . b6 & b11 = b4 . b7
holds b4 . (b5 -tree(b6,b7)) = b5 -Meaning_on(b10,b11));
:: SCM_COMP:th 6
theorem
for b1 being Element of product the Object-Kind of SCM
for b2 being Element of Terminals SCM-AE holds
(root-tree b2) @ b1 = b1 . b2;
:: SCM_COMP:th 7
theorem
for b1 being Element of product the Object-Kind of SCM
for b2 being Element of NonTerminals SCM-AE
for b3, b4 being Element of TS SCM-AE holds
(b2 -tree(b3,b4)) @ b1 = b2 -Meaning_on(b3 @ b1,b4 @ b1);
:: SCM_COMP:th 8
theorem
for b1 being Element of product the Object-Kind of SCM
for b2, b3 being Element of TS SCM-AE holds
(b2 + b3) @ b1 = (b2 @ b1) + (b3 @ b1) &
(b2 - b3) @ b1 = (b2 @ b1) - (b3 @ b1) &
(b2 * b3) @ b1 = (b2 @ b1) * (b3 @ b1) &
(b2 div b3) @ b1 = (b2 @ b1) div (b3 @ b1) &
(b2 mod b3) @ b1 = (b2 @ b1) mod (b3 @ b1);
:: SCM_COMP:funcnot 14 => SCM_COMP:func 14
definition
let a1 be Element of NonTerminals SCM-AE;
let a2 be Element of NAT;
func Selfwork(A1,A2) -> Element of (the Instructions of SCM) * equals
<*AddTo(dl. a2,dl. (a2 + 1))*>
if a1 = [0,0],
<*SubFrom(dl. a2,dl. (a2 + 1))*>
if a1 = [0,1],
<*MultBy(dl. a2,dl. (a2 + 1))*>
if a1 = [0,2],
<*Divide(dl. a2,dl. (a2 + 1))*>
if a1 = [0,3]
otherwise case a1 = [0,4];
thus <*Divide(dl. a2,dl. (a2 + 1)),(dl. a2) := dl. (a2 + 1)*>;
end;
;
end;
:: SCM_COMP:def 10
theorem
for b1 being Element of NonTerminals SCM-AE
for b2 being Element of NAT holds
(b1 = [0,0] implies Selfwork(b1,b2) = <*AddTo(dl. b2,dl. (b2 + 1))*>) &
(b1 = [0,1] implies Selfwork(b1,b2) = <*SubFrom(dl. b2,dl. (b2 + 1))*>) &
(b1 = [0,2] implies Selfwork(b1,b2) = <*MultBy(dl. b2,dl. (b2 + 1))*>) &
(b1 = [0,3] implies Selfwork(b1,b2) = <*Divide(dl. b2,dl. (b2 + 1))*>) &
(b1 = [0,4] implies Selfwork(b1,b2) = <*Divide(dl. b2,dl. (b2 + 1)),(dl. b2) := dl. (b2 + 1)*>);
:: SCM_COMP:funcnot 15 => SCM_COMP:func 15
definition
let a1 be Element of TS SCM-AE;
let a2 be Element of NAT;
func SCM-Compile(A1,A2) -> FinSequence of the Instructions of SCM means
ex b1 being Function-like quasi_total Relation of TS SCM-AE,Funcs(NAT,(the Instructions of SCM) *) st
it = (b1 . a1) . a2 &
(for b2 being Element of Terminals SCM-AE holds
ex b3 being Function-like quasi_total Relation of NAT,(the Instructions of SCM) * st
b3 = b1 . root-tree b2 &
(for b4 being Element of NAT holds
b3 . b4 = <*(dl. b4) := @ b2*>)) &
(for b2 being Element of NonTerminals SCM-AE
for b3, b4 being Element of TS SCM-AE
for b5, b6 being Element of the carrier of SCM-AE
st b5 = root-label b3 & b6 = root-label b4 & b2 ==> <*b5,b6*>
holds ex b7, b8, b9 being Function-like quasi_total Relation of NAT,(the Instructions of SCM) * st
b7 = b1 . (b2 -tree(b3,b4)) &
b8 = b1 . b3 &
b9 = b1 . b4 &
(for b10 being Element of NAT holds
b7 . b10 = ((b8 . b10) ^ (b9 . (b10 + 1))) ^ Selfwork(b2,b10)));
end;
:: SCM_COMP:def 11
theorem
for b1 being Element of TS SCM-AE
for b2 being Element of NAT
for b3 being FinSequence of the Instructions of SCM holds
b3 = SCM-Compile(b1,b2)
iff
ex b4 being Function-like quasi_total Relation of TS SCM-AE,Funcs(NAT,(the Instructions of SCM) *) st
b3 = (b4 . b1) . b2 &
(for b5 being Element of Terminals SCM-AE holds
ex b6 being Function-like quasi_total Relation of NAT,(the Instructions of SCM) * st
b6 = b4 . root-tree b5 &
(for b7 being Element of NAT holds
b6 . b7 = <*(dl. b7) := @ b5*>)) &
(for b5 being Element of NonTerminals SCM-AE
for b6, b7 being Element of TS SCM-AE
for b8, b9 being Element of the carrier of SCM-AE
st b8 = root-label b6 & b9 = root-label b7 & b5 ==> <*b8,b9*>
holds ex b10, b11, b12 being Function-like quasi_total Relation of NAT,(the Instructions of SCM) * st
b10 = b4 . (b5 -tree(b6,b7)) &
b11 = b4 . b6 &
b12 = b4 . b7 &
(for b13 being Element of NAT holds
b10 . b13 = ((b11 . b13) ^ (b12 . (b13 + 1))) ^ Selfwork(b5,b13)));
:: SCM_COMP:th 9
theorem
for b1 being Element of Terminals SCM-AE
for b2 being Element of NAT holds
SCM-Compile(root-tree b1,b2) = <*(dl. b2) := @ b1*>;
:: SCM_COMP:th 10
theorem
for b1 being Element of NonTerminals SCM-AE
for b2, b3 being Element of TS SCM-AE
for b4 being Element of NAT
for b5, b6 being Element of the carrier of SCM-AE
st b5 = root-label b2 & b6 = root-label b3 & b1 ==> <*b5,b6*>
holds SCM-Compile(b1 -tree(b2,b3),b4) = ((SCM-Compile(b2,b4)) ^ SCM-Compile(b3,b4 + 1)) ^ Selfwork(b1,b4);
:: SCM_COMP:funcnot 16 => SCM_COMP:func 16
definition
let a1 be Element of Terminals SCM-AE;
func d". A1 -> Element of NAT means
dl. it = a1;
end;
:: SCM_COMP:def 12
theorem
for b1 being Element of Terminals SCM-AE
for b2 being Element of NAT holds
b2 = d". b1
iff
dl. b2 = b1;
:: SCM_COMP:funcnot 17 => SCM_COMP:func 17
definition
let a1 be Element of TS SCM-AE;
func max_Data-Loc_in A1 -> Element of NAT means
ex b1 being Function-like quasi_total Relation of TS SCM-AE,NAT st
it = b1 . a1 &
(for b2 being Element of Terminals SCM-AE holds
b1 . root-tree b2 = d". b2) &
(for b2 being Element of NonTerminals SCM-AE
for b3, b4 being Element of TS SCM-AE
for b5, b6 being Element of the carrier of SCM-AE
st b5 = root-label b3 & b6 = root-label b4 & b2 ==> <*b5,b6*>
for b7, b8 being Element of NAT
st b7 = b1 . b3 & b8 = b1 . b4
holds b1 . (b2 -tree(b3,b4)) = max(b7,b8));
end;
:: SCM_COMP:def 13
theorem
for b1 being Element of TS SCM-AE
for b2 being Element of NAT holds
b2 = max_Data-Loc_in b1
iff
ex b3 being Function-like quasi_total Relation of TS SCM-AE,NAT st
b2 = b3 . b1 &
(for b4 being Element of Terminals SCM-AE holds
b3 . root-tree b4 = d". b4) &
(for b4 being Element of NonTerminals SCM-AE
for b5, b6 being Element of TS SCM-AE
for b7, b8 being Element of the carrier of SCM-AE
st b7 = root-label b5 & b8 = root-label b6 & b4 ==> <*b7,b8*>
for b9, b10 being Element of NAT
st b9 = b3 . b5 & b10 = b3 . b6
holds b3 . (b4 -tree(b5,b6)) = max(b9,b10));
:: SCM_COMP:th 11
theorem
for b1 being Element of Terminals SCM-AE holds
max_Data-Loc_in root-tree b1 = d". b1;
:: SCM_COMP:th 12
theorem
for b1 being Element of NonTerminals SCM-AE
for b2, b3 being Element of TS SCM-AE holds
max_Data-Loc_in (b1 -tree(b2,b3)) = max(max_Data-Loc_in b2,max_Data-Loc_in b3);
:: SCM_COMP:th 13
theorem
for b1 being Element of TS SCM-AE
for b2, b3 being Element of product the Object-Kind of SCM
st for b4 being Element of NAT
st b4 <= max_Data-Loc_in b1
holds b2 . dl. b4 = b3 . dl. b4
holds b1 @ b2 = b1 @ b3;
:: SCM_COMP:th 14
theorem
for b1 being Element of TS SCM-AE
for b2, b3, b4 being Element of NAT
for b5 being State-consisting of b3,b3,b4,SCM-Compile(b1,b2),<*> INT
st max_Data-Loc_in b1 < b2
holds ex b6 being Element of NAT st
ex b7 being Element of product the Object-Kind of SCM st
b7 = Computation(b5,b6 + 1) &
b6 + 1 = len SCM-Compile(b1,b2) &
IC Computation(b5,b6) = il. (b3 + b6) &
IC b7 = il. (b3 + (b6 + 1)) &
b7 . dl. b2 = b1 @ b5 &
(for b8 being Element of NAT
st b8 < b2
holds b5 . dl. b8 = b7 . dl. b8);
:: SCM_COMP:th 15
theorem
for b1 being Element of TS SCM-AE
for b2, b3, b4 being Element of NAT
for b5 being State-consisting of b3,b3,b4,(SCM-Compile(b1,b2)) ^ <*halt SCM*>,<*> INT
st max_Data-Loc_in b1 < b2
holds b5 is halting(NAT, {INT}, SCM) & (Result b5) . dl. b2 = b1 @ b5 & LifeSpan b5 = len SCM-Compile(b1,b2);