Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
c331950
feat(circuit/frontier): Boolean tensor networks and their contraction
SamuelSchlesinger Oct 30, 2026
ae63897
feat(circuit/frontier): deformed contraction and the Cauchy kernel
SamuelSchlesinger Oct 30, 2026
b06c211
refactor(circuit/frontier): index explicit tables by BitString.lsbValue
SamuelSchlesinger Oct 30, 2026
6c76726
Merge claude/boolean-tensor-networks (#1844 review fix) into the T2.1…
SamuelSchlesinger Oct 30, 2026
31ff8a6
feat(circuit/frontier): Lemma D.4, integral local coordinates of the …
SamuelSchlesinger Oct 30, 2026
3d38310
refactor(foundations): move integer valuation bounds to RatValuation
SamuelSchlesinger Oct 30, 2026
adeeddc
feat(circuit/frontier): mode expansion and the child identity (D.16)
SamuelSchlesinger Oct 30, 2026
6e6afdd
Merge remote-tracking branch 'origin/claude/t2-integral-coordinates' …
SamuelSchlesinger Oct 30, 2026
05c80d0
feat(circuit/frontier): modes of the Cauchy matrix, the geometric exp…
SamuelSchlesinger Oct 30, 2026
02ef13c
feat(GenericRAM/Native): depth-first stack recursion with native bounds
SamuelSchlesinger Oct 31, 2026
99d9e0d
feat(PolyTime): arithmetic in (Z/2^p)[U]/(f) on coefficient lists
SamuelSchlesinger Oct 31, 2026
27d0311
doc(GenericRAM/Native): qualify the module path in the stack recursio…
SamuelSchlesinger Oct 31, 2026
70f4cd5
feat(PolyTime/Nat): the clock 2^(K n / sqrt(floor(log2 n))) in polyno…
SamuelSchlesinger Oct 31, 2026
b9caee5
feat(PolyTime): unit and powers in (Z/2^p)[U]/(f)
SamuelSchlesinger Oct 31, 2026
dc4824e
feat(PolyTime): negation, subtraction and Newton inversion in (Z/2^p)…
SamuelSchlesinger Oct 31, 2026
164f4b2
Merge remote-tracking branch 'origin/main' into claude/t2-native-recu…
SamuelSchlesinger Oct 31, 2026
f9bcc51
Merge origin/main into claude/t2-cauchy-modes
SamuelSchlesinger Oct 31, 2026
7926132
feat(circuit/frontier): direct summation over networks with described…
SamuelSchlesinger Oct 31, 2026
3685aba
feat(circuit/frontier): explicit packet entries of the child networks…
SamuelSchlesinger Oct 31, 2026
4c076d5
feat(circuit/frontier): the local Cauchy kernel as a product of units…
SamuelSchlesinger Oct 31, 2026
c997e5f
Merge remote-tracking branch 'origin/claude/t2-galois-arith' into cla…
SamuelSchlesinger Oct 31, 2026
36c9ae9
Merge origin/main into claude/t2-packet-entry
SamuelSchlesinger Oct 31, 2026
955f94a
feat(circuit/frontier): direct summation over described networks with…
SamuelSchlesinger Oct 31, 2026
67d77cc
Merge remote-tracking branch 'origin/main' into claude/t2-described-g…
SamuelSchlesinger Oct 31, 2026
9e5bd2b
Merge origin/main into claude/t2-described-leaf
SamuelSchlesinger Oct 31, 2026
87ee708
Merge remote-tracking branch 'origin/main' into claude/t2-packet-eval…
SamuelSchlesinger Oct 31, 2026
62dc6f5
feat(circuit/frontier): evaluate packet entries on coefficient lists …
SamuelSchlesinger Oct 31, 2026
04fe069
refactor(circuit/frontier): packet modes by dense index y0 * nb + b
SamuelSchlesinger Oct 31, 2026
3615494
Merge remote-tracking branch 'origin/claude/t2-described-galois' into…
SamuelSchlesinger Oct 31, 2026
5317b59
feat(circuit/frontier): coefficient extraction as a stack recursion
SamuelSchlesinger Oct 31, 2026
3130c30
refactor(circuit/frontier): take the number of slots L as a parameter…
SamuelSchlesinger Oct 31, 2026
44c05e5
Merge branch 'claude/t2-packet-evaluator' into claude/t2-coeff-scheme
SamuelSchlesinger Oct 31, 2026
1454915
fix(circuit/frontier): mode terms vanish when a packet has no exponents
SamuelSchlesinger Oct 31, 2026
7aed491
Merge branch 'claude/t2-packet-evaluator' into claude/t2-coeff-scheme
SamuelSchlesinger Oct 31, 2026
fb6f83d
feat(circuit/frontier): the native packet evaluator in time exp(O(L l…
SamuelSchlesinger Oct 31, 2026
e03f0ce
feat(circuit/frontier): descriptors of packet vertices and their nati…
SamuelSchlesinger Oct 31, 2026
8e9725b
Merge remote-tracking branch 'origin/main' into claude/t2-packet-eval…
SamuelSchlesinger Oct 31, 2026
5736072
chore: regenerate Complexity.lean after merging main
SamuelSchlesinger Oct 31, 2026
1b2f892
Merge branch 'claude/t2-packet-evaluator' into claude/t2-coeff-scheme
SamuelSchlesinger Oct 31, 2026
74a464e
chore: regenerate Complexity.lean after merging the base
SamuelSchlesinger Oct 31, 2026
0e967bc
Merge branch 'claude/t2-coeff-scheme' into claude/t2-packet-terms
SamuelSchlesinger Oct 31, 2026
956e30a
feat(circuit/frontier): vertex descriptors and the entries of native …
SamuelSchlesinger Oct 31, 2026
ef0982e
refactor(circuit/frontier): share the port/descriptor record between …
SamuelSchlesinger Oct 31, 2026
d18d15f
test(circuit/frontier): name IsRowsFirstBipartite explicitly on an an…
SamuelSchlesinger Oct 31, 2026
88ddd69
refactor(circuit/frontier): number packet modes with Mathlib's finPro…
SamuelSchlesinger Oct 31, 2026
bd4bf8e
Merge branch 'claude/t2-packet-evaluator' into claude/t2-coeff-scheme
SamuelSchlesinger Oct 31, 2026
21e70d1
Merge branch 'claude/t2-described-galois' into claude/t2-coeff-scheme
SamuelSchlesinger Oct 31, 2026
9bc99e7
Merge branch 'claude/t2-coeff-scheme' into claude/t2-packet-terms
SamuelSchlesinger Oct 31, 2026
30bb409
refactor(circuit/frontier): read packet exponents at finProdFinEquiv …
SamuelSchlesinger Oct 31, 2026
1268016
Merge branch 'claude/t2-packet-terms' into claude/t2-assembly
SamuelSchlesinger Oct 31, 2026
a74e6d0
refactor(circuit/frontier): read packet exponents at finProdFinEquiv …
SamuelSchlesinger Oct 31, 2026
b585eeb
Merge branch 'claude/t2-described-leaf' into claude/t2-described-galois
SamuelSchlesinger Oct 31, 2026
766fca0
Merge remote-tracking branch 'origin/main' into claude/t2-described-g…
SamuelSchlesinger Oct 31, 2026
cd930a8
Merge remote-tracking branch 'origin/main' into claude/t2-packet-eval…
SamuelSchlesinger Oct 31, 2026
f5bd48c
Merge branch 'claude/t2-packet-evaluator' into claude/t2-coeff-scheme
SamuelSchlesinger Oct 31, 2026
2689826
Merge branch 'claude/t2-described-galois' into claude/t2-coeff-scheme
SamuelSchlesinger Oct 31, 2026
69dc8fb
Merge branch 'claude/t2-coeff-scheme' into claude/t2-packet-terms
SamuelSchlesinger Oct 31, 2026
1e77f7d
Merge branch 'claude/t2-packet-terms' into claude/t2-assembly
SamuelSchlesinger Oct 31, 2026
babef77
chore: regenerate Complexity.lean after merging the base
SamuelSchlesinger Oct 31, 2026
3dd7894
Merge origin/main into claude/t2-assembly
SamuelSchlesinger Oct 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Complexity.lean
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ public import Complexity.Computability.Circuit.Frontier.TensorNetwork.ActiveCall
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.Binarize
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.CauchyModes
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.ChildCursor
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.ChildEntries
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.ChildNumbering
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.ChildSize
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.CoeffScheme
Expand All @@ -930,11 +931,13 @@ public import Complexity.Computability.Circuit.Frontier.TensorNetwork.PacketEntr
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.PacketEvaluator
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.PacketTerms
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.Recursion
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.ReductionLift
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.Reindex
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.Schedule
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.ScheduleCount
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.ScheduledRecursion
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.TaperedRecovery
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.VertexDesc
public import Complexity.Computability.Circuit.Frontier.TwoSidedWitness
public import Complexity.Computability.Circuit.Frontier.Unconditional
public import Complexity.Computability.Circuit.Frontier.Witness
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,308 @@
/-
Copyright (c) 2026 Samuel Schlesinger. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Samuel Schlesinger
-/

module
-- upstream: candidate

public import Complexity.Computability.Circuit.Frontier.TensorNetwork.VertexDesc
public import Complexity.Computability.Circuit.Frontier.TensorNetwork.DescribedContraction
import Mathlib.Data.List.GetD

/-!
# The entries of the child networks from their descriptors

A child network of the contraction recursion of [OpenAI2026ETH] (`ModeSplitting.child`, §D.4.6,
p. 63) is carried natively as a network of vertex descriptors (`VertexDesc`) with port lists. This
file proves that such a network has the contraction of the child, once each descriptor reads its
ports in the right order.

* **Port lists** (`DescribedNetwork.contraction_eq_of_ports`). Number the vertices and the edges of
a Boolean tensor network `N`, and give each vertex any list of edges as its ports and a
descriptor. If the evaluator at the descriptor of `v`, read at the bits of an assignment on its
ports, is the tensor of `v` at that assignment, the described network has the contraction of
`N`.
* **Retained vertices** (`ModeSplitting.child_tensor_inl_eq_tensor`). A vertex of group `g` keeps
its tensor in the child of group `g`: a row reads its row ports and a column its column ports.
So a retained vertex keeps its descriptor, and its ports are its parent ports, in the same
order, renumbered as child edges.
* **Packet vertices** (`TensorNetwork.map_val_entry_child_inr`). Let the ports of the packet
vertex `q` be the child edges of packet `q` in any order without repetition, and let its
descriptor tag each port with whether it is a row port and with its slot, in the same order. Then
along any ring map from `A_p` to the coefficient ring of the child, the descriptor's entry at the
bits on its ports is the child's entry (`child_tensor_inr_cauchyModeSplitting`), for the
packet's context matching the node `(t, ζ)`, the group `g`, the symbols of `q` and the exponents
`β`. The tags are computed from the port list itself, so tags and bits align by construction
(`NativePacket.sidePorts_map`).

## Main results

* `Cslib.Circuits.Frontier.DescribedNetwork.contraction_eq_of_ports`: a described network with
port lists has the contraction of the network it describes.
* `Cslib.Circuits.Frontier.NativePacket.sidePorts_map`: the ports of one side of a tagged list.
* `Cslib.Circuits.Frontier.TensorNetwork.ModeSplitting.child_tensor_inl_eq_tensor`: the entries
of the retained vertices of a child.
* `Cslib.Circuits.Frontier.TensorNetwork.map_val_entry_child_inr`: the entries of the packet
vertices of a Cauchy child, from their descriptors.

## References

* [OpenAI, *The Exponential Time Hypothesis is False*][OpenAI2026ETH], §D.4.6, p. 63.
-/

public section

namespace Cslib.Circuits.Frontier

/-- The subring `ℤ_(2)` of rationals with odd denominator. -/
local notation "ℤ₍₂₎" => Valuation.integer (Rat.padicValuation 2)

open Finset GaloisRingArith NativePacket

/-! ### Port lists -/

namespace DescribedNetwork

variable {T : Type} {R : Type*} [CommSemiring R] {V E : Type*} [Fintype V] [Fintype E]
[DecidableEq E]

/-- **A described network with port lists has the contraction of the network it describes.**
Number the vertices of `N` by `ev` and its edges by `ee`, and give each vertex `v` a list of edges
`ports v` and a descriptor `desc v`. If the evaluator at `desc v`, read at the bits of every
assignment on `ports v`, is the tensor of `v` at that assignment, the described network with the
numbered ports and the descriptors has the contraction of `N`. -/
theorem contraction_eq_of_ports {k l : ℕ} (N : TensorNetwork R Bool V E) (ev : V ≃ Fin k)
(ee : E ≃ Fin l) (ports : V → List E) (desc : V → T) (eval : T → List Bool → R)
(h : ∀ v (x : E → Bool), eval (desc v) ((ports v).map x) = N.tensor v x) :
(⟨l, List.ofFn fun i => ((ports (ev.symm i)).map fun e => (ee e : ℕ), desc (ev.symm i))⟩ :
DescribedNetwork T).contraction eval = N.contraction := by
simp only [contraction, TensorNetwork.contraction, List.map_ofFn, List.prod_ofFn]
rw [← (ee.arrowCongr (Equiv.refl Bool)).symm.sum_comp]
refine sum_congr rfl fun x _ => ?_
rw [← ev.symm.prod_comp]
refine prod_congr rfl fun v _ => ?_
simp only [Function.comp_apply]
rw [← h]
congr 1
simp only [wordBits, List.map_map]
refine List.map_congr_left fun e _ => ?_
simp only [Function.comp_apply, Equiv.arrowCongr_symm, Equiv.arrowCongr_apply,
Equiv.symm_symm, Equiv.refl_symm, Equiv.coe_refl, id_eq]
rw [List.getD_eq_getElem _ _ (by simp), List.getElem_ofFn]

end DescribedNetwork

/-! ### The ports of one side of a tagged list -/

namespace NativePacket

/-- **The ports of one side of a tagged list.** If the ports of a vertex are tagged, in their
order, by whether they are row ports and by their slots, and the bits are read in the same order,
the ports of one side are the ports with that tag, with their slots and bits, in order. -/
theorem sidePorts_map {α : Type*} (cs : List α) (tag : α → Bool) (sl : α → ℕ) (y : α → Bool)
(side : Bool) :
sidePorts (cs.map fun c => (tag c, sl c)) (cs.map y) side =
(cs.filter fun c => tag c == side).map fun c => (sl c, y c) := by
induction cs with
| nil => rfl
| cons c cs ih =>
simp only [sidePorts, List.length_map] at ih
simp only [sidePorts, List.map_cons, List.length_cons, List.length_map,
List.range_succ_eq_map, List.filter_cons, List.filter_map, List.getD_cons_zero,
Function.comp_def, List.getD_cons_succ]
by_cases hc : tag c == side
· rw [ite_eq_left hc, ite_eq_left hc]
simp only [List.map_cons, List.map_map]
rw [← ih]
rfl
· rw [ite_eq_right hc, ite_eq_right hc]
simp only [List.map_map]
rw [← ih]
rfl

end NativePacket

namespace TensorNetwork

/-! ### Retained vertices -/

namespace ModeSplitting

variable {R V E G P M : Type*} [CommRing R] [Fintype M] [DecidableEq V] [Fintype E]
[DecidableEq E] [DecidableEq P] [DecidableEq G] [DecidableEq M] {N : TensorNetwork R Bool V E}
{W : Matrix E E R} (S : ModeSplitting N W G P M)

/-- **The retained vertices of a child**: a vertex of group `g` keeps its tensor in the child of
group `g`, reading at each of its edges the child edge of that edge: a row its row ports and a
column its column ports. -/
theorem child_tensor_inl_eq_tensor (β : M → ℕ) (g : G) (v : {v // S.group v = g})
(y : {e // S.group (N.src e) = g} ⊕ {e // S.group (N.tgt e) = g} → Bool) :
(S.child β g).tensor (.inl v) y = N.tensor v.1 fun e =>
if S.side v.1 then (if h : S.group (N.src e) = g then y (.inl ⟨e, h⟩) else false)
else (if h : S.group (N.tgt e) = g then y (.inr ⟨e, h⟩) else false) := by
simp only [child]
by_cases hv : S.side v.1
· rw [ite_eq_left hv]
refine N.tensor_congr _ _ _ fun e he => ?_
simp only [ite_eq_left hv]
by_cases hs : N.src e = v.1
· rw [dite_eq_left hs, dite_eq_left (hs ▸ v.2)]
· have ht : N.tgt e = v.1 := he.resolve_left hs
have := S.side_tgt e
rw [ht, hv] at this
exact absurd this (by decide)
· rw [ite_eq_right hv]
refine N.tensor_congr _ _ _ fun e he => ?_
simp only [ite_eq_right hv]
by_cases ht : N.tgt e = v.1
· rw [dite_eq_left ht, dite_eq_left (ht ▸ v.2)]
· have hs : N.src e = v.1 := he.resolve_right ht
have := S.side_src e
rw [hs] at this
exact absurd this hv

end ModeSplitting

/-! ### Packet vertices -/

section Ports

variable {R V E G : Type*} [DecidableEq G] {N : TensorNetwork R Bool V E} {group : V → G}
{slot : E → ℕ}

/-- The row ports of a list of child edges, with their slots and bits. -/
private theorem filter_isLeft_map {g : G}
(cs : List ({e // group (N.src e) = g} ⊕ {e // group (N.tgt e) = g}))
(y : {e // group (N.src e) = g} ⊕ {e // group (N.tgt e) = g} → Bool) :
(cs.filter fun c => c.isLeft == true).map
(fun c => (slot (Sum.elim Subtype.val Subtype.val c), y c)) =
((cs.filterMap Sum.getLeft?).map Subtype.val).map fun e =>
(slot e, if h : group (N.src e) = g then y (.inl ⟨e, h⟩) else false) := by
induction cs with
| nil => rfl
| cons c cs ih =>
rcases c with c | c
· rw [List.filter_cons_of_pos rfl, List.filterMap_cons_some (f := Sum.getLeft?) rfl,
List.map_cons, List.map_cons, List.map_cons, ih, dite_eq_left c.2]
rfl
· rw [List.filter_cons_of_neg (by simp), List.filterMap_cons_none (f := Sum.getLeft?) rfl, ih]

/-- The column ports of a list of child edges, with their slots and bits. -/
private theorem filter_isLeft_false_map {g : G}
(cs : List ({e // group (N.src e) = g} ⊕ {e // group (N.tgt e) = g}))
(y : {e // group (N.src e) = g} ⊕ {e // group (N.tgt e) = g} → Bool) :
(cs.filter fun c => c.isLeft == false).map
(fun c => (slot (Sum.elim Subtype.val Subtype.val c), y c)) =
((cs.filterMap Sum.getRight?).map Subtype.val).map fun e =>
(slot e, if h : group (N.tgt e) = g then y (.inr ⟨e, h⟩) else false) := by
induction cs with
| nil => rfl
| cons c cs ih =>
rcases c with c | c
· rw [List.filter_cons_of_neg (by simp), List.filterMap_cons_none (f := Sum.getRight?) rfl,
ih]
· rw [List.filter_cons_of_pos rfl, List.filterMap_cons_some (f := Sum.getRight?) rfl,
List.map_cons, List.map_cons, List.map_cons, ih, dite_eq_left c.2]
rfl

end Ports

section Cauchy

variable {R V E G P : Type*} [CommRing R] [Fintype E] [DecidableEq E] [Fintype P] [DecidableEq G]
[DecidableEq P] {N : TensorNetwork R Bool V E} {group : V → G} {packet : E → P} {slot : E → ℕ}
{sym : P → G × G} {i : ℕ}
(side : V → Bool) (hsrc : ∀ e, side (N.src e) = true)
(htgt : ∀ e, side (N.tgt e) = false)
(horient : ∀ e, (group (N.src e), group (N.tgt e)) =
if (slot e).testBit i then (sym (packet e)).swap else sym (packet e))
{a : ℕ} (hslot : ∀ e, slot e < 2 ^ a) (hia : i < a) (κ : ℤ₍₂₎ →+* R) (ζ : R) {p : ℕ}
(hp : (2 : R) ^ p = 0) {t : ℤ} (ht : t ∈ cauchyGrid (2 ^ a)) (hti : (2 : ℤ) ^ i ∣ t)
(hti' : ¬ (2 : ℤ) ^ (i + 1) ∣ t)

/-- **The packet vertices of a Cauchy child, from their descriptors.** Let the ports of the
packet vertex `q` in the child of group `g` be the child edges of packet `q`, listed without
repetition in any order, and let the descriptor's ports tag each of them, in the same order, with
whether it is a row port and with its slot. Let the packet's context have the node `t` of
valuation `i < a`, `L = 2 ^ a` slots, `2 ^ (i + 1)` tiles and `p` exponents per tile, the symbols
of `q` against `g`, an interpolation value mapping to `ζ`, and the dense exponents of `β` at `q`.
Then along a ring map `ψ` from `A_p`, at the packet's precision, to `R`, the descriptor's entry at
the bits on its ports is the child's entry. -/
theorem map_val_entry_child_inr [DecidableEq V] (β : P × Fin (2 ^ (i + 1)) × Fin p → ℕ) (g : G)
(q : P)
(cs : List ({e // (cauchyModeSplitting side hsrc htgt horient hslot hia κ ζ hp ht hti
hti').group (N.src e) = g} ⊕
{e // (cauchyModeSplitting side hsrc htgt horient hslot hia κ ζ hp ht hti hti').group
(N.tgt e) = g}))
(hcs : cs.Nodup) (hcs' : ∀ c, c ∈ cs ↔ packet (Sum.elim Subtype.val Subtype.val c) = q)
(c : PacketCtx) (βd : List ℕ) (ψ : Ring c.p c.fl →+* R) (hζ : ψ (val c.p c.fl c.ζ) = ζ)
(ha : c.a = a) (hL : c.L = 2 ^ a) (hi : c.i = i) (htiles : c.tiles = 2 ^ (i + 1))
(ht' : c.t = t) (hnb : c.nb = p) (he₁ : c.e₁ = decide ((sym q).1 = g))
(he₂ : c.e₂ = decide ((sym q).2 = g)) (hdiffer : c.differ = decide ((sym q).1 ≠ (sym q).2))
(hβ : ∀ Z : Fin (2 ^ (i + 1)) × Fin p, βd.getD (finProdFinEquiv Z) 0 = β (q, Z))
(y : {e // (cauchyModeSplitting side hsrc htgt horient hslot hia κ ζ hp ht hti hti').group
(N.src e) = g} ⊕
{e // (cauchyModeSplitting side hsrc htgt horient hslot hia κ ζ hp ht hti hti').group
(N.tgt e) = g} → Bool) :
ψ (val c.p c.fl (VertexDesc.entry
(.inr (c, cs.map fun e => (e.isLeft, slot (Sum.elim Subtype.val Subtype.val e)), βd))
(cs.map y))) =
((cauchyModeSplitting side hsrc htgt horient hslot hia κ ζ hp ht hti hti').child β g).tensor
(.inr q) y := by
subst ha hi ht' hnb
have hports : ∀ x ∈ cs.map (fun e => (e.isLeft, slot (Sum.elim Subtype.val Subtype.val e))),
x.2 < 2 ^ c.a := by
intro x hx
obtain ⟨e, -, rfl⟩ := List.mem_map.mp hx
exact hslot _
have key := VertexDesc.map_val_entry_inr (c, cs.map fun e => (e.isLeft,
slot (Sum.elim Subtype.val Subtype.val e)), βd) (cs.map y) ψ hp κ hL hia htiles ht hti hti'
hports
have hgoal : ψ (val c.p c.fl (VertexDesc.entry (.inr (c, cs.map fun e => (e.isLeft,
slot (Sum.elim Subtype.val Subtype.val e)), βd)) (cs.map y))) = _ := key
rw [hgoal]
dsimp only
have hrows : ((cs.filterMap Sum.getLeft?).map Subtype.val).Nodup :=
((hcs.filterMap fun _ _ _ h₁ h₂ => by
rw [Option.mem_def, Sum.getLeft?_eq_some_iff] at h₁ h₂; rw [h₁, h₂])).map
Subtype.val_injective
have hcols : ((cs.filterMap Sum.getRight?).map Subtype.val).Nodup :=
((hcs.filterMap fun _ _ _ h₁ h₂ => by
rw [Option.mem_def, Sum.getRight?_eq_some_iff] at h₁ h₂; rw [h₁, h₂])).map
Subtype.val_injective
have hrows' : ∀ e, e ∈ (cs.filterMap Sum.getLeft?).map Subtype.val ↔
packet e = q ∧ group (N.src e) = g := by
intro e
simp only [List.mem_map, List.mem_filterMap, Sum.getLeft?_eq_some_iff]
constructor
· rintro ⟨e', ⟨c, hc, rfl⟩, rfl⟩
exact ⟨(hcs' _).1 hc, by simpa using e'.2⟩
· rintro ⟨hq, hg⟩
have hg' : (cauchyModeSplitting side hsrc htgt horient hslot hia κ ζ hp ht hti hti').group
(N.src e) = g := by simpa using hg
exact ⟨⟨e, hg'⟩, ⟨_, (hcs' (.inl ⟨e, hg'⟩)).2 hq, rfl⟩, rfl⟩
have hcols' : ∀ e, e ∈ (cs.filterMap Sum.getRight?).map Subtype.val ↔
packet e = q ∧ group (N.tgt e) = g := by
intro e
simp only [List.mem_map, List.mem_filterMap, Sum.getRight?_eq_some_iff]
constructor
· rintro ⟨e', ⟨c, hc, rfl⟩, rfl⟩
exact ⟨(hcs' _).1 hc, by simpa using e'.2⟩
· rintro ⟨hq, hg⟩
have hg' : (cauchyModeSplitting side hsrc htgt horient hslot hia κ ζ hp ht hti hti').group
(N.tgt e) = g := by simpa using hg
exact ⟨⟨e, hg'⟩, ⟨_, (hcs' (.inr ⟨e, hg'⟩)).2 hq, rfl⟩, rfl⟩
rw [child_tensor_inr_cauchyModeSplitting side hsrc htgt horient hslot hia κ _ hp ht hti hti' β
g q y hrows hrows' hcols hcols', sidePorts_map, sidePorts_map, filter_isLeft_map,
filter_isLeft_false_map, hζ, he₁, he₂, hdiffer]
congr 1
funext Z
exact hβ Z

end Cauchy

end TensorNetwork

end Cslib.Circuits.Frontier
Loading
Loading