lean4 icon indicating copy to clipboard operation
lean4 copied to clipboard

fix: make Hoare `Triple` universe-polymorphic in its assertion type

Open sgraf812 opened this issue 5 months ago • 2 comments

This PR lets a Hoare Triple use an assertion type Pred at a universe independent of the program's value type, so specifications can quantify over assertions like σ → Prop while values stay at Type 0.

Triple coupled Value, Pred, and EPred to one universe (via m : Type u → Type v), forcing Pred down to the value universe. The structure never uses m, so it now takes four independent universes {Prog} {Value} {Pred} {EPred} directly, matching the WP class; m is reintroduced only for the monad-specific lemmas. The pointwise-entailment lemmas le_iff_forall_le, le_of_forall_le, and top_le_of_forall_top_le are generalized to independent state and assertion universes, and the StateT specs get/set/modifyGet are scoped to an independent assertion universe.

Having vcgen exploit this over an abstract assertion universe is a follow-up that is intentionally not included here: vcgen's state-introduction backward rule le_of_forall_le then produces a level constraint max ?u ?v =?= <lit> that the Sym pattern matcher's structural level unifier (isLevelDefEqS) leaves unsolved, even though the full isLevelDefEq accepts it. That fix belongs in Sym/Pattern.lean (separate owner).

sgraf812 avatar Jun 24 '26 10:06 sgraf812

Reference manual CI status:

  • ❗ Reference manual CI can not be attempted yet, as the nightly-testing-2026-06-24 tag does not exist there yet. We will retry when you push more commits. If you rebase your branch onto nightly-with-manual, reference manual CI should run now. You can force reference manual CI using the force-manual-ci label. (2026-06-24 11:26:34)

leanprover-bot avatar Jun 24 '26 11:06 leanprover-bot

Mathlib CI status (docs):