A proof in src/Bluebell/Logic/Ownership.lean contains a sorry.
🤖 AI Analysis:
Statement Explanation
This theorem, sampledFrom_prod, connects the statistical independence of two expressions, E₁ and E₂, with the separating conjunction (∗) of the underlying resource logic.
It states that if sampling the pair (E₁ x, E₂ x) at index i follows a product distribution (given by Prod.mk <$> μ₁ <*> μ₂), then the resources can be spatially separated into two parts. One part is sufficient to guarantee that E₁ is sampled from μ₁, and the other part is sufficient to guarantee that E₂ is sampled from μ₂.
In essence, this rule allows you to "split" a proof about an independent joint distribution into two separate, independent proofs about the marginal distributions.
- Hypothesis:
assertSampledFrom i (fun x => (E₁ x, E₂ x)) (Prod.mk <$> μ₁ <*> μ₂)
This asserts the existence of a family of probability spaces P such that at index i, the joint distribution of E₁ and E₂ is the product of μ₁ and μ₂.
- Goal:
HyperAssertion.sep (assertSampledFrom i E₁ μ₁) (assertSampledFrom i E₂ μ₂).
This asserts that the current resource can be divided (sep) into two disjoint parts, one satisfying the assertion for E₁ and μ₁, and the other for E₂ and μ₂.
Context
This theorem is a fundamental rule in a probabilistic separation logic built using HyperAssertion. It serves as an introduction rule for the separating conjunction (∗, spelled sep) when dealing with probabilistic assertions. It's analogous to rules in classical separation logic that allow splitting ownership of disjoint memory regions. Here, it's about splitting "ownership" of probability distributions.
This rule is crucial for compositional reasoning. It allows a proof about a system with multiple independent random variables to be decomposed into simpler proofs about each variable. It relies heavily on the definitions of assertSampledFrom, the IndexedPSpPm resource model, and the interaction between Mathlib's PMF monad and MeasureTheory. The structure of the PSpPm CMRA, which combines probability spaces and permissions, is key to how resources are composed and split.
Proof Suggestion
-
Unfold Definitions: Start by unfolding HyperAssertion.entails. This gives you a resource s : IndexedPSpPm I α V F and a hypothesis h_s that the left-hand side assertion holds for s.
-
Deconstruct the Hypothesis: Use rcases or simp to unfold assertSampledFrom, sep, ownIndexedProb, ownIndexedTuple, and own in your hypothesis h_s. This will give you:
- A family of probability spaces
P : I → ProbabilitySpace (α → V).
- A family of permissions
p : I → Permission α F.
- A hypothesis
h_own that s includes the resource composed of P and p.
- A pure hypothesis
h_map stating (Prod.mk <$> μ₁ <*> μ₂).toMeasure = Measure.map (fun x => (E₁ x, E₂ x)) (P i).μ.
-
Leverage Measure Theory: The core of the probabilistic argument lies in h_map. You need to relate the measure of the product PMF to the product of measures. Use a key lemma from Mathlib, likely related to PMF.toMeasure_bind or MeasureTheory.Measure.map_prod_map_iff, to deduce from h_map that E₁ and E₂ are independent and that their individual distributions are what you need for the goal:
μ₁.toMeasure = Measure.map E₁ (P i).μ
μ₂.toMeasure = Measure.map E₂ (P i).μ
- You will also get the necessary
AEMeasurable properties for E₁ and E₂.
-
Construct Witnesses for sep: The goal is s ∈ sep (assertSampledFrom ... E₁ μ₁) (assertSampledFrom ... E₂ μ₂). You need to provide witness resources s₁ and s₂ such that s₁ • s₂ ≼ s and each satisfies the respective assertSampledFrom assertion. This is the crux of the proof.
-
Split the Resource: The resource you own from h_own is essentially a pair (P, p). The key insight should be how to split this resource into two parts, r₁ and r₂, such that they compose back to the original resource and can be used to prove the two sub-goals.
- The
pure parts of the sub-goals are satisfied by the facts derived in step 3. The main challenge is splitting the ownIndexedProb part.
- Both sub-goals will need to refer to the same probability space
P at index i. However, the permissions p can be split. The CMRA structure on PSpPm is a predicated product. The operation on PSp is PSp.indepMul and on permissions it is pointwise. The unit for PSp is ⊥.
- Consider splitting the owned resource
r at index i, r i = ⟨⟨_, p i⟩, _⟩, into two parts. A possible strategy is to give one part the full probability space and trivial permissions, and the other part the permissions and a trivial probability space. For example, define r₁ and r₂ such that for index j:
- If
j = i, let r₁ i be based on (P i, 1) and r₂ i be based on (⊥, p i).
- If
j ≠ i, you need to decide how to split the resource. Perhaps r₁ j gets everything and r₂ j is the unit.
- You will need to show that this split
r₁ • r₂ is included in the original resource r. Then, use r₁ to witness ownership for the first assertSampledFrom and r₂ for the second. Be careful: the second goal will now have ⊥ as its probability space at index i, which may not be what's needed. The correct split might require a more subtle property of your PSpPm CMRA, possibly related to the sorry in the compatiblePerm_CompatibleRel instance. The central idea is that the probability space P can be "shared" or "reused" while the permissions p are split.
Goal: Replace the sorry with a complete proof.
Link to the sorry on GitHub
Code Snippet:
theorem sampledFrom_prod {β₁ β₂ : Type _}
[MeasurableSpace β₁] [MeasurableSpace β₂] {i : I}
(E₁ : (α → V) → β₁) (E₂ : (α → V) → β₂)
(μ₁ : PMF β₁) (μ₂ : PMF β₂) :
HyperAssertion.entails
(assertSampledFrom (I := I) (α := α) (V := V) (F := F) i (fun x => (E₁ x, E₂ x))
(Prod.mk <$> μ₁ <*> μ₂))
(HyperAssertion.sep
(assertSampledFrom (I := I) (α := α) (V := V) (F := F) i E₁ μ₁)
(assertSampledFrom (I := I) (α := α) (V := V) (F := F) i E₂ μ₂)) := by
sorry
A proof in
src/Bluebell/Logic/Ownership.leancontains asorry.🤖 AI Analysis:
Statement Explanation
This theorem,
sampledFrom_prod, connects the statistical independence of two expressions,E₁andE₂, with the separating conjunction (∗) of the underlying resource logic.It states that if sampling the pair
(E₁ x, E₂ x)at indexifollows a product distribution (given byProd.mk <$> μ₁ <*> μ₂), then the resources can be spatially separated into two parts. One part is sufficient to guarantee thatE₁is sampled fromμ₁, and the other part is sufficient to guarantee thatE₂is sampled fromμ₂.In essence, this rule allows you to "split" a proof about an independent joint distribution into two separate, independent proofs about the marginal distributions.
assertSampledFrom i (fun x => (E₁ x, E₂ x)) (Prod.mk <$> μ₁ <*> μ₂)This asserts the existence of a family of probability spaces
Psuch that at indexi, the joint distribution ofE₁andE₂is the product ofμ₁andμ₂.HyperAssertion.sep (assertSampledFrom i E₁ μ₁) (assertSampledFrom i E₂ μ₂).This asserts that the current resource can be divided (
sep) into two disjoint parts, one satisfying the assertion forE₁andμ₁, and the other forE₂andμ₂.Context
This theorem is a fundamental rule in a probabilistic separation logic built using
HyperAssertion. It serves as an introduction rule for the separating conjunction (∗, spelledsep) when dealing with probabilistic assertions. It's analogous to rules in classical separation logic that allow splitting ownership of disjoint memory regions. Here, it's about splitting "ownership" of probability distributions.This rule is crucial for compositional reasoning. It allows a proof about a system with multiple independent random variables to be decomposed into simpler proofs about each variable. It relies heavily on the definitions of
assertSampledFrom, theIndexedPSpPmresource model, and the interaction between Mathlib'sPMFmonad andMeasureTheory. The structure of thePSpPmCMRA, which combines probability spaces and permissions, is key to how resources are composed and split.Proof Suggestion
Unfold Definitions: Start by unfolding
HyperAssertion.entails. This gives you a resources : IndexedPSpPm I α V Fand a hypothesish_sthat the left-hand side assertion holds fors.Deconstruct the Hypothesis: Use
rcasesorsimpto unfoldassertSampledFrom,sep,ownIndexedProb,ownIndexedTuple, andownin your hypothesish_s. This will give you:P : I → ProbabilitySpace (α → V).p : I → Permission α F.h_ownthatsincludes the resource composed ofPandp.h_mapstating(Prod.mk <$> μ₁ <*> μ₂).toMeasure = Measure.map (fun x => (E₁ x, E₂ x)) (P i).μ.Leverage Measure Theory: The core of the probabilistic argument lies in
h_map. You need to relate the measure of the product PMF to the product of measures. Use a key lemma from Mathlib, likely related toPMF.toMeasure_bindorMeasureTheory.Measure.map_prod_map_iff, to deduce fromh_mapthatE₁andE₂are independent and that their individual distributions are what you need for the goal:μ₁.toMeasure = Measure.map E₁ (P i).μμ₂.toMeasure = Measure.map E₂ (P i).μAEMeasurableproperties forE₁andE₂.Construct Witnesses for
sep: The goal iss ∈ sep (assertSampledFrom ... E₁ μ₁) (assertSampledFrom ... E₂ μ₂). You need to provide witness resourcess₁ands₂such thats₁ • s₂ ≼ sand each satisfies the respectiveassertSampledFromassertion. This is the crux of the proof.Split the Resource: The resource you own from
h_ownis essentially a pair(P, p). The key insight should be how to split this resource into two parts,r₁andr₂, such that they compose back to the original resource and can be used to prove the two sub-goals.pureparts of the sub-goals are satisfied by the facts derived in step 3. The main challenge is splitting theownIndexedProbpart.Pat indexi. However, the permissionspcan be split. The CMRA structure onPSpPmis a predicated product. The operation onPSpisPSp.indepMuland on permissions it is pointwise. The unit forPSpis⊥.rat indexi,r i = ⟨⟨_, p i⟩, _⟩, into two parts. A possible strategy is to give one part the full probability space and trivial permissions, and the other part the permissions and a trivial probability space. For example, definer₁andr₂such that for indexj:j = i, letr₁ ibe based on(P i, 1)andr₂ ibe based on(⊥, p i).j ≠ i, you need to decide how to split the resource. Perhapsr₁ jgets everything andr₂ jis the unit.r₁ • r₂is included in the original resourcer. Then, user₁to witness ownership for the firstassertSampledFromandr₂for the second. Be careful: the second goal will now have⊥as its probability space at indexi, which may not be what's needed. The correct split might require a more subtle property of yourPSpPmCMRA, possibly related to thesorryin thecompatiblePerm_CompatibleRelinstance. The central idea is that the probability spacePcan be "shared" or "reused" while the permissionspare split.Goal: Replace the
sorrywith a complete proof.Link to the sorry on GitHub
Code Snippet: