Skip to content

Commit f2ce72a

Browse files
Merge pull request #1696 from cryspen/lean-lib-update
proof-libs/lean Library update and refactor
2 parents bf9a7e4 + 9533fe5 commit f2ce72a

File tree

15 files changed

+1392
-1081
lines changed

15 files changed

+1392
-1081
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Changes to hax-lib:
5555
- New behavior for `hax_lib::include`: it now forces inclusion when in contradiction with `-i` flag.
5656
- hax-lib requires edition 2021 instead of 2024 (#1726)
5757
- Improved `VecDeque` model in F* proof lib (#1728)
58+
- Split the Lean library into several files, update to lean 4.23.0 (#1696)
5859

5960
Changes to the Lean backend:
6061
- Improve support for functionalized loops (#1695)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:v4.22.0
1+
leanprover/lean4:v4.23.0

examples/lean_barrett/src/lib.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,22 @@ pub(crate) const FIELD_MODULUS: i32 = 3329;
4040
#[hax_lib::lean::before("@[simp, spec]")]
4141
#[hax_lib::lean::after(
4242
"
43+
set_option maxHeartbeats 1000000 in
44+
-- quite computation intensive
4345
theorem barrett_spec (value: i32) :
44-
⦃ Lean_barrett.__4.requires (value) = pure true ⦄
45-
(Lean_barrett.barrett_reduce value)
46-
⦃ ⇓ result => Lean_barrett.__5.ensures value result = pure true ⦄
46+
⦃ ⌜ Lean_barrett.__4.requires (value) = pure true ⌝ ⦄
47+
(do
48+
let result ← Lean_barrett.barrett_reduce value;
49+
Lean_barrett.__5.ensures value result)
50+
⦃ ⇓ post => ⌜post = true⌝ ⦄
4751
:= by
48-
mvcgen
52+
open Spec.BV in mvcgen [Lean_barrett.__5.ensures] <;> simp at *
4953
hax_bv_decide
50-
simp [Lean_barrett.__5.ensures] at *
51-
rw [i32.HaxRem_spec_bv_rw] ; simp ;
52-
rw [i32.HaxAdd_spec_bv_rw] ; simp ;
53-
rw [i32.HaxSub_spec_bv_rw] ; simp
54-
hax_bv_decide
55-
expose_names
56-
have ⟨ h1, h2 ⟩ := h; clear h
5754
simp [Int32.eq_iff_toBitVec_eq,
58-
Int32.lt_iff_toBitVec_slt,
59-
Int32.le_iff_toBitVec_sle,
60-
Int64.eq_iff_toBitVec_eq,
61-
Int64.lt_iff_toBitVec_slt,
62-
Int64.le_iff_toBitVec_sle,
63-
] at *
55+
Int32.lt_iff_toBitVec_slt,
56+
Int64.le_iff_toBitVec_sle,
57+
] at *
58+
expose_names; have ⟨ _ , _ ⟩ := h_1 ; clear h_1
6459
generalize Int32.toBitVec value = bv_value at * ; clear value
6560
bv_decide (config := {timeout := 120})
6661
"

examples/lean_chacha20/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ default:
77

88
clean:
99
-rm -f proofs/lean/extraction/lean_chacha20.lean
10+
-cd proofs/lean/extraction && lake clean

0 commit comments

Comments
 (0)