Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CoqOfRust/examples/default/examples/custom/links/loops_free.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Require Import CoqOfRust.CoqOfRust.
Require Import CoqOfRust.links.M.
Require Import examples.default.examples.custom.loops_free.

(* pub fn max2(a: u32, b: u32) -> u32 *)
Instance run_max2 (a b : U32.t) : Run.Trait max2 [] [] [φ a; φ b] U32.t.
Proof.
constructor.
run_symbolic.
Defined.
26 changes: 26 additions & 0 deletions CoqOfRust/examples/default/examples/custom/simulate/loops_free.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Require Import CoqOfRust.CoqOfRust.
Require Import CoqOfRust.links.M.
Require Import CoqOfRust.simulate.M.
Require Import examples.default.examples.custom.links.loops_free.

Definition max2 (a b : U32.t) : U32.t :=
if a.(Integer.value) <? b.(Integer.value) then
b
else
a.

Lemma max2_eq (a b : U32.t) :
{{
SimulateM.eval_f (Stack := []) (run_max2 a b) tt 🌲
(Output.Success (max2 a b), tt)
}}.
Proof.
unfold max2.
repeat (
cbn ||
get_can_access ||
eapply Run.Call ||
apply Run.Pure ||
destruct (_ <? _)
).
Qed.
Loading