Skip to content

Conversation

@leodemoura
Copy link
Member

This PR adds a new suggestion to finish?. It now generates the grind tactic script as before, and a finish only tactic. Example:

/--
info: Try these:
  [apply]
    instantiate only [findIdx, insert, = mem_indices_of_mem]
    instantiate only [= getElem?_neg, = getElem?_pos]
    cases #1bba
    · instantiate only [findIdx]
    · instantiate only
      instantiate only [= HashMap.mem_insert, = HashMap.getElem_insert]
  [apply] finish only [findIdx, insert, = mem_indices_of_mem, = getElem?_neg, = getElem?_pos, = HashMap.mem_insert,
    = HashMap.getElem_insert, #1bba]
-/
example (m : IndexMap α β) (a : α) (b : β) :
    (m.insert a b).findIdx a = if h : a ∈ m then m.findIdx a else m.size := by
  grind => finish?

This PR adds a new suggestion to `finish?`. It now generates the
`grind` tactic script as before, and a `finish only` tactic.
Example:
```lean
/--
info: Try these:
  [apply] ⏎
    instantiate only [findIdx, insert, = mem_indices_of_mem]
    instantiate only [= getElem?_neg, = getElem?_pos]
    cases #1bba
    · instantiate only [findIdx]
    · instantiate only
      instantiate only [= HashMap.mem_insert, = HashMap.getElem_insert]
  [apply] finish only [findIdx, insert, = mem_indices_of_mem, = getElem?_neg, = getElem?_pos, = HashMap.mem_insert,
    = HashMap.getElem_insert, #1bba]
-/
example (m : IndexMap α β) (a : α) (b : β) :
    (m.insert a b).findIdx a = if h : a ∈ m then m.findIdx a else m.size := by
  grind => finish?
```
@leodemoura leodemoura requested a review from kim-em as a code owner October 31, 2025 06:38
@leodemoura leodemoura added the changelog-tactics User facing tactics label Oct 31, 2025
@leodemoura leodemoura enabled auto-merge October 31, 2025 06:38
@leodemoura leodemoura changed the title fear: finish? produces finish only suggestion feat: finish? produces finish only suggestion Oct 31, 2025
It is panicing, but it is not due to this PR
@leodemoura leodemoura added this pull request to the merge queue Oct 31, 2025
Merged via the queue into master with commit 16d0005 Oct 31, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants