Files
lean4/tests/elab/10564.lean
Garmelon 08eb78a5b2 chore: switch to new test/bench suite (#12590)
This PR sets up the new integrated test/bench suite. It then migrates
all benchmarks and some related tests to the new suite. There's also
some documentation and some linting.

For now, a lot of the old tests are left alone so this PR doesn't become
even larger than it already is. Eventually, all tests should be migrated
to the new suite though so there isn't a confusing mix of two systems.
2026-02-25 13:51:53 +00:00

33 lines
1.0 KiB
Lean4

import Std.Tactic.Do
open Std.Do
set_option mvcgen.warning false
structure Supply where
counter : Nat
limit : Nat
property : counter limit
def mkFreshN2 (n : Nat) : ExceptT Char (EStateM String Supply) (List Nat) := do
let mut acc := #[]
for _ in [:n] do
let supply get
if h : supply.counter = supply.limit then
throwThe String s!"Supply exhausted: {supply.counter} = {supply.limit}"
else
let n := supply.counter
have := supply.property
set {supply with counter := n + 1, property := by omega}
acc := acc.push n
pure acc.toList
theorem mkFreshN2_spec2 (n : Nat) :
True
mkFreshN2 n
postfun r => r.Nodup, fun _ => False, fun _msg state => state.counter = state.limit := by
mvcgen [mkFreshN2] invariants
· postfun xs, acc state => ( n acc, n < state.counter) acc.toList.Nodup,
fun _ => False,
fun _msg state => state.counter = state.limit
with grind