-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature-micromega
- Loading branch information
Showing
94 changed files
with
2,881 additions
and
2,400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ ECARGS ?= | |
ECTOUT ?= 10 | ||
ECJOBS ?= 0 | ||
ECEXTRA ?= --report=report.log | ||
ECPROVERS ?= [email protected] Z3@4.8 CVC4@1.8 | ||
ECPROVERS ?= [email protected] Z3@4.12 CVC5@1.0 | ||
CHECKPY ?= | ||
CHECK := $(CHECKPY) scripts/testing/runtest | ||
CHECK += --bin=./ec.native --bin-args="$(ECARGS)" | ||
|
@@ -27,7 +27,7 @@ default: build | |
|
||
build: | ||
rm -f src/ec.exe ec.native | ||
dune build -p easycrypt | ||
dune build | ||
ln -sf src/ec.exe ec.native | ||
ifeq ($(UNAME_P)-$(UNAME_S),arm-Darwin) | ||
-codesign -f -s - src/ec.exe | ||
|
@@ -39,15 +39,16 @@ install: build | |
uninstall: | ||
$(DUNE) uninstall | ||
|
||
check: stdlib examples | ||
unit: build | ||
$(CHECK) unit | ||
|
||
stdlib: build | ||
$(CHECK) prelude stdlib | ||
|
||
examples: build | ||
$(CHECK) examples mee-cbc | ||
|
||
check: stdlib examples | ||
check: unit stdlib examples | ||
@true | ||
|
||
clean: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
(* example use of well-founded recursion and induction | ||
(theories/structures/WF.ec) *) | ||
|
||
require import AllCore List IntDiv StdOrder. | ||
import IntOrder. | ||
|
||
require import WF. | ||
|
||
(* define well-founded relation on lists: lt_list_size xs ys <=> | ||
size xs < size ys *) | ||
|
||
op lt_list_size : 'a list rel = wf_pre size lt_nat. | ||
lemma wf_lt_list_size ['a] : wf lt_list_size<:'a>. | ||
proof. | ||
rewrite wf_pre wf_lt_nat. | ||
qed. | ||
lemma lt_list_sizeP (xs ys : 'a list) : | ||
lt_list_size xs ys <=> size xs < size ys. | ||
proof. | ||
by rewrite /lt_list_size /wf_pre /lt_nat size_ge0. | ||
qed. | ||
|
||
(* body of well-founded recursive definition that "chunkifies" an 'a | ||
list into an 'a list list: the first n elements, then the next n | ||
elements, etc., where if at the end there are < n elements left, | ||
they are discarded *) | ||
|
||
op chunkify_wf_rec_def (n : int) : ('a list, 'a list list) wf_rec_def = | ||
fun (xs : 'a list, (* input list *) | ||
f : 'a list -> 'a list list) => (* for recursive calls on | ||
strictly shorter lists *) | ||
if n <= size xs | ||
then take n xs :: f (drop n xs) | ||
else []. | ||
(* the actual recursive definition: *) | ||
op chunkify (n : int) : 'a list -> 'a list list = | ||
wf_recur | ||
lt_list_size (* well-founded relation being used *) | ||
[] (* element to be returned if recursive calls | ||
don't respect well-founded relation *) | ||
(chunkify_wf_rec_def n). (* body of recursive definition *) | ||
|
||
lemma chunkify_size (n : int, xs : 'a list) : | ||
1 <= n => size (chunkify n xs) = size xs %/ n. | ||
proof. | ||
move => ge1_n; move : xs. | ||
apply (wf_ind lt_list_size). (* use well-founded induction on lt_list_size *) | ||
apply wf_lt_list_size. | ||
rewrite /chunkify => /= xs IH. | ||
rewrite wf_recur 1:wf_lt_list_size. | ||
rewrite {1}/chunkify_wf_rec_def. (* only need to rewrite at top-level *) | ||
case (n <= size xs) => [le_n_size_xs | not_le_n_size_xs]. | ||
(* first case *) | ||
rewrite lt_list_sizeP. | ||
have lt_size_drop : size (drop n xs) < size xs by rewrite size_drop /#. | ||
rewrite lt_size_drop /= IH 1:lt_list_sizeP //. | ||
rewrite size_drop 1:/# ler_maxr 1:/#. | ||
have {2}-> : size xs = n + (size xs - n) by smt(). | ||
rewrite (divzDl n) 1:dvdzz divzz /#. | ||
(* second case *) | ||
smt(size_ge0 ltr_normr). | ||
qed. |
Oops, something went wrong.