Contraction of factored tensor networks
DefinitionMerging vertices of a factored tensor network#✓fully proved
Merge vertices along χ, retaining source states and labels on their classes and padding all
other coordinates with the supplied defaults.
def merge [Fintype J] [LinearOrder J] [LinearOrder J'] (N : Factored J σ τ)
(χ : J → J') (defaultState : σ) (defaultLabel : τ) :
Factored J' (J → σ) (J × J → τ) where
S G := Fintype.piFinsetOn (fun a => χ a = G) N.S defaultState
W G z :=
(∏ a with χ a = G, N.W a (z a)) *
∏ p ∈ orderedPairs J with χ p.1 = G ∧ χ p.2 = G,
N.interaction p.1 p.2 (z p.1) (z p.2)
Θ G G' := Fintype.piFinsetOn (fun p : J × J => χ p.1 = G ∧ χ p.2 = G')
(fun p => N.labelSet p.1 p.2) defaultLabel
f G G' z t :=
∏ p : J × J with χ p.1 = G ∧ χ p.2 = G',
N.f p.1 p.2 (z p.1) (t (if G < G' then p else p.swap))
c G G' := ∑ p : J × J with χ p.1 = G ∧ χ p.2 = G', N.c p.1 p.2
structure Factored (J σ τ : Type*) where
/-- The finite set of states allowed at each vertex. -/
S : J → Finset σ
/-- The integer weight of a state at a vertex. -/
W : J → σ → ℤ
/-- The finite label set stored in increasing vertex order. -/
Θ : J → J → Finset τ
/-- The factor contributed on one vertex's side of an edge label. -/
f : J → J → σ → τ → ℤ
/-- The directed capacity table; the bare structure does not require symmetry. -/
c : J → J → ℕ
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:84
S : J → Finset σ
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:86
def piFinsetOn (P : ι → Prop) [DecidablePred P] (T : ι → Finset σ) (d : σ) :
Finset (ι → σ) :=
piFinset fun i => if P i then T i else {d}
MathlibExt/Data/Fintype/PiFinsetOn.lean:35
W : J → σ → ℤ
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:88
def orderedPairs (J : Type*) [Fintype J] [LinearOrder J] : Finset (J × J) :=
univ.filter fun p => p.1 < p.2
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:37
Θ : J → J → Finset τ
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:90
f : J → J → σ → τ → ℤ
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:92
c : J → J → ℕ
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:94
TheoremInteraction of merged classes in increasing order#✓fully proved
The interaction of two increasingly ordered classes is the product of all source interactions crossing between them.
theorem merge_interaction_lt [Fintype J] [LinearOrder J] [LinearOrder J']
(N : Factored J σ τ) (χ : J → J') (defaultState : σ) (defaultLabel : τ)
{G G' : J'} (h : G < G') (z z' : J → σ) :
(N.merge χ defaultState defaultLabel).interaction G G' z z' =
∏ p : J × J with χ p.1 = G ∧ χ p.2 = G',
N.interaction p.1 p.2 (z p.1) (z' p.2)
structure Factored (J σ τ : Type*) where
/-- The finite set of states allowed at each vertex. -/
S : J → Finset σ
/-- The integer weight of a state at a vertex. -/
W : J → σ → ℤ
/-- The finite label set stored in increasing vertex order. -/
Θ : J → J → Finset τ
/-- The factor contributed on one vertex's side of an edge label. -/
f : J → J → σ → τ → ℤ
/-- The directed capacity table; the bare structure does not require symmetry. -/
c : J → J → ℕ
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:84
Uses 7 · Used by 2
TheoremInteraction of two distinct merged classes#✓fully proved
The interaction of two distinct classes is the product of all source interactions crossing between them, oriented from the first class to the second.
theorem merge_interaction [Fintype J] [LinearOrder J] [LinearOrder J']
(N : Factored J σ τ) (χ : J → J') (defaultState : σ) (defaultLabel : τ)
{G G' : J'} (h : G ≠ G') (z z' : J → σ) :
(N.merge χ defaultState defaultLabel).interaction G G' z z' =
∏ p : J × J with χ p.1 = G ∧ χ p.2 = G',
N.interaction p.1 p.2 (z p.1) (z' p.2)
structure Factored (J σ τ : Type*) where
/-- The finite set of states allowed at each vertex. -/
S : J → Finset σ
/-- The integer weight of a state at a vertex. -/
W : J → σ → ℤ
/-- The finite label set stored in increasing vertex order. -/
Θ : J → J → Finset τ
/-- The factor contributed on one vertex's side of an edge label. -/
f : J → J → σ → τ → ℤ
/-- The directed capacity table; the bare structure does not require symmetry. -/
c : J → J → ℕ
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:84
TheoremMerging vertices preserves network value#✓fully proved
Merging along any map preserves the exact integer-valued network value.
theorem value_merge [Fintype J] [LinearOrder J] [Fintype J'] [LinearOrder J']
(N : Factored J σ τ) (χ : J → J') (defaultState : σ) (defaultLabel : τ) :
(N.merge χ defaultState defaultLabel).value = N.value
structure Factored (J σ τ : Type*) where
/-- The finite set of states allowed at each vertex. -/
S : J → Finset σ
/-- The integer weight of a state at a vertex. -/
W : J → σ → ℤ
/-- The finite label set stored in increasing vertex order. -/
Θ : J → J → Finset τ
/-- The factor contributed on one vertex's side of an edge label. -/
f : J → J → σ → τ → ℤ
/-- The directed capacity table; the bare structure does not require symmetry. -/
c : J → J → ℕ
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:84
TheoremNumber of states of a merged vertex#✓fully proved
The number of merged states is the product of the state-set sizes in the class.
theorem card_merge_S [Fintype J] [LinearOrder J] [LinearOrder J']
(N : Factored J σ τ) (χ : J → J') (defaultState : σ) (defaultLabel : τ)
(G : J') :
((N.merge χ defaultState defaultLabel).S G).card =
∏ a with χ a = G, (N.S a).card
structure Factored (J σ τ : Type*) where
/-- The finite set of states allowed at each vertex. -/
S : J → Finset σ
/-- The integer weight of a state at a vertex. -/
W : J → σ → ℤ
/-- The finite label set stored in increasing vertex order. -/
Θ : J → J → Finset τ
/-- The factor contributed on one vertex's side of an edge label. -/
f : J → J → σ → τ → ℤ
/-- The directed capacity table; the bare structure does not require symmetry. -/
c : J → J → ℕ
MathlibExt/Combinatorics/TensorNetwork/Basic.lean:84
Uses 3 · Used by 1
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.