cfahlgren1's picture
download
raw
3.46 kB
import Mathlib
import OAI.Computability.VertexCover.Information.ChainRule
namespace OAI
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
section
namespace UniqueGames.Foundations.Information
open scoped BigOperators
variable {α β : Type*} [Fintype α] [Fintype β]
noncomputable def conditionalKernel
(p : α × β → ℝ) (fallback : β → ℝ) (a : α) (b : β) : ℝ := by
classical
exact if firstMarginal p a = 0 then fallback b
else p (a, b) / firstMarginal p a
theorem conditionalKernel_isProbability
(p : α × β → ℝ) (fallback : β → ℝ)
(hp : IsProbability p) (hf : IsProbability fallback) (a : α) :
IsProbability (conditionalKernel p fallback a) := by
classical
by_cases hm : firstMarginal p a = 0
· simpa only [IsProbability, conditionalKernel, ite_eq_left hm] using hf
· constructor
· intro b
simp only [conditionalKernel, ite_eq_right hm]
exact div_nonneg (hp.1 (a, b))
((firstMarginal_isProbability p hp).1 a)
· simp only [conditionalKernel, ite_eq_right hm, div_eq_mul_inv, ← Finset.sum_mul]
change firstMarginal p a * (firstMarginal p a)⁻¹ = 1
exact mul_inv_cancel₀ hm
theorem marginal_mul_conditionalKernel
(p : α × β → ℝ) (fallback : β → ℝ)
(hp : IsProbability p) (a : α) (b : β) :
firstMarginal p a * conditionalKernel p fallback a b = p (a, b) := by
classical
by_cases hm : firstMarginal p a = 0
· have hpoint := point_le_firstMarginal p hp a b
rw [hm] at hpoint
have hz : p (a, b) = 0 := le_antisymm hpoint (hp.1 (a, b))
simp [conditionalKernel, hm, hz]
· simp only [conditionalKernel, ite_eq_right hm]
calc
firstMarginal p a * (p (a, b) / firstMarginal p a)
= p (a, b) *
(firstMarginal p a / firstMarginal p a) := by ring
_ = p (a, b) := by rw [div_self hm, mul_one]
theorem law_of_total_probability
(p : α × β → ℝ) (fallback : β → ℝ)
(hp : IsProbability p) (b : β) :
(∑ a, firstMarginal p a * conditionalKernel p fallback a b) =
secondMarginal p b := by
simp only [marginal_mul_conditionalKernel p fallback hp, secondMarginal]
theorem kernelProduct_isProbability
(r : α → ℝ) (k : α → β → ℝ)
(hr : IsProbability r) (hk : ∀ a, IsProbability (k a)) :
IsProbability (fun ab : α × β => r ab.1 * k ab.1 ab.2) := by
constructor
· intro ab
exact mul_nonneg (hr.1 ab.1) ((hk ab.1).1 ab.2)
· simp only [Fintype.sum_prod_type, ← Finset.mul_sum,
(hk _).2, mul_one, hr.2]
theorem alternativeInput_conditionalProduct_isProbability
(p : α × β → ℝ) (fallback : β → ℝ) (r : α → ℝ)
(hp : IsProbability p) (hf : IsProbability fallback)
(hr : IsProbability r) :
IsProbability
(fun ab : α × β => r ab.1 * conditionalKernel p fallback ab.1 ab.2) :=
kernelProduct_isProbability r (conditionalKernel p fallback) hr
(conditionalKernel_isProbability p fallback hp hf)
end UniqueGames.Foundations.Information
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end
end OAI

Xet Storage Details

Size:
3.46 kB
·
Xet hash:
32010509074b338d8472d34792a49e6bca6c414c02830f211856fea9ac2f58b4

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.