Skip to content

Commit 6c03674

Browse files
oskgostrub
authored andcommitted
Make allperms_r opaque to work around #334
Add explicit unfolding lemmas and simplification hints to restore definitional transparency for proofs.
1 parent ecb3395 commit 6c03674

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

theories/algebra/Perms.ec

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@ require import AllCore List IntDiv Binomial Ring StdOrder.
33
(*---*) import IntID IntOrder.
44

55
(* -------------------------------------------------------------------- *)
6-
op allperms_r (n : unit list) (s : 'a list) : 'a list list =
7-
with n = [] => [[]]
8-
with n = x::n => flatten (
9-
map (fun x => map ((::) x) (allperms_r n (rem x s))) (undup s)).
6+
op [smt_opaque] allperms_r (n : unit list) (s : 'a list) : 'a list list =
7+
with n = [] =>
8+
[[]]
9+
with n = x :: n =>
10+
flatten (map (fun x => map ((::) x) (allperms_r n (rem x s))) (undup s)).
1011

12+
lemma allperms_r0 (s : 'a list) :
13+
allperms_r [] s = [[]]
14+
by done.
15+
16+
lemma allperms_rS (x : unit) (n : unit list) (s : 'a list) :
17+
allperms_r (x :: n) s = flatten (
18+
map (fun x => map ((::) x) (allperms_r n (rem x s))) (undup s))
19+
by done.
20+
21+
(* -------------------------------------------------------------------- *)
1122
op allperms (s : 'a list) = allperms_r (nseq (size s) tt) s.
1223
1324
(* -------------------------------------------------------------------- *)

0 commit comments

Comments
 (0)