roseking's picture
Add lean source and binary files (part 64)
92416a2 verified
Raw History Blame Contribute Delete
3.26 kB
import Mathlib
import OAI.Computability.VertexCover.Games.Basic
import OAI.Computability.VertexCover.Games.Stochastic
import OAI.Computability.VertexCover.Repetition.Factorization
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.Repetition
open scoped BigOperators
open Games
noncomputable section
variable {X Y : Type*} [Fintype X] [Fintype Y]
def normalizeOr (w : X → ℝ) (hw : ∀ x, 0 ≤ w x)
(fallback : FiniteDistribution X) : FiniteDistribution X :=
if h : 0 < ∑ x, w x then
{ weight := normalizedWeight w
nonnegative := (normalizedWeight_isProbability w hw h).1
normalized := (normalizedWeight_isProbability w hw h).2 }
else fallback
theorem sum_mul_normalizeOr (w : X → ℝ) (hw : ∀ x, 0 ≤ w x)
(fallback : FiniteDistribution X) (x : X) :
(∑ z, w z) * (normalizeOr w hw fallback).weight x = w x := by
classical
have hs : 0 ≤ ∑ z, w z := Finset.sum_nonneg (fun z _ => hw z)
by_cases h : 0 < ∑ z, w z
· simp only [normalizeOr, dite_eq_left h, normalizedWeight]
field_simp
· have hz : ∑ z, w z = 0 := le_antisymm (le_of_not_gt h) hs
have hx : w x = 0 := by
apply le_antisymm _ (hw x)
have hl := Finset.single_le_sum (fun z _ => hw z) (Finset.mem_univ x)
simpa only [hz] using hl
simp [normalizeOr, hz, hx]
theorem local_completion_recombination
(left : X → ℝ) (right : Y → ℝ)
(hl : ∀ x, 0 ≤ left x) (hr : ∀ y, 0 ≤ right y)
(defaultLeft : FiniteDistribution X) (defaultRight : FiniteDistribution Y)
(«c» : ℝ) (x : X) (y : Y) :
(«c» * (∑ z, left z) * (∑ z, right z)) *
((normalizeOr left hl defaultLeft).weight x *
(normalizeOr right hr defaultRight).weight y) = «c» * left x * right y := by
calc
_ = «c» * ((∑ z, left z) * (normalizeOr left hl defaultLeft).weight x) *
((∑ z, right z) * (normalizeOr right hr defaultRight).weight y) := by ring
_ = _ := by rw [sum_mul_normalizeOr, sum_mul_normalizeOr]
theorem factorized_completion_row
(left : X → ℝ) (right : Y → ℝ)
(hl : ∀ x, 0 ≤ left x) (hr : ∀ y, 0 ≤ right y)
(defaultLeft : FiniteDistribution X) (defaultRight : FiniteDistribution Y)
(«c» : ℝ) (xy : X × Y) :
(∑ z : X × Y, «c» * left z.1 * right z.2) *
((normalizeOr left hl defaultLeft).product
(normalizeOr right hr defaultRight)).weight xy = «c» * left xy.1 * right xy.2 := by
have hm : (∑ z : X × Y, «c» * left z.1 * right z.2) =
«c» * (∑ z, left z) * (∑ z, right z) := by
simp_rw [mul_assoc, ← Finset.mul_sum]
rw [productWeight_mass]
rw [hm]
exact local_completion_recombination left right hl hr defaultLeft defaultRight «c» xy.1 xy.2
end
end UniqueGames.Foundations.Repetition
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