lean4-htt/tests/elab/delabOverApp.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

41 lines
958 B
Text

/-!
Tests for delaborating over-applied functions.
For example, checking to see that the algorithm for app unexpanders handles over-applications.
-/
/-!
Technically these are not examples of overapplied functions,
but in principle these are two-argument functions that return functions.
-/
def add (f g : Nat → Nat) : Nat → Nat := fun x => f x + g x
def mul (f g : Nat → Nat) : Nat → Nat := fun x => f x * g x
variable (f g : Nat → Nat)
infixl:65 " +' " => add
/-!
Checking the app unexpander that was generated by the `infixl` command works when overapplied.
-/
#check f +' g
#check (f +' g) 1
@[app_unexpander mul]
def unexpandAdd : Lean.PrettyPrinter.Unexpander
| `($_ $f $g) => `($f * $g)
| _ => throw ()
/-!
Checking the app unexpander when both applied and overapplied
-/
#check mul f g
#check mul f g 1
/-!
Make sure pp.explicit turns off app unexpanders
-/
section
set_option pp.explicit true
#check mul f g
#check mul f g 1
end