cfahlgren1/math / lean /OAI /Computability /DepthThree /RestrictionPathData.lean
cfahlgren1's picture
download
raw
7.68 kB
import OAI.Computability.DepthThree.RestrictionCylinders
import OAI.Computability.DepthThree.RestrictionKeepClause
import OAI.Computability.DepthThree.RestrictionProbability
import OAI.Computability.DepthThree.CylinderProbability
namespace OAI
universe uDepth1 uDepth2
noncomputable section
open scoped BigOperators Classical
namespace DepthThreeLowerBound
variable {V : Type uDepth1} {I : Type uDepth2} [instFintypeV : Fintype V] [instFintypeI : Fintype I]
def pathCompatible (C : I → Clause V) (σ : Restriction V) (P : List I) : Prop :=
∃ z : Cube (Live σ), ∀ i ∈ P, (C i).violation (fill σ z) = true
def pathCenter (C : I → Clause V) (σ : Restriction V) (P : List I) : Cube (Live σ) :=
if h : pathCompatible C σ P then Classical.choose h else fun _ => false
theorem pathCenter_support
{V : Type uDepth1}
{I : Type uDepth2}
[Fintype V]
[Fintype I]
(C : I → Clause V) (σ : Restriction V) (P : List I)
(h : pathCompatible C σ P) :
∀ i ∈ P, (C i).violation (fill σ (pathCenter C σ P)) = true := by
unfold pathCenter
rw [dite_eq_left h]
exact Classical.choose_spec h
@[simp] theorem pathCompatible_nil
{V : Type uDepth1}
{I : Type uDepth2}
[Fintype V]
[Fintype I]
(C : I → Clause V) (σ : Restriction V) :
pathCompatible C σ [] := by
exact ⟨fun _ => false, by simp⟩
def pathPrefixSet (C : I → Clause V) (σ : Restriction V) (P : List I)
(h : Fin P.length) : Finset V :=
revealed (fun i => (C i).scope) (liveSet σ) (P.take (h.val + 1))
def pathFinalSet (C : I → Clause V) (σ : Restriction V) (P : List I) : Finset V :=
revealed (fun i => (C i).scope) (liveSet σ) P
def pathLiveSet (C : I → Clause V) (σ : Restriction V) (P : List I) :
Finset (Live σ) :=
Finset.univ.filter fun v => v.val ∈ pathFinalSet C σ P
def pathCoveredCount (C : I → Clause V) (σ : Restriction V) (P : List I)
(h : Fin P.length) : ℕ :=
coveredCount (fun i => (C i).scope) (liveSet σ)
(fun i => (C i).violation (fill σ (pathCenter C σ P))) (pathPrefixSet C σ P h)
def pathWeight (C : I → Clause V) (σ : Restriction V) (P : List I) : ℝ :=
∏ h : Fin P.length, (pathCoveredCount C σ P h : ℝ)⁻¹
def pathCost (C : I → Clause V) (b : ℕ) (σ : Restriction V) (j : ℕ) : ℝ :=
∑ P ∈ paths (fun i => (C i).scope) (liveSet σ) b j,
if pathCompatible C σ P then pathWeight C σ P else 0
def restrictionCost (C : I → Clause V) (b : ℕ) (σ : Restriction V) : ℝ :=
∑ j ∈ Finset.range (Fintype.card V / (b + 1) + 1), pathCost C b σ j
theorem pathWeight_nonneg (C : I → Clause V) (σ : Restriction V) (P : List I) :
0 ≤ pathWeight C σ P := by
exact Finset.prod_nonneg fun h _ => inv_nonneg.mpr (Nat.cast_nonneg _)
theorem pathCost_nonneg (C : I → Clause V) (b : ℕ) (σ : Restriction V) (j : ℕ) :
0 ≤ pathCost C b σ j := by
apply Finset.sum_nonneg
intro P hP
split
· exact pathWeight_nonneg C σ P
· exact le_rfl
theorem restrictionCost_nonneg (C : I → Clause V) (b : ℕ) (σ : Restriction V) :
0 ≤ restrictionCost C b σ :=
Finset.sum_nonneg fun j _ => pathCost_nonneg C b σ j
@[simp] theorem pathWeight_nil (C : I → Clause V) (σ : Restriction V) :
pathWeight C σ [] = 1 := by simp [pathWeight]
@[simp] theorem pathCost_zero (C : I → Clause V) (b : ℕ) (σ : Restriction V) :
pathCost C b σ 0 = 1 := by
simp [pathCost, paths_zero]
theorem pathPrefixSet_subset_final
{V : Type uDepth1}
{I : Type uDepth2}
[instFintypeV : Fintype V]
[Fintype I]
(C : I → Clause V) (σ : Restriction V)
(P : List I) (h : Fin P.length) :
pathPrefixSet C σ P h ⊆ pathFinalSet C σ P :=
revealed_mono (fun i => (C i).scope) (liveSet σ) (List.take_subset _ _)
theorem pathCoveredCount_pos (C : I → Clause V) (b : ℕ) (σ : Restriction V)
{n : ℕ} {P : List I}
(hP : P ∈ paths (fun i => (C i).scope) (liveSet σ) b n)
(hc : pathCompatible C σ P) (h : Fin P.length) :
0 < pathCoveredCount C σ P h := by
have hk : h.val + 1 ≤ n := by
rw [← length_of_mem_paths hP]
exact Nat.succ_le_of_lt h.isLt
have hpref := take_mem_paths (fun i => (C i).scope) (liveSet σ) b hP hk
have hs : pathNumerator
(fun i => (C i).violation (fill σ (pathCenter C σ P)))
(P.take (h.val + 1)) ≠ 0 := by
apply (pathNumerator_ne_zero_iff _ _).mpr
intro i hi
exact pathCenter_support C σ P hc i ((List.take_subset _ _) hi)
have hle := length_le_coveredCount_of_support (fun i => (C i).scope)
(liveSet σ) b (fun i => (C i).violation (fill σ (pathCenter C σ P))) hpref hs
rw [length_of_mem_paths hpref] at hle
exact (Nat.succ_pos h.val).trans_le hle
theorem pathLiveSet_image
{V : Type uDepth1}
{I : Type uDepth2}
[instFintypeV : Fintype V]
[Fintype I]
(C : I → Clause V) (σ : Restriction V) (P : List I) :
(pathLiveSet C σ P).image Subtype.val = pathFinalSet C σ P := by
ext v
constructor
· intro hv
obtain ⟨w, hw, rfl⟩ := Finset.mem_image.mp hv
exact (Finset.mem_filter.mp hw).2
· intro hv
have ht : v ∈ liveSet σ := revealed_subset (fun i => (C i).scope) (liveSet σ) P hv
have hσ : σ v = none := by simpa [liveSet] using ht
exact Finset.mem_image.mpr ⟨⟨v, hσ⟩, by simp [pathLiveSet, hv], rfl⟩
theorem pathLiveSet_card (C : I → Clause V) (σ : Restriction V) (P : List I) :
(pathLiveSet C σ P).card = (pathFinalSet C σ P).card := by
rw [← pathLiveSet_image C σ P]
exact (Finset.card_image_of_injective _ Subtype.val_injective).symm
theorem path_support_iff_live_cylinder (C : I → Clause V) (σ : Restriction V)
(P : List I) (hn : ∀ i ∈ P, (C i).Normalized) (hc : pathCompatible C σ P)
(x : Cube (Live σ)) :
(∀ i ∈ P, (C i).violation (fill σ x) = true) ↔
∀ v ∈ pathLiveSet C σ P, x v = pathCenter C σ P v := by
rw [simultaneous_restricted_violation_iff C σ (liveSet σ)
(by intro v; simp [liveSet]) P x (pathCenter C σ P) hn
(pathCenter_support C σ P hc)]
constructor
· intro h v hv
have hval : v.val ∈ pathFinalSet C σ P := (Finset.mem_filter.mp hv).2
simpa using h v.val hval
· intro h v hv
have ht : v ∈ liveSet σ := revealed_subset (fun i => (C i).scope) (liveSet σ) P hv
have hσ : σ v = none := by simpa [liveSet] using ht
have hv' : (⟨v, hσ⟩ : Live σ) ∈ pathLiveSet C σ P := by
exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, hv⟩
simpa [fill, hσ] using h ⟨v, hσ⟩ hv'
theorem path_cylinder_probability (C : I → Clause V) (σ : Restriction V)
(P : List I) (hn : ∀ i ∈ P, (C i).Normalized) (hc : pathCompatible C σ P) :
finiteAvg (fun x : Cube (Live σ) =>
indicator (decide (∀ i ∈ P, (C i).violation (fill σ x) = true))) =
((2 : ℝ) ^ (pathFinalSet C σ P).card)⁻¹ := by
simp_rw [path_support_iff_live_cylinder C σ P hn hc]
calc
_ = ((2 : ℝ) ^ (pathLiveSet C σ P).card)⁻¹ := by
have havg (inst₁ inst₂ : Fintype (Cube (Live σ)))
(f g : Cube (Live σ) → ℝ) (hfg : ∀ x, f x = g x) :
@finiteAvg _ inst₁ f = @finiteAvg _ inst₂ g := by
have hi : inst₁ = inst₂ := Subsingleton.elim _ _
cases hi
exact @finiteAvg_congr _ inst₁ f g hfg
refine Eq.trans ?_
(finiteAvg_indicator_eq_pattern (pathLiveSet C σ P) (pathCenter C σ P))
apply havg
intro x
apply congrArg indicator
apply Bool.eq_iff_iff.mpr
simp only [decide_eq_true_eq]
_ = _ := by rw [pathLiveSet_card]
end DepthThreeLowerBound
end
end OAI

Xet Storage Details

Size:
7.68 kB
·
Xet hash:
f77b20b55afa5102c5cb62ed8798d5e90a5f5825313e22d8fdacf1d69996050d

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