Skip to content

feat: add SPred and PostCond entailment lemmas#13582

Merged
sgraf812 merged 1 commit intomasterfrom
sg/spred-entails-lemmas
Apr 30, 2026
Merged

feat: add SPred and PostCond entailment lemmas#13582
sgraf812 merged 1 commit intomasterfrom
sg/spred-entails-lemmas

Conversation

@sgraf812
Copy link
Copy Markdown
Contributor

This PR adds several entailment-related lemmas to Std.Do.SPred and Std.Do.PostCond, intended for goal-decomposition during program verification proof automation.

  • SPred.down_pure_nil and SPred.apply_pure_cons (existing rfl lemmas) become @[simp, grind =]. Drops the now-redundant pure_cons argument from simp in conjunction_apply.
  • New SPred.entails_nil_intro and SPred.entails_nil_pure_intro: introduction forms for entails at SPred [], mirroring the existing entails_cons_intro.
  • New SPred.down_pure_intro: derive (pure φ).down from φ.
  • New SPred.apply_pure_cons_entails_l/_r: peel a state argument from pure (σ::σs) φ s on either side of ⊢ₛ.
  • New Std.Do.ExceptConds.entails.pure: closes any ⊢ₑ goal at PostShape.pure, where ExceptConds.entails reduces to True.

This PR adds several entailment-related lemmas to `Std.Do.SPred` and
`Std.Do.PostCond`, intended for goal-decomposition during program
verification proof automation.

- `SPred.down_pure_nil` and `SPred.apply_pure_cons` (existing `rfl`
  lemmas) become `@[simp, grind =]`. Drops the now-redundant `pure_cons`
  argument from `simp` in `conjunction_apply`.
- New `SPred.entails_nil_intro` and `SPred.entails_nil_pure_intro`:
  introduction forms for `entails` at `SPred []`, mirroring the existing
  `entails_cons_intro`.
- New `SPred.down_pure_intro`: derive `(pure φ).down` from `φ`.
- New `SPred.apply_pure_cons_entails_l`/`_r`: peel a state argument
  from `pure (σ::σs) φ s` on either side of `⊢ₛ`.
- New `Std.Do.ExceptConds.entails.pure`: closes any `⊢ₑ` goal at
  `PostShape.pure`, where `ExceptConds.entails` reduces to `True`.
@sgraf812 sgraf812 added the changelog-library Library label Apr 30, 2026
@sgraf812 sgraf812 changed the title feat(std/do): add SPred and PostCond entailment lemmas feat: add SPred and PostCond entailment lemmas Apr 30, 2026
@sgraf812 sgraf812 enabled auto-merge April 30, 2026 06:21
@sgraf812 sgraf812 added this pull request to the merge queue Apr 30, 2026
Merged via the queue into master with commit 906d9cf Apr 30, 2026
24 of 25 checks passed
@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 Apr 30, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 2b5d154a4cfbd4ab1a01a2c74a95172a2c1969a4 --onto 0a6c31520b2ebaa6e71227454b46ebfb4986ae7b. You can force Mathlib CI using the force-mathlib-ci label. (2026-04-30 07:08:51)

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 2b5d154a4cfbd4ab1a01a2c74a95172a2c1969a4 --onto 3fc99eef102549c743c6c63547983319bfae6f01. You can force reference manual CI using the force-manual-ci label. (2026-04-30 07:08:53)

@sgraf812 sgraf812 deleted the sg/spred-entails-lemmas branch April 30, 2026 08:37
sgraf812 added a commit that referenced this pull request Apr 30, 2026
Renames `down_apply_pure_elim` to `down_pure_intro` and relocates it under
the `# Pure` section of `DerivedLaws.lean`, matching #13582 as merged.
Reverts the six `Invariant.withEarlyReturn`/`withEarlyReturnNewDo`
variants to `abbrev` and reverts `Std/Data/String/ToNat.lean` to its
pre-PR state, matching the final form of #13583. Updates the local
`VCGen.lean` reference to the renamed `SPred.down_pure_intro` lemma and
restores `mkFreshPair_triple` to legacy `mvcgen -elimLets +trivial` (it
remains blocked under `mvcgen'`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-library Library 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.

2 participants