cfahlgren1/math / lean /OAI /Combinatorics /ContingencyTables /Sampling /SmallRepairCandidates.lean
cfahlgren1's picture
download
raw
2.99 kB
import OAI.Combinatorics.ContingencyTables.Sampling.InverseSmallRepair
import OAI.Combinatorics.ContingencyTables.Sampling.PhysicalGraphDegree
namespace OAI
/-! # Polynomial lists of forward and inverse repair candidates -/
namespace ContingencyTables.SmallGraphProfiles
open scoped Classical
open PhysicalCompletionFibres SmallContextFibres FirstPaperProfiles
open IntegerWeightedTransport SmallContextEnumeration RowMajorEnumeration
open SmallContextCoordinates CompletionCounts
noncomputable section
universe u
variable {I J : Type u} [Fintype I] [Fintype J] [LinearOrder I] [LinearOrder J]
/-- Candidates are generated by ordered cell pairs, without enumerating
positive defect states. A later feasibility test removes unused pairs. -/
def localRepairCandidates (small : I → J → Bool) (B : I → J → ℕ)
(v : SmallProfile small) : Finset (SmallProfile small) :=
(Finset.univ.image (fun st : Cells small×Cells small =>
repairedProfile small B v st.1.val st.2.val)) ∪
(Finset.univ.image (fun st : Cells small×Cells small =>
inverseRepairProfile small B v st.1.val st.2.val))
lemma localRepairCandidates_card (small : I → J → Bool) (B : I → J → ℕ)
(v : SmallProfile small) :
(localRepairCandidates small B v).card ≤ 2*(Fintype.card (Cells small))^2 := by
unfold localRepairCandidates
apply (Finset.card_union_le _ _).trans
have h1 := Finset.card_image_le (s := (Finset.univ : Finset (Cells small×Cells small)))
(f := fun st => repairedProfile small B v st.1.val st.2.val)
have h2 := Finset.card_image_le (s := (Finset.univ : Finset (Cells small×Cells small)))
(f := fun st => inverseRepairProfile small B v st.1.val st.2.val)
simp only [Finset.card_univ,Fintype.card_prod] at h1 h2
nlinarith
lemma fullNeighbors_local (r : I → ℕ) (c : J → ℕ) (U L : ℕ) (B : I → J → ℕ)
(hB : ∀ i j,firstPaperSmall r c U i j=true → B i j=U)
(v : SmallProfile (firstPaperSmall r c U)) :
fullNeighbors r c U L B hB v ⊆
exchangeCandidates v ∪ localRepairCandidates (firstPaperSmall r c U) B v := by
intro w hw
have hs := fullNeighbors_subset r c U L B hB v hw
simp only [Finset.mem_union] at hs ⊢
rcases hs with he|hr
· exact Or.inl he
· right
simp only [repairNeighbors,Finset.mem_union,Finset.mem_image,
Finset.mem_filter,Finset.mem_univ,true_and] at hr
simp only [localRepairCandidates,Finset.mem_union,Finset.mem_image,
Finset.mem_univ,true_and]
rcases hr with ⟨z,hzv,hzw⟩|⟨z,hzv,hzw⟩
· left
refine ⟨defectLabels _ B r c L z,?_⟩
rw [←hzv]
rw [repairWord_profile r c U L B hB z] at hzw
exact hzw
· right
refine ⟨defectLabels _ B r c L z,?_⟩
rw [repairWord_profile r c U L B hB z] at hzv
rw [←hzv,inverseRepairProfile_repaired _ B _ _ _
(naturalProfile_bounded z.val) (defectLabels_spec _ B r c L z)]
exact hzw
end
end ContingencyTables.SmallGraphProfiles
end OAI

Xet Storage Details

Size:
2.99 kB
·
Xet hash:
5d77a6ba4d37e718dc922c1f0cbece70b2389bd52c03b1f923c94d90ea5bb7d2

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