introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
6.69 kB
import Mathlib
import OAI.RepresentationTheory.Saxl.Main
import OAI.RepresentationTheory.UniversalSquare.Contraction.ColumnCertificates
import OAI.RepresentationTheory.UniversalSquare.Balance.PackingPlans
namespace OAI
/-! Domain Contractions. -/
section
open scoped BigOperators
namespace Saxl.Columns
def Domains : List β„• β†’ Type
| [] => Unit
| r :: rs => Finset (Equiv.Perm (Fin r)) Γ— Domains rs
def Domains.full : (rs : List β„•) β†’ Domains rs
| [] => ()
| _ :: rs => (Finset.univ, full rs)
def Domains.weight : {rs : List β„•} β†’ Domains rs β†’ Perms rs β†’ β„€
| [], _, _ => 1
| _ :: _, (s,D), (Ο€,Οƒ) => (if Ο€ ∈ s then (Equiv.Perm.sign Ο€ : β„€) else 0) * weight D Οƒ
lemma Domains.full_weight {rs : List β„•} (Οƒ : Perms rs) :
(full rs).weight Οƒ = sgInteger Οƒ := by
induction rs with
| nil => rfl
| cons r rs ih => simp only [full, weight, sgInteger, Finset.mem_univ, ite_true, ih]
def Domains.atValue : {rs : List β„•} β†’ Domains rs β†’ Cells rs β†’ β„• β†’ Domains rs
| _ :: _, (s,D), .inl i, j => (s.filter (fun Ο€ => (Ο€ i).val = j),D)
| _ :: _, (s,D), .inr c, j => (s,atValue D c j)
lemma Domains.atValue_weight {rs : List β„•} (D : Domains rs) (c : Cells rs)
(j : β„•) (Οƒ : Perms rs) :
(D.atValue c j).weight Οƒ = D.weight Οƒ *
(if row (perm Οƒ c) = j then 1 else 0) := by
induction rs with
| nil => exact c.elim
| cons r rs ih =>
rcases D with ⟨s,D⟩
rcases Οƒ with βŸ¨Ο€,ΟƒβŸ©
cases c with
| inl i =>
simp only [atValue, weight, Finset.mem_filter, perm, Equiv.sumCongr_apply,
Sum.map_inl, row]
split_ifs <;> simp_all
| inr c =>
simp only [atValue, weight, perm, Equiv.sumCongr_apply, Sum.map_inr, row, ih,
mul_assoc]
def Domains.vanished : {rs : List β„•} β†’ Domains rs β†’ Bool
| [], _ => false
| _ :: _, (s,D) => decide (s = βˆ…) || vanished D
lemma Domains.weight_eq_zero {rs : List β„•} (D : Domains rs)
(h : D.vanished = true) (Οƒ : Perms rs) : D.weight Οƒ = 0 := by
induction rs with
| nil => simp [vanished] at h
| cons r rs ih =>
rcases D with ⟨s,D⟩
rcases Οƒ with βŸ¨Ο€,ΟƒβŸ©
simp only [vanished, Bool.or_eq_true] at h
rcases h with h | h
Β· have hs : s = βˆ… := of_decide_eq_true h
simp [weight, hs]
Β· simp only [weight, ih D h Οƒ, mul_zero]
def Domains.mass : {rs : List β„•} β†’ Domains rs β†’ β„€
| [], _ => 1
| _ :: _, (s,D) => (βˆ‘ Ο€ ∈ s, (Equiv.Perm.sign Ο€ : β„€)) * mass D
lemma Domains.mass_eq_sum {rs : List β„•} (D : Domains rs) :
D.mass = βˆ‘ Οƒ : Perms rs, D.weight Οƒ := by
classical
induction rs with
| nil => simp [mass, weight, Perms]
| cons r rs ih =>
rcases D with ⟨s,D⟩
simp only [Perms, Fintype.sum_prod_type, weight, ← Finset.mul_sum, ← ih,
← Finset.sum_mul, mass]
congr 1
simp
abbrev Edge (rsT rsA rsB : List β„•) := Cells rsT Γ— Cells rsA Γ— Cells rsB
def domainContraction {rsT rsA rsB : List β„•}
(D : Domains rsT) (E : Domains rsA) (F : Domains rsB)
(edges : List (Edge rsT rsA rsB)) (flag : Finset (β„• Γ— β„• Γ— β„•)) : β„€ :=
βˆ‘ Ο€ : Perms rsT, βˆ‘ Οƒ : Perms rsA, βˆ‘ Ο„ : Perms rsB,
D.weight Ο€ * E.weight Οƒ * F.weight Ο„ *
(edges.map (fun c => if (row (perm Ο€ c.1), row (perm Οƒ c.2.1),
row (perm Ο„ c.2.2)) ∈ flag then (1 : β„€) else 0)).prod
lemma domainContraction_nil {rsT rsA rsB : List β„•}
(D : Domains rsT) (E : Domains rsA) (F : Domains rsB)
(flag : Finset (β„• Γ— β„• Γ— β„•)) :
domainContraction D E F [] flag = D.mass * E.mass * F.mass := by
simp only [domainContraction, List.map_nil, List.prod_nil, mul_one,
← Finset.mul_sum, ← Finset.sum_mul, ← Domains.mass_eq_sum]
lemma domainContraction_zero {rsT rsA rsB : List β„•}
(D : Domains rsT) (E : Domains rsA) (F : Domains rsB)
(edges : List (Edge rsT rsA rsB)) (flag : Finset (β„• Γ— β„• Γ— β„•))
(h : (D.vanished || E.vanished || F.vanished) = true) :
domainContraction D E F edges flag = 0 := by
rw [domainContraction]
simp only [Bool.or_eq_true] at h
rcases h with (h | h) | h
Β· simp only [Domains.weight_eq_zero D h, zero_mul, Finset.sum_const_zero]
Β· simp only [Domains.weight_eq_zero E h, mul_zero, zero_mul, Finset.sum_const_zero]
Β· simp only [Domains.weight_eq_zero F h, mul_zero, zero_mul, Finset.sum_const_zero]
lemma triple_indicator_sum (flag : Finset (β„• Γ— β„• Γ— β„•)) (a b c : β„•) :
(βˆ‘ v ∈ flag, (if a = v.1 then (1 : β„€) else 0) *
(if b = v.2.1 then 1 else 0) * (if c = v.2.2 then 1 else 0)) =
if (a,b,c) ∈ flag then 1 else 0 := by
have hh : βˆ€ v : β„• Γ— β„• Γ— β„•, (if a = v.1 then (1 : β„€) else 0) *
(if b = v.2.1 then 1 else 0) * (if c = v.2.2 then 1 else 0) =
if (a,b,c) = v then 1 else 0 := by
rintro ⟨x,y,z⟩
simp only [Prod.mk.injEq]
split_ifs <;> simp_all
simp only [hh]
rw [Finset.sum_ite_eq]
lemma domainContraction_cons {rsT rsA rsB : List β„•}
(D : Domains rsT) (E : Domains rsA) (F : Domains rsB)
(c : Edge rsT rsA rsB) (edges : List (Edge rsT rsA rsB))
(flag : Finset (β„• Γ— β„• Γ— β„•)) :
domainContraction D E F (c::edges) flag =
βˆ‘ v ∈ flag, domainContraction (D.atValue c.1 v.1)
(E.atValue c.2.1 v.2.1) (F.atValue c.2.2 v.2.2) edges flag := by
classical
simp only [domainContraction, List.map_cons, List.prod_cons, Domains.atValue_weight]
conv_rhs => rw [Finset.sum_comm]
apply Finset.sum_congr rfl
intro Ο€ _
conv_rhs => rw [Finset.sum_comm]
apply Finset.sum_congr rfl
intro Οƒ _
conv_rhs => rw [Finset.sum_comm]
apply Finset.sum_congr rfl
intro Ο„ _
trans (D.weight Ο€ * E.weight Οƒ * F.weight Ο„) *
(βˆ‘ v ∈ flag, (if row (perm Ο€ c.1) = v.1 then (1 : β„€) else 0) *
(if row (perm Οƒ c.2.1) = v.2.1 then 1 else 0) *
(if row (perm Ο„ c.2.2) = v.2.2 then 1 else 0)) *
(edges.map (fun e => if (row (perm Ο€ e.1), row (perm Οƒ e.2.1),
row (perm Ο„ e.2.2)) ∈ flag then (1 : β„€) else 0)).prod
Β· rw [triple_indicator_sum]
ring
Β· simp only [Finset.mul_sum, Finset.sum_mul]
apply Finset.sum_congr rfl
intro v _
ring
lemma domainContraction_perm {rsT rsA rsB : List β„•}
(D : Domains rsT) (E : Domains rsA) (F : Domains rsB)
{cs es : List (Edge rsT rsA rsB)} (hp : cs.Perm es)
(flag : Finset (β„• Γ— β„• Γ— β„•)) :
domainContraction D E F cs flag = domainContraction D E F es flag := by
simp only [domainContraction]
apply Finset.sum_congr rfl
intro Ο€ _
apply Finset.sum_congr rfl
intro Οƒ _
apply Finset.sum_congr rfl
intro Ο„ _
exact congrArg (_ * Β·) ((hp.map _).prod_eq)
end Saxl.Columns
end
end OAI