lean4-htt/tests/elab/sym_getMaxFVar.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
960 B
Text

import Lean.Meta.Sym
open Lean Meta Sym
open Internal
def checkMaxFVar (e : Expr) (x : Expr) : SymM Unit := do
let some fvarId ← getMaxFVar? e | unreachable!
assert! x.fvarId! == fvarId
def test1 : MetaM Unit := do
let nat := mkConst ``Nat
withLocalDeclD `x nat fun x => do
let m₁ ← mkFreshExprMVar nat
withLocalDeclD `y nat fun y => do
let m₂ ← mkFreshExprMVar nat
withLocalDeclD `z nat fun z => do
SymM.run do
let x ← shareCommon x
let y ← shareCommon y
let z ← shareCommon z
let m₁ ← shareCommon m₁
let m₂ ← shareCommon m₂
let f ← mkConstS `f
let e₁ ← mkAppS f x
checkMaxFVar e₁ x
let e₂ ← mkAppS e₁ m₁
checkMaxFVar e₂ x
let e₂ ← mkAppS e₁ m₂
checkMaxFVar e₂ y
let e₃ ← mkAppS e₂ (← mkProjS ``Prod 0 (← mkAppS f z))
checkMaxFVar e₃ z
let e₄ ← mkAppS f (← shareCommon (mkNatLit 3))
assert! (← getMaxFVar? e₄).isNone
#eval test1