Files
lean4/tests/elab/subexpr.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

22 lines
634 B
Lean4

import Lean
open Lean.SubExpr
def ps := [#[], #[0], #[1], #[0,1], #[1,0] , #[0,0], #[1,2,3]]
theorem Pos.roundtrip :
true = ps.all fun x => x == (Pos.toArray <| Pos.ofArray <| x)
:= by native_decide
theorem Pos.append_roundtrip :
true = (List.all
(ps.flatMap fun p => ps.map fun q => (p,q))
(fun (x,y) => (x ++ y) == (Pos.toArray <| (Pos.append (Pos.ofArray x) (Pos.ofArray y))))
) := by native_decide
theorem Pos.stringRoundtrip :
true = ps.all (fun p =>
let x := Pos.ofArray p
some x == (Except.toOption $ Pos.fromString? $ Pos.toString $ x)
) := by native_decide
#guard Pos.toString Nat.zero == "/"