Commit e017894d authored by Martin Clochard's avatar Martin Clochard
Browse files

Mini-compiler: loop in progress

parent b041d198
......@@ -114,10 +114,10 @@
<proof prover="1"><result status="valid" time="0.09"/></proof>
</goal>
<goal name="WP_parameter compile_aexpr.21.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.09"/></proof>
<proof prover="1"><result status="valid" time="0.19"/></proof>
</goal>
<goal name="WP_parameter compile_aexpr.21.1.1.4" expl="4.">
<proof prover="1"><result status="valid" time="0.19"/></proof>
<proof prover="1"><result status="valid" time="0.09"/></proof>
</goal>
</transf>
</goal>
......@@ -171,10 +171,10 @@
<proof prover="1"><result status="valid" time="0.09"/></proof>
</goal>
<goal name="WP_parameter compile_aexpr.33.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.10"/></proof>
<proof prover="1"><result status="valid" time="0.09"/></proof>
</goal>
<goal name="WP_parameter compile_aexpr.33.1.1.4" expl="4.">
<proof prover="1"><result status="valid" time="0.21"/></proof>
<proof prover="1"><result status="valid" time="0.10"/></proof>
</goal>
</transf>
</goal>
......@@ -231,7 +231,7 @@
<proof prover="1"><result status="valid" time="0.10"/></proof>
</goal>
<goal name="WP_parameter compile_aexpr.45.1.1.4" expl="4.">
<proof prover="1"><result status="valid" time="0.30"/></proof>
<proof prover="1"><result status="valid" time="0.28"/></proof>
</goal>
</transf>
</goal>
......@@ -261,7 +261,7 @@
</transf>
</goal>
</theory>
<theory name="Compile_bexpr" sum="de0cc184accf537c48330a50451eb643" expanded="true">
<theory name="Compile_bexpr" sum="de0cc184accf537c48330a50451eb643">
<goal name="WP_parameter compile_bexpr" expl="VC for compile_bexpr">
<transf name="split_goal_wp">
<goal name="WP_parameter compile_bexpr.1" expl="1. precondition">
......@@ -280,10 +280,10 @@
<proof prover="1"><result status="valid" time="0.06"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.3.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.06"/></proof>
<proof prover="1"><result status="valid" time="0.07"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.3.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.07"/></proof>
<proof prover="1"><result status="valid" time="0.06"/></proof>
</goal>
</transf>
</goal>
......@@ -316,10 +316,10 @@
<proof prover="1"><result status="valid" time="0.06"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.9.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.07"/></proof>
<proof prover="1"><result status="valid" time="0.06"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.9.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.06"/></proof>
<proof prover="1"><result status="valid" time="0.07"/></proof>
</goal>
</transf>
</goal>
......@@ -352,10 +352,10 @@
<proof prover="1"><result status="valid" time="0.05"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.15.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.08"/></proof>
<proof prover="1"><result status="valid" time="0.06"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.15.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.06"/></proof>
<proof prover="1"><result status="valid" time="0.08"/></proof>
</goal>
</transf>
</goal>
......@@ -388,10 +388,10 @@
<proof prover="1"><result status="valid" time="0.05"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.21.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.07"/></proof>
<proof prover="1"><result status="valid" time="0.06"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.21.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.06"/></proof>
<proof prover="1"><result status="valid" time="0.07"/></proof>
</goal>
</transf>
</goal>
......@@ -475,10 +475,10 @@
<goal name="WP_parameter compile_bexpr.39.1.1" expl="1.">
<transf name="split_goal_wp">
<goal name="WP_parameter compile_bexpr.39.1.1.1" expl="1.">
<proof prover="1"><result status="valid" time="0.08"/></proof>
<proof prover="1"><result status="valid" time="0.09"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.39.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.22"/></proof>
<proof prover="1"><result status="valid" time="0.23"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.39.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.23"/></proof>
......@@ -487,10 +487,10 @@
<proof prover="1"><result status="valid" time="0.12"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.39.1.1.5" expl="5.">
<proof prover="1"><result status="valid" time="0.42"/></proof>
<proof prover="1"><result status="valid" time="0.51"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.39.1.1.6" expl="6.">
<proof prover="1"><result status="valid" time="0.41"/></proof>
<proof prover="1"><result status="valid" time="0.51"/></proof>
</goal>
</transf>
</goal>
......@@ -532,19 +532,19 @@
<goal name="WP_parameter compile_bexpr.49.1.1" expl="1.">
<transf name="split_goal_wp">
<goal name="WP_parameter compile_bexpr.49.1.1.1" expl="1.">
<proof prover="1"><result status="valid" time="0.09"/></proof>
<proof prover="1"><result status="valid" time="0.15"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.49.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.08"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.49.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.14"/></proof>
<proof prover="1"><result status="valid" time="0.09"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.49.1.1.4" expl="4.">
<proof prover="1"><result status="valid" time="0.27"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.49.1.1.5" expl="5.">
<proof prover="1"><result status="valid" time="0.28"/></proof>
<proof prover="1"><result status="valid" time="0.40"/></proof>
</goal>
</transf>
</goal>
......@@ -586,19 +586,19 @@
<goal name="WP_parameter compile_bexpr.59.1.1" expl="1.">
<transf name="split_goal_wp">
<goal name="WP_parameter compile_bexpr.59.1.1.1" expl="1.">
<proof prover="1"><result status="valid" time="0.08"/></proof>
<proof prover="1"><result status="valid" time="0.24"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.59.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.09"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.59.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.11"/></proof>
<proof prover="1"><result status="valid" time="0.08"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.59.1.1.4" expl="4.">
<proof prover="1"><result status="valid" time="0.25"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.59.1.1.5" expl="5.">
<proof prover="1"><result status="valid" time="0.24"/></proof>
<proof prover="1"><result status="valid" time="0.25"/></proof>
</goal>
</transf>
</goal>
......@@ -640,19 +640,19 @@
<goal name="WP_parameter compile_bexpr.69.1.1" expl="1.">
<transf name="split_goal_wp">
<goal name="WP_parameter compile_bexpr.69.1.1.1" expl="1.">
<proof prover="1"><result status="valid" time="0.08"/></proof>
<proof prover="1"><result status="valid" time="0.24"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.69.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.09"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.69.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.11"/></proof>
<proof prover="1"><result status="valid" time="0.08"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.69.1.1.4" expl="4.">
<proof prover="1"><result status="valid" time="0.26"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.69.1.1.5" expl="5.">
<proof prover="1"><result status="valid" time="0.24"/></proof>
<proof prover="1"><result status="valid" time="0.25"/></proof>
</goal>
</transf>
</goal>
......@@ -694,19 +694,19 @@
<goal name="WP_parameter compile_bexpr.79.1.1" expl="1.">
<transf name="split_goal_wp">
<goal name="WP_parameter compile_bexpr.79.1.1.1" expl="1.">
<proof prover="1"><result status="valid" time="0.07"/></proof>
<proof prover="1"><result status="valid" time="0.11"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.79.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.07"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.79.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.11"/></proof>
<proof prover="1"><result status="valid" time="0.07"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.79.1.1.4" expl="4.">
<proof prover="1"><result status="valid" time="0.27"/></proof>
</goal>
<goal name="WP_parameter compile_bexpr.79.1.1.5" expl="5.">
<proof prover="1"><result status="valid" time="0.26"/></proof>
<proof prover="1"><result status="valid" time="0.23"/></proof>
</goal>
</transf>
</goal>
......@@ -725,7 +725,7 @@
</goal>
</transf>
</goal>
<goal name="WP_parameter compile_bexpr_natural" expl="VC for compile_bexpr_natural" expanded="true">
<goal name="WP_parameter compile_bexpr_natural" expl="VC for compile_bexpr_natural">
<proof prover="1"><result status="valid" time="2.16"/></proof>
</goal>
</theory>
......@@ -752,13 +752,13 @@
<goal name="WP_parameter compile_com.3.1.1" expl="1.">
<transf name="split_goal_wp">
<goal name="WP_parameter compile_com.3.1.1.1" expl="1.">
<proof prover="1"><result status="valid" time="0.08"/></proof>
<proof prover="1"><result status="valid" time="0.10"/></proof>
</goal>
<goal name="WP_parameter compile_com.3.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.07"/></proof>
<proof prover="1"><result status="valid" time="0.08"/></proof>
</goal>
<goal name="WP_parameter compile_com.3.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.10"/></proof>
<proof prover="1"><result status="valid" time="0.07"/></proof>
</goal>
<goal name="WP_parameter compile_com.3.1.1.4" expl="4.">
<proof prover="1"><result status="valid" time="0.08"/></proof>
......@@ -804,10 +804,10 @@
<proof prover="1"><result status="valid" time="0.11"/></proof>
</goal>
<goal name="WP_parameter compile_com.11.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.11"/></proof>
<proof prover="1"><result status="valid" time="0.12"/></proof>
</goal>
<goal name="WP_parameter compile_com.11.1.1.4" expl="4.">
<proof prover="1"><result status="valid" time="0.12"/></proof>
<proof prover="1"><result status="valid" time="0.11"/></proof>
</goal>
<goal name="WP_parameter compile_com.11.1.1.5" expl="5.">
<proof prover="1"><result status="valid" time="0.54"/></proof>
......@@ -855,19 +855,19 @@
<proof prover="1"><result status="valid" time="0.08"/></proof>
</goal>
<goal name="WP_parameter compile_com.21.1.1.2" expl="2.">
<proof prover="0"><result status="valid" time="0.05"/></proof>
<proof prover="0"><result status="valid" time="0.06"/></proof>
</goal>
<goal name="WP_parameter compile_com.21.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.08"/></proof>
</goal>
<goal name="WP_parameter compile_com.21.1.1.4" expl="4.">
<proof prover="0"><result status="valid" time="0.06"/></proof>
<proof prover="0"><result status="valid" time="0.05"/></proof>
</goal>
<goal name="WP_parameter compile_com.21.1.1.5" expl="5.">
<proof prover="1"><result status="valid" time="0.09"/></proof>
<proof prover="1"><result status="valid" time="0.13"/></proof>
</goal>
<goal name="WP_parameter compile_com.21.1.1.6" expl="6.">
<proof prover="1"><result status="valid" time="0.13"/></proof>
<proof prover="1"><result status="valid" time="0.09"/></proof>
</goal>
<goal name="WP_parameter compile_com.21.1.1.7" expl="7.">
<proof prover="1"><result status="valid" time="0.09"/></proof>
......@@ -934,63 +934,63 @@
<proof prover="1"><result status="valid" time="0.25"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.2" expl="2.">
<proof prover="1"><result status="valid" time="0.39"/></proof>
<proof prover="1"><result status="valid" time="0.35"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.3" expl="3.">
<proof prover="1"><result status="valid" time="0.31"/></proof>
<proof prover="1"><result status="valid" time="0.28"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.4" expl="4.">
<proof prover="1"><result status="valid" time="0.25"/></proof>
<proof prover="1"><result status="valid" time="0.30"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.5" expl="5.">
<proof prover="1"><result status="valid" time="0.25"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.6" expl="6.">
<proof prover="1"><result status="valid" time="0.95"/></proof>
<proof prover="1"><result status="valid" time="1.47"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.7" expl="7.">
<proof prover="1"><result status="valid" time="0.28"/></proof>
<proof prover="1"><result status="valid" time="0.39"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.8" expl="8.">
<proof prover="1"><result status="valid" time="0.47"/></proof>
<proof prover="1"><result status="valid" time="0.31"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.9" expl="9.">
<proof prover="1"><result status="valid" time="0.34"/></proof>
<proof prover="1"><result status="valid" time="0.48"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.10" expl="10.">
<proof prover="1"><result status="valid" time="0.38"/></proof>
<proof prover="0" obsolete="true"><result status="timeout" time="4.99"/></proof>
<proof prover="1"><result status="valid" time="0.41"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.11" expl="11.">
<proof prover="1"><result status="valid" time="0.99"/></proof>
<proof prover="1"><result status="valid" time="1.36"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.12" expl="12.">
<proof prover="0"><result status="valid" time="0.13"/></proof>
<proof prover="1" obsolete="true"><result status="timeout" time="4.99"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.13" expl="13.">
<proof prover="1"><result status="valid" time="0.54"/></proof>
<proof prover="1"><result status="valid" time="0.45"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.14" expl="14.">
<proof prover="1"><result status="valid" time="0.45"/></proof>
<proof prover="1"><result status="valid" time="0.62"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.15" expl="15.">
<proof prover="1"><result status="valid" time="0.40"/></proof>
<proof prover="1"><result status="valid" time="0.34"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.16" expl="16.">
<proof prover="0" obsolete="true"><result status="timeout" time="4.99"/></proof>
<proof prover="1"><result status="valid" time="0.27"/></proof>
<proof prover="1"><result status="valid" time="0.38"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.17" expl="17.">
<proof prover="1"><result status="valid" time="0.30"/></proof>
<proof prover="1"><result status="valid" time="0.34"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.18" expl="18.">
<proof prover="1"><result status="valid" time="0.28"/></proof>
<proof prover="1"><result status="valid" time="0.38"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.19" expl="19.">
<proof prover="1"><result status="valid" time="0.35"/></proof>
<proof prover="1"><result status="valid" time="0.45"/></proof>
</goal>
<goal name="WP_parameter compile_com.37.1.1.20" expl="20.">
<proof prover="1"><result status="valid" time="0.34"/></proof>
<proof prover="1"><result status="valid" time="0.40"/></proof>
</goal>
</transf>
</goal>
......@@ -1007,7 +1007,7 @@
<goal name="WP_parameter compile_com.40" expl="40. postcondition">
<proof prover="1"><result status="valid" time="0.09"/></proof>
</goal>
<goal name="WP_parameter compile_com.41" expl="41. unreachable point">
<goal name="WP_parameter compile_com.41" expl="41. unreachable point" expanded="true">
<proof prover="1"><result status="unknown" time="0.24"/></proof>
</goal>
</transf>
......
......@@ -151,7 +151,33 @@ module Compiler_logic
end
meta rewrite prop trivial_pre_lemma
inductive acc ('a -> 'a -> bool) 'a =
| Acc : forall r,x:'a. (forall y. r y x -> acc r y) -> acc r x
function loop_post (inv:'a -> pos -> pred)
(var:'a -> pos -> post)
(post:'a -> pos -> post)
(x:'a)
(p:pos)
(ms:machine_state) : pred =
\ms'. (inv x p ms /\ var x p ms' ms) \/ post x p ms ms'
meta rewrite_def function loop_post
(* Variant of hoare triplet introduction rule for looping code. *)
let make_loop (c:wp 'a)
(ghost inv:'a -> pos -> pred)
(ghost var: 'a -> pos -> post)
(ghost post : 'a -> pos -> post) : hl 'a
requires { wp_correctness c }
requires { forall x p ms. inv x p ms -> acc (var x p) ms }
requires { forall x p ms. inv x p ms ->
(c.wp x p (loop_post inv var post x p ms)) ms }
ensures { result.pre = inv /\ result.post = post }
ensures { result.code.length = c.wcode.length /\ hl_correctness result }
= { code = c.wcode ; pre = inv ; post = post }
end
......@@ -159,4 +185,4 @@ end
Local Variables:
compile-command: "why3 ide -L . logic.mlw"
End:
*)
\ No newline at end of file
*)
(* This file is generated by Why3's Coq driver *)
(* Beware! Only edit allowed sections below *)
Require Import BuiltIn.
Require BuiltIn.
Require int.Int.
Require int.Abs.
Require int.EuclideanDivision.
Require list.List.
Require list.Length.
Require list.Mem.
Require map.Map.
Require list.Append.
(* Why3 assumption *)
Definition unit := unit.
Axiom qtmark : Type.
Parameter qtmark_WhyType : WhyType qtmark.
Existing Instance qtmark_WhyType.
Axiom map : forall (a:Type) (b:Type), Type.
Parameter map_WhyType : forall (a:Type) {a_WT:WhyType a}
(b:Type) {b_WT:WhyType b}, WhyType (map a b).
Existing Instance map_WhyType.
Parameter get: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
(map a b) -> a -> b.
Parameter set: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
(map a b) -> a -> b -> (map a b).
Axiom Select_eq : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
forall (m:(map a b)), forall (a1:a) (a2:a), forall (b1:b), (a1 = a2) ->
((get (set m a1 b1) a2) = b1).
Axiom Select_neq : forall {a:Type} {a_WT:WhyType a}
{b:Type} {b_WT:WhyType b}, forall (m:(map a b)), forall (a1:a) (a2:a),
forall (b1:b), (~ (a1 = a2)) -> ((get (set m a1 b1) a2) = (get m a2)).
Parameter const: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
b -> (map a b).
Axiom Const : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
forall (b1:b) (a1:a), ((get (const b1: (map a b)) a1) = b1).
(* Why3 assumption *)
Inductive id :=
| Id : Z -> id.
Axiom id_WhyType : WhyType id.
Existing Instance id_WhyType.
(* Why3 assumption *)
Definition state := (map id Z).
(* Why3 assumption *)
Definition pos := Z.
(* Why3 assumption *)
Definition stack := (list Z).
(* Why3 assumption *)
Inductive machine_state :=
| VMS : Z -> (list Z) -> (map id Z) -> machine_state.
Axiom machine_state_WhyType : WhyType machine_state.
Existing Instance machine_state_WhyType.
(* Why3 assumption *)
Inductive instr :=
| Iconst : Z -> instr
| Ivar : id -> instr
| Isetvar : id -> instr
| Ibranch : Z -> instr
| Iadd : instr
| Isub : instr
| Imul : instr
| Ibeq : Z -> instr
| Ibne : Z -> instr
| Ible : Z -> instr
| Ibgt : Z -> instr
| Ihalt : instr.
Axiom instr_WhyType : WhyType instr.
Existing Instance instr_WhyType.
(* Why3 assumption *)
Definition code := (list instr).
(* Why3 assumption *)
Inductive codeseq_at: (list instr) -> Z -> (list instr) -> Prop :=
| codeseq_at_intro : forall (c1:(list instr)) (c2:(list instr))
(c3:(list instr)) (pc:Z), (pc = (list.Length.length c1)) -> (codeseq_at
(Init.Datatypes.app (Init.Datatypes.app c1 c2) c3) pc c2).
Axiom codeseq_at_app_right : forall (c:(list instr)) (c1:(list instr))
(c2:(list instr)) (p:Z), (codeseq_at c p (Init.Datatypes.app c1 c2)) ->
(codeseq_at c (p + (list.Length.length c1))%Z c2).
Axiom codeseq_at_app_left : forall (c:(list instr)) (c1:(list instr))
(c2:(list instr)) (p:Z), (codeseq_at c p (Init.Datatypes.app c1 c2)) ->
(codeseq_at c p c1).
(* Why3 assumption *)
Definition iconst (n:Z): (list instr) :=
(Init.Datatypes.cons (Iconst n) Init.Datatypes.nil).
(* Why3 assumption *)
Definition ivar (x:id): (list instr) :=
(Init.Datatypes.cons (Ivar x) Init.Datatypes.nil).
(* Why3 assumption *)
Definition isetvar (x:id): (list instr) :=
(Init.Datatypes.cons (Isetvar x) Init.Datatypes.nil).
(* Why3 assumption *)
Definition ibeq (ofs:Z): (list instr) :=
(Init.Datatypes.cons (Ibeq ofs) Init.Datatypes.nil).
(* Why3 assumption *)
Definition ible (ofs:Z): (list instr) :=
(Init.Datatypes.cons (Ible ofs) Init.Datatypes.nil).
(* Why3 assumption *)
Definition ibne (ofs:Z): (list instr) :=
(Init.Datatypes.cons (Ibne ofs) Init.Datatypes.nil).
(* Why3 assumption *)
Definition ibgt (ofs:Z): (list instr) :=
(Init.Datatypes.cons (Ibgt ofs) Init.Datatypes.nil).
(* Why3 assumption *)
Definition ibranch (ofs:Z): (list instr) :=
(Init.Datatypes.cons (Ibranch ofs) Init.Datatypes.nil).
(* Why3 assumption *)
Inductive transition: (list instr) -> machine_state -> machine_state ->
Prop :=
| trans_const : forall (c:(list instr)) (p:Z) (n:Z), (codeseq_at c p
(iconst n)) -> forall (m:(map id Z)) (s:(list Z)), (transition c (VMS p
s m) (VMS (p + 1%Z)%Z (Init.Datatypes.cons n s) m))
| trans_var : forall (c:(list instr)) (p:Z) (x:id), (codeseq_at c p
(ivar x)) -> forall (m:(map id Z)) (s:(list Z)), (transition c (VMS p s
m) (VMS (p + 1%Z)%Z (Init.Datatypes.cons (get m x) s) m))
| trans_set_var : forall (c:(list instr)) (p:Z) (x:id), (codeseq_at c p
(isetvar x)) -> forall (n:Z) (s:(list Z)) (m:(map id Z)), (transition c
(VMS p (Init.Datatypes.cons n s) m) (VMS (p + 1%Z)%Z s (set m x n)))
| trans_add : forall (c:(list instr)) (p:Z), (codeseq_at c p
(Init.Datatypes.cons Iadd Init.Datatypes.nil)) -> forall (n1:Z) (n2:Z)
(s:(list Z)) (m:(map id Z)), (transition c (VMS p
(Init.Datatypes.cons n2 (Init.Datatypes.cons n1 s)) m) (VMS (p + 1%Z)%Z
(Init.Datatypes.cons (n1 + n2)%Z s) m))
| trans_sub : forall (c:(list instr)) (p:Z), (codeseq_at c p
(Init.Datatypes.cons Isub Init.Datatypes.nil)) -> forall (n1:Z) (n2:Z)
(s:(list Z)) (m:(map id Z)), (transition c (VMS p
(Init.Datatypes.cons n2 (Init.Datatypes.cons n1 s)) m) (VMS (p + 1%Z)%Z
(Init.Datatypes.cons (n1 - n2)%Z s) m))
| trans_mul : forall (c:(list instr)) (p:Z), (codeseq_at c p
(Init.Datatypes.cons Imul Init.Datatypes.nil)) -> forall (n1:Z) (n2:Z)
(s:(list Z)) (m:(map id Z)), (transition c (VMS p
(Init.Datatypes.cons n2 (Init.Datatypes.cons n1 s)) m) (VMS (p + 1%Z)%Z
(Init.Datatypes.cons (n1 * n2)%Z s) m))
| trans_beq : forall (c:(list instr)) (p1:Z) (ofs:Z), (codeseq_at c p1
(ibeq ofs)) -> forall (s:(list Z)) (m:(map id Z)) (n1:Z) (n2:Z),
(n1 = n2) -> (transition c (VMS p1