cfahlgren1/math / lean /OAI /Combinatorics /Sensitivity /RecursiveProfiles.lean
cfahlgren1's picture
download
raw
4.12 kB
import OAI.Combinatorics.Sensitivity.Model
namespace OAI
/-! The side and joint profiles count literal flips of the same raw input. -/
noncomputable section
open scoped Classical
namespace Paper320
/-- Acceptance at a stronger index implies acceptance at every weaker index. -/
structure NestedFamily {h : ℕ} {I : Type}
(F : Fin h → (I → Bool) → Bool) : Prop where
accepts_of_le : ∀ {q q' : Fin h} {x}, q ≤ q' → F q' x = true → F q x = true
theorem NestedFamily.rejects_of_le {h : ℕ} {I : Type}
{F : Fin h → (I → Bool) → Bool} (hF : NestedFamily F)
{q q' : Fin h} {x} (hqq : q ≤ q') (hx : F q x = false) :
F q' x = false := by
cases h' : F q' x
· rfl
· have := hF.accepts_of_le hqq h'
simp [hx] at this
/-- The number of coordinates whose one-bit flip changes both predicates. -/
def jointSensitivityAt {I : Type} [Fintype I]
(f g : (I → Bool) → Bool) (x : I → Bool) : ℕ :=
(Finset.univ.filter fun i =>
f (flip x {i}) ≠ f x ∧ g (flip x {i}) ≠ g x).card
/-- Maximum sensitivity over all indices and inputs with the indicated output. -/
def sideSensitivity {h : ℕ} {I : Type} [Fintype I]
(F : Fin h → (I → Bool) → Bool) (b : Bool) : ℕ :=
Finset.univ.sup fun q => Finset.univ.sup fun x =>
if F q x = b then sensitivityAt (F q) x else 0
/-- Maximum same-input, same-bit joint sensitivity over two distinct ordered indices. -/
def jointSensitivity {h : ℕ} {I : Type} [Fintype I]
(F : Fin h → (I → Bool) → Bool) (b : Bool) : ℕ :=
Finset.univ.sup fun q => Finset.univ.sup fun q' => Finset.univ.sup fun x =>
if q < q' ∧ F q x = b ∧ F q' x = b then
jointSensitivityAt (F q) (F q') x else 0
theorem sensitivityAt_le_sideSensitivity {h : ℕ} {I : Type} [Fintype I]
(F : Fin h → (I → Bool) → Bool) (b : Bool) (q : Fin h) (x : I → Bool)
(hx : F q x = b) : sensitivityAt (F q) x ≤ sideSensitivity F b := by
apply Finset.le_sup_of_le (Finset.mem_univ q)
apply Finset.le_sup_of_le (Finset.mem_univ x)
simp [hx]
theorem sideSensitivity_le {h : ℕ} {I : Type} [Fintype I]
(F : Fin h → (I → Bool) → Bool) (b : Bool) (B : ℕ)
(hB : ∀ q x, F q x = b → sensitivityAt (F q) x ≤ B) :
sideSensitivity F b ≤ B := by
apply Finset.sup_le
intro q _
apply Finset.sup_le
intro x _
split_ifs with hx
· exact hB q x hx
· exact Nat.zero_le _
theorem jointSensitivityAt_le_jointSensitivity {h : ℕ} {I : Type} [Fintype I]
(F : Fin h → (I → Bool) → Bool) (b : Bool) (q q' : Fin h) (x : I → Bool)
(hqq : q < q') (hx : F q x = b) (hx' : F q' x = b) :
jointSensitivityAt (F q) (F q') x ≤ jointSensitivity F b := by
apply Finset.le_sup_of_le (Finset.mem_univ q)
apply Finset.le_sup_of_le (Finset.mem_univ q')
apply Finset.le_sup_of_le (Finset.mem_univ x)
simp [hqq, hx, hx']
theorem jointSensitivity_le {h : ℕ} {I : Type} [Fintype I]
(F : Fin h → (I → Bool) → Bool) (b : Bool) (B : ℕ)
(hB : ∀ q q' x, q < q' → F q x = b → F q' x = b →
jointSensitivityAt (F q) (F q') x ≤ B) : jointSensitivity F b ≤ B := by
apply Finset.sup_le
intro q _
apply Finset.sup_le
intro q' _
apply Finset.sup_le
intro x _
split_ifs with hx
· exact hB q q' x hx.1 hx.2.1 hx.2.2
· exact Nat.zero_le _
theorem jointSensitivityAt_le_left {I : Type} [Fintype I]
(f g : (I → Bool) → Bool) (x : I → Bool) :
jointSensitivityAt f g x ≤ sensitivityAt f x := by
apply Finset.card_le_card
intro i hi
exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, (Finset.mem_filter.mp hi).2.1⟩
theorem jointSensitivityAt_comm {I : Type} [Fintype I]
(f g : (I → Bool) → Bool) (x : I → Bool) :
jointSensitivityAt f g x = jointSensitivityAt g f x := by
simp only [jointSensitivityAt, and_comm]
theorem jointSensitivity_one {I : Type} [Fintype I]
(F : Fin 1 → (I → Bool) → Bool) (b : Bool) : jointSensitivity F b = 0 := by
apply Nat.eq_zero_of_le_zero
apply jointSensitivity_le
intro q q' x hqq _ _
exact False.elim (by omega)
end Paper320
end
end OAI

Xet Storage Details

Size:
4.12 kB
·
Xet hash:
2cf0de36f85abb92e85814cf56e8a90c432e663f22c3aec1daa5a3ecd33f4c17

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