Skip to content

feat: add Triple.observe#14034

Merged
sgraf812 merged 1 commit into
masterfrom
triple-rotate-pre
Jun 17, 2026
Merged

feat: add Triple.observe#14034
sgraf812 merged 1 commit into
masterfrom
triple-rotate-pre

Conversation

@sgraf812

@sgraf812 sgraf812 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This PR adds the Hoare triple lemma Triple.observe to Std.Do. It proves a triple for prog from a specification of a stateless program obs: observing the postcondition Q of obs (via h) and using Q to establish wp⟦prog⟧ Post (via hgoal) yields ⦃Pre⦄ prog ⦃Post⦄. The premise hp requires obs to be stateless: its successful runs leave the state unchanged, which holds for every program of a stateless monad such as Except.

This supports specifications written in the object language, where a programmatic precondition such as (pre x).holds appears as a triple hypothesis, which mvcgen then steps through. Tests exercise the pattern for unfoldable and opaque Except programs.

@sgraf812 sgraf812 added the changelog-library Library label Jun 12, 2026
@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, 2026
@mathlib-lean-pr-testing

mathlib-lean-pr-testing Bot commented Jun 12, 2026

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 aa2317ae0bf993eabeefe5aad010a90a83e54287 --onto 659e8bb858995b0a1ada239c5b3819c8f8f2772f. You can force Mathlib CI using the force-mathlib-ci label. (2026-06-12 19:51:40)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase aa2317ae0bf993eabeefe5aad010a90a83e54287 --onto 4792cd22887c8b529a351f6563b693426ff2a8f8. You can force Mathlib CI using the force-mathlib-ci label. (2026-06-17 09:49:17)

@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 aa2317ae0bf993eabeefe5aad010a90a83e54287 --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force reference manual CI using the force-manual-ci label. (2026-06-12 19:51:42)

@sgraf812 sgraf812 force-pushed the triple-rotate-pre branch from 876e081 to 4fb7ea2 Compare June 17, 2026 09:08
@sgraf812 sgraf812 changed the title feat: add Triple.post_imp_elim and Triple.rotate_pre feat: add Triple.observe Jun 17, 2026
@sgraf812 sgraf812 enabled auto-merge June 17, 2026 09:20
@sgraf812 sgraf812 added this pull request to the merge queue Jun 17, 2026
Merged via the queue into master with commit 8233528 Jun 17, 2026
19 checks passed
@sgraf812 sgraf812 deleted the triple-rotate-pre branch June 17, 2026 19:16
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