Article SFMASTR3, MML version 4.99.1005
:: SFMASTR3:th 7
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being Int-Location
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
st b3 is_closed_on Initialize b1 & b3 is_halting_on Initialize b1 & b3 does_not_destroy b2
holds (IExec(b3,b1)) . b2 = (Initialize b1) . b2;
:: SFMASTR3:th 8
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
st b1 . intloc 0 = 1
holds (IExec(SCM+FSA-Stop,b1)) | (Int-Locations \/ FinSeq-Locations) = b1 | (Int-Locations \/ FinSeq-Locations);
:: SFMASTR3:th 9
theorem
for b1 being Int-Location holds
SCM+FSA-Stop does_not_refer b1;
:: SFMASTR3:th 10
theorem
for b1, b2, b3 being Int-Location
st b1 <> b2
holds b3 := b2 does_not_refer b1;
:: SFMASTR3:th 11
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3 being Int-Location
for b4 being FinSeq-Location holds
(Exec(b2 :=(b4,b3),b1)) . b2 = (b1 . b4) /. abs (b1 . b3);
:: SFMASTR3:th 12
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2, b3 being Int-Location
for b4 being FinSeq-Location holds
(Exec((b4,b2):= b3,b1)) . b4 = (b1 . b4) +*(abs (b1 . b2),b1 . b3);
:: SFMASTR3:funcreg 1
registration
let a1 be read-write Int-Location;
let a2 be Int-Location;
let a3, a4 be finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA;
cluster if>0(a1,a2,a3,a4) -> finite programmed initial good;
end;
:: SFMASTR3:th 13
theorem
for b1, b2 being Int-Location
for b3, b4 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
UsedIntLoc if>0(b1,b2,b3,b4) = ({b1,b2} \/ UsedIntLoc b3) \/ UsedIntLoc b4;
:: SFMASTR3:th 14
theorem
for b1, b2 being Int-Location
for b3 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
st b3 does_not_destroy b1
holds while>0(b2,b3) does_not_destroy b1;
:: SFMASTR3:th 15
theorem
for b1, b2, b3 being Int-Location
for b4, b5 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
st b1 <> b2 & b4 does_not_destroy b1 & b5 does_not_destroy b1
holds if>0(b2,b3,b4,b5) does_not_destroy b1;
:: SFMASTR3:funcnot 1 => SFMASTR3:func 1
definition
let a1, a2, a3 be Int-Location;
let a4 be finite programmed initial Element of sproduct the Object-Kind of SCM+FSA;
let a5 be Element of product the Object-Kind of SCM+FSA;
func StepForUp(A1,A2,A3,A4,A5) -> Function-like quasi_total Relation of NAT,product the Object-Kind of SCM+FSA equals
StepWhile>0(1 -thRWNotIn ({a1,a2,a3} \/ UsedIntLoc a4),(a4 ';' AddTo(a1,intloc 0)) ';' SubFrom(1 -thRWNotIn ({a1,a2,a3} \/ UsedIntLoc a4),intloc 0),(a5 +*(1 -thRWNotIn ({a1,a2,a3} \/ UsedIntLoc a4),((a5 . a3) - (a5 . a2)) + 1)) +*(a1,a5 . a2));
end;
:: SFMASTR3:def 6
theorem
for b1, b2, b3 being Int-Location
for b4 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
for b5 being Element of product the Object-Kind of SCM+FSA holds
StepForUp(b1,b2,b3,b4,b5) = StepWhile>0(1 -thRWNotIn ({b1,b2,b3} \/ UsedIntLoc b4),(b4 ';' AddTo(b1,intloc 0)) ';' SubFrom(1 -thRWNotIn ({b1,b2,b3} \/ UsedIntLoc b4),intloc 0),(b5 +*(1 -thRWNotIn ({b1,b2,b3} \/ UsedIntLoc b4),((b5 . b3) - (b5 . b2)) + 1)) +*(b1,b5 . b2));
:: SFMASTR3:th 16
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
st b1 . intloc 0 = 1
holds ((StepForUp(b2,b3,b4,b5,b1)) . 0) . intloc 0 = 1;
:: SFMASTR3:th 17
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
((StepForUp(b2,b3,b4,b5,b1)) . 0) . b2 = b1 . b3;
:: SFMASTR3:th 18
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
st b2 <> b3
holds ((StepForUp(b2,b3,b4,b5,b1)) . 0) . b3 = b1 . b3;
:: SFMASTR3:th 19
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
st b2 <> b3
holds ((StepForUp(b2,b4,b3,b5,b1)) . 0) . b3 = b1 . b3;
:: SFMASTR3:th 20
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4, b5 being Int-Location
for b6 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
st b2 <> b3 & b3 in UsedIntLoc b6
holds ((StepForUp(b2,b4,b5,b6,b1)) . 0) . b3 = b1 . b3;
:: SFMASTR3:th 21
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being FinSeq-Location
for b6 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
((StepForUp(b2,b3,b4,b6,b1)) . 0) . b5 = b1 . b5;
:: SFMASTR3:th 22
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
st b1 . intloc 0 = 1
for b6 being read-write Int-Location
st b6 = 1 -thRWNotIn ({b2,b3,b4} \/ UsedIntLoc b5)
holds (IExec((((b6 := b4) ';' SubFrom(b6,b3)) ';' AddTo(b6,intloc 0)) ';' (b2 := b3),b1)) | (Int-Locations \/ FinSeq-Locations) = ((b1 +*(b6,((b1 . b4) - (b1 . b3)) + 1)) +*(b2,b1 . b3)) | (Int-Locations \/ FinSeq-Locations);
:: SFMASTR3:prednot 1 => SFMASTR3:pred 1
definition
let a1, a2, a3 be Int-Location;
let a4 be finite programmed initial Element of sproduct the Object-Kind of SCM+FSA;
let a5 be Element of product the Object-Kind of SCM+FSA;
pred ProperForUpBody A1,A2,A3,A4,A5 means
for b1 being Element of NAT
st b1 < ((a5 . a3) - (a5 . a2)) + 1
holds a4 is_closed_on (StepForUp(a1,a2,a3,a4,a5)) . b1 & a4 is_halting_on (StepForUp(a1,a2,a3,a4,a5)) . b1;
end;
:: SFMASTR3:dfs 2
definiens
let a1, a2, a3 be Int-Location;
let a4 be finite programmed initial Element of sproduct the Object-Kind of SCM+FSA;
let a5 be Element of product the Object-Kind of SCM+FSA;
To prove
ProperForUpBody a1,a2,a3,a4,a5
it is sufficient to prove
thus for b1 being Element of NAT
st b1 < ((a5 . a3) - (a5 . a2)) + 1
holds a4 is_closed_on (StepForUp(a1,a2,a3,a4,a5)) . b1 & a4 is_halting_on (StepForUp(a1,a2,a3,a4,a5)) . b1;
:: SFMASTR3:def 7
theorem
for b1, b2, b3 being Int-Location
for b4 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
for b5 being Element of product the Object-Kind of SCM+FSA holds
ProperForUpBody b1,b2,b3,b4,b5
iff
for b6 being Element of NAT
st b6 < ((b5 . b3) - (b5 . b2)) + 1
holds b4 is_closed_on (StepForUp(b1,b2,b3,b4,b5)) . b6 & b4 is_halting_on (StepForUp(b1,b2,b3,b4,b5)) . b6;
:: SFMASTR3:th 23
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2, b3, b4 being Int-Location
for b5 being finite programmed initial parahalting Element of sproduct the Object-Kind of SCM+FSA holds
ProperForUpBody b2,b3,b4,b5,b1;
:: SFMASTR3:th 24
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b6 being Element of NAT
st ((StepForUp(b2,b3,b4,b5,b1)) . b6) . intloc 0 = 1 &
b5 is_closed_on (StepForUp(b2,b3,b4,b5,b1)) . b6 &
b5 is_halting_on (StepForUp(b2,b3,b4,b5,b1)) . b6
holds ((StepForUp(b2,b3,b4,b5,b1)) . (b6 + 1)) . intloc 0 = 1;
:: SFMASTR3:th 25
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
st b1 . intloc 0 = 1 & ProperForUpBody b2,b3,b4,b5,b1
for b6 being Element of NAT
st b6 <= ((b1 . b4) - (b1 . b3)) + 1
holds ((StepForUp(b2,b3,b4,b5,b1)) . b6) . intloc 0 = 1 &
(b5 does_not_destroy b2 implies ((StepForUp(b2,b3,b4,b5,b1)) . b6) . b2 = b6 + (b1 . b3) &
((StepForUp(b2,b3,b4,b5,b1)) . b6) . b2 <= (b1 . b4) + 1) &
(((StepForUp(b2,b3,b4,b5,b1)) . b6) . (1 -thRWNotIn ({b2,b3,b4} \/ UsedIntLoc b5))) + b6 = ((b1 . b4) - (b1 . b3)) + 1;
:: SFMASTR3:th 26
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
st b1 . intloc 0 = 1 & ProperForUpBody b2,b3,b4,b5,b1
for b6 being Element of NAT holds
0 < ((StepForUp(b2,b3,b4,b5,b1)) . b6) . (1 -thRWNotIn ({b2,b3,b4} \/ UsedIntLoc b5))
iff
b6 < ((b1 . b4) - (b1 . b3)) + 1;
:: SFMASTR3:th 27
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b6 being Element of NAT
st b1 . intloc 0 = 1 &
ProperForUpBody b2,b3,b4,b5,b1 &
b6 < ((b1 . b4) - (b1 . b3)) + 1
holds ((StepForUp(b2,b3,b4,b5,b1)) . (b6 + 1)) | (({b2,b3,b4} \/ UsedIntLoc b5) \/ FinSeq-Locations) = (IExec(b5 ';' AddTo(b2,intloc 0),(StepForUp(b2,b3,b4,b5,b1)) . b6)) | (({b2,b3,b4} \/ UsedIntLoc b5) \/ FinSeq-Locations);
:: SFMASTR3:funcnot 2 => SFMASTR3:func 2
definition
let a1, a2, a3 be Int-Location;
let a4 be finite programmed initial Element of sproduct the Object-Kind of SCM+FSA;
func for-up(A1,A2,A3,A4) -> finite programmed initial Element of sproduct the Object-Kind of SCM+FSA equals
(((((1 -thRWNotIn ({a1,a2,a3} \/ UsedIntLoc a4)) := a3) ';' SubFrom(1 -thRWNotIn ({a1,a2,a3} \/ UsedIntLoc a4),a2)) ';' AddTo(1 -thRWNotIn ({a1,a2,a3} \/ UsedIntLoc a4),intloc 0)) ';' (a1 := a2)) ';' while>0(1 -thRWNotIn ({a1,a2,a3} \/ UsedIntLoc a4),(a4 ';' AddTo(a1,intloc 0)) ';' SubFrom(1 -thRWNotIn ({a1,a2,a3} \/ UsedIntLoc a4),intloc 0));
end;
:: SFMASTR3:def 8
theorem
for b1, b2, b3 being Int-Location
for b4 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
for-up(b1,b2,b3,b4) = (((((1 -thRWNotIn ({b1,b2,b3} \/ UsedIntLoc b4)) := b3) ';' SubFrom(1 -thRWNotIn ({b1,b2,b3} \/ UsedIntLoc b4),b2)) ';' AddTo(1 -thRWNotIn ({b1,b2,b3} \/ UsedIntLoc b4),intloc 0)) ';' (b1 := b2)) ';' while>0(1 -thRWNotIn ({b1,b2,b3} \/ UsedIntLoc b4),(b4 ';' AddTo(b1,intloc 0)) ';' SubFrom(1 -thRWNotIn ({b1,b2,b3} \/ UsedIntLoc b4),intloc 0));
:: SFMASTR3:th 28
theorem
for b1, b2, b3 being Int-Location
for b4 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA holds
{b1,b2,b3} \/ UsedIntLoc b4 c= UsedIntLoc for-up(b1,b2,b3,b4);
:: SFMASTR3:funcreg 2
registration
let a1 be read-write Int-Location;
let a2, a3 be Int-Location;
let a4 be finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA;
cluster for-up(a1,a2,a3,a4) -> finite programmed initial good;
end;
:: SFMASTR3:th 29
theorem
for b1 being read-write Int-Location
for b2, b3, b4 being Int-Location
for b5 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
st b1 <> b2 &
b2 <> 1 -thRWNotIn ({b1,b3,b4} \/ UsedIntLoc b5) &
b5 does_not_destroy b2
holds for-up(b1,b3,b4,b5) does_not_destroy b2;
:: SFMASTR3:th 30
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial Element of sproduct the Object-Kind of SCM+FSA
st b1 . intloc 0 = 1 & b1 . b4 < b1 . b3
holds (for b6 being Int-Location
st b6 <> b2 & b6 in {b3,b4} \/ UsedIntLoc b5
holds (IExec(for-up(b2,b3,b4,b5),b1)) . b6 = b1 . b6) &
(for b6 being FinSeq-Location holds
(IExec(for-up(b2,b3,b4,b5),b1)) . b6 = b1 . b6);
:: SFMASTR3:th 31
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
for b6 being Element of NAT
st b1 . intloc 0 = 1 &
b6 = ((b1 . b3) - (b1 . b4)) + 1 &
(ProperForUpBody b2,b4,b3,b5,b1 or b5 is parahalting)
holds (IExec(for-up(b2,b4,b3,b5),b1)) | (Int-Locations \/ FinSeq-Locations) = ((StepForUp(b2,b4,b3,b5,b1)) . b6) | (Int-Locations \/ FinSeq-Locations);
:: SFMASTR3:th 32
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being finite programmed initial good Element of sproduct the Object-Kind of SCM+FSA
st b1 . intloc 0 = 1 & (ProperForUpBody b2,b3,b4,b5,b1 or b5 is parahalting)
holds for-up(b2,b3,b4,b5) is_closed_on b1 & for-up(b2,b3,b4,b5) is_halting_on b1;
:: SFMASTR3:funcnot 3 => SFMASTR3:func 3
definition
let a1, a2, a3 be Int-Location;
let a4 be FinSeq-Location;
func FinSeqMin(A4,A1,A2,A3) -> finite programmed initial Element of sproduct the Object-Kind of SCM+FSA equals
(a3 := a1) ';' for-up(3 -thRWNotIn {a1,a2,a3},a1,a2,(((1 -thRWNotIn {a1,a2,a3}) :=(a4,3 -thRWNotIn {a1,a2,a3})) ';' ((2 -thRWNotIn {a1,a2,a3}) :=(a4,a3))) ';' if>0(2 -thRWNotIn {a1,a2,a3},1 -thRWNotIn {a1,a2,a3},Macro (a3 := (3 -thRWNotIn {a1,a2,a3})),SCM+FSA-Stop));
end;
:: SFMASTR3:def 9
theorem
for b1, b2, b3 being Int-Location
for b4 being FinSeq-Location holds
FinSeqMin(b4,b1,b2,b3) = (b3 := b1) ';' for-up(3 -thRWNotIn {b1,b2,b3},b1,b2,(((1 -thRWNotIn {b1,b2,b3}) :=(b4,3 -thRWNotIn {b1,b2,b3})) ';' ((2 -thRWNotIn {b1,b2,b3}) :=(b4,b3))) ';' if>0(2 -thRWNotIn {b1,b2,b3},1 -thRWNotIn {b1,b2,b3},Macro (b3 := (3 -thRWNotIn {b1,b2,b3})),SCM+FSA-Stop));
:: SFMASTR3:funcreg 3
registration
let a1, a2 be Int-Location;
let a3 be read-write Int-Location;
let a4 be FinSeq-Location;
cluster FinSeqMin(a4,a1,a2,a3) -> finite programmed initial good;
end;
:: SFMASTR3:th 33
theorem
for b1 being read-write Int-Location
for b2, b3 being Int-Location
for b4 being FinSeq-Location
st b1 <> b2
holds FinSeqMin(b4,b2,b3,b1) does_not_destroy b2;
:: SFMASTR3:th 34
theorem
for b1 being read-write Int-Location
for b2, b3 being Int-Location
for b4 being FinSeq-Location holds
{b2,b3,b1} c= UsedIntLoc FinSeqMin(b4,b2,b3,b1);
:: SFMASTR3:th 35
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being FinSeq-Location
st b1 . intloc 0 = 1
holds FinSeqMin(b5,b3,b4,b2) is_closed_on b1 & FinSeqMin(b5,b3,b4,b2) is_halting_on b1;
:: SFMASTR3:th 36
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being FinSeq-Location
st b3 <> b2 & b4 <> b2 & b1 . intloc 0 = 1
holds (IExec(FinSeqMin(b5,b3,b4,b2),b1)) . b5 = b1 . b5 &
(IExec(FinSeqMin(b5,b3,b4,b2),b1)) . b3 = b1 . b3 &
(IExec(FinSeqMin(b5,b3,b4,b2),b1)) . b4 = b1 . b4;
:: SFMASTR3:th 37
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being read-write Int-Location
for b3, b4 being Int-Location
for b5 being FinSeq-Location
st 1 <= b1 . b3 & b1 . b3 <= b1 . b4 & b1 . b4 <= len (b1 . b5) & b3 <> b2 & b4 <> b2 & b1 . intloc 0 = 1
holds (IExec(FinSeqMin(b5,b3,b4,b2),b1)) . b2 = min_at(b1 . b5,abs (b1 . b3),abs (b1 . b4));
:: SFMASTR3:funcnot 4 => SFMASTR3:func 4
definition
let a1 be FinSeq-Location;
let a2, a3 be Int-Location;
func swap(A1,A2,A3) -> finite programmed initial Element of sproduct the Object-Kind of SCM+FSA equals
((((1 -thRWNotIn {a2,a3}) :=(a1,a2)) ';' ((2 -thRWNotIn {a2,a3}) :=(a1,a3))) ';' ((a1,a2):= (2 -thRWNotIn {a2,a3}))) ';' ((a1,a3):= (1 -thRWNotIn {a2,a3}));
end;
:: SFMASTR3:def 10
theorem
for b1 being FinSeq-Location
for b2, b3 being Int-Location holds
swap(b1,b2,b3) = ((((1 -thRWNotIn {b2,b3}) :=(b1,b2)) ';' ((2 -thRWNotIn {b2,b3}) :=(b1,b3))) ';' ((b1,b2):= (2 -thRWNotIn {b2,b3}))) ';' ((b1,b3):= (1 -thRWNotIn {b2,b3}));
:: SFMASTR3:funcreg 4
registration
let a1 be FinSeq-Location;
let a2, a3 be Int-Location;
cluster swap(a1,a2,a3) -> finite programmed initial parahalting good;
end;
:: SFMASTR3:th 38
theorem
for b1, b2, b3 being Int-Location
for b4 being FinSeq-Location
st b1 <> 1 -thRWNotIn {b2,b3} & b1 <> 2 -thRWNotIn {b2,b3}
holds swap(b4,b2,b3) does_not_destroy b1;
:: SFMASTR3:th 39
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2, b3 being Int-Location
for b4 being FinSeq-Location
st 1 <= b1 . b2 & b1 . b2 <= len (b1 . b4) & 1 <= b1 . b3 & b1 . b3 <= len (b1 . b4) & b1 . intloc 0 = 1
holds (IExec(swap(b4,b2,b3),b1)) . b4 = ((b1 . b4) +*(b1 . b2,(b1 . b4) . (b1 . b3))) +*(b1 . b3,(b1 . b4) . (b1 . b2));
:: SFMASTR3:th 40
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2, b3 being Int-Location
for b4 being FinSeq-Location
st 1 <= b1 . b2 & b1 . b2 <= len (b1 . b4) & 1 <= b1 . b3 & b1 . b3 <= len (b1 . b4) & b1 . intloc 0 = 1
holds ((IExec(swap(b4,b2,b3),b1)) . b4) . (b1 . b2) = (b1 . b4) . (b1 . b3) &
((IExec(swap(b4,b2,b3),b1)) . b4) . (b1 . b3) = (b1 . b4) . (b1 . b2);
:: SFMASTR3:th 41
theorem
for b1, b2 being Int-Location
for b3 being FinSeq-Location holds
{b1,b2} c= UsedIntLoc swap(b3,b1,b2);
:: SFMASTR3:th 42
theorem
for b1, b2 being Int-Location
for b3 being FinSeq-Location holds
UsedInt*Loc swap(b3,b1,b2) = {b3};
:: SFMASTR3:funcnot 5 => SFMASTR3:func 5
definition
let a1 be FinSeq-Location;
func Selection-sort A1 -> finite programmed initial Element of sproduct the Object-Kind of SCM+FSA equals
((1 -thNotUsed swap(a1,1 -thRWNotIn {} Int-Locations,2 -thRWNotIn {} Int-Locations)) :=len a1) ';' for-up(1 -thRWNotIn {} Int-Locations,intloc 0,1 -thNotUsed swap(a1,1 -thRWNotIn {} Int-Locations,2 -thRWNotIn {} Int-Locations),(FinSeqMin(a1,1 -thRWNotIn {} Int-Locations,1 -thNotUsed swap(a1,1 -thRWNotIn {} Int-Locations,2 -thRWNotIn {} Int-Locations),2 -thRWNotIn {} Int-Locations)) ';' swap(a1,1 -thRWNotIn {} Int-Locations,2 -thRWNotIn {} Int-Locations));
end;
:: SFMASTR3:def 11
theorem
for b1 being FinSeq-Location holds
Selection-sort b1 = ((1 -thNotUsed swap(b1,1 -thRWNotIn {} Int-Locations,2 -thRWNotIn {} Int-Locations)) :=len b1) ';' for-up(1 -thRWNotIn {} Int-Locations,intloc 0,1 -thNotUsed swap(b1,1 -thRWNotIn {} Int-Locations,2 -thRWNotIn {} Int-Locations),(FinSeqMin(b1,1 -thRWNotIn {} Int-Locations,1 -thNotUsed swap(b1,1 -thRWNotIn {} Int-Locations,2 -thRWNotIn {} Int-Locations),2 -thRWNotIn {} Int-Locations)) ';' swap(b1,1 -thRWNotIn {} Int-Locations,2 -thRWNotIn {} Int-Locations));
:: SFMASTR3:th 43
theorem
for b1 being Element of product the Object-Kind of SCM+FSA
for b2 being FinSeq-Location
for b3 being Element of product the Object-Kind of SCM+FSA
st b3 = IExec(Selection-sort b2,b1)
holds b3 . b2 is_non_decreasing_on 1,len (b3 . b2) &
(ex b4 being Function-like quasi_total bijective Relation of dom (b1 . b2),dom (b1 . b2) st
b3 . b2 = (b1 . b2) * b4);