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

62 lines
1.2 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Lean
set_option warn.sorry false
def f [Add α] (a : α) := a + a
abbrev id' (a : α) := a
abbrev addNat : Add Nat := ⟨Nat.add⟩
set_option pp.explicit true
/--
trace: a b : Nat
⊢ @Eq Nat (@f Nat (@id' (Add Nat) addNat) a) b
---
trace: a b : Nat
⊢ @Eq Nat (@f Nat addNat a) b
-/
#guard_msgs in
example : @f _ (id' addNat) a = id b := by
dsimp [id']
trace_state -- `id'` was not unfolded because it is part of an instance
dsimp +instances [id']
trace_state
sorry
/--
trace: a b : Nat
⊢ @Eq Nat (@f Nat addNat a) b
-/
#guard_msgs in
set_option backward.dsimp.instances true in
example : @f _ (id' addNat) a = id b := by
dsimp [id']
trace_state
sorry
set_option linter.unusedSimpArgs false
/--
trace: a b : Nat
⊢ @Eq Nat (@f Nat (@id' (Add Nat) addNat) a) b
---
trace: a b : Nat
⊢ @Eq Nat (@f Nat addNat a) b
-/
#guard_msgs in
example : @f _ (id' addNat) a = id b := by
simp [id']
trace_state -- `id'` was not unfolded because it is part of an instance
simp +instances [id']
trace_state
sorry
/--
trace: a b : Nat
⊢ @Eq Nat (@f Nat addNat a) b
-/
#guard_msgs in
set_option backward.dsimp.instances true in
example : @f _ (id' addNat) a = id b := by
simp [id']
trace_state
sorry