This PR prevents `exact?` and `apply?` from suggesting tactics that correspond to correct proofs but do not elaborate, and it allows these tactics to suggest `expose_names` when needed. These tactics now indicate that a non-compiling term was generated but do not suggest that that term be inserted. `exact?` also no longer suggests that the user try `apply?` if no partial suggestions were found. This addresses part of #5407 but does not achieve the exact expected behavior therein (due to #6122).
38 lines
1,021 B
Text
38 lines
1,021 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 ?_
|
|
---
|
|
info: found a partial proof, but the corresponding tactic failed:
|
|
refine r.trans ?_ ?_
|
|
---
|
|
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?
|