cfahlgren1's picture
download
raw
5.53 kB
import Mathlib
import OAI.Computability.VertexCover.PCP.SpectralReturn
namespace OAI
namespace UniqueGames.Foundations.PCP.ZigzagGraphs
open PoweringWalks
variable {V D E : Type*}
def involutionEquiv {A : Type*} (f : A → A) (hf : Function.Involutive f) : A ≃ A where
toFun := f
invFun := f
left_inv := hf
right_inv := hf
theorem palindrome_involutive {A : Type*} (B P : A ≃ A)
(hB : Function.Involutive B) (hP : Function.Involutive P) :
Function.Involutive (B.trans (P.trans B)) := by
intro x
change B (P (B (B (P (B x))))) = x
rw [hB, hP, hB]
def squareFirst (G : PortGraph V D) (s : V × (D × D)) : V × (D × D) :=
let step := G.rot (s.1, s.2.1)
(step.1, (step.2, s.2.2))
theorem squareFirst_involutive (G : PortGraph V D) : Function.Involutive (squareFirst G) := by
rintro ⟨v, d₁, d₂⟩
change ((G.rot (G.rot (v, d₁))).1, ((G.rot (G.rot (v, d₁))).2, d₂)) =
(v, (d₁, d₂))
rw [G.rot_involutive]
def squareSwap (s : V × (D × D)) : V × (D × D) := (s.1, (s.2.2, s.2.1))
theorem squareSwap_involutive : Function.Involutive (squareSwap (V := V) (D := D)) := by
rintro ⟨v, d₁, d₂⟩
rfl
def square (G : PortGraph V D) : PortGraph V (D × D) := by
let B := involutionEquiv (squareFirst G) (squareFirst_involutive G)
let P := involutionEquiv (squareSwap (V := V) (D := D)) squareSwap_involutive
exact
{ rot := B.trans (P.trans B)
rot_involutive := palindrome_involutive B P
(squareFirst_involutive G) squareSwap_involutive }
@[simp] theorem square_rot_apply (G : PortGraph V D) (v : V) (d₁ d₂ : D) :
(square G).rot (v, (d₁, d₂)) =
let first := G.rot (v, d₁)
let second := G.rot (first.1, d₂)
(second.1, (second.2, first.2)) := rfl
@[simp] theorem square_next (G : PortGraph V D) (v : V) (d₁ d₂ : D) :
next (square G) v (d₁, d₂) = next G (next G v d₁) d₂ := rfl
def cloudFirst (H : PortGraph D E) (s : (V × D) × (E × E)) :
(V × D) × (E × E) :=
let step := H.rot (s.1.2, s.2.1)
((s.1.1, step.1), (step.2, s.2.2))
theorem cloudFirst_involutive (H : PortGraph D E) :
Function.Involutive (cloudFirst (V := V) H) := by
rintro ⟨⟨v, d⟩, ⟨e₁, e₂⟩⟩
change ((v, (H.rot (H.rot (d, e₁))).1), ((H.rot (H.rot (d, e₁))).2, e₂)) =
((v, d), (e₁, e₂))
rw [H.rot_involutive]
def crossCloud (G : PortGraph V D) (s : (V × D) × (E × E)) :
(V × D) × (E × E) := (G.rot s.1, (s.2.2, s.2.1))
theorem crossCloud_involutive (G : PortGraph V D) :
Function.Involutive (crossCloud (E := E) G) := by
rintro ⟨x, e₁, e₂⟩
change (G.rot (G.rot x), (e₁, e₂)) = (x, (e₁, e₂))
rw [G.rot_involutive]
def zigzag (G : PortGraph V D) (H : PortGraph D E) : PortGraph (V × D) (E × E) := by
let B := involutionEquiv (cloudFirst (V := V) H) (cloudFirst_involutive H)
let P := involutionEquiv (crossCloud (E := E) G) (crossCloud_involutive G)
exact
{ rot := B.trans (P.trans B)
rot_involutive := palindrome_involutive B P
(cloudFirst_involutive H) (crossCloud_involutive G) }
@[simp] theorem zigzag_rot_apply (G : PortGraph V D) (H : PortGraph D E)
(v : V) (d : D) (e₁ e₂ : E) :
(zigzag G H).rot ((v, d), (e₁, e₂)) =
let first := H.rot (d, e₁)
let middle := G.rot (v, first.1)
let last := H.rot (middle.2, e₂)
((middle.1, last.1), (last.2, first.2)) := rfl
theorem natCard_square_ports : Nat.card (D × D) = Nat.card D ^ 2 := by
simp [Nat.card_prod, pow_two]
theorem natCard_square_edges :
Nat.card (Edge V (D × D)) = Nat.card V * Nat.card D ^ 2 := by
simp [Edge, Nat.card_prod, pow_two]
theorem natCard_zigzag_vertices :
Nat.card (V × D) = Nat.card V * Nat.card D := Nat.card_prod V D
theorem natCard_zigzag_ports : Nat.card (E × E) = Nat.card E ^ 2 := by
simp [Nat.card_prod, pow_two]
theorem natCard_zigzag_edges :
Nat.card (Edge (V × D) (E × E)) =
Nat.card V * Nat.card D * Nat.card E ^ 2 := by
simp [Edge, Nat.card_prod, pow_two]
noncomputable section
def cloudOperator [Fintype E] (H : PortGraph D E) (f : V × D → ℝ) (x : V × D) : ℝ :=
SpectralReturn.mean (fun e => f (x.1, (H.rot (x.2, e)).1))
def graphPermutation (G : PortGraph V D) (f : V × D → ℝ) (x : V × D) : ℝ :=
f (G.rot x)
theorem averagingOperator_square [Fintype D] (G : PortGraph V D) (f : V → ℝ) :
SpectralReturn.averagingOperator (square G) f =
SpectralReturn.averagingOperator G (SpectralReturn.averagingOperator G f) := by
funext v
let w : D × D → ℝ := fun ds => f (G.rot ((G.rot (v, ds.1)).1, ds.2)).1
change SpectralReturn.mean w =
SpectralReturn.mean (fun d₁ => SpectralReturn.mean (fun d₂ => w (d₁, d₂)))
exact SpectralReturn.mean_prod w
theorem averagingOperator_zigzag [Fintype E] (G : PortGraph V D)
(H : PortGraph D E) (f : V × D → ℝ) :
SpectralReturn.averagingOperator (zigzag G H) f =
cloudOperator H (graphPermutation G (cloudOperator H f)) := by
funext x
rcases x with ⟨v, d⟩
let w : E × E → ℝ := fun es =>
let first := H.rot (d, es.1)
let middle := G.rot (v, first.1)
let last := H.rot (middle.2, es.2)
f (middle.1, last.1)
change SpectralReturn.mean w =
SpectralReturn.mean (fun e₁ => SpectralReturn.mean (fun e₂ => w (e₁, e₂)))
exact SpectralReturn.mean_prod w
end
end UniqueGames.Foundations.PCP.ZigzagGraphs
end OAI

Xet Storage Details

Size:
5.53 kB
·
Xet hash:
e775111b47e8f6dda0caaea24aa120f4e01e5f1e427eb64e6bb9993f52a63ec7

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