abbrev Cell (W H : ℕ) := Fin W × Fin H 19Horizontal wires run west/east; vertical wires run south/north. The extra endpoint in each coordinate is literal, not periodic boundary data.
abbrev GridWire (W H : ℕ) := (Fin (W+1) × Fin H) ⊕ (Fin W × Fin (H+1)) abbrev FullWire (W H : ℕ) := GridWire W H ⊕ Cell W H def network (W H : ℕ) : TileNetwork (GridWire W H) (Cell W H) where body · 4 lines
west t := .inl (t.1.castSucc,t.2)
east t := .inl (t.1.succ,t.2)
south t := .inr (t.1,t.2.castSucc)
north t := .inr (t.1,t.2.succ)def wireEmbedding {W H : ℕ} : FullWire W H → Wire body · 3 lines
| .inl (.inl (i,j)) => (i.val,j.val,2)
| .inl (.inr (i,j)) => (i.val,j.val,1)
| .inr (i,j) => (i.val,j.val,0)lemma wireEmbedding_injective (W H : ℕ) :
Function.Injective (wireEmbedding (W:=W) (H:=H)) := by proof · 16 lines
intro x y h
cases x with
| inl x => cases x with
| inl x => cases y with
| inl y => cases y with
| inl y => simpa [wireEmbedding,Prod.ext_iff,Fin.ext_iff] using h
| inr y => simp [wireEmbedding] at h
| inr y => simp [wireEmbedding] at h
| inr x => cases y with
| inl y => cases y with
| inl y => simp [wireEmbedding] at h
| inr y => simpa [wireEmbedding,Prod.ext_iff,Fin.ext_iff] using h
| inr y => simp [wireEmbedding] at h
| inr x => cases y with
| inl y => cases y <;> simp [wireEmbedding] at h
| inr y => simpa [wireEmbedding,Prod.ext_iff,Fin.ext_iff] using hnoncomputable def spins {W H : ℕ} (σ : GridWire W H → Fin 3)
(μ : Cell W H → Fin 3) : Wire → Fin 3 := body · 1 line
Function.extend wireEmbedding (Sum.elim σ μ) (fun _ => 1)lemma spins_wire {W H : ℕ} (σ : GridWire W H → Fin 3) (μ : Cell W H → Fin 3)
(w : FullWire W H) : spins σ μ (wireEmbedding w)=Sum.elim σ μ w := by proof · 1 line
exact (wireEmbedding_injective W H).extend_apply _ _ _def cellCenter {W H : ℕ} (t : Cell W H) (b : Bool) : Center := body · 1 line
(t.1.val,t.2.val,b)lemma cellCenter_injective (W H : ℕ) :
Function.Injective (fun p : Cell W H × Bool => cellCenter p.1 p.2) := by proof · 4 lines
intro x y h
rcases x with ⟨⟨i,j⟩,b⟩
rcases y with ⟨⟨i',j'⟩,b'⟩
simpa [cellCenter,Prod.ext_iff,Fin.ext_iff,and_assoc] using hnoncomputable def domain (W H : ℕ) : Finset Center := body · 1 line
Finset.univ.image (fun p : Cell W H × Bool => cellCenter p.1 p.2)lemma up_wires {W H : ℕ} (t : Cell W H) :
incidentWire (cellCenter t true) 0 = wireEmbedding (.inr t) ∧
incidentWire (cellCenter t true) 1 = wireEmbedding (.inl ((network W H).south t)) ∧
incidentWire (cellCenter t true) 2 = wireEmbedding (.inl ((network W H).west t)) := by proof · 1 line
simp [incidentWire,cellCenter,wireEmbedding,network]
lemma down_wires {W H : ℕ} (t : Cell W H) :
incidentWire (cellCenter t false) 0 = wireEmbedding (.inr t) ∧
incidentWire (cellCenter t false) 1 = wireEmbedding (.inl ((network W H).north t)) ∧
incidentWire (cellCenter t false) 2 = wireEmbedding (.inl ((network W H).east t)) := by proof · 1 line
simp [incidentWire,cellCenter,wireEmbedding,network,Nat.cast_add]lemma up_centerTensor {W H : ℕ} (σ : GridWire W H → Fin 3) (μ : Cell W H → Fin 3)
(t : Cell W H) : centerTensor (spins σ μ) (cellCenter t true) =
upTensor (σ ((network W H).west t)) (σ ((network W H).south t)) (μ t) := by proof · 3 lines
change upTensor _ _ _ = _
rw [(up_wires t).1,(up_wires t).2.1,(up_wires t).2.2]
simp only [spins_wire,Sum.elim_inl,Sum.elim_inr]lemma down_centerTensor {W H : ℕ} (σ : GridWire W H → Fin 3) (μ : Cell W H → Fin 3)
(t : Cell W H) : centerTensor (spins σ μ) (cellCenter t false) =
downTensor (σ ((network W H).east t)) (σ ((network W H).north t)) (μ t) := by proof · 3 lines
change downTensor _ _ _ = _
rw [(down_wires t).1,(down_wires t).2.1,(down_wires t).2.2]
simp only [spins_wire,Sum.elim_inl,Sum.elim_inr]100Product of actual visited-center tensors on the literal rectangle.
lemma center_product_eq {W H : ℕ} (σ : GridWire W H → Fin 3) (μ : Cell W H → Fin 3) :
centerProduct (domain W H) (spins σ μ) =
∏ t : Cell W H, upTensor (σ ((network W H).west t)) (σ ((network W H).south t)) (μ t) *
downTensor (σ ((network W H).east t)) (σ ((network W H).north t)) (μ t) := by proof · 6 lines
classical
rw [centerProduct,domain,Finset.prod_image (fun x _ y _ h => cellCenter_injective W H h)]
rw [Fintype.prod_prod_type]
apply Finset.prod_congr rfl
intro t ht
simp only [Fintype.prod_bool,up_centerTensor,down_centerTensor]113The source finite physical network contracts precisely to the actual center tensors on the rectangle, with every internal middle wire summed.
theorem grid_physical_eq_centers (W H : ℕ) (σ : GridWire W H → Fin 3) :
(network W H).physical σ = ∑ μ : Cell W H → Fin 3,
centerProduct (domain W H) (spins σ μ) := by proof · 4 lines
rw [physical_network_center_expansion]
apply Finset.sum_congr rfl
intro μ hμ
exact (center_product_eq σ μ).symmlemma sum_vectors_cons {α : Type*} [Fintype α] {n : ℕ}
(F : (Fin (n+1) → α) → ℂ) :
(∑ τ, F τ) = ∑ a : α, ∑ τ : Fin n → α, F (Fin.cons (α:=fun _=>α) a τ) := by proof · 2 lines
rw [←(Fin.consEquiv (fun _ : Fin (n+1) => α)).sum_comp F,Fintype.sum_prod_type]
rfl135A finite matrix path expansion, used only for the actual physical column kernels below. All intermediate states are summed once.
noncomputable def matrixPath {α : Type*} [Fintype α] [DecidableEq α] {n : ℕ}
(K : Fin n → Matrix α α ℂ) (a b : α) : ℂ := body · 2 lines
∑ τ : Fin n → α, if (Fin.cons (α:=fun _=>α) a τ) (Fin.last n)=b then
∏ j : Fin n, K j ((Fin.cons (α:=fun _=>α) a τ) j.castSucc) (τ j) else 0lemma matrixPath_zero {α : Type*} [Fintype α] [DecidableEq α]
(K : Fin 0 → Matrix α α ℂ) (a b : α) :
matrixPath K a b = if a=b then 1 else 0 := by proof · 1 line
simp [matrixPath]
lemma matrixPath_succ {α : Type*} [Fintype α] [DecidableEq α] {n : ℕ}
(K : Fin (n+1) → Matrix α α ℂ) (a b : α) :
matrixPath K a b = ∑ c, K 0 a c * matrixPath (fun j => K j.succ) c b := by proof · 14 lines
unfold matrixPath
rw [sum_vectors_cons]
apply Finset.sum_congr rfl
intro c hc
rw [Finset.mul_sum]
apply Finset.sum_congr rfl
intro τ hτ
have hl : (Fin.cons (α:=fun _=>α) a (Fin.cons (α:=fun _=>α) c τ)) (Fin.last (n+1)) =
(Fin.cons (α:=fun _=>α) c τ) (Fin.last n) := rfl
rw [hl]
split_ifs with hb
· rw [Fin.prod_univ_succ]
congr 1
· simptheorem matrixPath_eq_prod {α : Type*} [Fintype α] [DecidableEq α] {n : ℕ}
(K : Fin n → Matrix α α ℂ) (a b : α) :
matrixPath K a b = (List.ofFn K).prod a b := by proof · 7 lines
induction n generalizing a b with
| zero => simp [matrixPath_zero,Matrix.one_apply]
| succ n ih =>
rw [matrixPath_succ,List.ofFn_succ,List.prod_cons,Matrix.mul_apply]
apply Finset.sum_congr rfl
intro c hc
rw [ih]abbrev Column (H : ℕ) := Fin H → Fin 3 noncomputable def columnProduct {H : ℕ} (west east vertical : Column H) (north : Fin 3) : ℂ := body · 2 lines
∏ j : Fin H, Planar.sourceR (kappa:ℂ) (kappa^2:ℂ) (kappa^2:ℂ) (kappa^2:ℂ) 0
((Fin.snoc (α:=fun _=>Fin 3) vertical north) j.succ,west j) (vertical j,east j)noncomputable def columnKernel (H : ℕ) (south north : Fin 3) : Matrix (Column H) (Column H) ℂ := body · 3 lines
fun west east => ∑ vertical : Column H,
if (Fin.snoc (α:=fun _=>Fin 3) vertical north) 0=south then
columnProduct west east vertical north else 0188Literal grid spins after fixing the west and north outer boundaries. The remaining horizontal and vertical wires are genuine independent coordinates, not redundant copies at the centers.
def spinsFromColumns {W H : ℕ} (west : Column H) (north : Fin W → Fin 3)
(horizontal : Fin W → Column H) (vertical : Fin W → Column H) : GridWire W H → Fin 3 body · 2 lines
| .inl (i,j) => (Fin.cons (α:=fun _=>Column H) west horizontal) i j
| .inr (i,j) => (Fin.snoc (α:=fun _=>Fin 3) (vertical i) (north i)) jlemma physical_columns {W H : ℕ} (west : Column H) (north : Fin W → Fin 3)
(horizontal vertical : Fin W → Column H) :
(network W H).physical (spinsFromColumns west north horizontal vertical) =
∏ i : Fin W, columnProduct ((Fin.cons (α:=fun _=>Column H) west horizontal) i.castSucc)
(horizontal i) (vertical i) (north i) := by proof · 7 lines
unfold TileNetwork.physical columnProduct
rw [Fintype.prod_prod_type]
apply Finset.prod_congr rfl
intro i hi
apply Finset.prod_congr rfl
intro j hj
simp [network,spinsFromColumns]209Actual finite grid tensor with all four boundary spin lists prescribed. West and north are built into the parametrization; east and south are imposed by their exact indicator, before performing any orientation sum.
noncomputable def prescribedPartition (W H : ℕ) (west east : Column H)
(south north : Fin W → Fin 3) : ℂ := body · 4 lines
∑ horizontal : Fin W → Column H, ∑ vertical : Fin W → Column H,
if (Fin.cons (α:=fun _=>Column H) west horizontal) (Fin.last W)=east ∧
(∀ i, (Fin.snoc (α:=fun _=>Fin 3) (vertical i) (north i)) 0=south i) then
(network W H).physical (spinsFromColumns west north horizontal vertical) else 0lemma prescribedPartition_eq_matrixPath (W H : ℕ) (west east : Column H)
(south north : Fin W → Fin 3) :
prescribedPartition W H west east south north =
matrixPath (fun i => columnKernel H (south i) (north i)) west east := by proof · 14 lines
classical
unfold prescribedPartition matrixPath
apply Finset.sum_congr rfl
intro horizontal hhorizontal
by_cases he : (Fin.cons (α:=fun _=>Column H) west horizontal) (Fin.last W)=east
· simp only [he,true_and,ite_true]
simp_rw [physical_columns]
unfold columnKernel
rw [Fintype.prod_sum]
apply Finset.sum_congr rfl
intro vertical hvertical
rw [Fintype.prod_ite_zero]
split_ifs <;> rfl
· simp [he]238The exact full finite rectangle contraction is the product of its physical column matrices. Together with
grid_physical_eq_centersthis connects the transfer ordering to the literal center tensors.
theorem prescribedPartition_eq_transfer (W H : ℕ) (west east : Column H)
(south north : Fin W → Fin 3) :
prescribedPartition W H west east south north =
(List.ofFn (fun i => columnKernel H (south i) (north i))).prod west east := by proof · 1 line
rw [prescribedPartition_eq_matrixPath,matrixPath_eq_prod]
246The parametrization has exactly the actual spin assignments with the west/north walls fixed; no geometric configurations are dropped.
def HasWestNorth {W H : ℕ} (west : Column H) (north : Fin W → Fin 3)
(σ : GridWire W H → Fin 3) : Prop := body · 1 line
(∀ j, σ (.inl (0,j))=west j) ∧ (∀ i, σ (.inr (i,Fin.last H))=north i)lemma spinsFromColumns_boundary {W H : ℕ} (west : Column H) (north : Fin W → Fin 3)
(horizontal vertical : Fin W → Column H) :
HasWestNorth west north (spinsFromColumns west north horizontal vertical) := by proof · 1 line
constructor <;> intro i <;> simp [spinsFromColumns]
def gridSpinsEquiv {W H : ℕ} (west : Column H) (north : Fin W → Fin 3) :
((Fin W → Column H) × (Fin W → Column H)) ≃
{σ : GridWire W H → Fin 3 // HasWestNorth west north σ} where body · 21 lines
toFun p := ⟨spinsFromColumns west north p.1 p.2,
spinsFromColumns_boundary west north p.1 p.2⟩
invFun σ := (fun i j => σ.val (.inl (i.succ,j)),
fun i j => σ.val (.inr (i,j.castSucc)))
left_inv p := by
rcases p with ⟨horizontal,vertical⟩
ext i j <;> simp [spinsFromColumns]
right_inv σ := by
apply Subtype.ext
funext wire
cases wire with
| inl p =>
rcases p with ⟨i,j⟩
cases i using Fin.cases with
| zero => simpa [spinsFromColumns] using (σ.property.1 j).symm
| succ i => simp [spinsFromColumns]
| inr p =>
rcases p with ⟨i,j⟩
cases j using Fin.lastCases with
| last => simpa [spinsFromColumns] using (σ.property.2 i).symm
| cast j => simp [spinsFromColumns]noncomputable instance fixedGridSpinsFintype {W H : ℕ} (west : Column H) (north : Fin W → Fin 3) :
Fintype {σ : GridWire W H → Fin 3 // HasWestNorth west north σ} := body · 1 line
Fintype.ofEquiv ((Fin W → Column H) × (Fin W → Column H)) (gridSpinsEquiv west north)285Exact literal finite-network expression for the prescribed partition.
theorem prescribedPartition_eq_grid_sum (W H : ℕ) (west east : Column H)
(south north : Fin W → Fin 3) :
prescribedPartition W H west east south north =
∑ σ : {σ : GridWire W H → Fin 3 // HasWestNorth west north σ},
if (∀ j, σ.val (.inl (Fin.last W,j))=east j) ∧
(∀ i, σ.val (.inr (i,0))=south i) then
(network W H).physical σ.val else 0 := by proof · 16 lines
classical
rw [←(gridSpinsEquiv west north).sum_comp]
rw [Fintype.sum_prod_type]
unfold prescribedPartition
apply Finset.sum_congr rfl
intro horizontal hh
apply Finset.sum_congr rfl
intro vertical hv
change (if (Fin.cons (α:=fun _=>Column H) west horizontal) (Fin.last W)=east ∧
(∀ i, (Fin.snoc (α:=fun _=>Fin 3) (vertical i) (north i)) 0=south i) then
(network W H).physical (spinsFromColumns west north horizontal vertical) else 0) =
(if (∀ j, (Fin.cons (α:=fun _=>Column H) west horizontal) (Fin.last W) j=east j) ∧
(∀ i, (Fin.snoc (α:=fun _=>Fin 3) (vertical i) (north i)) 0=south i) then
(network W H).physical (spinsFromColumns west north horizontal vertical) else 0)
congr 1
exact propext (and_congr funext_iff Iff.rfl)Outline
- abbrev
Cell16 - abbrev
GridWire19 - abbrev
FullWire20 - def
network22 - def
wireEmbedding28 - lemma
wireEmbedding_injective33 - def
spins52 - lemma
spins_wire56 - def
cellCenter60 - lemma
cellCenter_injective63 - def
domain70 - lemma
up_wires73 - lemma
down_wires79 - lemma
up_centerTensor85 - lemma
down_centerTensor92 - lemma
center_product_eq100 - theorem
grid_physical_eq_centers113 - lemma
sum_vectors_cons127 - def
matrixPath135 - lemma
matrixPath_zero140 - lemma
matrixPath_succ145 - theorem
matrixPath_eq_prod163 - abbrev
Column174 - def
columnProduct176 - def
columnKernel180 - def
spinsFromColumns188 - lemma
physical_columns193 - def
prescribedPartition209 - lemma
prescribedPartition_eq_matrixPath216 - theorem
prescribedPartition_eq_transfer238 - def
HasWestNorth246 - lemma
spinsFromColumns_boundary250 - def
gridSpinsEquiv255 - instance
fixedGridSpinsFintype280 - theorem
prescribedPartition_eq_grid_sum285
Xet Storage Details
- Size:
- 14.1 kB
- Xet hash:
- af42f2a467c4c62d6a9286fe0ba8923b3ff996e707520c9659a3dce5cd458d79
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.