:: SCMBSORT semantic presentation

theorem Th1: :: SCMBSORT:1
canceled;

theorem Th2: :: SCMBSORT:2
canceled;

theorem Th3: :: SCMBSORT:3
for b1 being Macro-Instruction
for b2, b3 being Int-Location st b1 does_not_destroy b3 & b2 <> b3 holds
Times b2,b1 does_not_destroy b3
proof end;

theorem Th4: :: SCMBSORT:4
for b1 being Function
for b2, b3, b4, b5 being set holds ((b1 +* (b2 .--> b3)) +* (b5 .--> b4)) . b5 = b4
proof end;

theorem Th5: :: SCMBSORT:5
for b1 being Function
for b2, b3 being set holds ((b1 +* (b2 .--> b3)) +* (b3 .--> b2)) . b2 = b3
proof end;

theorem Th6: :: SCMBSORT:6
for b1 being Function
for b2, b3, b4, b5, b6 being set st b6 <> b5 & b6 <> b2 holds
((b1 +* (b2 .--> b3)) +* (b5 .--> b4)) . b6 = b1 . b6
proof end;

theorem Th7: :: SCMBSORT:7
for b1, b2 being Function
for b3, b4 being set st b1 . b3 = b2 . b4 & b1 . b4 = b2 . b3 & b3 in dom b1 & b4 in dom b1 & dom b1 = dom b2 & ( for b5 being set st b5 <> b3 & b5 <> b4 & b5 in dom b1 holds
b1 . b5 = b2 . b5 ) holds
b1,b2 are_fiberwise_equipotent
proof end;

theorem Th8: :: SCMBSORT:8
for b1 being State of SCM+FSA
for b2 being FinSeq-Location
for b3, b4 being Int-Location holds (Exec (b4 := b2,b3),b1) . b4 = (b1 . b2) /. (abs (b1 . b3))
proof end;

theorem Th9: :: SCMBSORT:9
for b1 being State of SCM+FSA
for b2 being FinSeq-Location
for b3, b4 being Int-Location holds (Exec (b2,b3 := b4),b1) . b2 = (b1 . b2) +* (abs (b1 . b3)),(b1 . b4)
proof end;

theorem Th10: :: SCMBSORT:10
for b1 being State of SCM+FSA
for b2 being FinSeq-Location
for b3, b4 being Nat
for b5 being Int-Location st b3 <> b4 + 1 holds
(Exec ((intloc b3) := b2,b5),(Initialize b1)) . (intloc (b4 + 1)) = b1 . (intloc (b4 + 1))
proof end;

theorem Th11: :: SCMBSORT:11
for b1 being State of SCM+FSA
for b2, b3 being Nat
for b4 being Int-Location st b2 <> b3 + 1 holds
(Exec ((intloc b2) := b4),(Initialize b1)) . (intloc (b3 + 1)) = b1 . (intloc (b3 + 1))
proof end;

theorem Th12: :: SCMBSORT:12
for b1 being State of SCM+FSA
for b2 being FinSeq-Location
for b3 being read-write Int-Location holds
( (IExec SCM+FSA-Stop ,b1) . b3 = b1 . b3 & (IExec SCM+FSA-Stop ,b1) . b2 = b1 . b2 )
proof end;

theorem Th13: :: SCMBSORT:13
for b1 being natural number holds
( not b1 <= 10 or b1 = 0 or b1 = 1 or b1 = 2 or b1 = 3 or b1 = 4 or b1 = 5 or b1 = 6 or b1 = 7 or b1 = 8 or b1 = 9 or b1 = 10 )
proof end;

theorem Th14: :: SCMBSORT:14
for b1 being natural number holds
( not b1 <= 12 or b1 = 0 or b1 = 1 or b1 = 2 or b1 = 3 or b1 = 4 or b1 = 5 or b1 = 6 or b1 = 7 or b1 = 8 or b1 = 9 or b1 = 10 or b1 = 11 or b1 = 12 )
proof end;

theorem Th15: :: SCMBSORT:15
for b1, b2 being Function
for b3 being set st dom b1 = dom b2 & ( for b4 being set st b4 in b3 holds
b1 . b4 = b2 . b4 ) holds
b1 | b3 = b2 | b3
proof end;

theorem Th16: :: SCMBSORT:16
for b1 being programmed FinPartState of SCM+FSA
for b2 being Instruction of SCM+FSA
for b3, b4 being Int-Location st b2 in rng b1 & ( b2 = b3 := b4 or b2 = AddTo b3,b4 or b2 = SubFrom b3,b4 or b2 = MultBy b3,b4 or b2 = Divide b3,b4 ) holds
( b3 in UsedIntLoc b1 & b4 in UsedIntLoc b1 )
proof end;

theorem Th17: :: SCMBSORT:17
for b1 being programmed FinPartState of SCM+FSA
for b2 being Instruction of SCM+FSA
for b3 being Int-Location
for b4 being Instruction-Location of SCM+FSA st b2 in rng b1 & ( b2 = b3 =0_goto b4 or b2 = b3 >0_goto b4 ) holds
b3 in UsedIntLoc b1
proof end;

theorem Th18: :: SCMBSORT:18
for b1 being programmed FinPartState of SCM+FSA
for b2 being Instruction of SCM+FSA
for b3 being FinSeq-Location
for b4, b5 being Int-Location st b2 in rng b1 & ( b2 = b4 := b3,b5 or b2 = b3,b5 := b4 ) holds
( b5 in UsedIntLoc b1 & b4 in UsedIntLoc b1 )
proof end;

theorem Th19: :: SCMBSORT:19
for b1 being programmed FinPartState of SCM+FSA
for b2 being Instruction of SCM+FSA
for b3 being FinSeq-Location
for b4, b5 being Int-Location st b2 in rng b1 & ( b2 = b4 := b3,b5 or b2 = b3,b5 := b4 ) holds
b3 in UsedInt*Loc b1
proof end;

theorem Th20: :: SCMBSORT:20
for b1 being programmed FinPartState of SCM+FSA
for b2 being Instruction of SCM+FSA
for b3 being FinSeq-Location
for b4 being Int-Location st b2 in rng b1 & ( b2 = b4 :=len b3 or b2 = b3 :=<0,...,0> b4 ) holds
b4 in UsedIntLoc b1
proof end;

theorem Th21: :: SCMBSORT:21
for b1 being programmed FinPartState of SCM+FSA
for b2 being Instruction of SCM+FSA
for b3 being FinSeq-Location
for b4 being Int-Location st b2 in rng b1 & ( b2 = b4 :=len b3 or b2 = b3 :=<0,...,0> b4 ) holds
b3 in UsedInt*Loc b1
proof end;

theorem Th22: :: SCMBSORT:22
for b1 being Nat
for b2 being with_non-empty_elements set
for b3 being non empty non void IC-Ins-separated steady-programmed definite AMI-Struct of b2
for b4 being programmed FinPartState of b3
for b5, b6 being State of b3 st b4 c= b5 & b4 c= b6 holds
((Computation b5) . b1) | (dom b4) = ((Computation b6) . b1) | (dom b4)
proof end;

theorem Th23: :: SCMBSORT:23
for b1 being FinPartState of SCM+FSA
for b2 being Macro-Instruction
for b3 being set st dom b1 c= Int-Locations \/ FinSeq-Locations & b3 in ((dom b1) \/ (UsedInt*Loc b2)) \/ (UsedIntLoc b2) & b3 is not Int-Location holds
b3 is FinSeq-Location
proof end;

theorem Th24: :: SCMBSORT:24
canceled;

theorem Th25: :: SCMBSORT:25
for b1, b2 being Nat
for b3 being FinPartState of SCM+FSA
for b4 being Macro-Instruction
for b5, b6 being State of SCM+FSA st b2 <= b1 & b4 c= b5 & b4 c= b6 & dom b3 c= Int-Locations \/ FinSeq-Locations & ( for b7 being Nat holds
( IC ((Computation b5) . b7) in dom b4 & IC ((Computation b6) . b7) in dom b4 ) ) & ((Computation b5) . b2) . (IC SCM+FSA ) = ((Computation b6) . b2) . (IC SCM+FSA ) & ((Computation b5) . b2) | (((dom b3) \/ (UsedInt*Loc b4)) \/ (UsedIntLoc b4)) = ((Computation b6) . b2) | (((dom b3) \/ (UsedInt*Loc b4)) \/ (UsedIntLoc b4)) holds
( ((Computation b5) . b1) . (IC SCM+FSA ) = ((Computation b6) . b1) . (IC SCM+FSA ) & ((Computation b5) . b1) | (((dom b3) \/ (UsedInt*Loc b4)) \/ (UsedIntLoc b4)) = ((Computation b6) . b1) | (((dom b3) \/ (UsedInt*Loc b4)) \/ (UsedIntLoc b4)) )
proof end;

theorem Th26: :: SCMBSORT:26
for b1, b2 being Nat
for b3 being Macro-Instruction
for b4, b5 being State of SCM+FSA st b2 <= b1 & b3 c= b4 & b3 c= b5 & ( for b6 being Nat holds
( IC ((Computation b4) . b6) in dom b3 & IC ((Computation b5) . b6) in dom b3 ) ) & ((Computation b4) . b2) . (IC SCM+FSA ) = ((Computation b5) . b2) . (IC SCM+FSA ) & ((Computation b4) . b2) | ((UsedInt*Loc b3) \/ (UsedIntLoc b3)) = ((Computation b5) . b2) | ((UsedInt*Loc b3) \/ (UsedIntLoc b3)) holds
( ((Computation b4) . b1) . (IC SCM+FSA ) = ((Computation b5) . b1) . (IC SCM+FSA ) & ((Computation b4) . b1) | ((UsedInt*Loc b3) \/ (UsedIntLoc b3)) = ((Computation b5) . b1) | ((UsedInt*Loc b3) \/ (UsedIntLoc b3)) )
proof end;

theorem Th27: :: SCMBSORT:27
canceled;

theorem Th28: :: SCMBSORT:28
canceled;

theorem Th29: :: SCMBSORT:29
for b1, b2 being Macro-Instruction
for b3 being Int-Location holds
( UsedIntLoc (if=0 b3,b1,b2) = ({b3} \/ (UsedIntLoc b1)) \/ (UsedIntLoc b2) & UsedIntLoc (if>0 b3,b1,b2) = ({b3} \/ (UsedIntLoc b1)) \/ (UsedIntLoc b2) )
proof end;

theorem Th30: :: SCMBSORT:30
for b1 being Macro-Instruction
for b2 being Instruction-Location of SCM+FSA holds UsedIntLoc (Directed b1,b2) = UsedIntLoc b1
proof end;

theorem Th31: :: SCMBSORT:31
for b1 being Int-Location
for b2 being Macro-Instruction holds UsedIntLoc (Times b1,b2) = (UsedIntLoc b2) \/ {b1,(intloc 0)}
proof end;

theorem Th32: :: SCMBSORT:32
for b1, b2, b3 being set holds {b2,b1} \/ {b3,b1} = {b1,b2,b3}
proof end;

theorem Th33: :: SCMBSORT:33
canceled;

theorem Th34: :: SCMBSORT:34
canceled;

theorem Th35: :: SCMBSORT:35
for b1, b2 being Macro-Instruction
for b3 being Int-Location holds
( UsedInt*Loc (if=0 b3,b1,b2) = (UsedInt*Loc b1) \/ (UsedInt*Loc b2) & UsedInt*Loc (if>0 b3,b1,b2) = (UsedInt*Loc b1) \/ (UsedInt*Loc b2) ) by SCMFSA9A:14, SCMFSA9A:16;

theorem Th36: :: SCMBSORT:36
for b1 being Macro-Instruction
for b2 being Instruction-Location of SCM+FSA holds UsedInt*Loc (Directed b1,b2) = UsedInt*Loc b1
proof end;

theorem Th37: :: SCMBSORT:37
for b1 being Int-Location
for b2 being Macro-Instruction holds UsedInt*Loc (Times b1,b2) = UsedInt*Loc b2
proof end;

definition
let c1 be FinSeq-Location ;
let c2 be FinSequence of INT ;
redefine func .--> as c1 .--> c2 -> FinPartState of SCM+FSA ;
coherence
c1 .--> c2 is FinPartState of SCM+FSA
proof end;
end;

theorem Th38: :: SCMBSORT:38
for b1 being FinSequence of INT holds b1 is FinSequence of REAL
proof end;

theorem Th39: :: SCMBSORT:39
for b1 being FinSequence of INT ex b2 being FinSequence of REAL st
( b1,b2 are_fiberwise_equipotent & b2 is FinSequence of INT & b2 is non-increasing )
proof end;

theorem Th40: :: SCMBSORT:40
dom (((intloc 0) .--> 1) +* (Start-At (insloc 0))) = {(intloc 0),(IC SCM+FSA )}
proof end;

theorem Th41: :: SCMBSORT:41
for b1 being Macro-Instruction holds dom (Initialized b1) = (dom b1) \/ {(intloc 0),(IC SCM+FSA )}
proof end;

theorem Th42: :: SCMBSORT:42
for b1 being FinSequence of INT
for b2 being FinSeq-Location
for b3 being Macro-Instruction holds dom ((Initialized b3) +* (b2 .--> b1)) = (dom b3) \/ {(intloc 0),(IC SCM+FSA ),b2}
proof end;

theorem Th43: :: SCMBSORT:43
for b1 being Instruction-Location of SCM+FSA holds IC SCM+FSA <> b1
proof end;

theorem Th44: :: SCMBSORT:44
for b1 being Int-Location
for b2 being Macro-Instruction holds card (Times b1,b2) = (card b2) + 12
proof end;

theorem Th45: :: SCMBSORT:45
for b1, b2, b3 being Instruction of SCM+FSA holds card ((b1 ';' b2) ';' b3) = 6
proof end;

theorem Th46: :: SCMBSORT:46
for b1 being FinSequence of INT
for b2 being FinSeq-Location
for b3 being Macro-Instruction holds dom (Initialized b3) misses dom (b2 .--> b1)
proof end;

theorem Th47: :: SCMBSORT:47
for b1 being FinSequence of INT
for b2 being FinSeq-Location
for b3 being Macro-Instruction holds (Initialized b3) +* (b2 .--> b1) starts_at insloc 0
proof end;

theorem Th48: :: SCMBSORT:48
for b1, b2 being Macro-Instruction
for b3 being Nat
for b4 being Instruction of SCM+FSA st b3 < card b2 & b4 = b2 . (insloc b3) holds
(b1 ';' b2) . (insloc ((card b1) + b3)) = IncAddr b4,(card b1)
proof end;

theorem Th49: :: SCMBSORT:49
for b1 being Instruction of SCM+FSA
for b2 being FinSeq-Location
for b3, b4 being Int-Location
for b5 being Instruction-Location of SCM+FSA st ( b1 = b3 := b4 or b1 = AddTo b3,b4 or b1 = SubFrom b3,b4 or b1 = MultBy b3,b4 or b1 = Divide b3,b4 or b1 = goto b5 or b1 = b3 =0_goto b5 or b1 = b3 >0_goto b5 or b1 = b4 := b2,b3 or b1 = b2,b3 := b4 or b1 = b3 :=len b2 or b1 = b2 :=<0,...,0> b3 ) holds
b1 <> halt SCM+FSA by SCMFSA_2:42, SCMFSA_2:43, SCMFSA_2:44, SCMFSA_2:45, SCMFSA_2:46, SCMFSA_2:47, SCMFSA_2:48, SCMFSA_2:49, SCMFSA_2:50, SCMFSA_2:51, SCMFSA_2:52, SCMFSA_2:53, SCMFSA_2:124;

theorem Th50: :: SCMBSORT:50
for b1, b2 being Macro-Instruction
for b3 being Nat
for b4 being Instruction of SCM+FSA st ( for b5 being Nat holds IncAddr b4,b5 = b4 ) & b4 <> halt SCM+FSA & b3 = card b1 holds
( ((b1 ';' b4) ';' b2) . (insloc b3) = b4 & ((b1 ';' b4) ';' b2) . (insloc (b3 + 1)) = goto (insloc ((card b1) + 2)) )
proof end;

theorem Th51: :: SCMBSORT:51
for b1, b2 being Int-Location
for b3, b4 being Macro-Instruction
for b5 being Nat st b5 = card b3 holds
( ((b3 ';' (b1 := b2)) ';' b4) . (insloc b5) = b1 := b2 & ((b3 ';' (b1 := b2)) ';' b4) . (insloc (b5 + 1)) = goto (insloc ((card b3) + 2)) )
proof end;

theorem Th52: :: SCMBSORT:52
for b1 being FinSeq-Location
for b2 being Int-Location
for b3, b4 being Macro-Instruction
for b5 being Nat st b5 = card b3 holds
( ((b3 ';' (b2 :=len b1)) ';' b4) . (insloc b5) = b2 :=len b1 & ((b3 ';' (b2 :=len b1)) ';' b4) . (insloc (b5 + 1)) = goto (insloc ((card b3) + 2)) )
proof end;

theorem Th53: :: SCMBSORT:53
for b1 being FinSequence of INT
for b2 being FinSeq-Location
for b3 being State of SCM+FSA
for b4 being Macro-Instruction st (Initialized b4) +* (b2 .--> b1) c= b3 holds
b4 c= b3
proof end;

theorem Th54: :: SCMBSORT:54
for b1 being FinSequence of INT
for b2 being FinSeq-Location
for b3 being State of SCM+FSA
for b4 being Macro-Instruction st (Initialized b4) +* (b2 .--> b1) c= b3 holds
( b3 . b2 = b1 & b3 . (intloc 0) = 1 )
proof end;

theorem Th55: :: SCMBSORT:55
for b1 being FinSeq-Location
for b2 being Int-Location
for b3 being State of SCM+FSA holds {b2,(IC SCM+FSA ),b1} c= dom b3
proof end;

theorem Th56: :: SCMBSORT:56
for b1 being Macro-Instruction
for b2 being State of SCM+FSA holds (UsedInt*Loc b1) \/ (UsedIntLoc b1) c= dom b2
proof end;

theorem Th57: :: SCMBSORT:57
for b1 being State of SCM+FSA
for b2 being Macro-Instruction
for b3 being FinSeq-Location holds (Result (b1 +* (Initialized b2))) . b3 = (IExec b2,b1) . b3
proof end;

set c1 = intloc 0;

set c2 = intloc 1;

set c3 = intloc 2;

set c4 = intloc 3;

set c5 = intloc 4;

set c6 = intloc 5;

set c7 = intloc 6;

set c8 = (((((intloc 2) := (intloc 0)) ';' ((intloc 3) := (intloc 0))) ';' ((intloc 4) := (intloc 0))) ';' ((intloc 5) := (intloc 0))) ';' ((intloc 6) := (intloc 0));

definition
let c9 be FinSeq-Location ;
func bubble-sort c1 -> Macro-Instruction means :Def1: :: SCMBSORT:def 1
a2 = (((((((intloc 2) := (intloc 0)) ';' ((intloc 3) := (intloc 0))) ';' ((intloc 4) := (intloc 0))) ';' ((intloc 5) := (intloc 0))) ';' ((intloc 6) := (intloc 0))) ';' ((intloc 1) :=len a1)) ';' (Times (intloc 1),(((((intloc 2) := (intloc 1)) ';' (SubFrom (intloc 2),(intloc 0))) ';' ((intloc 3) :=len a1)) ';' (Times (intloc 2),(((((((intloc 4) := (intloc 3)) ';' (SubFrom (intloc 3),(intloc 0))) ';' ((intloc 5) := a1,(intloc 3))) ';' ((intloc 6) := a1,(intloc 4))) ';' (SubFrom (intloc 6),(intloc 5))) ';' (if>0 (intloc 6),((((intloc 6) := a1,(intloc 4)) ';' (a1,(intloc 3) := (intloc 6))) ';' (a1,(intloc 4) := (intloc 5))),SCM+FSA-Stop )))));
correctness
existence
ex b1 being Macro-Instruction st b1 = (((((((intloc 2) := (intloc 0)) ';' ((intloc 3) := (intloc 0))) ';' ((intloc 4) := (intloc 0))) ';' ((intloc 5) := (intloc 0))) ';' ((intloc 6) := (intloc 0))) ';' ((intloc 1) :=len c9)) ';' (Times (intloc 1),(((((intloc 2) := (intloc 1)) ';' (SubFrom (intloc 2),(intloc 0))) ';' ((intloc 3) :=len c9)) ';' (Times (intloc 2),(((((((intloc 4) := (intloc 3)) ';' (SubFrom (intloc 3),(intloc 0))) ';' ((intloc 5) := c9,(intloc 3))) ';' ((intloc 6) := c9,(intloc 4))) ';' (SubFrom (intloc 6),(intloc 5))) ';' (if>0 (intloc 6),((((intloc 6) := c9,(intloc 4)) ';' (c9,(intloc 3) := (intloc 6))) ';' (c9,(intloc 4) := (intloc 5))),SCM+FSA-Stop )))))
;
uniqueness
for b1, b2 being Macro-Instruction st b1 = (((((((intloc 2) := (intloc 0)) ';' ((intloc 3) := (intloc 0))) ';' ((intloc 4) := (intloc 0))) ';' ((intloc 5) := (intloc 0))) ';' ((intloc 6) := (intloc 0))) ';' ((intloc 1) :=len c9)) ';' (Times (intloc 1),(((((intloc 2) := (intloc 1)) ';' (SubFrom (intloc 2),(intloc 0))) ';' ((intloc 3) :=len c9)) ';' (Times (intloc 2),(((((((intloc 4) := (intloc 3)) ';' (SubFrom (intloc 3),(intloc 0))) ';' ((intloc 5) := c9,(intloc 3))) ';' ((intloc 6) := c9,(intloc 4))) ';' (SubFrom (intloc 6),(intloc 5))) ';' (if>0 (intloc 6),((((intloc 6) := c9,(intloc 4)) ';' (c9,(intloc 3) := (intloc 6))) ';' (c9,(intloc 4) := (intloc 5))),SCM+FSA-Stop ))))) & b2 = (((((((intloc 2) := (intloc 0)) ';' ((intloc 3) := (intloc 0))) ';' ((intloc 4) := (intloc 0))) ';' ((intloc 5) := (intloc 0))) ';' ((intloc 6) := (intloc 0))) ';' ((intloc 1) :=len c9)) ';' (Times (intloc 1),(((((intloc 2) := (intloc 1)) ';' (SubFrom (intloc 2),(intloc 0))) ';' ((intloc 3) :=len c9)) ';' (Times (intloc 2),(((((((intloc 4) := (intloc 3)) ';' (SubFrom (intloc 3),(intloc 0))) ';' ((intloc 5) := c9,(intloc 3))) ';' ((intloc 6) := c9,(intloc 4))) ';' (SubFrom (intloc 6),(intloc 5))) ';' (if>0 (intloc 6),((((intloc 6) := c9,(intloc 4)) ';' (c9,(intloc 3) := (intloc 6))) ';' (c9,(intloc 4) := (intloc 5))),SCM+FSA-Stop ))))) holds
b1 = b2
;
;
end;

:: deftheorem Def1 defines bubble-sort SCMBSORT:def 1 :
for b1 being FinSeq-Location
for b2 being Macro-Instruction holds
( b2 = bubble-sort b1 iff b2 = (((((((intloc 2) := (intloc 0)) ';' ((intloc 3) := (intloc 0))) ';' ((intloc 4) := (intloc 0))) ';' ((intloc 5) := (intloc 0))) ';' ((intloc 6) := (intloc 0))) ';' ((intloc 1) :=len b1)) ';' (Times (intloc 1),(((((intloc 2) := (intloc 1)) ';' (SubFrom (intloc 2),(intloc 0))) ';' ((intloc 3) :=len b1)) ';' (Times (intloc 2),(((((((intloc 4) := (intloc 3)) ';' (SubFrom (intloc 3),(intloc 0))) ';' ((intloc 5) := b1,(intloc 3))) ';' ((intloc 6) := b1,(intloc 4))) ';' (SubFrom (intloc 6),(intloc 5))) ';' (if>0 (intloc 6),((((intloc 6) := b1,(intloc 4)) ';' (b1,(intloc 3) := (intloc 6))) ';' (b1,(intloc 4) := (intloc 5))),SCM+FSA-Stop ))))) );

definition
func Bubble-Sort-Algorithm -> Macro-Instruction means :Def2: :: SCMBSORT:def 2
a1 = bubble-sort (fsloc 0);
correctness
existence
ex b1 being Macro-Instruction st b1 = bubble-sort (fsloc 0)
;
uniqueness
for b1, b2 being Macro-Instruction st b1 = bubble-sort (fsloc 0) & b2 = bubble-sort (fsloc 0) holds
b1 = b2
;
;
end;

:: deftheorem Def2 defines Bubble-Sort-Algorithm SCMBSORT:def 2 :
for b1 being Macro-Instruction holds
( b1 = Bubble-Sort-Algorithm iff b1 = bubble-sort (fsloc 0) );

set c9 = intloc (0 + 1);

set c10 = intloc (1 + 1);

set c11 = intloc (2 + 1);

set c12 = intloc (3 + 1);

set c13 = intloc (4 + 1);

set c14 = intloc (5 + 1);

set c15 = fsloc 0;

set c16 = (intloc (3 + 1)) := (intloc (2 + 1));

set c17 = SubFrom (intloc (2 + 1)),(intloc 0);

set c18 = (intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1));

set c19 = (intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1));

set c20 = SubFrom (intloc (5 + 1)),(intloc (4 + 1));

set c21 = (fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1));

set c22 = (fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1));

set c23 = SCM+FSA-Stop ;

set c24 = if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ;

set c25 = ((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop );

set c26 = Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ));

set c27 = (intloc (1 + 1)) := (intloc (0 + 1));

set c28 = SubFrom (intloc (1 + 1)),(intloc 0);

set c29 = (intloc (2 + 1)) :=len (fsloc 0);

set c30 = (((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0));

set c31 = ((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))) ';' (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )));

set c32 = Times (intloc (0 + 1)),(((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))) ';' (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))));

set c33 = (intloc (1 + 1)) := (intloc 0);

set c34 = (intloc (2 + 1)) := (intloc 0);

set c35 = (intloc (3 + 1)) := (intloc 0);

set c36 = (intloc (4 + 1)) := (intloc 0);

set c37 = (intloc (5 + 1)) := (intloc 0);

set c38 = (intloc (0 + 1)) :=len (fsloc 0);

theorem Th58: :: SCMBSORT:58
for b1 being FinSeq-Location holds UsedIntLoc (bubble-sort b1) = {(intloc 0),(intloc 1),(intloc 2),(intloc 3),(intloc 4),(intloc 5),(intloc 6)}
proof end;

theorem Th59: :: SCMBSORT:59
for b1 being FinSeq-Location holds UsedInt*Loc (bubble-sort b1) = {b1}
proof end;

definition
func Sorting-Function -> PartFunc of FinPartSt SCM+FSA , FinPartSt SCM+FSA means :Def3: :: SCMBSORT:def 3
for b1, b2 being FinPartState of SCM+FSA holds
( [b1,b2] in a1 iff ex b3 being FinSequence of INT ex b4 being FinSequence of REAL st
( b3,b4 are_fiberwise_equipotent & b4 is FinSequence of INT & b4 is non-increasing & b1 = (fsloc 0) .--> b3 & b2 = (fsloc 0) .--> b4 ) );
existence
ex b1 being PartFunc of FinPartSt SCM+FSA , FinPartSt SCM+FSA st
for b2, b3 being FinPartState of SCM+FSA holds
( [b2,b3] in b1 iff ex b4 being FinSequence of INT ex b5 being FinSequence of REAL st
( b4,b5 are_fiberwise_equipotent & b5 is FinSequence of INT & b5 is non-increasing & b2 = (fsloc 0) .--> b4 & b3 = (fsloc 0) .--> b5 ) )
proof end;
uniqueness
for b1, b2 being PartFunc of FinPartSt SCM+FSA , FinPartSt SCM+FSA st ( for b3, b4 being FinPartState of SCM+FSA holds
( [b3,b4] in b1 iff ex b5 being FinSequence of INT ex b6 being FinSequence of REAL st
( b5,b6 are_fiberwise_equipotent & b6 is FinSequence of INT & b6 is non-increasing & b3 = (fsloc 0) .--> b5 & b4 = (fsloc 0) .--> b6 ) ) ) & ( for b3, b4 being FinPartState of SCM+FSA holds
( [b3,b4] in b2 iff ex b5 being FinSequence of INT ex b6 being FinSequence of REAL st
( b5,b6 are_fiberwise_equipotent & b6 is FinSequence of INT & b6 is non-increasing & b3 = (fsloc 0) .--> b5 & b4 = (fsloc 0) .--> b6 ) ) ) holds
b1 = b2
proof end;
end;

:: deftheorem Def3 defines Sorting-Function SCMBSORT:def 3 :
for b1 being PartFunc of FinPartSt SCM+FSA , FinPartSt SCM+FSA holds
( b1 = Sorting-Function iff for b2, b3 being FinPartState of SCM+FSA holds
( [b2,b3] in b1 iff ex b4 being FinSequence of INT ex b5 being FinSequence of REAL st
( b4,b5 are_fiberwise_equipotent & b5 is FinSequence of INT & b5 is non-increasing & b2 = (fsloc 0) .--> b4 & b3 = (fsloc 0) .--> b5 ) ) );

theorem Th60: :: SCMBSORT:60
for b1 being set holds
( b1 in dom Sorting-Function iff ex b2 being FinSequence of INT st b1 = (fsloc 0) .--> b2 )
proof end;

theorem Th61: :: SCMBSORT:61
for b1 being FinSequence of INT ex b2 being FinSequence of REAL st
( b1,b2 are_fiberwise_equipotent & b2 is non-increasing & b2 is FinSequence of INT & Sorting-Function . ((fsloc 0) .--> b1) = (fsloc 0) .--> b2 )
proof end;

theorem Th62: :: SCMBSORT:62
for b1 being FinSeq-Location holds card (bubble-sort b1) = 63
proof end;

theorem Th63: :: SCMBSORT:63
for b1 being FinSeq-Location
for b2 being Nat st b2 < 63 holds
insloc b2 in dom (bubble-sort b1)
proof end;

Lemma58: for b1 being State of SCM+FSA st Bubble-Sort-Algorithm c= b1 holds
( b1 . (insloc 0) = (intloc 2) := (intloc 0) & b1 . (insloc 1) = goto (insloc 2) & b1 . (insloc 2) = (intloc 3) := (intloc 0) & b1 . (insloc 3) = goto (insloc 4) & b1 . (insloc 4) = (intloc 4) := (intloc 0) & b1 . (insloc 5) = goto (insloc 6) & b1 . (insloc 6) = (intloc 5) := (intloc 0) & b1 . (insloc 7) = goto (insloc 8) & b1 . (insloc 8) = (intloc 6) := (intloc 0) & b1 . (insloc 9) = goto (insloc 10) & b1 . (insloc 10) = (intloc 1) :=len (fsloc 0) & b1 . (insloc 11) = goto (insloc 12) )
proof end;

Lemma59: for b1 being State of SCM+FSA st Bubble-Sort-Algorithm c= b1 & b1 starts_at insloc 0 holds
( ((Computation b1) . 1) . (IC SCM+FSA ) = insloc 1 & ((Computation b1) . 1) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 1) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 2) . (IC SCM+FSA ) = insloc 2 & ((Computation b1) . 2) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 2) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 3) . (IC SCM+FSA ) = insloc 3 & ((Computation b1) . 3) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 3) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 4) . (IC SCM+FSA ) = insloc 4 & ((Computation b1) . 4) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 4) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 5) . (IC SCM+FSA ) = insloc 5 & ((Computation b1) . 5) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 5) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 6) . (IC SCM+FSA ) = insloc 6 & ((Computation b1) . 6) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 6) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 7) . (IC SCM+FSA ) = insloc 7 & ((Computation b1) . 7) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 7) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 8) . (IC SCM+FSA ) = insloc 8 & ((Computation b1) . 8) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 8) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 9) . (IC SCM+FSA ) = insloc 9 & ((Computation b1) . 9) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 9) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 10) . (IC SCM+FSA ) = insloc 10 & ((Computation b1) . 10) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 10) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 11) . (IC SCM+FSA ) = insloc 11 & ((Computation b1) . 11) . (intloc 0) = b1 . (intloc 0) & ((Computation b1) . 11) . (fsloc 0) = b1 . (fsloc 0) & ((Computation b1) . 11) . (intloc 1) = len (b1 . (fsloc 0)) & ((Computation b1) . 11) . (intloc 2) = b1 . (intloc 0) & ((Computation b1) . 11) . (intloc 3) = b1 . (intloc 0) & ((Computation b1) . 11) . (intloc 4) = b1 . (intloc 0) & ((Computation b1) . 11) . (intloc 5) = b1 . (intloc 0) & ((Computation b1) . 11) . (intloc 6) = b1 . (intloc 0) )
proof end;

Lemma60: ((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ) does_not_destroy intloc (1 + 1)
proof end;

Lemma61: Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )) is good InitHalting Macro-Instruction
proof end;

Lemma62: ((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ) does_not_destroy intloc (0 + 1)
proof end;

Lemma63: ((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))) ';' (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))) does_not_destroy intloc (0 + 1)
proof end;

Lemma64: ((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))) ';' (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))) is good InitHalting Macro-Instruction
proof end;

Lemma65: Times (intloc (0 + 1)),(((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))) ';' (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )))) is good InitHalting Macro-Instruction
proof end;

theorem Th64: :: SCMBSORT:64
( bubble-sort (fsloc 0) is keepInt0_1 & bubble-sort (fsloc 0) is InitHalting )
proof end;

Lemma67: for b1 being State of SCM+FSA holds
( ( b1 . (intloc (5 + 1)) > 0 implies (IExec (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ),b1) . (fsloc 0) = ((b1 . (fsloc 0)) +* (abs (b1 . (intloc (2 + 1)))),((b1 . (fsloc 0)) /. (abs (b1 . (intloc (3 + 1)))))) +* (abs (b1 . (intloc (3 + 1)))),(b1 . (intloc (4 + 1))) ) & ( b1 . (intloc (5 + 1)) <= 0 implies (IExec (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ),b1) . (fsloc 0) = b1 . (fsloc 0) ) )
proof end;

Lemma68: for b1 being State of SCM+FSA holds (IExec (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ),b1) . (intloc (2 + 1)) = b1 . (intloc (2 + 1))
proof end;

Lemma69: for b1 being State of SCM+FSA st b1 . (intloc (2 + 1)) <= len (b1 . (fsloc 0)) & b1 . (intloc (2 + 1)) >= 2 holds
( (IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (intloc (2 + 1)) = (b1 . (intloc (2 + 1))) - 1 & b1 . (fsloc 0),(IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (fsloc 0) are_fiberwise_equipotent & ( (b1 . (fsloc 0)) . (b1 . (intloc (2 + 1))) = ((IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (fsloc 0)) . (b1 . (intloc (2 + 1))) or (b1 . (fsloc 0)) . (b1 . (intloc (2 + 1))) = ((IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (fsloc 0)) . ((b1 . (intloc (2 + 1))) - 1) ) & ( (b1 . (fsloc 0)) . (b1 . (intloc (2 + 1))) = ((IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (fsloc 0)) . (b1 . (intloc (2 + 1))) or (b1 . (fsloc 0)) . ((b1 . (intloc (2 + 1))) - 1) = ((IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (fsloc 0)) . (b1 . (intloc (2 + 1))) ) & ( (b1 . (fsloc 0)) . (b1 . (intloc (2 + 1))) = ((IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (fsloc 0)) . ((b1 . (intloc (2 + 1))) - 1) or (b1 . (fsloc 0)) . ((b1 . (intloc (2 + 1))) - 1) = ((IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (fsloc 0)) . ((b1 . (intloc (2 + 1))) - 1) ) & ( for b2 being set st b2 <> (b1 . (intloc (2 + 1))) - 1 & b2 <> b1 . (intloc (2 + 1)) & b2 in dom (b1 . (fsloc 0)) holds
(b1 . (fsloc 0)) . b2 = ((IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (fsloc 0)) . b2 ) & ex b2, b3 being Integer st
( b2 = ((IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (fsloc 0)) . ((b1 . (intloc (2 + 1))) - 1) & b3 = ((IExec (((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop )),b1) . (fsloc 0)) . (b1 . (intloc (2 + 1))) & b2 >= b3 ) )
proof end;

Lemma70: for b1 being State of SCM+FSA st b1 . (intloc (1 + 1)) >= 0 & b1 . (intloc (1 + 1)) < b1 . (intloc (2 + 1)) & b1 . (intloc (2 + 1)) <= len (b1 . (fsloc 0)) holds
ex b2 being Nat st
( b2 <= b1 . (intloc (2 + 1)) & b2 >= (b1 . (intloc (2 + 1))) - (b1 . (intloc (1 + 1))) & ((IExec (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))),b1) . (fsloc 0)) . b2 = (b1 . (fsloc 0)) . (b1 . (intloc (2 + 1))) )
proof end;

Lemma71: for b1 being Nat
for b2 being State of SCM+FSA st b1 = b2 . (intloc (1 + 1)) & b1 < b2 . (intloc (2 + 1)) & b2 . (intloc (2 + 1)) <= len (b2 . (fsloc 0)) holds
( b2 . (fsloc 0),(IExec (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))),b2) . (fsloc 0) are_fiberwise_equipotent & ( for b3 being Nat st ( ( b3 < (b2 . (intloc (2 + 1))) - b1 & b3 >= 1 ) or ( b3 > b2 . (intloc (2 + 1)) & b3 in dom (b2 . (fsloc 0)) ) ) holds
(b2 . (fsloc 0)) . b3 = ((IExec (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))),b2) . (fsloc 0)) . b3 ) & ( for b3 being Nat st b3 >= (b2 . (intloc (2 + 1))) - b1 & b3 <= b2 . (intloc (2 + 1)) holds
ex b4, b5 being Integer st
( b4 = ((IExec (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))),b2) . (fsloc 0)) . ((b2 . (intloc (2 + 1))) - b1) & b5 = ((IExec (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))),b2) . (fsloc 0)) . b3 & b4 >= b5 ) ) & ( for b3 being Nat st b3 >= (b2 . (intloc (2 + 1))) - b1 & b3 <= b2 . (intloc (2 + 1)) holds
ex b4 being Nat st
( b4 >= (b2 . (intloc (2 + 1))) - b1 & b4 <= b2 . (intloc (2 + 1)) & ((IExec (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))),b2) . (fsloc 0)) . b3 = (b2 . (fsloc 0)) . b4 ) ) )
proof end;

Lemma72: for b1 being State of SCM+FSA holds
( (IExec ((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))),b1) . (intloc (1 + 1)) = (b1 . (intloc (0 + 1))) - 1 & (IExec ((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))),b1) . (intloc (2 + 1)) = len (b1 . (fsloc 0)) & (IExec ((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))),b1) . (fsloc 0) = b1 . (fsloc 0) )
proof end;

Lemma73: for b1 being State of SCM+FSA st b1 . (intloc (0 + 1)) = len (b1 . (fsloc 0)) holds
( b1 . (fsloc 0),(IExec (Times (intloc (0 + 1)),(((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))) ';' (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))))),b1) . (fsloc 0) are_fiberwise_equipotent & ( for b2, b3 being Nat st b2 >= 1 & b3 <= len (b1 . (fsloc 0)) & b2 < b3 holds
for b4, b5 being Integer st b4 = ((IExec (Times (intloc (0 + 1)),(((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))) ';' (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))))),b1) . (fsloc 0)) . b2 & b5 = ((IExec (Times (intloc (0 + 1)),(((((intloc (1 + 1)) := (intloc (0 + 1))) ';' (SubFrom (intloc (1 + 1)),(intloc 0))) ';' ((intloc (2 + 1)) :=len (fsloc 0))) ';' (Times (intloc (1 + 1)),(((((((intloc (3 + 1)) := (intloc (2 + 1))) ';' (SubFrom (intloc (2 + 1)),(intloc 0))) ';' ((intloc (4 + 1)) := (fsloc 0),(intloc (2 + 1)))) ';' ((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1)))) ';' (SubFrom (intloc (5 + 1)),(intloc (4 + 1)))) ';' (if>0 (intloc (5 + 1)),((((intloc (5 + 1)) := (fsloc 0),(intloc (3 + 1))) ';' ((fsloc 0),(intloc (2 + 1)) := (intloc (5 + 1)))) ';' ((fsloc 0),(intloc (3 + 1)) := (intloc (4 + 1)))),SCM+FSA-Stop ))))),b1) . (fsloc 0)) . b3 holds
b4 >= b5 ) )
proof end;

theorem Th65: :: SCMBSORT:65
for b1 being State of SCM+FSA holds
( b1 . (fsloc 0),(IExec (bubble-sort (fsloc 0)),b1) . (fsloc 0) are_fiberwise_equipotent & ( for b2, b3 being Nat st b2 >= 1 & b3 <= len (b1 . (fsloc 0)) & b2 < b3 holds
for b4, b5 being Integer st b4 = ((IExec (bubble-sort (fsloc 0)),b1) . (fsloc 0)) . b2 & b5 = ((IExec (bubble-sort (fsloc 0)),b1) . (fsloc 0)) . b3 holds
b4 >= b5 ) )
proof end;

theorem Th66: :: SCMBSORT:66
for b1 being Nat
for b2 being State of SCM+FSA
for b3 being FinSequence of INT st (Initialized Bubble-Sort-Algorithm ) +* ((fsloc 0) .--> b3) c= b2 holds
IC ((Computation b2) . b1) in dom Bubble-Sort-Algorithm
proof end;

theorem Th67: :: SCMBSORT:67
for b1 being State of SCM+FSA
for b2 being FinSequence of INT st (Initialized Bubble-Sort-Algorithm ) +* ((fsloc 0) .--> b2) c= b1 holds
ex b3 being FinSequence of REAL st
( b2,b3 are_fiberwise_equipotent & b3 is non-increasing & b3 is FinSequence of INT & (Result b1) . (fsloc 0) = b3 )
proof end;

theorem Th68: :: SCMBSORT:68
for b1 being FinSequence of INT holds (Initialized Bubble-Sort-Algorithm ) +* ((fsloc 0) .--> b1) is autonomic
proof end;

theorem Th69: :: SCMBSORT:69
Initialized Bubble-Sort-Algorithm computes Sorting-Function
proof end;