summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--compiler/Extract.ml2
-rw-r--r--tests/lean/Array.lean2
-rw-r--r--tests/lean/Constants.lean36
-rw-r--r--tests/lean/NoNestedBorrows.lean4
-rw-r--r--tests/lean/Traits.lean4
-rw-r--r--tests/lean/Tutorial.lean2
-rw-r--r--tests/lean/lake-manifest.json128
-rw-r--r--tests/lean/lean-toolchain2
9 files changed, 101 insertions, 83 deletions
diff --git a/README.md b/README.md
index 0530a0da..82ff3944 100644
--- a/README.md
+++ b/README.md
@@ -83,9 +83,9 @@ to display a detailed documentation.
Files generated by the Lean backend import the `Base` package from Aeneas.
To use those files in Lean, create a new Lean package using `lake new`,
overwrite the `lean-toolchain` with the one inside `./backends/lean`,
-and add `Base` as a dependency in the `lakefile.lean`:
+and add `base` as a dependency in the `lakefile.lean`:
```
-require Base from "PATH_TO_AENEAS_REPO/backends/lean"
+require base from "PATH_TO_AENEAS_REPO/backends/lean"
```
## Targeted Subset And Current Limitations
diff --git a/compiler/Extract.ml b/compiler/Extract.ml
index 87dcb1fd..6c523549 100644
--- a/compiler/Extract.ml
+++ b/compiler/Extract.ml
@@ -1864,7 +1864,7 @@ let extract_global_decl (ctx : extraction_ctx) (fmt : F.formatter)
let body =
match !backend with
| FStar -> "eval_global " ^ body_name
- | Lean -> "eval_global " ^ body_name ^ " (by simp)"
+ | Lean -> "eval_global " ^ body_name ^ " (by decide)"
| Coq -> body_name ^ "%global"
| HOL4 -> "get_return_value " ^ body_name
in
diff --git a/tests/lean/Array.lean b/tests/lean/Array.lean
index 7785a208..b49e30fb 100644
--- a/tests/lean/Array.lean
+++ b/tests/lean/Array.lean
@@ -452,7 +452,7 @@ def f3 : Result U32 :=
/- [array::SZ]
Source: 'src/array.rs', lines 286:0-286:19 -/
def sz_body : Result Usize := Result.ret 32#usize
-def sz_c : Usize := eval_global sz_body (by simp)
+def sz_c : Usize := eval_global sz_body (by decide)
/- [array::f5]:
Source: 'src/array.rs', lines 289:0-289:31 -/
diff --git a/tests/lean/Constants.lean b/tests/lean/Constants.lean
index 2912805f..4c626ab3 100644
--- a/tests/lean/Constants.lean
+++ b/tests/lean/Constants.lean
@@ -8,17 +8,17 @@ namespace constants
/- [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)
+def x0_c : U32 := eval_global x0_body (by decide)
/- [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)
+def x1_c : U32 := eval_global x1_body (by decide)
/- [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)
+def x2_c : U32 := eval_global x2_body (by decide)
/- [constants::incr]:
Source: 'src/constants.rs', lines 17:0-17:32 -/
@@ -28,7 +28,7 @@ def incr (n : U32) : Result U32 :=
/- [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)
+def x3_c : U32 := eval_global x3_body (by decide)
/- [constants::mk_pair0]:
Source: 'src/constants.rs', lines 23:0-23:51 -/
@@ -49,22 +49,22 @@ def mk_pair1 (x : U32) (y : U32) : Result (Pair U32 U32) :=
/- [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)
+def p0_c : (U32 × U32) := eval_global p0_body (by decide)
/- [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)
+def p1_c : Pair U32 U32 := eval_global p1_body (by decide)
/- [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)
+def p2_c : (U32 × U32) := eval_global p2_body (by decide)
/- [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)
+def p3_c : Pair U32 U32 := eval_global p3_body (by decide)
/- [constants::Wrap]
Source: 'src/constants.rs', lines 49:0-49:18 -/
@@ -79,7 +79,7 @@ def Wrap.new (T : Type) (value : T) : Result (Wrap T) :=
/- [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)
+def y_c : Wrap I32 := eval_global y_body (by decide)
/- [constants::unwrap_y]:
Source: 'src/constants.rs', lines 43:0-43:30 -/
@@ -89,12 +89,12 @@ def unwrap_y : Result I32 :=
/- [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)
+def yval_c : I32 := eval_global yval_body (by decide)
/- [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)
+def get_z1_z1_c : I32 := eval_global get_z1_z1_body (by decide)
/- [constants::get_z1]:
Source: 'src/constants.rs', lines 61:0-61:28 -/
@@ -109,17 +109,17 @@ def add (a : I32) (b : I32) : Result I32 :=
/- [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)
+def q1_c : I32 := eval_global q1_body (by decide)
/- [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)
+def q2_c : I32 := eval_global q2_body (by decide)
/- [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)
+def q3_c : I32 := eval_global q3_body (by decide)
/- [constants::get_z2]:
Source: 'src/constants.rs', lines 70:0-70:28 -/
@@ -132,21 +132,21 @@ def get_z2 : Result I32 :=
/- [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)
+def s1_c : U32 := eval_global s1_body (by decide)
/- [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)
+def s2_c : U32 := eval_global s2_body (by decide)
/- [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)
+def s3_c : Pair U32 U32 := eval_global s3_body (by decide)
/- [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)
+def s4_c : Pair U32 U32 := eval_global s4_body (by decide)
end constants
diff --git a/tests/lean/NoNestedBorrows.lean b/tests/lean/NoNestedBorrows.lean
index 0dd29429..bed71d94 100644
--- a/tests/lean/NoNestedBorrows.lean
+++ b/tests/lean/NoNestedBorrows.lean
@@ -139,12 +139,12 @@ def mix_arith_i32 (x : I32) (y : I32) (z : I32) : Result I32 :=
/- [no_nested_borrows::CONST0]
Source: 'src/no_nested_borrows.rs', lines 125:0-125:23 -/
def const0_body : Result Usize := 1#usize + 1#usize
-def const0_c : Usize := eval_global const0_body (by simp)
+def const0_c : Usize := eval_global const0_body (by decide)
/- [no_nested_borrows::CONST1]
Source: 'src/no_nested_borrows.rs', lines 126:0-126:23 -/
def const1_body : Result Usize := 2#usize * 2#usize
-def const1_c : Usize := eval_global const1_body (by simp)
+def const1_c : Usize := eval_global const1_body (by decide)
/- [no_nested_borrows::cast_u32_to_i32]:
Source: 'src/no_nested_borrows.rs', lines 128:0-128:37 -/
diff --git a/tests/lean/Traits.lean b/tests/lean/Traits.lean
index d32aba86..3ef4febc 100644
--- a/tests/lean/Traits.lean
+++ b/tests/lean/Traits.lean
@@ -249,7 +249,7 @@ def traits.ToTypetraitsBoolWrapperTInst (T : Type) (ToTypeBoolTInst : ToType
Source: 'src/traits.rs', lines 164:4-164:21 -/
def with_const_ty_len2_body : Result Usize := Result.ret 32#usize
def with_const_ty_len2_c : Usize :=
- eval_global with_const_ty_len2_body (by simp)
+ eval_global with_const_ty_len2_body (by decide)
/- Trait declaration: [traits::WithConstTy]
Source: 'src/traits.rs', lines 161:0-161:39 -/
@@ -264,7 +264,7 @@ structure WithConstTy (Self : Type) (LEN : Usize) where
/- [traits::{bool#8}::LEN1]
Source: 'src/traits.rs', lines 175:4-175:21 -/
def bool_len1_body : Result Usize := Result.ret 12#usize
-def bool_len1_c : Usize := eval_global bool_len1_body (by simp)
+def bool_len1_c : Usize := eval_global bool_len1_body (by decide)
/- [traits::{bool#8}::f]:
Source: 'src/traits.rs', lines 180:4-180:39 -/
diff --git a/tests/lean/Tutorial.lean b/tests/lean/Tutorial.lean
index 840a606e..d92b2dd7 100644
--- a/tests/lean/Tutorial.lean
+++ b/tests/lean/Tutorial.lean
@@ -376,7 +376,7 @@ theorem i32_id_spec (x : I32) (h : 0 ≤ x.val) :
--
-- We first specify a decreasing value. Here, we state that [x], seen as a natural number,
-- decreases at every recursive call.
-termination_by i32_id_spec x _ => x.val.toNat
+termination_by x.val.toNat
-- And we now have to prove that it indeed decreases - you can skip this for now.
decreasing_by
-- We first need to "massage" the goal (in practice, all the proofs of [decreasing_by]
diff --git a/tests/lean/lake-manifest.json b/tests/lean/lake-manifest.json
index 5c20ec3b..e167e841 100644
--- a/tests/lean/lake-manifest.json
+++ b/tests/lean/lake-manifest.json
@@ -1,56 +1,74 @@
-{"version": 5,
- "packagesDir": "lake-packages",
+{"version": 7,
+ "packagesDir": ".lake/packages",
"packages":
- [{"git":
- {"url": "https://github.com/EdAyers/ProofWidgets4",
- "subDir?": null,
- "rev": "a0c2cd0ac3245a0dade4f925bcfa97e06dd84229",
- "opts": {},
- "name": "proofwidgets",
- "inputRev?": "v0.0.13",
- "inherited": true}},
- {"path":
- {"opts": {},
- "name": "Base",
- "inherited": false,
- "dir": "./../../backends/lean"}},
- {"git":
- {"url": "https://github.com/mhuisi/lean4-cli.git",
- "subDir?": null,
- "rev": "21dac2e9cc7e3cf7da5800814787b833e680b2fd",
- "opts": {},
- "name": "Cli",
- "inputRev?": "nightly",
- "inherited": true}},
- {"git":
- {"url": "https://github.com/leanprover-community/mathlib4.git",
- "subDir?": null,
- "rev": "b639e46a19a0328adfb9b1fdf8cbe39dfc1de76b",
- "opts": {},
- "name": "mathlib",
- "inputRev?": null,
- "inherited": false}},
- {"git":
- {"url": "https://github.com/gebner/quote4",
- "subDir?": null,
- "rev": "e75daed95ad1c92af4e577fea95e234d7a8401c1",
- "opts": {},
- "name": "Qq",
- "inputRev?": "master",
- "inherited": true}},
- {"git":
- {"url": "https://github.com/JLimperg/aesop",
- "subDir?": null,
- "rev": "1a0cded2be292b5496e659b730d2accc742de098",
- "opts": {},
- "name": "aesop",
- "inputRev?": "master",
- "inherited": true}},
- {"git":
- {"url": "https://github.com/leanprover/std4",
- "subDir?": null,
- "rev": "ba5e5e3af519b4fc5221ad0fa4b2c87276f1d323",
- "opts": {},
- "name": "std",
- "inputRev?": "main",
- "inherited": true}}]}
+ [{"url": "https://github.com/leanprover/std4",
+ "type": "git",
+ "subDir": null,
+ "rev": "276953b13323ca151939eafaaec9129bf7970306",
+ "name": "std",
+ "manifestFile": "lake-manifest.json",
+ "inputRev": "main",
+ "inherited": true,
+ "configFile": "lakefile.lean"},
+ {"url": "https://github.com/leanprover-community/quote4",
+ "type": "git",
+ "subDir": null,
+ "rev": "1c88406514a636d241903e2e288d21dc6d861e01",
+ "name": "Qq",
+ "manifestFile": "lake-manifest.json",
+ "inputRev": "master",
+ "inherited": true,
+ "configFile": "lakefile.lean"},
+ {"url": "https://github.com/leanprover-community/aesop",
+ "type": "git",
+ "subDir": null,
+ "rev": "6beed82dcfbb7731d173cd517675df27d62ad0f4",
+ "name": "aesop",
+ "manifestFile": "lake-manifest.json",
+ "inputRev": "master",
+ "inherited": true,
+ "configFile": "lakefile.lean"},
+ {"url": "https://github.com/leanprover-community/ProofWidgets4",
+ "type": "git",
+ "subDir": null,
+ "rev": "af1e86cf7a37389632a02f4a111e6b501b2b818f",
+ "name": "proofwidgets",
+ "manifestFile": "lake-manifest.json",
+ "inputRev": "v0.0.27",
+ "inherited": true,
+ "configFile": "lakefile.lean"},
+ {"url": "https://github.com/leanprover/lean4-cli",
+ "type": "git",
+ "subDir": null,
+ "rev": "a751d21d4b68c999accb6fc5d960538af26ad5ec",
+ "name": "Cli",
+ "manifestFile": "lake-manifest.json",
+ "inputRev": "main",
+ "inherited": true,
+ "configFile": "lakefile.lean"},
+ {"url": "https://github.com/leanprover-community/import-graph.git",
+ "type": "git",
+ "subDir": null,
+ "rev": "8079d2d1d0e073bde42eab159c24f4c2d0d3a871",
+ "name": "importGraph",
+ "manifestFile": "lake-manifest.json",
+ "inputRev": "main",
+ "inherited": true,
+ "configFile": "lakefile.lean"},
+ {"url": "https://github.com/leanprover-community/mathlib4.git",
+ "type": "git",
+ "subDir": null,
+ "rev": "d04f8d39c0e47a0d73450b49f6c0665897cdcaf7",
+ "name": "mathlib",
+ "manifestFile": "lake-manifest.json",
+ "inputRev": null,
+ "inherited": false,
+ "configFile": "lakefile.lean"},
+ {"type": "path",
+ "name": "base",
+ "manifestFile": "lake-manifest.json",
+ "inherited": false,
+ "dir": "./../../backends/lean",
+ "configFile": "lakefile.lean"}],
+ "name": "Tests",
+ "lakeDir": ".lake"}
diff --git a/tests/lean/lean-toolchain b/tests/lean/lean-toolchain
index fbca4d37..cfcdd327 100644
--- a/tests/lean/lean-toolchain
+++ b/tests/lean/lean-toolchain
@@ -1 +1 @@
-leanprover/lean4:v4.0.0 \ No newline at end of file
+leanprover/lean4:v4.6.0-rc1