Skip to content

Commit

Permalink
fix adaptation note
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-em committed Jan 5, 2025
1 parent 189ebbf commit 7a6030b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions Plausible/Gen.lean
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,14 @@ def elements (xs : List α) (pos : 0 < xs.length) : Gen α := do
return xs[x]


/-!
adaptation_note
Due to an error in `nightly-2025-01-04`, we temporarily need `open Classical in` here,
and `(α := α)` at the call site of `List.perm_insertIdx`. Both should be removed after `nightly-2025-01-05` is available.
-/
open List in
open Classical in
/-- Generate a random permutation of a given list. -/
def permutationOf : (xs : List α) → Gen { ys // xs ~ ys }
| [] => pure ⟨[], Perm.nil⟩
| x::xs => do
let ⟨ys, h1⟩ ← permutationOf xs
let ⟨n, _, h3⟩ ← up <| choose Nat 0 ys.length (by omega)
return ⟨insertIdx n x ys, Perm.trans (Perm.cons _ h1) (List.perm_insertIdx (α := α) _ _ h3).symm⟩
return ⟨insertIdx n x ys, Perm.trans (Perm.cons _ h1) (List.perm_insertIdx _ _ h3).symm⟩

/-- Given two generators produces a tuple consisting out of the result of both -/
def prodOf {α : Type u} {β : Type v} (x : Gen α) (y : Gen β) : Gen (α × β) := do
Expand Down
2 changes: 1 addition & 1 deletion lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:nightly-2025-01-04
leanprover/lean4:nightly-2025-01-05

0 comments on commit 7a6030b

Please sign in to comment.