lean4-htt/tests/lean/run/3922.lean
Kyle Miller 41d310ab39
fix: solveByElim would add symm hypotheses to local context and make impossible-to-elaborate terms (#3962)
Rather than adding symm hypotheses to the local context, it now adds
them to the list of hypotheses derived from the local context.

This is not ideal for performance reasons, but it at least closes #3922.

In the future, solveByElim could maintain its own cache of facts that it
updates whenever it does intro.
2024-04-22 04:13:22 +00:00

37 lines
980 B
Text

/-!
# Issue 3922
The `apply?` tactic would apply `symm` to every hypothesis in the local context,
leading to these new hypotheses being included in the term even if they weren't used.
They also created unelaboratable terms such as `?_ (id (r.symm h₂))`.
-/
set_option linter.unusedVariables false
-- set up a binary relation
axiom r : Nat → Nat → Prop
-- that is symmetric
axiom r.symm {a b : Nat} : r a b → r b a
-- and has some other property
axiom r.trans {a b c : Nat} : r a b → r b c → r a c
/--
info: Try this: refine r.symm ?a✝
---
info: Try this: refine r.trans ?a✝ ?a✝¹
---
warning: declaration uses 'sorry'
-/
#guard_msgs (ordering := sorted) in
example (a b c : Nat) (h₁ : r b a) (h₂ : r b c) : r c a := by
apply?
-- now attach the `symm` attribute to `r.symm`
attribute [symm] r.symm
/-- info: Try this: exact r.trans (id (r.symm h₂)) h₁ -/
#guard_msgs in
example (a b c : Nat) (h₁ : r b a) (h₂ : r b c) : r c a := by
apply?