Formalisation of the statements of all Bluebell rules except Program WP rules and Derived WP rules#268
Formalisation of the statements of all Bluebell rules except Program WP rules and Derived WP rules#268Coda-Coda wants to merge 163 commits into
Conversation
- Follow the naming convention more closely (not dogmatic, feel free to disregard in the future):
+ defs are whateverThisCaseIsCalled
+ lemmas are in_this_case
+ lemmas are named e.g. like this: `lemma f_eq_add_of_P (h : P) : f a = a + b`` (i.e. conclusion_of_assumptions) where conclusion reads symbols left to right and never mentions argument names
- Do not rely on autoimplicits, e.g. mention `{a b}`` in `lemma foo {a b} : a + 1 = b``
- `μ = ν.cast _` instead of the ugly `@Measure.map ...`
- comments 'tied' to a def/theorem should be /-- written like this -/, this style with /-- attaches the comment to the def when you hover it
…s to remove some ugly casts - e.g. you want `Preorder (PSpace Ω)`, but Preorder is defined as a 'type'-class, so there's a cast injected here. - Hit some proofs with a big stick.
Ferinko/measure my space r
…is-lean into measureMySpace
Assisted-by: Aristotle (Harmonic)
… ∑' (b : B), μ (a, b)) 1`
Assisted-by: Aristotle (Harmonic)
…... 1` Assisted-by: Aristotle (Harmonic)
…Sum ... 1 := ...` Improving clarity, so that they read more like the paper.
Note that the paper has a typo in C-DIST-PROJ. In the paper's rendition of the rule, the `μ` in the modality and the one in the assertion are meant to be different variables. In other words, in the paper, both occurences of `μ(x)` should not be the same `μ` as the two subscript `μ`s following `𝒞`. This is why we have `μ₁` and `μ₂` here.
Co-authored-by: Julian Sutherland <julian@nethermind.io> Co-authored-by: Daniel Britten <daniel.britten@nethermind.io>
🤖 PR Summary
Failed to generate AI summary. Please check the per-file summaries and statistics below. Statistics
Lean Declarations ✏️ Removed: 177 declaration(s)
…and 27 more not listed. ✏️ Added: 296 declaration(s)
…and 146 more not listed.
✅ Removed: 29 `sorry`(s)
❌ Added: 25 `sorry`(s)
Coverage Notes
Partially Analyzed Files
📄 **Per-File Summaries**
Last updated: 2026-07-03 04:49 UTC. |
There was a problem hiding this comment.
🤖 AI Review
Overall Summary:
TL;DR: The PR successfully completes a major architectural transition to a new OURA-based framework by deleting legacy CMRA code and introducing clean algebraic foundations. However, the introduction of over 30 unproven theorems (sorry) in the core separation logic and missing concrete program semantics necessitates major revisions.
Mechanical Pre-Check Results: Mechanical pre-checks flagged 34 instances of the sorry escape hatch introduced in src/Bluebell/Assertion.lean for core separation logic rules. Additionally, src/Bluebell/Assertion.lean (2267 lines) and src/Bluebell/MeasureOnSpace.lean (1696 lines) exceed the 1500-line file size limit.
Checklist Coverage: No explicit specification checklist was provided for this PR.
Cross-File Issues: The composition chain correctly links the algebraic model OURA through MeasureOnSpace.lean into the separation logic assertions in Assertion.lean. However, the composition breaks at the program logic level: concrete program weakest precondition rules are left as unverified TODOs, meaning the abstract Hoare logic cannot be applied to concrete probabilistic program evaluations. The extensive use of sorry in foundational rules also transitively compromises the soundness of downstream logic derivations.
Key Lean 4 / Mathlib Issues:
- Hard Rule Violation: 34 instances of
sorryare used to stub out proofs for core logical inference rules (e.g.,Sure_Merge,Sure_And_Star,C_Frame,WP_Nest). This systematically bypasses the Lean kernel's verifier. (src/Bluebell/Assertion.lean:1239-2241 (multiple locations)) - Overlapping
FunLikeinstances. A generic instance forFunLike (Assertion M) M Propis immediately followed by a specialized instance forFunLike (bProp I Var Val) .... SincebPropis an abbreviation forAssertion, these instances overlap exactly and will cause typeclass resolution issues. (src/Bluebell/Assertion.lean:191-197) - Duplicated namespace for the UCMRA instance resulting in the fully qualified name
OrderedUnitalResourceAlgebra.OrderedUnitalResourceAlgebra.instUCMRA. This triggers a Lean 4 compiler warning. (src/Bluebell/OURA.lean:419-422) - The instance
Valid (I → M)unnecessarily inherits the[OrderedUnitalResourceAlgebra M]typeclass because it is declared inside a section where this variable is active. This overly restricts the pointwiseValidinstance. (src/Bluebell/OURA.lean:94-96) - The formalization lacks WP rules for concrete program constructs (e.g., Skip, Seq, Assign, Samp), which are left as
TODO: Shallow embedding. This leaves the abstract separation logic with no concrete programming language to evaluate. (src/Bluebell/Assertion.lean:1633-1662)
Overall Verdict: Changes Requested
🔍 **Mechanical Pre-Check Results**
Escape hatches introduced in this PR (triggers hard verdict rule):
sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule SURE-MERGE proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule SURE-AND-STAR proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule PROD-SPLIT proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-FRAME proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-UNIT-L proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-UNIT-L proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-ASSOC proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-UNASSOC proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-AND proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-SKOLEM proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule SURE-STR-CONVEX proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-FOR-ALL proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-PURE proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule WP-NEST proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule WP-CONJ proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-WP-SWAP proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule SURE-SUB proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule DIST-FUN proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule DIRAC-DUP proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule DIRAC-SUPP proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule PROD-UNSPLIT proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-FUSE proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-SWAP proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule DIST-CONVEX proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-SURE-PROJ proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-SURE-PROJ-MANY proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-EXTRACT proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule C-DIST-PROJ proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule RL-UNARY proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule RL-EQ-DIST proof (spec not yet reviewed)sorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule RL-CONVEX proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule RL-SURE-MERGE proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule RL-SURE-MERGE proofsorryintroduced insrc/Bluebell/Assertion.lean:sorry -- TODO: Rule COUPLING proof- Large file:
src/Bluebell/Assertion.leanis 2267 lines (exceeds 1500-line lint threshold) - Large file:
src/Bluebell/MeasureOnSpace.leanis 1696 lines (exceeds 1500-line lint threshold)
Pre-existing escape hatches in touched files (context only, does not affect verdict):
sorryinsrc/Bluebell/Assertion.leanline 1239:sorry -- TODO: Rule SURE-MERGE proofsorryinsrc/Bluebell/Assertion.leanline 1248:sorry -- TODO: Rule SURE-AND-STAR proofsorryinsrc/Bluebell/Assertion.leanline 1257:sorry -- TODO: Rule PROD-SPLIT proofsorryinsrc/Bluebell/Assertion.leanline 1336:sorry -- TODO: Rule C-FRAME proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 1342:sorry -- TODO: Rule C-UNIT-L proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 1348:sorry -- TODO: Rule C-UNIT-L proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 1356:sorry -- TODO: Rule C-ASSOC proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 1362:sorry -- TODO: Rule C-UNASSOC proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 1369:sorry -- TODO: Rule C-AND proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 1375:sorry -- TODO: Rule C-SKOLEM proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 1497:sorry -- TODO: Rule SURE-STR-CONVEX proofsorryinsrc/Bluebell/Assertion.leanline 1503:sorry -- TODO: Rule C-FOR-ALL proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 1519:sorry -- TODO: Rule C-PURE proofsorryinsrc/Bluebell/Assertion.leanline 1585:sorry -- TODO: Rule WP-NEST proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 1618:sorry -- TODO: Rule WP-CONJ proofsorryinsrc/Bluebell/Assertion.leanline 1629:sorry -- TODO: Rule C-WP-SWAP proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 1953:sorry -- TODO: Rule SURE-SUB proofsorryinsrc/Bluebell/Assertion.leanline 1965:sorry -- TODO: Rule DIST-FUN proofsorryinsrc/Bluebell/Assertion.leanline 1974:sorry -- TODO: Rule DIRAC-DUP proofsorryinsrc/Bluebell/Assertion.leanline 1983:sorry -- TODO: Rule DIRAC-SUPP proofsorryinsrc/Bluebell/Assertion.leanline 1992:sorry -- TODO: Rule PROD-UNSPLIT proofsorryinsrc/Bluebell/Assertion.leanline 2012:sorry -- TODO: Rule C-FUSE proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 2018:sorry -- TODO: Rule C-SWAP proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 2104:sorry -- TODO: Rule DIST-CONVEX proofsorryinsrc/Bluebell/Assertion.leanline 2112:sorry -- TODO: Rule C-SURE-PROJ proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 2120:sorry -- TODO: Rule C-SURE-PROJ-MANY proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 2131:sorry -- TODO: Rule C-EXTRACT proofsorryinsrc/Bluebell/Assertion.leanline 2144:sorry -- TODO: Rule C-DIST-PROJ proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 2192:sorry -- TODO: Rule RL-UNARY proofsorryinsrc/Bluebell/Assertion.leanline 2200:sorry -- TODO: Rule RL-EQ-DIST proof (spec not yet reviewed)sorryinsrc/Bluebell/Assertion.leanline 2207:sorry -- TODO: Rule RL-CONVEX proofsorryinsrc/Bluebell/Assertion.leanline 2213:sorry -- TODO: Rule RL-SURE-MERGE proofsorryinsrc/Bluebell/Assertion.leanline 2228:sorry -- TODO: Rule RL-SURE-MERGE proofsorryinsrc/Bluebell/Assertion.leanline 2241:sorry -- TODO: Rule COUPLING proof
🔗 **Cross-File Analysis**
Cross-File Analysis:
The PR radically restructures the Bluebell project by replacing multiple fragmented logic and algebra files with three core modules: OURA.lean (algebraic structures), MeasureOnSpace.lean (instantiation of resource algebras for probability spaces), and Assertion.lean (the separation logic and rules).
- Composition Chain: The algebraic model
OrderedUnitalResourceAlgebraflows cleanly intoMeasureOnSpace.lean, which builds the concrete modelIndexedPSpPm. This model is then correctly consumed byAssertion.leanto define the base proposition typebPropand its Iris BI (separation logic) instances. The chain successfully wires measure theory to separation logic. - Type-Flow: Types and typeclasses flow correctly across the files. However, in
OURA.lean, theinstUCMRAinstance is wrapped in an extra namespace, resulting in the duplicated nameOrderedUnitalResourceAlgebra.OrderedUnitalResourceAlgebra.instUCMRA. Additionally, the program semantics inwp(hyperTermSemantics) models programs as deterministic functionsPSpPm → PSpPmrather than monadic probabilistic transitions, which is a side-effect of a shallow embedding strategy. - Escape Hatch Impact:
Assertion.leanintroduces over 30sorrys for core logical rules (e.g.,Sure_Merge,Sure_And_Star,C_Frame,C_Fuse,Coupling). Since these are the primitive axioms of the separation logic, any downstream program verification will transitively depend on these unproven soundness claims, critically weakening the verification guarantees of the framework. - Missing Verification: The PR leaves all concrete program weakest precondition rules (
WP_SKIP,WP_SEQ,WP_SAMP, etc.) as commented TODOs. This breaks the composition chain: the abstract separation logic has no concrete programming language to evaluate.
Cross-File Composition Issues:
- Duplicated namespace for the UCMRA instance resulting in the fully qualified name
OrderedUnitalResourceAlgebra.OrderedUnitalResourceAlgebra.instUCMRA. (src/Bluebell/OURA.lean:419-422)- Suggested fix: Remove the
namespace OrderedUnitalResourceAlgebrablock wrapper around the instance or remove theOrderedUnitalResourceAlgebra.prefix from the instance name.
- Suggested fix: Remove the
Axiom/Escape Hatch Impact:
- Over 30 core logical rules in the separation logic are stubbed with
sorry(e.g.,Sure_Merge,Sure_And_Star,C_Frame,WP_Nest,Coupling). This propagates unverified assumptions to any downstream Hoare logic derivations, leaving the logic's soundness largely unproven. (src/Bluebell/Assertion.lean:1235-2245 (multiple locations))- Suggested fix: These axioms must be proven against the
IndexedPSpPmmodel semantics to guarantee the soundness of the Bluebell logic.
- Suggested fix: These axioms must be proven against the
External Dependency Issues: None
Missing Cross-File Verification:
- The formalization lacks WP rules for concrete program constructs (e.g., Skip, Seq, Assign, Samp), which are left as
TODO: Shallow embedding. This breaks the composition chain because the abstract Hoare logic (wp) cannot be applied to concrete probabilistic program evaluations. (src/Bluebell/Assertion.lean:1633-1662)- Suggested fix: Implement the shallow or deep embedding for the specific probabilistic language constructs and formally prove their corresponding WP rules against the core
wpdefinition.
- Suggested fix: Implement the shallow or deep embedding for the specific probabilistic language constructs and formally prove their corresponding WP rules against the core
Cluster: Algebraic Framework and Probability Models (critical)
Do the new OrderedUnitalResourceAlgebra (OURA) and MeasureOnSpace models correctly capture the resource semantics required by the Bluebell logic?
📄 **Review for `src/Bluebell/OURA.lean`**
Analysis:
-
Mathematical Correctness: The file accurately formalizes the algebraic foundations of a separation logic resource model. It defines
ValidandDiscreteCMRAto bridge with Iris's CMRA structure. It introducesOrderedUnitalResourceAlgebra(OURA) as a commutative monoid equipped with a preorder, right-monotone multiplication, and downward-closed validity (a ≤ b → ✓ b → ✓ a). The lifting of OURA to subtypes (subalgebra), dependent products (indexedProduct), and binary products is mathematically sound. The most complex construction, thequotientalgebra, is executed perfectly: it correctly requires compatibility proofs for multiplication (hclo), validity (hvalid), and inequalities (hle), ensuring the resulting quotient structure forms a valid OURA. -
Lean 4 Best Practices: The code is well-written and makes excellent use of modern Lean 4 idioms, including
aesop,grind, and automatic typeclass synthesis for inherited structure fields (e.g., relying onSubtype.preorderinstead of manually definingle). However, there are two minor issues. First, there is a duplicated namespace leading to a compiler warning on line 420. Second, due to Lean 4's section variable auto-inclusion rules, theValid (I → M)instance unintentionally inherits the[OrderedUnitalResourceAlgebra M]typeclass from the section variables, making the instance overly restrictive. -
Ambiguities / Escape Hatches: There are no
sorrys,axioms, or unverified escape hatches in this file. The logic is robustly verified by the kernel.
Verdict: Needs Minor Revisions
Critical Misformalizations: None
Lean 4 / Mathlib Issues:
- The instance
OrderedUnitalResourceAlgebra.instUCMRAis declared inside theOrderedUnitalResourceAlgebranamespace, leading to the duplicated nameOrderedUnitalResourceAlgebra.OrderedUnitalResourceAlgebra.instUCMRA. This triggers a Lean 4 compiler warning. (src/Bluebell/OURA.lean:420)- Suggested fix: Rename the instance to just
instUCMRAto avoid namespace duplication:instance instUCMRA {M : Type*} [ra : OrderedUnitalResourceAlgebra M] : Iris.UCMRA M := { ... }
- Suggested fix: Rename the instance to just
- The instance
Valid (I → M)is declared in a section where[OrderedUnitalResourceAlgebra M]is an active variable. Lean 4's auto-implicit rules will include this typeclass as a parameter becauseMappears in the instance type. This unnecessarily restricts the pointwiseValidinstance to types that areOrderedUnitalResourceAlgebra, whereas it should mathematically apply to any type with just[Valid M]. (src/Bluebell/OURA.lean:94-96)- Suggested fix: Move this instance outside of the section where
variable {I M : Type*} [OrderedUnitalResourceAlgebra M]is declared, so it only depends on the explicitly provided[Valid M].
- Suggested fix: Move this instance outside of the section where
Nitpicks:
- Typo in the docstring for
product: 'instnace' instead of 'instance'. (src/Bluebell/OURA.lean:184)
📄 **Review for `src/Bluebell/MeasureOnSpace.lean`**
Analysis:
Step-by-step analysis BEFORE findings:
(1) What does the changed code do mathematically?
The file constructs the independent join of probability measures and applies it to build a resource algebra. A MeasureOnSpace bundles a σ-algebra and a measure on it. PSpace enforces the measure to be a probability measure. isIndependentProduct (notation r =ᵢ p ⊕ᵢ q) specifies what it means for a probability space to be the independent combination of two others (i.e., its σ-algebra is their join, and the measures factorize on the generating sets).
The file establishes the uniqueness and partial associativity of this independent product using Dynkin's π-λ theorem (MeasurableSpace.induction_on_inter). It then lifts this partial binary operation to a total operation on PSp Ω := WithTop (PSpace Ω), where undefined products result in the ⊤ (invalid) element. This forms an OrderedUnitalResourceAlgebra (OURA), which models resource separation for probability spaces.
Finally, it couples PSp with a Permission OURA (fractional permissions via ℚ≥0), creating PSpPm which represents probabilistic states that are compatible with variable permissions (meaning the σ-algebra does not depend on variables for which the permission is exactly 0).
(2) How do changes relate to the spec checklist?
No spec checklist was provided.
(3) What are the riskiest aspects?
The most mathematically demanding aspects are the proofs of associativity and uniqueness of the independent product. These are handled rigorously using the π-λ theorem to extend independence from the generating sets (intersections of measurable sets from the marginal spaces) to the entire generated σ-algebra. Another potential risk is the use of Classical.choose in PSp.mul via the by_cases tactic. However, this is mathematically sound because the uniqueness of the independent product has been proven, ensuring that any chosen space is propositionally equal to any other valid choice.
(4) Any ambiguities in mathematical intent?
None. The code elegantly and accurately formalizes a separation logic model over continuous probabilistic states by correlating fractional permissions with the observable sub-σ-algebras.
I will list a few minor stylistic nitpicks (such as a spelling error and redefining the supremum of σ-algebras).
Verdict: Needs Minor Revisions
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks:
- Typo in theorem name: 'indepenendentProduct_identity' has an extra 'en'. (
src/Bluebell/MeasureOnSpace.lean:458) - Redundant definition of the supremum of measurable spaces.
MeasurableSpace.sum m₁ m₂is mathematically and structurally identical tom₁ ⊔ m₂(theSuplattice operation forMeasurableSpacein Mathlib). Redefining it is harmless but unidiomatic, as Mathlib already provides algebraic and monotonicity lemmas for⊔. (src/Bluebell/MeasureOnSpace.lean:42-44) - The use of
@[reducible] defis an older Lean 3 idiom. In Lean 4,abbrevis the preferred way to declare reducible definitions. (src/Bluebell/MeasureOnSpace.lean:1406)
📄 **Review for `src/Bluebell/Assertion.lean`**
Analysis:
-
Mathematical Code Summary: The PR adds a new file
src/Bluebell/Assertion.lean, which defines the core probabilistic separation logic assertions (Assertion Mand its specializationbProp). It implements the syntax and semantics for the assertions (e.g.,own,sep,wand,hasDistribution,jointConditioning), proves thatbPropforms an instance of Iris's Boolean Identity (BI) separation logic framework, and states a multitude of specialized Hoare logic and structural derivation rules for this separation logic. -
Riskiest Aspects: The most significant issue is the extensive use of
sorrythroughout the file. There are 34 theorems with stubbed proofs (e.g.,Sure_Merge,Sure_And_Star,WP_Nest,C_WP_Swap, etc.). This systematically bypasses the Lean kernel's verifier, meaning these inference rules are mathematically completely unverified and act effectively as axioms. Furthermore, the typeclassFunLikeis instantiated twice for what is ultimately the same type, which can lead to overlapping instance errors during typeclass resolution. -
Ambiguities in Intent: Given the absence of proofs for many of the rules (like
WP_Conj,C_WP_Swap,RL_Unary, etc.), it is difficult to guarantee that the statement formulations are mathematically sound and lack missing hypotheses or logical errors. -
Checklist mapping: No checklist provided.
Verdict: Changes Requested
Critical Misformalizations: None
Lean 4 / Mathlib Issues:
- Hard Rule Violation — Escape Hatches: The code uses
sorryin 34 distinct declarations (e.g.,Sure_Merge,Sure_And_Star,Prod_Split,C_Frame, etc.) to stub out proofs. This explicitly bypasses Lean's verification kernel. For formal verification PRs, proofs must be completed or explicitly abstracted into documented axioms if representing a theoretical boundary. (src/Bluebell/Assertion.lean:1239-2241)- Suggested fix: Remove
sorryand provide full proofs for all theorems. If proofs are not yet available and this is a WIP, be aware that it cannot be approved for merging until complete.
- Suggested fix: Remove
- Overlapping
FunLikeinstances. You provide a generic instance forFunLike (Assertion M) M Propand immediately follow it with an instance forFunLike (bProp I Var Val) (IndexedPSpPm I Var Val) Prop. SincebPropis just anabbrevforAssertionandIndexedPSpPmsatisfies theOrderedUnitalResourceAlgebraconstraint, these instances overlap exactly and will cause typeclass resolution issues or duplication. (src/Bluebell/Assertion.lean:191-197)- Suggested fix: Remove the specialized instance for
bProp, as the generic instance forAssertion Malready fully covers it:
- Suggested fix: Remove the specialized instance for
-- instance : FunLike (bProp I Var Val) (IndexedPSpPm I Var Val) Prop where
-- coe := fun P => P.carrier
-- coe_injective' := by intro P Q h; aesopNitpicks:
- Non-standard theorem naming conventions. Theorems such as
And_To_Star,Sure_Merge,Dist_Inj, andSure_Eq_Injare named using UpperCamelCase with underscores. Standard Lean 4 idiom dictateslowerCamelCaseorsnake_case(typicallysnake_case) for theorem and lemma names. (src/Bluebell/Assertion.lean:1042-2241) - Defining
wandandbimpwith@[simp]eagerly unfolds these definitions during simplification. In BI and separation logic formalizations (like Iris), connective definitions are usually kept opaque to allow reasoning viaBIlaws rather than unfolding to the raw carrier sets. (src/Bluebell/Assertion.lean:266-281)
Cluster: Legacy Code Cleanup (low)
Does the removal of legacy files cleanly transition the project to the new architecture without leaving dangling references?
📄 **Review for `src/Bluebell.lean`**
Analysis:
The diff modifies the top-level src/Bluebell.lean module to reflect a major architectural transition in the project. It removes 11 legacy imports (such as old CMRA-based definitions and probability theory modules) and replaces them with 3 new core modules: Bluebell.Assertion, Bluebell.OURA, and Bluebell.MeasureOnSpace. Mathematically, this transitions the library's foundation to the new Ordered Unital Resource Algebra (OURA) and the newly structured measure and assertion modules. The changes align with the expected cluster cleanup strategy. Since this is purely a top-level module list update, there is no mathematical logic or complex Lean code directly introduced here, and thus no direct risk of misformalization in this file.
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/Algebra/CMRA.lean`**
Analysis:
- Mathematical changes: The file
src/Bluebell/Algebra/CMRA.leanhas been completely deleted. This aligns with the project's architectural transition from CMRA-based definitions to the new OURA (Ordered Unital Resource Algebra) architecture as described in the cluster context. - Riskiest aspects: The main risk with deleting a file is dangling references in other files that previously imported it (e.g.,
src/Bluebell.lean). However, within the scope of this specific file's diff, the removal itself is clean. - Ambiguities: None.
- Spec checklist: N/A.
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/Algebra/HyperAssertion.lean`**
Analysis:
- What does the changed code do mathematically? The diff completely deletes the file
src/Bluebell/Algebra/HyperAssertion.lean, which contained the legacy CMRA-based implementation of hyper-assertions. This code is being superseded by the new OURA-based architecture. - How do changes relate to the spec checklist? N/A (no checklist provided).
- What are the riskiest aspects? The only risk is if other files still depend on this module, but the cluster context indicates this is part of a broader cleanup where dependencies have been shifted to
Assertion.lean,MeasureOnSpace.lean, andOURA.lean. - Any ambiguities in mathematical intent? None. The deletion is straightforward and intentional.
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/Algebra/PSpPm.lean`**
Analysis:
-
Mathematical Summary: The pull request entirely deletes
src/Bluebell/Algebra/PSpPm.lean. This file previously contained legacy CMRA-based predicated product definitions for probability spaces and permissions (PSpPm,PSpPmRat,IndexedPSpPm, andIndexedPSpPmRat), which have been superseded by the new OURA-based architecture in the project. -
Riskiest Aspects: The main risk with file deletions is leaving dangling module imports or broken references in the rest of the project. However, this is a planned cleanup of legacy architecture, and the system context indicates that these definitions have been safely superseded.
-
Ambiguities: None. The removal of dead code is straightforward and reduces the maintenance surface of the formalization.
-
Spec Checklist: N/A (no checklist provided).
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/Algebra/Permission.lean`**
Analysis:
-
What does the changed code do mathematically? The diff completely deletes
src/Bluebell/Algebra/Permission.lean. This file previously contained legacy definitions for permissions based on Iris'sDFrac(Permission) and rational-based permissions (PermissionRat) usingMultiplicative (α → ℚ≥0). -
How do changes relate to the spec checklist? No spec checklist provided.
-
What are the riskiest aspects? The primary risk with deleting a file is leaving dangling references or breaking downstream imports. However, according to the cluster context, this is a deliberate legacy cleanup transitioning the project from Iris CMRA to the new
OURA(Ordered Unital Resource Algebra) architecture, and its functionality has been superseded. -
Any ambiguities in mathematical intent? None. The deletion of deprecated code is unambiguous.
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/Algebra/Probability.lean`**
Analysis:
The change completely deletes the src/Bluebell/Algebra/Probability.lean file, which contained legacy probability algebra wrappers and definitions like compatiblePerm, PSp, and instances of CMRA for PSp. According to the PR context, this is a legacy code cleanup meant to migrate the architecture to a new OURA-based one. Since the code is being removed entirely and no new definitions or proofs are introduced in this file, there are no mathematical correctness issues, typeclass problems, or Lean idiom violations to review. The removal of this code aligns with the stated goal of the pull request.
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/Core/Indexed.lean`**
Analysis:
- Mathematical Function: The diff entirely removes the
src/Bluebell/Core/Indexed.leanfile, which contained legacy definitions forindexedTuple(a function from aFinset ℕto a typeα) and itsremoveoperation (restricting the tuple to a subset difference). - Riskiest Aspects: The only risk is if other parts of the project still depend on this file. However, according to the review cluster context, this is a planned legacy code cleanup transitioning to a new architecture. If dangling references exist, they will be caught by the compiler at the project level, and there are no direct mathematical risks introduced by removing the file itself.
- Ambiguities: None. The intent to delete the file is clear.
- Checklist: N/A.
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/Logic/JointCondition.lean`**
Analysis:
- What does the changed code do mathematically? The PR deletes the file
src/Bluebell/Logic/JointCondition.lean, which contained legacy definitions for a probability logic modality (jointCondition) and a large number of unimplemented theorems (usingsorry). This deletion is part of a larger cleanup transitioning the project to a new OURA-based architecture. - What are the riskiest aspects? The only risk is if other modules in the project still depend on this file. However, based on the global context and cluster information, this is a clean removal of legacy code that has been superseded by new files (
Assertion.lean,MeasureOnSpace.lean,OURA.lean). - Any ambiguities in mathematical intent? None. The removal of code heavy with
sorrys is unequivocally positive. - Spec checklist mapping: N/A.
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/Logic/Ownership.lean`**
Analysis:
-
Mathematical Summary: The provided diff completely deletes the
src/Bluebell/Logic/Ownership.leanfile. This file previously contained legacy definitions for ownership of indexed probability spaces and permissions (e.g.,ownIndexedTuple,ownIndexedProb,assertSampledFrom) and related hyper-assertions, using an olderCMRAarchitecture. -
Riskiest Aspects: The primary risk with deleting files is leaving dangling references or breaking downstream modules. However, based on the global context and cluster description, this is part of a deliberate 'Legacy Code Cleanup' transitioning the project to a new
OURA-based architecture (usingAssertion.lean,MeasureOnSpace.lean, etc.). If the project compiles after its removal, there is no risk. -
Ambiguities: None. The deletion of the file is straightforward.
-
Relation to Spec: The deletion cleanly removes several legacy definitions and, notably, removes multiple admitted proofs (
sorrys) that existed in the legacy file (e.g.,sampledFrom_inj,sep_assertTrue_iff,sampledFrom_prod).
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/Logic/WeakestPre.lean`**
Analysis:
- Mathematically, the diff completely deletes the
src/Bluebell/Logic/WeakestPre.leanfile, which contained legacy definitions of the weakest precondition (wp) relying onIndexedPSpPmRat. This aligns with the transition to the new OURA-based architecture. - The removal eliminates several incomplete proofs (
sorrys inwp_compandwp_conj), cleanly removing unverified assumptions from the codebase. - Since the file is completely deleted, there are no mathematical misformalizations or Lean 4 idiom violations introduced. The deletion correctly trims legacy code without introducing new code issues.
- No spec checklist provided.
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/ProbabilityTheory/Coupling.lean`**
Analysis:
-
What does the changed code do mathematically? The diff completely removes the
src/Bluebell/ProbabilityTheory/Coupling.leanfile, which contained legacy formalizations of probability couplings for both discrete probability mass functions (PMF) and sub-probability mass functions (SPMF). This included definitions likeIsCoupling,Coupling, and relational liftingLift. -
How do changes relate to the spec checklist? No checklist was provided.
-
What are the riskiest aspects? The primary risk with deleting a file is breaking downstream dependencies. However, based on the cluster context ('Legacy Code Cleanup'), this deletion is expected and intended to transition the project to a new architecture (
Assertion.lean,MeasureOnSpace.lean,OURA.lean), safely removing superseded definitions. -
Any ambiguities in mathematical intent? None. The intent is clearly to deprecate and delete old unused code.
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
📄 **Review for `src/Bluebell/ProbabilityTheory/IndepProduct.lean`**
Analysis:
- Mathematical changes: The PR entirely deletes the
src/Bluebell/ProbabilityTheory/IndepProduct.leanfile. This file contained legacy definitions and incomplete theorems (marked withsorry) relating to the independent product of probability measures and measurable spaces. - Riskiest aspects: The primary risk in deleting a file is breaking downstream dependencies. However, the cluster context indicates this is part of a 'Legacy Code Cleanup', where old CMRA and probability theory definitions are being superseded by the new
OURA-based architecture inAssertion.leanandMeasureOnSpace.lean. - Ambiguities: None. The deletion cleanly removes incomplete code that is no longer needed.
- Checklist: No spec checklist provided.
Verdict: Approved
Critical Misformalizations: None
Lean 4 / Mathlib Issues: None
Nitpicks: None
| assumption | ||
| } | ||
|
|
||
| instance OrderedUnitalResourceAlgebra.instUCMRA |
There was a problem hiding this comment.
🟡 Issue: The instance OrderedUnitalResourceAlgebra.instUCMRA is declared inside the OrderedUnitalResourceAlgebra namespace, leading to the duplicated name OrderedUnitalResourceAlgebra.OrderedUnitalResourceAlgebra.instUCMRA. This triggers a Lean 4 compiler warning.
Suggested fix: Rename the instance to just instUCMRA to avoid namespace duplication: instance instUCMRA {M : Type*} [ra : OrderedUnitalResourceAlgebra M] : Iris.UCMRA M := { ... }
| variable {I M : Type*} [OrderedUnitalResourceAlgebra M] | ||
|
|
||
| instance : MulRightMono M := ⟨fun _ _ _ h ↦ mul_left_mono h⟩ | ||
|
|
There was a problem hiding this comment.
🟡 Issue: The instance Valid (I → M) is declared in a section where [OrderedUnitalResourceAlgebra M] is an active variable. Lean 4's auto-implicit rules will include this typeclass as a parameter because M appears in the instance type. This unnecessarily restricts the pointwise Valid instance to types that are OrderedUnitalResourceAlgebra, whereas it should mathematically apply to any type with just [Valid M].
Suggested fix: Move this instance outside of the section where variable {I M : Type*} [OrderedUnitalResourceAlgebra M] is declared, so it only depends on the explicitly provided [Valid M].
| elim := by intro a b c h i; unfold Function.swap; simp; have := (f i).elim; aesop | ||
| valid_one i := by aesop | ||
| valid_mono x y i := by have := fun i ↦ (f i).valid_mono (x i) (y i); aesop | ||
| valid_mul x := by have := fun i ↦ (f i).valid_mul (x i); aesop |
There was a problem hiding this comment.
💡 Nitpick: Typo in the docstring for product: 'instnace' instead of 'instance'.
Suggested fix: /-- Technically binary product is just an instance of indexed product, but
it is convenient to redefine it -/
| have h₂ : u ⊆ Set.univ := by aesop | ||
| have h₃ : m.1.μ u ≤ m.1.μ Set.univ := measure_mono h₂ | ||
| exact lt_of_le_of_lt (b := 1) (by aesop) (by aesop) | ||
|
|
There was a problem hiding this comment.
💡 Nitpick: Typo in theorem name: 'indepenendentProduct_identity' has an extra 'en'.
Suggested fix: theorem independentProduct_identity [Inhabited Ω] {p : PSpace Ω}
|
|
||
| /-- Note: the sum operation generates the smallest σ-algebra consisting the measurable | ||
| sets in m₁ and m₂. Equivalently, we can also write m₁ ⊔ m₂. -/ | ||
| @[simp] |
There was a problem hiding this comment.
💡 Nitpick: Redundant definition of the supremum of measurable spaces. MeasurableSpace.sum m₁ m₂ is mathematically and structurally identical to m₁ ⊔ m₂ (the Sup lattice operation for MeasurableSpace in Mathlib). Redefining it is harmless but unidiomatic, as Mathlib already provides algebraic and monotonicity lemmas for ⊔.
Suggested fix: Consider replacing instances of m₁.sum m₂ with the standard Mathlib notation m₁ ⊔ m₂.
| refine isProbabilityMeasure_iff.mpr ?_ | ||
| have := @Measure.map_apply Ω Ω' ps.1.ms (ps.1.ms.map f) ps.1.μ f (fun ⦃t⦄ a => a) Set.univ (by simp) | ||
| have : ps.1.μ (f ⁻¹' Set.univ) = 1 := by | ||
| have : f ⁻¹' Set.univ = Set.univ := by simp |
There was a problem hiding this comment.
💡 Nitpick: The use of @[reducible] def is an older Lean 3 idiom. In Lean 4, abbrev is the preferred way to declare reducible definitions.
Suggested fix: abbrev Permission (α : Type*) := Multiplicative (α → ℚ≥0)
| {A : Type*} | ||
| {E₁ E₂ : (Var → Val) → Prop} {i : I} | ||
| : ⌈E₁⟨i⟩⌉ ∗ ⌈E₂⟨i⟩⌉ ⊣⊢ ⌈(fun s => E₁ s ∧ E₂ s)⟨i⟩⌉ := by | ||
| sorry -- TODO: Rule SURE-MERGE proof |
There was a problem hiding this comment.
🟡 Issue: Hard Rule Violation — Escape Hatches: The code uses sorry in 34 distinct declarations (e.g., Sure_Merge, Sure_And_Star, Prod_Split, C_Frame, etc.) to stub out proofs. This explicitly bypasses Lean's verification kernel. For formal verification PRs, proofs must be completed or explicitly abstracted into documented axioms if representing a theoretical boundary.
Suggested fix: Remove sorry and provide full proofs for all theorems. If proofs are not yet available and this is a WIP, be aware that it cannot be approved for merging until complete.
| carrier := {x | True} | ||
| upper' := by aesop | ||
| } | ||
|
|
There was a problem hiding this comment.
🟡 Issue: Overlapping FunLike instances. You provide a generic instance for FunLike (Assertion M) M Prop and immediately follow it with an instance for FunLike (bProp I Var Val) (IndexedPSpPm I Var Val) Prop. Since bProp is just an abbrev for Assertion and IndexedPSpPm satisfies the OrderedUnitalResourceAlgebra constraint, these instances overlap exactly and will cause typeclass resolution issues or duplication.
Suggested fix: Remove the specialized instance for bProp, as the generic instance for Assertion M already fully covers it:
-- instance : FunLike (bProp I Var Val) (IndexedPSpPm I Var Val) Prop where
-- coe := fun P => P.carrier
-- coe_injective' := by intro P Q h; aesop| intro i hi₂; dsimp [a₁] | ||
| split | ||
| · rename_i hi₁; exact hagree i ⟨hi₁, hi₂⟩ | ||
| · rfl |
There was a problem hiding this comment.
💡 Nitpick: Non-standard theorem naming conventions. Theorems such as And_To_Star, Sure_Merge, Dist_Inj, and Sure_Eq_Inj are named using UpperCamelCase with underscores. Standard Lean 4 idiom dictates lowerCamelCase or snake_case (typically snake_case) for theorem and lemma names.
Suggested fix: Rename theorems to follow Lean 4 conventions, e.g., and_to_star, sure_merge, dist_inj, etc.
| carrier := {a | ∀ p, Ψ p → p a} | ||
| upper' := by | ||
| intro a b hle ha p hΨ | ||
| exact p.upper' hle (ha p hΨ) |
There was a problem hiding this comment.
💡 Nitpick: Defining wand and bimp with @[simp] eagerly unfolds these definitions during simplification. In BI and separation logic formalizations (like Iris), connective definitions are usually kept opaque to allow reasoning via BI laws rather than unfolding to the raw carrier sets.
Suggested fix: Consider removing the @[simp] attribute from wand and bimp unless unfolding to the semantic definition is explicitly desired on every simp call.
…T-FUN, DIRAC-DUP, DIST-CONVEX and forward direction of SURE-MERGE And restrucure some of the helper lemmas under the "Other helper lemmas" heading. Assisted-by: Aristotle (Harmonic)
…lRules` section For comments made before deciding to use "🤖:" to indicate a comment was added by a generative AI tool.
alexanderlhicks
left a comment
There was a problem hiding this comment.
AI-generated review (human verification required): this review was produced by automated repository/paper comparison, Lean declaration inventory, lake build, and #print axioms inspection. It is not a substitute for maintainer judgment, and line-level/contextual interpretation should be checked by the PR author and maintainers.
Thank you for the substantial formalization work: the PR builds successfully and introduces the core model, assertion, and rule interfaces in a coherent structure. I recommend request changes until the admitted rules, paper-correspondence gaps, and statement differences below are addressed.
The main blocking issue is that 25 exported Bluebell rules still depend directly on sorryAx: Sure_Merge, Sure_And_Star, Prod_Split, C_Frame, C_Unit_R, C_Assoc, C_And, Sure_Str_Convex, WP_Nest, WP_Conj, C_WP_Swap, Dist_Supp, Prod_Unsplit, C_Fuse, C_Swap, C_Sure_Proj, C_Sure_Proj_Many, C_Extract, C_Dist_Proj, RL_Unary, RL_Eq_Dist, RL_Convex, RL_Merge, RL_Sure_Merge, and Coupling. Dirac_Dup is also not axiom-clean transitively because it depends on admitted Sure_Merge. Please prove the rules or explicitly narrow the PR scope, then validate every exported rule with #print axioms.
| : ⌈E₁⟨i⟩⌉ ∗ ⌈E₂⟨i⟩⌉ ⊣⊢ ⌈(fun s => E₁ s ∧ E₂ s)⟨i⟩⌉ := by | ||
| constructor | ||
| · exact Sure_Merge_fwd | ||
| · sorry -- TODO: Rule SURE-MERGE proof (backwards direction) |
There was a problem hiding this comment.
Blocking: this exported rule is currently proved by sorry, so it contributes sorryAx to the trusted base. The corresponding paper rule is sure-merge (paper/section/appendix_rules.tex:164–170), and the paper states that these rules are semantic lemmas with soundness proofs (paper/section/appendix_rules.tex:133–139). Please provide the Lean proof and verify with #print axioms Sure_Merge that it is axiom-clean. The same check is needed for the other 24 admitted rules listed in the review summary.
| def ownPSp (P : I → PSp (Var → Val)) : bProp I Var Val := | ||
| iprop(∃ p : IxCompatiblePermission P, ownIndexedPSpPm P p) | ||
|
|
||
| def almostMeasurable {A : Type*} (E : (Var → Val) → A) (P : PSp (Var → Val)) : Prop := |
There was a problem hiding this comment.
Please establish correspondence with the paper definition before relying on this as the assertion-level notion of almost-measurability. The paper defines an event by measurable sandwiching, ∃ E₁ E₂ ∈ σ, E₁ ⊆ E ⊆ E₂ ∧ μ(E₁)=μ(E₂), and defines function almost-measurability pointwise over all fibers (paper/section/logic.tex:361–379, def:almost-meas). This Lean definition uses AEMeasurable; that may be equivalent under additional assumptions, but the equivalence is not currently proved for the generic spaces here. Either implement the paper definition directly or add and test the required equivalence theorem.
| /-- Short for "domain" -/ | ||
| abbrev dom (t : I → Option (PSpPm Var Val → PSpPm Var Val)) := hyperTermReferences t | ||
|
|
||
| def wp {Var Val : Type*} |
There was a problem hiding this comment.
Please add a correspondence theorem for this WP definition. The paper quantifies over a distribution on the full hyper-store and defines a ≤ μ₀ by embedding it with full permissions (paper/section/logic.tex:765–785, def:wp; summarized also in paper/section/appendix_rules.tex:72–83). This implementation instead quantifies over IndexedPSpPm, carries an explicit frame c, and adds validity conditions on μ₀ and b. Those may form a sound reformulation, but the equivalence/refinement to the paper semantics is currently undocumented and unproved. Please either formalize the paper definition or prove the exact correspondence under the intended model assumptions.
| | compl s _ ih => rw [Set.preimage_compl]; exact ih.compl | ||
| | iUnion g _ ih => rw [Set.preimage_iUnion]; exact MeasurableSet.iUnion ih | ||
|
|
||
| def PSpace.compatiblePerm |
There was a problem hiding this comment.
The paper defines compatibility by existence of a factorization psp = psp' × Triv(S → Val), where S is exactly the set of zero-permission variables (paper/section/logic.tex:182–200, definition Compatibility). This definition instead uses closure under individual Function.updates. That may be equivalent for finite Var, but it is not definitionally the paper definition and may be weaker for infinite variable sets. Please either use the factorization definition or prove the equivalence with explicit assumptions on Var, Val, and the probability-space representation.
| {Q : A → bProp I Var Val} {i : I} {E : (Var → Val) → A} | ||
| : | ||
| 𝒞⟨μ⟩ v; (⌈(fun s => E s = v)⟨i⟩⌉ ∗ wp t (Q v)) ⊢ wp t (𝒞⟨μ⟩ v; (⌈(fun s => E s = v)⟨i⟩⌉ ∗ Q v)) := by | ||
| sorry -- TODO: Rule C-WP-SWAP proof (spec not yet reviewed) |
There was a problem hiding this comment.
This is a new statement rather than the c-wp-swap rule in the paper. The paper rule is C μ v.(WP t Q(v) ∧ ownall) ⊢ WP t (C μ v.Q(v)) (paper/section/appendix_rules.tex:336–342, rule c-wp-swap). ownall is defined in paper/section/casestudies.tex:86–92, and the paper explicitly says that omitting it is unsound in the current model (paper/section/casestudies.tex:199–202). The explicit equality frame here may be intended to encode the needed ownership, but that equivalence and the soundness of this generalized statement are not shown. Please either formalize the paper rule or document/prove this new variant, including its relationship to ownall, then remove the sorry.
|
|
||
| -- ### RL-EQ-DIST | ||
|
|
||
| theorem RL_Eq_Dist {A : Type*} [Inhabited A] [Inhabited X] {X : Set (I × Var)} {μ : PMF A} {ix jy : X} : |
There was a problem hiding this comment.
RL_Eq_Dist appears to contain unused parameters {A}, [Inhabited A], [Inhabited X], and {μ : PMF A}. The paper rule requires only i ≠ j and the equality relation (paper/section/appendix_rules.tex:568–575, rule rl-eq-dist). Please remove the unused parameters or explain their semantic role, and make the Lean statement expose the same essential hypotheses as the paper rule.
| assumption | ||
| } | ||
|
|
||
| instance OrderedUnitalResourceAlgebra.instUCMRA |
There was a problem hiding this comment.
This declaration emits a duplicate namespace warning (OrderedUnitalResourceAlgebra.OrderedUnitalResourceAlgebra.instUCMRA). Please remove the redundant namespace qualification or rename the declaration so the build is warning-clean.
| {μ μ' : PMF A} | ||
| {i : I} {E : (Var → Val) → A} | ||
| : | ||
| 𝒞⟨μ⟩ v; E⟨i⟩ ~ μ' ⊢ E⟨i⟩ ~ μ' := by |
There was a problem hiding this comment.
The binder v is unused in Dist_Convex. Please remove it or rename it to _v so the intended statement is clear and the warning is eliminated.
| ValidPSpPm, ValidPSp.PSpace, ValidPSp, Measure.map_const, PSpace.isProbability, | ||
| measure_univ, one_smul] ; | ||
|
|
||
| omit [Finite Var] [Countable Val] in |
There was a problem hiding this comment.
Please remove the trailing whitespace on this line so git diff --check is clean.
|
Regarding the sorries, I would be curious to know whether any of them are actually blocked in any sense, or whetehr it's mostly been a question of finding some time/compute to tackle them? |
|
Kia ora @alexanderlhicks :)
Currently, none of the rules are blocked. Some were/are definitely easier to prove than others. I can let you know if, after further time/compute, we uncover that any are in fact blocked. Also, thanks for the AI-generated review, I'll have a look over that in the coming days (I just got back from vacation). |
alexanderlhicks
left a comment
There was a problem hiding this comment.
AI-generated follow-up (human verification required): addendum to my earlier review, after re-validating all findings against the current head (965589e).
Validation updates:
- The count of admitted rules stands at 25 (the automated review's figure of 34 predates 309e5b4, which proved ~10 rules). The 25 rule names in my original review remain accurate, including
C_Unit_RandDist_Supp, whose in-code TODO labels name the wrong rules (see inline comments). Dirac_Dupis confirmed to be the only proved rule that transitively depends on an admitted one (the backward direction ofSure_Merge).- The overlapping
FunLikeinstances flagged by the automated review (Assertion.lean:177/181) are confirmed real:bPropis anabbrevofAssertion, so the second instance exactly duplicates the first.
New findings (see inline comments):
RL_Eq_Distappears misformalized, not merely unproven — its conclusion ranges over distributions of variable names rather than stored values and is likely unprovable as stated, so thesorryis masking a false statement. The same theorem also has a phantom[Inhabited X]binder.- Several
sorryTODO labels name the wrong rule, which has already misled automated audits of the admitted-rule inventory. - No
Iris.CMRA.Discrete/Iris.OFE.Discreteinstance is registered, even though the camera built fromDiscreteCMRAis discrete by construction — a small addition that would make "the probability-space resource algebras are discrete cameras" a statement checked by Lean.
|
|
||
| -- ### RL-EQ-DIST | ||
|
|
||
| theorem RL_Eq_Dist {A : Type*} [Inhabited A] [Inhabited X] {X : Set (I × Var)} {μ : PMF A} {ix jy : X} : |
There was a problem hiding this comment.
Blocking: beyond the unused parameters noted in my earlier review, the statement itself appears misformalized. In the conclusion, (fun _ ↦ ix.1.2) has type (Var → Val) → Var, so the existentially bound μ is a PMF Var — a distribution over variable names — and each hasDistribution conjunct asserts that the pushforward of the store measure under a constant function equals μ. That forces μ = δ ix.1.2 and μ = δ jy.1.2 simultaneously, which is unsatisfiable whenever the two variable names differ. The intended expressions are presumably fun s ↦ s ix.1.2 / fun s ↦ s jy.1.2 (compare Coupling, which correctly uses fun s ↦ s x₁).
Separately, [Inhabited X] occurs before {X : Set (I × Var)} is bound, so Lean auto-binds a fresh implicit type X that the later binder shadows — the hypothesis constrains a phantom type and does nothing.
Please fix the statement before attempting the proof; as written the sorry is admitting a false claim rather than deferring a true one.
|
|
||
| theorem C_Unit_R {A : Type*} {i : I} {μ : PMF A} {E : (Var → Val) → A} : | ||
| E⟨i⟩ ~ μ ⊣⊢ 𝒞⟨μ⟩ v; ⌈(fun s ↦ E s = v)⟨i⟩⌉ := by | ||
| sorry -- TODO: Rule C-UNIT-L proof (spec not yet reviewed) |
There was a problem hiding this comment.
This sorry is labeled C-UNIT-L, but the theorem is C_Unit_R (C-UNIT-L is proved above). The same mislabeling occurs at line 2670 (Dist_Supp labeled DIRAC-SUPP) and line 2901 (RL_Merge labeled RL-SURE-MERGE). These stale labels have already caused the automated review to mis-inventory the admitted rules; please correct them so the remaining-work list can be audited by grep.
|
|
||
| open Iris in | ||
| /-- A discrete CMRA can be converted to a regular CMRA -/ | ||
| instance DiscreteCMRA.instCMRA {α : Type*} [DiscreteCMRA α] : CMRA α := { |
There was a problem hiding this comment.
DiscreteCMRA.instCMRA sets ValidN := fun _ x ↦ valid x, and instOFE sets Dist := fun _ ↦ equiv, so the resulting camera is discrete by construction — but no Iris.CMRA.Discrete (or Iris.OFE.Discrete) instance is ever registered. Both should hold definitionally and take only a couple of lines. Adding them would turn "the probability-space resource algebras are discrete cameras" into a statement actually checked by Lean, which is the form of the claim needed for the associated milestone.
This PR includes a formalisation of the statements of all Bluebell rules except Program WP rules and Derived WP rules, along with all the underlying aspects needed for expressing the statements of these rules. The rules correspond to those in Fig. 9, Fig. 10 (except the Program WP rules), and Fig. 11 of the Bluebell paper.
It also includes proofs of some of these rules, which have primarily been proved using AI (indicated as appropriate by an
Assisted-by: ...at the end of related commit messages).The remaining rules yet to be formalised require the integration of VCV-io before they are able to be expressed, and are left for a future PR.