cfahlgren1/math / lean /OAI /Combinatorics /Sensitivity /TournamentCyclic.lean
cfahlgren1's picture
download
raw
1.68 kB
import OAI.Combinatorics.Sensitivity.Tournament
import Mathlib.Algebra.Group.Fin.Basic
import Mathlib.Algebra.Group.Units.Equiv
import Mathlib.Order.Interval.Finset.Fin
namespace OAI
/-! The literal regular tournament on an odd cyclic set. -/
noncomputable section
open scoped Classical
namespace Paper320
def cyclicTournament (a : ℕ) : Tournament (2*a+1) where
Adj i j := 0 < (j-i).val ∧ (j-i).val ≤ a
loopless i := by simp
edge_compl := by
intro i j hij
have hδ : j-i ≠ 0 := sub_ne_zero.mpr hij.symm
have hp : 0 < (j-i).val := Nat.pos_of_ne_zero (Fin.val_ne_zero_iff.mpr hδ)
have hb := (j-i).isLt
have hn : (i-j).val = 2*a+1-(j-i).val := by
rw [← neg_sub j i, Fin.val_neg, ite_eq_right hδ]
change (0 < (j-i).val ∧ (j-i).val ≤ a) ↔ ¬ (0 < (i-j).val ∧ (i-j).val ≤ a)
rw [hn]
omega
theorem cyclicTournament_outdegree (a : ℕ) (i : Fin (2*a+1)) :
(Finset.univ.filter ((cyclicTournament a).Adj i)).card = a := by
let z : Fin (2*a+1) := 0
let b : Fin (2*a+1) := ⟨a, by omega⟩
have he : (Finset.Ioc z b).card =
(Finset.univ.filter ((cyclicTournament a).Adj i)).card :=
Finset.card_equiv (Equiv.addLeft i) (by
intro x
simp only [Finset.mem_Ioc, Finset.mem_filter, Finset.mem_univ, true_and]
change (0 < x.val ∧ x.val ≤ a) ↔
(0 < ((i+x)-i).val ∧ ((i+x)-i).val ≤ a)
rw [add_sub_cancel_left])
rw [← he, Fin.card_Ioc]
change a - 0 = a
exact Nat.sub_zero a
def regularCyclicTournament (M : ℕ) : RegularTournament M where
toTournament := cyclicTournament (M^2)
outdegree := cyclicTournament_outdegree (M^2)
end Paper320
end
end OAI

Xet Storage Details

Size:
1.68 kB
·
Xet hash:
dcf3bf3489421623a8cad09f360204258eaf55352104f1a4f77c79eed9b797c0

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