Skip to content

Conversation

@sgraf812
Copy link
Contributor

@sgraf812 sgraf812 commented Jun 11, 2025

This PR implements a finally section following a (potentially empty) where block. where ... finally opens a tactic sequence block in which the goals are the unassigned metavariables from the definition body and its auxiliary definitions that arise from use of let rec and where.

This can be useful for discharging multiple proof obligations in the definition body by a single invocation of a tactic such as all_goals:

example (i j : Nat) (xs : Array Nat) (hi : i < xs.size) (hj: j < xs.size) :=
  match i with
  | 0 => x
  | _ => xs[i]'?_ + xs[j]'?_
where x := 13
finally all_goals assumption

@sgraf812 sgraf812 force-pushed the sg/obligations branch 2 times, most recently from 9bcae65 to 3ac3c81 Compare June 12, 2025 14:21
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jun 12, 2025
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Jun 12, 2025

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 2629921c0173f6bb8dccc9f0b74433c362b4d009 --onto 0a9c24649767dea857a388e5385b7ae94bfd0185. You can force Mathlib CI using the force-mathlib-ci label. (2025-06-12 14:54:05)
  • ✅ Mathlib branch lean-pr-testing-8723 has successfully built against this PR. (2025-06-12 16:30:45) View Log
  • ✅ Mathlib branch lean-pr-testing-8723 has successfully built against this PR. (2025-06-20 16:53:19) View Log

@sgraf812 sgraf812 marked this pull request as ready for review June 12, 2025 14:55
@sgraf812 sgraf812 added the changelog-language Language features and metaprograms label Jun 12, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jun 12, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jun 12, 2025
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Jun 12, 2025
@sgraf812 sgraf812 force-pushed the sg/obligations branch 2 times, most recently from 9edb22b to 65f7853 Compare June 20, 2025 14:29
@sgraf812 sgraf812 changed the title feat: obligations_by section for def, where and let rec feat: where ... finally section to assign leftover goals Jun 20, 2025
@sgraf812 sgraf812 enabled auto-merge June 20, 2025 15:37
@sgraf812 sgraf812 added this pull request to the merge queue Jun 20, 2025
auto-merge was automatically disabled June 20, 2025 15:57

Pull Request is not mergeable

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Jun 20, 2025
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Jun 20, 2025
Merged via the queue into master with commit cf527e0 Jun 20, 2025
16 checks passed
@sgraf812 sgraf812 deleted the sg/obligations branch June 20, 2025 16:42
wkrozowski pushed a commit to wkrozowski/lean4 that referenced this pull request Jun 24, 2025
…r#8723)

This PR implements a `finally` section following a (potentially empty)
`where` block. `where ... finally` opens a tactic sequence block in
which the goals are the unassigned metavariables from the definition
body and its auxiliary definitions that arise from use of `let rec` and
`where`.

This can be useful for discharging multiple proof obligations in the
definition body by a single invocation of a tactic such as `all_goals`:
```lean
example (i j : Nat) (xs : Array Nat) (hi : i < xs.size) (hj: j < xs.size) :=
  match i with
  | 0 => x
  | _ => xs[i]'?_ + xs[j]'?_
where x := 13
finally all_goals assumption
```

---------

Co-authored-by: Sebastian Graf <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-mathlib CI has verified that Mathlib builds against this PR changelog-language Language features and metaprograms toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants