import OAI.Probability.ClassicalON.SeparatedAnnuli namespace OAI noncomputable section open Set open scoped Classical namespace ClassicalON.LatticeGraph def extendAnnulusSign (G : LatticeGraph) (N : ℤ) (z : Site) (s : (G.annulusGraph N z).vertices → Bool) (v : G.vertices) : Bool := if h : v.val∈annulusSites N z then s ⟨v.val,Finset.mem_filter.mpr ⟨v.property,h⟩⟩ else decide (2*N e.val.1) (fun e => e.val.2) (G.annulusPins N z) (layerSigns (G.annulusInner N z)) (fun e => η (G.restrictEdge _ e))) : G.extendAnnulusSign N z s∈compatibleSigns (fun e : G.edges => e.val.1) (fun e => e.val.2) η := by intro e he have hstep := siteRadius_neighbor_step z (Or.inl (G.nearest e.val e.property)) by_cases hl : siteRadius z e.val.1.val e.val.1) (fun e => e.val.2) η x y) : G.annulusIndicator N z η=1 := by have hd : Disjoint (G.annulusInner N z) (G.annulusOuter N z) := by apply Set.disjoint_left.mpr intro v hv hw change siteRadius z v.val=N at hv change siteRadius z v.val=2*N at hw omega have hc : bondCrossing (fun e : (G.annulusGraph N z).edges => e.val.1) (fun e => e.val.2) (G.annulusInner N z) (G.annulusOuter N z) (fun e => η (G.restrictEdge _ e)) := by by_contra hn obtain ⟨s,hs⟩ := (layerSigns_consistent_iff (fun e : (G.annulusGraph N z).edges => e.val.1) (fun e => e.val.2) _ _ hd _).mpr hn have he := compatibleSigns_connected _ _ η (G.extendAnnulusSign_compatible N hN z η s hs) hxy rw [G.extendAnnulusSign_inner N hN z s hs.2 x hx,G.extendAnnulusSign_outer N hN z s hs.2 y hy] at he cases he exact ite_eq_left hc theorem annulus_crossing_of_component (G : LatticeGraph) (N : ℤ) (hN : 0 e.val.1) (fun e => e.val.2) η x y) (hxw : bondConnected (fun e : G.edges => e.val.1) (fun e => e.val.2) η x w) (z : Site) (hw : siteRadius z w.val≤N) : G.annulusIndicator N z η=1 := by have hout : 2*N≤ siteRadius z x.val ∨ 2*N≤ siteRadius z y.val := by have ht := siteRadius_triangle x.val z y.val rw [siteRadius_symm x.val z] at ht omega rcases hout with hx | hy · exact G.annulus_crossing_of_connected N hN z η w x hw hx (bondConnected_symm _ _ _ hxw) · exact G.annulus_crossing_of_connected N hN z η w y hw hy (bondConnected_trans _ _ _ (bondConnected_symm _ _ _ hxw) hxy) end ClassicalON.LatticeGraph end end OAI