Article SCPINVAR, MML version 4.99.1005
:: SCPINVAR:th 5
theorem
for b1, b2 being Element of the Instructions of SCMPDS
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCMPDS holds
((b1 ';' b2) ';' b3) . inspos 0 = b1 &
((b1 ';' b2) ';' b3) . inspos 1 = b2;
:: SCPINVAR:th 6
theorem
for b1, b2 being Int_position holds
ex b3 being Function-like quasi_total Relation of product the Object-Kind of SCMPDS,NAT st
for b4 being Element of product the Object-Kind of SCMPDS holds
(b4 . b1 = b4 . b2 implies b3 . b4 = 0) &
(b4 . b1 = b4 . b2 or b3 . b4 = max(abs (b4 . b1),abs (b4 . b2)));
:: SCPINVAR:th 7
theorem
for b1 being Int_position holds
ex b2 being Function-like quasi_total Relation of product the Object-Kind of SCMPDS,NAT st
for b3 being Element of product the Object-Kind of SCMPDS holds
(0 <= b3 . b1 implies b2 . b3 = 0) &
(0 <= b3 . b1 or b2 . b3 = - (b3 . b1));
:: SCPINVAR:sch 1
scheme SCPINVAR:sch 1
{F1 -> Element of NAT,
F2 -> Element of product the Object-Kind of SCMPDS,
F3 -> finite programmed initial shiftable No-StopCode Element of sproduct the Object-Kind of SCMPDS,
F4 -> Int_position,
F5 -> integer set}:
F1(Dstate IExec(while<0(F4(),F5(),F3()),F2())) = 0 & P1[Dstate IExec(while<0(F4(),F5(),F3()),F2())]
provided
0 < card F3()
and
for b1 being Element of product the Object-Kind of SCMPDS
st P1[Dstate b1]
holds F1(Dstate b1) = 0
iff
0 <= b1 . DataLoc(F2() . F4(),F5())
and
P1[Dstate F2()]
and
for b1 being Element of product the Object-Kind of SCMPDS
st P1[Dstate b1] & b1 . F4() = F2() . F4() & b1 . DataLoc(F2() . F4(),F5()) < 0
holds (IExec(F3(),b1)) . F4() = b1 . F4() & F3() is_closed_on b1 & F3() is_halting_on b1 & F1(Dstate IExec(F3(),b1)) < F1(Dstate b1) & P1[Dstate IExec(F3(),b1)];
:: SCPINVAR:funcnot 1 => SCPINVAR:func 1
definition
let a1, a2 be Element of NAT;
func sum(A1,A2) -> finite programmed initial Element of sproduct the Object-Kind of SCMPDS equals
((((GBP := 0) ';' ((intpos 1) := 0)) ';' ((intpos 2) := - a1)) ';' ((intpos 3) := (a2 + 1))) ';' while<0(GBP,2,((AddTo(GBP,1,intpos 3,0)) ';' AddTo(GBP,2,1)) ';' AddTo(GBP,3,1));
end;
:: SCPINVAR:def 1
theorem
for b1, b2 being Element of NAT holds
sum(b1,b2) = ((((GBP := 0) ';' ((intpos 1) := 0)) ';' ((intpos 2) := - b1)) ';' ((intpos 3) := (b2 + 1))) ';' while<0(GBP,2,((AddTo(GBP,1,intpos 3,0)) ';' AddTo(GBP,2,1)) ';' AddTo(GBP,3,1));
:: SCPINVAR:th 8
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2 being finite programmed initial shiftable No-StopCode Element of sproduct the Object-Kind of SCMPDS
for b3, b4, b5 being Int_position
for b6, b7, b8 being Element of NAT
for b9 being FinSequence of INT
st 0 < card b2 &
b9 is_FinSequence_on b1,b8 &
len b9 = b6 &
b1 . b4 = 0 &
b1 . b3 = 0 &
b1 . intpos b7 = - b6 &
b1 . b5 = b8 + 1 &
(for b10 being Element of product the Object-Kind of SCMPDS
st (ex b11 being FinSequence of INT st
b11 is_FinSequence_on b1,b8 &
len b11 = (b10 . intpos b7) + b6 &
b10 . b4 = Sum b11 &
b10 . b5 = (b8 + 1) + len b11) &
b10 . b3 = 0 &
b10 . intpos b7 < 0 &
(for b11 being Element of NAT
st b8 < b11
holds b10 . intpos b11 = b1 . intpos b11)
holds (IExec(b2,b10)) . b3 = 0 &
b2 is_closed_on b10 &
b2 is_halting_on b10 &
(IExec(b2,b10)) . intpos b7 = (b10 . intpos b7) + 1 &
(ex b11 being FinSequence of INT st
b11 is_FinSequence_on b1,b8 &
len b11 = ((b10 . intpos b7) + b6) + 1 &
(IExec(b2,b10)) . b5 = (b8 + 1) + len b11 &
(IExec(b2,b10)) . b4 = Sum b11) &
(for b11 being Element of NAT
st b8 < b11
holds (IExec(b2,b10)) . intpos b11 = b1 . intpos b11))
holds (IExec(while<0(b3,b7,b2),b1)) . b4 = Sum b9 &
while<0(b3,b7,b2) is_closed_on b1 &
while<0(b3,b7,b2) is_halting_on b1;
:: SCPINVAR:th 9
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2, b3 being Element of NAT
for b4 being FinSequence of INT
st 3 <= b3 & b4 is_FinSequence_on b1,b3 & len b4 = b2
holds (IExec(sum(b2,b3),b1)) . intpos 1 = Sum b4 &
sum(b2,b3) is parahalting;
:: SCPINVAR:sch 2
scheme SCPINVAR:sch 2
{F1 -> Element of NAT,
F2 -> Element of product the Object-Kind of SCMPDS,
F3 -> finite programmed initial shiftable No-StopCode Element of sproduct the Object-Kind of SCMPDS,
F4 -> Int_position,
F5 -> integer set}:
F1(Dstate IExec(while>0(F4(),F5(),F3()),F2())) = 0 & P1[Dstate IExec(while>0(F4(),F5(),F3()),F2())]
provided
0 < card F3()
and
for b1 being Element of product the Object-Kind of SCMPDS
st P1[Dstate b1]
holds F1(Dstate b1) = 0
iff
b1 . DataLoc(F2() . F4(),F5()) <= 0
and
P1[Dstate F2()]
and
for b1 being Element of product the Object-Kind of SCMPDS
st P1[Dstate b1] & b1 . F4() = F2() . F4() & 0 < b1 . DataLoc(F2() . F4(),F5())
holds (IExec(F3(),b1)) . F4() = b1 . F4() & F3() is_closed_on b1 & F3() is_halting_on b1 & F1(Dstate IExec(F3(),b1)) < F1(Dstate b1) & P1[Dstate IExec(F3(),b1)];
:: SCPINVAR:funcnot 2 => SCPINVAR:func 2
definition
let a1 be Element of NAT;
func Fib-macro A1 -> finite programmed initial Element of sproduct the Object-Kind of SCMPDS equals
((((GBP := 0) ';' ((intpos 1) := 0)) ';' ((intpos 2) := 1)) ';' ((intpos 3) := a1)) ';' while>0(GBP,3,((((GBP,4):=(GBP,2)) ';' AddTo(GBP,2,GBP,1)) ';' ((GBP,1):=(GBP,4))) ';' AddTo(GBP,3,- 1));
end;
:: SCPINVAR:def 2
theorem
for b1 being Element of NAT holds
Fib-macro b1 = ((((GBP := 0) ';' ((intpos 1) := 0)) ';' ((intpos 2) := 1)) ';' ((intpos 3) := b1)) ';' while>0(GBP,3,((((GBP,4):=(GBP,2)) ';' AddTo(GBP,2,GBP,1)) ';' ((GBP,1):=(GBP,4))) ';' AddTo(GBP,3,- 1));
:: SCPINVAR:th 10
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2 being finite programmed initial shiftable No-StopCode Element of sproduct the Object-Kind of SCMPDS
for b3, b4, b5 being Int_position
for b6, b7 being Element of NAT
st 0 < card b2 &
b1 . b3 = 0 &
b1 . b4 = 0 &
b1 . b5 = 1 &
b1 . intpos b7 = b6 &
(for b8 being Element of product the Object-Kind of SCMPDS
for b9 being Element of NAT
st b6 = (b8 . intpos b7) + b9 & b8 . b4 = Fib b9 & b8 . b5 = Fib (b9 + 1) & b8 . b3 = 0 & 0 < b8 . intpos b7
holds (IExec(b2,b8)) . b3 = 0 &
b2 is_closed_on b8 &
b2 is_halting_on b8 &
(IExec(b2,b8)) . intpos b7 = (b8 . intpos b7) - 1 &
(IExec(b2,b8)) . b4 = Fib (b9 + 1) &
(IExec(b2,b8)) . b5 = Fib ((b9 + 1) + 1))
holds (IExec(while>0(b3,b7,b2),b1)) . b4 = Fib b6 &
(IExec(while>0(b3,b7,b2),b1)) . b5 = Fib (b6 + 1) &
while>0(b3,b7,b2) is_closed_on b1 &
while>0(b3,b7,b2) is_halting_on b1;
:: SCPINVAR:th 11
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2 being Element of NAT holds
(IExec(Fib-macro b2,b1)) . intpos 1 = Fib b2 &
(IExec(Fib-macro b2,b1)) . intpos 2 = Fib (b2 + 1) &
Fib-macro b2 is parahalting;
:: SCPINVAR:funcnot 3 => SCPINVAR:func 3
definition
let a1 be Int_position;
let a2 be integer set;
let a3 be finite programmed initial Element of sproduct the Object-Kind of SCMPDS;
func while<>0(A1,A2,A3) -> finite programmed initial Element of sproduct the Object-Kind of SCMPDS equals
((((a1,a2)<>0_goto 2) ';' goto ((card a3) + 2)) ';' a3) ';' goto - ((card a3) + 2);
end;
:: SCPINVAR:def 3
theorem
for b1 being Int_position
for b2 being integer set
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCMPDS holds
while<>0(b1,b2,b3) = ((((b1,b2)<>0_goto 2) ';' goto ((card b3) + 2)) ';' b3) ';' goto - ((card b3) + 2);
:: SCPINVAR:th 12
theorem
for b1 being Int_position
for b2 being integer set
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCMPDS holds
card while<>0(b1,b2,b3) = (card b3) + 3;
:: SCPINVAR:th 13
theorem
for b1 being Int_position
for b2 being integer set
for b3 being Element of NAT
for b4 being finite programmed initial Element of sproduct the Object-Kind of SCMPDS holds
b3 < (card b4) + 3
iff
inspos b3 in proj1 while<>0(b1,b2,b4);
:: SCPINVAR:th 14
theorem
for b1 being Int_position
for b2 being integer set
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCMPDS holds
inspos 0 in proj1 while<>0(b1,b2,b3) & inspos 1 in proj1 while<>0(b1,b2,b3);
:: SCPINVAR:th 15
theorem
for b1 being Int_position
for b2 being integer set
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCMPDS holds
(while<>0(b1,b2,b3)) . inspos 0 = (b1,b2)<>0_goto 2 &
(while<>0(b1,b2,b3)) . inspos 1 = goto ((card b3) + 2) &
(while<>0(b1,b2,b3)) . inspos ((card b3) + 2) = goto - ((card b3) + 2);
:: SCPINVAR:th 16
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCMPDS
for b3 being Int_position
for b4 being integer set
st b1 . DataLoc(b1 . b3,b4) = 0
holds while<>0(b3,b4,b2) is_closed_on b1 & while<>0(b3,b4,b2) is_halting_on b1;
:: SCPINVAR:th 17
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCMPDS
for b3, b4 being Int_position
for b5 being integer set
st b1 . DataLoc(b1 . b3,b5) = 0
holds IExec(while<>0(b3,b5,b2),b1) = b1 +* Start-At inspos ((card b2) + 3);
:: SCPINVAR:th 18
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCMPDS
for b3 being Int_position
for b4 being integer set
st b1 . DataLoc(b1 . b3,b4) = 0
holds IC IExec(while<>0(b3,b4,b2),b1) = inspos ((card b2) + 3);
:: SCPINVAR:th 19
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2 being finite programmed initial Element of sproduct the Object-Kind of SCMPDS
for b3, b4 being Int_position
for b5 being integer set
st b1 . DataLoc(b1 . b3,b5) = 0
holds (IExec(while<>0(b3,b5,b2),b1)) . b4 = b1 . b4;
:: SCPINVAR:funcreg 1
registration
let a1 be finite programmed initial shiftable Element of sproduct the Object-Kind of SCMPDS;
let a2 be Int_position;
let a3 be integer set;
cluster while<>0(a2,a3,a1) -> finite programmed initial shiftable;
end;
:: SCPINVAR:funcreg 2
registration
let a1 be finite programmed initial No-StopCode Element of sproduct the Object-Kind of SCMPDS;
let a2 be Int_position;
let a3 be integer set;
cluster while<>0(a2,a3,a1) -> finite programmed initial No-StopCode;
end;
:: SCPINVAR:sch 3
scheme SCPINVAR:sch 3
{F1 -> Element of NAT,
F2 -> Element of product the Object-Kind of SCMPDS,
F3 -> finite programmed initial shiftable No-StopCode Element of sproduct the Object-Kind of SCMPDS,
F4 -> Int_position,
F5 -> integer set}:
while<>0(F4(),F5(),F3()) is_closed_on F2() & while<>0(F4(),F5(),F3()) is_halting_on F2()
provided
0 < card F3()
and
for b1 being Element of product the Object-Kind of SCMPDS
st P1[Dstate b1] & F1(Dstate b1) = 0
holds b1 . DataLoc(F2() . F4(),F5()) = 0
and
P1[Dstate F2()]
and
for b1 being Element of product the Object-Kind of SCMPDS
st P1[Dstate b1] & b1 . F4() = F2() . F4() & b1 . DataLoc(F2() . F4(),F5()) <> 0
holds (IExec(F3(),b1)) . F4() = b1 . F4() & F3() is_closed_on b1 & F3() is_halting_on b1 & F1(Dstate IExec(F3(),b1)) < F1(Dstate b1) & P1[Dstate IExec(F3(),b1)];
:: SCPINVAR:sch 4
scheme SCPINVAR:sch 4
{F1 -> Element of NAT,
F2 -> Element of product the Object-Kind of SCMPDS,
F3 -> finite programmed initial shiftable No-StopCode Element of sproduct the Object-Kind of SCMPDS,
F4 -> Int_position,
F5 -> integer set}:
IExec(while<>0(F4(),F5(),F3()),F2()) = IExec(while<>0(F4(),F5(),F3()),IExec(F3(),F2()))
provided
0 < card F3()
and
F2() . DataLoc(F2() . F4(),F5()) <> 0
and
for b1 being Element of product the Object-Kind of SCMPDS
st P1[Dstate b1] & F1(Dstate b1) = 0
holds b1 . DataLoc(F2() . F4(),F5()) = 0
and
P1[Dstate F2()]
and
for b1 being Element of product the Object-Kind of SCMPDS
st P1[Dstate b1] & b1 . F4() = F2() . F4() & b1 . DataLoc(F2() . F4(),F5()) <> 0
holds (IExec(F3(),b1)) . F4() = b1 . F4() & F3() is_closed_on b1 & F3() is_halting_on b1 & F1(Dstate IExec(F3(),b1)) < F1(Dstate b1) & P1[Dstate IExec(F3(),b1)];
:: SCPINVAR:sch 5
scheme SCPINVAR:sch 5
{F1 -> Element of NAT,
F2 -> Element of product the Object-Kind of SCMPDS,
F3 -> finite programmed initial shiftable No-StopCode Element of sproduct the Object-Kind of SCMPDS,
F4 -> Int_position,
F5 -> integer set}:
F1(Dstate IExec(while<>0(F4(),F5(),F3()),F2())) = 0 & P1[Dstate IExec(while<>0(F4(),F5(),F3()),F2())]
provided
0 < card F3()
and
for b1 being Element of product the Object-Kind of SCMPDS
st P1[Dstate b1]
holds F1(Dstate b1) = 0
iff
b1 . DataLoc(F2() . F4(),F5()) = 0
and
P1[Dstate F2()]
and
for b1 being Element of product the Object-Kind of SCMPDS
st P1[Dstate b1] & b1 . F4() = F2() . F4() & b1 . DataLoc(F2() . F4(),F5()) <> 0
holds (IExec(F3(),b1)) . F4() = b1 . F4() & F3() is_closed_on b1 & F3() is_halting_on b1 & F1(Dstate IExec(F3(),b1)) < F1(Dstate b1) & P1[Dstate IExec(F3(),b1)];
:: SCPINVAR:th 20
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2 being finite programmed initial shiftable No-StopCode Element of sproduct the Object-Kind of SCMPDS
for b3, b4, b5 being Int_position
for b6, b7 being integer set
st 0 < card b2 &
b1 . b3 = b7 &
0 < b1 . b4 &
0 < b1 . b5 &
b1 . DataLoc(b7,b6) = (b1 . b4) - (b1 . b5) &
(for b8 being Element of product the Object-Kind of SCMPDS
st 0 < b8 . b4 &
0 < b8 . b5 &
b8 . b3 = b7 &
b8 . DataLoc(b7,b6) = (b8 . b4) - (b8 . b5) &
b8 . b4 <> b8 . b5
holds (IExec(b2,b8)) . b3 = b7 &
b2 is_closed_on b8 &
b2 is_halting_on b8 &
(b8 . b4 <= b8 . b5 or (IExec(b2,b8)) . b4 = (b8 . b4) - (b8 . b5) &
(IExec(b2,b8)) . b5 = b8 . b5) &
(b8 . b4 <= b8 . b5 implies (IExec(b2,b8)) . b5 = (b8 . b5) - (b8 . b4) &
(IExec(b2,b8)) . b4 = b8 . b4) &
(IExec(b2,b8)) . DataLoc(b7,b6) = ((IExec(b2,b8)) . b4) - ((IExec(b2,b8)) . b5))
holds while<>0(b3,b6,b2) is_closed_on b1 &
while<>0(b3,b6,b2) is_halting_on b1 &
(b1 . DataLoc(b1 . b3,b6) = 0 or IExec(while<>0(b3,b6,b2),b1) = IExec(while<>0(b3,b6,b2),IExec(b2,b1)));
:: SCPINVAR:funcnot 4 => SCPINVAR:func 4
definition
func GCD-Algorithm -> finite programmed initial Element of sproduct the Object-Kind of SCMPDS equals
(((GBP := 0) ';' ((GBP,3):=(GBP,1))) ';' SubFrom(GBP,3,GBP,2)) ';' while<>0(GBP,3,((if>0(GBP,3,Load SubFrom(GBP,1,GBP,2),Load SubFrom(GBP,2,GBP,1))) ';' ((GBP,3):=(GBP,1))) ';' SubFrom(GBP,3,GBP,2));
end;
:: SCPINVAR:def 4
theorem
GCD-Algorithm = (((GBP := 0) ';' ((GBP,3):=(GBP,1))) ';' SubFrom(GBP,3,GBP,2)) ';' while<>0(GBP,3,((if>0(GBP,3,Load SubFrom(GBP,1,GBP,2),Load SubFrom(GBP,2,GBP,1))) ';' ((GBP,3):=(GBP,1))) ';' SubFrom(GBP,3,GBP,2));
:: SCPINVAR:th 21
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2 being finite programmed initial shiftable No-StopCode Element of sproduct the Object-Kind of SCMPDS
for b3, b4, b5 being Int_position
for b6, b7 being integer set
st 0 < card b2 &
b1 . b3 = b7 &
0 < b1 . b4 &
0 < b1 . b5 &
b1 . DataLoc(b7,b6) = (b1 . b4) - (b1 . b5) &
(for b8 being Element of product the Object-Kind of SCMPDS
st 0 < b8 . b4 &
0 < b8 . b5 &
b8 . b3 = b7 &
b8 . DataLoc(b7,b6) = (b8 . b4) - (b8 . b5) &
b8 . b4 <> b8 . b5
holds (IExec(b2,b8)) . b3 = b7 &
b2 is_closed_on b8 &
b2 is_halting_on b8 &
(b8 . b4 <= b8 . b5 or (IExec(b2,b8)) . b4 = (b8 . b4) - (b8 . b5) &
(IExec(b2,b8)) . b5 = b8 . b5) &
(b8 . b4 <= b8 . b5 implies (IExec(b2,b8)) . b5 = (b8 . b5) - (b8 . b4) &
(IExec(b2,b8)) . b4 = b8 . b4) &
(IExec(b2,b8)) . DataLoc(b7,b6) = ((IExec(b2,b8)) . b4) - ((IExec(b2,b8)) . b5))
holds (IExec(while<>0(b3,b6,b2),b1)) . b4 = (b1 . b4) gcd (b1 . b5) &
(IExec(while<>0(b3,b6,b2),b1)) . b5 = (b1 . b4) gcd (b1 . b5);
:: SCPINVAR:th 22
theorem
card GCD-Algorithm = 12;
:: SCPINVAR:th 23
theorem
for b1 being Element of product the Object-Kind of SCMPDS
for b2, b3 being integer set
st b1 . intpos 1 = b2 & b1 . intpos 2 = b3 & 0 < b2 & 0 < b3
holds (IExec(GCD-Algorithm,b1)) . intpos 1 = b2 gcd b3 &
(IExec(GCD-Algorithm,b1)) . intpos 2 = b2 gcd b3 &
GCD-Algorithm is_closed_on b1 &
GCD-Algorithm is_halting_on b1;