summaryrefslogtreecommitdiff
path: root/tests/lean/Constants.lean
diff options
context:
space:
mode:
authorSon HO2023-11-22 15:06:43 +0100
committerGitHub2023-11-22 15:06:43 +0100
commitbacf3f5f6f5f6a9aa650d5ae8d12a132fd747039 (patch)
tree9953d7af1fe406cdc750030a43a5e4d6245cd763 /tests/lean/Constants.lean
parent587f1ebc0178acb19029d3fc9a729c197082aba7 (diff)
parent01cfd899119174ef7c5941c99dd251711f4ee701 (diff)
Merge pull request #45 from AeneasVerif/son_merge_types
Big cleanup
Diffstat (limited to 'tests/lean/Constants.lean')
-rw-r--r--tests/lean/Constants.lean84
1 files changed, 56 insertions, 28 deletions
diff --git a/tests/lean/Constants.lean b/tests/lean/Constants.lean
index bd3a07b7..80864427 100644
--- a/tests/lean/Constants.lean
+++ b/tests/lean/Constants.lean
@@ -5,119 +5,147 @@ open Primitives
namespace constants
-/- [constants::X0] -/
+/- [constants::X0]
+ Source: 'src/constants.rs', lines 5:0-5:17 -/
def x0_body : Result U32 := Result.ret 0#u32
def x0_c : U32 := eval_global x0_body (by simp)
-/- [constants::X1] -/
+/- [constants::X1]
+ Source: 'src/constants.rs', lines 7:0-7:17 -/
def x1_body : Result U32 := Result.ret core_u32_max
def x1_c : U32 := eval_global x1_body (by simp)
-/- [constants::X2] -/
+/- [constants::X2]
+ Source: 'src/constants.rs', lines 10:0-10:17 -/
def x2_body : Result U32 := Result.ret 3#u32
def x2_c : U32 := eval_global x2_body (by simp)
-/- [constants::incr]: forward function -/
+/- [constants::incr]: forward function
+ Source: 'src/constants.rs', lines 17:0-17:32 -/
def incr (n : U32) : Result U32 :=
n + 1#u32
-/- [constants::X3] -/
+/- [constants::X3]
+ Source: 'src/constants.rs', lines 15:0-15:17 -/
def x3_body : Result U32 := incr 32#u32
def x3_c : U32 := eval_global x3_body (by simp)
-/- [constants::mk_pair0]: forward function -/
+/- [constants::mk_pair0]: forward function
+ Source: 'src/constants.rs', lines 23:0-23:51 -/
def mk_pair0 (x : U32) (y : U32) : Result (U32 × U32) :=
Result.ret (x, y)
-/- [constants::Pair] -/
+/- [constants::Pair]
+ Source: 'src/constants.rs', lines 36:0-36:23 -/
structure Pair (T1 T2 : Type) where
x : T1
y : T2
-/- [constants::mk_pair1]: forward function -/
+/- [constants::mk_pair1]: forward function
+ Source: 'src/constants.rs', lines 27:0-27:55 -/
def mk_pair1 (x : U32) (y : U32) : Result (Pair U32 U32) :=
Result.ret { x := x, y := y }
-/- [constants::P0] -/
+/- [constants::P0]
+ Source: 'src/constants.rs', lines 31:0-31:24 -/
def p0_body : Result (U32 × U32) := mk_pair0 0#u32 1#u32
def p0_c : (U32 × U32) := eval_global p0_body (by simp)
-/- [constants::P1] -/
+/- [constants::P1]
+ Source: 'src/constants.rs', lines 32:0-32:28 -/
def p1_body : Result (Pair U32 U32) := mk_pair1 0#u32 1#u32
def p1_c : Pair U32 U32 := eval_global p1_body (by simp)
-/- [constants::P2] -/
+/- [constants::P2]
+ Source: 'src/constants.rs', lines 33:0-33:24 -/
def p2_body : Result (U32 × U32) := Result.ret (0#u32, 1#u32)
def p2_c : (U32 × U32) := eval_global p2_body (by simp)
-/- [constants::P3] -/
+/- [constants::P3]
+ Source: 'src/constants.rs', lines 34:0-34:28 -/
def p3_body : Result (Pair U32 U32) := Result.ret { x := 0#u32, y := 1#u32 }
def p3_c : Pair U32 U32 := eval_global p3_body (by simp)
-/- [constants::Wrap] -/
+/- [constants::Wrap]
+ Source: 'src/constants.rs', lines 49:0-49:18 -/
structure Wrap (T : Type) where
value : T
-/- [constants::Wrap::{0}::new]: forward function -/
+/- [constants::{constants::Wrap<T>}::new]: forward function
+ Source: 'src/constants.rs', lines 54:4-54:41 -/
def Wrap.new (T : Type) (value : T) : Result (Wrap T) :=
Result.ret { value := value }
-/- [constants::Y] -/
+/- [constants::Y]
+ Source: 'src/constants.rs', lines 41:0-41:22 -/
def y_body : Result (Wrap I32) := Wrap.new I32 2#i32
def y_c : Wrap I32 := eval_global y_body (by simp)
-/- [constants::unwrap_y]: forward function -/
+/- [constants::unwrap_y]: forward function
+ Source: 'src/constants.rs', lines 43:0-43:30 -/
def unwrap_y : Result I32 :=
Result.ret y_c.value
-/- [constants::YVAL] -/
+/- [constants::YVAL]
+ Source: 'src/constants.rs', lines 47:0-47:19 -/
def yval_body : Result I32 := unwrap_y
def yval_c : I32 := eval_global yval_body (by simp)
-/- [constants::get_z1::Z1] -/
+/- [constants::get_z1::Z1]
+ Source: 'src/constants.rs', lines 62:4-62:17 -/
def get_z1_z1_body : Result I32 := Result.ret 3#i32
def get_z1_z1_c : I32 := eval_global get_z1_z1_body (by simp)
-/- [constants::get_z1]: forward function -/
+/- [constants::get_z1]: forward function
+ Source: 'src/constants.rs', lines 61:0-61:28 -/
def get_z1 : Result I32 :=
Result.ret get_z1_z1_c
-/- [constants::add]: forward function -/
+/- [constants::add]: forward function
+ Source: 'src/constants.rs', lines 66:0-66:39 -/
def add (a : I32) (b : I32) : Result I32 :=
a + b
-/- [constants::Q1] -/
+/- [constants::Q1]
+ Source: 'src/constants.rs', lines 74:0-74:17 -/
def q1_body : Result I32 := Result.ret 5#i32
def q1_c : I32 := eval_global q1_body (by simp)
-/- [constants::Q2] -/
+/- [constants::Q2]
+ Source: 'src/constants.rs', lines 75:0-75:17 -/
def q2_body : Result I32 := Result.ret q1_c
def q2_c : I32 := eval_global q2_body (by simp)
-/- [constants::Q3] -/
+/- [constants::Q3]
+ Source: 'src/constants.rs', lines 76:0-76:17 -/
def q3_body : Result I32 := add q2_c 3#i32
def q3_c : I32 := eval_global q3_body (by simp)
-/- [constants::get_z2]: forward function -/
+/- [constants::get_z2]: forward function
+ Source: 'src/constants.rs', lines 70:0-70:28 -/
def get_z2 : Result I32 :=
do
let i ← get_z1
let i0 ← add i q3_c
add q1_c i0
-/- [constants::S1] -/
+/- [constants::S1]
+ Source: 'src/constants.rs', lines 80:0-80:18 -/
def s1_body : Result U32 := Result.ret 6#u32
def s1_c : U32 := eval_global s1_body (by simp)
-/- [constants::S2] -/
+/- [constants::S2]
+ Source: 'src/constants.rs', lines 81:0-81:18 -/
def s2_body : Result U32 := incr s1_c
def s2_c : U32 := eval_global s2_body (by simp)
-/- [constants::S3] -/
+/- [constants::S3]
+ Source: 'src/constants.rs', lines 82:0-82:29 -/
def s3_body : Result (Pair U32 U32) := Result.ret p3_c
def s3_c : Pair U32 U32 := eval_global s3_body (by simp)
-/- [constants::S4] -/
+/- [constants::S4]
+ Source: 'src/constants.rs', lines 83:0-83:29 -/
def s4_body : Result (Pair U32 U32) := mk_pair1 7#u32 8#u32
def s4_c : Pair U32 U32 := eval_global s4_body (by simp)