introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3.84 kB
import Mathlib
namespace OAI
section
section
noncomputable section
namespace HyperbolicObstruction
namespace SparsePattern
open scoped BigOperators
/-- Independent table entry types, with their coordinate supports and critical costs.
The table model of Sections 2 and 4 is a concrete instance. -/
structure Pattern (F R : Type*) [Fintype F] [Fintype R] where
support : R β†’ Finset F
cost : R β†’ β„€
nonneg : βˆ€ r, 0 ≀ cost r
variable {F R : Type*} [Fintype F] [Fintype R] [DecidableEq F]
namespace Pattern
def exponent (P : Pattern F R) (W : Finset F) : β„€ :=
W.card - βˆ‘ r, if P.support r βŠ† W then P.cost r else 0
lemma exponent_submodular (P : Pattern F R) (S T : Finset F) :
P.exponent (S βˆͺ T) + P.exponent (S ∩ T) ≀ P.exponent S + P.exponent T := by
classical
have hcost : (βˆ‘ r, if P.support r βŠ† S then P.cost r else 0) +
(βˆ‘ r, if P.support r βŠ† T then P.cost r else 0) ≀
(βˆ‘ r, if P.support r βŠ† S βˆͺ T then P.cost r else 0) +
(βˆ‘ r, if P.support r βŠ† S ∩ T then P.cost r else 0) := by
rw [← Finset.sum_add_distrib, ← Finset.sum_add_distrib]
apply Finset.sum_le_sum
intro r _
by_cases hS : P.support r βŠ† S <;> by_cases hT : P.support r βŠ† T
Β· simp [hS, hT, Finset.subset_union_left.trans' hS, Finset.subset_inter hS hT]
Β· have hu : P.support r βŠ† S βˆͺ T := hS.trans Finset.subset_union_left
have hi : Β¬P.support r βŠ† S ∩ T := fun h => hT (h.trans Finset.inter_subset_right)
simp [hS, hT, hu, hi]
Β· have hu : P.support r βŠ† S βˆͺ T := hT.trans Finset.subset_union_right
have hi : Β¬P.support r βŠ† S ∩ T := fun h => hS (h.trans Finset.inter_subset_left)
simp [hS, hT, hu, hi]
Β· have hi : Β¬P.support r βŠ† S ∩ T := fun h => hS (h.trans Finset.inter_subset_left)
simp only [hS, hT, hi, ite_false, add_zero]
split_ifs <;> simp [P.nonneg]
have hc : ((S βˆͺ T).card : β„€) + (S ∩ T).card = S.card + T.card := by
exact_mod_cast Finset.card_union_add_card_inter S T
unfold exponent
linarith
lemma exponent_eq_card (P : Pattern F R) (I : Finset F)
(hI : βˆ€ r, Β¬P.support r βŠ† I) : P.exponent I = I.card := by
simp [exponent, hI]
/-- The maximal critical closure in Section 4. The conclusions retain a full
unit integer margin, not merely strictness. -/
theorem critical_closure (P : Pattern F R) (I : Finset F) (e : F)
(he : e βˆ‰ I) (hI : P.exponent I = I.card)
(hbudget : βˆ€ W, I βŠ† W β†’ (I.card : β„€) ≀ P.exponent W)
(htest : βˆ€ W, insert e I βŠ† W β†’ ((insert e I).card : β„€) ≀ P.exponent W) :
βˆƒ U : Finset F, I βŠ† U ∧ P.exponent U = I.card ∧ e βˆ‰ U ∧
βˆ€ V : Finset F, V.Nonempty β†’ Disjoint V U β†’
1 ≀ P.exponent (U βˆͺ V) - P.exponent U := by
classical
let B : Finset (Finset F) := Finset.univ.filter (fun U => I βŠ† U ∧ P.exponent U = I.card)
have hmem : I ∈ B := by simp [B, hI]
obtain ⟨U, hU, hmax⟩ := B.exists_max_image Finset.card ⟨I, hmem⟩
have hU' : I βŠ† U ∧ P.exponent U = I.card := (Finset.mem_filter.mp hU).2
refine ⟨U, hU'.1, hU'.2, ?_, ?_⟩
Β· intro heU
have hh := htest U (Finset.insert_subset heU hU'.1)
rw [Finset.card_insert_of_notMem he, Nat.cast_add, Nat.cast_one, hU'.2] at hh
omega
Β· intro V hV hd
have hsub : I βŠ† U βˆͺ V := hU'.1.trans Finset.subset_union_left
have hb := hbudget (U βˆͺ V) hsub
have hne : P.exponent (U βˆͺ V) β‰  (I.card : β„€) := by
intro heq
have hm : U βˆͺ V ∈ B := by simp [B, hsub, heq]
have hm' := hmax (U βˆͺ V) hm
have hc : (U βˆͺ V).card = U.card + V.card :=
Finset.card_union_of_disjoint hd.symm
have hv := Finset.card_pos.mpr hV
omega
rw [hU'.2]
omega
end Pattern
end SparsePattern
end HyperbolicObstruction
end
end
end
end OAI