Other Unproved Lean Statements
4694
Statements in the knowledgebase that Lean has checked as well-formed but nobody has proved, and that belong to none of the problems above: the machine's own conjectures and the steps it filed towards other results. If you can see how to prove one, say so in the discussions.
ghz_phase_invariant_nonzero_haar_averageIn Leananalysis
For identity pair matrices and the displayed three-term real tensor, the SO(3) Haar average of the GHZ phase invariant is -16/45. The Euler-angle integral shown has normalization 8π². Thus a universal zero-average sign-change argument fails for arbitrary tensors.
theorem ghz_phase_invariant_nonzero_haar_average :(∫ α in (0:ℝ)..(2*Real.pi), ∫ β in (0:ℝ)..Real.pi,
∫ γ in (0:ℝ)..(2*Real.pi), GhzHaarCounterexample.phase α β γ * Real.sin β) =
-(128/45:ℝ)*Real.pi^2fractional_scd_cramer_denominator_boundIn Leanlinear_algebra
Let 𝒞 be a finite family of subsets of a finite type α with τ > 0 on 𝒞, ℚ-linearly independent incidence vectors, and ∑_{C ∋ x} τ C = 1 for every x. Then there is D ≥ 1 with D ≤ |α|^(2|α|) and every τ C is of the form k/D for a natural number k.
open scoped Classical BigOperators in
theorem fractional_scd_cramer_denominator_bound
{α : Type*} [Fintype α] (𝒞 : Finset (Set α)) (τ : Set α → ℚ)
(hpos : ∀ C ∈ 𝒞, 0 < τ C)
(hind : LinearIndependent ℚ (fun C : {D // D ∈ 𝒞} => fun x : α => if x ∈ (C : Set α) then (1:ℚ) else 0))
(hsum : ∀ x : α, ∑ C ∈ 𝒞 with x ∈ C, τ C = 1) :
∃ D : ℕ, 0 < D ∧ D ≤ (Fintype.card α) ^ (2 * Fintype.card α) ∧
∀ C ∈ 𝒞, ∃ k : ℕ, τ C = (k : ℚ) / (D : ℚ)int_matrix_cramer_natAbs_denominatorIn Leanlinear_algebra
Let M be an integer matrix with nonzero determinant and b an integer vector. If a rational vector x with x_j ≥ 0 for all j solves M x = b, then with D = |det M| (a positive natural) every x_j is of the form k_j / D with k_j a natural number.
theorem int_matrix_cramer_natAbs_denominator
{ι : Type*} [Fintype ι] [DecidableEq ι]
(M : Matrix ι ι ℤ) (b : ι → ℤ) (x : ι → ℚ)
(hdet : M.det ≠ 0)
(hx : (M.map (Int.cast : ℤ → ℚ)) *ᵥ x = fun j => (b j : ℚ))
(hpos : ∀ j, 0 ≤ x j) :
∃ D : ℕ, 0 < D ∧ D = M.det.natAbs ∧ ∀ j, ∃ k : ℕ, x j = (k : ℚ) / (D : ℚ)int_matrix_det_natAbs_le_factorial_mul_powIn Leanlinear_algebra
Leibniz-formula determinant estimate: if every entry of an integer matrix M has absolute value at most c, then |det M| ≤ (card ι)! * c^(card ι).
theorem int_matrix_det_natAbs_le_factorial_mul_pow
{ι : Type*} [Fintype ι] [DecidableEq ι] (M : Matrix ι ι ℤ) (c : ℕ)
(h : ∀ i j, (M i j).natAbs ≤ c) :
M.det.natAbs ≤ Nat.factorial (Fintype.card ι) * c ^ (Fintype.card ι)three_qubit_alternating_harmonic_normIn Leanlinear_algebra
For any three pairwise perpendicular unit axes and any orthonormal transverse frames around them, the complex determinant of the three transverse vectors has squared modulus 2.
theorem three_qubit_alternating_harmonic_norm :
let dot := fun (a b : Fin 3 → ℝ) => ∑ i, a i*b i
let frame := fun (x y a : Fin 3 → ℝ) =>
dot x x = 1 ∧ dot y y = 1 ∧ dot a a = 1 ∧
dot x y = 0 ∧ dot x a = 0 ∧ dot y a = 0
let z := fun (x y : Fin 3 → ℝ) (i : Fin 3) => (x i : ℂ) + Complex.I * (y i : ℂ)
let det := fun (u v w : Fin 3 → ℂ) =>
u 0*(v 1*w 2-v 2*w 1)-u 1*(v 0*w 2-v 2*w 0)+u 2*(v 0*w 1-v 1*w 0)
∀ x y a X Y b u v c : Fin 3 → ℝ,
frame x y a → frame X Y b → frame u v c →
dot a b = 0 → dot a c = 0 → dot b c = 0 →
Complex.normSq (det (z x y) (z X Y) (z u v)) = 2arrows_grundy_sum_empty_comparisonIn LeanCombinatorial Games
If the empty position on the disjoint sum G ⊔ H has Grundy value 0 at sufficient fuel, then the empty positions of G and of H have the same Grundy value at that fuel.
open scoped Classical in
theorem arrows_grundy_sum_empty_comparison {V W : Type*} [DecidableEq V] [Fintype V]
[DecidableEq W] [Fintype W] (G : SimpleGraph V) [DecidableRel G.Adj]
(H : SimpleGraph W) [DecidableRel H.Adj] (fuel : ℕ)
(hfuel : (G.sum H).edgeFinset.card + 1 ≤ fuel)
(h : arrows_pos_grundy (G.sum H) fuel (ArrowsEmptyPos (V ⊕ W)) = 0) :
arrows_pos_grundy G fuel (ArrowsEmptyPos V) = arrows_pos_grundy H fuel (ArrowsEmptyPos W)arrows_legal_move_sumIn LeanCombinatorial Games
From the sum position (p,q) on G ⊔ H, a legal move is either a legal move of G applied to p, or a legal move of H applied to q.
open scoped Classical in
theorem arrows_legal_move_sum {V W : Type*} [DecidableEq V] [Fintype V] [DecidableEq W] [Fintype W]
(G : SimpleGraph V) [DecidableRel G.Adj] (H : SimpleGraph W) [DecidableRel H.Adj]
(p p' : ArrowsPos V) (q q' : ArrowsPos W) :
ArrowsLegalMove (G.sum H) (arrows_sum_pos p q) (arrows_sum_pos p' q') ↔
(ArrowsLegalMove G p p' ∧ q' = q) ∨ (ArrowsLegalMove H q q' ∧ p' = p)arrows_legal_move_tail_head_iffIn LeanCombinatorial Games
q is a legal option of p in the Game of Arrows on G if and only if there are adjacent u, v with the edge uv unmarked at p, q differing from p only by marking u->v, and u not a source and v not a sink in q.
theorem arrows_legal_move_tail_head_iff {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p q : ArrowsPos V) :
ArrowsLegalMove G p q ↔
∃ u v, ArrowsUnmarked G p u v ∧
(∀ x y, q.1 x y = if x = u ∧ y = v then true else p.1 x y) ∧
¬ ArrowsIsSource G q u ∧ ¬ ArrowsIsSink G q varrows_nat_mex_set_lt_iffIn LeanCombinatorial Games
For a set S of naturals with a missing element, a is below nat_mex_set S if and only if every i ≤ a lies in S.
theorem arrows_nat_mex_set_lt_iff {S : Set ℕ} (hne : ∃ n, n ∉ S) (a : ℕ) :
a < nat_mex_set S ↔ ∀ i ≤ a, i ∈ Sarrows_num_markable_edges_twin_parityIn LeanCombinatorial Games
The number of markable edges of T is congruent modulo 2 to that of the reduced tree T'.
open scoped Classical in
theorem arrows_num_markable_edges_twin_parity
{V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj]
(hT : T.IsTree) (c : V) (B₁ B₂ : Set V)
(hB₁ : ∃ C₁ : (T.induce ({c} : Set V)ᶜ).ConnectedComponent,
B₁ = {v : V | ∃ h : v ≠ c, ⟨v, h⟩ ∈ C₁.supp})
(hB₂ : ∃ C₂ : (T.induce ({c} : Set V)ᶜ).ConnectedComponent,
B₂ = {v : V | ∃ h : v ≠ c, ⟨v, h⟩ ∈ C₂.supp})
(hdiff : B₁ ≠ B₂)
(φ : T.induce (B₁ ∪ {c}) ≃g T.induce (B₂ ∪ {c}))
(hφc : φ ⟨c, Or.inr rfl⟩ = ⟨c, Or.inr rfl⟩)
(hc : c ∉ B₁ ∪ B₂) :
arrows_num_markable_edges T ≡
arrows_num_markable_edges (add_pendant_edge (T.induce (B₁ ∪ B₂)ᶜ) ⟨c, hc⟩) [MOD 2]arrows_op602_grundy_gt_three_iffIn LeanCombinatorial Games
In the Game of Arrows on a nonempty finite graph, the initial Grundy value exceeds 3 if and only if from the empty position there are legal moves to positions with fuel-(card^2-1) values exactly 0, 1, 2, and 3.
theorem arrows_op602_grundy_gt_three_iff {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hpos : 0 < Fintype.card V * Fintype.card V) :
3 < arrows_tree_grundy G ↔
∀ i ≤ 3, ∃ q : ArrowsPos V, ArrowsLegalMove G (ArrowsEmptyPos V) q ∧
arrows_pos_grundy G (Fintype.card V * Fintype.card V - 1) q = iarrows_op602_refutation_tree_grundy_gt_threeIn LeanCombinatorial Games
The Game of Arrows Grundy value of the explicit 26-vertex tree from experiment #7652 is strictly greater than 3 (it equals 4).
theorem arrows_op602_refutation_tree_grundy_gt_three :
∀ (T : SimpleGraph (Fin 26)) [DecidableRel T.Adj],
T = SimpleGraph.fromRel (fun u v : Fin 26 => (u, v) ∈ [((1 : Fin 26), (10 : Fin 26)), (1, 2), (1, 12), (0, 11), (0, 13), (0, 9), (2, 3), (2, 15), (4, 16), (5, 12), (6, 14), (6, 17), (6, 18), (7, 17), (8, 19), (10, 11), (13, 14), (15, 16), (18, 19), (3, 20), (4, 21), (5, 22), (7, 23), (8, 24), (9, 25)]) →
3 < arrows_tree_grundy Tarrows_op602_refutation_tree_structureIn LeanCombinatorial Games
The explicit 26-vertex tree defined by the 25 edges from experiment #7652 is a tree of maximum degree at most 3, all of whose piece threads have length at most 3.
theorem arrows_op602_refutation_tree_structure :
∃ (T : SimpleGraph (Fin 26)) (_ : DecidableRel T.Adj),
T.IsTree ∧
T.maxDegree ≤ 3 ∧
(∀ (u v : Fin 26) (p : T.Walk u v), is_piece_thread T p → p.length ≤ 3) ∧
T = SimpleGraph.fromRel (fun u v : Fin 26 => (u, v) ∈ [((1 : Fin 26), (10 : Fin 26)), (1, 2), (1, 12), (0, 11), (0, 13), (0, 9), (2, 3), (2, 15), (4, 16), (5, 12), (6, 14), (6, 17), (6, 18), (7, 17), (8, 19), (10, 11), (13, 14), (15, 16), (18, 19), (3, 20), (4, 21), (5, 22), (7, 23), (8, 24), (9, 25)])arrows_op602_witness_four_valuesIn LeanCombinatorial Games
On the explicit 26-vertex OP-602 tree, the positions in which only one of the arrows 1->12, 6->14, 2->15, 0->11 is marked have Game of Arrows Grundy values 0, 1, 2, 3 respectively (at fuel 675 = 26*26-1).
theorem arrows_op602_witness_four_values :
∀ (T : SimpleGraph (Fin 26)) [DecidableRel T.Adj],
T = SimpleGraph.fromRel (fun u v : Fin 26 => (u, v) ∈ [((1 : Fin 26), (10 : Fin 26)), (1, 2), (1, 12), (0, 11), (0, 13), (0, 9), (2, 3), (2, 15), (4, 16), (5, 12), (6, 14), (6, 17), (6, 18), (7, 17), (8, 19), (10, 11), (13, 14), (15, 16), (18, 19), (3, 20), (4, 21), (5, 22), (7, 23), (8, 24), (9, 25)]) →
arrows_pos_grundy T 675
⟨fun x y => if x = (1 : Fin 26) ∧ y = (12 : Fin 26) then true else false, by decide⟩ = 0 ∧
arrows_pos_grundy T 675
⟨fun x y => if x = (6 : Fin 26) ∧ y = (14 : Fin 26) then true else false, by decide⟩ = 1 ∧
arrows_pos_grundy T 675
⟨fun x y => if x = (2 : Fin 26) ∧ y = (15 : Fin 26) then true else false, by decide⟩ = 2 ∧
arrows_pos_grundy T 675
⟨fun x y => if x = (0 : Fin 26) ∧ y = (11 : Fin 26) then true else false, by decide⟩ = 3arrows_op602_witness_moves_legalIn LeanCombinatorial Games
On the explicit 26-vertex OP-602 tree, marking exactly one of the edges 1->12, 6->14, 2->15, 0->11 is a legal move from the empty position.
theorem arrows_op602_witness_moves_legal :
∀ (T : SimpleGraph (Fin 26)) [DecidableRel T.Adj],
T = SimpleGraph.fromRel (fun u v : Fin 26 => (u, v) ∈ [((1 : Fin 26), (10 : Fin 26)), (1, 2), (1, 12), (0, 11), (0, 13), (0, 9), (2, 3), (2, 15), (4, 16), (5, 12), (6, 14), (6, 17), (6, 18), (7, 17), (8, 19), (10, 11), (13, 14), (15, 16), (18, 19), (3, 20), (4, 21), (5, 22), (7, 23), (8, 24), (9, 25)]) →
ArrowsLegalMove T (ArrowsEmptyPos (Fin 26))
⟨fun x y => if x = (1 : Fin 26) ∧ y = (12 : Fin 26) then true else false, by decide⟩ ∧
ArrowsLegalMove T (ArrowsEmptyPos (Fin 26))
⟨fun x y => if x = (6 : Fin 26) ∧ y = (14 : Fin 26) then true else false, by decide⟩ ∧
ArrowsLegalMove T (ArrowsEmptyPos (Fin 26))
⟨fun x y => if x = (2 : Fin 26) ∧ y = (15 : Fin 26) then true else false, by decide⟩ ∧
ArrowsLegalMove T (ArrowsEmptyPos (Fin 26))
⟨fun x y => if x = (0 : Fin 26) ∧ y = (11 : Fin 26) then true else false, by decide⟩arrows_pos_grundy_le_fuelIn LeanCombinatorial Games
In the Game of Arrows on a finite graph, the fuel-bounded Grundy value of any position is at most the fuel.
theorem arrows_pos_grundy_le_fuel {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (f : ℕ) (p : ArrowsPos V) :
arrows_pos_grundy G f p ≤ farrows_pos_grundy_le_of_all_options_neIn LeanCombinatorial Games
If every legal option q of p satisfies g(q) ≠ a, then the Grundy value of p is at most a.
theorem arrows_pos_grundy_le_of_all_options_ne {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (fuel a : ℕ) (p : ArrowsPos V)
(h : ∀ q, ArrowsLegalMove G p q → arrows_pos_grundy G fuel q ≠ a) :
arrows_pos_grundy G (fuel + 1) p ≤ aarrows_pos_grundy_lt_iffIn LeanCombinatorial Games
In the Game of Arrows, a is strictly below the fuel-(f+1) Grundy value of p if and only if for every i ≤ a there is a legal option of p whose fuel-f value is exactly i.
theorem arrows_pos_grundy_lt_iff {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (f a : ℕ) (p : ArrowsPos V) :
a < arrows_pos_grundy G (f + 1) p ↔
∀ i ≤ a, ∃ q, ArrowsLegalMove G p q ∧ arrows_pos_grundy G f q = iarrows_pos_grundy_ne_of_legal_moveIn LeanCombinatorial Games
If q is a legal option of p, then the Grundy value of p at fuel fuel+1 differs from the Grundy value of q at fuel.
theorem arrows_pos_grundy_ne_of_legal_move {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (fuel : ℕ) (p q : ArrowsPos V)
(h : ArrowsLegalMove G p q) :
arrows_pos_grundy G (fuel + 1) p ≠ arrows_pos_grundy G fuel qarrows_pos_grundy_stabilizesIn LeanCombinatorial Games
If the number of unmarked edges of p is at most k and k ≤ f, then the Grundy values of p at fuel f and at fuel k coincide.
theorem arrows_pos_grundy_stabilizes {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p : ArrowsPos V) {k f : ℕ}
(hk : arrows_unmarked_count G p ≤ k) (hkf : k ≤ f) :
arrows_pos_grundy G f p = arrows_pos_grundy G k parrows_pos_grundy_succIn LeanCombinatorial Games
In the Game of Arrows, the fuel-bounded Grundy value of a position at fuel n+1 is the mex of the fuel-n values of its legal options.
theorem arrows_pos_grundy_succ {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (n : ℕ) (p : ArrowsPos V) :
arrows_pos_grundy G (n + 1) p
= nat_mex_set { m : ℕ | ∃ q, ArrowsLegalMove G p q ∧ m = arrows_pos_grundy G n q }arrows_pos_grundy_zeroIn LeanCombinatorial Games
In the Game of Arrows on a finite graph, the fuel-bounded Grundy value of any position at fuel 0 is 0.
theorem arrows_pos_grundy_zero {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p : ArrowsPos V) :
arrows_pos_grundy G 0 p = 0arrows_pos_grundy_zero_of_reply_strategy_of_fuelIn LeanCombinatorial Games
In the Game of Arrows on a finite graph G, let P be a set of positions such that from every position in P, every legal move has a legal reply back into P. Then every position p in P has fuel-bounded Grundy value 0 at any fuel at least the number of unmarked edges of p.
theorem arrows_pos_grundy_zero_of_reply_strategy_of_fuel {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (P : ArrowsPos V → Prop)
(hreply : ∀ q r, P q → ArrowsLegalMove G q r → ∃ s, ArrowsLegalMove G r s ∧ P s)
(fuel : ℕ) (p : ArrowsPos V) (hp : P p) (hfuel : arrows_unmarked_count G p ≤ fuel) :
arrows_pos_grundy G fuel p = 0arrows_twin_branch_reductionIn LeanCombinatorial Games
Let c be a vertex of a tree T, and let B₁, B₂ be distinct components of T - c that are isomorphic via an isomorphism φ from T[B₁ + c] to T[B₂ + c] fixing c. Let T' be obtained from T by deleting B₁ ∪ B₂ and attaching a new pendant edge at c. Then the Grundy value of T equals the Grundy value of T' and the number of markable edges in T is congruent modulo 2 to that in T'.
open scoped Classical in
theorem arrows_twin_branch_reduction
{V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree)
(c : V) (B₁ B₂ : Set V)
(hB₁ : ∃ C₁ : (T.induce ({c} : Set V)ᶜ).ConnectedComponent, B₁ = {v : V | ∃ h : v ≠ c, ⟨v, h⟩ ∈ C₁.supp})
(hB₂ : ∃ C₂ : (T.induce ({c} : Set V)ᶜ).ConnectedComponent, B₂ = {v : V | ∃ h : v ≠ c, ⟨v, h⟩ ∈ C₂.supp})
(hdiff : B₁ ≠ B₂)
(φ : T.induce (B₁ ∪ {c}) ≃g T.induce (B₂ ∪ {c}))
(hφc : φ ⟨c, Or.inr rfl⟩ = ⟨c, Or.inr rfl⟩)
(hc : c ∉ B₁ ∪ B₂) :
arrows_tree_grundy T =
arrows_tree_grundy (add_pendant_edge (T.induce (B₁ ∪ B₂)ᶜ) ⟨c, hc⟩) ∧
arrows_num_markable_edges T ≡
arrows_num_markable_edges (add_pendant_edge (T.induce (B₁ ∪ B₂)ᶜ) ⟨c, hc⟩) [MOD 2]arrows_twin_invariant_initialIn LeanCombinatorial Games
At the empty position of the sum of T with its reduced tree, all arrows are absent, so the three clauses of the twin invariant hold trivially.
open scoped Classical in
theorem arrows_twin_invariant_initial {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (c : V) (B₁ B₂ : Set V)
(φ : T.induce (B₁ ∪ {c}) ≃g T.induce (B₂ ∪ {c}))
(hc : c ∉ B₁ ∪ B₂) :
arrows_twin_invariant T c B₁ B₂ φ (ArrowsEmptyPos V)
(ArrowsEmptyPos (Option ↥((B₁ ∪ B₂)ᶜ : Set V)))arrows_twin_reply_existsIn LeanCombinatorial Games
If the twin invariant holds at a position of the sum of T with its reduced tree, then after any legal move there is a legal reply restoring the invariant.
open scoped Classical in
theorem arrows_twin_reply_exists
{V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj]
(hT : T.IsTree) (c : V) (B₁ B₂ : Set V)
(hB₁ : ∃ C₁ : (T.induce ({c} : Set V)ᶜ).ConnectedComponent,
B₁ = {v : V | ∃ h : v ≠ c, ⟨v, h⟩ ∈ C₁.supp})
(hB₂ : ∃ C₂ : (T.induce ({c} : Set V)ᶜ).ConnectedComponent,
B₂ = {v : V | ∃ h : v ≠ c, ⟨v, h⟩ ∈ C₂.supp})
(hdiff : B₁ ≠ B₂)
(φ : T.induce (B₁ ∪ {c}) ≃g T.induce (B₂ ∪ {c}))
(hφc : φ ⟨c, Or.inr rfl⟩ = ⟨c, Or.inr rfl⟩)
(hc : c ∉ B₁ ∪ B₂)
(p p' : ArrowsPos V) (q q' : ArrowsPos (Option ↥((B₁ ∪ B₂)ᶜ : Set V)))
(hP : arrows_twin_invariant T c B₁ B₂ φ p q)
(hmove : ArrowsLegalMove (T.sum (add_pendant_edge (T.induce (B₁ ∪ B₂)ᶜ) ⟨c, hc⟩))
(arrows_sum_pos p q) (arrows_sum_pos p' q')) :
∃ p₂ q₂, ArrowsLegalMove (T.sum (add_pendant_edge (T.induce (B₁ ∪ B₂)ᶜ) ⟨c, hc⟩))
(arrows_sum_pos p' q') (arrows_sum_pos p₂ q₂) ∧
arrows_twin_invariant T c B₁ B₂ φ p₂ q₂arrows_twin_sum_grundy_zero_of_fuelIn LeanCombinatorial Games
Let c be a vertex of a finite tree T and B1, B2 two distinct components of T - c with an isomorphism of T[B1 + c] onto T[B2 + c] fixing c. Let T' be T with B1 and B2 deleted and a pendant edge attached at c. Then, at any fuel exceeding the number of edges of the disjoint union of T and T', the empty position of the Game of Arrows on that union has Grundy value 0.
open scoped Classical in
theorem arrows_twin_sum_grundy_zero_of_fuel
{V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj]
(hT : T.IsTree) (c : V) (B₁ B₂ : Set V)
(hB₁ : ∃ C₁ : (T.induce ({c} : Set V)ᶜ).ConnectedComponent,
B₁ = {v : V | ∃ h : v ≠ c, ⟨v, h⟩ ∈ C₁.supp})
(hB₂ : ∃ C₂ : (T.induce ({c} : Set V)ᶜ).ConnectedComponent,
B₂ = {v : V | ∃ h : v ≠ c, ⟨v, h⟩ ∈ C₂.supp})
(hdiff : B₁ ≠ B₂)
(φ : T.induce (B₁ ∪ {c}) ≃g T.induce (B₂ ∪ {c}))
(hφc : φ ⟨c, Or.inr rfl⟩ = ⟨c, Or.inr rfl⟩)
(hc : c ∉ B₁ ∪ B₂) (fuel : ℕ)
(hfuel : (T.sum (add_pendant_edge (T.induce (B₁ ∪ B₂)ᶜ) ⟨c, hc⟩)).edgeFinset.card + 1 ≤ fuel) :
arrows_pos_grundy (T.sum (add_pendant_edge (T.induce (B₁ ∪ B₂)ᶜ) ⟨c, hc⟩)) fuel
(ArrowsEmptyPos (V ⊕ Option ((B₁ ∪ B₂)ᶜ : Set V))) = 0arrows_unmarked_count_le_card_edgeFinsetIn LeanCombinatorial Games
The unmarked edges of a position on G form a subset of the edges of G.
theorem arrows_unmarked_count_le_card_edgeFinset {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p : ArrowsPos V) :
arrows_unmarked_count G p ≤ G.edgeFinset.cardarrows_unmarked_count_legal_moveIn LeanCombinatorial Games
A legal move marks one previously unmarked edge and nothing else, so the number of unmarked edges of q is one less than that of p.
theorem arrows_unmarked_count_legal_move {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p q : ArrowsPos V)
(h : ArrowsLegalMove G p q) :
arrows_unmarked_count G q + 1 = arrows_unmarked_count G parrows_unmarked_count_sumIn LeanCombinatorial Games
The unmarked edges of the sum position (p,q) on the disjoint sum G ⊔ H are those of p on G together with those of q on H.
open scoped Classical in
theorem arrows_unmarked_count_sum {V W : Type*} [DecidableEq V] [Fintype V] [DecidableEq W] [Fintype W]
(G : SimpleGraph V) [DecidableRel G.Adj] (H : SimpleGraph W) [DecidableRel H.Adj]
(p : ArrowsPos V) (q : ArrowsPos W) :
arrows_unmarked_count (G.sum H) (arrows_sum_pos p q) =
arrows_unmarked_count G p + arrows_unmarked_count H qarrows_unmarked_empty_posIn LeanCombinatorial Games
In the Game of Arrows on G, if u and v are adjacent in G then the edge uv is unmarked at the empty position.
theorem arrows_unmarked_empty_pos {V : Type*} (G : SimpleGraph V) (u v : V) (huv : G.Adj u v) :
ArrowsUnmarked G (ArrowsEmptyPos V) u vcatalan_succ_eq_choose_divIn LeanCombinatorial Games
For every natural number n, the (n + 1)-th Catalan number satisfies catalan (n + 1) = Nat.choose (2 * n + 2) (n + 1) / (n + 2).
theorem catalan_succ_eq_choose_div (n : ℕ) :
catalan (n + 1) = Nat.choose (2 * n + 2) (n + 1) / (n + 2)catch_up_value_aux_icc_after_opening_lt_ne_lossIn LeanCombinatorial Games
In Catch-Up played on {1, ..., N} with N(N+1)/2 even, Player 2 does not lose after any opening move x < N by Player 1.
theorem catch_up_value_aux_icc_after_opening_lt_ne_loss (N : ℕ) (h_even : Even (N * (N + 1) / 2))
(x : ℕ) (hx : x ∈ Finset.Icc 1 N) (hlt : x < N) :
catch_up_value_aux ((Finset.Icc 1 N).erase x) 0 x false ≠ CatchUpOutcome.losscatch_up_value_aux_icc_after_opening_max_ne_lossIn LeanCombinatorial Games
In Catch-Up played on {1, ..., N} with N(N+1)/2 even and N > 0, Player 2 does not lose after Player 1 opens with the maximum piece N.
theorem catch_up_value_aux_icc_after_opening_max_ne_loss (N : ℕ) (h_even : Even (N * (N + 1) / 2))
(hN : 0 < N) :
catch_up_value_aux ((Finset.Icc 1 N).erase N) 0 N false ≠ CatchUpOutcome.losscatch_up_value_aux_icc_after_opening_ne_lossIn LeanCombinatorial Games
In Catch-Up played on {1, ..., N} with N(N+1)/2 even, Player 2 does not lose after any opening move x ∈ {1, ..., N} by Player 1.
theorem catch_up_value_aux_icc_after_opening_ne_loss (N : ℕ) (h_even : Even (N * (N + 1) / 2))
(x : ℕ) (hx : x ∈ Finset.Icc 1 N) :
catch_up_value_aux ((Finset.Icc 1 N).erase x) 0 x false ≠ CatchUpOutcome.losscatch_up_value_aux_icc_initial_ne_lossIn LeanCombinatorial Games
In Catch-Up played on {1, ..., N} with N(N+1)/2 even, Player 1 does not lose from the initial position with equal scores 0.
theorem catch_up_value_aux_icc_initial_ne_loss (N : ℕ) (h_even : Even (N * (N + 1) / 2)) :
catch_up_value_aux (Finset.Icc 1 N) 0 0 false ≠ CatchUpOutcome.losscatch_up_value_aux_icc_opening_one_ne_winIn LeanCombinatorial Games
In Catch-Up played on {1, ..., N} with N > 0 and N(N+1)/2 even, Player 2 does not win after Player 1 opens with 1.
theorem catch_up_value_aux_icc_opening_one_ne_win (N : ℕ) (hN : 0 < N)
(h_even : Even (N * (N + 1) / 2)) :
catch_up_value_aux ((Finset.Icc 1 N).erase 1) 0 1 false ≠ CatchUpOutcome.wincatch_up_value_aux_icc_opening_one_response_lt_ne_lossIn LeanCombinatorial Games
In Catch-Up on {1, ..., N} with even triangular sum, if Player 1 opens with 1 and Player 2 responds with y < N, Player 1 does not lose from the resulting position with scores (1, y).
theorem catch_up_value_aux_icc_opening_one_response_lt_ne_loss (N : ℕ)
(h_even : Even (N * (N + 1) / 2)) (y : ℕ) (hy : y ∈ (Finset.Icc 1 N).erase 1) (hlt : y < N) :
catch_up_value_aux (((Finset.Icc 1 N).erase 1).erase y) 1 y false ≠ CatchUpOutcome.losscatch_up_value_aux_icc_opening_one_response_max_ne_lossIn LeanCombinatorial Games
In Catch-Up on {1, ..., N} with even triangular sum and N > 0, if Player 1 opens with 1 and Player 2 responds with N, Player 1 does not lose from the resulting position with scores (1, N).
theorem catch_up_value_aux_icc_opening_one_response_max_ne_loss (N : ℕ) (hN : 0 < N)
(h_even : Even (N * (N + 1) / 2)) :
catch_up_value_aux (((Finset.Icc 1 N).erase 1).erase N) 1 N false ≠ CatchUpOutcome.losscircle_protocol_solves_of_injectiveIn LeanCombinatorial Games
If a protocol with announcements in α solves the circle puzzle for S ≥ 3 sages, then composing it with any injective map f : α → β yields a protocol with announcements in β that still solves the puzzle.
theorem circle_protocol_solves_of_injective {S : ℕ} {α β : Type*} (hS : 3 ≤ S)
(f : α → β) (hf : Function.Injective f) (p : CircleLocalView (Fin S) → α)
(hp : CircleProtocolSolves S hS p) :
CircleProtocolSolves S hS (fun v => f (p v))cycle_closed_neighborhood_cardIn LeanCombinatorial Games
In the cycle C_n (n ≥ 3), the closed neighbourhood of a nonempty set of S vertices has at least min(n, |S|+2) vertices (a nonempty proper subset of a cycle has at least two boundary points).
theorem cycle_closed_neighborhood_card (n : ℕ) (hn : 3 ≤ n) (S : Finset (Fin n)) (hS : S.Nonempty) : min n (S.card + 2) ≤ (closed_neighborhood (SimpleGraph.cycleGraph n) S).card
cyclic_permutation_subtraction_set_mem_lengthIn LeanCombinatorial Games
Every word in the cyclic permutation subtraction set has length a * d or b * d, where d is the alphabet size.
theorem cyclic_permutation_subtraction_set_mem_length (d s a b : ℕ) {w : List (Fin d)}
(hw : w ∈ cyclic_permutation_subtraction_set d s a b) : w.length = a * d ∨ w.length = b * ddfa_state_complexity_complIn LeanCombinatorial Games
For any language L over alphabet α, the deterministic state complexity of the complement language Lᶜ is equal to the deterministic state complexity of L.
theorem dfa_state_complexity_compl {α : Type*} (L : Language α) :
dfa_state_complexity Lᶜ = dfa_state_complexity Lepstein_level_one_mem_iff_is_squareIn LeanCombinatorial Games
A position n is in remoteness level 1 of Epstein's game if and only if n is a positive perfect square.
theorem epstein_level_one_mem_iff_is_square (n : ℕ) :
n ∈ epstein_remoteness_level 1 ↔ 0 < n ∧ IsSquare nepstein_level_three_count_le_pow_seven_eighthsIn LeanCombinatorial Games
The number of n ≤ Y in remoteness level 3 of Epstein's game is O(Y^{7/8}).
theorem epstein_level_three_count_le_pow_seven_eighths :
∃ C : ℝ, 0 < C ∧ ∀ Y : ℕ,
(Set.ncard ({n : ℕ | n ∈ epstein_remoteness_level 3} ∩ Set.Iic Y) : ℝ) ≤
C * ((Y : ℝ) + 1) ^ ((7 : ℝ) / 8)epstein_level_three_iffIn LeanCombinatorial Games
A position n is in remoteness level 3 of Epstein's game if and only if n is nonzero, neither move of n is zero, and at least one of the two moves is a Stein number.
theorem epstein_level_three_iff (n : ℕ) :
n ∈ epstein_remoteness_level 3 ↔
n ≠ 0 ∧ epstein_down n ≠ 0 ∧ epstein_up n ≠ 0 ∧
(is_stein_number (epstein_down n) ∨ is_stein_number (epstein_up n))epstein_level_two_mem_iff_is_stein_numberIn LeanCombinatorial Games
A position n is in remoteness level 2 of Epstein's game if and only if n is an E. P. Stein number.
theorem epstein_level_two_mem_iff_is_stein_number (n : ℕ) :
n ∈ epstein_remoteness_level 2 ↔ is_stein_number nepstein_pell_family_movesIn LeanCombinatorial Games
If T^2 + 1 = 2 S^2 with T ≥ 2, then for n = (2S)^2 + 1 the square root is 2S so the down-move is 1 and the up-move is (2T)^2 + 5, and for that up-move the square root is 2T so its down-move is 5.
theorem epstein_pell_family_moves (S T : ℕ) (hT : 2 ≤ T) (h : T * T + 1 = 2 * S * S) :
Nat.sqrt ((2 * S) ^ 2 + 1) = 2 * S ∧ epstein_down ((2 * S) ^ 2 + 1) = 1 ∧
epstein_up ((2 * S) ^ 2 + 1) = (2 * T) ^ 2 + 5 ∧
Nat.sqrt ((2 * T) ^ 2 + 5) = 2 * T ∧ epstein_down ((2 * T) ^ 2 + 5) = 5epstein_remoteness_eq_four_iffIn LeanCombinatorial Games
A natural number n has remoteness 4 in Epstein's game if and only if n belongs to level 4 of epstein_remoteness_level.
theorem epstein_remoteness_eq_four_iff (n : ℕ) :
epstein_remoteness n = 4 ↔ n ∈ epstein_remoteness_level 4
epstein_remoteness_four_count_eq_ncardIn LeanCombinatorial Games
The number of n ≤ X with remoteness 4, counted by filtering the range, equals the cardinality of the set of such n intersected with the initial segment up to X.
theorem epstein_remoteness_four_count_eq_ncard (X : ℕ) :
(Finset.filter (fun n => epstein_remoteness n = 4) (Finset.range (X + 1))).card
= Set.ncard ({n : ℕ | epstein_remoteness n = 4} ∩ Set.Iic X)epstein_remoteness_four_count_le_pow_fifteen_sixteenthsIn LeanCombinatorial Games
The number of n ≤ X with remoteness 4 in Epstein's game is O(X^{15/16}).
theorem epstein_remoteness_four_count_le_pow_fifteen_sixteenths :
∃ C : ℝ, 0 < C ∧ ∀ X : ℕ,
((Finset.filter (fun n => epstein_remoteness n = 4) (Finset.range (X + 1))).card : ℝ) ≤
C * ((X : ℝ) + 1) ^ ((15 : ℝ) / 16)epstein_remoteness_four_infiniteIn LeanCombinatorial Games
The set of natural numbers n with remoteness epstein_remoteness n = 4 is infinite.
theorem epstein_remoteness_four_infinite :
Set.Infinite {n : ℕ | epstein_remoteness n = 4}epstein_remoteness_four_infinite_of_pellIn LeanCombinatorial Games
Infinitely many Pell-parameters plus the Pell family being level 4 gives that the set of n with remoteness 4 is infinite.
theorem epstein_remoteness_four_infinite_of_pell
(hsol : Set.Infinite {S : ℕ | ∃ T : ℕ, 2 ≤ T ∧ T * T + 1 = 2 * S * S})
(hfam : ∀ S T : ℕ, 2 ≤ T → T * T + 1 = 2 * S * S →
epstein_remoteness ((2 * S) ^ 2 + 1) = 4) :
Set.Infinite {n : ℕ | epstein_remoteness n = 4}epstein_remoteness_four_pell_familyIn LeanCombinatorial Games
If T^2 + 1 = 2 S^2 with T ≥ 2, then the position (2S)^2 + 1 has remoteness 4.
theorem epstein_remoteness_four_pell_family (S T : ℕ) (hT : 2 ≤ T)
(h : T * T + 1 = 2 * S * S) : epstein_remoteness ((2 * S) ^ 2 + 1) = 4epstein_remoteness_four_zero_densityIn LeanCombinatorial Games
The set of natural numbers n with epstein_remoteness n = 4 has natural asymptotic density zero.
theorem epstein_remoteness_four_zero_density :
Filter.Tendsto
(fun X : ℕ => ((Finset.filter (fun n => epstein_remoteness n = 4) (Finset.range (X + 1))).card : ℝ) / (X : ℝ))
Filter.atTop (nhds (0 : ℝ))epstein_remoteness_four_zero_density_of_subpolyIn LeanCombinatorial Games
If the number of n ≤ X with remoteness 4 is O((X+1)^e) for some exponent e < 1, then the natural density of those n is zero.
theorem epstein_remoteness_four_zero_density_of_subpoly
(C e : ℝ) (hC : 0 < C) (he : e < 1)
(hbound : ∀ X : ℕ,
((Finset.filter (fun n => epstein_remoteness n = 4) (Finset.range (X + 1))).card : ℝ)
≤ C * ((X : ℝ) + 1) ^ e) :
Filter.Tendsto
(fun X : ℕ => ((Finset.filter (fun n => epstein_remoteness n = 4) (Finset.range (X + 1))).card : ℝ) / (X : ℝ))
Filter.atTop (nhds (0 : ℝ))epstein_remoteness_level_four_eqIn LeanCombinatorial Games
In Epstein's game, a position n ≠ 0 belongs to remoteness level 4 if and only if both down(n) and up(n) belong to level 1 ∪ level 3, and at least one of down(n) or up(n) belongs to level 3.
theorem epstein_remoteness_level_four_eq :
epstein_remoteness_level 4 = {n | n ≠ 0 ∧
epstein_down n ∈ epstein_remoteness_level 1 ∪ epstein_remoteness_level 3 ∧
epstein_up n ∈ epstein_remoteness_level 1 ∪ epstein_remoteness_level 3 ∧
(epstein_down n ∈ epstein_remoteness_level 3 ∨ epstein_up n ∈ epstein_remoteness_level 3)}eventual_period_value_of_mod_eqIn LeanCombinatorial Games
If w is eventually periodic with period p from index N on, then for x, y ≥ N that are congruent mod p, w x = w y.
theorem eventual_period_value_of_mod_eq (w : ℕ → Bool) (p N : ℕ)
(hper : ∀ n, N ≤ n → w (n + p) = w n) :
∀ x y : ℕ, N ≤ x → N ≤ y → x % p = y % p → w x = w yexists_odd_sq_dvd_mu_starIn LeanCombinatorial Games
Every positive integer g can be factored as g = d * k^2 where d, k > 0, k is odd, and mu_star d holds.
theorem exists_odd_sq_dvd_mu_star (g : ℕ) (hg : 0 < g) :
∃ d k : ℕ, 0 < d ∧ 0 < k ∧ Odd k ∧ mu_star d ∧ g = d * k ^ 2finset_mex_insert_xor_oneIn LeanCombinatorial Games
For any finite set of natural numbers U, the mex of the set obtained by inserting the mex of U into the image of U under bitwise exclusive-or with 1 equals the mex of U bitwise exclusive-or 1.
theorem finset_mex_insert_xor_one (U : Finset ℕ) :
finset_mex (insert (finset_mex U) (U.image (· ^^^ 1))) = finset_mex U ^^^ 1hunger3_closure_tile_eq_iUnion_cellIn LeanCombinatorial Games
For a real 3-by-3 row-stochastic symmetric matrix Q with positive off-diagonal entries, the closure of its zero-sum recurrent hunger tile is the union over the six permutations e of the cells hunger3_firing_cell Q e.
theorem hunger3_closure_tile_eq_iUnion_cell (Q : Matrix (Fin 3) (Fin 3) ℝ)
(hstoch : Q ∈ Matrix.rowStochastic ℝ (Fin 3)) (hsymm : Q.IsSymm)
(hpos : ∀ i j, i ≠ j → 0 < Q i j) :
closure (hunger_zero_sum_recurrent_tile Q) =
⋃ e : Equiv.Perm (Fin 3), hunger3_firing_cell Q ehunger3_nonultrametric_not_convexIn LeanCombinatorial Games
For a real 3-by-3 row-stochastic symmetric matrix Q with positive off-diagonal entries that does not satisfy the ultrametric transition property, the union of the six firing cells hunger3_firing_cell Q e is not convex: there are points of two cells whose midpoint lies in no cell.
theorem hunger3_nonultrametric_not_convex (Q : Matrix (Fin 3) (Fin 3) ℝ)
(hstoch : Q ∈ Matrix.rowStochastic ℝ (Fin 3)) (hsymm : Q.IsSymm)
(hpos : ∀ i j, i ≠ j → 0 < Q i j) (hnot : ¬ is_ultrametric_transition Q) :
¬ Convex ℝ (⋃ e : Equiv.Perm (Fin 3), hunger3_firing_cell Q e)hunger3_ultrametric_convexIn LeanCombinatorial Games
For a real 3-by-3 row-stochastic symmetric matrix Q with positive off-diagonal entries satisfying the ultrametric transition property, the union of the six firing cells hunger3_firing_cell Q e is convex in ℝ³.
theorem hunger3_ultrametric_convex (Q : Matrix (Fin 3) (Fin 3) ℝ)
(hstoch : Q ∈ Matrix.rowStochastic ℝ (Fin 3)) (hsymm : Q.IsSymm)
(hpos : ∀ i j, i ≠ j → 0 < Q i j) (hultra : is_ultrametric_transition Q) :
Convex ℝ (⋃ e : Equiv.Perm (Fin 3), hunger3_firing_cell Q e)hunger_eventually_periodic_of_finite_value_setIn LeanCombinatorial Games
For n : ℕ with [NeZero n], a rational matrix P, h : Fin n → ℚ and a finite set S of rational vectors containing every iterate hunger_iter P t h, there exist N and L with 0 < L such that hunger_iter P (N + L) h = hunger_iter P N h; that is, the orbit is eventually periodic. Combined with hunger_iter_mem_denominator_lattice and any a priori box bound on the iterates, S can be taken to be the finite set of lattice points in the box.
theorem hunger_eventually_periodic_of_finite_value_set {n : ℕ} [NeZero n]
(P : Matrix (Fin n) (Fin n) ℚ) (h : Fin n → ℚ) (S : Set (Fin n → ℚ))
(hS : S.Finite) (hmem : ∀ t : ℕ, hunger_iter P t h ∈ S) :
∃ N L : ℕ, 0 < L ∧ hunger_iter P (N + L) h = hunger_iter P N hhunger_firing_state_eq_iff_first_maxIn LeanCombinatorial Games
A vector h : Fin n → α (α linearly ordered) has hunger firing state i if and only if h i is a maximum of h and no index smaller than i ties with it at the maximum.
theorem hunger_firing_state_eq_iff_first_max {n : ℕ} [NeZero n] {α : Type*} [LinearOrder α]
(h : Fin n → α) (i : Fin n) :
hunger_firing_state h = i ↔ (∀ j, h j ≤ h i) ∧ (∀ j, h i ≤ h j → i ≤ j)hunger_firing_state_is_maxIn LeanCombinatorial Games
For n : ℕ with [NeZero n], a linearly ordered type α and any vector h : Fin n → α, the coordinate selected by the hunger rule, hunger_firing_state h, is a coordinate at which h attains its maximum: h i ≤ h (hunger_firing_state h) for every i.
theorem hunger_firing_state_is_max {n : ℕ} [NeZero n] {α : Type*} [LinearOrder α]
(h : Fin n → α) (i : Fin n) : h i ≤ h (hunger_firing_state h)hunger_iter_eq_fire_countsIn LeanCombinatorial Games
For n : ℕ with [NeZero n], a rational matrix P, a natural number t and h : Fin n → ℚ, there is a count vector c : Fin n → ℕ with ∑ i, c i = t such that for every coordinate j, hunger_iter P t h j = h j + ∑ i, ((c i : ℚ) * P i j) - (c j : ℚ). That is, the state after t firings depends only on how many times each state was fired, and equals h + ∑_i c_i (P_i - e_i).
theorem hunger_iter_eq_fire_counts {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℚ)
(t : ℕ) (h : Fin n → ℚ) :
∃ c : Fin n → ℕ, (∑ i, c i = t) ∧
∀ j, hunger_iter P t h j = h j + ∑ i, ((c i : ℚ) * P i j) - (c j : ℚ)hunger_iter_eq_fire_counts_realIn LeanCombinatorial Games
For a real n-by-n matrix P, a time t and a vector h, there is a firing-count vector c : Fin n → ℕ with ∑ c = t such that the t-th hunger iterate is h j plus the total weight ∑ c i * P i j received, minus the number c j of times j itself fired.
theorem hunger_iter_eq_fire_counts_real {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ)
(t : ℕ) (h : Fin n → ℝ) :
∃ c : Fin n → ℕ, (∑ i, c i = t) ∧
∀ j, hunger_iter P t h j = h j + ∑ i, ((c i : ℝ) * P i j) - (c j)hunger_iter_mem_denominator_latticeIn LeanCombinatorial Games
For n : ℕ with [NeZero n], a rational matrix P and h : Fin n → ℚ, there is a positive natural number D such that for every t : ℕ and every coordinate j, D * hunger_iter P t h j is an integer: ∃ D, 0 < D ∧ ∀ t j, ∃ z : ℤ, (D : ℚ) * hunger_iter P t h j = (z : ℚ). Explicitly D = (∏ j, (h j).den) * (∏ ij, (P ij.1 ij.2).den) works, so D depends only on h and P and is bounded by the product of the denominators.
theorem hunger_iter_mem_denominator_lattice {n : ℕ} [NeZero n]
(P : Matrix (Fin n) (Fin n) ℚ) (h : Fin n → ℚ) :
∃ D : ℕ, 0 < D ∧ ∀ (t : ℕ) (j : Fin n), ∃ z : ℤ, (D : ℚ) * hunger_iter P t h j = (z : ℚ)hunger_iter_succ_and_addIn LeanCombinatorial Games
For n : ℕ with [NeZero n], a rational matrix P, a natural number t and h : Fin n → ℚ, the (t+1)-th iterate equals one hunger step applied to the t-th iterate, hunger_iter P (t+1) h = hunger_step P (hunger_iter P t h); and iterates compose additively, hunger_iter P (a+b) h = hunger_iter P a (hunger_iter P b h).
theorem hunger_iter_succ_and_add {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℚ) :
(∀ (t : ℕ) (h : Fin n → ℚ), hunger_iter P (t + 1) h = hunger_step P (hunger_iter P t h)) ∧
(∀ (a b : ℕ) (h : Fin n → ℚ), hunger_iter P (a + b) h = hunger_iter P a (hunger_iter P b h))hunger_iter_sum_invariantIn LeanCombinatorial Games
For n : ℕ with [NeZero n], a row-stochastic rational matrix P, any rational h and every t : ℕ, the sum of the coordinates of the t-th iterate is the sum of the coordinates of h: ∑ j, hunger_iter P t h j = ∑ j, h j. In particular, if ∑ i, h i = 0 then every iterate has coordinate sum 0.
theorem hunger_iter_sum_invariant {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℚ)
(hP : P ∈ Matrix.rowStochastic ℚ (Fin n)) (t : ℕ) (h : Fin n → ℚ) :
∑ j, hunger_iter P t h j = ∑ j, h jhunger_period_dvd_minimal_integral_periodIn LeanCombinatorial Games
For n : ℕ with [NeZero n], an irreducible row-stochastic rational matrix P, a stationary distribution π of P, and T the minimal integral period of π, every periodic orbit point y : Fin n → ℚ of positive period T' has T dividing T'. Equivalently (Theorem 2.2 of arXiv:2610.08949): every recurrent orbit of an irreducible rational hunger game has least period exactly T.
theorem hunger_period_dvd_minimal_integral_period {n : ℕ} [NeZero n]
(P : Matrix (Fin n) (Fin n) ℚ) (hP_stoch : P ∈ Matrix.rowStochastic ℚ (Fin n))
(hP_irred : is_irreducible_matrix P) (π : Fin n → ℚ)
(hπ : is_stationary_distribution P π) (T : ℕ) (hT : is_minimal_integral_period π T)
(y : Fin n → ℚ) (T' : ℕ) (hT' : 0 < T') (hper : hunger_iter P T' y = y) :
T ∣ T'hunger_step_sum_invariantIn LeanCombinatorial Games
For n : ℕ with [NeZero n], a rational matrix P : Matrix (Fin n) (Fin n) ℚ that is row-stochastic and any rational vector h : Fin n → ℚ, one hunger firing preserves the total hunger: ∑ j, hunger_step P h j = ∑ j, h j.
theorem hunger_step_sum_invariant {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℚ)
(hP : P ∈ Matrix.rowStochastic ℚ (Fin n)) (h : Fin n → ℚ) :
∑ j, hunger_step P h j = ∑ j, h jhunger_symm_stochastic_kernel_constIn LeanCombinatorial Games
If a real n-by-n matrix P is row-stochastic, symmetric, and has strictly positive off-diagonal entries, then every vector v with ∑ i, v i * P i j = v j for all j is constant.
theorem hunger_symm_stochastic_kernel_const {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ)
(hstoch : P ∈ Matrix.rowStochastic ℝ (Fin n)) (hsymm : P.IsSymm)
(hpos : ∀ i j, i ≠ j → 0 < P i j) (v : Fin n → ℝ)
(hv : ∀ j, ∑ i, v i * P i j = v j) :
∀ i j, v i = v jhunger_three_firing_cell_eq_weakIn LeanCombinatorial Games
For a real 3-by-3 row-stochastic symmetric matrix Q with positive off-diagonal entries and a permutation e, the closure of the set of zero-sum states firing e 0, e 1, e 2 in that order consists exactly of the zero-sum h such that h is weakly maximised at e 0, then h + row (e 0) - e_{e 0} is weakly maximised at e 1, and then h + row (e 0) - e_{e 0} + row (e 1) - e_{e 1} is weakly maximised at e 2.
theorem hunger_three_firing_cell_eq_weak (Q : Matrix (Fin 3) (Fin 3) ℝ)
(hstoch : Q ∈ Matrix.rowStochastic ℝ (Fin 3)) (hsymm : Q.IsSymm)
(hpos : ∀ i j, i ≠ j → 0 < Q i j) (e : Equiv.Perm (Fin 3)) :
hunger3_firing_cell Q e =
{h | (∑ i, h i = 0) ∧ (∀ j, h j ≤ h (e 0)) ∧
(∀ j, hunger3_fire Q (e 0) h j ≤ hunger3_fire Q (e 0) h (e 1)) ∧
(∀ j, hunger3_fire Q (e 1) (hunger3_fire Q (e 0) h) j ≤
hunger3_fire Q (e 1) (hunger3_fire Q (e 0) h) (e 2))}hunger_three_recurrent_fire_permIn LeanCombinatorial Games
If Q is a real 3-by-3 row-stochastic symmetric matrix with positive off-diagonal entries and hunger_iter Q 3 h = h, then there is a permutation e of the three states such that the states fired at times 0, 1, 2 are e 0, e 1, e 2.
theorem hunger_three_recurrent_fire_perm (Q : Matrix (Fin 3) (Fin 3) ℝ)
(hstoch : Q ∈ Matrix.rowStochastic ℝ (Fin 3)) (hsymm : Q.IsSymm)
(hpos : ∀ i j, i ≠ j → 0 < Q i j) (h : Fin 3 → ℝ)
(hrec : hunger_iter Q 3 h = h) :
∃ e : Equiv.Perm (Fin 3), hunger_firing_state h = e 0 ∧
hunger_firing_state (hunger_step Q h) = e 1 ∧
hunger_firing_state (hunger_step Q (hunger_step Q h)) = e 2hunger_three_recurrent_iff_firing_orderIn LeanCombinatorial Games
For a real 3-by-3 row-stochastic symmetric matrix Q with positive off-diagonal entries there exists h : Fin 3 → ℝ with ∑ i, h i = 0 and h in the zero-sum recurrent hunger tile of Q if and only if some permutation e lists the firing states of the first three hunger steps of h; concretely, h with zero sum lies in the tile iff for some e the states fired at times 0, 1, 2 are e 0, e 1, e 2.
theorem hunger_three_recurrent_iff_firing_order (Q : Matrix (Fin 3) (Fin 3) ℝ)
(hstoch : Q ∈ Matrix.rowStochastic ℝ (Fin 3)) (hsymm : Q.IsSymm)
(hpos : ∀ i j, i ≠ j → 0 < Q i j) (h : Fin 3 → ℝ) (hsum : ∑ i, h i = 0) :
h ∈ hunger_zero_sum_recurrent_tile Q ↔
∃ e : Equiv.Perm (Fin 3), hunger_firing_state h = e 0 ∧
hunger_firing_state (hunger_step Q h) = e 1 ∧
hunger_firing_state (hunger_step Q (hunger_step Q h)) = e 2hunger_transient_time_le_of_mem_basinIn LeanCombinatorial Games
For n : ℕ with [NeZero n], P : Matrix (Fin n) (Fin n) ℚ, T N : ℕ, h : Fin n → ℚ, if the N-th iterate lies in the recurrent basin of period T, i.e. hunger_recurrent_basin P T (which is the fixed-point set of the T-fold iterate), then hunger_transient_time P T h ≤ N and for every k the trajectory from N on is T-periodic in the sense hunger_iter P (N + k) h = hunger_iter P (N + k % T) h. Only 0 < T is not needed for this; the statement is unconditional.
theorem hunger_transient_time_le_of_mem_basin {n : ℕ} [NeZero n]
(P : Matrix (Fin n) (Fin n) ℚ) (T N : ℕ) (h : Fin n → ℚ)
(hN : hunger_iter P N h ∈ hunger_recurrent_basin P T) :
hunger_transient_time P T h ≤ N ∧ ∀ k : ℕ, hunger_iter P (N + k) h = hunger_iter P (N + k % T) hhunger_transient_time_le_of_returnIn LeanCombinatorial Games
For n : ℕ with [NeZero n], a rational matrix P, a positive period T, a time N and h : Fin n → ℚ, if hunger_iter P (N + T) h = hunger_iter P N h then hunger_transient_time P T h ≤ N.
theorem hunger_transient_time_le_of_return {n : ℕ} [NeZero n]
(P : Matrix (Fin n) (Fin n) ℚ) (T N : ℕ) (h : Fin n → ℚ)
(hper : hunger_iter P (N + T) h = hunger_iter P N h) :
hunger_transient_time P T h ≤ Nhunger_transient_time_le_polynomial_explicitIn LeanCombinatorial Games
There is a natural number K such that for every n with [NeZero n], every irreducible row-stochastic rational P, every stationary π with minimal integral period T, and every h with ∑ i, h i = 0, the hunger transient time is at most (n + T + max-norm h + max-denominator P)^K.
theorem hunger_transient_time_le_polynomial_explicit :
∃ K : ℕ, ∀ (n : ℕ) [NeZero n]
(P : Matrix (Fin n) (Fin n) ℚ)
(hP_stoch : P ∈ Matrix.rowStochastic ℚ (Fin n))
(hP_irred : is_irreducible_matrix P)
(π : Fin n → ℚ)
(hπ : is_stationary_distribution P π)
(T : ℕ)
(hT : is_minimal_integral_period π T)
(h : Fin n → ℚ)
(h_sum : ∑ i, h i = 0),
(hunger_transient_time P T h : ℚ) ≤
((n : ℚ) + (T : ℚ) + hunger_max_norm h + (rational_matrix_max_denominator P : ℚ)) ^ Khunger_transient_time_le_preperiodIn LeanCombinatorial Games
For n : ℕ with [NeZero n], a rational matrix P, a positive T and h : Fin n → ℚ, if D is a positive integer with D * hunger_iter P t h j integral for all t and j, and if N, L are the pre-period and period of the orbit in the sense hunger_iter P (N + L) h = hunger_iter P N h, then hunger_transient_time P T h ≤ N when T divides L. In particular, when the eventual cycle length L is exactly T, the transient time is at most the pre-period N.
theorem hunger_transient_time_le_preperiod {n : ℕ} [NeZero n]
(P : Matrix (Fin n) (Fin n) ℚ) (T N L : ℕ) (hT : 0 < T) (hL : 0 < L)
(h : Fin n → ℚ) (hdiv : T ∣ L)
(hper : hunger_iter P (N + L) h = hunger_iter P N h) :
hunger_transient_time P T h ≤ Nis_eventual_period_addIn LeanCombinatorial Games
If p and q are eventual periods of a Boolean sequence w, then p + q is an eventual period of w.
theorem is_eventual_period_add (w : ℕ → Bool) (p q : ℕ) (hp : is_eventual_period w p) (hq : is_eventual_period w q) : is_eventual_period w (p + q)
is_eventual_period_gcdIn LeanCombinatorial Games
If p and q are both eventual periods of a Boolean sequence w, then gcd p q is an eventual period of w.
theorem is_eventual_period_gcd (w : ℕ → Bool) (p q : ℕ) (hp : is_eventual_period w p) (hq : is_eventual_period w q) : is_eventual_period w (Nat.gcd p q)
is_eventual_period_mulIn LeanCombinatorial Games
If p is an eventual period of w, then every positive multiple k * p (k ≥ 1) is an eventual period of w.
theorem is_eventual_period_mul (w : ℕ → Bool) (p k : ℕ) (hk : 1 ≤ k) (hp : is_eventual_period w p) : is_eventual_period w (k * p)
is_eventual_period_sub_of_ltIn LeanCombinatorial Games
If p < q are both eventual periods of w, then q - p is an eventual period of w.
theorem is_eventual_period_sub_of_lt (w : ℕ → Bool) (p q : ℕ) (hp : is_eventual_period w p) (hq : is_eventual_period w q) (hlt : p < q) : is_eventual_period w (q - p)
is_stein_number_iff_pell_formIn LeanCombinatorial Games
A natural number n is an E. P. Stein number if and only if n = m^2 + a^2 for positive integers m, a, b satisfying a^2 ≤ 2m and the Pell equation 2m^2 + a^2 = b^2.
theorem is_stein_number_iff_pell_form (n : ℕ) :
is_stein_number n ↔ ∃ m a b : ℕ, 0 < a ∧ a ^ 2 ≤ 2 * m ∧ 2 * m ^ 2 + a ^ 2 = b ^ 2 ∧ n = m ^ 2 + a ^ 2is_ultrametric_transition_three_iff_maxIn LeanCombinatorial Games
A symmetric 3-by-3 matrix P over a linear order satisfies the ultrametric transition property if and only if P 0 1 ≤ max (P 0 2) (P 1 2), P 0 2 ≤ max (P 0 1) (P 1 2) and P 1 2 ≤ max (P 0 1) (P 0 2).
theorem is_ultrametric_transition_three_iff_max {α : Type*} [LinearOrder α]
(P : Matrix (Fin 3) (Fin 3) α) (hsymm : P.IsSymm) :
is_ultrametric_transition P ↔
(P 0 1 ≤ max (P 0 2) (P 1 2) ∧ P 0 2 ≤ max (P 0 1) (P 1 2) ∧
P 1 2 ≤ max (P 0 1) (P 0 2))least_eventual_period_dvdIn LeanCombinatorial Games
For any eventual period p of w, the least eventual period of w divides p.
theorem least_eventual_period_dvd (w : ℕ → Bool) (p : ℕ) (hp : is_eventual_period w p) : least_eventual_period w ∣ p
least_eventual_period_is_eventual_periodIn LeanCombinatorial Games
If w has at least one eventual period, then the infimum of the set of eventual periods of w is again an eventual period of w.
theorem least_eventual_period_is_eventual_period (w : ℕ → Bool) (h : ∃ p, is_eventual_period w p) : is_eventual_period w (least_eventual_period w)
least_eventual_period_posIn LeanCombinatorial Games
If w has an eventual period, then its least eventual period is positive.
theorem least_eventual_period_pos (w : ℕ → Bool) (h : ∃ p, is_eventual_period w p) : 0 < least_eventual_period w
list_isSuffix_iff_getElem?_reverseIn LeanCombinatorial Games
s is a suffix of l if and only if, for every i below the length of s, the i-th letter of l from the right equals the i-th letter of s from the right.
theorem list_isSuffix_iff_getElem?_reverse {α : Type*} {s l : List α} :
s <:+ l ↔ ∀ i : ℕ, i < s.length → l.reverse[i]? = s.reverse[i]?list_take_append_singleton_takeIn LeanCombinatorial Games
Dropping the last j letters (j ≥ 1) from w ++ [c] gives the same word as dropping the last j-1 letters from w.
theorem list_take_append_singleton_take {α : Type*} (w : List α) (c : α) {j : ℕ} (hj : 1 ≤ j) :
(w ++ [c]).take ((w ++ [c]).length - j) = w.take (w.length - (j - 1))moving_target_lower_bound_of_expansionIn LeanCombinatorial Games
For any simple graph G on a finite type V, if every subset D of vertices of cardinality at least K satisfies 2 * K ≤ |closed_neighborhood G D| + 1, then any successful moving target strategy starting from a set D with |D| ≥ K must have accuracy threshold s ≥ K.
theorem moving_target_lower_bound_of_expansion
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (K : ℕ)
(h_exp : ∀ D : Finset V, K ≤ D.card → 2 * K ≤ (closed_neighborhood G D).card + 1)
(S : MovingTargetStrategy V) :
∀ (D : Finset V) (s : ℕ), K ≤ D.card →
moving_target_strategy_successful G s S D → K ≤ smoving_target_strategy_successful_mono_of_subsetIn LeanCombinatorial Games
A strategy that succeeds with accuracy s on a candidate set D also succeeds with accuracy s on every subset D' ⊆ D (a larger candidate set can only hurt).
theorem moving_target_strategy_successful_mono_of_subset {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (s : ℕ) (S : MovingTargetStrategy V) {D D' : Finset V} (hsub : D' ⊆ D) : moving_target_strategy_successful G s S D → moving_target_strategy_successful G s S D'moving_target_strategy_successful_of_neighborhood_card_leIn LeanCombinatorial Games
If the closed neighbourhood of the candidate set D has at most 2s vertices, one query suffices to win with accuracy s: query a subset of N[D] of size |N[D]| - s (or stop if |N[D]| ≤ s), leaving both answer branches with at most s candidates.
theorem moving_target_strategy_successful_of_neighborhood_card_le {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (s : ℕ) (D : Finset V) (h : (closed_neighborhood G D).card ≤ 2 * s) : ∃ S : MovingTargetStrategy V, moving_target_strategy_successful G s S Dnot_op_1643_pyranim_collision_prob_decayIn LeanCombinatorial Games
The statement op_1643_pyranim_collision_prob_decay is false: The statement claims that Filter.Tendsto (fun n => (pyranim_collision_prob n) ^ (1 / n)) Filter.atTop (nhds 1), i.e., that the n-th root of the game isomorphism collision probability converges to 1. This is mathematically false:
1. Provenance: The informal provenance cites arXiv:2611.16153 Sec. 5.3, Question 4 as a 'published theorem'. In fact, Section 5.3 of that paper is the Open Questions section, and Question 4 merely asks what the collision probability is. The paper does not state, let alone prove, that (P(n))^(1/n) -> 1.
2. Theoretical upper bound: The total number of stable positions is |T_n| = C_{n+1} ~ 4^(n+1) / (sqrt(pi) * n^(3/2)). Game isomorphism coincides with unit interval graph isomorphism (pyranim_game_iso_iff_graph_iso). Since connected unit interval graphs have essentially unique interval representations (at most 2 up to reversal by Roberts 1969), each isomorphism class C_i has size |C_i| <= 2^n. Thus:
P(n) = (sum |C_i|^2) / |T_n|^2 <= max |C_i| / |T_n| <= 2^n / C_{n+1} = O(n^(3/2) * 2^(-n)).
Taking n-th roots yields limsup_{n -> infty} (P(n))^(1/n) <= 1/2 < 1.
3. Numerical evidence (experiment #25564):
- n=1: P(1) = 0.500000, P(1)^(1/1) = 0.500000
- n=2: P(2) = 0.280000, P(2)^(1/2) = 0.529150
- n=3: P(3) = 0.153061, P(3)^(1/3) = 0.534919
- n=4: P(4) = 0.083900, P(4)^(1/4) = 0.538196
- n=5: P(5) = 0.044995, P(5)^(1/5) = 0.537816
- n=6: P(6) = 0.023565, P(6)^(1/6) = 0.535442
- n=7: P(7) = 0.012129, P(7)^(1/7) = 0.532426
- n=8: P(8) = 0.006171, P(8)^(1/8) = 0.529415
The sequence (P(n))^(1/n) stays near 0.53 and decreases for n >= 4. It does not converge to 1.
theorem not_op_1643_pyranim_collision_prob_decay : ¬ (Filter.Tendsto (fun n : ℕ => (pyranim_collision_prob n) ^ (1 / (n : ℝ))) Filter.atTop (nhds 1))
op_1349_cyclic_distinguishable_familyIn LeanCombinatorial Games
Lower-bound milestone for OP-1349: there are 4*d*lcm(a,b)-d words over Fin d that are pairwise distinguished by the P-position language, i.e. no two have the same left quotient.
theorem op_1349_cyclic_distinguishable_family
(d : ℕ) (hd : 2 ≤ d) (s : ℕ) (hs1 : 1 ≤ s) (hsd : s < d) (a b : ℕ) (ha : 1 ≤ a) (hb : 1 ≤ b) :
∃ f : Fin (4 * d * Nat.lcm a b - d) → List (Fin d),
∀ i j, i ≠ j →
(word_subtraction_N (cyclic_permutation_subtraction_set d s a b))ᶜ.leftQuotient (f i) ≠
(word_subtraction_N (cyclic_permutation_subtraction_set d s a b))ᶜ.leftQuotient (f j)op_1349_cyclic_explicit_dfaIn LeanCombinatorial Games
Upper-bound milestone for OP-1349: there is a DFA over the alphabet Fin d with exactly 4*d*lcm(a,b)-d states accepting precisely the P-position language, i.e. the complement of word_subtraction_N of the cyclic-permutation subtraction set.
theorem op_1349_cyclic_explicit_dfa
(d : ℕ) (hd : 2 ≤ d) (s : ℕ) (hs1 : 1 ≤ s) (hsd : s < d) (a b : ℕ) (ha : 1 ≤ a) (hb : 1 ≤ b) :
∃ (σ : Type) (_ : Fintype σ) (M : DFA (Fin d) σ),
Fintype.card σ = 4 * d * Nat.lcm a b - d ∧
M.accepts = (word_subtraction_N (cyclic_permutation_subtraction_set d s a b))ᶜop_1349_cyclic_permutation_word_game_state_complexity_geIn LeanCombinatorial Games
Open Problem OP-1349 (lower bound): For every integer d ≥ 2, rotation 1 ≤ s < d, and positive exponents a, b ≥ 1, the deterministic state complexity of word_subtraction_N (cyclic_permutation_subtraction_set d s a b) is at least 4 * d * Nat.lcm a b - d.
theorem op_1349_cyclic_permutation_word_game_state_complexity_ge
(d : ℕ) (hd : 2 ≤ d) (s : ℕ) (hs1 : 1 ≤ s) (hsd : s < d) (a b : ℕ) (ha : 1 ≤ a) (hb : 1 ≤ b) :
4 * d * Nat.lcm a b - d ≤
dfa_state_complexity (word_subtraction_N (cyclic_permutation_subtraction_set d s a b))op_1349_cyclic_permutation_word_game_state_complexity_leIn LeanCombinatorial Games
Open Problem OP-1349 (upper bound): For every integer d ≥ 2, rotation 1 ≤ s < d, and positive exponents a, b ≥ 1, the deterministic state complexity of word_subtraction_N (cyclic_permutation_subtraction_set d s a b) is at most 4 * d * Nat.lcm a b - d.
theorem op_1349_cyclic_permutation_word_game_state_complexity_le
(d : ℕ) (hd : 2 ≤ d) (s : ℕ) (hs1 : 1 ≤ s) (hsd : s < d) (a b : ℕ) (ha : 1 ≤ a) (hb : 1 ≤ b) :
dfa_state_complexity (word_subtraction_N (cyclic_permutation_subtraction_set d s a b)) ≤
4 * d * Nat.lcm a b - dop_1349_partial_binary_case_geIn LeanCombinatorial Games
Open Problem OP-1349 (binary case lower bound): For the binary alphabet with d = 2, rotation s = 1, and positive exponents a, b ≥ 1, the deterministic state complexity of word_subtraction_N (cyclic_permutation_subtraction_set 2 1 a b) is at least 8 * Nat.lcm a b - 2.
theorem op_1349_partial_binary_case_ge
(a b : ℕ) (ha : 1 ≤ a) (hb : 1 ≤ b) :
8 * Nat.lcm a b - 2 ≤
dfa_state_complexity (word_subtraction_N (cyclic_permutation_subtraction_set 2 1 a b))op_1349_partial_binary_case_leIn LeanCombinatorial Games
Open Problem OP-1349 (binary case upper bound): For the binary alphabet with d = 2, rotation s = 1, and positive exponents a, b ≥ 1, the deterministic state complexity of word_subtraction_N (cyclic_permutation_subtraction_set 2 1 a b) is at most 8 * Nat.lcm a b - 2.
theorem op_1349_partial_binary_case_le
(a b : ℕ) (ha : 1 ≤ a) (hb : 1 ≤ b) :
dfa_state_complexity (word_subtraction_N (cyclic_permutation_subtraction_set 2 1 a b)) ≤
8 * Nat.lcm a b - 2op_1349_partial_unit_exponents_geIn LeanCombinatorial Games
Open Problem OP-1349 (unit exponents lower bound): For every integer d ≥ 2 and shift 1 ≤ s < d, the deterministic state complexity of word_subtraction_N (cyclic_permutation_subtraction_set d s 1 1) is at least 3 * d.
theorem op_1349_partial_unit_exponents_ge
(d : ℕ) (hd : 2 ≤ d) (s : ℕ) (hs1 : 1 ≤ s) (hsd : s < d) :
3 * d ≤
dfa_state_complexity (word_subtraction_N (cyclic_permutation_subtraction_set d s 1 1))op_1349_partial_unit_exponents_leIn LeanCombinatorial Games
Open Problem OP-1349 (unit exponents upper bound): For every integer d ≥ 2 and shift 1 ≤ s < d, the deterministic state complexity of word_subtraction_N (cyclic_permutation_subtraction_set d s 1 1) is at most 3 * d.
theorem op_1349_partial_unit_exponents_le
(d : ℕ) (hd : 2 ≤ d) (s : ℕ) (hs1 : 1 ≤ s) (hsd : s < d) :
dfa_state_complexity (word_subtraction_N (cyclic_permutation_subtraction_set d s 1 1)) ≤
3 * dop_1349_smallest_instance_state_complexityIn LeanCombinatorial Games
The smallest instance of OP-1349: for d = 2, s = 1, a = b = 1 the deterministic state complexity of the P-position language is exactly 6, agreeing with both 4*d*lcm(a,b)-d and 3*d.
theorem op_1349_smallest_instance_state_complexity :
dfa_state_complexity (word_subtraction_N (cyclic_permutation_subtraction_set 2 1 1 1))ᶜ = 6pell_solution_stein_paramIn LeanCombinatorial Games
Any solution to the Pell equation 2m^2 + a^2 = b^2 with 0 < a and a^2 ≤ 2m yields positive integers g, U, V with U odd such that m^2 + a^2 = g^2 (U^4 + 4V^4) and g (U^2 - 2V^2)^2 ≤ 4UV.
theorem pell_solution_stein_param (m a b : ℕ) (ha : 0 < a) (hle : a ^ 2 ≤ 2 * m) (hpell : 2 * m ^ 2 + a ^ 2 = b ^ 2) :
∃ g U V : ℕ, 0 < g ∧ 0 < U ∧ 0 < V ∧ Odd U ∧
m ^ 2 + a ^ 2 = g ^ 2 * (U ^ 4 + 4 * V ^ 4) ∧
(g : ℤ) * ((U : ℤ) ^ 2 - 2 * (V : ℤ) ^ 2) ^ 2 ≤ 4 * (U : ℤ) * (V : ℤ)pell_two_neg_one_solutions_infiniteIn LeanCombinatorial Games
The negative Pell equation T^2 + 1 = 2 S^2 has infinitely many solutions (S, T) in natural numbers with T ≥ 2.
theorem pell_two_neg_one_solutions_infinite :
Set.Infinite {S : ℕ | ∃ T : ℕ, 2 ≤ T ∧ T * T + 1 = 2 * S * S}pell_unit_squared_gt_oneIn LeanCombinatorial Games
The squared fundamental Pell unit pell_unit_squared = 17 + 12 * sqrt(2) is strictly greater than 1.
theorem pell_unit_squared_gt_one : 1 < pell_unit_squared
pyranim_between_mem_iff_joinIn LeanCombinatorial Games
In an order ideal X, the chip (min u v, max u v) spanned by u and v lies in X if and only if the two diagonal chips (u,u) and (v,v) have a common upper bound in X. Thus adjacency in pyranim_gamma is the existence of a join of two minimal chips.
theorem pyranim_between_mem_iff_join (X : Finset (ℕ × ℕ)) (hX : pyranim_is_order_ideal X)
(u v : ℕ) :
(min u v, max u v) ∈ X ↔
∃ w ∈ X, pyranim_chip_sub (u, u) w ∧ pyranim_chip_sub (v, v) wpyranim_card_stable_positions_card_eq_seqIn LeanCombinatorial Games
The number of stable positions of the n-tier Pyranim pyramid equals the number of weakly increasing sequences l : Fin n → Fin (n+2) with 1 ≤ l i ≤ i+2: a position is recovered from, and determined by, the minima of its columns.
theorem pyranim_card_stable_positions_card_eq_seq (n : ℕ) :
(pyranim_stable_positions n).card = (pyranim_seq n).cardpyranim_card_stable_positions_of_equivIn LeanCombinatorial Games
If the set of stable positions pyranim_stable_positions n in an n-tier Pyranim game is in bijection with the type of Dyck words of semilength n + 1, then its cardinality equals the Catalan number catalan (n + 1).
theorem pyranim_card_stable_positions_of_equiv (n : ℕ)
(h : Nonempty (pyranim_stable_positions n ≃ { p : DyckWord // p.semilength = n + 1 })) :
(pyranim_stable_positions n).card = catalan (n + 1)pyranim_catalan_succ_recIn LeanCombinatorial Games
The Catalan numbers satisfy catalan (n+2) = 2 * catalan (n+1) + ∑_{i<n} catalan (i+1) * catalan (n-i); this is the standard convolution recursion with the two end terms (both equal to catalan (n+1)) peeled off.
theorem pyranim_catalan_succ_rec (n : ℕ) :
catalan (n + 2) = 2 * catalan (n + 1) + ∑ i ∈ Finset.range n, catalan (i + 1) * catalan (n - i)pyranim_chip_sub_antisymmIn LeanCombinatorial Games
Chip containment is antisymmetric: if p is contained in q and q in p, then p = q. So pyranim_chip_sub is a genuine partial order and "positions isomorphic as posets" is a well-posed notion.
theorem pyranim_chip_sub_antisymm {p q : ℕ × ℕ} (h₁ : pyranim_chip_sub p q) (h₂ : pyranim_chip_sub q p) : p = qpyranim_game_iso_imp_poset_isoIn LeanCombinatorial Games
The bisimulation type of a stable position determines its chip poset: game-isomorphic stable positions are isomorphic as chip posets.
theorem pyranim_game_iso_imp_poset_iso {n : ℕ} {X Y : Finset (ℕ × ℕ)}
(hX : X ∈ pyranim_stable_positions n) (hY : Y ∈ pyranim_stable_positions n)
(h : pyranim_game_iso X Y) : pyranim_poset_iso X Ypyranim_game_iso_reflIn LeanCombinatorial Games
Every Pyranim position X is game-isomorphic to itself.
theorem pyranim_game_iso_refl (X : Finset (ℕ × ℕ)) : pyranim_game_iso X X
pyranim_game_iso_symmIn LeanCombinatorial Games
If Pyranim position X is game-isomorphic to position Y, then Y is game-isomorphic to X.
theorem pyranim_game_iso_symm {X Y : Finset (ℕ × ℕ)} (h : pyranim_game_iso X Y) : pyranim_game_iso Y Xpyranim_game_iso_transIn LeanCombinatorial Games
If X is game-isomorphic to Y and Y is game-isomorphic to Z, then X is game-isomorphic to Z.
theorem pyranim_game_iso_trans {X Y Z : Finset (ℕ × ℕ)} (hXY : pyranim_game_iso X Y) (hYZ : pyranim_game_iso Y Z) : pyranim_game_iso X Zpyranim_gamma_iso_imp_poset_isoIn LeanCombinatorial Games
An isomorphism of the unit interval graphs pyranim_gamma X and pyranim_gamma Y of two stable positions comes from an isomorphism of their chip posets.
theorem pyranim_gamma_iso_imp_poset_iso {n : ℕ} {X Y : Finset (ℕ × ℕ)}
(hX : X ∈ pyranim_stable_positions n) (hY : Y ∈ pyranim_stable_positions n)
(h : Nonempty (pyranim_gamma X ≃g pyranim_gamma Y)) : pyranim_poset_iso X Ypyranim_minimal_iff_diagonalIn LeanCombinatorial Games
In an order ideal all of whose chips are intervals, a chip c is minimal for chip containment (nothing in X lies strictly below it) if and only if it is a diagonal chip with c.1 = c.2.
theorem pyranim_minimal_iff_diagonal (X : Finset (ℕ × ℕ)) (hX : pyranim_is_order_ideal X)
(hI : ∀ p ∈ X, p.1 ≤ p.2) (c : ℕ × ℕ) (hc : c ∈ X) :
(∀ d ∈ X, pyranim_chip_sub d c → pyranim_chip_sub c d) ↔ c.1 = c.2pyranim_poset_iso_imp_game_isoIn LeanCombinatorial Games
An isomorphism of chip posets between two stable positions is a game isomorphism.
theorem pyranim_poset_iso_imp_game_iso {n : ℕ} {X Y : Finset (ℕ × ℕ)}
(hX : X ∈ pyranim_stable_positions n) (hY : Y ∈ pyranim_stable_positions n)
(h : pyranim_poset_iso X Y) : pyranim_game_iso X Ypyranim_poset_iso_imp_gamma_isoIn LeanCombinatorial Games
If two stable positions are isomorphic as chip posets, their unit interval graphs pyranim_gamma are isomorphic.
theorem pyranim_poset_iso_imp_gamma_iso {n : ℕ} {X Y : Finset (ℕ × ℕ)}
(hX : X ∈ pyranim_stable_positions n) (hY : Y ∈ pyranim_stable_positions n)
(h : pyranim_poset_iso X Y) : Nonempty (pyranim_gamma X ≃g pyranim_gamma Y)pyranim_poset_iso_reflIn LeanCombinatorial Games
Every position is isomorphic to itself as a chip poset.
theorem pyranim_poset_iso_refl (X : Finset (ℕ × ℕ)) : pyranim_poset_iso X X
pyranim_seq_card_eq_catalanIn LeanCombinatorial Games
The number of weakly increasing sequences l : Fin n → Fin (n+2) with 1 ≤ l i ≤ i+2 is the Catalan number catalan (n+1).
theorem pyranim_seq_card_eq_catalan (n : ℕ) : (pyranim_seq n).card = catalan (n + 1)
pyranim_seq_first_empty_specIn LeanCombinatorial Games
Let l be a sequence of pyranim_seq (n+1) with l 0 = 1 (so the first column is nonempty) and suppose some later column is empty, i.e. l i = i+2 for some 0 < i < n+1. Then j = pyranim_seq_first_empty n l satisfies l(j) = j+2, 0 < j < n+1, and every column with 0 < i < j is nonempty, i.e. l i ≤ i+1.
theorem pyranim_seq_first_empty_spec (n : ℕ) {l : Fin (n + 1) → Fin (n + 3)}
(hl : l ∈ pyranim_seq (n + 1)) (h0 : l ⟨0, Nat.succ_pos n⟩ = 1)
(h : ∃ i : Fin (n + 1), 0 < (i : ℕ) ∧ (l i : ℕ) = (i : ℕ) + 2) :
pyranim_fin_lookup (n + 1) l (pyranim_seq_first_empty n l) = pyranim_seq_first_empty n l + 2 ∧
0 < pyranim_seq_first_empty n l ∧ pyranim_seq_first_empty n l < n + 1 ∧
∀ j, 0 < j → j < pyranim_seq_first_empty n l → pyranim_fin_lookup (n + 1) l j ≤ j + 1pyranim_seq_ideal_injectiveIn LeanCombinatorial Games
If two weakly increasing sequences 1 ≤ l i ≤ i+2 give the same position, then they are equal: the least element of column b of the position recovers l(b-1).
theorem pyranim_seq_ideal_injective (n : ℕ) {l l' : Fin n → Fin (n + 2)}
(hl : l ∈ pyranim_seq n) (hl' : l' ∈ pyranim_seq n)
(h : pyranim_seq_ideal n l = pyranim_seq_ideal n l') : l = l'pyranim_seq_ideal_mem_iffIn LeanCombinatorial Games
For a sequence l : Fin n → Fin (n+2) and 1 ≤ b ≤ n, the chip (a,b) belongs to pyranim_seq_ideal n l if and only if 1 ≤ a, a ≤ b, and l(b-1) ≤ a.
theorem pyranim_seq_ideal_mem_iff (n : ℕ) (l : Fin n → Fin (n + 2)) {a b : ℕ}
(hb1 : 1 ≤ b) (hbn : b ≤ n) :
(a, b) ∈ pyranim_seq_ideal n l ↔ 1 ≤ a ∧ a ≤ b ∧ pyranim_fin_lookup n l (b - 1) ≤ apyranim_seq_ideal_mem_stableIn LeanCombinatorial Games
If l is a weakly increasing sequence with 1 ≤ l i ≤ i+2 for i < n, then pyranim_seq_ideal n l is a stable position of the n-tier pyramid (a subset of the pyramid closed under taking subintervals).
theorem pyranim_seq_ideal_mem_stable (n : ℕ) {l : Fin n → Fin (n + 2)} (hl : l ∈ pyranim_seq n) :
pyranim_seq_ideal n l ∈ pyranim_stable_positions npyranim_seq_ideal_stable_seqIn LeanCombinatorial Games
For a stable position X of the n-tier pyramid, the position attached to its column-minimum sequence is X again: pyranim_seq_ideal n (pyranim_stable_seq n X) = X.
theorem pyranim_seq_ideal_stable_seq (n : ℕ) {X : Finset (ℕ × ℕ)} (hX : X ∈ pyranim_stable_positions n) :
pyranim_seq_ideal n (pyranim_stable_seq n X) = Xpyranim_seq_succ_cardIn LeanCombinatorial Games
The number B(n+1) of sequences in pyranim_seq (n+1) satisfies B(n+1) = 2·B(n) + ∑_{i<n} B(i)·B(n-1-i), the three cases being: first column empty, first column nonempty with no empty column later, and first column nonempty with a first empty column j > 1.
theorem pyranim_seq_succ_card (n : ℕ) :
(pyranim_seq (n + 1)).card = 2 * (pyranim_seq n).card +
∑ i ∈ Finset.range n, (pyranim_seq i).card * (pyranim_seq (n - 1 - i)).cardpyranim_seq_succ_card_fullIn LeanCombinatorial Games
The number of sequences in pyranim_seq (n+1) that have l 0 = 1 and satisfy l i ≤ i+1 for every i (no empty column) equals the number of sequences in pyranim_seq n: it is the bijection that deletes the first entry.
theorem pyranim_seq_succ_card_full (n : ℕ) :
((pyranim_seq (n + 1)).filter (fun l => l ⟨0, Nat.succ_pos n⟩ = 1 ∧
∀ i : Fin (n + 1), (l i : ℕ) ≤ (i : ℕ) + 1)).card = (pyranim_seq n).cardpyranim_seq_succ_card_splitIn LeanCombinatorial Games
The number of sequences in pyranim_seq (n+1) with l 0 = 1 and some column i > 0 empty (l i = i+2) equals ∑_{i<n} B(i)·B(n-1-i), where B(m) is the number of sequences of length m: splitting at the first empty column j gives a bijection with a pair of sequences of lengths j-1 and n-j.
theorem pyranim_seq_succ_card_split (n : ℕ) :
((pyranim_seq (n + 1)).filter (fun l => l ⟨0, Nat.succ_pos n⟩ = 1 ∧
∃ i : Fin (n + 1), 0 < (i : ℕ) ∧ (l i : ℕ) = (i : ℕ) + 2)).card
= ∑ i ∈ Finset.range n, (pyranim_seq i).card * (pyranim_seq (n - 1 - i)).cardpyranim_seq_succ_card_topIn LeanCombinatorial Games
The number of sequences in pyranim_seq (n+1) with l 0 = 2 (first column empty) equals the number of sequences in pyranim_seq n: the bijection drops the first entry and subtracts one from all the others.
theorem pyranim_seq_succ_card_top (n : ℕ) :
((pyranim_seq (n + 1)).filter (fun l => l ⟨0, Nat.succ_pos n⟩ = 2)).card = (pyranim_seq n).cardpyranim_stable_column_iffIn LeanCombinatorial Games
Let X be a stable position in the n-tier pyramid (an order ideal). For 1 ≤ a ≤ b ≤ n, the chip (a,b) belongs to X if and only if b + 1 - (the number of a' in {1,...,b} with (a',b) in X) ≤ a; that is, each column of X is a final segment of {1,...,b}.
theorem pyranim_stable_column_iff (n : ℕ) {X : Finset (ℕ × ℕ)} (hX : X ∈ pyranim_stable_positions n)
{a b : ℕ} (ha : a ∈ Finset.Icc 1 b) (hbn : b ≤ n) :
(a, b) ∈ X ↔ b + 1 - ((Finset.Icc 1 b).filter (fun a' => (a', b) ∈ X)).card ≤ apyranim_stable_positions_equiv_dyck_wordIn LeanCombinatorial Games
For every natural number n, the set of stable positions pyranim_stable_positions n in an n-tier Pyranim game is in bijection with the type of Dyck words of semilength n + 1.
theorem pyranim_stable_positions_equiv_dyck_word (n : ℕ) :
Nonempty (pyranim_stable_positions n ≃ { p : DyckWord // p.semilength = n + 1 })pyranim_stable_positions_equiv_of_card_eqIn LeanCombinatorial Games
If the cardinality of pyranim_stable_positions n equals catalan (n + 1), then there exists a bijection between pyranim_stable_positions n and the type of Dyck words of semilength n + 1.
theorem pyranim_stable_positions_equiv_of_card_eq (n : ℕ)
(h : (pyranim_stable_positions n).card = catalan (n + 1)) :
Nonempty (pyranim_stable_positions n ≃ { p : DyckWord // p.semilength = n + 1 })pyranim_stable_seq_memIn LeanCombinatorial Games
If X is a stable position of the n-tier pyramid, its column-minimum sequence l i = (i+2) - (size of column i+1) is weakly increasing with 1 ≤ l i ≤ i+2, i.e. it belongs to pyranim_seq n.
theorem pyranim_stable_seq_mem (n : ℕ) {X : Finset (ℕ × ℕ)} (hX : X ∈ pyranim_stable_positions n) :
pyranim_stable_seq n X ∈ pyranim_seq npyranim_upper_set_card_iffIn LeanCombinatorial Games
Let S be a finite set of natural numbers contained in {1, ..., b} and upward closed inside it: if a ∈ S and a ≤ a' ≤ b then a' ∈ S. Then for every a in {1, ..., b}, a belongs to S if and only if b + 1 - (card S) ≤ a; equivalently a finite upward closed subset of {1, ..., b} is exactly {b + 1 - card S, ..., b}.
theorem pyranim_upper_set_card_iff {b : ℕ} {S : Finset ℕ} (hsub : S ⊆ Finset.Icc 1 b)
(hup : ∀ a ∈ S, ∀ a' ∈ Finset.Icc a b, a' ∈ S) {a : ℕ} (ha : a ∈ Finset.Icc 1 b) :
a ∈ S ↔ b + 1 - S.card ≤ areal_hunger_add_shift_sum_eqIn LeanCombinatorial Games
For a row-stochastic real matrix P, any vector x and any real vector v, the coordinate sum of x + v * (P - I) equals the coordinate sum of x. No hypothesis on v is needed: every row of P - I sums to 0.
theorem real_hunger_add_shift_sum_eq {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ) (hP : P ∈ Matrix.rowStochastic ℝ (Fin n)) (v x : Fin n → ℝ) : ∑ j, (x j + Matrix.vecMul v (P - 1) j) = ∑ j, x jreal_hunger_coalescence_transIn LeanCombinatorial Games
Coalescence of hunger trajectories is transitive: if the trajectories from h1 and h2 meet at time t1 and those from h2 and h3 meet at time t2, then those from h1 and h3 meet.
theorem real_hunger_coalescence_trans {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ) {h1 h2 h3 : Fin n → ℝ} {t1 t2 : ℕ} (h12 : hunger_iter P t1 h1 = hunger_iter P t1 h2) (h23 : hunger_iter P t2 h2 = hunger_iter P t2 h3) : ∃ t, hunger_iter P t h1 = hunger_iter P t h3real_hunger_elementary_shift_coalescenceIn LeanCombinatorial Games
For n ≥ 3, irreducible row-stochastic real P, zero-sum h, and distinct p q, the hunger trajectories from h and from h + (e_p - e_q) * (P - I) eventually coincide.
theorem real_hunger_elementary_shift_coalescence : ∀ (n : ℕ) [NeZero n] (hn : 3 ≤ n) (P : Matrix (Fin n) (Fin n) ℝ) (hP_stoch : P ∈ Matrix.rowStochastic ℝ (Fin n)) (hP_irred : is_irreducible_real_matrix P) (h : Fin n → ℝ) (h_sum : ∑ i, h i = 0) (p q : Fin n) (hpq : p ≠ q), ∃ t : ℕ, hunger_iter P t h = hunger_iter P t (h + Matrix.vecMul (fun j => ((if j = p then (1:ℝ) else 0) - (if j = q then 1 else 0))) (P - 1))
real_hunger_elementary_shift_reductionIn LeanCombinatorial Games
If every elementary shift e_p - e_q coalesces (at zero-sum starts), then every zero-sum integer shift z coalesces: the target's conclusion holds, with no irreducibility or n ≥ 3 hypothesis.
theorem real_hunger_elementary_shift_reduction {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ) (hP : P ∈ Matrix.rowStochastic ℝ (Fin n)) (helem : ∀ (x : Fin n → ℝ), (∑ i, x i = 0) → ∀ p q : Fin n, p ≠ q → ∃ t, hunger_iter P t x = hunger_iter P t (x + Matrix.vecMul (fun j => ((if j = p then (1:ℝ) else 0) - (if j = q then 1 else 0))) (P - 1))) (h : Fin n → ℝ) (h_sum : ∑ i, h i = 0) (z : Fin n → ℤ) (hz_sum : ∑ i, z i = 0) : ∃ t, hunger_iter P t h = hunger_iter P t (h + Matrix.vecMul (fun j => (z j : ℝ)) (P - 1))real_hunger_erase_sum_eqIn LeanCombinatorial Games
Every zero-sum integer vector z equals the sum over i ≠ q0 of z i * (e_i - e_{q0}), because ∑_{i ≠ q0} z i = -z_{q0}.
theorem real_hunger_erase_sum_eq {n : ℕ} [NeZero n] (z : Fin n → ℤ) (hz : ∑ i, z i = 0) (q0 : Fin n) : (fun j => ∑ i ∈ Finset.univ.erase q0, (z i : ℝ) * ((if j = i then (1:ℝ) else 0) - (if j = q0 then (1:ℝ) else 0))) = fun j => (z j : ℝ)real_hunger_finset_shift_coalescenceIn LeanCombinatorial Games
Assume coalescence for every elementary shift. Then for any finite set S of indices, any multiplicities c : S → ℕ and any choice of distinct directions (pp i, qq i) for i in S, the trajectories from h and h + (∑_{i∈S} c i * (e_{pp i} - e_{qq i})) * (P - I) coalesce.
theorem real_hunger_finset_shift_coalescence {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ) (hP : P ∈ Matrix.rowStochastic ℝ (Fin n)) (helem : ∀ (x : Fin n → ℝ), (∑ i, x i = 0) → ∀ p q : Fin n, p ≠ q → ∃ t, hunger_iter P t x = hunger_iter P t (x + Matrix.vecMul (fun j => ((if j = p then (1:ℝ) else 0) - (if j = q then 1 else 0))) (P - 1))) (h : Fin n → ℝ) (h_sum : ∑ i, h i = 0) : ∀ (S : Finset (Fin n)) (c : Fin n → ℕ) (pp qq : Fin n → Fin n), (∀ i ∈ S, pp i ≠ qq i) → ∃ t, hunger_iter P t h = hunger_iter P t (h + Matrix.vecMul (fun j => ∑ i ∈ S, (c i : ℝ) * ((if j = pp i then (1:ℝ) else 0) - (if j = qq i then 1 else 0))) (P - 1))real_hunger_iter_succIn LeanCombinatorial Games
For an n-by-n real matrix P and any vector h, the (t+1)-th hunger iterate equals hunger_step P applied to the t-th iterate.
theorem real_hunger_iter_succ (n : ℕ) [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ) (t : ℕ) (h : Fin n → ℝ) : hunger_iter P (t + 1) h = hunger_step P (hunger_iter P t h)
real_hunger_iter_sum_invariantIn LeanCombinatorial Games
For any row-stochastic real matrix P, time t, and vector h, the coordinate sum of hunger_iter P t h equals that of h.
theorem real_hunger_iter_sum_invariant (n : ℕ) [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ) (hP : P ∈ Matrix.rowStochastic ℝ (Fin n)) (t : ℕ) (h : Fin n → ℝ) : ∑ j, hunger_iter P t h j = ∑ j, h j
real_hunger_multiple_shift_coalescenceIn LeanCombinatorial Games
Assume coalescence for every elementary shift e_p - e_q. Then for any c ≥ 1, the trajectories from h and h + c*(e_p - e_q)*(P - I) coalesce.
theorem real_hunger_multiple_shift_coalescence {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ) (hP : P ∈ Matrix.rowStochastic ℝ (Fin n)) (helem : ∀ (x : Fin n → ℝ), (∑ i, x i = 0) → ∀ p q : Fin n, p ≠ q → ∃ t, hunger_iter P t x = hunger_iter P t (x + Matrix.vecMul (fun j => ((if j = p then (1:ℝ) else 0) - (if j = q then 1 else 0))) (P - 1))) (h : Fin n → ℝ) (h_sum : ∑ i, h i = 0) (p q : Fin n) (hpq : p ≠ q) : ∀ c : ℕ, ∃ t, hunger_iter P t h = hunger_iter P t (h + Matrix.vecMul (fun j => (c : ℝ) * ((if j = p then (1:ℝ) else 0) - (if j = q then 1 else 0))) (P - 1))real_hunger_step_eq_add_rowIn LeanCombinatorial Games
For a real matrix P and vector h, one hunger step equals h plus the row of P - I selected by the firing state: hunger_step P h = h + fun j => (P - 1) (hunger_firing_state h) j.
theorem real_hunger_step_eq_add_row {n : ℕ} [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ) (h : Fin n → ℝ) : hunger_step P h = h + fun j => (P - 1) (hunger_firing_state h) jreal_hunger_step_sum_invariantIn LeanCombinatorial Games
For any row-stochastic real matrix P and vector h, the sum of coordinates of hunger_step P h equals the sum of coordinates of h.
theorem real_hunger_step_sum_invariant (n : ℕ) [NeZero n] (P : Matrix (Fin n) (Fin n) ℝ) (hP : P ∈ Matrix.rowStochastic ℝ (Fin n)) (h : Fin n → ℝ) : ∑ j, hunger_step P h j = ∑ j, h j
run_grundy_eq_run_valIn LeanCombinatorial Games
In the Game of Arrows, the Grundy value of a run of length k with boundary conditions α and β matches the closed-form valuation run_val k α β for all k ≥ 0.
theorem run_grundy_eq_run_val (k : ℕ) (α β : RunBoundary) :
run_grundy k α β = run_val k α βrun_grundy_one_blocked_endIn LeanCombinatorial Games
In the Game of Arrows, for all k ≥ 0, a run of length k with one free end and one end blocked inward has Grundy value k, and is therefore equivalent to a nim heap of size k.
theorem run_grundy_one_blocked_end (k : ℕ) :
run_grundy k RunBoundary.free RunBoundary.blocked_in = krun_grundy_valuesIn LeanCombinatorial Games
In the Game of Arrows, for all k ≥ 0, the Grundy values of runs satisfy: a run with both ends free has Grundy value k mod 2, a run with both ends blocked inward has Grundy value k mod 2, a run with one end free and one end blocked inward has Grundy value k, and a run with one end blocked inward and the other blocked outward has Grundy value 1 if k ≥ 2 is even and 0 otherwise.
theorem run_grundy_values (k : ℕ) :
run_grundy k RunBoundary.free RunBoundary.free = k % 2 ∧
run_grundy k RunBoundary.blocked_in RunBoundary.blocked_in = k % 2 ∧
run_grundy k RunBoundary.free RunBoundary.blocked_in = k ∧
run_grundy k RunBoundary.blocked_in RunBoundary.blocked_out =
if k ≥ 2 ∧ Even k then 1 else 0run_options_val_memIn LeanCombinatorial Games
A natural number x occurs in the option-value list of a run of length k with boundaries α and β iff x is the nim-sum of the two sub-run values produced by some legal move, i.e. iff there are an edge j with 1 ≤ j ≤ k and a direction δ ∉ {free} such that the move is legal and x = run_val (j-1) α δ ⊕ run_val (k-j) δ β.
theorem run_options_val_mem (k : ℕ) (α β : RunBoundary) (x : ℕ) :
x ∈ run_options_val k α β ↔
∃ (j : ℕ) (δ : RunBoundary), 1 ≤ j ∧ j ≤ k ∧ δ ≠ RunBoundary.free ∧
run_move_legal k α β j δ = true ∧
x = run_val (j - 1) α δ ^^^ run_val (k - j) δ βrun_val_eq_mex_optionsIn LeanCombinatorial Games
For any k > 0 and boundary conditions α and β, the mex of the list of option values computed under run_val equals run_val k α β.
theorem run_val_eq_mex_options (k : ℕ) (hk : 0 < k) (α β : RunBoundary) :
run_val k α β = nat_mex_list (run_options_val k α β)run_val_mex_both_blocked_oppositeIn LeanCombinatorial Games
For k ≥ 1 and boundary conditions α ≠ β with neither end free (so the pair is (blocked_in, blocked_out) or (blocked_out, blocked_in)), the mex of the option-value list is 1 if k ≥ 2 is even and 0 otherwise.
theorem run_val_mex_both_blocked_opposite (k : ℕ) (hk : 1 ≤ k) (α β : RunBoundary) (hne : α ≠ β)
(hα : α ≠ RunBoundary.free) (hβ : β ≠ RunBoundary.free) :
nat_mex_list (run_options_val k α β) = if k ≥ 2 ∧ Even k then 1 else 0run_val_mex_equal_endsIn LeanCombinatorial Games
For k ≥ 1 and any boundary condition α, the mex of the option-value list of the run of length k with both ends α (same condition at both ends) is k mod 2.
theorem run_val_mex_equal_ends (k : ℕ) (hk : 1 ≤ k) (α : RunBoundary) :
nat_mex_list (run_options_val k α α) = k % 2run_val_mex_one_free_endIn LeanCombinatorial Games
For k ≥ 1, boundary conditions α ≠ β with at least one end free, the mex of the option-value list of the run of length k is k.
theorem run_val_mex_one_free_end (k : ℕ) (hk : 1 ≤ k) (α β : RunBoundary) (hne : α ≠ β)
(hfree : α = RunBoundary.free ∨ β = RunBoundary.free) :
nat_mex_list (run_options_val k α β) = ksages_circle_pair_protocol_solvesIn LeanCombinatorial Games
For S ≥ 3 sages in a circle, there exists a protocol taking local views to 2-element subsets of Fin S that solves the anonymous-slip circle puzzle.
theorem sages_circle_pair_protocol_solves (S : ℕ) (hS : 3 ≤ S) :
∃ p : CircleLocalView (Fin S) → {s : Finset (Fin S) // s.card = 2},
CircleProtocolSolves S hS psages_circle_upper_bound_binomialIn LeanCombinatorial Games
For every natural number S and hypothesis hS : 3 ≤ S, the anonymous-slip puzzle for S sages in a circle with unlabeled seats can be solved using Nat.choose S 2 symbols, that is, CircleProblemSolvable S (Nat.choose S 2) hS.
theorem sages_circle_upper_bound_binomial (S : ℕ) (hS : 3 ≤ S) :
CircleProblemSolvable S (Nat.choose S 2) hSsages_row_chain_injIn LeanCombinatorial Games
If two row seatings of S ≥ 3 sages have the same set of adjacent pairs and the same sage at the right end, then they are the same seating.
theorem sages_row_chain_inj {S : ℕ} (hS : 3 ≤ S) (π₁ π₂ : Equiv.Perm (Fin S))
(hset : sages_row_edge_set π₁ = sages_row_edge_set π₂)
(hlastv : π₁ ⟨S - 1, by omega⟩ = π₂ ⟨S - 1, by omega⟩) :
π₁ = π₂sages_row_chain_stepIn LeanCombinatorial Games
Let two row seatings of S ≥ 3 sages have the same set of adjacent pairs. If the sages in position S-1-k coincide in the two seatings (for k+1 ≤ S-1), then the sages in position S-2-k coincide as well.
theorem sages_row_chain_step {S : ℕ} (hS : 3 ≤ S) (π₁ π₂ : Equiv.Perm (Fin S))
(hset : sages_row_edge_set π₁ = sages_row_edge_set π₂) (k : ℕ) (hk : k + 1 ≤ S - 1)
(hmatch : π₁ ⟨S - 1 - k, by omega⟩ = π₂ ⟨S - 1 - k, by omega⟩) :
π₁ ⟨S - 1 - (k + 1), by omega⟩ = π₂ ⟨S - 1 - (k + 1), by omega⟩sages_row_edge_at_vertexIn LeanCombinatorial Games
If an adjacent pair of the seating π contains the sage at position i, then that pair is either the pair with the sage at position i+1 (when i is not the last position) or the pair with the sage at position i-1 (when i is not the first position).
theorem sages_row_edge_at_vertex {S : ℕ} (π : Equiv.Perm (Fin S)) (i : Fin S)
{s : Finset (Fin S)} (hs : s ∈ sages_row_edge_set π) (hi : π i ∈ s) :
(∃ h : i.val + 1 < S, s = ({π i, π ⟨i.val + 1, h⟩} : Finset (Fin S))) ∨
(i.val ≠ 0 ∧ s = ({π ⟨i.val - 1, by omega⟩, π i} : Finset (Fin S)))sages_row_edge_degreeIn LeanCombinatorial Games
In a row seating π of S sages, the number of adjacent pairs containing the sage in position i is 1 if i is the first or last position, and 2 otherwise.
theorem sages_row_edge_degree {S : ℕ} (hS : 2 ≤ S) (π : Equiv.Perm (Fin S)) (i : Fin S) :
((sages_row_edge_set π).filter (fun s => π i ∈ s)).card =
(if i.val + 1 = S then 1 else if i.val = 0 then 1 else 2)sages_row_last_edge_alignsIn LeanCombinatorial Games
If two row seatings of S ≥ 3 sages have the same set of adjacent pairs and their rightmost adjacent pairs are equal as 2-element sets of sages, then the rightmost sage is the same in both seatings.
theorem sages_row_last_edge_aligns {S : ℕ} (hS : 3 ≤ S) (π₁ π₂ : Equiv.Perm (Fin S))
(hset : sages_row_edge_set π₁ = sages_row_edge_set π₂)
(hlast : ({π₁ ⟨S - 2, by omega⟩, π₁ ⟨S - 1, by omega⟩} : Finset (Fin S))
= ({π₂ ⟨S - 2, by omega⟩, π₂ ⟨S - 1, by omega⟩} : Finset (Fin S))) :
π₁ ⟨S - 1, by omega⟩ = π₂ ⟨S - 1, by omega⟩sages_row_pair_multiset_countIn LeanCombinatorial Games
For a row seating π: a 2-element set occurs in the announced multiset if and only if it is an adjacent pair of the row; the last adjacent pair {π(S-2), π(S-1)} occurs exactly twice; and any pair occurring at least twice is that last pair.
theorem sages_row_pair_multiset_count {S : ℕ} (hS : 2 ≤ S) (π : Equiv.Perm (Fin S)) :
(∀ s : Finset (Fin S),
s ∈ (rowMultiset hS (sages_row_pair_protocol hS) π).map (fun t => t.val) ↔
s ∈ sages_row_edge_set π) ∧
Multiset.count ({π ⟨S - 2, by omega⟩, π ⟨S - 1, by omega⟩} : Finset (Fin S))
((rowMultiset hS (sages_row_pair_protocol hS) π).map (fun t => t.val)) = 2 ∧
(∀ s : Finset (Fin S),
2 ≤ Multiset.count s ((rowMultiset hS (sages_row_pair_protocol hS) π).map (fun t => t.val)) →
s = ({π ⟨S - 2, by omega⟩, π ⟨S - 1, by omega⟩} : Finset (Fin S)))sages_row_pair_multiset_eqIn LeanCombinatorial Games
For a row seating π, the multiset of announced pairs is the multiset of the S-1 adjacent pairs, except that the last pair {π(S-2), π(S-1)} occurs twice.
theorem sages_row_pair_multiset_eq {S : ℕ} (hS : 2 ≤ S) (π : Equiv.Perm (Fin S)) :
(rowMultiset hS (sages_row_pair_protocol hS) π).map (fun s => s.val) =
Multiset.map (fun i : {i : Fin S // i.val + 1 < S} =>
({π i.1, π ⟨i.1.val + 1, i.2⟩} : Finset (Fin S)))
(Finset.univ : Finset {i : Fin S // i.val + 1 < S}).val
+ ({({π ⟨S - 2, by omega⟩, π ⟨S - 1, by omega⟩} : Finset (Fin S))} : Multiset (Finset (Fin S)))sages_row_pair_protocol_eval_lastIn LeanCombinatorial Games
The sage in the last position of the row, having no right neighbour, announces the pair of themselves and their left neighbour.
theorem sages_row_pair_protocol_eval_last {S : ℕ} (hS : 2 ≤ S) (π : Equiv.Perm (Fin S)) (i : Fin S)
(h : i.val + 1 = S) :
(sages_row_pair_protocol hS (rowView hS π i)).val
= ({π ⟨i.val - 1, by omega⟩, π i} : Finset (Fin S))sages_row_pair_protocol_eval_succIn LeanCombinatorial Games
A sage in position i of the row who has a right neighbour announces the pair of themselves and the sage in position i+1.
theorem sages_row_pair_protocol_eval_succ {S : ℕ} (hS : 2 ≤ S) (π : Equiv.Perm (Fin S)) (i : Fin S)
(h : i.val + 1 < S) :
(sages_row_pair_protocol hS (rowView hS π i)).val
= ({π i, π ⟨i.val + 1, h⟩} : Finset (Fin S))sages_row_pair_protocol_solvesIn LeanCombinatorial Games
For S ≥ 3, the protocol in which each sage announces the 2-element set of themselves and their right neighbour (the rightmost sage using their left neighbour) solves the anonymous-slip puzzle for S sages in a row with unlabeled seats.
theorem sages_row_pair_protocol_solves (S : ℕ) (hS : 3 ≤ S) :
RowProtocolSolves S (by omega) (sages_row_pair_protocol (S := S) (by omega))sages_row_two_element_subsets_cardIn LeanCombinatorial Games
The number of 2-element subsets of Fin S is Nat.choose S 2.
theorem sages_row_two_element_subsets_card (S : ℕ) : Fintype.card {s : Finset (Fin S) // s.card = 2} = Nat.choose S 2sages_universal_upper_bound_binomialIn LeanCombinatorial Games
For every natural number S and hypothesis hS : 3 ≤ S, both the row problem RowProblemSolvable S (Nat.choose S 2) (by omega) and the circle problem CircleProblemSolvable S (Nat.choose S 2) hS hold in the anonymous-slip puzzle with unlabeled seats.
theorem sages_universal_upper_bound_binomial (S : ℕ) (hS : 3 ≤ S) :
RowProblemSolvable S (Nat.choose S 2) (by omega) ∧
CircleProblemSolvable S (Nat.choose S 2) hSseeded_subtraction_cycle_coverIn LeanCombinatorial Games
Let c be a cyclic 0/1 word on Z/p with c n = ¬c(n-a) ∨ ¬c(n-2a) ∨ ¬c(n-2a-1). Then every n with c n = true has c(n-a) = false or c(n-2a) = false or c(n-2a-1) = false.
theorem seeded_subtraction_cycle_cover (a p : ℕ) (c : ZMod p → Bool)
(hrec : ∀ n : ZMod p, c n = (!c (n - a) || !c (n - 2 * a) || !c (n - (2 * a + 1)))) :
∀ n : ZMod p, c n = true → c (n - a) = false ∨ c (n - 2 * a) = false ∨ c (n - (2 * a + 1)) = falseseeded_subtraction_cycle_period_dvdIn LeanCombinatorial Games
For a ≥ 1, p > 0 and a cyclic word c : Z/p → {0,1} satisfying c n = ¬c(n-a) ∨ ¬c(n-2a) ∨ ¬c(n-2a-1) for all n, there is a positive period q of c (c(n+q) = c n for all n) dividing 3a or 3a+1.
theorem seeded_subtraction_cycle_period_dvd (a p : ℕ) (ha : 1 ≤ a) (hp : 0 < p) (c : ZMod p → Bool)
(hrec : ∀ n : ZMod p, c n = (!c (n - a) || !c (n - 2 * a) || !c (n - (2 * a + 1)))) :
∃ q : ℕ, 0 < q ∧ (∀ n : ZMod p, c (n + q) = c n) ∧ (q ∣ 3 * a ∨ q ∣ 3 * a + 1)seeded_subtraction_cycle_zeros_avoidIn LeanCombinatorial Games
Let c be a cyclic 0/1 word on Z/p satisfying c n = ¬c(n-a) ∨ ¬c(n-2a) ∨ ¬c(n-2a-1). Then the zero set Z is disjoint from its translates Z+a, Z+2a and Z+(2a+1): if c n = false then c(n+a) = c(n+2a) = c(n+2a+1) = true.
theorem seeded_subtraction_cycle_zeros_avoid (a p : ℕ) (c : ZMod p → Bool)
(hrec : ∀ n : ZMod p, c n = (!c (n - a) || !c (n - 2 * a) || !c (n - (2 * a + 1)))) :
∀ n : ZMod p, c n = false → c (n + a) = true ∧ c (n + 2 * a) = true ∧ c (n + (2 * a + 1)) = trueseeded_subtraction_eventual_period_tail_cycleIn LeanCombinatorial Games
If w is eventually periodic with period p > 0 from index N on, and w obeys the subtraction recursion for n ≥ 2a+1, then there is a threshold m and a cyclic word c : ZMod p → Bool obeying the same recursion on Z/p, with w n = c(n mod p) for all n ≥ m.
theorem seeded_subtraction_eventual_period_tail_cycle (a p N : ℕ) (ha : 1 ≤ a) (hp : 0 < p) (w : ℕ → Bool)
(hrec : ∀ n, 2 * a + 1 ≤ n → w n = (!w (n - a) || !w (n - 2 * a) || !w (n - (2 * a + 1))))
(hper : ∀ n, N ≤ n → w (n + p) = w n) :
∃ m : ℕ, ∃ c : ZMod p → Bool,
(∀ n : ZMod p, c n = (!c (n - a) || !c (n - 2 * a) || !c (n - (2 * a + 1)))) ∧
(∀ n, m ≤ n → w n = c ((n : ℕ) : ZMod p))seeded_subtraction_least_period_dividesIn LeanCombinatorial Games
For any binary seed of length 2a+1 and any integer a ≥ 1, the least eventual period of the generated subtraction sequence divides 3a or divides 3a + 1.
theorem seeded_subtraction_least_period_divides (a : ℕ) (ha : 1 ≤ a)
(seed : Fin (2 * a + 1) → Bool) :
least_eventual_period (seeded_subtraction_seq a seed) ∣ 3 * a ∨
least_eventual_period (seeded_subtraction_seq a seed) ∣ 3 * a + 1seeded_subtraction_least_period_leIn LeanCombinatorial Games
For every a ≥ 1 and every binary seed of length 2a+1, the least eventual period of the generated subtraction sequence is at most 3a+1.
theorem seeded_subtraction_least_period_le (a : ℕ) (ha : 1 ≤ a) (seed : Fin (2 * a + 1) → Bool) : least_eventual_period (seeded_subtraction_seq a seed) ≤ 3 * a + 1
seeded_subtraction_seq_stepIn LeanCombinatorial Games
For n ≥ 2a + 1 and a ≥ 1, the seeded subtraction sequence satisfies the recurrence w_n = ¬w_{n-a} ∨ ¬w_{n-2a} ∨ ¬w_{n-(2a+1)}.
theorem seeded_subtraction_seq_step (a : ℕ) (seed : Fin (2 * a + 1) → Bool) (n : ℕ)
(hn : 2 * a + 1 ≤ n) (ha : 1 ≤ a) :
seeded_subtraction_seq a seed n =
(!seeded_subtraction_seq a seed (n - a) ||
!seeded_subtraction_seq a seed (n - 2 * a) ||
!seeded_subtraction_seq a seed (n - (2 * a + 1)))seeded_subtraction_zero_seed_formulaIn LeanCombinatorial Games
For the all-zero seed, the sequence is identically false for n < 2a+1, and for n ≥ 2a+1 alternates between 2a+1 ones and a zeros with period 3a+1.
theorem seeded_subtraction_zero_seed_formula (a : ℕ) (ha : 1 ≤ a) (n : ℕ) :
seeded_subtraction_seq a (fun _ => false) n =
if n < 2 * a + 1 then false
else decide ((n - (2 * a + 1)) % (3 * a + 1) < 2 * a + 1)slow_exact_nim_followers_eq_empty_of_pos_card_ltIn LeanCombinatorial Games
If the number of positive piles of x is strictly less than k, then slow_exact_nim_followers k n x = ∅.
theorem slow_exact_nim_followers_eq_empty_of_pos_card_lt (k n : ℕ) (x : Fin n → ℕ)
(h : (Finset.filter (fun i => 0 < x i) Finset.univ).card < k) :
slow_exact_nim_followers k n x = ∅slow_exact_nim_grundy_comp_eq_of_geIn LeanCombinatorial Games
For natural numbers k and n, any position x on n piles, and any fuel at least the sum of piles of x, the fuel-bounded Sprague-Grundy value slow_exact_nim_grundy_comp k n fuel x equals slow_exact_nim_grundy k n x.
theorem slow_exact_nim_grundy_comp_eq_of_ge (k n : ℕ) (fuel : ℕ) (x : Fin n → ℕ)
(hfuel : ∑ i, x i ≤ fuel) :
slow_exact_nim_grundy_comp k n fuel x = slow_exact_nim_grundy k n xslow_exact_nim_grundy_comp_eq_zero_of_followers_emptyIn LeanCombinatorial Games
If slow_exact_nim_followers k n x = ∅, then slow_exact_nim_grundy_comp k n fuel x = 0 for any fuel.
theorem slow_exact_nim_grundy_comp_eq_zero_of_followers_empty (k n : ℕ) (fuel : ℕ) (x : Fin n → ℕ)
(h : slow_exact_nim_followers k n x = ∅) :
slow_exact_nim_grundy_comp k n fuel x = 0slow_exact_nim_grundy_comp_witness_twoIn LeanCombinatorial Games
For k ≥ 2 and fuel ≥ 2, slow_exact_nim_grundy_comp k (k+1) fuel (slow_exact_nim_witness_two k) = 2.
theorem slow_exact_nim_grundy_comp_witness_two (k : ℕ) (hk : 2 ≤ k) (fuel : ℕ) (hfuel : 2 ≤ fuel) :
slow_exact_nim_grundy_comp k (k + 1) fuel (slow_exact_nim_witness_two k) = 2slow_exact_nim_grundy_eq_finset_mex_followersIn LeanCombinatorial Games
In slow exact k-Nim on n piles with k ≥ 1, the Sprague-Grundy value of any position x equals the mex of the set of Sprague-Grundy values of its legal followers.
theorem slow_exact_nim_grundy_eq_finset_mex_followers (k n : ℕ) (hk : 1 ≤ k) (x : Fin n → ℕ) :
slow_exact_nim_grundy k n x =
finset_mex ((slow_exact_nim_followers k n x).image (slow_exact_nim_grundy k n))slow_exact_nim_grundy_witness_threeIn LeanCombinatorial Games
For k ≥ 2, slow_exact_nim_grundy k (k+1) (slow_exact_nim_witness_three k) = 3.
theorem slow_exact_nim_grundy_witness_three (k : ℕ) (hk : 2 ≤ k) :
slow_exact_nim_grundy k (k + 1) (slow_exact_nim_witness_three k) = 3slow_exact_nim_grundy_witness_twoIn LeanCombinatorial Games
For k ≥ 2, slow_exact_nim_grundy k (k+1) (slow_exact_nim_witness_two k) = 2.
theorem slow_exact_nim_grundy_witness_two (k : ℕ) (hk : 2 ≤ k) :
slow_exact_nim_grundy k (k + 1) (slow_exact_nim_witness_two k) = 2slow_exact_nim_grundy_witnessesIn LeanCombinatorial Games
For every integer k ≥ 2, the positions (0, ..., 0), (1, ..., 1), slow_exact_nim_witness_two k, and slow_exact_nim_witness_three k have Sprague-Grundy values 0, 1, 2, and 3 respectively in slow exact k-Nim on k+1 piles.
theorem slow_exact_nim_grundy_witnesses (k : ℕ) (hk : 2 ≤ k) :
slow_exact_nim_grundy k (k + 1) (fun _ => 0) = 0 ∧
slow_exact_nim_grundy k (k + 1) (fun _ => 1) = 1 ∧
slow_exact_nim_grundy k (k + 1) (slow_exact_nim_witness_two k) = 2 ∧
slow_exact_nim_grundy k (k + 1) (slow_exact_nim_witness_three k) = 3slow_exact_nim_grundy_zero_onesIn LeanCombinatorial Games
For k ≥ 2, slow_exact_nim_grundy k (k+1) (fun _ => 0) = 0 and slow_exact_nim_grundy k (k+1) (fun _ => 1) = 1.
theorem slow_exact_nim_grundy_zero_ones (k : ℕ) (hk : 2 ≤ k) :
slow_exact_nim_grundy k (k + 1) (fun _ => 0) = 0 ∧
slow_exact_nim_grundy k (k + 1) (fun _ => 1) = 1spider_blocked_free_leg_opts_eqIn LeanCombinatorial Games
The option contribution of the free leg (1,free) in (in;{(r,β),(1,free)}) evaluates to the two-element list [spider_rho r outward β, spider_rho_star r β], because ρ(0;δ,free) = 0 and the one-leg sub-states are given by the singleton lemma.
theorem spider_blocked_free_leg_opts_eq (r : ℕ) (beta : SpiderLegEnd) :
spider_blocked_free_leg_opts r beta
= [spider_rho r SpiderLegEnd.outward beta, spider_rho_star r beta]spider_blocked_incoming_one_inwardIn LeanCombinatorial Games
For the configuration κ = (in;{(1,inward)}), the blocked family V^φ_κ(r) of Table 6 is r mod 2 when φ = inward and 1 - r mod 2 when φ = outward, for every r ≥ 1.
theorem spider_blocked_incoming_one_inward (r : ℕ) (hr : 1 ≤ r) (φ : SpiderLegEnd) (hφ : φ ≠ SpiderLegEnd.free) :
spider_gamma (r + 2) CentreStatus.incoming [(1, SpiderLegEnd.inward), (r, φ)] =
if φ = SpiderLegEnd.inward then r % 2 else 1 - r % 2spider_blocked_incoming_one_inward_options_all_eqIn LeanCombinatorial Games
Every option generated by the two-legged spider state [(1, inward), (r, φ)] at fuel r + 2 with centre status incoming equals the bit (if φ = inward then 1 - r % 2 else r % 2), assuming the induction hypothesis for r' < r.
theorem spider_blocked_incoming_one_inward_options_all_eq (r : ℕ) (hr : 1 ≤ r) (φ : SpiderLegEnd) (hφ : φ ≠ SpiderLegEnd.free)
(ih : ∀ r' < r, 1 ≤ r' → ∀ φ' ≠ SpiderLegEnd.free, spider_gamma (r' + 2) CentreStatus.incoming [(1, SpiderLegEnd.inward), (r', φ')] = (if φ' = SpiderLegEnd.inward then r' % 2 else 1 - r' % 2))
(x : ℕ) (hx : x ∈ ([(1, SpiderLegEnd.inward), (r, φ)].zipIdx.flatMap (fun ⟨⟨h, phi⟩, idx⟩ =>
let rest := [(1, SpiderLegEnd.inward), (r, φ)].eraseIdx idx
(List.range h).flatMap (fun j_zero =>
let j := j_zero + 1
[SpiderLegEnd.inward, SpiderLegEnd.outward].filterMap (fun delta =>
if j == h ∧ phi ≠ SpiderLegEnd.free ∧ delta ≠ phi then none
else
let d := spider_rho (h - j) delta phi
if j ≥ 2 then
let new_L := (j - 1, delta) :: rest
some (d ^^^ spider_gamma (r + 1) CentreStatus.incoming new_L)
else
let new_s := spider_update_centre CentreStatus.incoming delta
some (d ^^^ spider_gamma (r + 1) new_s rest)
)
)
))) :
x = if φ = SpiderLegEnd.inward then 1 - r % 2 else r % 2spider_blocked_leg0_opts_eqIn LeanCombinatorial Games
For r ≥ 2, β ≠ free, assuming the closed form at all smaller leg lengths, the options generated by cuts of the blocked leg (r,β) in (in;{(r,β),(1,free)}) evaluate to the range-block of spider_blocked_optionvals followed by the single end-cut term ρ(0;β,β) xor spider_blocked_val β (r-1).
theorem spider_blocked_leg0_opts_eq (r : ℕ) (hr : 2 ≤ r) (beta : SpiderLegEnd)
(hβ : beta ≠ SpiderLegEnd.free)
(ih : ∀ r' < r, 1 ≤ r' → ∀ β' ≠ SpiderLegEnd.free,
spider_gamma (r' + 2) CentreStatus.incoming [(r', β'), (1, SpiderLegEnd.free)]
= spider_blocked_val β' r') :
spider_blocked_leg0_opts r beta
= (List.range (r - 1)).flatMap (fun idx =>
let j := idx + 1
[SpiderLegEnd.inward, SpiderLegEnd.outward].map
(fun delta => spider_rho (r - j) delta beta ^^^ spider_blocked_val delta (j - 1)))
++ [spider_rho 0 beta beta ^^^ spider_blocked_val beta (r - 1)]spider_blocked_none_one_inward_one_inwardIn LeanCombinatorial Games
For the configuration κ = (none;{(1,inward),(1,inward)}), the blocked family V^φ_κ(r) of Table 6 equals 1 - r mod 2 when φ = inward and r mod 2 when φ = outward, for every r ≥ 1.
theorem spider_blocked_none_one_inward_one_inward (r : ℕ) (hr : 1 ≤ r) (φ : SpiderLegEnd) (hφ : φ ≠ SpiderLegEnd.free) :
spider_gamma (r + 3) CentreStatus.none [(1, SpiderLegEnd.inward), (1, SpiderLegEnd.inward), (r, φ)] =
if φ = SpiderLegEnd.inward then 1 - r % 2 else r % 2spider_blocked_none_one_outward_one_outwardIn LeanCombinatorial Games
For the configuration κ = (none;{(1,outward),(1,outward)}), the blocked family V^φ_κ(r) of Table 6 equals r mod 2 when φ = inward and 1 - r mod 2 when φ = outward, for every r ≥ 1.
theorem spider_blocked_none_one_outward_one_outward (r : ℕ) (hr : 1 ≤ r) (φ : SpiderLegEnd) (hφ : φ ≠ SpiderLegEnd.free) :
spider_gamma (r + 3) CentreStatus.none [(1, SpiderLegEnd.outward), (1, SpiderLegEnd.outward), (r, φ)] =
if φ = SpiderLegEnd.inward then r % 2 else 1 - r % 2spider_blocked_options_closed_formIn LeanCombinatorial Games
For r ≥ 2 and β ≠ free, assuming the closed form at all smaller leg lengths, spider_gamma (r+2) incoming [(r,β),(1,free)] equals nat_mex_list (spider_blocked_optionvals r β).
theorem spider_blocked_options_closed_form (r : ℕ) (hr : 2 ≤ r) (beta : SpiderLegEnd)
(hβ : beta ≠ SpiderLegEnd.free)
(ih : ∀ r' < r, 1 ≤ r' → ∀ β' ≠ SpiderLegEnd.free,
spider_gamma (r' + 2) CentreStatus.incoming [(r', β'), (1, SpiderLegEnd.free)]
= spider_blocked_val β' r') :
spider_gamma (r + 2) CentreStatus.incoming [(r, beta), (1, SpiderLegEnd.free)]
= nat_mex_list (spider_blocked_optionvals r beta)spider_blocked_raw_mex_eqIn LeanCombinatorial Games
The Grundy value of the state (in;{(r,β),(1,free)}) at fuel r+2 equals the mex of the raw option list spider_blocked_raw_opts r β.
theorem spider_blocked_raw_mex_eq (r : ℕ) (beta : SpiderLegEnd) :
spider_gamma (r + 2) CentreStatus.incoming [(r, beta), (1, SpiderLegEnd.free)]
= nat_mex_list (spider_blocked_raw_opts r beta)spider_blocked_raw_opts_eqIn LeanCombinatorial Games
For r ≥ 2 and β ≠ free, assuming the closed form at all smaller leg lengths, the raw option list of the state (in;{(r,β),(1,free)}) at fuel r+2 is literally the list spider_blocked_optionvals r β (list equality, not mere membership).
theorem spider_blocked_raw_opts_eq (r : ℕ) (hr : 2 ≤ r) (beta : SpiderLegEnd)
(hβ : beta ≠ SpiderLegEnd.free)
(ih : ∀ r' < r, 1 ≤ r' → ∀ β' ≠ SpiderLegEnd.free,
spider_gamma (r' + 2) CentreStatus.incoming [(r', β'), (1, SpiderLegEnd.free)]
= spider_blocked_val β' r') :
spider_blocked_raw_opts r beta = spider_blocked_optionvals r betaspider_blocked_type_p_none_boundedIn LeanCombinatorial Games
For each of the twelve reachable configurations κ = (none;K) whose two attached legs K are listed (the type-P configurations with free centre of the paper's Table 6), every blocked family V^φ_κ(r) with φ ≠ free and r ≥ 1 has value at most 7.
theorem spider_blocked_type_p_none_bounded (r : ℕ) (hr : 1 ≤ r) (φ : SpiderLegEnd) (hφ : φ ≠ SpiderLegEnd.free)
(K : List (ℕ × SpiderLegEnd))
(hK : K = [(2, SpiderLegEnd.free), (1, SpiderLegEnd.inward)] ∨
K = [(2, SpiderLegEnd.free), (1, SpiderLegEnd.outward)] ∨
K = [(2, SpiderLegEnd.free), (2, SpiderLegEnd.inward)] ∨
K = [(2, SpiderLegEnd.free), (2, SpiderLegEnd.outward)] ∨
K = [(1, SpiderLegEnd.inward), (3, SpiderLegEnd.free)] ∨
K = [(1, SpiderLegEnd.outward), (3, SpiderLegEnd.free)] ∨
K = [(1, SpiderLegEnd.inward), (1, SpiderLegEnd.inward)] ∨
K = [(1, SpiderLegEnd.outward), (1, SpiderLegEnd.outward)] ∨
K = [(1, SpiderLegEnd.inward), (2, SpiderLegEnd.inward)] ∨
K = [(1, SpiderLegEnd.inward), (2, SpiderLegEnd.outward)] ∨
K = [(1, SpiderLegEnd.outward), (2, SpiderLegEnd.inward)] ∨
K = [(1, SpiderLegEnd.outward), (2, SpiderLegEnd.outward)]) :
spider_gamma ((K.map Prod.fst).sum + r + 1) CentreStatus.none (K ++ [(r, φ)]) ≤ 7spider_blocked_val_zeroIn LeanCombinatorial Games
For δ = inward or outward, the closed form spider_blocked_val δ 0 equals 1.
theorem spider_blocked_val_zero (delta : SpiderLegEnd) (h : delta ≠ SpiderLegEnd.free) :
spider_blocked_val delta 0 = 1spider_eventual_parity_two_three_option_analysisIn LeanCombinatorial Games
For z ≥ 14 the main state's option set meets {0,1} exactly as the parity decision requires: if z is even, neither 0 nor 1 is an option and the mex is 0; if z is odd, 0 is an option and 1 is not, so the mex is 1.
theorem spider_eventual_parity_two_three_option_analysis (z : ℕ) (hz : 14 ≤ z) :
(z % 2 = 0 →
spider_gamma (z + 6) CentreStatus.none
[(2, SpiderLegEnd.free), (3, SpiderLegEnd.free), (z, SpiderLegEnd.free)] = 0) ∧
(z % 2 = 1 →
spider_gamma (z + 6) CentreStatus.none
[(2, SpiderLegEnd.free), (3, SpiderLegEnd.free), (z, SpiderLegEnd.free)] = 1)spider_free_family_bounds_fourIn LeanCombinatorial Games
For every level h ≥ 14, the free families V^*_{(i;{2^*})}(h) and V^*_{(o;{2^*})}(h) are at least 4; in particular they are not 2 and not 3.
theorem spider_free_family_bounds_four (h : ℕ) (hh : 14 ≤ h) :
spider_gamma (h + 3) CentreStatus.incoming [(2, SpiderLegEnd.free), (h, SpiderLegEnd.free)] ≥ 4 ∧
spider_gamma (h + 3) CentreStatus.outgoing [(2, SpiderLegEnd.free), (h, SpiderLegEnd.free)] ≥ 4spider_free_family_bounds_twoIn LeanCombinatorial Games
For every level h ≥ 14, the free families V^*_σ(h) for σ = (i;{3^*}), (o;{3^*}), (n;{1^in,3^*}), (n;{1^out,3^*}), (n;{1^in,2^*}), (n;{1^out,2^*}), (n;{2^in,2^*}), (n;{2^out,2^*}) are all at least 2.
theorem spider_free_family_bounds_two (h : ℕ) (hh : 14 ≤ h) :
spider_gamma (h + 4) CentreStatus.incoming [(3, SpiderLegEnd.free), (h, SpiderLegEnd.free)] ≥ 2 ∧
spider_gamma (h + 4) CentreStatus.outgoing [(3, SpiderLegEnd.free), (h, SpiderLegEnd.free)] ≥ 2 ∧
spider_gamma (h + 5) CentreStatus.none
[(1, SpiderLegEnd.inward), (3, SpiderLegEnd.free), (h, SpiderLegEnd.free)] ≥ 2 ∧
spider_gamma (h + 5) CentreStatus.none
[(1, SpiderLegEnd.outward), (3, SpiderLegEnd.free), (h, SpiderLegEnd.free)] ≥ 2 ∧
spider_gamma (h + 4) CentreStatus.none
[(1, SpiderLegEnd.inward), (2, SpiderLegEnd.free), (h, SpiderLegEnd.free)] ≥ 2 ∧
spider_gamma (h + 4) CentreStatus.none
[(1, SpiderLegEnd.outward), (2, SpiderLegEnd.free), (h, SpiderLegEnd.free)] ≥ 2 ∧
spider_gamma (h + 5) CentreStatus.none
[(2, SpiderLegEnd.inward), (2, SpiderLegEnd.free), (h, SpiderLegEnd.free)] ≥ 2 ∧
spider_gamma (h + 5) CentreStatus.none
[(2, SpiderLegEnd.outward), (2, SpiderLegEnd.free), (h, SpiderLegEnd.free)] ≥ 2spider_gamma_singleton_valIn LeanCombinatorial Games
For a one-legged state, the Grundy value at any successor fuel is determined by the centre status: incoming gives spider_rho h outward φ, outgoing gives spider_rho h inward φ, and free gives spider_rho_star h φ.
theorem spider_gamma_singleton_val (F h : ℕ) (phi : SpiderLegEnd) :
spider_gamma (F + 1) CentreStatus.incoming [(h, phi)] = spider_rho h SpiderLegEnd.outward phi ∧
spider_gamma (F + 1) CentreStatus.outgoing [(h, phi)] = spider_rho h SpiderLegEnd.inward phi ∧
spider_gamma (F + 1) CentreStatus.free [(h, phi)] = spider_rho_star h phispider_has_eventual_parity_one_oddIn LeanCombinatorial Games
For every odd natural number y, the spider pair (1, y) has eventual parity: there exists z₀ such that for all z ≥ z₀, the Grundy value spider_grundy_val 1 y z is equal to z % 2.
theorem spider_has_eventual_parity_one_odd (y : ℕ) (hy : Odd y) : spider_has_eventual_parity 1 y
spider_has_eventual_parity_twinsIn LeanCombinatorial Games
For every positive integer x, the twin-legged spider pair (x, x) has eventual parity: there exists z₀ such that for all z ≥ z₀, the Grundy value spider_grundy_val x x z is equal to z % 2.
theorem spider_has_eventual_parity_twins (x : ℕ) (hx : 1 ≤ x) : spider_has_eventual_parity x x
spider_has_eventual_parity_two_le_ltIn LeanCombinatorial Games
For all natural numbers x and y with 2 ≤ x and x < y, the spider pair (x, y) has eventual parity: there exists z₀ such that for all z ≥ z₀, the Grundy value spider_grundy_val x y z is equal to z % 2.
theorem spider_has_eventual_parity_two_le_lt (x y : ℕ) (hx : 2 ≤ x) (hxy : x < y) : spider_has_eventual_parity x y
spider_three_leg_one_shortIn LeanCombinatorial Games
With free centre, one short leg of length 1 whose far end is blocked (δ inward or outward), together with the two free legs 1 and k, has value k for odd k and k-2 for even k, i.e. k - 2*(1 - k%2). This supplies the "c"-options of the root.
theorem spider_three_leg_one_short (k : ℕ) (δ : SpiderLegEnd)
(hδ : δ = SpiderLegEnd.inward ∨ δ = SpiderLegEnd.outward) :
spider_gamma (k + 3) CentreStatus.none
[(1, δ), (1, SpiderLegEnd.free), (k, SpiderLegEnd.free)] = k - 2 * (1 - k % 2)spider_two_leg_blocked_incoming_inward_valIn LeanCombinatorial Games
For incoming centre status and inward end condition on the blocked leg of length r, the Grundy value at canonical fuel r + 2 with a free leg of length 1 equals r - 1 if r % 4 = 3, and r + 1 otherwise.
theorem spider_two_leg_blocked_incoming_inward_val (r : ℕ) :
spider_gamma (r + 2) CentreStatus.incoming [(r, SpiderLegEnd.inward), (1, SpiderLegEnd.free)] =
if r % 4 = 3 then r - 1 else r + 1spider_two_leg_blocked_incoming_outward_valIn LeanCombinatorial Games
For incoming centre status and outward end condition on the blocked leg of length r, the Grundy value at canonical fuel r + 2 with a free leg of length 1 equals r - 1 if r % 4 = 1, and r + 1 otherwise.
theorem spider_two_leg_blocked_incoming_outward_val (r : ℕ) :
spider_gamma (r + 2) CentreStatus.incoming [(r, SpiderLegEnd.outward), (1, SpiderLegEnd.free)] =
if r % 4 = 1 then r - 1 else r + 1spider_two_leg_blocked_incoming_valIn LeanCombinatorial Games
For incoming centre status and canonical fuel r + 2, a blocked leg of length r with end condition inward has Grundy value r - 1 if r % 4 = 3 and r + 1 otherwise; with end condition outward it has Grundy value r - 1 if r % 4 = 1 and r + 1 otherwise.
theorem spider_two_leg_blocked_incoming_val (r : ℕ) :
spider_gamma (r + 2) CentreStatus.incoming [(r, SpiderLegEnd.inward), (1, SpiderLegEnd.free)] =
(if r % 4 = 3 then r - 1 else r + 1) ∧
spider_gamma (r + 2) CentreStatus.incoming [(r, SpiderLegEnd.outward), (1, SpiderLegEnd.free)] =
(if r % 4 = 1 then r - 1 else r + 1)spider_two_leg_blocked_one_free_parityIn LeanCombinatorial Games
For incoming or outgoing centre, a blocked leg of length r with end condition inward or outward together with a free leg of length 1 has Grundy value of parity (r + 1) % 2 for any fuel at least r + 2.
theorem spider_two_leg_blocked_one_free_parity (F r : ℕ) (s : CentreStatus) (δ : SpiderLegEnd)
(hs : s = CentreStatus.incoming ∨ s = CentreStatus.outgoing)
(hδ : δ = SpiderLegEnd.inward ∨ δ = SpiderLegEnd.outward)
(hF : r + 2 ≤ F) :
spider_gamma F s [(r, δ), (1, SpiderLegEnd.free)] % 2 = (r + 1) % 2spider_two_leg_free_freeIn LeanCombinatorial Games
For incoming or outgoing centre, the two free legs 2 and k give Grundy value k for odd k and k-2 for even k, i.e. k - 2*(1 - k%2), for any fuel at least k+3.
theorem spider_two_leg_free_free (F k : ℕ) (s : CentreStatus)
(hs : s = CentreStatus.incoming ∨ s = CentreStatus.outgoing) (hk : k + 3 ≤ F) :
spider_gamma F s [(2, SpiderLegEnd.free), (k, SpiderLegEnd.free)] = k - 2 * (1 - k % 2)spider_two_leg_one_freeIn LeanCombinatorial Games
For incoming or outgoing centre, the two free legs 1 and k give Grundy value 1 - k%2 (i.e. (k+1) mod 2), for any fuel at least k+2. This is paper Lemma 9.4's Γ(i;(1,*),(i,*)) = (i+1) mod 2.
theorem spider_two_leg_one_free (F k : ℕ) (s : CentreStatus)
(hs : s = CentreStatus.incoming ∨ s = CentreStatus.outgoing) (hk : k + 2 ≤ F) :
spider_gamma F s [(1, SpiderLegEnd.free), (k, SpiderLegEnd.free)] = 1 - k % 2stein_number_count_le_pow_three_quartersIn LeanCombinatorial Games
The number of E. P. Stein numbers up to Z is O(Z^{3/4}).
theorem stein_number_count_le_pow_three_quarters :
∃ C : ℝ, 0 < C ∧ ∀ Z : ℕ,
(Set.ncard ({n : ℕ | is_stein_number n} ∩ Set.Iic Z) : ℝ) ≤
C * ((Z : ℝ) + 1) ^ ((3 : ℝ) / 4)stein_number_parameterization_bijectiveIn LeanCombinatorial Games
The map sending (d, u, v) to d^2 * (u^4 + 4 * v^4) is a bijection (Set.BijOn) from stein_param_set to the set of natural numbers satisfying is_stein_number.
theorem stein_number_parameterization_bijective :
Set.BijOn (fun (d, u, v) => d^2 * (u^4 + 4 * v^4)) stein_param_set {n | is_stein_number n}stein_param_surj_onIn LeanCombinatorial Games
The map sending (d, u, v) to d^2 * (u^4 + 4 * v^4) maps stein_param_set surjectively onto the set of natural numbers satisfying is_stein_number.
theorem stein_param_surj_on :
Set.SurjOn (fun (d, u, v) => d^2 * (u^4 + 4 * v^4)) stein_param_set {n | is_stein_number n}stein_pell_unit_step_primitive_normIn LeanCombinatorial Games
For natural parameters u and v, the unit step (u,v) -> (u+2v,u+v) preserves coprimality and the parity of u and reverses the sign of u squared minus twice v squared.
theorem stein_pell_unit_step_primitive_norm (u v : ℕ) : (Nat.Coprime (u + 2 * v) (u + v) ↔ Nat.Coprime u v) ∧ ((u + 2 * v) % 2 = u % 2) ∧ (((u : ℤ) + 2 * (v : ℤ)) ^ 2 - 2 * ((u : ℤ) + (v : ℤ)) ^ 2 = -((u : ℤ) ^ 2 - 2 * (v : ℤ) ^ 2))
stein_periodic_fluctuation_nonconstantIn LeanCombinatorial Games
Any function F : ℝ → ℝ that approximates stein_residual Y with log-period pell_unit_squared along Filter.atTop must be nonconstant.
theorem stein_periodic_fluctuation_nonconstant (F : ℝ → ℝ)
(h_lim : Filter.Tendsto (fun Y : ℝ => stein_residual Y - F (Real.log Y / Real.log pell_unit_squared))
Filter.atTop (nhds 0)) :
∃ s t : ℝ, F s ≠ F tstein_residual_converges_to_periodic_limitIn LeanCombinatorial Games
There exists a continuous 1-periodic function F : ℝ → ℝ such that stein_residual Y - F(log Y / log pell_unit_squared) tends to 0 along Filter.atTop.
theorem stein_residual_converges_to_periodic_limit :
∃ F : ℝ → ℝ, Continuous F ∧ Function.Periodic F 1 ∧
Filter.Tendsto (fun Y : ℝ => stein_residual Y - F (Real.log Y / Real.log pell_unit_squared))
Filter.atTop (nhds 0)three_by_cycle_torus_moving_target_accuracy_le_sevenIn LeanCombinatorial Games
For any integer n ≥ 5, there exists an adaptive search strategy for a moving target on the 3-by-n torus C_3 □ C_n achieving accuracy at most 7 starting from the set of all vertices.
theorem three_by_cycle_torus_moving_target_accuracy_le_seven (n : ℕ) (hn : 5 ≤ n) :
∃ S : MovingTargetStrategy (Fin 3 × Fin n),
moving_target_strategy_successful (torus_graph 3 n) 7 S Finset.univthree_by_cycle_torus_neighborhood_expansionIn LeanCombinatorial Games
On the 3-by-n torus graph C_3 □ C_n for every n ≥ 3, every subset D of vertices with |D| ≥ min 7 ((3*n+1)/2) satisfies 2 * min 7 ((3*n+1)/2) ≤ |closed_neighborhood D| + 1.
theorem three_by_cycle_torus_neighborhood_expansion (n : ℕ) (hn : 3 ≤ n) (D : Finset (Fin 3 × Fin n)) :
min 7 ((3 * n + 1) / 2) ≤ D.card →
2 * min 7 ((3 * n + 1) / 2) ≤ (closed_neighborhood (torus_graph 3 n) D).card + 1three_row_arithmeticIn LeanCombinatorial Games
Arithmetic core: for three row sizes a, b, c ≤ n with n ≥ 5 and a + b + c ≥ 7, the sum over the three rows of max(adjacent row sizes, (own size = 0 ? 0 : min n (own size + 2))) is at least 13.
theorem three_row_arithmetic (n a b c : ℕ) (hn : 5 ≤ n) (ha : a ≤ n) (hb : b ≤ n) (hc : c ≤ n) (h : 7 ≤ a + b + c) : 13 ≤ max (max b c) (if a = 0 then 0 else min n (a + 2)) + max (max a c) (if b = 0 then 0 else min n (b + 2)) + max (max a b) (if c = 0 then 0 else min n (c + 2))
torus_arc_cardIn LeanCombinatorial Games
A column arc of width L ≤ n has exactly 3L vertices: the L columns (a+i) mod n, i < L, are distinct.
theorem torus_arc_card (n : ℕ) (hn : 5 ≤ n) (a L : ℕ) (hL : L ≤ n) : (torusArc n a L).card = 3 * L
torus_arc_neighborhood_subsetIn LeanCombinatorial Games
The closed neighbourhood of a width-L column arc is contained in the width-(min n (L+2)) arc starting one column earlier: after the target moves it can only occupy the arc itself plus the two adjacent columns (all columns once L+2 ≥ n).
theorem torus_arc_neighborhood_subset (n : ℕ) (hn : 5 ≤ n) (a L : ℕ) (hL : L ≤ n) : closed_neighborhood (torus_graph 3 n) (torusArc n a L) ⊆ torusArc n (a + n - 1) (min n (L + 2))
torus_arc_univIn LeanCombinatorial Games
The full width-n column arc covers every column, hence the whole vertex set.
theorem torus_arc_univ (n : ℕ) (hn : 5 ≤ n) (a : ℕ) : torusArc n a n = Finset.univ
torus_arc_winnableIn LeanCombinatorial Games
On the 3-by-n torus with n ≥ 5, every column arc of width L ≤ n is winnable with accuracy 7.
theorem torus_arc_winnable (n : ℕ) (hn : 5 ≤ n) (a L : ℕ) (hL : L ≤ n) : ∃ S : MovingTargetStrategy (Fin 3 × Fin n), moving_target_strategy_successful (torus_graph 3 n) 7 S (torusArc n a L)
torus_neighborhood_card_ge_elevenIn LeanCombinatorial Games
On the 3-by-4 torus, every set D of at least 6 vertices has a closed neighbourhood of at least 11 vertices.
theorem torus_neighborhood_card_ge_eleven (D : Finset (Fin 3 × Fin 4)) (hD : 6 ≤ D.card) : 11 ≤ (closed_neighborhood (torus_graph 3 4) D).card
torus_neighborhood_card_ge_nineIn LeanCombinatorial Games
On the 3-by-3 torus, every set D of at least 5 vertices has closed neighbourhood equal to the whole vertex set (9 vertices).
theorem torus_neighborhood_card_ge_nine (D : Finset (Fin 3 × Fin 3)) (hD : 5 ≤ D.card) : 9 ≤ (closed_neighborhood (torus_graph 3 3) D).card
torus_neighborhood_card_ge_thirteenIn LeanCombinatorial Games
On the 3-by-n torus with n ≥ 5, every set D of at least 7 vertices has a closed neighbourhood of at least 13 vertices.
theorem torus_neighborhood_card_ge_thirteen (n : ℕ) (hn : 5 ≤ n) (D : Finset (Fin 3 × Fin n)) (hD : 7 ≤ D.card) : 13 ≤ (closed_neighborhood (torus_graph 3 n) D).card
torus_neighborhood_card_rowsIn LeanCombinatorial Games
The closed neighbourhood of D on the 3-by-n torus has at least, summed over the three rows r, the maximum of (i) the number of D-vertices in the two adjacent rows and (ii) the row-wise closed neighbourhood in C_n of the set of columns occupied in row r.
theorem torus_neighborhood_card_rows (n : ℕ) (hn : 5 ≤ n) (D : Finset (Fin 3 × Fin n)) : (closed_neighborhood (torus_graph 3 n) D).card ≥ ∑ r : Fin 3, max (max ((D.filter (fun v => v.1 = r - 1)).card) ((D.filter (fun v => v.1 = r + 1)).card)) ((closed_neighborhood (SimpleGraph.cycleGraph n) ((D.filter (fun v => v.1 = r)).image (fun v => v.2))).card)
word_subtraction_N_iff_existsIn LeanCombinatorial Games
Recursion characterisation of winning positions: w is winning iff it splits as u ++ s with s in S and u not winning.
theorem word_subtraction_N_iff_exists {α : Type*} (S : Finset (List α)) (hne : ∀ s ∈ S, s ≠ []) (w : List α) :
w ∈ word_subtraction_N S ↔ ∃ s ∈ S, ∃ u : List α, w = u ++ s ∧ u ∉ word_subtraction_N Sword_subtraction_N_length_oneIn LeanCombinatorial Games
A single-letter word [a] is in word_subtraction_N S if and only if [a] ∈ S.
theorem word_subtraction_N_length_one {α : Type*} (S : Finset (List α)) (hne : ∀ s ∈ S, s ≠ []) (a : α) : [a] ∈ word_subtraction_N S ↔ [a] ∈ Sword_subtraction_N_nilIn LeanCombinatorial Games
The empty word has no legal moves in normal play with nonempty subtraction set S, hence [] ∉ word_subtraction_N S.
theorem word_subtraction_N_nil {α : Type*} (S : Finset (List α)) (hne : ∀ s ∈ S, s ≠ []) : ([] : List α) ∉ word_subtraction_N Sword_subtraction_N_nil_not_memIn LeanCombinatorial Games
The empty word is a P-position: the empty word is not in word_subtraction_N S.
theorem word_subtraction_N_nil_not_mem {α : Type*} (S : Finset (List α)) :
([] : List α) ∉ word_subtraction_N Sword_subtraction_N_not_mem_of_length_ltIn LeanCombinatorial Games
If every word in the subtraction set S has length at least ℓ, then every word shorter than ℓ is a P-position, i.e. not in word_subtraction_N S.
theorem word_subtraction_N_not_mem_of_length_lt {α : Type*} (S : Finset (List α)) (ℓ : ℕ)
(hℓ : ∀ s ∈ S, ℓ ≤ s.length) {w : List α} (hw : w.length < ℓ) : w ∉ word_subtraction_N Sword_subtraction_buffer_appendIn LeanCombinatorial Games
The reverse window of w ++ [c] is obtained by putting c at index 0 and moving the i-th entry of the reverse window of w to index i+1.
theorem word_subtraction_buffer_append {α : Type*} (n : ℕ) (w : List α) (c : α) (i : Fin n) :
word_subtraction_buffer n (w ++ [c]) i =
(if (i : ℕ) = 0 then some c
else word_subtraction_buffer n w ⟨(i : ℕ) - 1, by have := i.isLt; omega⟩)word_subtraction_dfa_existsIn LeanCombinatorial Games
There exists a DFA M on a finite state set σ recognizing word_subtraction_N S whose state count is exactly the sum over n from 0 to ℓ - 1 of 2^(n + 1) * |α|^n.
theorem word_subtraction_dfa_exists (α : Type*) [Fintype α] (S : Finset (List α)) (hS : S.Nonempty) (hne : ∀ s ∈ S, s ≠ []) : ∃ (σ : Type) (_ : Fintype σ) (M : DFA α σ), Fintype.card σ = ∑ n ∈ Finset.range (S.sup List.length), 2 ^ (n + 1) * (Fintype.card α) ^ n ∧ M.accepts = word_subtraction_N S
word_subtraction_dfa_state_cardIn LeanCombinatorial Games
The cardinality of the disjoint union state space Σ n : Fin ℓ, (Fin n → α) × (Fin (n + 1) → Bool) equals the sum over n from 0 to ℓ - 1 of 2^(n + 1) * |α|^n.
theorem word_subtraction_dfa_state_card (α : Type*) [Fintype α] (ℓ : ℕ) : Fintype.card (Σ n : Fin ℓ, (Fin (n : ℕ) → α) × (Fin ((n : ℕ) + 1) → Bool)) = ∑ n ∈ Finset.range ℓ, 2 ^ (n + 1) * (Fintype.card α) ^ n
word_subtraction_dfa_state_complexity_le_oneIn LeanCombinatorial Games
For any finite alphabet α and nonempty subtraction set S of nonempty words with maximum length at most 1, the deterministic state complexity of word_subtraction_N S is at most 2.
theorem word_subtraction_dfa_state_complexity_le_one {α : Type*} [Fintype α] (S : Finset (List α)) (hS : S.Nonempty) (hne : ∀ s ∈ S, s ≠ []) (hℓ : S.sup List.length ≤ 1) : dfa_state_complexity (word_subtraction_N S) ≤ 2word_subtraction_foldl_invIn LeanCombinatorial Games
Folding the transition over the letters of w from the start state yields a state correct for w.
theorem word_subtraction_foldl_inv {α : Type*} (S : Finset (List α)) (n : ℕ)
(hn : ∀ s ∈ S, s.length ≤ n) (hne : ∀ s ∈ S, s ≠ []) (w : List α) :
word_subtraction_inv S n w
(w.foldl (fun st c => word_subtraction_step S n hn st c) (word_subtraction_start n))word_subtraction_language_N_iff_existsIn LeanCombinatorial Games
For a subtraction set S containing only nonempty words, a word w is an N-position in the word subtraction game if and only if there exist a word s in S and a prefix u such that w = u ++ s and u is not an N-position.
theorem word_subtraction_language_N_iff_exists {α : Type*} (S : Language α)
(hne : ∀ s ∈ S, s ≠ []) (w : List α) :
w ∈ word_subtraction_language_N S ↔
∃ s ∈ S, ∃ u : List α, w = u ++ s ∧ u ∉ word_subtraction_language_N Sword_subtraction_language_N_nilIn LeanCombinatorial Games
The empty word is not an N-position in the word subtraction game with subtraction set S.
theorem word_subtraction_language_N_nil {α : Type*} (S : Language α) :
([] : List α) ∉ word_subtraction_language_N Sword_subtraction_regular_language_is_regularIn LeanCombinatorial Games
Let Σ be an alphabet and S ⊆ Σ⁺ be a regular language (so every word in S is nonempty). Then, the N-position language word_subtraction_language_N S of the word subtraction game with subtraction set S is regular.
theorem word_subtraction_regular_language_is_regular {α : Type*}
(S : Language α) (hne : ∀ s ∈ S, s ≠ []) (hreg : S.IsRegular) :
(word_subtraction_language_N S).IsRegularword_subtraction_regular_language_p_positions_is_regularIn LeanCombinatorial Games
Let Σ be an alphabet and S ⊆ Σ⁺ be a regular language (so every word in S is nonempty). Then, the P-position language (the complement of the N-position language) of the word subtraction game with subtraction set S is regular.
theorem word_subtraction_regular_language_p_positions_is_regular {α : Type*}
(S : Language α) (hne : ∀ s ∈ S, s ≠ []) (hreg : S.IsRegular) :
(word_subtraction_language_N S)ᶜ.IsRegularword_subtraction_start_invIn LeanCombinatorial Games
The start state (empty buffer, bits true exactly from index 1 on) is correct for the empty word.
theorem word_subtraction_start_inv {α : Type*} (S : Finset (List α)) (n : ℕ) :
word_subtraction_inv S n [] (word_subtraction_start n)word_subtraction_step_invIn LeanCombinatorial Games
If the state is correct for w, then the transition on the letter c yields a state correct for w ++ [c].
theorem word_subtraction_step_inv {α : Type*} (S : Finset (List α)) (n : ℕ)
(hn : ∀ s ∈ S, s.length ≤ n) (hne : ∀ s ∈ S, s ≠ []) (w : List α) (c : α)
(st : (Fin n → Option α) × (Fin (n + 1) → Bool)) (hinv : word_subtraction_inv S n w st) :
word_subtraction_inv S n (w ++ [c]) (word_subtraction_step S n hn st c)word_subtraction_step_snd_succIn LeanCombinatorial Games
After reading c, the bit at index j+1 equals the previous bit j, which is correct for the longer word.
theorem word_subtraction_step_snd_succ {α : Type*} (S : Finset (List α)) (n : ℕ)
(hn : ∀ s ∈ S, s.length ≤ n) (w : List α) (c : α) (j : Fin n)
(st : (Fin n → Option α) × (Fin (n + 1) → Bool)) (hinv : word_subtraction_inv S n w st) :
(word_subtraction_step S n hn st c).2 ⟨(j : ℕ) + 1, by have := j.isLt; omega⟩ = true ↔
(((j : ℕ) + 1) > (w ++ [c]).length ∨
(w ++ [c]).take ((w ++ [c]).length - ((j : ℕ) + 1)) ∈ word_subtraction_N S)word_subtraction_step_snd_zeroIn LeanCombinatorial Games
After a step, bit 0 is true iff the extended word w ++ [c] is a winning position.
theorem word_subtraction_step_snd_zero {α : Type*} (S : Finset (List α)) (n : ℕ)
(hn : ∀ s ∈ S, s.length ≤ n) (hne : ∀ s ∈ S, s ≠ []) (w : List α) (c : α)
(st : (Fin n → Option α) × (Fin (n + 1) → Bool)) (hinv : word_subtraction_inv S n w st) :
(word_subtraction_step S n hn st c).2 ⟨0, Nat.succ_pos n⟩ = true ↔ w ++ [c] ∈ word_subtraction_N Schordal_exists_clique_separatorIn LeanEquilibria in Games
A finite chordal graph that is not a clique can be written as the union of two proper parts A and B whose intersection C is a clique, such that every edge of G has both endpoints in A or both endpoints in B.
theorem chordal_exists_clique_separator {V : Type} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (h : is_chordal G)
(hne : ¬ G.IsClique (Set.univ : Set V)) :
∃ (A B C : Set V), A ∪ B = Set.univ ∧ A ∩ B = C ∧ G.IsClique C ∧
A ≠ Set.univ ∧ B ≠ Set.univ ∧
∀ a b : V, G.Adj a b → (a ∈ A ∧ b ∈ A) ∨ (a ∈ B ∧ b ∈ B)chordal_induceIn LeanEquilibria in Games
Every induced subgraph of a chordal graph is chordal: if a cycle graph embeds induced into the induced subgraph on a set s, then composing with the induced embedding of G.induce s into G gives an induced embedding into G, contradicting chordality of G.
theorem chordal_induce {V : Type} (G : SimpleGraph V) (h : is_chordal G) (s : Set V) :
is_chordal (G.induce s)chordal_maxcut_boundary_strongIn LeanEquilibria in Games
Let G be a finite chordal graph, k ≥ 3, K a clique, β a colouring of V and σ a colouring with σ = β on K that is optimal among all colourings agreeing with β on K. Then no nonempty coalition S disjoint from K has a strong deviation from σ.
theorem chordal_maxcut_boundary_strong {V : Type} [Fintype V] (G : SimpleGraph V)
[DecidableRel G.Adj] (k : ℕ) (hchord : is_chordal G) (hk : 3 ≤ k)
(K : Set V) (hK : G.IsClique K) (β : V → Fin k) (σ : V → Fin k)
(hfix : ∀ c : V, c ∈ K → σ c = β c)
(hopt : ∀ τ : V → Fin k, (∀ c : V, c ∈ K → τ c = β c) →
maxcut_welfare G τ ≤ maxcut_welfare G σ) :
∀ (S : Finset V) (τ : V → Fin k), (∀ v ∈ S, v ∉ K) →
¬ is_maxcut_strong_deviation G σ S τmaxcut_deviation_from_optimal_card_ge_threeIn LeanEquilibria in Games
Every strong deviation from an optimal coloring must involve a coalition of size at least 3. In particular, optimal colorings are 2-strong on every finite simple graph.
theorem maxcut_deviation_from_optimal_card_ge_three {V : Type} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (σ : V → Fin k)
(hopt : is_maxcut_optimal G σ) (S : Finset V) (τ : V → Fin k)
(hdev : is_maxcut_strong_deviation G σ S τ) : 3 ≤ S.cardmaxcut_deviation_from_optimal_internal_edges_boundIn LeanEquilibria in Games
For any strong deviation from an optimal coloring in the Max-k-Cut game, the total internal bichromatic edge count must be at least twice the size of the coalition.
theorem maxcut_deviation_from_optimal_internal_edges_bound {V : Type} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (σ τ : V → Fin k)
(hopt : is_maxcut_optimal G σ) (S : Finset V)
(hdev : is_maxcut_strong_deviation G σ S τ) :
2 * S.card ≤ ∑ v ∈ S, ∑ w ∈ S, (if G.Adj v w ∧ τ w ≠ τ v then 1 else 0 : ℕ)maxcut_exists_optimalIn LeanEquilibria in Games
For k ≥ 1 every finite simple graph has an optimal k-colouring, since the colourings form a nonempty finite set and welfare is a natural number.
theorem maxcut_exists_optimal {V : Type} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (hk : 0 < k) : ∃ σ : V → Fin k, is_maxcut_optimal G σmaxcut_exists_unused_color_or_safe_pivotIn LeanEquilibria in Games
Given a finite graph with a strong equilibrium and a vertex subset of size less than twice the number of colors, some strong equilibrium either omits a color on the subset or uses a color exactly once there at a neutral-pivot-safe vertex.
theorem maxcut_exists_unused_color_or_safe_pivot
{V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(N : Finset V) (k : ℕ) (hN : N.card < 2 * k)
(hse : ∃ s : V → Fin k, is_maxcut_strong_equilibrium G s) :
∃ s : V → Fin k, is_maxcut_strong_equilibrium G s ∧
∃ c : Fin k, (N.filter fun w => s w = c).card = 0 ∨
∃ u : V, (N.filter fun w => s w = c) = {u} ∧ is_maxcut_neutral_pivot_safe G s umaxcut_has_optimal_strong_of_forall_optimalIn LeanEquilibria in Games
For k ≥ 1, if every optimal k-colouring of a finite simple graph G is a strong equilibrium, then G admits an optimal colouring that is a strong equilibrium.
theorem maxcut_has_optimal_strong_of_forall_optimal {V : Type} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (k : ℕ) (hk : 0 < k)
(h : ∀ σ : V → Fin k, is_maxcut_optimal G σ → is_maxcut_strong_equilibrium G σ) :
maxcut_has_optimal_strong_equilibrium G kmaxcut_large_complete_parts_defect_color_rigidityIn LeanEquilibria in Games
If k vertex sets each have more than k d vertices, all cross-set pairs are adjacent, and every vertex has at most d same-colored neighbors, then each set is monochromatic and the k set colors are all distinct.
theorem maxcut_large_complete_parts_defect_color_rigidity
{V : Type} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
(k d : ℕ) (A : Fin k → Finset V) (σ : V → Fin k)
(hsize : ∀ i, k * d < (A i).card)
(hcross : ∀ i j : Fin k, i ≠ j → ∀ v ∈ A i, ∀ w ∈ A j, G.Adj v w)
(hdefect : ∀ v : V, (Finset.univ.filter fun w => G.Adj v w ∧ σ w = σ v).card ≤ d) :
∃ π : Equiv.Perm (Fin k), ∀ i : Fin k, ∀ v ∈ A i, σ v = π imaxcut_no_infinite_strong_deviation_chain_two_colorsIn LeanEquilibria in Games
For every finite simple graph, the strong-deviation relation on 2-colourings has no infinite chain: welfare strictly increases along every step and is bounded.
theorem maxcut_no_infinite_strong_deviation_chain_two_colors (V : Type) [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] : ¬ ∃ f : ℕ → (V → Fin 2), ∀ n, is_maxcut_strong_deviation G (f n) (Finset.univ.filter fun v => f (n+1) v ≠ f n v) (f (n+1))
maxcut_no_mutual_strong_deviationIn LeanEquilibria in Games
Two colourings can never be strong deviations from each other: the relation σ → τ (τ changes a nonempty set of vertices and strictly improves every changed player) is antisymmetric. Hence the deviation digraph has no 2-cycles, for every k.
theorem maxcut_no_mutual_strong_deviation {V : Type} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} {σ τ : V → Fin k} : ¬ (is_maxcut_strong_deviation G σ (Finset.univ.filter fun v => τ v ≠ σ v) τ ∧ is_maxcut_strong_deviation G τ (Finset.univ.filter fun v => σ v ≠ τ v) σ)maxcut_op89_exists_of_not_colorableNeeds helpEquilibria in Games
Every finite simple graph G that is not k-colourable (χ(G) > k) on at least 2k+2 vertices admits an optimal colouring of the unweighted Max-k-Cut game that is a strong equilibrium, for every k ≥ 3.
theorem maxcut_op89_exists_of_not_colorable {V : Type} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] (k : ℕ) (hk : 3 ≤ k) (hV : 2 * k + 2 ≤ Fintype.card V) (hchi : ¬ G.Colorable k) : maxcut_has_optimal_strong_equilibrium G kmaxcut_op89_residual_existsIn LeanEquilibria in Games
In the unweighted Max-k-Cut game with k ≥ 3, every non-k-colorable finite simple graph on at least 2k+2 vertices having maximum degree at least 2k admits an optimal coloring that is a strong equilibrium (residual open core of OP-89).
theorem maxcut_op89_residual_exists {V : Type} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] (k : ℕ) (hk : 3 ≤ k) (hV : 2 * k + 2 ≤ Fintype.card V) (hchi : ¬ G.Colorable k) (hdeg : ∃ v, 2 * k ≤ G.degree v) : maxcut_has_optimal_strong_equilibrium G kmaxcut_optimal_induce_of_agrees_on_separatorIn LeanEquilibria in Games
Let A ∪ B = univ, A ∩ B = C and every edge of G lie inside A or inside B. If σ is an optimal colouring of G and ρ is a colouring of G that agrees with σ on C, then the restriction of ρ to A has welfare at most that of the restriction of σ to A, computed in the induced graph G[A].
theorem maxcut_optimal_induce_of_agrees_on_separator {V : Type} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (σ ρ : V → Fin k)
(hopt : is_maxcut_optimal G σ)
(A B C : Set V) [Fintype A] [Fintype B] [Fintype C]
(hunion : A ∪ B = Set.univ) (hinter : A ∩ B = C)
(hedge : ∀ a b : V, G.Adj a b → (a ∈ A ∧ b ∈ A) ∨ (a ∈ B ∧ b ∈ B))
(hagree : ∀ c : V, c ∈ C → ρ c = σ c) :
maxcut_welfare (G.induce A) (fun a : A => ρ a.1) ≤
maxcut_welfare (G.induce A) (fun a : A => σ a.1)maxcut_optimal_no_singleton_deviationIn LeanEquilibria in Games
Every optimal coloring is a pure Nash equilibrium: no singleton coalition has a strong deviation.
theorem maxcut_optimal_no_singleton_deviation {V : Type} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (σ : V → Fin k)
(hopt : is_maxcut_optimal G σ) (v : V) (τ : V → Fin k) :
¬ is_maxcut_strong_deviation G σ {v} τmaxcut_optimal_strong_of_isClique_univIn LeanEquilibria in Games
If the whole vertex set of a finite simple graph is a clique (that is, the graph is complete), then every optimal colouring of the Max-k-Cut game is a strong equilibrium.
theorem maxcut_optimal_strong_of_isClique_univ {V : Type} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (σ : V → Fin k)
(hclique : G.IsClique (Set.univ : Set V)) (hopt : is_maxcut_optimal G σ) :
is_maxcut_strong_equilibrium G σmaxcut_pinned_twins_initial_defect_eight_nashIn LeanEquilibria in Games
The initial pinned-twins coloring is a Nash equilibrium and each vertex has at most eight same-colored neighbors.
theorem maxcut_pinned_twins_initial_defect_eight_nash
[DecidableRel maxcut_pinned_twins_graph.Adj] :
(∀ v : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2),
(Finset.univ.filter fun w => maxcut_pinned_twins_graph.Adj v w ∧
maxcut_anchor_three_initial_coloring w.1 = maxcut_anchor_three_initial_coloring v.1).card ≤ 8) ∧
∀ v : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2), ∀ c : Fin 3,
¬ is_maxcut_strong_deviation maxcut_pinned_twins_graph
(fun v : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2) => maxcut_anchor_three_initial_coloring v.1) {v} (Function.update (fun v : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2) => maxcut_anchor_three_initial_coloring v.1) v c)maxcut_pinned_twins_minimum_max_defect_nash_not_strongIn LeanEquilibria in Games
The pinned-twins graph has a Nash profile with maximum monochromatic degree eight, but no strong equilibrium with maximum monochromatic degree at most eight; therefore minimizing that maximum, or its sorted vector, among Nash profiles cannot select a strong equilibrium.
theorem maxcut_pinned_twins_minimum_max_defect_nash_not_strong
[DecidableRel maxcut_pinned_twins_graph.Adj] :
(∃ σ : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2) → Fin 3,
(∀ v : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2), (Finset.univ.filter fun w => maxcut_pinned_twins_graph.Adj v w ∧ σ w = σ v).card ≤ 8) ∧ (∀ v : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2), ∀ c : Fin 3, ¬ is_maxcut_strong_deviation maxcut_pinned_twins_graph σ {v} (Function.update σ v c))) ∧
∀ σ : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2) → Fin 3,
(∀ v : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2), (Finset.univ.filter fun w => maxcut_pinned_twins_graph.Adj v w ∧ σ w = σ v).card ≤ 8) →
¬ is_maxcut_strong_equilibrium maxcut_pinned_twins_graph σmaxcut_pinned_twins_nash_defect_eight_rigidityIn LeanEquilibria in Games
Every Nash coloring of the pinned-twins graph with maximum monochromatic degree at most eight is a global color permutation of the initial coloring.
theorem maxcut_pinned_twins_nash_defect_eight_rigidity
[DecidableRel maxcut_pinned_twins_graph.Adj]
(σ : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2) → Fin 3)
(hdefect : ∀ v : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2), (Finset.univ.filter fun w => maxcut_pinned_twins_graph.Adj v w ∧ σ w = σ v).card ≤ 8)
(hnash : ∀ v : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2), ∀ c : Fin 3, ¬ is_maxcut_strong_deviation maxcut_pinned_twins_graph σ {v} (Function.update σ v c)) :
∃ π : Equiv.Perm (Fin 3), ∀ v : ((Fin 16 ⊕ (Fin 3 × Fin 25)) × Fin 2),
σ v = π (maxcut_anchor_three_initial_coloring v.1)maxcut_proper_coloring_strong_equilibriumIn LeanEquilibria in Games
Any colouring in which adjacent vertices get different colours is a strong equilibrium: every player already attains its full degree as utility, so nobody can gain.
theorem maxcut_proper_coloring_strong_equilibrium {V : Type} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (σ : V → Fin k) (h : ∀ v w, G.Adj v w → σ w ≠ σ v) : is_maxcut_strong_equilibrium G σmaxcut_single_conflict_deviation_pivotIn LeanEquilibria in Games
Let a restored vertex play a best response with exactly one monochromatic neighbor, and suppose the deletion profile is strongly stable. Every profitable coalition in the full graph moves that unique neighbor, whose utility in the deletion stays unchanged, while all other coalition members in the deletion strictly improve; the initial monochromatic edge becomes cut.
theorem maxcut_single_conflict_deviation_pivot
{V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k : ℕ} (v : V) (σ : V → Fin k) (u : (↑(Finset.univ.erase v) : Set V))
(huniq : (Finset.univ.filter fun w => G.Adj v w ∧ σ w = σ v) = {u.1})
(hbest : ∀ c : Fin k, (Finset.univ.filter fun w => G.Adj v w ∧ σ w = σ v).card ≤
(Finset.univ.filter fun w => G.Adj v w ∧ σ w = c).card)
(hsub : is_maxcut_strong_equilibrium (G.induce (↑(Finset.univ.erase v) : Set V)) (fun x : (↑(Finset.univ.erase v) : Set V) => σ x.1))
(C : Finset V) (τ : V → Fin k) (hdev : is_maxcut_strong_deviation G σ C τ) :
u.1 ∈ C ∧ τ u.1 ≠ σ u.1 ∧ τ u.1 ≠ τ v ∧
maxcut_utility (G.induce (↑(Finset.univ.erase v) : Set V)) (fun x : (↑(Finset.univ.erase v) : Set V) => σ x.1) u = maxcut_utility (G.induce (↑(Finset.univ.erase v) : Set V)) (fun x : (↑(Finset.univ.erase v) : Set V) => τ x.1) u ∧
∀ x : (↑(Finset.univ.erase v) : Set V), x.1 ∈ C → x ≠ u →
maxcut_utility (G.induce (↑(Finset.univ.erase v) : Set V)) (fun x : (↑(Finset.univ.erase v) : Set V) => σ x.1) x < maxcut_utility (G.induce (↑(Finset.univ.erase v) : Set V)) (fun x : (↑(Finset.univ.erase v) : Set V) => τ x.1) xmaxcut_strong_deviation_induce_of_nbrs_subsetIn LeanEquilibria in Games
Suppose T is a coalition inside A every member of which has all of its G-neighbours in A (this holds automatically for subsets of A \ B when every edge of G lies inside A or inside B). If τ is a strong deviation from σ for the coalition of the underlying vertices of T in G, then restricting both colourings to A gives a strong deviation in the game on the induced graph G[A].
theorem maxcut_strong_deviation_induce_of_nbrs_subset {V : Type} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (σ τ : V → Fin k)
(A : Set V) [Fintype A] (T : Finset A)
(hN : ∀ t : A, t ∈ T → ∀ w : V, G.Adj t.1 w → w ∈ A)
(hdev : is_maxcut_strong_deviation G σ (T.image (fun t : A => t.1)) τ) :
is_maxcut_strong_deviation (G.induce A) (fun a : A => σ a.1) T (fun a : A => τ a.1)maxcut_strong_deviation_no_cycleNeeds helpEquilibria in Games
For every finite simple graph and every k, the strong-deviation relation on k-colourings has no directed cycle of any length, hence no infinite chain; consequently some colouring is a strong equilibrium.
theorem maxcut_strong_deviation_no_cycle (V : Type) [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] (k : ℕ) : ∀ (m : ℕ) (f : ℕ → (V → Fin k)), 0 < m → ¬ (∀ i : ℕ, is_maxcut_strong_deviation G (f i) (Finset.univ.filter fun v => f (i+1) v ≠ f i v) (f (i+1)) ∧ f m = f 0)
maxcut_strong_deviation_welfare_lt_two_colorsIn LeanEquilibria in Games
With two colours, every strong deviation strictly increases the social welfare; hence a welfare-maximising 2-colouring is a strong equilibrium and every graph has a strong equilibrium in the 2-colour Max-k-Cut game.
theorem maxcut_strong_deviation_welfare_lt_two_colors {V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (σ τ : V → Fin 2) (S : Finset V) (h : is_maxcut_strong_deviation G σ S τ) : maxcut_welfare G σ < maxcut_welfare G τmaxcut_strong_equilibrium_exists_two_colorsIn LeanEquilibria in Games
Every finite simple graph has a strong equilibrium in the 2-colour Max-k-Cut game: take a welfare-maximising 2-colouring.
theorem maxcut_strong_equilibrium_exists_two_colors {V : Type} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] : ∃ σ : V → Fin 2, is_maxcut_strong_equilibrium G σmaxcut_strong_equilibrium_iffIn LeanEquilibria in Games
σ is a strong equilibrium iff for every other colouring τ some vertex whose colour changes under τ fails to strictly improve its utility.
theorem maxcut_strong_equilibrium_iff {V : Type} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (σ : V → Fin k) : is_maxcut_strong_equilibrium G σ ↔ ∀ τ : V → Fin k, (∃ v, τ v ≠ σ v) → ∃ v, τ v ≠ σ v ∧ maxcut_utility G τ v ≤ maxcut_utility G σ vmaxcut_strong_equilibrium_of_colorableIn LeanEquilibria in Games
If G admits a proper colouring with k colours then the k-colour Max-k-Cut game on G has a strong equilibrium.
theorem maxcut_strong_equilibrium_of_colorable {V : Type} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (h : G.Colorable k) : ∃ σ : V → Fin k, is_maxcut_strong_equilibrium G σmaxcut_strong_equilibrium_of_neutral_pivot_safeIn LeanEquilibria in Games
A deletion strong equilibrium extends across a best-responding vertex with exactly one monochromatic neighbor if that neighbor is neutral-pivot safe in the deletion.
theorem maxcut_strong_equilibrium_of_neutral_pivot_safe
{V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k : ℕ} (v : V) (σ : V → Fin k) (u : (↑(Finset.univ.erase v) : Set V))
(huniq : (Finset.univ.filter fun w => G.Adj v w ∧ σ w = σ v) = {u.1})
(hbest : ∀ c : Fin k, (Finset.univ.filter fun w => G.Adj v w ∧ σ w = σ v).card ≤
(Finset.univ.filter fun w => G.Adj v w ∧ σ w = c).card)
(hsub : is_maxcut_strong_equilibrium (G.induce (↑(Finset.univ.erase v) : Set V)) (fun x : (↑(Finset.univ.erase v) : Set V) => σ x.1))
(hsafe : is_maxcut_neutral_pivot_safe (G.induce (↑(Finset.univ.erase v) : Set V)) (fun x : (↑(Finset.univ.erase v) : Set V) => σ x.1) u) :
is_maxcut_strong_equilibrium G σmaxcut_strong_equilibrium_of_no_deviation_chainIn LeanEquilibria in Games
If there is no infinite chain σ₀ → σ₁ → … of strong deviations (each step changing exactly the players whose colour changes), then a strong equilibrium exists.
theorem maxcut_strong_equilibrium_of_no_deviation_chain {V : Type} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (hk : 0 < k) (h : ¬ ∃ f : ℕ → (V → Fin k), ∀ n, is_maxcut_strong_deviation G (f n) (Finset.univ.filter fun v => f (n+1) v ≠ f n v) (f (n+1))) : ∃ σ : V → Fin k, is_maxcut_strong_equilibrium G σmaxcut_strong_equilibrium_some_extension_degree_lt_two_kIn LeanEquilibria in Games
If a vertex has degree less than twice the number of colors and the deleted graph has a strong equilibrium, then some strong equilibrium of the deleted graph extends to a strong equilibrium of the original graph.
theorem maxcut_strong_equilibrium_some_extension_degree_lt_two_k
{V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(v : V) (k : ℕ) (hd : G.degree v < 2 * k)
(hsub : ∃ s : (↑(Finset.univ.erase v) : Set V) → Fin k,
is_maxcut_strong_equilibrium (G.induce (↑(Finset.univ.erase v) : Set V)) s) :
∃ σ : V → Fin k, is_maxcut_strong_equilibrium G σ ∧
is_maxcut_strong_equilibrium (G.induce (↑(Finset.univ.erase v) : Set V))
(fun x : (↑(Finset.univ.erase v) : Set V) => σ x.1)maxcut_utility_induce_of_nbrs_subsetIn LeanEquilibria in Games
If every neighbour of a vertex t of the induced subgraph G.induce A (viewed as a vertex of G) lies in A, then t's utility in the game on the induced subgraph G.induce A equals its utility in the game on G.
theorem maxcut_utility_induce_of_nbrs_subset {V : Type} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (σ : V → Fin k)
(A : Set V) [Fintype A] (t : A) (hN : ∀ w : V, G.Adj t.1 w → w ∈ A) :
maxcut_utility (G.induce A) (fun a : A => σ a.1) t = maxcut_utility G σ t.1maxcut_welfare_separator_decompIn LeanEquilibria in Games
If A ∪ B is everything, A ∩ B = C, and every edge of G lies inside A or inside B, then for every colouring rho the welfare of rho on G plus the welfare on the shared part C equals the welfare on G[A] plus the welfare on G[B].
theorem maxcut_welfare_separator_decomp {V : Type} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (ρ : V → Fin k)
(A B C : Set V) [Fintype A] [Fintype B] [Fintype C]
(hunion : A ∪ B = Set.univ) (hinter : A ∩ B = C)
(hedge : ∀ a b : V, G.Adj a b → (a ∈ A ∧ b ∈ A) ∨ (a ∈ B ∧ b ∈ B)) :
maxcut_welfare G ρ + maxcut_welfare (G.induce C) (fun c : C => ρ c.1) =
maxcut_welfare (G.induce A) (fun a : A => ρ a.1) +
maxcut_welfare (G.induce B) (fun b : B => ρ b.1)pure_best_response_payoff_le_oneIn LeanEquilibria in Games
Let n be a positive natural number. If every entry of the square matrix A : Matrix (Fin n) (Fin n) ℝ is at most 1, then for any strategy p in stdSimplex ℝ (Fin n) and any row index i in Fin n, Matrix.mulVec A p.val i ≤ 1.
theorem pure_best_response_payoff_le_one {n : ℕ} [NeZero n] (A : Matrix (Fin n) (Fin n) ℝ) (p : stdSimplex ℝ (Fin n)) (hA : ∀ i j, A i j ≤ 1) (i : Fin n) : Matrix.mulVec A p.val i ≤ 1regret_le_one_sub_two_eps_of_self_payoffIn LeanEquilibria in Games
Let n be a positive natural number. If every entry of A : Matrix (Fin n) (Fin n) ℝ is at most 1 and strategy p in stdSimplex ℝ (Fin n) satisfies dotProduct p.val (Matrix.mulVec A p.val) ≥ 2 * ε, then symmetric_game_regret A p ≤ 1 - 2 * ε.
theorem regret_le_one_sub_two_eps_of_self_payoff {n : ℕ} [NeZero n] (A : Matrix (Fin n) (Fin n) ℝ) (p : stdSimplex ℝ (Fin n)) (ε : ℝ) (hA : ∀ i j, A i j ≤ 1) (h_self : dotProduct p.val (Matrix.mulVec A p.val) ≥ 2 * ε) : symmetric_game_regret A p ≤ 1 - 2 * εsaddle_gap_first_marginal_boundsIn LeanEquilibria in Games
Let n be a positive natural number. For any matrix A : Matrix (Fin n) (Fin n) ℝ with non-negative entries and any optimal row strategy σ in (saddle_gap_game A).optimalRowStrategies, its first marginal a = saddle_gap_first_marginal σ satisfies Matrix.vecMul a.val A j ≥ (saddle_gap_game A).value for all j in Fin n, and dotProduct a.val (Matrix.mulVec A a.val) ≥ 2 * (saddle_gap_game A).value.
theorem saddle_gap_first_marginal_bounds {n : ℕ} [NeZero n] (A : Matrix (Fin n) (Fin n) ℝ) (hA_nonneg : ∀ i j, 0 ≤ A i j) (σ : stdSimplex ℝ (Fin n × Fin n)) (hσ : σ ∈ (saddle_gap_game A).optimalRowStrategies) : let a := saddle_gap_first_marginal σ; (∀ j : Fin n, Matrix.vecMul a.val A j ≥ (saddle_gap_game A).value) ∧ dotProduct a.val (Matrix.mulVec A a.val) ≥ 2 * (saddle_gap_game A).valuesaddle_gap_first_marginal_guaranteeIn LeanEquilibria in Games
Let n be a positive natural number, and let A : Matrix (Fin n) (Fin n) ℝ have entries in [0, 1]. If the value of the saddle-gap game satisfies (saddle_gap_game A).value > ε, then for any optimal row strategy σ in (saddle_gap_game A).optimalRowStrategies, its first marginal p₀ = saddle_gap_first_marginal σ satisfies symmetric_game_regret A p₀ ≤ 1 - 2 * ε and Matrix.vecMul p₀.val A j ≥ ε for all j in Fin n.
theorem saddle_gap_first_marginal_guarantee {n : ℕ} [NeZero n] (A : Matrix (Fin n) (Fin n) ℝ) (hA_nonneg : ∀ i j, 0 ≤ A i j) (hA_le_one : ∀ i j, A i j ≤ 1) (ε : ℝ) (h_val : (saddle_gap_game A).value > ε) (σ : stdSimplex ℝ (Fin n × Fin n)) (hσ : σ ∈ (saddle_gap_game A).optimalRowStrategies) : let p₀ := saddle_gap_first_marginal σ; symmetric_game_regret A p₀ ≤ 1 - 2 * ε ∧ ∀ j : Fin n, Matrix.vecMul p₀.val A j ≥ εadditive_valuation_bivalued_cardIn LeanFair Division
If every chore costs either 1 or r, the cost of a bundle S is |S| + (r-1) times the number of r-cost chores in S.
theorem additive_valuation_bivalued_card {m : ℕ} (r : ℝ) (u : Fin m → ℝ)
(hu : ∀ g, u g = 1 ∨ u g = r) (S : Finset (Fin m)) :
additive_valuation u S = (S.card : ℝ) + (r - 1) * ((S.filter fun g => u g = r).card : ℝ)adversary_forces_ratio_antitone_factorIn LeanFair Division
For 1 ≤ r, if the adversary can force factor β by prefix H then it can force every smaller factor α ≤ β by prefix H; so the set of forcible factors is a down-set and adversary_forces_ratio is antitone in the factor.
theorem adversary_forces_ratio_antitone_factor {r α β : ℝ} (hr : 1 ≤ r) (H : ℕ) (hαβ : α ≤ β)
(h : adversary_forces_ratio r β H) : adversary_forces_ratio r α Hallocation_rule_unique_ownerIn LeanFair Division
For an allocation rule that is non-wasteful, every object has exactly one owner at every profile: there is a unique agent whose bundle contains it.
theorem allocation_rule_unique_owner {Agent Object : Type*} [Fintype Agent] [Fintype Object]
[DecidableEq Agent] [DecidableEq Object]
(f : (Agent → LinearOrder Object) → Agent → Finset Object)
(h_alloc : is_allocation_rule f) (h_nw : is_non_wasteful_rule f)
(succ : Agent → LinearOrder Object) (y : Object) :
∃! i : Agent, y ∈ f succ ialmost_mms_base_case_allocationIn LeanFair Division
For a single agent u and a finite set of items E with valuation v, if the total value ∑_{e ∈ E} v(u, e) ≥ 1, then there exists an allocation assigning a subset of E to each agent in {u} such that u receives a bundle of value at least 1.
theorem almost_mms_base_case_allocation
{Agent Item : Type*} [DecidableEq Agent] [DecidableEq Item]
(u : Agent) (E : Finset Item)
(v : Agent → Item → ℝ)
(hv : 1 ≤ ∑ e ∈ E, v u e) :
∃ B : Agent → Finset Item,
(∀ a ∈ ({u} : Finset Agent), B a ⊆ E) ∧
(({u} : Finset Agent) : Set Agent).PairwiseDisjoint B ∧
∀ a ∈ ({u} : Finset Agent), 1 ≤ ∑ e ∈ B a, v a ealmost_mms_exists_prefix_bundle_ge_one_all_le_twoIn LeanFair Division
For any non-empty finite set of agents U and finite set of items E, if each agent u ∈ U has non-negative item valuations v(u, e) ≤ 1 for all e ∈ E, and some agent in U values E at least 1, then there exists a subset B ⊆ E and an agent u* ∈ U such that u* values B at least 1, and every agent in U values B at most 2.
theorem almost_mms_exists_prefix_bundle_ge_one_all_le_two
{Agent Item : Type*} [DecidableEq Agent] [DecidableEq Item]
(U : Finset Agent) (hU : U.Nonempty) (E : Finset Item)
(v : Agent → Item → ℝ)
(hv_nonneg : ∀ u ∈ U, ∀ e ∈ E, 0 ≤ v u e)
(hv_le_one : ∀ u ∈ U, ∀ e ∈ E, v u e ≤ 1)
(hex : ∃ u ∈ U, 1 ≤ ∑ e ∈ E, v u e) :
∃ B : Finset Item, B ⊆ E ∧
(∃ ustar ∈ U, 1 ≤ ∑ e ∈ B, v ustar e) ∧
∀ u ∈ U, ∑ e ∈ B, v u e ≤ 2almost_mms_guaranteed_allocation_of_value_ge_two_mul_card_sub_oneIn LeanFair Division
Let U be a finite non-empty set of agents, and let E be a finite set of items. Suppose each agent u ∈ U has an additive valuation given by non-negative item values v(u, e) ≤ 1 for all e ∈ E such that ∑_{e ∈ E} v(u, e) ≥ 2 * |U| - 1 for all u ∈ U. Then there exists an allocation (B_u)_{u ∈ U} of a subset of E to U of pairwise disjoint bundles such that ∑_{e ∈ B_u} v(u, e) ≥ 1 for every u ∈ U.
theorem almost_mms_guaranteed_allocation_of_value_ge_two_mul_card_sub_one
{Agent Item : Type*} [DecidableEq Agent] [DecidableEq Item]
(U : Finset Agent) (hU : U.Nonempty) (E : Finset Item)
(v : Agent → Item → ℝ)
(hv_nonneg : ∀ u ∈ U, ∀ e ∈ E, 0 ≤ v u e)
(hv_le_one : ∀ u ∈ U, ∀ e ∈ E, v u e ≤ 1)
(hv_total : ∀ u ∈ U, 2 * (U.card : ℝ) - 1 ≤ ∑ e ∈ E, v u e) :
∃ B : Agent → Finset Item,
(∀ u ∈ U, B u ⊆ E) ∧
(U : Set Agent).PairwiseDisjoint B ∧
∀ u ∈ U, 1 ≤ ∑ e ∈ B u, v u ealmost_mms_remaining_items_value_geIn LeanFair Division
For a finite set of items E, a subset B ⊆ E, a valuation v on items, and a positive integer n ≥ 1, if ∑_{e ∈ E} v(e) ≥ 2 * n - 1 and ∑_{e ∈ B} v(e) ≤ 2, then the remaining items satisfy ∑_{e ∈ E \ B} v(e) ≥ 2 * (n - 1) - 1.
theorem almost_mms_remaining_items_value_ge
{Item : Type*} [DecidableEq Item]
(E B : Finset Item) (hB : B ⊆ E) (v : Item → ℝ)
(n : ℕ) (hn : 1 ≤ n)
(h_total : 2 * (n : ℝ) - 1 ≤ ∑ e ∈ E, v e)
(h_bundle : ∑ e ∈ B, v e ≤ 2) :
2 * ((n - 1 : ℕ) : ℝ) - 1 ≤ ∑ e ∈ E \ B, v ealmost_mms_residual_allocation_after_removing_low_value_setIn LeanFair Division
Let M be a finite set of items and N a finite set of agents with additive valuations given by item values v(i, e) ∈ [0, 1] such that ∑_{e ∈ M} v(i, e) ≥ d. Let F ⊆ M satisfy ∑_{e ∈ F} v(i, e) ≤ |N| + 1 for all i ∈ N. Then for any subset U ⊆ N with |U| ≤ (d - |N|)/2, there exists an allocation assigning each agent u ∈ U a pairwise disjoint bundle B(u) ⊆ M \ F such that ∑_{e ∈ B(u)} v(u, e) ≥ 1.
theorem almost_mms_residual_allocation_after_removing_low_value_set
{Agent Item : Type*} [DecidableEq Agent] [DecidableEq Item]
(N : Finset Agent) (M : Finset Item) (d : ℝ)
(v : Agent → Item → ℝ)
(hv_nonneg : ∀ i ∈ N, ∀ e ∈ M, 0 ≤ v i e)
(hv_le_one : ∀ i ∈ N, ∀ e ∈ M, v i e ≤ 1)
(hv_M : ∀ i ∈ N, d ≤ ∑ e ∈ M, v i e)
(F : Finset Item) (hF : F ⊆ M)
(hF_val : ∀ i ∈ N, ∑ e ∈ F, v i e ≤ (N.card : ℝ) + 1)
(U : Finset Agent) (hU_sub : U ⊆ N)
(hU_card : (U.card : ℝ) ≤ (d - (N.card : ℝ)) / 2) :
∃ B : Agent → Finset Item,
(∀ u ∈ U, B u ⊆ M \ F) ∧
(U : Set Agent).PairwiseDisjoint B ∧
∀ u ∈ U, 1 ≤ ∑ e ∈ B u, v u ealmost_mms_residual_value_geIn LeanFair Division
For a finite set of agents N and items M, an item subset F ⊆ M, additive valuations v with total value ∑_{e ∈ M} v(u, e) ≥ d and subset value ∑_{e ∈ F} v(u, e) ≤ |N| + 1 for each agent, and a subset of agents U ⊆ N with |U| ≤ (d - |N|)/2, every agent u ∈ U values the residual items M \ F at least 2 * |U| - 1.
theorem almost_mms_residual_value_ge
{Agent Item : Type*} [DecidableEq Agent] [DecidableEq Item]
(N : Finset Agent) (M : Finset Item) (d : ℝ)
(v : Agent → Item → ℝ)
(hv_M : ∀ i ∈ N, d ≤ ∑ e ∈ M, v i e)
(F : Finset Item) (hF : F ⊆ M)
(hF_val : ∀ i ∈ N, ∑ e ∈ F, v i e ≤ (N.card : ℝ) + 1)
(U : Finset Agent) (hU_sub : U ⊆ N)
(hU_card : (U.card : ℝ) ≤ (d - (N.card : ℝ)) / 2)
(u : Agent) (hu : u ∈ U) :
2 * (U.card : ℝ) - 1 ≤ ∑ e ∈ M \ F, v u ebalanced_bivalued_two_bundle_mms_boundIn LeanFair Division
For a positive two-valued chore cost, if a bipartition balances both the total number of chores and the number of high-cost chores to within one, both bundles cost at most (r+1)/2 times the two-agent maximin share.
theorem balanced_bivalued_two_bundle_mms_bound
(m : ℕ) (r a : ℝ) (hr : 1 ≤ r) (ha : 0 < a)
(u : Fin m → ℝ) (H S : Finset (Fin m))
(hu : ∀ g, u g = if g ∈ H then r * a else a)
(hs : S.card ≤ (m + 1) / 2)
(hsc : (Finset.univ \ S).card ≤ (m + 1) / 2)
(hh : (S ∩ H).card ≤ (H.card + 1) / 2)
(hhc : (H \ S).card ≤ (H.card + 1) / 2) :
additive_valuation u S ≤ ((r + 1) / 2) * chore_maximin_share 2 u ∧
additive_valuation u (Finset.univ \ S) ≤
((r + 1) / 2) * chore_maximin_share 2 ubalanced_draft_fixed_values_independentIn LeanFair Division
Fix any deterministic picking schedule and, for each agent, any strictly increasing list of real values. Independently assign each agent a uniformly random permutation of the good labels. Then the agents' normalized sincere-draft utilities are jointly independent; zero total value uses division by zero equal to zero.
theorem balanced_draft_fixed_values_independent :
∀ (n m : ℕ) (s : Fin m → Fin n) (w : Fin n → Fin m → ℝ),
(∀ i, StrictMono (w i)) →
iIndepFun
(fun i (π : Fin n → Equiv.Perm (Fin m)) =>
balanced_draft_normalized_utility n m s (fun j g => w j (π j g)) i)
(Measure.pi (fun _ : Fin n => uniformOn (Set.univ : Set (Equiv.Perm (Fin m)))))balanced_draft_scaled_utilities_independentIn LeanFair Division
For every deterministic picking schedule, including unbalanced schedules, the scaled normalized utilities of the agents are jointly independent under independent uniform unit-interval valuations.
theorem balanced_draft_scaled_utilities_independent : ∀ (n m : ℕ) (s : Fin m → Fin n), iIndepFun (fun i v => balanced_draft_scaled_utility n m s v i) (balanced_draft_input_law n m : Measure (Fin n → Fin m → ℝ))
balanced_draft_threshold_imbalance_boundIn LeanFair Division
For a balanced deterministic schedule and one agent, let T be a nonnegative threshold starting at at most one that can decrease only on that agent's turns. The absolute difference between n-1 times the sum of the post-pick thresholds on that agent's turns and the sum of the thresholds on all other turns is at most n-1.
theorem balanced_draft_threshold_imbalance_bound :
∀ (n m : ℕ) (s : Fin m → Fin n) (i : Fin n) (T : ℕ → ℝ),
is_balanced_schedule n m s → T 0 ≤ 1 →
(∀ t, t ≤ m → 0 ≤ T t) →
(∀ t, t < m → T (t+1) ≤ T t) →
(∀ t (ht : t < m), s ⟨t,ht⟩ ≠ i → T (t+1) = T t) →
|((n : ℝ)-1) * (∑ t : Fin m, if s t = i then T (t.val+1) else 0) -
(∑ t : Fin m, if s t ≠ i then T t.val else 0)| ≤ (n : ℝ)-1balanced_high_count_few_chores_mms_boundIn LeanFair Division
For n at least two and at most 2n bivalued chores with ratio r at least one and positive base a, a bundle whose total and high-cost counts each round their population averages up by less than one costs at most (r+1)/2 times the n-agent chore maximin share.
theorem balanced_high_count_few_chores_mms_bound (n m : ℕ) (hn : 2 ≤ n) (hm : m ≤ 2*n) (r : ℝ) (hr : 1 ≤ r) (a : ℝ) (ha : 0 < a) (u : Fin m → ℝ) (hu : ∀ g, u g = a ∨ u g = r*a) (S : Finset (Fin m)) (hs : n * S.card ≤ m + n - 1) (hh : n * ((S.filter fun g => u g = r*a).card) ≤ ((Finset.univ.filter fun g => u g = r*a).card) + n - 1) : additive_valuation u S ≤ ((r+1)/2) * chore_maximin_share n u
balanced_high_count_large_ratio_mms_boundIn LeanFair Division
For n at least two and m bivalued chores with ratio r at least two and positive base a, a bundle whose total and high-cost counts each round their population averages up by less than one costs at most (r+1)/2 times the n-agent chore maximin share.
theorem balanced_high_count_large_ratio_mms_bound (n m : ℕ) (hn : 2 ≤ n) (r : ℝ) (hr : 2 ≤ r) (a : ℝ) (ha : 0 < a) (u : Fin m → ℝ) (hu : ∀ g, u g = a ∨ u g = r*a) (S : Finset (Fin m)) (hs : n * S.card ≤ m + n - 1) (hh : n * ((S.filter fun g => u g = r*a).card) ≤ ((Finset.univ.filter fun g => u g = r*a).card) + n - 1) : additive_valuation u S ≤ ((r+1)/2) * chore_maximin_share n u
balanced_high_count_many_chores_mms_boundIn LeanFair Division
Let n be at least two, r at least one and a positive. Suppose there are m bivalued chores of costs a or r*a, with (r-1)*m at least 2*r*n. A bundle whose total and high-cost counts each round their population averages up by less than one costs at most (r+1)/2 times the n-agent chore maximin share.
theorem balanced_high_count_many_chores_mms_bound (n m : ℕ) (hn : 2 ≤ n) (r : ℝ) (hr : 1 ≤ r) (hm : (r-1)*(m:ℝ) ≥ 2*r*(n:ℝ)) (a : ℝ) (ha : 0 < a) (u : Fin m → ℝ) (hu : ∀ g, u g = a ∨ u g = r*a) (S : Finset (Fin m)) (hs : n * S.card ≤ m + n - 1) (hh : n * ((S.filter fun g => u g = r*a).card) ≤ ((Finset.univ.filter fun g => u g = r*a).card) + n - 1) : additive_valuation u S ≤ ((r+1)/2) * chore_maximin_share n u
balanced_high_count_two_sub_inv_ratio_mms_boundIn LeanFair Division
For n at least two and m bivalued chores with ratio r at least one and positive base a, a bundle whose total and high-cost counts each round their population averages up by less than one costs at most (2-1/r) times the n-agent chore maximin share.
theorem balanced_high_count_two_sub_inv_ratio_mms_bound (n m : ℕ) (hn : 2 ≤ n) (r : ℝ) (hr : 1 ≤ r) (a : ℝ) (ha : 0 < a) (u : Fin m → ℝ) (hu : ∀ g, u g = a ∨ u g = r*a) (S : Finset (Fin m)) (hs : n * S.card ≤ m + n - 1) (hh : n * ((S.filter fun g => u g = r*a).card) ≤ ((Finset.univ.filter fun g => u g = r*a).card) + n - 1) : additive_valuation u S ≤ (2-1/r) * chore_maximin_share n u
bivalued_agent_balanced_exact_mms_partitionIn LeanFair Division
Let r = 1 + 1/k with k >= 1, and let a two-agent chore cost u take only the values 1 and r. Then there is a set S of chores with both |S| and its complement of size at most (m+1)/2, and with both sides costing the agent at most her two-agent chore maximin share.
theorem bivalued_agent_balanced_exact_mms_partition (r : ℝ) (hr1 : 1 ≤ r) (hr2 : r ≤ 2)
(hr : r = 1 ∨ ∃ k : ℕ, 1 ≤ k ∧ r = 1 + 1 / (k : ℝ))
(m : ℕ) (u : Fin m → ℝ) (hu : ∀ g, u g = 1 ∨ u g = r) :
∃ S : Finset (Fin m),
S.card ≤ (m + 1) / 2 ∧ (Finset.univ \ S).card ≤ (m + 1) / 2 ∧
additive_valuation u S ≤ chore_maximin_share 2 u ∧
additive_valuation u (Finset.univ \ S) ≤ chore_maximin_share 2 ubivalued_balanced_count_no_worse_evenIn LeanFair Division
Let h and l be the numbers of a r-cost chores and of 1-cost chores (h + l even). For any way of taking a of the h and b of the l, there is a balanced way (2(a'+b') = h+l, a' <= h, b' <= l) whose more expensive side, costed as a'*(1+1/k) + b' versus (h-a')*(1+1/k) + (l-b'), is no larger.
theorem bivalued_balanced_count_no_worse_even (k h l : ℕ) (hk : 1 ≤ k) (hpar : (h + l) % 2 = 0)
(a b : ℕ) (ha : a ≤ h) (hb : b ≤ l) :
∃ a' b' : ℕ, a' ≤ h ∧ b' ≤ l ∧ 2 * (a' + b') = h + l ∧
max ((a' : ℝ) * (1 + 1 / (k : ℝ)) + (b' : ℝ))
(((h - a' : ℕ) : ℝ) * (1 + 1 / (k : ℝ)) + ((l - b' : ℕ) : ℝ)) ≤
max ((a : ℝ) * (1 + 1 / (k : ℝ)) + (b : ℝ))
(((h - a : ℕ) : ℝ) * (1 + 1 / (k : ℝ)) + ((l - b : ℕ) : ℝ))bivalued_balanced_count_no_worse_oddIn LeanFair Division
Let h and l be the numbers of r-cost and 1-cost chores with h + l odd. For any way of taking a of the h and b of the l, there is an almost-balanced way (2(a'+b') is h+l-1 or h+l+1, a' <= h, b' <= l) whose more expensive side is no larger.
theorem bivalued_balanced_count_no_worse_odd (k h l : ℕ) (hk : 1 ≤ k) (hpar : (h + l) % 2 = 1)
(a b : ℕ) (ha : a ≤ h) (hb : b ≤ l) :
∃ a' b' : ℕ, a' ≤ h ∧ b' ≤ l ∧ (2 * (a' + b') + 1 = h + l ∨ 2 * (a' + b') = h + l + 1) ∧
max ((a' : ℝ) * (1 + 1 / (k : ℝ)) + (b' : ℝ))
(((h - a' : ℕ) : ℝ) * (1 + 1 / (k : ℝ)) + ((l - b' : ℕ) : ℝ)) ≤
max ((a : ℝ) * (1 + 1 / (k : ℝ)) + (b : ℝ))
(((h - a : ℕ) : ℝ) * (1 + 1 / (k : ℝ)) + ((l - b : ℕ) : ℝ))bivalued_efx_gadget_allocation_existsIn LeanFair Division
For any R ≥ 2 and h ≥ 1, with n = 1 + (R + 3)h and d = 2(R + 1)h, there exists an allocation σ of the 2d goods among the n agents such that σ is EFX for the bivalued valuation u and agent 0's bundle has additive value at most R.
theorem bivalued_efx_gadget_allocation_exists (R : ℕ) (hR : 2 ≤ R) (h : ℕ) (hh : 1 ≤ h) :
let n := 1 + (R + 3) * h
let d := 2 * (R + 1) * h
let u : Fin n → Fin (2 * d) → ℝ := fun _ g => if (g : ℕ) < d then (R : ℝ) else 1
∃ σ : Fin (2 * d) → Fin n,
is_efx_goods u σ ∧
additive_valuation (u 0) (bundle_of σ 0) ≤ (R : ℝ)bivalued_efx_gadget_mms_lowerIn LeanFair Division
On 2d goods where the first d goods have value R and the remaining d goods have value 1, the 1-out-of-d maximin share under additive valuation is at least R + 1, certified by the partition pairing good k with good d + k.
theorem bivalued_efx_gadget_mms_lower (d R : ℕ) (hd : 1 ≤ d) :
(R : ℝ) + 1 ≤ maximin_share (additive_valuation (fun (g : Fin (2 * d)) => if (g : ℕ) < d then (R : ℝ) else 1)) dbivalued_efx_sub_mms_instance_le_const_mul_agentsIn LeanFair Division
For R ≥ 2, any bivalued instance with n agents admitting an EFX allocation in which some agent's bundle is worth less than her 1-out-of-d maximin share satisfies d ≤ n · 2(R+1)/(R+3).
theorem bivalued_efx_sub_mms_instance_le_const_mul_agents (n R d : ℕ) (hR : 2 ≤ R)
(h : has_bivalued_efx_sub_mms_instance n R d) :
(d : ℝ) ≤ (n : ℝ) * (2 * ((R : ℝ) + 1) / ((R : ℝ) + 3))bivalued_efx_sub_mms_instance_witness_sanityIn LeanFair Division
With two agents and item values in {1,2}, there is an instance whose complete EFX allocation leaves an agent below her 1-out-of-1 maximin share; concretely with a single item of value 1 for one agent and the other agent's bundle, an agent is envious only up to a good but still fails 1-out-of-1 MMS.
theorem bivalued_efx_sub_mms_instance_witness_sanity :
has_bivalued_efx_sub_mms_instance 2 2 1bivalued_efx_sub_mms_lower_boundIn LeanFair Division
For R ≥ 2 and n ≥ 4R+10, the extremal denominator is at least n·2(R+1)/(R+3) minus (2(R+1)+2).
theorem bivalued_efx_sub_mms_lower_bound (n R : ℕ) (hR : 2 ≤ R) (hn : 4 * R + 10 ≤ n) :
(n : ℝ) * (2 * ((R : ℝ) + 1) / ((R : ℝ) + 3)) - (2 * ((R : ℝ) + 1) + 2)
≤ (bivalued_efx_sub_mms_max_d n R : ℝ)bivalued_efx_sub_mms_max_d_ge_of_constructionIn LeanFair Division
If there is a bivalued instance with n = 1+(R+3)h agents and d = 2(R+1)h bundles, then max_d n R ≥ 2(R+1)h.
theorem bivalued_efx_sub_mms_max_d_ge_of_construction (R h : ℕ) (hR : 2 ≤ R) (hh : 1 ≤ h)
(hinst : has_bivalued_efx_sub_mms_instance (1 + (R + 3) * h) R (2 * (R + 1) * h)) :
2 * (R + 1) * h ≤ bivalued_efx_sub_mms_max_d (1 + (R + 3) * h) Rbivalued_efx_sub_mms_max_d_mono_agentsIn LeanFair Division
The extremal ordinal MMS denominator for bivalued EFX instances is monotone in the number of agents: for R ≥ 2 and n ≤ n', max_d n R ≤ max_d n' R.
theorem bivalued_efx_sub_mms_max_d_mono_agents (R : ℕ) (hR : 2 ≤ R) {n n' : ℕ} (hnn : n ≤ n') :
bivalued_efx_sub_mms_max_d n R ≤ bivalued_efx_sub_mms_max_d n' Rbivalued_efx_sub_mms_tendsto_of_boundsIn LeanFair Division
If max_d n R ≤ n·α for all n and max_d n R ≥ n·α − C for all n ≥ 4R+10, then max_d n R / n tends to α = 2(R+1)/(R+3).
theorem bivalued_efx_sub_mms_tendsto_of_bounds (R : ℕ) (hR : 2 ≤ R)
(hupper : ∀ n : ℕ, (bivalued_efx_sub_mms_max_d n R : ℝ)
≤ (n : ℝ) * (2 * ((R : ℝ) + 1) / ((R : ℝ) + 3)))
(hlower : ∀ n : ℕ, 4 * R + 10 ≤ n →
(n : ℝ) * (2 * ((R : ℝ) + 1) / ((R : ℝ) + 3)) - (2 * ((R : ℝ) + 1) + 2)
≤ (bivalued_efx_sub_mms_max_d n R : ℝ)) :
Filter.Tendsto (fun n : ℕ => ((bivalued_efx_sub_mms_max_d n R : ℝ)) / (n : ℝ))
Filter.atTop (nhds (2 * (R + 1 : ℝ) / (R + 3 : ℝ)))bivalued_efx_sub_mms_upper_boundIn LeanFair Division
For R ≥ 2 and every n, bivalued_efx_sub_mms_max_d n R ≤ n · 2(R+1)/(R+3).
theorem bivalued_efx_sub_mms_upper_bound (n R : ℕ) (hR : 2 ≤ R) :
(bivalued_efx_sub_mms_max_d n R : ℝ) ≤ (n : ℝ) * (2 * ((R : ℝ) + 1) / ((R : ℝ) + 3))bivalued_sharp_lower_bound_mms_le_twoIn LeanFair Division
For any n ≥ 2, 1 < r ≤ 2, and agent i, the chore maximin share in the bivalued lower-bound instance is at most 2, achieved by a partition that pairs agent i's two cost-1 chores together in bundle 0 and gives each remaining chore its own bundle.
theorem bivalued_sharp_lower_bound_mms_le_two
(n : ℕ) (hn : 2 ≤ n) (r : ℝ) (hr1 : 1 < r) (hr2 : r ≤ 2) (i : Fin n) :
chore_maximin_share n (bivalued_sharp_lower_bound_cost n r i) ≤ 2bivalued_sharp_lower_bound_mms_nonnegIn LeanFair Division
For any n ≥ 2 and r > 1, each agent's chore maximin share in the bivalued lower-bound instance is nonnegative because every chore cost is positive.
theorem bivalued_sharp_lower_bound_mms_nonneg
(n : ℕ) (hn : 2 ≤ n) (r : ℝ) (hr1 : 1 < r) (i : Fin n) :
0 ≤ chore_maximin_share n (bivalued_sharp_lower_bound_cost n r i)bivalued_sharp_lower_bound_not_assigned_last_cost_geIn LeanFair Division
For n ≥ 2 and r > 1, any allocation σ assigning chore 1 to agent n-1 has some agent i whose bundle has total cost at least r + 1: either agent n-1 receives at least 2 chores (one being chore 1 of cost r), or agent n-1 receives only chore 1, in which case by pigeonhole some agent j < n-1 receives at least 2 chores (chore 1 is not in j's bundle, so at most one chore has cost 1).
theorem bivalued_sharp_lower_bound_not_assigned_last_cost_ge
(n : ℕ) (hn : 2 ≤ n) (r : ℝ) (hr1 : 1 < r)
(σ : Fin (n + 1) → Fin n) (hσ : σ ⟨1, by omega⟩ = ⟨n - 1, by omega⟩) :
∃ i : Fin n, r + 1 ≤ additive_valuation (bivalued_sharp_lower_bound_cost n r i) (bundle_of σ i)bivalued_two_agent_efx_envy_free_one_sideIn LeanFair Division
For real r > 1 and natural numbers n1, n2, n3, n4, unless n1 = n2 = n4 = 0 and n3 is odd, there is a two-agent allocation in one of three weight-tie families in which agent 1 is envy-free, agent 0 is envy-free up to any good, and the unweighted welfare difference is nonnegative. Goods are of four types LL, LH, HL, HH, worth (1,1), (1,r), (r,1), (r,r) to agents 0 and 1, with n1, n2, n3, n4 goods of each type; agent 0 receives a ≤ n1, b ≤ n2, c ≤ n3, d ≤ n4 of them, inside one of the three weight-tie families (b = 0 ∧ c = n3) ∨ (a = 0 ∧ b = 0 ∧ d = 0) ∨ (a = n1 ∧ c = n3 ∧ d = n4). U0 = a + b + r·c + r·d and U1 = (n1−a) + (n2−b) + r·(n3−c) + r·(n4−d) are agent 0's values of its own and of agent 1's bundle (natural-number subtractions cast to ℝ); V0 = a + r·b + c + r·d and V1 = (n1−a) + r·(n2−b) + (n3−c) + r·(n4−d) are agent 1's values of agent 0's and of its own bundle. L0 = 1 if (n1 − a) + (n2 − b) ≥ 1, else r if (n3 − c) + (n4 − d) ≥ 1, else 0 (agent 0's value of the least valuable good in agent 1's bundle). Conclusion: U1 ≤ U0 + L0 ∧ V0 ≤ V1 ∧ 0 ≤ (U0 − U1) + (V1 − V0).
theorem bivalued_two_agent_efx_envy_free_one_side (n1 n2 n3 n4 : ℕ) (r : ℝ) (hr : 1 < r)
(hn : ¬ (n1 = 0 ∧ n2 = 0 ∧ n4 = 0 ∧ n3 % 2 = 1)) :
∃ a b c d : ℕ, a ≤ n1 ∧ b ≤ n2 ∧ c ≤ n3 ∧ d ≤ n4 ∧
((b = 0 ∧ c = n3) ∨ (a = 0 ∧ b = 0 ∧ d = 0) ∨ (a = n1 ∧ c = n3 ∧ d = n4)) ∧
(let U0 : ℝ := (a : ℝ) + (b : ℝ) + r * (c : ℝ) + r * (d : ℝ)
let U1 : ℝ := ((n1 - a : ℕ) : ℝ) + ((n2 - b : ℕ) : ℝ) + r * ((n3 - c : ℕ) : ℝ)
+ r * ((n4 - d : ℕ) : ℝ)
let V0 : ℝ := (a : ℝ) + r * (b : ℝ) + (c : ℝ) + r * (d : ℝ)
let V1 : ℝ := ((n1 - a : ℕ) : ℝ) + r * ((n2 - b : ℕ) : ℝ) + ((n3 - c : ℕ) : ℝ)
+ r * ((n4 - d : ℕ) : ℝ)
let L0 : ℝ := if (n1 - a) + (n2 - b) ≥ 1 then 1 else if (n3 - c) + (n4 - d) ≥ 1 then r else 0
U1 ≤ U0 + L0 ∧ V0 ≤ V1 ∧ 0 ≤ (U0 - U1) + (V1 - V0))bivalued_two_agent_efx_envy_free_zero_sideIn LeanFair Division
For real r > 1 and natural numbers n1, n2, n3, n4, unless n1 = n3 = n4 = 0 and n2 is odd, there is a two-agent allocation in one of three weight-tie families in which agent 0 is envy-free, agent 1 is envy-free up to any good, and the unweighted welfare difference is nonnegative. Goods are of four types LL, LH, HL, HH, worth (1,1), (1,r), (r,1), (r,r) to agents 0 and 1, with n1, n2, n3, n4 goods of each type; agent 0 receives a ≤ n1, b ≤ n2, c ≤ n3, d ≤ n4 of them, inside one of the three weight-tie families (b = 0 ∧ c = n3) ∨ (a = 0 ∧ b = 0 ∧ d = 0) ∨ (a = n1 ∧ c = n3 ∧ d = n4). U0 = a + b + r·c + r·d and U1 = (n1−a) + (n2−b) + r·(n3−c) + r·(n4−d) are agent 0's values of its own and of agent 1's bundle (natural-number subtractions cast to ℝ); V0 = a + r·b + c + r·d and V1 = (n1−a) + r·(n2−b) + (n3−c) + r·(n4−d) are agent 1's values of agent 0's and of its own bundle. L1 = 1 if a + c ≥ 1, else r if b + d ≥ 1, else 0 (agent 1's value of the least valuable good in agent 0's bundle). Conclusion: U1 ≤ U0 ∧ V0 ≤ V1 + L1 ∧ 0 ≤ (U0 − U1) + (V1 − V0).
theorem bivalued_two_agent_efx_envy_free_zero_side (n1 n2 n3 n4 : ℕ) (r : ℝ) (hr : 1 < r)
(hn : ¬ (n1 = 0 ∧ n3 = 0 ∧ n4 = 0 ∧ n2 % 2 = 1)) :
∃ a b c d : ℕ, a ≤ n1 ∧ b ≤ n2 ∧ c ≤ n3 ∧ d ≤ n4 ∧
((b = 0 ∧ c = n3) ∨ (a = 0 ∧ b = 0 ∧ d = 0) ∨ (a = n1 ∧ c = n3 ∧ d = n4)) ∧
(let U0 : ℝ := (a : ℝ) + (b : ℝ) + r * (c : ℝ) + r * (d : ℝ)
let U1 : ℝ := ((n1 - a : ℕ) : ℝ) + ((n2 - b : ℕ) : ℝ) + r * ((n3 - c : ℕ) : ℝ)
+ r * ((n4 - d : ℕ) : ℝ)
let V0 : ℝ := (a : ℝ) + r * (b : ℝ) + (c : ℝ) + r * (d : ℝ)
let V1 : ℝ := ((n1 - a : ℕ) : ℝ) + r * ((n2 - b : ℕ) : ℝ) + ((n3 - c : ℕ) : ℝ)
+ r * ((n4 - d : ℕ) : ℝ)
let L1 : ℝ := if a + c ≥ 1 then 1 else if b + d ≥ 1 then r else 0
U1 ≤ U0 ∧ V0 ≤ V1 + L1 ∧ 0 ≤ (U0 - U1) + (V1 - V0))bivalued_two_agent_efx_envy_free_zero_side_f1In LeanFair Division
For real r > 1 and natural numbers n1, n2, n3, n4, in the intermediate regime where Family 2 contains no envy-free allocation for agent 0 but allocating all LL, HL, and HH goods makes agent 0 envy-free, there exists an allocation in Family 1 (b=0, c=n3) satisfying agent 0 envy-freeness, agent 1 EFX, and nonnegative welfare difference.
theorem bivalued_two_agent_efx_envy_free_zero_side_f1
(n1 n2 n3 n4 : ℕ) (r : ℝ) (hr : 1 < r)
(hf2 : ∀ c ≤ n3, r * (c : ℝ) < (n1 : ℝ) + (n2 : ℝ) + r * ((n3 - c : ℕ) : ℝ) + r * (n4 : ℝ))
(hf3 : (n2 : ℝ) ≤ (n1 : ℝ) + r * (n3 : ℝ) + r * (n4 : ℝ)) :
∃ a b c d : ℕ, a ≤ n1 ∧ b ≤ n2 ∧ c ≤ n3 ∧ d ≤ n4 ∧
((b = 0 ∧ c = n3) ∨ (a = 0 ∧ b = 0 ∧ d = 0) ∨ (a = n1 ∧ c = n3 ∧ d = n4)) ∧
(let U0 : ℝ := (a : ℝ) + (b : ℝ) + r * (c : ℝ) + r * (d : ℝ)
let U1 : ℝ := ((n1 - a : ℕ) : ℝ) + ((n2 - b : ℕ) : ℝ) + r * ((n3 - c : ℕ) : ℝ)
+ r * ((n4 - d : ℕ) : ℝ)
let V0 : ℝ := (a : ℝ) + r * (b : ℝ) + (c : ℝ) + r * (d : ℝ)
let V1 : ℝ := ((n1 - a : ℕ) : ℝ) + r * ((n2 - b : ℕ) : ℝ) + ((n3 - c : ℕ) : ℝ)
+ r * ((n4 - d : ℕ) : ℝ)
let L1 : ℝ := if a + c ≥ 1 then 1 else if b + d ≥ 1 then r else 0
U1 ≤ U0 ∧ V0 ≤ V1 + L1 ∧ 0 ≤ (U0 - U1) + (V1 - V0))bivalued_two_agent_efx_envy_free_zero_side_f2In LeanFair Division
For real r > 1 and natural numbers n1, n2, n3, n4, if some allocation in Family 2 (a=0, b=0, d=0, c <= n3) makes agent 0 envy-free, then there exists an allocation in the three families satisfying agent 0 envy-freeness, agent 1 EFX, and nonnegative welfare difference.
theorem bivalued_two_agent_efx_envy_free_zero_side_f2
(n1 n2 n3 n4 : ℕ) (r : ℝ) (hr : 1 < r)
(hc : ∃ c ≤ n3,
((n1 : ℝ) + (n2 : ℝ) + r * ((n3 - c : ℕ) : ℝ) + r * (n4 : ℝ) ≤ r * (c : ℝ))) :
∃ a b c d : ℕ, a ≤ n1 ∧ b ≤ n2 ∧ c ≤ n3 ∧ d ≤ n4 ∧
((b = 0 ∧ c = n3) ∨ (a = 0 ∧ b = 0 ∧ d = 0) ∨ (a = n1 ∧ c = n3 ∧ d = n4)) ∧
(let U0 : ℝ := (a : ℝ) + (b : ℝ) + r * (c : ℝ) + r * (d : ℝ)
let U1 : ℝ := ((n1 - a : ℕ) : ℝ) + ((n2 - b : ℕ) : ℝ) + r * ((n3 - c : ℕ) : ℝ)
+ r * ((n4 - d : ℕ) : ℝ)
let V0 : ℝ := (a : ℝ) + r * (b : ℝ) + (c : ℝ) + r * (d : ℝ)
let V1 : ℝ := ((n1 - a : ℕ) : ℝ) + r * ((n2 - b : ℕ) : ℝ) + ((n3 - c : ℕ) : ℝ)
+ r * ((n4 - d : ℕ) : ℝ)
let L1 : ℝ := if a + c ≥ 1 then 1 else if b + d ≥ 1 then r else 0
U1 ≤ U0 ∧ V0 ≤ V1 + L1 ∧ 0 ≤ (U0 - U1) + (V1 - V0))bivalued_two_agent_efx_envy_free_zero_side_f3In LeanFair Division
For real r > 1 and natural numbers n1, n2, n3, n4, if agent 0 remains envious even after receiving all LL, HL, and HH goods, choosing minimal b in Family 3 (a=n1, c=n3, d=n4) satisfies agent 0 envy-freeness, agent 1 EFX, and nonnegative welfare difference, using hn to avoid the excluded odd all-LH case.
theorem bivalued_two_agent_efx_envy_free_zero_side_f3
(n1 n2 n3 n4 : ℕ) (r : ℝ) (hr : 1 < r)
(hn : ¬ (n1 = 0 ∧ n3 = 0 ∧ n4 = 0 ∧ n2 % 2 = 1))
(h_cond : (n1 : ℝ) + r * (n3 : ℝ) + r * (n4 : ℝ) < (n2 : ℝ)) :
∃ a b c d : ℕ, a ≤ n1 ∧ b ≤ n2 ∧ c ≤ n3 ∧ d ≤ n4 ∧
((b = 0 ∧ c = n3) ∨ (a = 0 ∧ b = 0 ∧ d = 0) ∨ (a = n1 ∧ c = n3 ∧ d = n4)) ∧
(let U0 : ℝ := (a : ℝ) + (b : ℝ) + r * (c : ℝ) + r * (d : ℝ)
let U1 : ℝ := ((n1 - a : ℕ) : ℝ) + ((n2 - b : ℕ) : ℝ) + r * ((n3 - c : ℕ) : ℝ)
+ r * ((n4 - d : ℕ) : ℝ)
let V0 : ℝ := (a : ℝ) + r * (b : ℝ) + (c : ℝ) + r * (d : ℝ)
let V1 : ℝ := ((n1 - a : ℕ) : ℝ) + r * ((n2 - b : ℕ) : ℝ) + ((n3 - c : ℕ) : ℝ)
+ r * ((n4 - d : ℕ) : ℝ)
let L1 : ℝ := if a + c ≥ 1 then 1 else if b + d ≥ 1 then r else 0
U1 ≤ U0 ∧ V0 ≤ V1 + L1 ∧ 0 ≤ (U0 - U1) + (V1 - V0))bivalued_two_agent_efx_family_feasible_allIn LeanFair Division
For every r > 1, every positive scales a0, a1 and every type counts n1, n2, n3, n4, the EFX two-agent family arithmetic bivalued_two_agent_efx_family_feasible n1 n2 n3 n4 r a0 a1 holds: some allocation from one of the three weight-tie families is EFX for the normalized values and meets the subsidy aggregate inequality.
theorem bivalued_two_agent_efx_family_feasible_all (r a0 a1 : ℝ) (hr : 1 < r) (h0 : 0 < a0) (h1 : 0 < a1)
(n1 n2 n3 n4 : ℕ) : bivalued_two_agent_efx_family_feasible n1 n2 n3 n4 r a0 a1bivalued_two_agent_family_feasible_sanityIn LeanFair Division
Non-vacuity of the arithmetic predicate: it holds for one good of each of the four types with r = 2 and equal scales, and it holds for the empty instance.
theorem bivalued_two_agent_family_feasible_sanity :
bivalued_two_agent_family_feasible 1 1 1 1 2 1 1 ∧ bivalued_two_agent_family_feasible 0 0 0 0 2 1 1block_snake_draft_rule_satisfies_ef1_nel_aauIn LeanFair Division
For any natural numbers n, k, and r with r < n, and any draw permutation π of Fin n, the draft rule induced by the block-snake sequence block_snake_seq n k r hr π with agent type Fin n and object type Fin (k * n + r) satisfies is_ef1_rule, is_nel_rule, and is_aau_rule.
theorem block_snake_draft_rule_satisfies_ef1_nel_aau (n k r : ℕ) (hr : r < n)
(π : Equiv.Perm (Fin n)) :
is_ef1_rule (draft_rule (Agent := Fin n) (Object := Fin (k * n + r)) (block_snake_seq n k r hr π)) ∧
is_nel_rule (draft_rule (Agent := Fin n) (Object := Fin (k * n + r)) (block_snake_seq n k r hr π)) ∧
is_aau_rule (draft_rule (Agent := Fin n) (Object := Fin (k * n + r)) (block_snake_seq n k r hr π))bundle_card_succ_countIn LeanFair Division
For n > 0, r < n, a non-wasteful EF1 rule on n agents and k * n + r objects gives exactly r agents bundles of size k + 1, and the remaining n - r agents bundles of size k.
theorem bundle_card_succ_count (n k r : ℕ) (hn : 0 < n) (hr : r < n)
(f : (Fin n → LinearOrder (Fin (k * n + r))) → Fin n → Finset (Fin (k * n + r)))
(h_alloc : is_allocation_rule f) (h_nw : is_non_wasteful_rule f) (h_ef1 : is_ef1_rule f)
(succ : Fin n → LinearOrder (Fin (k * n + r))) :
(Finset.univ.filter (fun i : Fin n => (f succ i).card = k + 1)).card = rcard_fun_perm_eqIn LeanFair Division
The number of preference profiles for n agents each ranking m goods strictly is (m!)^n.
theorem card_fun_perm_eq (n m : ℕ) :
Fintype.card (Fin n → Fin m ≃ Fin m) = (Nat.factorial m) ^ nchore_insertion_bundle_valuation_eq_sumIn LeanFair Division
The additive valuation of agent j's bundle under chore_insertion_allocation σ c m from the perspective of agent i equals the sum of costs c i (slots k) over all slots k < m owned by agent j (where σ k = j).
theorem chore_insertion_bundle_valuation_eq_sum {n : ℕ} (σ : ℕ → Fin n) (c : Fin n → ℕ → ℝ) (m : ℕ) (i j : Fin n) :
additive_valuation (fun (d : Fin m) => c i d.val) (bundle_of (chore_insertion_allocation σ c m) j) =
∑ k ∈ (Finset.range m).filter (fun k => σ k = j), c i (chore_insertion_slots σ c m k)chore_insertion_slots_cost_le_of_ltIn LeanFair Division
For any picking sequence σ, cost profile c, and prefix length m, any earlier slot k < l < m holds a chore that is weakly cheaper for slot k's owner σ k than the chore in slot l.
theorem chore_insertion_slots_cost_le_of_lt {n : ℕ} (σ : ℕ → Fin n) (c : Fin n → ℕ → ℝ) (m : ℕ) (k l : ℕ) (hkl : k < l) (hl : l < m) :
c (σ k) (chore_insertion_slots σ c m k) ≤ c (σ k) (chore_insertion_slots σ c m l)collinear_six_class_convexIn LeanFair Division
If two bit functions b1, b2 on {0,...,5} are each monotone or antitone, then every class of the pair (b1,b2) is an interval: if indices i ≤ j ≤ k have the same pair of bits at i and at k, they have that pair at j as well.
theorem collinear_six_class_convex (b1 b2 : Fin 6 → Bool)
(h1 : Monotone b1 ∨ Antitone b1) (h2 : Monotone b2 ∨ Antitone b2) :
∀ i j k : Fin 6, i ≤ j → j ≤ k → (b1 i, b2 i) = (b1 k, b2 k) →
(b1 j, b2 j) = (b1 i, b2 i)collinear_six_not_two_cuts_carrierIn LeanFair Division
Let ℓ contain all six points (0,0),...,(5,0) -- so ℓ is the x-axis and its side bit is free at every point -- and let m be another line that does not contain them all. Then no choice of bits s and allocation α consistent with (ℓ,m) gives every agent exactly one red and one blue point.
theorem collinear_six_not_two_cuts_carrier (ℓ m : StraightLine) (α : (ℝ × ℝ) → Fin 3)
(s : StraightLine → (ℝ × ℝ) → Bool)
(hcarrier : ∀ i : Fin 6, ℓ.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = 0)
(hne_m : ∃ i : Fin 6, m.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) ≠ 0)
(hsign : ∀ (ℓ' : StraightLine), (ℓ' = ℓ ∨ ℓ' = m) → ∀ i : Fin 6,
(0 < ℓ'.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) →
s ℓ' ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = true) ∧
(ℓ'.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) < 0 →
s ℓ' ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = false))
(hcons : ∀ i j : Fin 6,
s ℓ ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = s ℓ ((((j : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) →
s m ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = s m ((((j : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) →
α ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = α ((((j : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ))
(hfair : ∀ a : Fin 3,
(collinear_six_points.filter (fun p => α p = a ∧ collinear_six_coloring p = 0)).card = 1 ∧
(collinear_six_points.filter (fun p => α p = a ∧ collinear_six_coloring p = 1)).card = 1) :
Falsecollinear_six_not_two_cuts_non_carrierIn LeanFair Division
Let ℓ and m be two straight lines, neither of which contains any of the six points (0,0),...,(5,0) -- equivalently both cut functionals are nonzero at all six points. If s is a choice of side bits consistent with ℓ and m, α is an allocation consistent with (ℓ,m) on the six points, and every agent gets exactly one red and one blue point, then contradiction.
theorem collinear_six_not_two_cuts_non_carrier (ℓ m : StraightLine) (α : (ℝ × ℝ) → Fin 3)
(s : StraightLine → (ℝ × ℝ) → Bool)
(hne_ℓ : ∃ i : Fin 6, ℓ.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) ≠ 0)
(hne_m : ∃ i : Fin 6, m.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) ≠ 0)
(hsign : ∀ (ℓ' : StraightLine), (ℓ' = ℓ ∨ ℓ' = m) → ∀ i : Fin 6,
(0 < ℓ'.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) →
s ℓ' ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = true) ∧
(ℓ'.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) < 0 →
s ℓ' ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = false))
(hcons : ∀ i j : Fin 6,
s ℓ ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = s ℓ ((((j : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) →
s m ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = s m ((((j : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) →
α ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = α ((((j : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ))
(hfair : ∀ a : Fin 3,
(collinear_six_points.filter (fun p => α p = a ∧ collinear_six_coloring p = 0)).card = 1 ∧
(collinear_six_points.filter (fun p => α p = a ∧ collinear_six_coloring p = 1)).card = 1) :
Falsecollinear_six_points_card_and_colorsIn LeanFair Division
The set {(0,0),...,(5,0)} has six elements, of which exactly three are coloured red (x < 3) and three blue (x ≥ 3).
theorem collinear_six_points_card_and_colors :
collinear_six_points.card = 6 ∧
(collinear_six_points.filter (fun p => collinear_six_coloring p = 0)).card = 3 ∧
(collinear_six_points.filter (fun p => collinear_six_coloring p = 1)).card = 3collinear_six_sign_bit_monotoneIn LeanFair Division
Let ℓ be a straight line and s a choice of side bit consistent with ℓ (true strictly above, false strictly below). If ℓ does not contain all six points (0,0),...,(5,0), then the six bits s ℓ (i,0), for i = 0..5, are either nondecreasing or nonincreasing in i. In other words each line induces at most one side change along the collinear set, not an arbitrary pattern.
theorem collinear_six_sign_bit_monotone (ℓ : StraightLine)
(s : StraightLine → (ℝ × ℝ) → Bool)
(hs : ∀ i : Fin 6,
(0 < ℓ.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) →
s ℓ ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = true) ∧
(ℓ.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) < 0 →
s ℓ ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) = false))
(hne : ∃ i : Fin 6, ℓ.cut ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ) ≠ 0) :
Monotone (fun i : Fin 6 => s ℓ ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ)) ∨
Antitone (fun i : Fin 6 => s ℓ ((((i : ℕ) : ℝ), (0 : ℝ)) : ℝ × ℝ))const_zero_is_consistentIn LeanFair Division
In the two-agent chore allocation setting, the algorithm assigning every chore to agent 0 is a consistent online allocator.
lemma const_zero_is_consistent :
is_consistent_online_allocator (fun _m _c _t => 0)critical_balanced_chore_splitIn LeanFair Division
For n at least four, there are 2n+1 chores and each of n agents designates n+1 chores high. There exist a chore e that is low for at least one agent and a set A of n other chores such that: every agent for whom e is high has at least two low chores in A and at least two low chores outside A and e; every agent for whom e is low has at least one low chore in each of those two sets.
theorem critical_balanced_chore_split (n : ℕ) (hn : 4 ≤ n) (H : Fin n → Finset (Fin (2*n+1))) (hH : ∀ i, (H i).card = n+1) : ∃ (e : Fin (2*n+1)) (A : Finset (Fin (2*n+1))), A.card = n ∧ e ∉ A ∧ (∃ i, e ∉ H i) ∧ ∀ i, (if e ∈ H i then 2 else 1) ≤ (((Finset.univ \ H i) ∩ A).card) ∧ (if e ∈ H i then 2 else 1) ≤ (((Finset.univ \ H i) \ (insert e A)).card)
critical_balanced_chore_split_fourIn LeanFair Division
For n equal to four, there are 2n+1 chores and each of n agents designates n+1 chores high. There exist a chore e that is low for at least one agent and a set A of n other chores such that: every agent for whom e is high has at least two low chores in A and at least two low chores outside A and e; every agent for whom e is low has at least one low chore in each of those two sets.
theorem critical_balanced_chore_split_four (n : ℕ) (hn : n = 4) (H : Fin n → Finset (Fin (2*n+1))) (hH : ∀ i, (H i).card = n+1) : ∃ (e : Fin (2*n+1)) (A : Finset (Fin (2*n+1))), A.card = n ∧ e ∉ A ∧ (∃ i, e ∉ H i) ∧ ∀ i, (if e ∈ H i then 2 else 1) ≤ (((Finset.univ \ H i) ∩ A).card) ∧ (if e ∈ H i then 2 else 1) ≤ (((Finset.univ \ H i) \ (insert e A)).card)
critical_equal_weight_allocation_familyIn LeanFair Division
For n at least three and 2n+1 chores, suppose every agent designates n+1 chores high. There exist n allocations such that every chore goes once to each agent across the allocations, agent i receives three chores in round i and two in every other round, and her three-chore bundle in round i contains at most one chore she designates high.
theorem critical_equal_weight_allocation_family (n : ℕ) (hn : 3 ≤ n) (H : Fin n → Finset (Fin (2*n+1))) (hH : ∀ i, (H i).card = n+1) : ∃ F : Fin n → Fin (2*n+1) → Fin n, (∀ g, Function.Bijective (fun t => F t g)) ∧ (∀ t i, (bundle_of (F t) i).card = if i = t then 3 else 2) ∧ ∀ t, ((bundle_of (F t) t) ∩ H t).card ≤ 1
critical_equal_weight_allocation_family_at_least_fourIn LeanFair Division
For n at least four and 2n+1 chores, suppose every agent designates n+1 chores high. There exist n allocations such that every chore goes once to each agent across the allocations, agent i receives three chores in round i and two in every other round, and her three-chore bundle in round i contains at most one chore she designates high.
theorem critical_equal_weight_allocation_family_at_least_four (n : ℕ) (hn : 4 ≤ n) (H : Fin n → Finset (Fin (2*n+1))) (hH : ∀ i, (H i).card = n+1) : ∃ F : Fin n → Fin (2*n+1) → Fin n, (∀ g, Function.Bijective (fun t => F t g)) ∧ (∀ t i, (bundle_of (F t) i).card = if i = t then 3 else 2) ∧ ∀ t, ((bundle_of (F t) t) ∩ H t).card ≤ 1
critical_good_pairing_at_least_elevenIn LeanFair Division
For n at least eleven with 2n+1 chores and n+1 high chores per agent, one can choose an extra chore that is low for some agent and pair all remaining chores so that every agent has at least two pairs which, together with the extra chore, contain at most one high chore.
theorem critical_good_pairing_at_least_eleven (n : ℕ) (hn : 11 ≤ n) (H : Fin n → Finset (Fin (2*n+1))) (hH : ∀ i, (H i).card = n+1) : ∃ (e : Fin (2*n+1)) (p : Equiv.Perm (Fin (2*n+1))), p e = e ∧ (∀ g, g ≠ e → p g ≠ g) ∧ (∀ g, p (p g) = g) ∧ (∃ i, e ∉ H i) ∧ ∀ i, 2 ≤ (Finset.univ.filter (fun g => g < p g ∧ if e ∈ H i then g ∉ H i ∧ p g ∉ H i else g ∉ H i ∨ p g ∉ H i)).card
cyclic_remainder_low_quota_allocation_familyIn LeanFair Division
For n at least three, K at least two and 1<=s<n, let m=(K-1)n+s and let every agent designate an arbitrary set of low chores. There are n allocations in which each chore visits each agent once, agent i receives K chores in round t exactly when (i+n-t) modulo n is less than s and K-1 otherwise, and every K-chore bundle of agent i contains at least max(0, min(K,floor(number of her designated lows / s))-floor(K/2)) designated lows.
theorem cyclic_remainder_low_quota_allocation_family (n K s : ℕ) (hn : 3 ≤ n) (hK : 2 ≤ K) (hs1 : 1 ≤ s) (hsn : s < n) (L : Fin n → Finset (Fin ((K-1)*n+s))) : ∃ F : Fin n → Fin ((K-1)*n+s) → Fin n, (∀ g, Function.Bijective (fun t => F t g)) ∧ (∀ t i, (bundle_of (F t) i).card = if (i.val+n-t.val)%n < s then K else K-1) ∧ ∀ t i, (i.val+n-t.val)%n < s → min K ((L i).card / s) - K/2 ≤ ((bundle_of (F t) i ∩ L i).card)
draft_alloc_biUnionIn LeanFair Division
The draft never wastes an object: if the picking list is exactly as long as the set of remaining objects, the union of all final bundles is the whole remaining set.
theorem draft_alloc_biUnion {Agent Object : Type*} [Fintype Agent] [DecidableEq Agent]
[DecidableEq Object] (succ : Agent → LinearOrder Object) (l : List Agent)
(rem : Finset Object) (hlen : l.length = rem.card) :
Finset.univ.biUnion (draft_alloc succ l rem) = remdraft_alloc_objectwise_mmIn LeanFair Division
Objectwise Maskin monotonicity for the draft: if every agent ranks every object strictly below each object she actually receives exactly as before, the draft produces the same allocation.
theorem draft_alloc_objectwise_mm {Agent Object : Type*} [DecidableEq Agent] [DecidableEq Object]
(succ succ' : Agent → LinearOrder Object) (l : List Agent) (rem : Finset Object)
(h : ∀ (i : Agent), ∀ y ∈ draft_alloc succ l rem i, ∀ z : Object,
(succ i).lt z y → (succ' i).lt z y) :
draft_alloc succ' l rem = draft_alloc succ l remdraft_alloc_relabelIn LeanFair Division
Relabelling objects by a permutation σ and relabelling every preference order by σ.symm commutes with the draft: the resulting bundle is the σ-image of the original bundle.
theorem draft_alloc_relabel {Agent Object : Type*} [DecidableEq Agent] [DecidableEq Object]
(σ : Equiv.Perm Object) (succ : Agent → LinearOrder Object) (l : List Agent)
(rem : Finset Object) (i : Agent) :
draft_alloc (fun j => @Equiv.linearOrder Object Object σ.symm (succ j) _)
l (rem.map σ.toEmbedding) i
= (draft_alloc succ l rem i).map σ.toEmbeddingdraft_enum_order_ltIn LeanFair Division
In the order of a unanimous profile induced by e, x is strictly below y exactly when y has the smaller index, i.e. y is the better object.
theorem draft_enum_order_lt {Object : Type*} [DecidableEq Object] {T : ℕ} (e : Object ≃ Fin T) (x y : Object) :
(draft_enum_order e).lt x y ↔ e y < e xdraft_pick_list_specIn LeanFair Division
If the picking list has as many entries as the remaining set has objects, then the draft makes exactly that many picks, no object is picked twice, and the picks are exactly the remaining objects.
theorem draft_pick_list_spec {Agent Object : Type*} [DecidableEq Agent] [DecidableEq Object]
(succ : Agent → LinearOrder Object) (l : List Agent) (rem : Finset Object)
(hlen : l.length = rem.card) :
(draft_pick_list succ l rem).length = l.length ∧
(draft_pick_list succ l rem).Nodup ∧
(draft_pick_list succ l rem).toFinset = remdraft_rule_axiomsIn LeanFair Division
Every draft rule is non-wasteful, neutral, and satisfies objectwise Maskin monotonicity.
theorem draft_rule_axioms {Agent Object : Type*} [Fintype Agent] [Fintype Object]
[DecidableEq Agent] [DecidableEq Object] (s : Fin (Fintype.card Object) → Agent) :
is_non_wasteful_rule (draft_rule (Agent := Agent) (Object := Object) s) ∧
is_neutral_rule (draft_rule (Agent := Agent) (Object := Object) s) ∧
satisfies_objectwise_mm (draft_rule (Agent := Agent) (Object := Object) s)draft_rule_block_snake_characterizationIn LeanFair Division
For any natural numbers n, k, and r with r < n, a draft rule induced by a picking sequence s : Fin (k * n + r) → Fin n (with agent type Fin n and object type Fin (k * n + r)) satisfies is_ef1_rule, is_nel_rule, and is_aau_rule if and only if there exists a permutation π : Equiv.Perm (Fin n) such that s equals the block-snake sequence block_snake_seq n k r hr π.
theorem draft_rule_block_snake_characterization (n k r : ℕ) (hr : r < n)
(s : Fin (k * n + r) → Fin n) :
is_ef1_rule (draft_rule (Agent := Fin n) (Object := Fin (k * n + r)) s) ∧
is_nel_rule (draft_rule (Agent := Fin n) (Object := Fin (k * n + r)) s) ∧
is_aau_rule (draft_rule (Agent := Fin n) (Object := Fin (k * n + r)) s) ↔
∃ π : Equiv.Perm (Fin n), s = block_snake_seq n k r hr πdraft_rule_characterizationIn LeanFair Division
Given finite types Agent and Object with decidable equality on both, a rule f : (Agent -> LinearOrder Object) -> Agent -> Finset Object satisfying is_allocation_rule f is non-wasteful (is_non_wasteful_rule f), neutral (is_neutral_rule f), and satisfies object-wise Maskin monotonicity (satisfies_objectwise_mm f) if and only if there exists a picking sequence s : Fin (Fintype.card Object) -> Agent such that f = draft_rule s.
theorem draft_rule_characterization {Agent Object : Type*}
[Fintype Agent] [Fintype Object] [DecidableEq Agent] [DecidableEq Object]
(f : (Agent → LinearOrder Object) → Agent → Finset Object)
(h_alloc : is_allocation_rule f) :
is_non_wasteful_rule f ∧ is_neutral_rule f ∧ satisfies_objectwise_mm f ↔
∃ s : Fin (Fintype.card Object) → Agent, f = draft_rule sdraft_rule_manipulable_of_separated_picksIn LeanFair Division
If a picking sequence s has an agent i with non-consecutive picks (turns p < q with s p = s q = i separated by an intervening turn m with s m ≠ i), then the draft rule induced by s is not weakly strategy-proof under pairwise dominance.
theorem draft_rule_manipulable_of_separated_picks (n k r : ℕ)
(s : Fin (k * n + r) → Fin n)
(hsep : ∃ (i : Fin n) (p q : Fin (k * n + r)), p < q ∧ s p = i ∧ s q = i ∧
∃ (m : Fin (k * n + r)), p < m ∧ m < q ∧ s m ≠ i) :
¬ is_weakly_strategy_proof_rule (draft_rule (Agent := Fin n) (Object := Fin (k * n + r)) s)draft_rule_of_axiomsIn LeanFair Division
Any allocation rule that is non-wasteful, neutral, and satisfies object-wise Maskin monotonicity is a draft rule for some picking sequence.
theorem draft_rule_of_axioms {Agent Object : Type*}
[Fintype Agent] [Fintype Object] [DecidableEq Agent] [DecidableEq Object]
(f : (Agent → LinearOrder Object) → Agent → Finset Object)
(h_alloc : is_allocation_rule f)
(h_nw : is_non_wasteful_rule f)
(h_neut : is_neutral_rule f)
(h_mm : satisfies_objectwise_mm f) :
∃ s : Fin (Fintype.card Object) → Agent, f = draft_rule sef1_bundle_card_le_succIn LeanFair Division
If a rule is EF1, then at every profile any agent's bundle has cardinality at most one more than any other agent's bundle.
theorem ef1_bundle_card_le_succ {Agent Object : Type*} [DecidableEq Object]
(f : (Agent → LinearOrder Object) → Agent → Finset Object)
(h_ef1 : is_ef1_rule f) (succ : Agent → LinearOrder Object) (i j : Agent) :
(f succ j).card ≤ (f succ i).card + 1ef1_draft_rule_has_separated_picksIn LeanFair Division
For n ≥ 3, k ≥ 2, and r < n, any picking sequence s inducing an EF1 draft rule must contain separated picks (some agent i picks at turns p < q with an intervening turn m belonging to another agent).
theorem ef1_draft_rule_has_separated_picks (n k r : ℕ) (hn : 3 ≤ n) (hk : 2 ≤ k) (hr : r < n)
(s : Fin (k * n + r) → Fin n)
(hef1 : is_ef1_rule (draft_rule (Agent := Fin n) (Object := Fin (k * n + r)) s)) :
∃ (i : Fin n) (p q : Fin (k * n + r)), p < q ∧ s p = i ∧ s q = i ∧
∃ (m : Fin (k * n + r)), p < m ∧ m < q ∧ s m ≠ iefx_allsource_pair_no_0_natIn LeanFair Division
No EFX completion can split only pair 0.
theorem efx_allsource_pair_no_0_nat (q : Fin 6 → Fin 4) : ¬ efx_allsource_pair_feasible_nat (efx_allsource_pair_code 0 q)
efx_allsource_pair_no_1_natIn LeanFair Division
No EFX completion can split only pair 1.
theorem efx_allsource_pair_no_1_nat (q : Fin 6 → Fin 4) : ¬ efx_allsource_pair_feasible_nat (efx_allsource_pair_code 1 q)
efx_allsource_pair_no_2_natIn LeanFair Division
No EFX completion can split only pair 2.
theorem efx_allsource_pair_no_2_nat (q : Fin 6 → Fin 4) : ¬ efx_allsource_pair_feasible_nat (efx_allsource_pair_code 2 q)
efx_allsource_pair_no_3_natIn LeanFair Division
No EFX completion can split only pair 3.
theorem efx_allsource_pair_no_3_nat (q : Fin 6 → Fin 4) : ¬ efx_allsource_pair_feasible_nat (efx_allsource_pair_code 3 q)
efx_allsource_pair_two_splitsIn LeanFair Division
Every complete EFX allocation splits at least two old pairs, even without a utility-preservation condition.
theorem efx_allsource_pair_two_splits (σ : Fin 9 → Fin 4)
(hefx : is_efx_goods (fun i g => (efx_allsource_pair_values i g : ℝ)) σ) :
∃ a b : Fin 4, a ≠ b ∧
σ (![0,2,4,6] a) ≠ σ (![1,3,5,7] a) ∧
σ (![0,2,4,6] b) ≠ σ (![1,3,5,7] b)efx_allsource_three_pair_no_0_natIn LeanFair Division
No EFX completion splits only the original pairs designated by index 0.
theorem efx_allsource_three_pair_no_0_nat (q : Fin 7 → Fin 4) : ¬ efx_allsource_three_pair_feasible_nat (efx_allsource_three_pair_code 0 q)
efx_allsource_three_pair_no_1_natIn LeanFair Division
No EFX completion splits only the original pairs designated by index 1.
theorem efx_allsource_three_pair_no_1_nat (q : Fin 7 → Fin 4) : ¬ efx_allsource_three_pair_feasible_nat (efx_allsource_three_pair_code 1 q)
efx_allsource_three_pair_no_2_natIn LeanFair Division
No EFX completion splits only the original pairs designated by index 2.
theorem efx_allsource_three_pair_no_2_nat (q : Fin 7 → Fin 4) : ¬ efx_allsource_three_pair_feasible_nat (efx_allsource_three_pair_code 2 q)
efx_allsource_three_pair_no_3_natIn LeanFair Division
No EFX completion splits only the original pairs designated by index 3.
theorem efx_allsource_three_pair_no_3_nat (q : Fin 7 → Fin 4) : ¬ efx_allsource_three_pair_feasible_nat (efx_allsource_three_pair_code 3 q)
efx_allsource_three_pair_no_4_natIn LeanFair Division
No EFX completion splits only the original pairs designated by index 4.
theorem efx_allsource_three_pair_no_4_nat (q : Fin 7 → Fin 4) : ¬ efx_allsource_three_pair_feasible_nat (efx_allsource_three_pair_code 4 q)
efx_allsource_three_pair_no_5_natIn LeanFair Division
No EFX completion splits only the original pairs designated by index 5.
theorem efx_allsource_three_pair_no_5_nat (q : Fin 7 → Fin 4) : ¬ efx_allsource_three_pair_feasible_nat (efx_allsource_three_pair_code 5 q)
efx_allsource_three_pair_perturbed_requires_threeIn LeanFair Division
Every complete EFX allocation of the nondegenerate perturbed instance splits at least three old pairs.
theorem efx_allsource_three_pair_perturbed_requires_three (σ : Fin 9 → Fin 4)
(hσ : is_efx_goods (fun i g => (efx_allsource_three_pair_perturbed_values i g : ℝ)) σ) :
∀ a b : Fin 4, a ≠ b →
σ (![0,2,4,6] a) ≠ σ (![1,3,5,7] a) ∨
σ (![0,2,4,6] b) ≠ σ (![1,3,5,7] b)efx_allsource_three_pair_requires_threeIn LeanFair Division
Every complete EFX allocation splits at least three of the four original pairs.
theorem efx_allsource_three_pair_requires_three (σ : Fin 9 → Fin 4)
(hefx : is_efx_goods (fun i g => (efx_allsource_three_pair_values i g : ℝ)) σ) :
∀ a b : Fin 4, a ≠ b →
σ (![0,2,4,6] a) ≠ σ (![1,3,5,7] a) ∨
σ (![0,2,4,6] b) ≠ σ (![1,3,5,7] b)efx_anchor_family_forces_structureIn LeanFair Division
Any individually rational partial EFX allocation in the anchor family has the original seven-good ownership, assigns every lock to agent 3, and assigns exactly r anchors to each original agent.
theorem efx_anchor_family_forces_structure (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s)
(σ : Fin ((7+(r+r+r))+s) → Fin 5)
(hσ : efx_partial_nat (efx_anchor_family_values r s) σ)
(hir : ∀ i : Fin 4, efx_anchor_family_baseline r s i ≤
efx_partial_nat_utility (efx_anchor_family_values r s) σ i) :
(∀ g : Fin 7, σ (Fin.castAdd s (Fin.castAdd (r+r+r) g)) =
![(1 : Fin 5),0,0,0,1,2,4] g) ∧
(∀ g : Fin s, σ (Fin.natAdd (7+(r+r+r)) g) = 3) ∧
(∀ i : Fin 3, (Finset.univ.filter (fun g : Fin (r+r+r) =>
σ (Fin.castAdd s (Fin.natAdd 7 g)) = i.castSucc.castSucc)).card = r)efx_anchor_family_fourth_losesIn LeanFair Division
Every complete EFX allocation of the arbitrary-size anchor family strictly lowers the fourth agent’s utility from her initial level, even if the other agents may lose utility.
theorem efx_anchor_family_fourth_loses (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s)
(σ : Fin ((7+(r+r+r))+s) → Fin 4)
(hσ : is_efx_goods (fun i g => (efx_anchor_family_values r s i g : ℝ)) σ) :
additive_valuation (fun g => (efx_anchor_family_values r s (3 : Fin 4) g : ℝ)) (bundle_of σ 3) <
(efx_anchor_family_baseline r s 3 : ℝ)efx_anchor_family_no_ir_completionIn LeanFair Division
Every complete EFX allocation of the nondegenerate anchor family makes at least one agent strictly worse off than in the starting one-charity allocation.
theorem efx_anchor_family_no_ir_completion (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s)
(p : Fin 4 → Fin ((7+(r+r+r))+s) → ℕ)
(hinj : ∀ i, Function.Injective (p i))
(hbound : ∀ i g, p i g < (7+(r+r+r))+s)
(hhigh : ∀ (i : Fin 3) (a b : Fin (r+r+r)),
efx_anchor_family_start r s (Fin.castAdd s (Fin.natAdd 7 a)) = i.castSucc.castSucc →
efx_anchor_family_start r s (Fin.castAdd s (Fin.natAdd 7 b)) ≠ i.castSucc.castSucc →
p i.castSucc (Fin.castAdd s (Fin.natAdd 7 b)) < p i.castSucc (Fin.castAdd s (Fin.natAdd 7 a)))
(σ : Fin ((7+(r+r+r))+s) → Fin 4)
(hσ : is_efx_goods (fun i g => (efx_anchor_family_perturbed_values r s p i g : ℝ)) σ) :
∃ i : Fin 4, additive_valuation (fun g => (efx_anchor_family_perturbed_values r s p i g : ℝ)) (bundle_of σ i) <
(efx_partial_nat_utility (efx_anchor_family_perturbed_values r s p) (efx_anchor_family_start r s) i : ℝ)efx_anchor_family_pareto_maximalIn LeanFair Division
For every r ≥ 1 and s ≥ 2, every partial EFX allocation weakly preserving the starting utilities has exactly those utilities. The starting bundle sizes are r+3, r+2, r+1 and s, so all four can be made arbitrarily large.
theorem efx_anchor_family_pareto_maximal (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s)
(σ : Fin ((7+(r+r+r))+s) → Fin 5)
(hσ : efx_partial_nat (efx_anchor_family_values r s) σ)
(hir : ∀ i : Fin 4, efx_anchor_family_baseline r s i ≤
efx_partial_nat_utility (efx_anchor_family_values r s) σ i) :
∀ i : Fin 4, efx_partial_nat_utility (efx_anchor_family_values r s) σ i =
efx_anchor_family_baseline r s iefx_anchor_family_perturbed_envy_graphIn LeanFair Division
The perturbed anchor-family starting allocation has precisely the envy edges 0→2, 0→3, 1→3, and 2→3, so its sources are 0 and 1.
theorem efx_anchor_family_perturbed_envy_graph (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s)
(p : Fin 4 → Fin ((7+(r+r+r))+s) → ℕ)
(hinj : ∀ i, Function.Injective (p i))
(hbound : ∀ i g, p i g < (7+(r+r+r))+s) :
∀ i j : Fin 4, i ≠ j →
(efx_partial_nat_utility (efx_anchor_family_perturbed_values r s p) (efx_anchor_family_start r s) i <
(∑ g, if efx_anchor_family_start r s g = j.castSucc then efx_anchor_family_perturbed_values r s p i g else 0) ↔
(i = 0 ∧ j = 2) ∨ ((i = 0 ∨ i = 1 ∨ i = 2) ∧ j = 3))efx_anchor_family_perturbed_fourth_losesIn LeanFair Division
Every complete EFX allocation of any injective bounded binary perturbation of the arbitrary-size anchor family strictly lowers the fourth agent’s utility from her initial level.
theorem efx_anchor_family_perturbed_fourth_loses (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s)
(p : Fin 4 → Fin ((7+(r+r+r))+s) → ℕ)
(hinj : ∀ i, Function.Injective (p i))
(hbound : ∀ i g, p i g < (7+(r+r+r))+s)
(σ : Fin ((7+(r+r+r))+s) → Fin 4)
(hσ : is_efx_goods (fun i g => (efx_anchor_family_perturbed_values r s p i g : ℝ)) σ) :
additive_valuation (fun g => (efx_anchor_family_perturbed_values r s p (3 : Fin 4) g : ℝ)) (bundle_of σ 3) <
(efx_partial_nat_utility (efx_anchor_family_perturbed_values r s p) (efx_anchor_family_start r s) 3 : ℝ)efx_anchor_family_perturbed_no_selfIn LeanFair Division
In the nondegenerate arbitrary-size anchor family no agent self-champions, even under inclusion-minimality: every preferred subset of her bundle plus an unallocated good is strongly envied by some agent.
theorem efx_anchor_family_perturbed_no_self (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s)
(p : Fin 4 → Fin ((7+(r+r+r))+s) → ℕ)
(hinj : ∀ i, Function.Injective (p i))
(hbound : ∀ i g, p i g < (7+(r+r+r))+s)
(hhigh : ∀ (i : Fin 3) (a b : Fin (r+r+r)),
efx_anchor_family_start r s (Fin.castAdd s (Fin.natAdd 7 a)) = i.castSucc.castSucc →
efx_anchor_family_start r s (Fin.castAdd s (Fin.natAdd 7 b)) ≠ i.castSucc.castSucc →
p i.castSucc (Fin.castAdd s (Fin.natAdd 7 b)) < p i.castSucc (Fin.castAdd s (Fin.natAdd 7 a)))
(i : Fin 4) (g : Fin ((7+(r+r+r))+s))
(hg : efx_anchor_family_start r s g = Fin.last 4)
(T : Finset (Fin ((7+(r+r+r))+s)))
(hT : T ⊆ insert g (efx_partial_nat_bundle (efx_anchor_family_start r s) i))
(hbetter : efx_partial_nat_utility (efx_anchor_family_perturbed_values r s p)
(efx_anchor_family_start r s) i < ∑ h ∈ T, efx_anchor_family_perturbed_values r s p i h) :
∃ (j : Fin 4) (h : Fin ((7+(r+r+r))+s)), h ∈ T ∧
efx_partial_nat_utility (efx_anchor_family_perturbed_values r s p) (efx_anchor_family_start r s) j <
∑ x ∈ T.erase h, efx_anchor_family_perturbed_values r s p j xefx_anchor_family_perturbed_start_efxIn LeanFair Division
Every perturbed valuation is positive and any injective bounded binary perturbation preserves all strict EFX inequalities of the anchor-family starting allocation.
theorem efx_anchor_family_perturbed_start_efx (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s)
(p : Fin 4 → Fin ((7+(r+r+r))+s) → ℕ)
(hinj : ∀ i, Function.Injective (p i))
(hbound : ∀ i g, p i g < (7+(r+r+r))+s) :
(∀ i g, 0 < efx_anchor_family_perturbed_values r s p i g) ∧
efx_partial_nat (efx_anchor_family_perturbed_values r s p) (efx_anchor_family_start r s) ∧
∀ i j : Fin 4, i ≠ j → ∀ g, efx_anchor_family_start r s g = j.castSucc →
(∑ h, if efx_anchor_family_start r s h = j.castSucc then efx_anchor_family_perturbed_values r s p i h else 0) <
efx_partial_nat_utility (efx_anchor_family_perturbed_values r s p) (efx_anchor_family_start r s) i +
efx_anchor_family_perturbed_values r s p i gefx_anchor_family_perturbed_uniqueIn LeanFair Division
For exponents satisfying the injectivity, bound, and own-anchor priority conditions, the perturbed anchor-family starting allocation is the unique partial EFX allocation weakly preserving all starting utilities.
theorem efx_anchor_family_perturbed_unique (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s)
(p : Fin 4 → Fin ((7+(r+r+r))+s) → ℕ)
(hinj : ∀ i, Function.Injective (p i))
(hbound : ∀ i g, p i g < (7+(r+r+r))+s)
(hhigh : ∀ (i : Fin 3) (a b : Fin (r+r+r)),
efx_anchor_family_start r s (Fin.castAdd s (Fin.natAdd 7 a)) = i.castSucc.castSucc →
efx_anchor_family_start r s (Fin.castAdd s (Fin.natAdd 7 b)) ≠ i.castSucc.castSucc →
p i.castSucc (Fin.castAdd s (Fin.natAdd 7 b)) < p i.castSucc (Fin.castAdd s (Fin.natAdd 7 a)))
(σ : Fin ((7+(r+r+r))+s) → Fin 5)
(hσ : efx_partial_nat (efx_anchor_family_perturbed_values r s p) σ)
(hir : ∀ i : Fin 4, efx_partial_nat_utility (efx_anchor_family_perturbed_values r s p)
(efx_anchor_family_start r s) i ≤
efx_partial_nat_utility (efx_anchor_family_perturbed_values r s p) σ i) :
σ = efx_anchor_family_start r sefx_anchor_family_sanityIn LeanFair Division
For every r ≥ 1 and s ≥ 2, the constructed one-charity partial allocation has positive values, the claimed utilities, and strictly satisfies every EFX inequality.
theorem efx_anchor_family_sanity (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s) :
(∀ i g, 0 < efx_anchor_family_values r s i g) ∧
efx_partial_nat (efx_anchor_family_values r s) (efx_anchor_family_start r s) ∧
(∀ i : Fin 4, efx_partial_nat_utility (efx_anchor_family_values r s) (efx_anchor_family_start r s) i =
efx_anchor_family_baseline r s i) ∧
(∀ i j : Fin 4, i ≠ j → ∀ g, efx_anchor_family_start r s g = j.castSucc →
(∑ h, if efx_anchor_family_start r s h = j.castSucc then efx_anchor_family_values r s i h else 0) <
efx_partial_nat_utility (efx_anchor_family_values r s) (efx_anchor_family_start r s) i + efx_anchor_family_values r s i g)efx_anchor_family_unperturbed_envy_graphIn LeanFair Division
In the anchor family with unperturbed valuations, the starting allocation has exactly the envy edges 0→2, 0→3, 1→3, and 2→3.
theorem efx_anchor_family_unperturbed_envy_graph (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s) :
∀ i j : Fin 4, i ≠ j →
(efx_partial_nat_utility (efx_anchor_family_values r s) (efx_anchor_family_start r s) i <
(∑ g, if efx_anchor_family_start r s g = j.castSucc then efx_anchor_family_values r s i g else 0) ↔
(i = 0 ∧ j = 2) ∨ ((i = 0 ∨ i = 1 ∨ i = 2) ∧ j = 3))efx_anchor_family_unperturbed_neIn LeanFair Division
In the anchor family with unperturbed valuations, no agent has equal utility for her own bundle and any distinct agent's bundle: every comparison is a strict inequality.
theorem efx_anchor_family_unperturbed_ne (r s : ℕ) (hr : 0 < r) (hs : 2 ≤ s) :
∀ i j : Fin 4, i ≠ j →
efx_partial_nat_utility (efx_anchor_family_values r s) (efx_anchor_family_start r s) i ≠
(∑ g, if efx_anchor_family_start r s g = j.castSucc then efx_anchor_family_values r s i g else 0)efx_anchor_lock_base_classificationIn LeanFair Division
Every partial EFX allocation weakly preserving the four original utilities has the original seven-good ownership and both locks assigned to agent 3, and differs only by a permutation of the three anchors among agents 0,1,2.
theorem efx_anchor_lock_base_classification (σ : Fin 12 → Fin 5)
(hσ : efx_partial_nat efx_anchor_lock_values σ)
(hir : ∀ i : Fin 4, efx_anchor_lock_baseline i ≤ efx_partial_nat_utility efx_anchor_lock_values σ i) :
σ = ![(1 : Fin 5),0,0,0,1,2,4,0,1,2,3,3] ∨
σ = ![(1 : Fin 5),0,0,0,1,2,4,0,2,1,3,3] ∨
σ = ![(1 : Fin 5),0,0,0,1,2,4,1,0,2,3,3] ∨
σ = ![(1 : Fin 5),0,0,0,1,2,4,1,2,0,3,3] ∨
σ = ![(1 : Fin 5),0,0,0,1,2,4,2,0,1,3,3] ∨
σ = ![(1 : Fin 5),0,0,0,1,2,4,2,1,0,3,3]
efx_anchor_lock_nondegenerateIn LeanFair Division
Every agent assigns distinct values to distinct subsets in the perturbed anchor-and-lock instance.
theorem efx_anchor_lock_nondegenerate (i : Fin 4) (S T : Finset (Fin 12))
(h : (∑ g ∈ S, efx_anchor_lock_perturbed_values i g) =
(∑ g ∈ T, efx_anchor_lock_perturbed_values i g)) : S = Tefx_anchor_lock_perturb_boundsIn LeanFair Division
Each exponent row is injective, all exponents are below 12, and every row’s total binary perturbation is below 8192.
theorem efx_anchor_lock_perturb_bounds :
(∀ i : Fin 4, Function.Injective (efx_anchor_lock_exponents i)) ∧
(∀ i g, efx_anchor_lock_exponents i g < 12) ∧
(∀ i : Fin 4, (∑ g : Fin 12, 2 ^ efx_anchor_lock_exponents i g) < 8192)
efx_anchor_lock_perturbed_uniqueIn LeanFair Division
The starting allocation is the only partial EFX allocation weakly preserving all four starting utilities in the nondegenerate instance, and is therefore Pareto-maximal.
theorem efx_anchor_lock_perturbed_unique (σ : Fin 12 → Fin 5)
(hσ : efx_partial_nat efx_anchor_lock_perturbed_values σ)
(hir : ∀ i : Fin 4, efx_anchor_lock_perturbed_baseline i ≤ efx_partial_nat_utility efx_anchor_lock_perturbed_values σ i) :
σ = efx_anchor_lock_start
efx_equal_pairs_blocked_dichotomyIn LeanFair Division
If every old pair has more than one blocking agent, then every old pair is blocked by two distinct agents, neither of which is the pair's owner.
theorem efx_equal_pairs_blocked_dichotomy (v : Fin 4 → Fin 9 → ℝ)
(hsmall : ∀ i : Fin 4,
v i 8 ≤ v i (![0,2,4,6] i) ∧ v i 8 ≤ v i (![1,3,5,7] i))
(h : ∀ p m : Fin 4, ∃ i : Fin 4, i ≠ m ∧ efx_pair_blocked v i p) :
∀ p : Fin 4, ∃ i j : Fin 4,
i ≠ p ∧ j ≠ p ∧ i ≠ j ∧ efx_pair_blocked v i p ∧ efx_pair_blocked v j pefx_four_agents_crux_positiveIn LeanFair Division
For m > 4 goods and four agents where every agent values at least one good positively, an EFX allocation exists.
theorem efx_four_agents_crux_positive (m : ℕ) (hm : 4 < m) (u : Fin 4 → Fin m → ℝ) (hu : ∀ i g, 0 ≤ u i g)
(hpos : ∀ i, ∃ g, 0 < u i g) : ∃ σ : Fin m → Fin 4, is_efx_goods u σefx_four_agents_of_le_fourIn LeanFair Division
For m ≤ 4 goods, the canonical injective allocation where good g is assigned to agent g is EFX for any nonnegative additive valuations.
theorem efx_four_agents_of_le_four (m : ℕ) (hm : m ≤ 4) (u : Fin 4 → Fin m → ℝ) (hu : ∀ i g, 0 ≤ u i g) :
∃ σ : Fin m → Fin 4, is_efx_goods u σefx_four_agents_of_zero_agentIn LeanFair Division
If one agent values all goods at 0 and the other three agents have an EFX allocation, then embedding that 3-agent allocation into 4 agents gives an EFX allocation.
theorem efx_four_agents_of_zero_agent (m : ℕ) (u : Fin 4 → Fin m → ℝ) (hu : ∀ i g, 0 ≤ u i g) (i₀ : Fin 4)
(h_zero : ∀ g, u i₀ g = 0) (τ : Fin m → Fin 3) (hτ : is_efx_goods (fun k g => u (i₀.succAbove k) g) τ) :
∃ σ : Fin m → Fin 4, is_efx_goods u σefx_locked_good_equivalenceIn LeanFair Division
For a nonempty original agent set, EFX exists in the original instance exactly when it exists in the locked-good lift with the new agent receiving at least her original utility m+1.
theorem efx_locked_good_equivalence {n m : ℕ} (hn : 0 < n)
(v : Fin n → Fin m → ℝ) (hv : ∀ i g, 0 ≤ v i g) :
(∃ τ : Fin m → Fin n, is_efx_goods v τ) ↔
∃ σ : Fin (m+1) → Fin (n+1), is_efx_goods (efx_locked_agent_values v) σ ∧
(m : ℝ) + 1 ≤ additive_valuation (efx_locked_agent_values v (Fin.last n))
(bundle_of σ (Fin.last n))efx_locked_good_extensionIn LeanFair Division
Any EFX allocation of the original goods extends to an EFX allocation of the locked-good lift by giving the new agent the locked good alone, while preserving all original agents’ utilities.
theorem efx_locked_good_extension {n m : ℕ}
(v : Fin n → Fin m → ℝ) (hv : ∀ i g, 0 ≤ v i g)
(τ : Fin m → Fin n) (hτ : is_efx_goods v τ) :
∃ σ : Fin (m+1) → Fin (n+1), is_efx_goods (efx_locked_agent_values v) σ ∧
σ (Fin.last m) = Fin.last n ∧
additive_valuation (efx_locked_agent_values v (Fin.last n)) (bundle_of σ (Fin.last n)) = (m : ℝ) + 1 ∧
∀ i : Fin n, additive_valuation (v i) (bundle_of τ i) =
additive_valuation (efx_locked_agent_values v i.castSucc) (bundle_of σ i.castSucc)efx_locked_good_forces_singletonIn LeanFair Division
If the new agent receives utility at least m+1 in an EFX allocation of the locked-good extension, then she owns the locked good and no old good.
theorem efx_locked_good_forces_singleton {n m : ℕ} (hn : 0 < n)
(v : Fin n → Fin m → ℝ) (hv : ∀ i g, 0 ≤ v i g)
(σ : Fin (m+1) → Fin (n+1))
(hσ : is_efx_goods (efx_locked_agent_values v) σ)
(hnew : (m : ℝ) + 1 ≤ additive_valuation (efx_locked_agent_values v (Fin.last n))
(bundle_of σ (Fin.last n))) :
σ (Fin.last m) = Fin.last n ∧ ∀ g : Fin m, σ g.castSucc ≠ Fin.last nefx_locked_good_projectionIn LeanFair Division
An EFX allocation of the locked-good extension that preserves the new agent’s initial utility projects to an EFX allocation of the original goods, preserving every original agent’s utility exactly.
theorem efx_locked_good_projection {n m : ℕ} (hn : 0 < n)
(v : Fin n → Fin m → ℝ) (hv : ∀ i g, 0 ≤ v i g)
(σ : Fin (m+1) → Fin (n+1))
(hσ : is_efx_goods (efx_locked_agent_values v) σ)
(hnew : (m : ℝ) + 1 ≤ additive_valuation (efx_locked_agent_values v (Fin.last n))
(bundle_of σ (Fin.last n))) :
∃ τ : Fin m → Fin n,
(∀ g, σ g.castSucc = (τ g).castSucc) ∧ is_efx_goods v τ ∧
∀ i : Fin n, additive_valuation (v i) (bundle_of τ i) =
additive_valuation (efx_locked_agent_values v i.castSucc) (bundle_of σ i.castSucc)efx_no_self_three_split_no_0_natIn LeanFair Division
No EFX completion exists among the allocations with the two old triples selected by pattern 0 kept intact.
theorem efx_no_self_three_split_no_0_nat (q : Fin 9 → Fin 4) : ¬ efx_no_self_three_split_nat (efx_no_self_three_split_code 0 q)
efx_no_self_three_split_no_1_natIn LeanFair Division
No EFX completion exists among the allocations with the two old triples selected by pattern 1 kept intact.
theorem efx_no_self_three_split_no_1_nat (q : Fin 9 → Fin 4) : ¬ efx_no_self_three_split_nat (efx_no_self_three_split_code 1 q)
efx_no_self_three_split_no_2_natIn LeanFair Division
No EFX completion exists among the allocations with the two old triples selected by pattern 2 kept intact.
theorem efx_no_self_three_split_no_2_nat (q : Fin 9 → Fin 4) : ¬ efx_no_self_three_split_nat (efx_no_self_three_split_code 2 q)
efx_no_self_three_split_no_3_natIn LeanFair Division
No EFX completion exists among the allocations with the two old triples selected by pattern 3 kept intact.
theorem efx_no_self_three_split_no_3_nat (q : Fin 9 → Fin 4) : ¬ efx_no_self_three_split_nat (efx_no_self_three_split_code 3 q)
efx_no_self_three_split_no_4_natIn LeanFair Division
No EFX completion exists among the allocations with the two old triples selected by pattern 4 kept intact.
theorem efx_no_self_three_split_no_4_nat (q : Fin 9 → Fin 4) : ¬ efx_no_self_three_split_nat (efx_no_self_three_split_code 4 q)
efx_no_self_three_split_no_5_natIn LeanFair Division
No EFX completion exists among the allocations with the two old triples selected by pattern 5 kept intact.
theorem efx_no_self_three_split_no_5_nat (q : Fin 9 → Fin 4) : ¬ efx_no_self_three_split_nat (efx_no_self_three_split_code 5 q)
efx_no_self_three_split_perturb_boundsIn LeanFair Division
Every exponent row is injective with exponents below 13, and the total binary perturbation in each row is smaller than 16384.
theorem efx_no_self_three_split_perturb_bounds :
(∀ i : Fin 4, Function.Injective (efx_no_self_three_split_exponents i)) ∧
(∀ i g, efx_no_self_three_split_exponents i g < 13) ∧
(∀ i : Fin 4, (∑ g : Fin 13, 2 ^ efx_no_self_three_split_exponents i g) < 16384)
efx_no_self_three_split_perturbed_no_selfIn LeanFair Division
No source self-champions in the nondegenerate perturbation, even under inclusion-minimality.
theorem efx_no_self_three_split_perturbed_no_self (i : Fin 4) (T : Finset (Fin 13))
(hT : T ⊆ insert 12 (efx_no_self_three_split_old i))
(hprefer : (∑ g ∈ efx_no_self_three_split_old i, efx_no_self_three_split_perturbed_values i g) <
(∑ g ∈ T, efx_no_self_three_split_perturbed_values i g)) :
∃ (j : Fin 4) (g : Fin 13), g ∈ T ∧
(∑ h ∈ efx_no_self_three_split_old j, efx_no_self_three_split_perturbed_values j h) <
(∑ h ∈ T.erase g, efx_no_self_three_split_perturbed_values j h)efx_no_self_three_split_perturbed_nondegenerateIn LeanFair Division
Every agent assigns distinct values to distinct subsets in the perturbed thirteen-good instance.
theorem efx_no_self_three_split_perturbed_nondegenerate (i : Fin 4) (S T : Finset (Fin 13))
(h : (∑ g ∈ S, efx_no_self_three_split_perturbed_values i g) =
(∑ g ∈ T, efx_no_self_three_split_perturbed_values i g)) : S = Tefx_no_self_three_split_perturbed_requires_threeIn LeanFair Division
Every complete EFX allocation of the nondegenerate perturbation splits at least three old triples.
theorem efx_no_self_three_split_perturbed_requires_three (σ : Fin 13 → Fin 4)
(hσ : is_efx_goods (fun i g => (efx_no_self_three_split_perturbed_values i g : ℝ)) σ) :
∀ a b : Fin 4, a ≠ b →
(σ (![0,3,6,9] a) ≠ σ (![1,4,7,10] a) ∨ σ (![0,3,6,9] a) ≠ σ (![2,5,8,11] a)) ∨
(σ (![0,3,6,9] b) ≠ σ (![1,4,7,10] b) ∨ σ (![0,3,6,9] b) ≠ σ (![2,5,8,11] b))efx_no_self_three_split_perturbed_sanityIn LeanFair Division
All perturbed values are positive, every agent strictly prefers her own old triple to every other old triple, every own item is worth at least charity to its owner, and for each target a foreign agent strongly envies its triple plus charity.
theorem efx_no_self_three_split_perturbed_sanity :
(∀ i g, 0 < efx_no_self_three_split_perturbed_values i g) ∧
(∀ i j : Fin 4, i ≠ j →
(∑ g ∈ efx_no_self_three_split_old j, efx_no_self_three_split_perturbed_values i g) <
(∑ g ∈ efx_no_self_three_split_old i, efx_no_self_three_split_perturbed_values i g)) ∧
(∀ i g, g ∈ efx_no_self_three_split_old i →
efx_no_self_three_split_perturbed_values i 12 ≤ efx_no_self_three_split_perturbed_values i g) ∧
(∀ j, ∃ i : Fin 4, i ≠ j ∧ ∃ g ∈ efx_no_self_three_split_old j,
(∑ h ∈ efx_no_self_three_split_old i, efx_no_self_three_split_perturbed_values i h) + efx_no_self_three_split_perturbed_values i g <
(∑ h ∈ efx_no_self_three_split_old j, efx_no_self_three_split_perturbed_values i h) + efx_no_self_three_split_perturbed_values i 12)efx_no_self_three_split_requires_threeIn LeanFair Division
Every complete EFX allocation of the explicit matrix splits at least three of the four old triples.
theorem efx_no_self_three_split_requires_three (σ : Fin 13 → Fin 4)
(hσ : is_efx_goods (fun i g => (efx_no_self_three_split_values i g : ℝ)) σ) :
∀ a b : Fin 4, a ≠ b →
(σ (![0,3,6,9] a) ≠ σ (![1,4,7,10] a) ∨ σ (![0,3,6,9] a) ≠ σ (![2,5,8,11] a)) ∨
(σ (![0,3,6,9] b) ≠ σ (![1,4,7,10] b) ∨ σ (![0,3,6,9] b) ≠ σ (![2,5,8,11] b))efx_nondeg_cycle_nondegenerateIn LeanFair Division
Each agent assigns distinct values to distinct subsets in the nondegenerate cycle instance.
theorem efx_nondeg_cycle_nondegenerate (i : Fin 4) (S T : Finset (Fin 13))
(h : (∑ g ∈ S, efx_nondeg_cycle_values i g) = (∑ g ∈ T, efx_nondeg_cycle_values i g)) : S = T
efx_nondeg_cycle_perturb_boundsIn LeanFair Division
Each exponent row is injective with exponents below 13 and total binary perturbation below 16384.
theorem efx_nondeg_cycle_perturb_bounds :
(∀ i : Fin 4, Function.Injective (efx_nondeg_cycle_exponents i)) ∧
(∀ i g, efx_nondeg_cycle_exponents i g < 13) ∧
(∀ i : Fin 4, (∑ g : Fin 13, 2 ^ efx_nondeg_cycle_exponents i g) < 16384)
efx_pair_blocked_not_selfIn LeanFair Division
No agent blocks her own old pair: if charity is worth no more to her than either good of her own pair, she cannot value charity strictly more than one of them.
theorem efx_pair_blocked_not_self (v : Fin 4 → Fin 9 → ℝ)
(hsmall : ∀ i : Fin 4,
v i 8 ≤ v i (![0,2,4,6] i) ∧ v i 8 ≤ v i (![1,3,5,7] i)) (i : Fin 4) :
¬ efx_pair_blocked v i iefx_pareto_almost_all_sourcesIn LeanFair Division
For every number of agents at least three, a positive partial EFX allocation on 2n+1 goods with one unallocated good and all but one agent a source can be the unique individually rational partial EFX state, with no individually rational complete EFX allocation.
theorem efx_pareto_almost_all_sources (n : ℕ) (hn : 3 ≤ n) :
∃ (m : ℕ) (v : Fin n → Fin m → ℕ) (σ : Fin m → Fin (n+1)) (sink : Fin n),
m = n+n+1 ∧
(∀ i g, 0 < v i g) ∧
(∀ i, 0 < efx_partial_nat_utility v σ i) ∧
efx_partial_nat v σ ∧
(∃ g, σ g = Fin.last n ∧ ∀ h, σ h = Fin.last n → h = g) ∧
(∀ i, efx_partial_nat_source v σ i ↔ i ≠ sink) ∧
(∀ τ : Fin m → Fin (n+1), efx_partial_nat v τ →
(∀ i, efx_partial_nat_utility v σ i ≤ efx_partial_nat_utility v τ i) → τ = σ) ∧
(∀ τ : Fin m → Fin (n+1), efx_partial_nat v τ →
(∀ i, efx_partial_nat_utility v σ i ≤ efx_partial_nat_utility v τ i) →
∀ i, efx_partial_nat_utility v τ i ≤ efx_partial_nat_utility v σ i) ∧
(∀ τ : Fin m → Fin (n+1), efx_partial_nat v τ →
(∀ i, efx_partial_nat_utility v σ i ≤ efx_partial_nat_utility v τ i) →
∃ g, τ g = Fin.last n)efx_pareto_incompatible_pos_additiveIn LeanFair Division
In the fair division instance with 4 agents and 8 goods with valuations efx_po_val_real, there is no allocation of the goods that is simultaneously EFX and Pareto optimal.
theorem efx_pareto_incompatible_pos_additive :
¬ ∃ σ : Fin 8 → Fin 4, is_efx_goods efx_po_val_real σ ∧ is_pareto_optimal_goods efx_po_val_real σefx_pareto_lock_encoded_uniqueIn LeanFair Division
Any feasible encoded partial allocation is the original one.
theorem efx_pareto_lock_encoded_unique (q : Fin 7 → Fin 4)
(hq : efx_pareto_lock_feasible (efx_pareto_lock_encode q)) :
q = ![(1 : Fin 4),0,0,0,1,2,3]
efx_pareto_lock_forces_dedicatedIn LeanFair Division
In every feasible partial allocation, agent 3 must receive the locked good 7 and cannot receive any other good.
theorem efx_pareto_lock_forces_dedicated (σ : Fin 8 → Fin 5)
(hσ : efx_pareto_lock_feasible σ) :
σ 7 = 3 ∧ ∀ g : Fin 7, σ g.castSucc ≠ 3
efx_pareto_lock_padded_maximalIn LeanFair Division
In every padded partial EFX allocation weakly preserving all four starting utilities, all four utilities are equal to their starting values. Consequently the padded starting allocation is Pareto-maximal for every k.
theorem efx_pareto_lock_padded_maximal (k : ℕ)
(σ : Fin (8+(k+k)) → Fin 5)
(hσ : efx_partial_nat (efx_pareto_lock_padded_values k) σ)
(hir : ∀ i : Fin 4, efx_pareto_lock_padded_baseline k i ≤
efx_partial_nat_utility (efx_pareto_lock_padded_values k) σ i) :
∀ i : Fin 4, efx_partial_nat_utility (efx_pareto_lock_padded_values k) σ i =
efx_pareto_lock_padded_baseline k iefx_pareto_lock_three_no_near_efxIn LeanFair Division
No complete EFX allocation of the three-agent seven-good base gives every agent at least her starting utility minus one.
theorem efx_pareto_lock_three_no_near_efx (τ : Fin 7 → Fin 3) : ¬ efx_pareto_lock_three_near_feasible τ
efx_pareto_lock_uniqueIn LeanFair Division
The only partial EFX allocation weakly preserving all four original utilities is the starting allocation, with good 6 unallocated.
theorem efx_pareto_lock_unique (σ : Fin 8 → Fin 5)
(hσ : efx_pareto_lock_feasible σ) :
σ = ![(1 : Fin 5),0,0,0,1,2,4,3]
efx_pareto_lock_unique_0In LeanFair Division
Among encoded partial allocations with q 0 = 0, feasibility forces the unique original assignment.
theorem efx_pareto_lock_unique_0 (q : Fin 7 → Fin 4) (h : q 0 = 0)
(hq : efx_pareto_lock_feasible (efx_pareto_lock_encode q)) :
q = ![(1 : Fin 4),0,0,0,1,2,3]
efx_pareto_lock_unique_1In LeanFair Division
Among encoded partial allocations with q 0 = 1, feasibility forces the unique original assignment.
theorem efx_pareto_lock_unique_1 (q : Fin 7 → Fin 4) (h : q 0 = 1)
(hq : efx_pareto_lock_feasible (efx_pareto_lock_encode q)) :
q = ![(1 : Fin 4),0,0,0,1,2,3]
efx_pareto_lock_unique_2In LeanFair Division
Among encoded partial allocations with q 0 = 2, feasibility forces the unique original assignment.
theorem efx_pareto_lock_unique_2 (q : Fin 7 → Fin 4) (h : q 0 = 2)
(hq : efx_pareto_lock_feasible (efx_pareto_lock_encode q)) :
q = ![(1 : Fin 4),0,0,0,1,2,3]
efx_pareto_lock_unique_3In LeanFair Division
Among encoded partial allocations with q 0 = 3, feasibility forces the unique original assignment.
theorem efx_pareto_lock_unique_3 (q : Fin 7 → Fin 4) (h : q 0 = 3)
(hq : efx_pareto_lock_feasible (efx_pareto_lock_encode q)) :
q = ![(1 : Fin 4),0,0,0,1,2,3]
efx_pareto_three_base_propertiesIn LeanFair Division
The three-agent base is positive, has a unique individually rational partial EFX state, and has exactly two sources.
theorem efx_pareto_three_base_properties :
(∀ i g, 0 < efx_pareto_three_values i g) ∧
(∀ i, 0 < efx_partial_nat_utility efx_pareto_three_values efx_pareto_three_start i) ∧
efx_partial_nat efx_pareto_three_values efx_pareto_three_start ∧
(∀ τ : Fin 7 → Fin 4, efx_partial_nat efx_pareto_three_values τ →
(∀ i, efx_partial_nat_utility efx_pareto_three_values efx_pareto_three_start i ≤
efx_partial_nat_utility efx_pareto_three_values τ i) → τ = efx_pareto_three_start) ∧
(∀ i : Fin 3, efx_partial_nat_source efx_pareto_three_values efx_pareto_three_start i ↔ i ≠ 2)efx_pareto_three_forces_024In LeanFair Division
Once agent 2 owns good 5, IR and EFX force goods 2, 4 and 0 to their original owners.
theorem efx_pareto_three_forces_024 (τ : Fin 7 → Fin 4)
(hτ : efx_partial_nat efx_pareto_three_values τ)
(hir : ∀ i : Fin 3, efx_partial_nat_utility efx_pareto_three_values efx_pareto_three_start i ≤
efx_partial_nat_utility efx_pareto_three_values τ i)
(h5 : τ 5 = 2) :
τ 2 = 0 ∧ τ 4 = 1 ∧ τ 0 = 1efx_pareto_three_forces_136In LeanFair Division
The last two old goods remain with agent 0 and good 6 must remain unallocated.
theorem efx_pareto_three_forces_136 (τ : Fin 7 → Fin 4)
(hτ : efx_partial_nat efx_pareto_three_values τ)
(hir : ∀ i : Fin 3, efx_partial_nat_utility efx_pareto_three_values efx_pareto_three_start i ≤
efx_partial_nat_utility efx_pareto_three_values τ i)
(h5 : τ 5 = 2) (h2 : τ 2 = 0) (h4 : τ 4 = 1) (h0 : τ 0 = 1) :
τ 1 = 0 ∧ τ 3 = 0 ∧ τ 6 = 3efx_pareto_three_forces_5In LeanFair Division
The third agent must retain good 5 in any IR partial EFX allocation.
theorem efx_pareto_three_forces_5 (τ : Fin 7 → Fin 4)
(hτ : efx_partial_nat efx_pareto_three_values τ)
(hir : ∀ i : Fin 3, efx_partial_nat_utility efx_pareto_three_values efx_pareto_three_start i ≤
efx_partial_nat_utility efx_pareto_three_values τ i) :
τ 5 = 2efx_partial_nat_self_champion_progressIn LeanFair Division
If an agent strictly prefers a universally trim-safe subset of her bundle plus an unallocated good, there is a partial EFX allocation that weakly improves every agent and strictly improves her.
theorem efx_partial_nat_self_champion_progress {n m : ℕ}
(v : Fin n → Fin m → ℕ) (σ : Fin m → Fin (n+1)) (hσ : efx_partial_nat v σ)
(i : Fin n) (g : Fin m) (hg : σ g = Fin.last n) (T : Finset (Fin m))
(hT : T ⊆ insert g (efx_partial_nat_bundle σ i))
(hbetter : efx_partial_nat_utility v σ i < ∑ h ∈ T, v i h)
(htrim : ∀ (j : Fin n) (h : Fin m), h ∈ T →
(∑ x ∈ T.erase h, v j x) ≤ efx_partial_nat_utility v σ j) :
∃ τ : Fin m → Fin (n+1), efx_partial_nat v τ ∧
(∀ j, efx_partial_nat_utility v σ j ≤ efx_partial_nat_utility v τ j) ∧
efx_partial_nat_utility v σ i < efx_partial_nat_utility v τ iefx_partial_scaled_perturbation_irIn LeanFair Division
If perturbed partial-allocation utility is at least K times an original natural threshold, and total perturbation is below K, original utility meets that threshold.
theorem efx_partial_scaled_perturbation_ir {n m : ℕ} (K : ℕ)
(v d : Fin n → Fin m → ℕ) (hsmall : ∀ i, (∑ g : Fin m, d i g) < K)
(σ : Fin m → Fin (n+1)) (b : Fin n → ℕ)
(hir : ∀ i, K * b i ≤ efx_partial_nat_utility (fun i g => K * v i g + d i g) σ i) :
∀ i, b i ≤ efx_partial_nat_utility v σ iefx_partial_scaled_perturbation_restrictIn LeanFair Division
If each agent’s total perturbation is less than K, any partial EFX allocation for K times the base natural valuations plus that perturbation is partial EFX for the base valuations.
theorem efx_partial_scaled_perturbation_restrict {n m : ℕ} (K : ℕ)
(v d : Fin n → Fin m → ℕ) (hsmall : ∀ i, (∑ g : Fin m, d i g) < K)
(σ : Fin m → Fin (n+1))
(hσ : efx_partial_nat (fun i g => K * v i g + d i g) σ) :
efx_partial_nat v σefx_partial_scaled_tail_irIn LeanFair Division
If every agent gets at least K times her original threshold and the whole tail is worth less than K, projection to original goods preserves each original natural threshold.
theorem efx_partial_scaled_tail_ir {n m k : ℕ} (K : ℕ)
(v : Fin n → Fin m → ℕ) (d : Fin n → Fin k → ℕ)
(hsmall : ∀ i, (∑ g : Fin k, d i g) < K)
(σ : Fin (m+k) → Fin (n+1)) (b : Fin n → ℕ)
(hir : ∀ i, K * b i ≤ efx_partial_nat_utility (efx_partial_scaled_tail K v d) σ i) :
∀ i, b i ≤ efx_partial_nat_utility v (fun g => σ (Fin.castAdd k g)) iefx_partial_scaled_tail_restrictIn LeanFair Division
If the total tail value of each agent is less than the positive scaling factor K, every partial EFX allocation projects to a partial EFX allocation of the original natural-valued goods.
theorem efx_partial_scaled_tail_restrict {n m k : ℕ} (K : ℕ)
(v : Fin n → Fin m → ℕ) (d : Fin n → Fin k → ℕ)
(hsmall : ∀ i, (∑ g : Fin k, d i g) < K)
(σ : Fin (m+k) → Fin (n+1)) (hσ : efx_partial_nat (efx_partial_scaled_tail K v d) σ) :
efx_partial_nat v (fun g => σ (Fin.castAdd k g))efx_pert_sum_filter_ltIn LeanFair Division
The sum of 2^(p g) over any subset of goods in Fin M is strictly less than 2^M whenever p is injective and has values strictly less than M.
theorem efx_pert_sum_filter_lt (M : ℕ) (p : Fin M → ℕ)
(hinj : Function.Injective p) (hbound : ∀ g, p g < M)
(Q : Fin M → Prop) [DecidablePred Q] :
(∑ g : Fin M, if Q g then 2 ^ p g else 0) < 2 ^ Mefx_po_additive_valuation_castIn LeanFair Division
In the 4-agent 8-good instance, an agent's real-valued utility for any bundle equals the natural-number sum of her integer values over that bundle, cast to real.
lemma efx_po_additive_valuation_cast (i : Fin 4) (S : Finset (Fin 8)) :
additive_valuation (efx_po_val_real i) S = ((∑ g ∈ S, efx_po_values i g : ℕ) : ℝ)efx_po_bv_nat_eq_sumIn LeanFair Division
In the 4-agent 8-good instance, the natural-number bundle value efx_po_bv_nat σ i j equals the sum of efx_po_values i over j's bundle.
lemma efx_po_bv_nat_eq_sum (σ : Fin 8 → Fin 4) (i j : Fin 4) :
efx_po_bv_nat σ i j = ∑ g ∈ bundle_of σ j, efx_po_values i gefx_po_efx_imp_dominatedIn LeanFair Division
Every EFX allocation of the 4-agent 8-good instance efx_po_val_real is Pareto dominated by some allocation.
lemma efx_po_efx_imp_dominated (σ : Fin 8 → Fin 4)
(h : is_efx_goods efx_po_val_real σ) :
∃ τ : Fin 8 → Fin 4, pareto_dominates_goods efx_po_val_real τ σefx_po_efx_nat_iffIn LeanFair Division
In the 4-agent 8-good instance, an allocation is EFX (with real-valued bundles) if and only if it satisfies the natural-number EFX condition efx_po_efx_nat.
lemma efx_po_efx_nat_iff (σ : Fin 8 → Fin 4) :
is_efx_goods efx_po_val_real σ ↔ efx_po_efx_nat σefx_po_family_efx_imp_dominated_natIn LeanFair Division
Every EFX allocation of the 4-agent 8-good instance that lies in the singleton family is Pareto dominated, in the natural-number sense, by some allocation of the goods.
lemma efx_po_family_efx_imp_dominated_nat (σ : Fin 8 → Fin 4)
(h : efx_po_in_singleton_family σ) (hefx : efx_po_efx_nat σ) :
∃ τ : Fin 8 → Fin 4, efx_po_dominates_nat τ σefx_po_in_singleton_family_of_efxIn LeanFair Division
Every EFX allocation of the 4-agent 8-good instance lies in the singleton family: goods 0 and 1 are singletons with distinct owners.
lemma efx_po_in_singleton_family_of_efx (σ : Fin 8 → Fin 4)
(h : is_efx_goods efx_po_val_real σ) : efx_po_in_singleton_family σefx_po_in_singleton_family_witnessIn LeanFair Division
The singleton family is nonempty: the allocation (0, 1, 2, 3, 2, 3, 2, 3) is in it, while the allocation (0, 0, 2, 3, 2, 3, 2, 3) is not.
lemma efx_po_in_singleton_family_witness :
efx_po_in_singleton_family ![0, 1, 2, 3, 2, 3, 2, 3] ∧
¬ efx_po_in_singleton_family ![0, 0, 2, 3, 2, 3, 2, 3]efx_po_pareto_nat_iffIn LeanFair Division
In the 4-agent 8-good instance, τ Pareto-dominates σ (in real utilities) if and only if efx_po_dominates_nat τ σ holds.
lemma efx_po_pareto_nat_iff (τ σ : Fin 8 → Fin 4) :
pareto_dominates_goods efx_po_val_real τ σ ↔ efx_po_dominates_nat τ σefx_po_small_goods_value_boundIn LeanFair Division
In the 4-agent 8-good instance, among the six non-large goods (goods 2 through 7) every agent values every good at most 3, so for any set R of such goods the total value actually realised by giving each good to its owner is at most 3 |R|.
lemma efx_po_small_goods_value_bound (σ : Fin 8 → Fin 4) (R : Finset (Fin 8))
(h0 : (0 : Fin 8) ∉ R) (h1 : (1 : Fin 8) ∉ R) :
∑ g ∈ R, efx_po_values (σ g) g ≤ 3 * R.cardefx_po_step1_singletonsIn LeanFair Division
In every EFX allocation of the 4-agent 8-good instance, goods 0 and 1 are each allocated as singletons to distinct agents.
lemma efx_po_step1_singletons (σ : Fin 8 → Fin 4) (h : is_efx_goods efx_po_val_real σ) :
bundle_of σ (σ 0) = {0} ∧ bundle_of σ (σ 1) = {1} ∧ σ 0 ≠ σ 1efx_scale_pert_lt_iffIn LeanFair Division
For positive natural numbers, scaling integers by K and adding perturbations strictly less than K preserves the strict inequality between distinct integers: K * A + dA < K * B + dB ↔ A < B whenever dA, dB < K and A ≠ B.
theorem efx_scale_pert_lt_iff (K A B dA dB : ℕ) (hdA : dA < K) (hdB : dB < K) (hne : A ≠ B) :
K * A + dA < K * B + dB ↔ A < Befx_scaled_perturbation_restrictIn LeanFair Division
If each agent’s total additive perturbation is below K, any EFX allocation for the scaled and perturbed natural valuations is EFX for the original natural valuations.
theorem efx_scaled_perturbation_restrict {n m : ℕ} (K : ℕ)
(v d : Fin n → Fin m → ℕ) (hsmall : ∀ i, (∑ g : Fin m, d i g) < K)
(σ : Fin m → Fin n)
(hσ : is_efx_goods (fun i g => (efx_scaled_perturbation K v d i g : ℝ)) σ) :
is_efx_goods (fun i g => (v i g : ℝ)) σefx_source_lift_new_sourceIn LeanFair Division
The new agent is an unenvied source.
theorem efx_source_lift_new_source {n m : ℕ}
(v : Fin n → Fin m → ℕ) (σ : Fin m → Fin (n+1))
(hown : ∀ i, 0 < efx_partial_nat_utility v σ i) :
efx_partial_nat_source (efx_source_lift_values v (efx_partial_nat_utility v σ))
(efx_source_lift_start σ) (Fin.last n)efx_source_lift_old_source_iffIn LeanFair Division
The two-lock lift preserves exactly which old agents are sources.
theorem efx_source_lift_old_source_iff {n m : ℕ}
(v : Fin n → Fin m → ℕ) (σ : Fin m → Fin (n+1)) (i : Fin n) :
efx_partial_nat_source (efx_source_lift_values v (efx_partial_nat_utility v σ))
(efx_source_lift_start σ) i.castSucc ↔ efx_partial_nat_source v σ iefx_source_lift_sanityIn LeanFair Division
The lifted starting allocation is EFX and the new agent is an isolated source.
theorem efx_source_lift_sanity {n m : ℕ}
(v : Fin n → Fin m → ℕ) (σ : Fin m → Fin (n+1))
(hpos : ∀ i g, 0 < v i g)
(hown : ∀ i, 0 < efx_partial_nat_utility v σ i)
(hσ : efx_partial_nat v σ) :
efx_partial_nat (efx_source_lift_values v (efx_partial_nat_utility v σ)) (efx_source_lift_start σ) ∧
(∀ i : Fin n,
(∑ g : Fin (m+2), if (efx_source_lift_start σ) g = (Fin.last n).castSucc then (efx_source_lift_values v (efx_partial_nat_utility v σ)) i.castSucc g else 0) <
efx_partial_nat_utility (efx_source_lift_values v (efx_partial_nat_utility v σ)) (efx_source_lift_start σ) i.castSucc ∧
(∑ g : Fin (m+2), if (efx_source_lift_start σ) g = i.castSucc.castSucc then (efx_source_lift_values v (efx_partial_nat_utility v σ)) (Fin.last n) g else 0) <
efx_partial_nat_utility (efx_source_lift_values v (efx_partial_nat_utility v σ)) (efx_source_lift_start σ) (Fin.last n))efx_source_lift_source_losesIn LeanFair Division
Any complete EFX allocation of the lifted instance lowers the isolated source’s utility.
theorem efx_source_lift_source_loses {n m : ℕ}
(hn : 0 < n)
(v : Fin n → Fin m → ℕ) (σ : Fin m → Fin (n+1))
(hpos : ∀ i g, 0 < v i g)
(hown : ∀ i, 0 < efx_partial_nat_utility v σ i)
(hσ : efx_partial_nat v σ)
(hchar : ∃ g : Fin m, σ g = Fin.last n ∧ ∀ h : Fin m, σ h = Fin.last n → h = g)
(hunique : ∀ τ : Fin m → Fin (n+1), efx_partial_nat v τ →
(∀ i, efx_partial_nat_utility v σ i ≤ efx_partial_nat_utility v τ i) → τ = σ)
(τ : Fin (m+2) → Fin ((n+1)+1))
(hτ : efx_partial_nat (efx_source_lift_values v (efx_partial_nat_utility v σ)) τ)
(hcomplete : ∀ g, τ g ≠ Fin.last (n+1)) :
efx_partial_nat_utility (efx_source_lift_values v (efx_partial_nat_utility v σ)) τ (Fin.last n) <
efx_partial_nat_utility (efx_source_lift_values v (efx_partial_nat_utility v σ)) (efx_source_lift_start σ) (Fin.last n)efx_source_lift_unique_irIn LeanFair Division
A unique individually rational partial EFX state lifts to a unique one while adding an isolated source.
theorem efx_source_lift_unique_ir {n m : ℕ}
(hn : 0 < n)
(v : Fin n → Fin m → ℕ) (σ : Fin m → Fin (n+1))
(hpos : ∀ i g, 0 < v i g)
(hown : ∀ i, 0 < efx_partial_nat_utility v σ i)
(hσ : efx_partial_nat v σ)
(hchar : ∃ g : Fin m, σ g = Fin.last n ∧ ∀ h : Fin m, σ h = Fin.last n → h = g)
(hunique : ∀ τ : Fin m → Fin (n+1), efx_partial_nat v τ →
(∀ i, efx_partial_nat_utility v σ i ≤ efx_partial_nat_utility v τ i) → τ = σ)
(τ : Fin (m+2) → Fin ((n+1)+1))
(hτ : efx_partial_nat (efx_source_lift_values v (efx_partial_nat_utility v σ)) τ)
(hir : ∀ i, efx_partial_nat_utility (efx_source_lift_values v (efx_partial_nat_utility v σ)) (efx_source_lift_start σ) i ≤
efx_partial_nat_utility (efx_source_lift_values v (efx_partial_nat_utility v σ)) τ i) : τ = (efx_source_lift_start σ)efx_source_two_fourth_losesIn LeanFair Division
Every complete EFX allocation strictly lowers the utility of the initially isolated source.
theorem efx_source_two_fourth_loses (σ : Fin 9 → Fin 4)
(hσ : is_efx_goods (fun i g => (efx_source_two_values i g : ℝ)) σ) :
additive_valuation (fun g => (efx_source_two_values (3 : Fin 4) g : ℝ)) (bundle_of σ 3) < 16
efx_source_two_no_self_championIn LeanFair Division
The starting state has no self champions.
theorem efx_source_two_no_self_champion (i : Fin 4) (T : Finset (Fin 9))
(hT : T ⊆ insert 6 (efx_partial_nat_bundle efx_source_two_start i))
(hprefer : efx_partial_nat_utility efx_source_two_values efx_source_two_start i <
∑ g ∈ T, efx_source_two_values i g) :
∃ (j : Fin 4) (g : Fin 9), g ∈ T ∧
efx_partial_nat_utility efx_source_two_values efx_source_two_start j <
∑ h ∈ T.erase g, efx_source_two_values j hefx_source_two_start_sanityIn LeanFair Division
The starting state is positive and strictly EFX, and agent 3 is an isolated source: she strictly neither envies nor is envied.
theorem efx_source_two_start_sanity :
efx_partial_nat efx_source_two_values efx_source_two_start ∧
(∀ i : Fin 4, ∀ g : Fin 9, 0 < efx_source_two_values i g) ∧
(∀ i : Fin 3,
(∑ g : Fin 9, if efx_source_two_start g = (3 : Fin 5) then efx_source_two_values i.castSucc g else 0) <
efx_partial_nat_utility efx_source_two_values efx_source_two_start i.castSucc ∧
(∑ g : Fin 9, if efx_source_two_start g = i.castSucc.castSucc then efx_source_two_values (3 : Fin 4) g else 0) <
efx_partial_nat_utility efx_source_two_values efx_source_two_start (3 : Fin 4)) ∧
(∀ (i j : Fin 4), i ≠ j → ∀ g : Fin 9, efx_source_two_start g = j.castSucc →
(∑ h : Fin 9, if efx_source_two_start h = j.castSucc ∧ h ≠ g then efx_source_two_values i h else 0) <
efx_partial_nat_utility efx_source_two_values efx_source_two_start i)efx_source_two_unique_irIn LeanFair Division
The starting allocation is the unique partial EFX allocation preserving all four starting utilities.
theorem efx_source_two_unique_ir (σ : Fin 9 → Fin 5)
(hσ : efx_partial_nat efx_source_two_values σ)
(hir : ∀ i : Fin 4, efx_partial_nat_utility efx_source_two_values efx_source_two_start i ≤
efx_partial_nat_utility efx_source_two_values σ i) : σ = efx_source_two_startefx_three_agents_additive_existsIn LeanFair Division
For three agents with nonnegative additive valuations, an EFX allocation of indivisible goods always exists.
theorem efx_three_agents_additive_exists (m : ℕ) (u : Fin 3 → Fin m → ℝ) (hu : ∀ i g, 0 ≤ u i g) :
∃ σ : Fin m → Fin 3, is_efx_goods u σefx_three_pair_anchor_countIn LeanFair Division
Individual rationality forces exactly r anchors for each agent.
theorem efx_three_pair_anchor_count (r : ℕ) (σ : Fin (9+4*r) → Fin 4)
(hir : ∀ i : Fin 4, 100*r+10 ≤ ∑ g, if σ g = i then efx_three_pair_anchor_values r i g else 0) :
∀ i : Fin 4, (Finset.univ.filter (fun g : Fin (4*r) => σ (Fin.natAdd 9 g) = i)).card = r
efx_three_pair_anchor_projectionIn LeanFair Division
If each agent receives r anchors, EFX projects to the nine original goods.
theorem efx_three_pair_anchor_projection (r : ℕ) (σ : Fin (9+4*r) → Fin 4)
(hcount : ∀ i : Fin 4, (Finset.univ.filter (fun g : Fin (4*r) => σ (Fin.natAdd 9 g) = i)).card = r)
(hefx : is_efx_goods (fun i g => (efx_three_pair_anchor_values r i g : ℝ)) σ) :
is_efx_goods (fun i g => (efx_allsource_three_pair_values i g : ℝ)) (fun g => σ (Fin.castAdd (4*r) g))
efx_three_pair_anchor_requires_threeIn LeanFair Division
Every utility-preserving complete EFX allocation splits at least three original enlarged bundles, for every anchor count.
theorem efx_three_pair_anchor_requires_three (r : ℕ) (σ : Fin (9+4*r) → Fin 4)
(hir : ∀ i : Fin 4, 100*r+10 ≤ ∑ g, if σ g = i then efx_three_pair_anchor_values r i g else 0)
(hefx : is_efx_goods (fun i g => (efx_three_pair_anchor_values r i g : ℝ)) σ) :
∀ a b : Fin 4, a ≠ b →
σ (Fin.castAdd (4*r) (![0,2,4,6] a)) ≠ σ (Fin.castAdd (4*r) (![1,3,5,7] a)) ∨
σ (Fin.castAdd (4*r) (![0,2,4,6] b)) ≠ σ (Fin.castAdd (4*r) (![1,3,5,7] b))efx_three_split_no_two_intactIn LeanFair Division
Every complete EFX allocation in the explicit instance splits at least three of the four old adjacent pairs: for every two distinct old pairs, at least one is split.
theorem efx_three_split_no_two_intact (σ : Fin 9 → Fin 4)
(hefx : is_efx_goods (fun i g => (efx_three_split_values i g : ℝ)) σ) :
∀ a b : Fin 4, a ≠ b →
σ (![0,2,4,6] a) ≠ σ (![1,3,5,7] a) ∨
σ (![0,2,4,6] b) ≠ σ (![1,3,5,7] b)efx_three_split_no_two_intact_0_natIn LeanFair Division
For the explicit instance, no natural EFX allocation encoded by two-intact-pair pattern 0 exists.
theorem efx_three_split_no_two_intact_0_nat (q : Fin 7 → Fin 4) : ¬ efx_three_split_efx_nat (efx_three_split_two_intact_code 0 q)
efx_three_split_no_two_intact_0_nat_case_0In LeanFair Division
For the explicit four-agent instance and intact-pair pattern 0, no natural EFX allocation exists with q 0 = 0.
theorem efx_three_split_no_two_intact_0_nat_case_0 (q : Fin 7 → Fin 4) (hq : q 0 = 0) : ¬ efx_three_split_efx_nat (efx_three_split_two_intact_code 0 q)
efx_three_split_no_two_intact_0_nat_case_1In LeanFair Division
For the explicit four-agent instance and intact-pair pattern 0, no natural EFX allocation exists with q 0 = 1.
theorem efx_three_split_no_two_intact_0_nat_case_1 (q : Fin 7 → Fin 4) (hq : q 0 = 1) : ¬ efx_three_split_efx_nat (efx_three_split_two_intact_code 0 q)
efx_three_split_no_two_intact_0_nat_case_2In LeanFair Division
For the explicit four-agent instance and intact-pair pattern 0, no natural EFX allocation exists with q 0 = 2.
theorem efx_three_split_no_two_intact_0_nat_case_2 (q : Fin 7 → Fin 4) (hq : q 0 = 2) : ¬ efx_three_split_efx_nat (efx_three_split_two_intact_code 0 q)
efx_three_split_no_two_intact_0_nat_case_3In LeanFair Division
For the explicit four-agent instance and intact-pair pattern 0, no natural EFX allocation exists with q 0 = 3.
theorem efx_three_split_no_two_intact_0_nat_case_3 (q : Fin 7 → Fin 4) (hq : q 0 = 3) : ¬ efx_three_split_efx_nat (efx_three_split_two_intact_code 0 q)
efx_three_split_no_two_intact_1_natIn LeanFair Division
For the explicit instance, no natural EFX allocation encoded by two-intact-pair pattern 1 exists.
theorem efx_three_split_no_two_intact_1_nat (q : Fin 7 → Fin 4) : ¬ efx_three_split_efx_nat (efx_three_split_two_intact_code 1 q)
efx_three_split_no_two_intact_2_natIn LeanFair Division
For the explicit instance, no natural EFX allocation encoded by two-intact-pair pattern 2 exists.
theorem efx_three_split_no_two_intact_2_nat (q : Fin 7 → Fin 4) : ¬ efx_three_split_efx_nat (efx_three_split_two_intact_code 2 q)
efx_three_split_no_two_intact_3_natIn LeanFair Division
For the explicit instance, no natural EFX allocation encoded by two-intact-pair pattern 3 exists.
theorem efx_three_split_no_two_intact_3_nat (q : Fin 7 → Fin 4) : ¬ efx_three_split_efx_nat (efx_three_split_two_intact_code 3 q)
efx_three_split_no_two_intact_4_natIn LeanFair Division
For the explicit instance, no natural EFX allocation encoded by two-intact-pair pattern 4 exists.
theorem efx_three_split_no_two_intact_4_nat (q : Fin 7 → Fin 4) : ¬ efx_three_split_efx_nat (efx_three_split_two_intact_code 4 q)
efx_three_split_no_two_intact_5_natIn LeanFair Division
For the explicit instance, no natural EFX allocation encoded by two-intact-pair pattern 5 exists.
theorem efx_three_split_no_two_intact_5_nat (q : Fin 7 → Fin 4) : ¬ efx_three_split_efx_nat (efx_three_split_two_intact_code 5 q)
efx_three_split_with_small_tailIn LeanFair Division
For the explicit nine-good instance, append any finite number of nonnegative goods whose total value is less than one for each agent. Every EFX allocation of all goods still splits at least three of the four original pairs.
theorem efx_three_split_with_small_tail {k : ℕ}
(w : Fin 4 → Fin (9+k) → ℝ)
(hw : ∀ i g, 0 ≤ w i g)
(hbase : ∀ i (g : Fin 9), w i (Fin.castAdd k g) = (efx_three_split_values i g : ℝ))
(htail : ∀ i, (∑ g : Fin k, w i (Fin.natAdd 9 g)) < 1)
(σ : Fin (9+k) → Fin 4) (hσ : is_efx_goods w σ) :
∀ a b : Fin 4, a ≠ b →
σ (Fin.castAdd k (![0,2,4,6] a)) ≠ σ (Fin.castAdd k (![1,3,5,7] a)) ∨
σ (Fin.castAdd k (![0,2,4,6] b)) ≠ σ (Fin.castAdd k (![1,3,5,7] b))envy_free_with_subsidy_of_aggregate_two_agentsIn LeanFair Division
For two agents, if the sum of the two agents' envy differences is nonnegative, v_0(A_0) - v_0(A_1) + v_1(A_1) - v_1(A_0) >= 0, then the allocation admits nonnegative subsidies making it envy-free.
theorem envy_free_with_subsidy_of_aggregate_two_agents {m : ℕ}
(v : Fin 2 → Finset (Fin m) → ℝ) (σ : Fin m → Fin 2)
(h : 0 ≤ (v 0 (bundle_of σ 0) - v 0 (bundle_of σ 1))
+ (v 1 (bundle_of σ 1) - v 1 (bundle_of σ 0))) :
∃ s : Fin 2 → ℝ, is_envy_free_with_subsidy v σ sequal_marginal_balanced_high_count_allocations_paddedIn LeanFair Division
For at least two agents and any finite number m of chores, each agent has an arbitrary set of high chores. There are n allocations such that each chore goes once to each agent across the n allocations; in each allocation every agent's chore count times n is at most m+n-1, and her high chore count times n is at most her total number of high chores plus n-1.
theorem equal_marginal_balanced_high_count_allocations_padded (n m : ℕ) (hn : 2 ≤ n) (H : Fin n → Finset (Fin m)) : ∃ F : Fin n → Fin m → Fin n, (∀ g, Function.Bijective (fun t => F t g)) ∧ ∀ t i, n * (bundle_of (F t) i).card ≤ m + n - 1 ∧ n * ((bundle_of (F t) i ∩ H i).card) ≤ (H i).card + n - 1
ex_post_five_fourths_mms_chore_lottery_existsIn LeanFair Division
For any n >= 1 agents and m indivisible chores with nonnegative additive costs, there exists an allocation lottery that is simultaneously ex-ante proportional and ex-post 5/4-MMS.
theorem ex_post_five_fourths_mms_chore_lottery_exists
(n m : ℕ) [NeZero n] (c : Fin n → Fin m → ℝ) (hc : ∀ i e, 0 ≤ c i e) :
∃ p ∈ stdSimplex ℝ (Fin m → Fin n),
is_ex_ante_proportional_chores c p ∧
is_ex_post_alpha_mms_chores (5 / 4) c pex_post_one_mms_chore_lottery_two_agentsIn LeanFair Division
For two agents and any m indivisible chores with nonnegative additive costs, there exists an allocation lottery that is simultaneously ex-ante proportional and ex-post 1-MMS.
theorem ex_post_one_mms_chore_lottery_two_agents (m : ℕ) (c : Fin 2 → Fin m → ℝ)
(hc : ∀ i e, 0 ≤ c i e) :
∃ p ∈ stdSimplex ℝ (Fin m → Fin 2),
is_ex_ante_proportional_chores c p ∧
is_ex_post_alpha_mms_chores 1 c pexists_finset_prescribed_countsIn LeanFair Division
Given a subset H of chores and counts a <= |H|, b <= |univ \ H|, there is a set S with exactly a elements of H and exactly b elements outside H, hence |S| = a + b.
theorem exists_finset_prescribed_counts {m : ℕ} (H : Finset (Fin m)) (a b : ℕ)
(ha : a ≤ H.card) (hb : b ≤ (Finset.univ \ H).card) :
∃ S : Finset (Fin m), S.card = a + b ∧ (S ∩ H).card = aexists_fpo_two_type_choresIn LeanFair Division
For n ≥ 2 agents, any chore totals a, b and strictly positive costs p, q, there exists an integer two-type allocation (sum x = a, sum y = b) that is fractionally Pareto optimal; explicitly, giving every chore to a single agent works.
theorem exists_fpo_two_type_chores {n : ℕ} (hn : 2 ≤ n) (a b : ℕ) (p q : Fin n → ℝ)
(hp : ∀ i, 0 < p i) (hq : ∀ i, 0 < q i) :
∃ x y : Fin n → ℕ, is_two_type_allocation n a b x y ∧
is_fractionally_pareto_optimal_two_type_chores p q x yexists_maxmin_value_identical_valuationIn LeanFair Division
For any valuation w and at least one agent, some allocation σ attains the max-min bundle value mu: every bundle of σ is worth at least mu, and every allocation has some bundle worth at most mu.
theorem exists_maxmin_value_identical_valuation {m n : ℕ} (hn : 0 < n)
(w : Fin m → ℝ) :
∃ (mu : ℝ) (sigma : Fin m → Fin n),
(∀ i, mu ≤ additive_valuation w (bundle_of sigma i)) ∧
(∀ tau : Fin m → Fin n, ∃ i, additive_valuation w (bundle_of tau i) ≤ mu)exists_potential_of_no_positive_simple_cycleIn LeanFair Division
If every simple cycle of a finite weighted digraph (weights c : α → α → ℝ on the complete digraph) has nonpositive total weight, then there is a real potential s with c i j ≤ s i - s j for all i j.
theorem exists_potential_of_no_positive_simple_cycle {α : Type*} [Fintype α]
(c : α → α → ℝ)
(h : ∀ (k : ℕ) (f : Fin (k + 1) → α),
Function.Injective (fun t : Fin k => f (Fin.castSucc t)) →
f 0 = f (Fin.last k) →
∑ t : Fin k, c (f (Fin.castSucc t)) (f (Fin.succ t)) ≤ 0) :
∃ s : α → ℝ, ∀ i j, c i j ≤ s i - s jfinset_card_filter_deviation_div_leIn LeanFair Division
Finite Chebyshev–Markov bound: for a real function X on a finite type with centre c, the proportion of points with |X - c| ≥ ε is at most ε^{-2} times the mean squared deviation from c.
theorem finset_card_filter_deviation_div_le {α : Type*} [Fintype α]
(X : α → ℝ) (c ε : ℝ) (hε : 0 < ε) :
((Finset.univ.filter (fun a => ε ≤ |X a - c|)).card : ℝ) / (Fintype.card α : ℝ) ≤
(1 / ε^2) * ((∑ a, (X a - c)^2) / (Fintype.card α : ℝ))finset_prod_prod_erase_powIn LeanFair Division
In any commutative monoid, the product of products over all elements j distinct from i in a finite set s equals the total product raised to the power (|s| - 1).
theorem finset_prod_prod_erase_pow {α M : Type*} [CommMonoid M] [DecidableEq α] (s : Finset α) (f : α → M) :
∏ i ∈ s, ∏ j ∈ s.erase i, f j = (∏ i ∈ s, f i) ^ (s.card - 1)four_agent_critical_equal_weight_allocation_familyIn LeanFair Division
For four agents and nine chores, suppose each agent designates five chores high. There exist four allocations such that every chore goes once to each agent across the allocations, agent i receives three chores in round i and two in every other round, and her three-chore bundle in round i contains at most one chore she designates high.
theorem four_agent_critical_equal_weight_allocation_family (H : Fin 4 → Finset (Fin 9)) (hH : ∀ i, (H i).card = 5) : ∃ F : Fin 4 → Fin 9 → Fin 4, (∀ g, Function.Bijective (fun t => F t g)) ∧ (∀ t i, (bundle_of (F t) i).card = if i = t then 3 else 2) ∧ ∀ t, ((bundle_of (F t) t) ∩ H t).card ≤ 1
fpo_of_weight_tie_two_agentsIn LeanFair Division
If an allocation of goods to two agents is optimal for some positive weighted sum of the two additive utilities — equivalently, there is t > 0 such that agent 0 gets only goods with t*u_1(g) ≤ u_0(g) and agent 1 gets only goods with u_0(g) ≤ t*u_1(g) — then the allocation is fractionally Pareto optimal.
theorem fpo_of_weight_tie_two_agents {m : ℕ} (u : Fin 2 → Fin m → ℝ) (σ : Fin m → Fin 2)
(h : ∃ t : ℝ, 0 < t ∧ ∀ g : Fin m,
(σ g = 1 → u 0 g ≤ t * u 1 g) ∧ (σ g = 0 → t * u 1 g ≤ u 0 g)) :
is_fractionally_pareto_optimal u σhas_consistent_online_alpha_mms_mono_factorIn LeanFair Division
For 1 ≤ r, if a consistent online allocator guarantees α-MMS after every bivalued prefix then it also guarantees β-MMS for every β ≥ α; so has_consistent_online_alpha_mms is monotone in the factor.
theorem has_consistent_online_alpha_mms_mono_factor {r α β : ℝ} (hr : 1 ≤ r) (hαβ : α ≤ β)
(h : has_consistent_online_alpha_mms r α) : has_consistent_online_alpha_mms r βhas_consistent_online_alpha_mms_twoIn LeanFair Division
For every r ≥ 1 there is a consistent deterministic online allocator for two agents guaranteeing a 2-MMS allocation after every prefix of every length whenever each agent's cost for each chore lies in {1, r}: the allocator that gives every arriving chore to agent 0.
theorem has_consistent_online_alpha_mms_two (r : ℝ) (hr : 1 ≤ r) :
has_consistent_online_alpha_mms r 2high_slack_small_bundle_sharp_mms_boundIn LeanFair Division
For positive n, nonnegative integer d and at least 2n(d+1) chores, ratio r>=1 and positive scale a, let every chore cost a or r*a. Any bundle of size at most floor(m/n) with at most ceil(the total number of high-cost chores/n)+d high-cost chores costs at most (r+1)/2 times the agent’s n-agent chore maximin share.
theorem high_slack_small_bundle_sharp_mms_bound (n m d : ℕ) (hn : 1 ≤ n) (hm : 2*n*(d+1) ≤ m) (r a : ℝ) (hr : 1 ≤ r) (ha : 0 < a) (u : Fin m → ℝ) (hu : ∀ g, u g = a ∨ u g = r*a) (S : Finset (Fin m)) (hs : n*S.card ≤ m) (hh : n*((S.filter fun g => u g = r*a).card) ≤ (Finset.univ.filter fun g => u g = r*a).card+n*(d+1)-1) : additive_valuation u S ≤ ((r+1)/2)*chore_maximin_share n u
is_alpha_mms_chores_mono_alphaIn LeanFair Division
For any m, n, cost matrix c and allocation σ, if every agent's maximin share is nonnegative then being α-MMS implies being β-MMS for every β ≥ α.
theorem is_alpha_mms_chores_mono_alpha {m n : ℕ} {α β : ℝ} (hαβ : α ≤ β)
{c : Fin n → Fin m → ℝ} {σ : Fin m → Fin n}
(hmms : ∀ i, 0 ≤ chore_maximin_share n (c i))
(h : is_alpha_mms_chores α c σ) : is_alpha_mms_chores β c σis_alpha_pmms_of_pair_half_boundIn LeanFair Division
If alpha ≥ 0 and an allocation (x,y) is such that every agent i's own bundle cost is at most (alpha/2) times the cost to i of the bundle she shares with any other agent j (bundle (x_i+x_j, y_i+y_j)), then (x,y) is alpha-PMMS.
theorem is_alpha_pmms_of_pair_half_bound {α : ℝ} (hα : 0 ≤ α)
{n : ℕ} {p q : Fin n → ℝ} (hp : ∀ i, 0 < p i) (hq : ∀ i, 0 < q i)
(x y : Fin n → ℕ)
(h : ∀ (i j : Fin n), i ≠ j →
p i * (x i : ℝ) + q i * (y i : ℝ) ≤
(α / 2) * (p i * ((x i + x j : ℕ) : ℝ) + q i * ((y i + y j : ℕ) : ℝ))) :
is_alpha_pmms_two_type_chores α p q x yis_efx_goods_nat_restrict_of_small_tailIn LeanFair Division
For natural-valued base goods and nonnegative real-valued additional goods whose total value is less than one for every agent, the restriction of any EFX allocation of all goods to the base goods is EFX.
theorem is_efx_goods_nat_restrict_of_small_tail {n m k : ℕ}
(v : Fin n → Fin m → ℕ) (w : Fin n → Fin (m+k) → ℝ)
(hw : ∀ i g, 0 ≤ w i g)
(hbase : ∀ i (g : Fin m), w i (Fin.castAdd k g) = (v i g : ℝ))
(htail : ∀ i, (∑ g : Fin k, w i (Fin.natAdd m g)) < 1)
(σ : Fin (m+k) → Fin n) (hσ : is_efx_goods w σ) :
is_efx_goods (fun i g => (v i g : ℝ)) (fun g => σ (Fin.castAdd k g))is_efx_goods_of_bundle_boundsIn LeanFair Division
For identical additive valuations, if every agent's bundle is worth at least R and removing any item from any bundle leaves value at most R, then the allocation is EFX.
theorem is_efx_goods_of_bundle_bounds {m n : ℕ} (u : Fin m → ℝ) (σ : Fin m → Fin n) (R : ℝ)
(h_ge : ∀ i : Fin n, R ≤ additive_valuation u (bundle_of σ i))
(h_le : ∀ j : Fin n, ∀ g ∈ bundle_of σ j, additive_valuation u ((bundle_of σ j).erase g) ≤ R) :
is_efx_goods (fun _ => u) σis_efx_goods_of_maxmin_bundle_valueIn LeanFair Division
If all agents share one valuation w with w ≥ 0, and the allocation σ has every bundle worth at least mu while no allocation gives every agent strictly more than mu (so mu is the max-min value), then σ is EFX.
theorem is_efx_goods_of_maxmin_bundle_value {m n : ℕ}
(w : Fin m → ℝ) (hw : ∀ g, 0 ≤ w g)
(sigma : Fin m → Fin n) (mu : ℝ)
(hsigma : ∀ i, mu ≤ additive_valuation w (bundle_of sigma i))
(hmu : ∀ tau : Fin m → Fin n, ∃ i, additive_valuation w (bundle_of tau i) ≤ mu) :
is_efx_goods (fun _ => w) sigmais_envy_free_with_subsidy_exists_iff_perm_welfare_maxIn LeanFair Division
An allocation admits a nonnegative subsidy vector making it envy-free if and only if it maximises utilitarian welfare among all permutations of its own bundles.
theorem is_envy_free_with_subsidy_exists_iff_perm_welfare_max {m n : ℕ}
(v : Fin n → Finset (Fin m) → ℝ) (sigma : Fin m → Fin n) :
(∃ s : Fin n → ℝ, is_envy_free_with_subsidy v sigma s) ↔
∀ pi : Equiv.Perm (Fin n),
∑ i, v i (bundle_of sigma (pi i)) ≤ ∑ i, v i (bundle_of sigma i)is_guaranteed_round_robin_ef1_factor_antitoneIn LeanFair Division
The property of being a guaranteed Round-Robin EF1 factor is antitone: if β is guaranteed and α ≤ β, then α is also guaranteed.
theorem is_guaranteed_round_robin_ef1_factor_antitone (n : ℕ) [NeZero n] {α β : ℝ} (h : α ≤ β)
(hβ : is_guaranteed_round_robin_ef1_factor n β) :
is_guaranteed_round_robin_ef1_factor n αis_two_pmms_twoIn LeanFair Division
Every two-chore-type allocation is 2-PMMS: each agent's bundle costs at most twice her pairwise maximin share against any other agent.
theorem is_two_pmms_two {n : ℕ} {p q : Fin n → ℝ} (hp : ∀ i, 0 < p i) (hq : ∀ i, 0 < q i)
(x y : Fin n → ℕ) : is_alpha_pmms_two_type_chores 2 p q x yiterated_round_robin_two_agents_item_preserving_swaps_leIn LeanFair Division
For two agents with additive utilities consistent with strict rankings, iterated Round Robin from truthful bids, where at each step an agent with a strictly profitable item-preserving swap replaces its bid by a best response among its item-preserving swaps, makes at most m(m-1)/2 manipulations.
theorem iterated_round_robin_two_agents_item_preserving_swaps_le (m : ℕ)
(pref : Fin 2 → Fin m ≃ Fin m) (v : Fin 2 → Fin m → ℝ) (hv : ∀ i g, 0 ≤ v i g)
(hcons : ∀ (i : Fin 2) (k l : Fin m), k < l → v i (pref i l) < v i (pref i k))
(f : ℕ → (Fin 2 → Fin m ≃ Fin m)) (hf0 : f 0 = pref) (T : ℕ)
(hf : ∀ t < T, irr_step v (round_robin_sequence 2 m)
(is_item_preserving_swap_bid (round_robin_sequence 2 m)) (f t) (f (t + 1))) :
T ≤ m * (m - 1) / 2maximin_share_additive_antitone_agentsIn LeanFair Division
For a nonnegative additive valuation, the 1-out-of-d maximin share is antitone in d: asking for fewer bundles (a 1-out-of-d guarantee with smaller d) can only make the guarantee larger.
theorem maximin_share_additive_antitone_agents {m : ℕ} (u : Fin m → ℝ) (hu : ∀ g, 0 ≤ u g)
{d d' : ℕ} (hd : 1 ≤ d) (hdd : d ≤ d') :
maximin_share (additive_valuation u) d' ≤ maximin_share (additive_valuation u) dmaximin_share_additive_le_averageIn LeanFair Division
For an additive valuation, the 1-out-of-d maximin share is at most the total value divided by d: in every partition some bundle is worth at most the average.
theorem maximin_share_additive_le_average {m d : ℕ} (u : Fin m → ℝ) (hd : 1 ≤ d) :
maximin_share (additive_valuation u) d ≤ (∑ g, u g) / (d : ℝ)maximin_share_ge_of_bundle_partitionIn LeanFair Division
If a single partition of the items into d bundles makes every bundle worth at least X, then the 1-out-of-d maximin share is at least X.
theorem maximin_share_ge_of_bundle_partition {m d : ℕ} (u : Fin m → ℝ) (hd : 1 ≤ d)
(P : Fin m → Fin d) {X : ℝ} (hP : ∀ k, X ≤ additive_valuation u (bundle_of P k)) :
X ≤ maximin_share (additive_valuation u) dmms_bad_cover_asymptoticIn LeanFair Division
Upper-bound partition family of arXiv:2610.06125 Section 3: there is g(n) = n + log₂ n + o(log₂ n) such that for all large n the n agents' partitions of the g(n) goods admit no covering allocation (no rainbow/transversal choice of one block per agent).
theorem mms_bad_cover_asymptotic :
∃ g : ℕ → ℕ,
(fun n : ℕ => (g n : ℝ) - (n : ℝ) - Real.logb 2 (n : ℝ)) =o[Filter.atTop]
(fun n : ℕ => Real.logb 2 (n : ℝ)) ∧
∀ᶠ n in Filter.atTop, mms_has_bad_cover n (g n)mms_bad_cover_not_existsIn LeanFair Division
A bad cover yields no MMS allocation: if the n partitions admit no choice of one block per agent with pairwise disjoint blocks, then taking v_i(S) = #{blocks of P_i contained in S} gives maximin share 1 for every agent, and no allocation reaches 1 for all agents.
theorem mms_bad_cover_not_exists {n m : ℕ} (hn : 1 ≤ n) {P : Fin n → Fin m → Fin n}
(h : mms_bad_cover n m P) : ¬ mms_exists_monotone n mmms_bad_cover_three_fiveIn LeanFair Division
With three agents and five goods there is a bad cover with no covering allocation, so no MMS allocation exists there and μ(3) ≤ 4.
theorem mms_bad_cover_three_five : mms_has_bad_cover 3 5
mms_bad_cover_two_fourIn LeanFair Division
With two agents and four goods there are two partitions of the four goods into two nonempty blocks with no covering allocation: the two crossing pairings {0,1}/{2,3} and {0,2}/{1,3}. So μ(2) ≤ 3, matching the known μ(2) = 3.
theorem mms_bad_cover_two_four : mms_has_bad_cover 2 4
mms_block_count_valuation_ge_oneIn LeanFair Division
For the block-count valuation, a bundle is worth at least 1 exactly when it contains one of the partition's blocks.
theorem mms_block_count_valuation_ge_one {m n : ℕ} (P : Fin m → Fin n) (S : Finset (Fin m)) :
1 ≤ mms_block_count_valuation P S ↔ ∃ k : Fin n, bundle_of P k ⊆ Smms_block_count_valuation_is_monotoneIn LeanFair Division
The block-count valuation of a partition with all blocks nonempty is a monotone valuation with value 0 on the empty set.
theorem mms_block_count_valuation_is_monotone {m n : ℕ} (P : Fin m → Fin n)
(hsurj : Function.Surjective P) :
is_monotone_valuation (mms_block_count_valuation P) ∧ mms_block_count_valuation P ∅ = 0mms_block_count_valuation_maximin_shareIn LeanFair Division
For the block-count valuation of a partition into n nonempty blocks, the maximin share among n agents is exactly 1: the MMS is at most 1 because for any partition the n blocks of the original partition can be counted in at most n bundles in total, and at least 1 because the original partition itself gives every bundle 1.
theorem mms_block_count_valuation_maximin_share {m n : ℕ} (P : Fin m → Fin n) (hn : 1 ≤ n)
(hsurj : Function.Surjective P) :
maximin_share (mms_block_count_valuation P) n = 1mms_no_bad_cover_two_threeIn LeanFair Division
Sanity check that the bad-cover predicate is not vacuous: with two agents and only three goods there is no bad cover, i.e. every pair of 2-block partitions of three goods admits a covering allocation.
theorem mms_no_bad_cover_two_three : ¬ mms_has_bad_cover 2 3
mms_not_exists_monotone_eventuallyIn LeanFair Division
For all sufficiently large n, there exists some number of goods K where an MMS allocation fails to exist, ensuring the set defining μ(n) is bounded above.
theorem mms_not_exists_monotone_eventually :
∀ᶠ n : ℕ in Filter.atTop, ∃ K : ℕ, ¬ mms_exists_monotone n Kmms_not_exists_of_bad_cover_of_leIn LeanFair Division
A bad cover for n agents on m goods also defeats MMS with any larger number of goods: passing to more goods by putting the extra items anywhere keeps the obstruction.
theorem mms_not_exists_of_bad_cover_of_le {n m m' : ℕ} (hn : 1 ≤ n)
(h : mms_has_bad_cover n m) (hle : m ≤ m') : ¬ mms_exists_monotone n m'mms_threshold_monotone_lower_asymptoticIn LeanFair Division
Conjectured asymptotic lower bound on μ(n) (OP-87, arXiv:2610.06125, Section 3): the threshold μ(n) is at least n + log₂ n - o(log₂ n) as n → ∞.
theorem mms_threshold_monotone_lower_asymptotic :
(fun n : ℕ => max 0 ((n : ℝ) + Real.logb 2 (n : ℝ) - (mms_threshold_monotone n : ℝ))) =o[Filter.atTop]
(fun n : ℕ => Real.logb 2 (n : ℝ))mms_threshold_monotone_lower_asymptotic_of_sequenceIn LeanFair Division
If a sequence f(n) is eventually at most the MMS threshold μ(n) and deviates from n + log₂ n by o(log₂ n), then max 0 (n + log₂ n - μ(n)) is o(log₂ n).
theorem mms_threshold_monotone_lower_asymptotic_of_sequence (f : ℕ → ℝ)
(hle : ∀ᶠ n : ℕ in Filter.atTop, f n ≤ (mms_threshold_monotone n : ℝ))
(hdiff : (fun n : ℕ => (n : ℝ) + Real.logb 2 (n : ℝ) - f n) =o[Filter.atTop]
(fun n : ℕ => Real.logb 2 (n : ℝ))) :
(fun n : ℕ => max 0 ((n : ℝ) + Real.logb 2 (n : ℝ) - (mms_threshold_monotone n : ℝ))) =o[Filter.atTop]
(fun n : ℕ => Real.logb 2 (n : ℝ))mms_threshold_monotone_lower_asymptotic_sequence_existsIn LeanFair Division
There exists an integer sequence f(n) such that MMS allocations exist for all m' ≤ f(n) and f(n) is asymptotically n + log₂ n - o(log₂ n).
theorem mms_threshold_monotone_lower_asymptotic_sequence_exists :
∃ f : ℕ → ℕ,
(∀ᶠ n : ℕ in Filter.atTop, ∀ m' ≤ f n, mms_exists_monotone n m') ∧
((fun n : ℕ => (n : ℝ) + Real.logb 2 (n : ℝ) - (f n : ℝ)) =o[Filter.atTop]
(fun n : ℕ => Real.logb 2 (n : ℝ)))mms_threshold_monotone_lower_asymptotic_threshold_of_existsIn LeanFair Division
If for all m' ≤ m every monotone instance with n agents and m' goods has an MMS allocation, and the threshold set is bounded above by a counterexample at K goods, then m ≤ μ(n).
theorem mms_threshold_monotone_lower_asymptotic_threshold_of_exists (n m : ℕ)
(hK : ∃ K : ℕ, ¬ mms_exists_monotone n K)
(hm : ∀ m' ≤ m, mms_exists_monotone n m') :
m ≤ mms_threshold_monotone nmms_threshold_monotone_lt_of_not_existsIn LeanFair Division
If there is no MMS allocation with K goods, then the threshold μ(n) is strictly below K.
theorem mms_threshold_monotone_lt_of_not_exists {n K : ℕ} (hK : 1 ≤ K)
(h : ¬ mms_exists_monotone n K) : mms_threshold_monotone n < Kmms_threshold_monotone_upper_asymptoticIn LeanFair Division
Asymptotic upper bound on μ(n) from arXiv:2610.06125 (Section 3): the threshold μ(n) is at most n + log₂ n + o(log₂ n) as n → ∞.
theorem mms_threshold_monotone_upper_asymptotic :
(fun n : ℕ => max 0 ((mms_threshold_monotone n : ℝ) - (n : ℝ) - Real.logb 2 (n : ℝ))) =o[Filter.atTop]
(fun n : ℕ => Real.logb 2 (n : ℝ))mms_threshold_upper_asymptotic_of_not_existsIn LeanFair Division
Assembly: if g(n) − n − log₂ n = o(log₂ n) and for all large n there is no MMS allocation with g(n) goods, then max 0 (μ(n) − n − log₂ n) = o(log₂ n).
theorem mms_threshold_upper_asymptotic_of_not_exists (g : ℕ → ℕ)
(hg : (fun n : ℕ => (g n : ℝ) - (n : ℝ) - Real.logb 2 (n : ℝ)) =o[Filter.atTop]
(fun n : ℕ => Real.logb 2 (n : ℝ)))
(hbad : ∀ᶠ n in Filter.atTop, ¬ mms_exists_monotone n (g n)) :
(fun n : ℕ => max 0 ((mms_threshold_monotone n : ℝ) - (n : ℝ) - Real.logb 2 (n : ℝ)))
=o[Filter.atTop] (fun n : ℕ => Real.logb 2 (n : ℝ))no_deterministic_online_upgrade_recourse_alpha_efx_choresIn LeanFair Division
Theorem 6.1 of arXiv:2611.00432: for every number of agents n ≥ 2 and finite approximation factor α ≥ 1, and for every deterministic prediction-free online chore algorithm alg with upgrade recourse, there exist a horizon m and an arrival sequence of identical strictly positive chore costs c such that alg's allocation at horizon m fails α-EFX (¬ is_alpha_efx_chores α ...), and the final instance admits an allocation σ that is both exactly EFX (is_alpha_efx_chores 1) and exactly MMS (is_alpha_mms_chores 1).
theorem no_deterministic_online_upgrade_recourse_alpha_efx_chores
(n : ℕ) (hn : 2 ≤ n) (α : ℝ) (hα : 1 ≤ α) (alg : DeterministicOnlineChoreRule n) :
∃ (m : ℕ) (c : Fin n → ℕ → ℝ),
(∀ i t, 0 < c i t) ∧ (∀ i j t, c i t = c j t) ∧
¬ is_alpha_efx_chores α (fun i (d : Fin m) => c i d.val) (alg.alloc c m) ∧
∃ σ : Fin m → Fin n,
is_alpha_efx_chores 1 (fun i (d : Fin m) => c i d.val) σ ∧
is_alpha_mms_chores 1 (fun i (d : Fin m) => c i d.val) σnon_wasteful_card_sumIn LeanFair Division
For a non-wasteful allocation rule on n agents and k * n + r objects, the bundle cardinalities sum to k * n + r.
theorem non_wasteful_card_sum (n k r : ℕ)
(f : (Fin n → LinearOrder (Fin (k * n + r))) → Fin n → Finset (Fin (k * n + r)))
(h_alloc : is_allocation_rule f) (h_nw : is_non_wasteful_rule f)
(succ : Fin n → LinearOrder (Fin (k * n + r))) :
∑ i, (f succ i).card = k * n + rnot_adversary_forces_ratio_of_two_leIn LeanFair Division
For r ≥ 1 and any horizon H, and any α ≥ 2, no adversary forces factor α by prefix H: the constant allocator that puts every chore on agent 0 is online and achieves 2-MMS after every bivalued prefix, and 2-MMS implies α-MMS.
theorem not_adversary_forces_ratio_of_two_le (r α : ℝ) (hr : 1 ≤ r) (H : ℕ) (hα : 2 ≤ α) :
¬ adversary_forces_ratio r α Hnot_fpo_of_cross_goodsIn LeanFair Division
If an allocation gives an LL good to agent 0 and an HH good to agent 1, it admits a fractional trade improving agent 0 while keeping agent 1's utility unchanged, and is therefore not fractionally Pareto optimal.
theorem not_fpo_of_cross_goods {m : ℕ} (a b : ℝ) (u : Fin 2 → Fin m → ℝ) (σ : Fin m → Fin 2)
(g1 g2 : Fin m) (hne : g1 ≠ g2) (hg1 : σ g1 = 1) (hg2 : σ g2 = 0)
(h_u0_g1 : u 0 g1 = a) (h_u0_g2 : u 0 g2 = 1)
(h_u1_g1 : u 1 g1 = b) (h_u1_g2 : u 1 g2 = 1)
(hb : 1 < b) (hba : b < a) :
¬ is_fractionally_pareto_optimal u σnot_is_guaranteed_round_robin_ef1_factor_of_witnessIn LeanFair Division
If there exists an instance with n agents and m goods with nonnegative weights admitting a pure Nash equilibrium under Round-Robin whose outcome is not α-EF1, then α is not guaranteed for n agents.
theorem not_is_guaranteed_round_robin_ef1_factor_of_witness (n : ℕ) [NeZero n] (α : ℝ)
(m : ℕ) (w : Fin n → Fin m → ℝ) (hw : ∀ i g, 0 ≤ w i g)
(rank : Fin n → Fin m ≃ Fin m)
(hpne : is_picking_sequence_pne
(SocialChoice.FairDivision.Indivisible.AdditiveValuation.toValuation ⟨w⟩)
(round_robin_sequence n m) rank)
(hnot : ¬ is_alpha_ef1 α
(SocialChoice.FairDivision.Indivisible.AdditiveValuation.toValuation ⟨w⟩)
(picking_sequence_outcome (round_robin_sequence n m) rank)) :
¬ is_guaranteed_round_robin_ef1_factor n αnot_planar_necklace_three_agents_two_cutsIn LeanFair Division
The statement planar_necklace_three_agents_two_cuts is false: The statement is false. Counterexample: the six collinear points P = {(0,0),(1,0),(2,0),(3,0),(4,0),(5,0)} on the x-axis, coloured by c p = 0 (red) if p.1 < 3 and c p = 1 (blue) otherwise. Then #red = 3 and #blue = 3, so both divisibility hypotheses hold, and each of the three agents must receive exactly one red and one blue point, i.e. exactly two points of P.
Why no two straight lines can do this. (1) alpha is surjective on P (all three agents get points), and alpha is constant on sign classes, so the number of sign classes is at least 3, hence |L| >= 2; combined with |L| <= 2 this gives L = {l1, l2} with l1 ≠ l2. (2) For a straight line l, the function x ↦ l.cut (x,0) is affine, x ↦ A x + C with A = l.cut.linear (1,0), C = l.cut 0. Consequently the sign data of l on the six points is one of only these patterns: (a) l contains all six points (only possible for the x-axis, in which case that sign bit is free at every point); (b) all six points lie strictly on one side (constant bit); (c) a threshold pattern — for some t the indices < t are on one side, the indices > t on the other, and at most the single index equal to t lies on l (that one point has a free bit). Two distinct lines cannot both have pattern (a), because both would have to be the x-axis. (3) Given data of these two kinds, the plane is divided into at most three sign cells with respect to the six points (as i = 0..5 increases, each bit flips at most once, monotonically), and only the at most two points lying on a line may be moved to an adjacent cell. Enumerating all 29 x 29 admissible sign-data pairs together with all maps from the four possible sign cells to the three agents and all red-blue pairings shows that no arrangement admits a fair allocation: exactly zero feasible pairs remain once the sole spurious pair (both lines = the x-axis) is discarded. This enumeration was carried out and machine-checked in Lean (experiment 4536: ((idxPairs.filter fun p => ... && Feas (getD p.1) (getD p.2)).length evaluates to 0). The human-readable reason for the hardest case (one line = the x-axis, so that bit is free everywhere): the second line then splits the indices into a prefix and a suffix, one agent would have to take its whole (1,1) share from the prefix and another its whole (1,1) share from the suffix, but any prefix of R,R,R,B,B,B that contains a blue contains three reds, and any suffix that contains a red contains three blues.
Note also that the natural "parallel two-cut" reduction is genuinely weaker than the statement and cannot rescue it: with two parallel cuts the 1-D problem also fails on the ordering R,R,R,B,B,B (machine-checked, experiment 4520); it succeeds there only through a linear functional that vanishes on the carrier line, which requires the two "lines" to coincide and hence yields only two sign classes.
For the record, the following structural lemma in this topic is true and was proved in full in Lean during this attempt (it is the statement of the existing node is_straight_line_cut_consistent_of_parallel_cuts): if phi ≠ 0 is a linear functional, t1 < t2, and alpha : ℝ×ℝ → Fin 3 satisfies alpha p = 0 → phi p ≤ t1, alpha p = 1 → t1 ≤ phi p ≤ t2, alpha p = 2 → t2 ≤ phi p, then some L with L.card ≤ 2 is consistent with alpha on P (take the two lines phi = t1 and phi = t2, and let s put a point strictly above a line on the true side, strictly below on the false side, and on a line send it to its own agent).
theorem not_planar_necklace_three_agents_two_cuts : ¬ (∀ (P : Finset (ℝ × ℝ)) (c : (ℝ × ℝ) → Fin 2)
(h_red : 3 ∣ (P.filter (fun p => c p = 0)).card)
(h_blue : 3 ∣ (P.filter (fun p => c p = 1)).card), ∃ (L : Finset StraightLine) (α : (ℝ × ℝ) → Fin 3),
L.card ≤ 2 ∧
is_straight_line_cut_consistent P L α ∧
∀ i : Fin 3,
(P.filter (fun p => α p = i ∧ c p = 0)).card = (P.filter (fun p => c p = 0)).card / 3 ∧
(P.filter (fun p => α p = i ∧ c p = 1)).card = (P.filter (fun p => c p = 1)).card / 3)not_reciprocal_between_consecutive_reciprocalsIn LeanFair Division
Every ratio r in [1,2] which is not 1 and not of the form 1 + 1/k for a positive integer k lies strictly between two consecutive reciprocal values: there is t ≥ 2 with 1 + 1/t < r < 1 + 1/(t-1).
theorem not_reciprocal_between_consecutive_reciprocals (r : ℝ) (hr1 : 1 ≤ r) (hr2 : r ≤ 2)
(h1 : r ≠ 1) (h2 : ∀ k : ℕ, 1 ≤ k → r ≠ 1 + 1 / (k : ℝ)) :
∃ t : ℕ, 2 ≤ t ∧ 1 + 1 / (t : ℝ) < r ∧ r < 1 + 1 / ((t - 1 : ℕ) : ℝ)not_two_cuts_collinear_sixIn LeanFair Division
There is no set L of at most two straight lines and no allocation α consistent with L on the six collinear points (0,0),...,(5,0), coloured R,R,R,B,B,B, such that each of the three agents receives exactly one red and one blue point.
theorem not_two_cuts_collinear_six (L : Finset StraightLine) (α : (ℝ × ℝ) → Fin 3)
(hcard : L.card ≤ 2)
(hcons : is_straight_line_cut_consistent collinear_six_points L α)
(hfair : ∀ a : Fin 3,
(collinear_six_points.filter (fun p => α p = a ∧ collinear_six_coloring p = 0)).card = 1 ∧
(collinear_six_points.filter (fun p => α p = a ∧ collinear_six_coloring p = 1)).card = 1) :
Falseobjectwise_mm_of_single_agent_stepsIn LeanFair Division
If a rule is unchanged whenever one agent alone replaces her preference by an objectwise Maskin improvement of it, then the rule satisfies objectwise Maskin monotonicity outright.
theorem objectwise_mm_of_single_agent_steps {Agent Object : Type*} [DecidableEq Agent] [Fintype Agent]
(f : (Agent → LinearOrder Object) → Agent → Finset Object)
(h_step : ∀ (succ : Agent → LinearOrder Object) (i : Agent) (o : LinearOrder Object),
(∀ y ∈ f succ i, ∀ z : Object, (succ i).lt z y → o.lt z y) →
f (Function.update succ i o) = f succ) :
satisfies_objectwise_mm foffline_identical_costs_efx_and_mmsIn LeanFair Division
For any number of agents n ≥ 2, any k with 1 ≤ k ≤ n + 1, and any cost ε with 0 < ε ≤ 1/2, the instance of k + 1 chores where chore k has cost 1 and chores 0 through k - 1 have cost ε for all agents admits an allocation σ that is both exactly EFX (is_alpha_efx_chores 1) and exactly MMS (is_alpha_mms_chores 1).
theorem offline_identical_costs_efx_and_mms (n : ℕ) (hn : 2 ≤ n) (k : ℕ) (hk : 1 ≤ k) (hkn : k ≤ n + 1)
(ε : ℝ) (hε0 : 0 < ε) (hε : ε ≤ 1 / 2) :
∃ σ : Fin (k + 1) → Fin n,
is_alpha_efx_chores 1 (fun _ (d : Fin (k + 1)) => if d.val = k then 1 else ε) σ ∧
is_alpha_mms_chores 1 (fun _ (d : Fin (k + 1)) => if d.val = k then 1 else ε) σop561_four_agents_two_fifths_algorithmIn LeanFair Division
There is a deterministic online algorithm for four agents with additive nonnegative valuations and exact frequency predictions (sorted-marginal predictions) that always produces a (2/5)-EF1 allocation. Since (3 - sqrt 5)/2 < 2/5, this is a concrete constant strictly above the published (3 - sqrt 5)/2.
theorem op561_four_agents_two_fifths_algorithm : has_online_alpha_ef1_algorithm 4 (2 / 5 : ℝ)
op561_ratio_gt_sqrt5In LeanFair Division
Open problem OP-561 (arXiv:2610.34625, Sec. 5): the online EF1 approximation ratio for four agents strictly exceeds (3 - sqrt 5)/2.
theorem op561_ratio_gt_sqrt5 :
(3 - Real.sqrt 5) / 2 < online_ef1_approximation_ratio 4op562_additive_valuation_monoIn LeanFair Division
For an additive valuation with nonnegative item values, the value of a sub-bundle is at most the value of the containing bundle.
theorem op562_additive_valuation_mono {m : ℕ} (u : Fin m → ℝ) (hu : ∀ g, 0 ≤ u g) {A B : Finset (Fin m)} (h : A ⊆ B) : additive_valuation u A ≤ additive_valuation u Bop562_critical_threshold_separates_reductionIn LeanFair Division
Assembly lemma: if the error factor is achievable for every ρ in [1, L) and unachievable for every ρ ≥ U, then the threshold eefx_overestimate_threshold n lies in [L, U], every ρ in [1, threshold) is achievable, and no ρ above the threshold is achievable.
theorem op562_critical_threshold_separates_reduction (n : ℕ) (L U : ℝ) (hL : 1 < L) (hex : ∀ ρ : ℝ, 1 ≤ ρ → ρ < L → has_consistent_eefx_algorithm n ρ) (hnon : ∀ ρ : ℝ, U ≤ ρ → ¬ has_consistent_eefx_algorithm n ρ) : L ≤ eefx_overestimate_threshold n ∧ eefx_overestimate_threshold n ≤ U ∧ (∀ ρ : ℝ, 1 ≤ ρ → ρ < eefx_overestimate_threshold n → has_consistent_eefx_algorithm n ρ) ∧ (∀ ρ : ℝ, eefx_overestimate_threshold n < ρ → ¬ has_consistent_eefx_algorithm n ρ)
op562_eefx_bundle_of_rest_boundIn LeanFair Division
If a bundle is worth at least α times the whole complement, it is α-EEFX (the complement is a valid single part of the n-1 part repartition).
theorem op562_eefx_bundle_of_rest_bound {m n : ℕ} (hn : 2 ≤ n) {v : Finset (Fin m) → ℝ} {α : ℝ} (hα : 0 ≤ α) (hmono : ∀ A B : Finset (Fin m), A ⊆ B → v A ≤ v B) (S : Finset (Fin m)) (h : α * v (Finset.univ \ S) ≤ v S) : is_alpha_eefx_bundle v n α Sop562_eefx_bundle_of_sparse_complementIn LeanFair Division
If an agent's bundle leaves at most n-1 items unassigned and the valuation is nonnegative with v(∅) = 0, the bundle is α-EEFX for every α ≥ 0.
theorem op562_eefx_bundle_of_sparse_complement {m n : ℕ} {v : Finset (Fin m) → ℝ} {α : ℝ} (hα : 0 ≤ α) (hzero : v ∅ = 0) (S : Finset (Fin m)) (hcard : (Finset.univ \ S).card ≤ n - 1) (hS : 0 ≤ v S) : is_alpha_eefx_bundle v n α Sop562_one_lt_lower_bound_ratioIn LeanFair Division
For n ≥ 3 the lower bound (2n-2)/(2n-3) is strictly greater than 1, so the interval [1, L) is nonempty.
theorem op562_one_lt_lower_bound_ratio (n : ℕ) (hn : 3 ≤ n) : (1 : ℝ) < (2 * (n : ℝ) - 2) / (2 * n - 3)
op562_overestimate_prediction_monoIn LeanFair Division
A prediction that overestimates with error factor ρ also overestimates with any larger error factor ρ' ≥ ρ (for nonnegative valuations).
theorem op562_overestimate_prediction_mono {m n : ℕ} {ρ ρ' : ℝ} {v a_hat : Fin n → Fin m → ℝ} (hρ : ρ ≤ ρ') (hv : ∀ i g, 0 ≤ v i g) (h : is_overestimate_prediction ρ v a_hat) : is_overestimate_prediction ρ' v a_hatop562_threshold_mono_of_error_factorIn LeanFair Division
The set of achievable error factors is downward closed: if a consistent online algorithm achieves a positive EEFX guarantee under error factor ρ, it achieves one under every smaller error factor ρ' ≤ ρ (same algorithm, same α).
theorem op562_threshold_mono_of_error_factor (n : ℕ) {ρ ρ' : ℝ} (hρ : ρ' ≤ ρ) (h : has_consistent_eefx_algorithm n ρ) : has_consistent_eefx_algorithm n ρ'op562_two_agents_consistent_of_lt_twoIn LeanFair Division
For two agents and any error factor rho with 1 <= rho < 2, there exists a consistent online algorithm guaranteeing a positive approximation of EEFX.
theorem op562_two_agents_consistent_of_lt_two (ρ : ℝ) (hρ1 : 1 ≤ ρ) (hρ2 : ρ < 2) :
has_consistent_eefx_algorithm 2 ρop562_two_agents_not_consistent_at_twoIn LeanFair Division
For two agents and error factor rho = 2, no consistent online algorithm can guarantee any positive approximation of EEFX.
theorem op562_two_agents_not_consistent_at_two :
¬ has_consistent_eefx_algorithm 2 2op562_two_agents_not_consistent_of_ge_twoIn LeanFair Division
For two agents and any error factor rho >= 2, no consistent online algorithm can guarantee any positive approximation of EEFX.
theorem op562_two_agents_not_consistent_of_ge_two (ρ : ℝ) (hρ : 2 ≤ ρ) :
¬ has_consistent_eefx_algorithm 2 ρop819_online_single_high_alpha_efx_largeIn LeanFair Division
For any natural number R >= 4 and any number of goods m >= 3 ceil(sqrt R), there exists a deterministic online allocator for 3 agents achieving (sqrt R + 1)⁻¹-EFX on all single-high valuation profiles with ratio R.
theorem op819_online_single_high_alpha_efx_large (R : ℕ) (hR : 4 ≤ R) (m : ℕ)
(hm : 3 * Nat.ceil (Real.sqrt (R : ℝ)) ≤ m) :
has_online_single_high_alpha_efx 3 m (R : ℝ) (Real.sqrt (R : ℝ) + 1)⁻¹op819_online_single_high_alpha_efx_smallIn LeanFair Division
For any natural number R >= 4 and any number of goods m with 1 <= m < 3 ceil(sqrt R), there exists a deterministic online allocator for 3 agents achieving (sqrt R + 1)⁻¹-EFX on all single-high valuation profiles with ratio R.
theorem op819_online_single_high_alpha_efx_small (R : ℕ) (hR : 4 ≤ R) (m : ℕ)
(hm_pos : 1 ≤ m) (hm_lt : m < 3 * Nat.ceil (Real.sqrt (R : ℝ))) :
has_online_single_high_alpha_efx 3 m (R : ℝ) (Real.sqrt (R : ℝ) + 1)⁻¹op819_online_single_high_efx_ratio_ge_of_forall_mIn LeanFair Division
If an approximation ratio alpha in [0, 1] satisfies has_online_single_high_alpha_efx 3 m R alpha for every number of goods m >= 1, then alpha is at most the competitive ratio online_single_high_efx_ratio R.
theorem op819_online_single_high_efx_ratio_ge_of_forall_m (R α : ℝ) (h0 : 0 ≤ α) (h1 : α ≤ 1)
(hall : ∀ (m : ℕ), 1 ≤ m → has_online_single_high_alpha_efx 3 m R α) :
α ≤ online_single_high_efx_ratio Rop819_online_single_high_efx_ratio_lower_boundIn LeanFair Division
For any natural number R >= 4, the online single-high EFX competitive ratio for three agents is at least 1 / (sqrt(R) + 1).
theorem op819_online_single_high_efx_ratio_lower_bound :
∀ (R : ℕ), 4 ≤ R → (Real.sqrt (R : ℝ) + 1)⁻¹ ≤ online_single_high_efx_ratio (R : ℝ)op819_online_single_high_efx_ratio_upper_boundNeeds helpFair Division
For any natural number R >= 4, the online single-high EFX competitive ratio for three agents is at most 1 / (sqrt(R) - 1).
theorem op819_online_single_high_efx_ratio_upper_bound :
∀ (R : ℕ), 4 ≤ R → online_single_high_efx_ratio (R : ℝ) ≤ (Real.sqrt (R : ℝ) - 1)⁻¹op826_single_high_efx_of_high_dataIn LeanFair Division
Present a single-high profile with ratio R by the map h sending each agent i to her unique high good h i (value R on h i, value 1 elsewhere). If, for all distinct agents i, j and every good g in j's bundle, alpha times the cardinality of j's bundle without g, plus a bonus R-1 exactly when i's high good survives, is at most the cardinality of i's own bundle plus a bonus R-1 exactly when i's high good lies in it, then the allocation is alpha-EFX for this profile.
theorem op826_single_high_efx_of_high_data (R α : ℝ) {m : ℕ} (h : Fin 3 → Fin m) (σ : Fin m → Fin 3)
(hcond : ∀ i j : Fin 3, i ≠ j → ∀ g ∈ bundle_of σ j,
α * (((bundle_of σ j).erase g).card + (R - 1) * (if h i ∈ (bundle_of σ j).erase g then (1:ℝ) else 0))
≤ (bundle_of σ i).card + (R - 1) * (if h i ∈ bundle_of σ i then (1:ℝ) else 0)) :
is_alpha_efx_goods (fun i g => if g = h i then R else 1) α σop_1005_find_tIn LeanFair Division
For real numbers 1 < b < a where no k >= 1 satisfies b <= 1 + 1/k <= a, there exists an integer t such that t * a < t + 1 and t + 2 < (t + 1) * b.
theorem op_1005_find_t (a b : ℝ) (hb : 1 < b) (hba : b < a)
(hnot : ¬ ∃ k : ℕ, 1 ≤ k ∧ b ≤ 1 + 1 / (k : ℝ) ∧ 1 + 1 / (k : ℝ) ≤ a) :
∃ t : ℕ, (t : ℝ) * a < (t : ℝ) + 1 ∧ (t : ℝ) + 2 < ((t : ℝ) + 1) * bop_1005_obstruction_no_efx_fpoIn LeanFair Division
For the 2t+4 goods instance with t+2 HH goods and t+2 LL goods, when t*a < t+1 and t+2 < (t+1)*b, no allocation can be simultaneously EFX and fractionally Pareto optimal.
theorem op_1005_obstruction_no_efx_fpo (t : ℕ) (a b : ℝ)
(hb : 1 < b) (hba : b < a)
(hta : (t : ℝ) * a < (t : ℝ) + 1)
(htb : (t : ℝ) + 2 < ((t : ℝ) + 1) * b) :
∀ σ : Fin (2 * t + 4) → Fin 2,
¬ (is_efx_goods (fun i g => if (g : ℕ) < t + 2 then (if i = 0 then a else b) else 1) σ ∧
is_fractionally_pareto_optimal (fun i g => if (g : ℕ) < t + 2 then (if i = 0 then a else b) else 1) σ)op_1553_sharp_alpha_normal_formIn LeanFair Division
For p ≥ 19 the conjectured factor (3p+1)/(2p) equals 3/2 + 1/(4r) with r = p/2, is strictly smaller than the proved 5/3 bound, and at p = 19 it reads 29/19 with horizon (p+3)/2 = 11.
theorem op_1553_sharp_alpha_normal_form (p : ℕ) (hp : 19 ≤ p) :
(3 * (p : ℝ) + 1) / (2 * (p : ℝ)) = 3 / 2 + 1 / (4 * ((p : ℝ) / 2)) ∧
(3 * (p : ℝ) + 1) / (2 * (p : ℝ)) < 5 / 3 ∧
((3 * (19 : ℝ) + 1) / (2 * (19 : ℝ)) = 29 / 19) ∧ ((19 + 3) / 2 = 11)op_1553_upper_bound_sharp_mmsIn LeanFair Division
For every p ≥ 19 with p ≡ 3 (mod 4), r = p/2 and α = (3p+1)/(2p), there is a consistent deterministic online allocator for two agents producing an α-MMS allocation after every prefix of every length whenever each agent's cost for each chore lies in {1, r}.
theorem op_1553_upper_bound_sharp_mms (p : ℕ) (hp : 19 ≤ p) (hmod : p % 4 = 3) :
has_consistent_online_alpha_mms ((p : ℝ) / 2) ((3 * (p : ℝ) + 1) / (2 * (p : ℝ)))pair_split_max_ge_half_totalIn LeanFair Division
For a two-type bundle with X type-A and Y type-B chores, costs p, q > 0 per chore, and any integral split of it into (s,t) and (X-s,Y-t), the more expensive of the two parts costs at least half the whole bundle, i.e. max(p*s+q*t, p*(X-s)+q*(Y-t)) >= (p*X+q*Y)/2.
theorem pair_split_max_ge_half_total (p q : ℝ) (X Y s t : ℕ) (hs : s ≤ X) (ht : t ≤ Y) :
(p * (X : ℝ) + q * (Y : ℝ)) / 2 ≤
max (p * (s : ℝ) + q * (t : ℝ))
(p * ((X - s : ℕ) : ℝ) + q * ((Y - t : ℕ) : ℝ))pairwise_dominates_card_leIn LeanFair Division
If a bundle S pairwise-dominates a bundle S' (for an arbitrary relation le), then S' has at most as many elements as S.
theorem pairwise_dominates_card_le {α : Type*} (le : α → α → Prop) (S S' : Finset α)
(h : pairwise_dominates le S S') : S'.card ≤ S.cardparabola_necklace_card_and_colorsIn LeanFair Division
The point set P = {(i, i²) : i ∈ ZMod m} in ℝ² has cardinality r + b, and the coloring c(p) = (if p.1 < r then 0 else 1) assigns color 0 to exactly r points and color 1 to exactly b points.
theorem parabola_necklace_card_and_colors (m r b : ℕ) [NeZero m]
(hm : m = r + b) :
let P : Finset (ℝ × ℝ) := Finset.univ.image (fun (j : ZMod m) => ((j.val : ℝ), (j.val : ℝ)^2))
let c : (ℝ × ℝ) → Fin 2 := fun p => if p.1 < (r : ℝ) then 0 else 1
P.card = r + b ∧
(P.filter (fun p => c p = 0)).card = r ∧
(P.filter (fun p => c p = 1)).card = bparabola_necklace_fair_transitions_geIn LeanFair Division
Any fair allocation α giving each of k agents r/k points of color 0 (indices < r) and b/k points of color 1 (indices ≥ r) on the parabola point set induces at least 2(k - 1) cyclic transitions where α(pt(i)) ≠ α(pt(i+1)).
theorem parabola_necklace_fair_transitions_ge (m k r b : ℕ) [NeZero m]
(hm : m = r + b) (hk : 2 ≤ k) (hr : k ≤ r) (hb : k ≤ b)
(α : (ℝ × ℝ) → Fin k)
(h_fair : ∀ i : Fin k,
((Finset.univ.image (fun (j : ZMod m) => ((j.val : ℝ), (j.val : ℝ)^2))).filter
(fun p => α p = i ∧ (if p.1 < (r : ℝ) then (0 : Fin 2) else 1) = 0)).card = r / k ∧
((Finset.univ.image (fun (j : ZMod m) => ((j.val : ℝ), (j.val : ℝ)^2))).filter
(fun p => α p = i ∧ (if p.1 < (r : ℝ) then (0 : Fin 2) else 1) = 1)).card = b / k) :
2 * (k - 1) ≤ (Finset.univ.filter (fun (i : ZMod m) =>
α ((i.val : ℝ), (i.val : ℝ)^2) ≠ α (((i + 1 : ZMod m).val : ℝ), ((i + 1 : ZMod m).val : ℝ)^2))).cardpicking_alloc_prefix_image_of_monotoneIn LeanFair Division
If a permutation g of the goods is order-compatible with every agent's ranking on that agent's turns (the good g t ranks above g u for every later turn u), then the first s turns of the picking sequence allocate exactly the goods g 0, ..., g (s-1).
theorem picking_alloc_prefix_image_of_monotone
{n m : ℕ} (seq : List (Fin n)) (hlen : seq.length = m)
(r : Fin n → Fin m ≃ Fin m) (g : Fin m ≃ Fin m)
(hg : ∀ i : Fin n, ∀ t ∈ picking_turn_set seq hlen i, ∀ u : Fin m, t < u →
(g.trans (r i).symm) t < (g.trans (r i).symm) u)
(s : ℕ) (hs : s ≤ m) :
(picking_prefix_state seq r s).2 =
(Finset.univ.filter (fun t : Fin m => t.val < s)).image gpicking_block_perm_countIn LeanFair Division
The number of permutations of Fin m that are increasing on each up-set of a set T of positions (π t < π u whenever t ∈ T and t < u) equals the product over k outside T of (m - k).
theorem picking_block_perm_count {m : ℕ} (T : Finset (Fin m)) :
((Finset.univ : Finset (Fin m ≃ Fin m)).filter
(fun π => ∀ t ∈ T, ∀ u : Fin m, t < u → π t < π u)).card
= ∏ k ∈ (Finset.univ.filter (fun k : Fin m => k ∉ T)), (m - k.val)picking_block_perm_prod_eqIn LeanFair Division
If the sets T_1, ..., T_n partition Fin m, the product over i of the number of permutations increasing on the up-sets of T_i equals (m!)^(n-1).
theorem picking_block_perm_prod_eq {n m : ℕ} (T : Fin n → Finset (Fin m))
(hdisj : ∀ i j : Fin n, i ≠ j → Disjoint (T i) (T j))
(hcover : ∀ k : Fin m, ∃ i : Fin n, k ∈ T i) :
∏ i : Fin n,
((Finset.univ : Finset (Fin m ≃ Fin m)).filter
(fun π => ∀ t ∈ T i, ∀ u : Fin m, t < u → π t < π u)).card
= (Nat.factorial m) ^ (n - 1)picking_consumption_perm_existsIn LeanFair Division
For every profile of rankings there is a single permutation g of the goods (the order in which goods are physically consumed) such that the goods allocated after s turns are g 0, ..., g (s-1), agent i's bundle is g applied to agent i's turn set T_i, and g is order-compatible with every agent's ranking on that agent's turns.
theorem picking_consumption_perm_exists
{n m : ℕ} (seq : List (Fin n)) (hlen : seq.length = m)
(r : Fin n → Fin m ≃ Fin m) :
∃ g : Fin m ≃ Fin m,
(∀ s : ℕ, s ≤ m → (picking_prefix_state seq r s).2 =
(Finset.univ.filter (fun t : Fin m => t.val < s)).image g) ∧
(∀ i : Fin n, picking_sequence_outcome seq r i = (picking_turn_set seq hlen i).image g) ∧
(∀ i : Fin n, ∀ t ∈ picking_turn_set seq hlen i, ∀ u : Fin m, t < u →
(g.trans (r i).symm) t < (g.trans (r i).symm) u)picking_prefix_grab_achievableIn LeanFair Division
In a three-agent Round-Robin run (no equilibrium hypothesis needed), if g is still unallocated just before agent i's (r+1)-th turn, then some reported ranking of i yields i a bundle whose value to i is at least the value of i's first r goods plus w i g.
theorem picking_prefix_grab_achievable
(m : ℕ) (w : Fin 3 → Fin m → ℝ) (hw : ∀ i g, 0 ≤ w i g)
(rank : Fin 3 → Fin m ≃ Fin m)
(i : Fin 3) (r : ℕ) (hs : i.val + 3 * r < m) (g : Fin m)
(hg : g ∉ (picking_prefix_state (round_robin_sequence 3 m) rank (i.val + 3 * r)).2) :
∃ r' : Fin m ≃ Fin m,
(∑ x ∈ (picking_prefix_state (round_robin_sequence 3 m) rank (i.val + 3 * r)).1 i, w i x)
+ w i g
≤ ∑ x ∈ picking_sequence_outcome (round_robin_sequence 3 m) (Function.update rank i r') i,
w i xpicking_prefix_grab_deviationIn LeanFair Division
In a three-agent Round-Robin pure Nash equilibrium, if g is unallocated just before agent i's (r+1)-th turn, then the value of i's first r goods plus w i g is at most the value of i's final bundle; otherwise i would profit by deviating to grab g.
theorem picking_prefix_grab_deviation
(m : ℕ) (w : Fin 3 → Fin m → ℝ) (hw : ∀ i g, 0 ≤ w i g)
(rank : Fin 3 → Fin m ≃ Fin m)
(h : is_picking_sequence_pne
(SocialChoice.FairDivision.Indivisible.AdditiveValuation.toValuation ⟨w⟩)
(round_robin_sequence 3 m) rank)
(i : Fin 3) (r : ℕ) (hs : i.val + 3 * r < m) (g : Fin m)
(hg : g ∉ (picking_prefix_state (round_robin_sequence 3 m) rank (i.val + 3 * r)).2) :
(∑ x ∈ (picking_prefix_state (round_robin_sequence 3 m) rank (i.val + 3 * r)).1 i, w i x)
+ w i g
≤ ∑ x ∈ picking_sequence_outcome (round_robin_sequence 3 m) rank i, w i xpicking_prefix_state_bundle_subsetIn LeanFair Division
A good allocated to agent a in the first s turns of a picking-sequence run is still in a's final bundle: the partial allocation is monotone in time.
theorem picking_prefix_state_bundle_subset {N G : Type*} [DecidableEq N] [DecidableEq G]
{m : ℕ} (seq : List N) (rank : N → Fin m ≃ G) (s : ℕ) (a : N) :
(picking_prefix_state seq rank s).1 a ⊆ picking_sequence_outcome seq rank apicking_rank_trajectory_fibre_countsIn LeanFair Division
Writing A_j for the number of permutations increasing on the up-sets of T_j, and a_i for those of them whose image of T_i sorts to the prescribed list s i: the joint count of profiles realising all lists s i is m! times the product of the a_i, and the marginal count for agent i alone is m! times a_i times the product of A_j over j ≠ i.
theorem picking_rank_trajectory_fibre_counts
{n m : ℕ} (seq : List (Fin n)) (hlen : seq.length = m) (s : Fin n → List (Fin m)) :
(let A : Fin n → ℕ := fun j =>
((Finset.univ : Finset (Fin m ≃ Fin m)).filter
(fun (π : Fin m ≃ Fin m) => ∀ t ∈ picking_turn_set seq hlen j, ∀ u : Fin m, t < u → π t < π u)).card
let a : Fin n → ℕ := fun i =>
((Finset.univ : Finset (Fin m ≃ Fin m)).filter
(fun (π : Fin m ≃ Fin m) => (∀ t ∈ picking_turn_set seq hlen i, ∀ u : Fin m, t < u → π t < π u)
∧ ((picking_turn_set seq hlen i).image (fun x => π x)).sort (· ≤ ·) = s i)).card
((Finset.univ : Finset (Fin n → Fin m ≃ Fin m)).filter
(fun r => ∀ i, ((picking_sequence_outcome seq r i).image (r i).symm).sort (· ≤ ·) = s i)).card
= Nat.factorial m * ∏ i : Fin n, a i
∧ ∀ i : Fin n,
((Finset.univ : Finset (Fin n → Fin m ≃ Fin m)).filter
(fun r => ((picking_sequence_outcome seq r i).image (r i).symm).sort (· ≤ ·) = s i)).card
= Nat.factorial m * a i * ∏ j ∈ (Finset.univ.erase i), A j)picking_sequence_outcome_card_eq_countIn LeanFair Division
If a picking sequence has at most as many turns as there are goods, then every turn consumes exactly one good, so agent a's final bundle has exactly as many goods as the number of times a appears in the sequence.
theorem picking_sequence_outcome_card_eq_count {N G : Type*} [DecidableEq N] [DecidableEq G]
{m : ℕ} (seq : List N) (rank : N → Fin m ≃ G) (a : N) (hlen : seq.length ≤ m) :
(picking_sequence_outcome seq rank a).card = seq.count apicking_trajectory_algebra_identityIn LeanFair Division
If the product of the sequence block counts A i equals (m!)^(n-1), then (m! * ∏ a_i)/(m!)^n equals the product over i of (m! * a_i * ∏_{j ≠ i} A_j)/(m!)^n.
theorem picking_trajectory_algebra_identity (n m : ℕ) (hn : 2 ≤ n) (hm : 1 ≤ m)
(A a : Fin n → ℕ)
(hA : ∏ i : Fin n, A i = (Nat.factorial m) ^ (n - 1)) :
(((Nat.factorial m : ℚ) * ∏ i : Fin n, (a i : ℚ)) / ((Nat.factorial m : ℚ) ^ n)) =
∏ i : Fin n,
(((Nat.factorial m : ℚ) * (a i : ℚ) * ∏ j ∈ Finset.univ.erase i, (A j : ℚ)) / ((Nat.factorial m : ℚ) ^ n))picking_turn_set_partitionIn LeanFair Division
When the picking sequence has length m, the turn sets T_i (turns at which agent i acts) are pairwise disjoint and cover all of Fin m.
theorem picking_turn_set_partition
{n m : ℕ} (seq : List (Fin n)) (hlen : seq.length = m) :
(∀ i j : Fin n, i ≠ j →
Disjoint (picking_turn_set seq hlen i) (picking_turn_set seq hlen j)) ∧
(∀ k : Fin m, ∃ i : Fin n, k ∈ picking_turn_set seq hlen i)planar_necklace_straight_line_cut_lower_boundIn LeanFair Division
For any natural numbers k, r, b with 2 ≤ k, 0 < r, 0 < b, and k dividing both r and b, there exists a finite set P of r + b points in ℝ² and a coloring c : (ℝ × ℝ) → Fin 2 with exactly r points of P colored 0 and b points of P colored 1, such that for any finite set L of straight lines (StraightLine) and any allocation α : (ℝ × ℝ) → Fin k consistent with L on P (is_straight_line_cut_consistent P L α), if each agent i : Fin k receives exactly r / k points of color 0 and b / k points of color 1 in P, then L must contain at least k - 1 lines: k - 1 ≤ L.card.
theorem planar_necklace_straight_line_cut_lower_bound (k r b : ℕ)
(hk : 2 ≤ k) (hr : 0 < r) (hb : 0 < b) (hkr : k ∣ r) (hkb : k ∣ b) :
∃ (P : Finset (ℝ × ℝ)) (c : (ℝ × ℝ) → Fin 2),
P.card = r + b ∧
(P.filter (fun p => c p = 0)).card = r ∧
(P.filter (fun p => c p = 1)).card = b ∧
∀ (L : Finset StraightLine) (α : (ℝ × ℝ) → Fin k),
is_straight_line_cut_consistent P L α →
(∀ i : Fin k,
(P.filter (fun p => α p = i ∧ c p = 0)).card = r / k ∧
(P.filter (fun p => α p = i ∧ c p = 1)).card = b / k) →
k - 1 ≤ L.cardplanar_necklace_three_agents_two_cuts_general_positionIn LeanFair Division
For any finite set P of points in the plane ℝ × ℝ coloured red/blue, with the number of red points and the number of blue points both divisible by 3, and with at most two points of P on any straight line, there exist at most two straight lines and an allocation consistent with them giving each of three agents exactly one-third of the red and one-third of the blue points.
theorem planar_necklace_three_agents_two_cuts_general_position
(P : Finset (ℝ × ℝ)) (c : (ℝ × ℝ) → Fin 2)
(h_red : 3 ∣ (P.filter (fun p => c p = 0)).card)
(h_blue : 3 ∣ (P.filter (fun p => c p = 1)).card)
(hgp : ∀ ℓ : StraightLine, (P.filter (fun p => ℓ.cut p = 0)).card ≤ 2) :
∃ (L : Finset StraightLine) (α : (ℝ × ℝ) → Fin 3),
L.card ≤ 2 ∧
is_straight_line_cut_consistent P L α ∧
∀ i : Fin 3,
(P.filter (fun p => α p = i ∧ c p = 0)).card = (P.filter (fun p => c p = 0)).card / 3 ∧
(P.filter (fun p => α p = i ∧ c p = 1)).card = (P.filter (fun p => c p = 1)).card / 3ratio_two_large_bundle_low_quota_mms_boundIn LeanFair Division
For positive n, K at least two and 1<=s<n, let m=(K-1)n+s. An agent designates low set L among the chores, with positive low cost a and high cost 2a. Any bundle of at most K chores containing at least max(0,min(K,floor(|L|/s))-floor(K/2)) lows costs at most 3/2 times her n-agent chore maximin share.
theorem ratio_two_large_bundle_low_quota_mms_bound (n K s : ℕ) (hn : 1 ≤ n) (hK : 2 ≤ K) (hs1 : 1 ≤ s) (hsn : s < n) (a : ℝ) (ha : 0 < a) (L : Finset (Fin ((K-1)*n+s))) (u : Fin ((K-1)*n+s) → ℝ) (hu : ∀ g, u g = if g ∈ L then a else 2*a) (S : Finset (Fin ((K-1)*n+s))) (hsize : S.card ≤ K) (hquota : min K (L.card / s) - K/2 ≤ (S ∩ L).card) : additive_valuation u S ≤ (3/2 : ℝ)*chore_maximin_share n u
remainder_bivalued_mms_minimum_lower_boundIn LeanFair Division
Let n be positive, K at least two and 1<=s<n. Among (K-1)n+s chores an agent designates a low-cost set L; each designated chore costs a>0 and each other chore costs r*a with r>=1. Put Q=min(K,floor(|L|/s)). Her n-agent chore maximin share is at least a times the minimum of K*r-(r-1)Q and K+1.
theorem remainder_bivalued_mms_minimum_lower_bound (n K s : ℕ) (hn : 1 ≤ n) (hK : 2 ≤ K) (hs1 : 1 ≤ s) (hsn : s < n) (r a : ℝ) (hr : 1 ≤ r) (ha : 0 < a) (L : Finset (Fin ((K-1)*n+s))) (u : Fin ((K-1)*n+s) → ℝ) (hu : ∀ g, u g = if g ∈ L then a else r*a) : a*min ((K : ℝ)*r-(r-1)*(min K (L.card / s) : ℕ)) (K+1) ≤ chore_maximin_share n u
round_robin_chore_insertion_ef1In LeanFair Division
For any n ≥ 2 agents with [NeZero n], picking sequence σ : ℕ → Fin n satisfying is_round_robin_picking_sequence n σ, and nonnegative chore costs c : Fin n → ℕ → ℝ (with ∀ i t, 0 ≤ c i t), the allocation chore_insertion_allocation σ c m is EF1 (is_ef1_chores) for every prefix length m : ℕ.
theorem round_robin_chore_insertion_ef1 (n : ℕ) [NeZero n] (hn : 2 ≤ n) (σ : ℕ → Fin n) (hrr : is_round_robin_picking_sequence n σ) (c : Fin n → ℕ → ℝ) (hc : ∀ i t, 0 ≤ c i t) (m : ℕ) : is_ef1_chores (fun i (d : Fin m) => c i d.val) (chore_insertion_allocation σ c m)
round_robin_chore_insertion_ef1_mmsIn LeanFair Division
For any n ≥ 2 agents with [NeZero n], any round-robin picking sequence σ : ℕ → Fin n satisfying is_round_robin_picking_sequence n σ, and any nonnegative arrival costs c : Fin n → ℕ → ℝ (with ∀ i t, 0 ≤ c i t), chore insertion has upgrade recourse (has_upgrade_recourse n c (chore_insertion_allocation σ c)), and at every prefix m : ℕ maintains an allocation that is EF1 (is_ef1_chores) and (2 - 1/n)-MMS (is_alpha_mms_chores (2 - 1 / (n : ℝ))).
theorem round_robin_chore_insertion_ef1_mms (n : ℕ) [NeZero n] (hn : 2 ≤ n) (σ : ℕ → Fin n) (hrr : is_round_robin_picking_sequence n σ) (c : Fin n → ℕ → ℝ) (hc : ∀ i t, 0 ≤ c i t) : has_upgrade_recourse n c (chore_insertion_allocation σ c) ∧ ∀ m : ℕ, is_ef1_chores (fun i (d : Fin m) => c i d.val) (chore_insertion_allocation σ c m) ∧ is_alpha_mms_chores (2 - 1 / (n : ℝ)) (fun i (d : Fin m) => c i d.val) (chore_insertion_allocation σ c m)
round_robin_expected_best_utility_tendstoIn LeanFair Division
For m = 2(k+1), the expected best-response Borda utility of agent A, normalised by m^2, converges to 3/8.
theorem round_robin_expected_best_utility_tendsto :
Filter.Tendsto (fun k : ℕ =>
((∑ p : (Fin (2 * (k + 1)) ≃ Fin (2 * (k + 1))) × (Fin (2 * (k + 1)) ≃ Fin (2 * (k + 1))),
round_robin_u_best (2 * (k + 1)) p.1 p.2) : ℝ) /
((Fintype.card (Fin (2 * (k + 1)) ≃ Fin (2 * (k + 1))))^2 : ℝ) /
(2 * (k + 1) : ℝ)^2)
Filter.atTop (nhds (3 / 8))round_robin_expected_manipulation_gain_eqIn LeanFair Division
Linearity: the expected normalized gain equals (expected best-response utility / m^2) − (expected truthful utility / m^2), i.e. each average of the finite sums of U_best and U_truth divided by (m!)^2 and by m^2.
theorem round_robin_expected_manipulation_gain_eq (m : ℕ) (hm : 0 < m) :
round_robin_expected_manipulation_gain m =
((∑ p : (Fin m ≃ Fin m) × (Fin m ≃ Fin m), round_robin_u_best m p.1 p.2) : ℝ) /
((Fintype.card (Fin m ≃ Fin m))^2 : ℝ) / (m : ℝ)^2
- ((∑ p : (Fin m ≃ Fin m) × (Fin m ≃ Fin m), round_robin_u_truth m p.1 p.2) : ℝ) /
((Fintype.card (Fin m ≃ Fin m))^2 : ℝ) / (m : ℝ)^2round_robin_expected_manipulation_gain_tendstoIn LeanFair Division
The expected normalised strategic gain round_robin_expected_manipulation_gain(2(k+1)) converges to 1/24. This is exactly the second conjunct of the target (law of large numbers for the mean gain).
theorem round_robin_expected_manipulation_gain_tendsto :
Filter.Tendsto (fun k : ℕ => round_robin_expected_manipulation_gain (2 * (k + 1)))
Filter.atTop (nhds (1 / 24))round_robin_expected_truthful_utility_two_mulIn LeanFair Division
With m = 2n goods and both agents truthful, the expected Borda utility of the first picker A is m(m+1)/3, i.e. the finite average of U_truth over all ranking pairs equals (2n)(2n+1)/3 = 2/3 of the total Borda value m(m+1)/2.
theorem round_robin_expected_truthful_utility_two_mul (n : ℕ) :
((∑ p : (Fin (2 * n) ≃ Fin (2 * n)) × (Fin (2 * n) ≃ Fin (2 * n)),
round_robin_u_truth (2 * n) p.1 p.2) : ℝ) /
((Fintype.card (Fin (2 * n) ≃ Fin (2 * n)))^2 : ℝ)
= (2 * n : ℝ) * (2 * n + 1) / 3round_robin_manipulation_gain_converges_in_probabilityIn LeanFair Division
For every ε > 0, the proportion of ranking pairs whose normalised strategic gain differs from 1/24 by at least ε tends to 0 as k → ∞ (m = 2(k+1)). This is exactly the first conjunct of the target (convergence in probability).
theorem round_robin_manipulation_gain_converges_in_probability :
∀ ε > 0, Filter.Tendsto
(fun k : ℕ =>
let m := 2 * (k + 1)
((Finset.univ.filter (fun p : (Fin m ≃ Fin m) × (Fin m ≃ Fin m) =>
ε ≤ |round_robin_borda_manipulation_gain m p.1 p.2 - (1 / 24 : ℝ)|)).card : ℝ) /
((Fintype.card (Fin m ≃ Fin m))^2 : ℝ))
Filter.atTop (nhds 0)round_robin_manipulation_gain_second_moment_tendstoIn LeanFair Division
For m = 2(k+1), the second moment of the normalised strategic gain round_robin_borda_manipulation_gain converges to (1/24)^2, i.e. the variance of the gain tends to 0 (concentration).
theorem round_robin_manipulation_gain_second_moment_tendsto :
Filter.Tendsto (fun k : ℕ =>
(∑ p : (Fin (2 * (k + 1)) ≃ Fin (2 * (k + 1))) × (Fin (2 * (k + 1)) ≃ Fin (2 * (k + 1))),
(round_robin_borda_manipulation_gain (2 * (k + 1)) p.1 p.2)^2) /
((Fintype.card (Fin (2 * (k + 1)) ≃ Fin (2 * (k + 1))))^2 : ℝ))
Filter.atTop (nhds ((1 / 24)^2))round_robin_outcome_card_eq_countIn LeanFair Division
In Round-Robin with n agents and m goods, agent a's bundle contains exactly as many goods as the number of times a occurs in the picking sequence (so with three agents and count_j ≥ 3, agent j owns at least three goods).
theorem round_robin_outcome_card_eq_count (n m : ℕ) [NeZero n]
(rank : Fin n → Fin m ≃ Fin m) (a : Fin n) :
(picking_sequence_outcome (round_robin_sequence n m) rank a).card =
(round_robin_sequence n m).count around_robin_outcome_coverIn LeanFair Division
Every good is allocated to some agent by Round-Robin: the bundles of the n agents cover all m goods.
theorem round_robin_outcome_cover (n m : ℕ) [NeZero n] (rank : Fin n → Fin m ≃ Fin m)
(g : Fin m) :
∃ a : Fin n, g ∈ picking_sequence_outcome (round_robin_sequence n m) rank around_robin_slots_cost_le_imp_ef1In LeanFair Division
If slot assignments satisfy that earlier slots are weakly cheaper for their owners and bundle valuations match the slot sums, then round-robin ordering guarantees that chore_insertion_allocation is EF1.
theorem round_robin_slots_cost_le_imp_ef1 (n : ℕ) [NeZero n] (hn : 2 ≤ n) (σ : ℕ → Fin n)
(hrr : is_round_robin_picking_sequence n σ) (c : Fin n → ℕ → ℝ) (hc : ∀ i t, 0 ≤ c i t) (m : ℕ)
(hle : ∀ k l, k < l → l < m → c (σ k) (chore_insertion_slots σ c m k) ≤ c (σ k) (chore_insertion_slots σ c m l))
(hval : ∀ i j, additive_valuation (fun (d : Fin m) => c i d.val) (bundle_of (chore_insertion_allocation σ c m) j) =
∑ k ∈ (Finset.range m).filter (fun k => σ k = j), c i (chore_insertion_slots σ c m k)) :
is_ef1_chores (fun i (d : Fin m) => c i d.val) (chore_insertion_allocation σ c m)round_robin_sup_achievable_le_u_bestIn LeanFair Division
Sufficiency half of the ballot characterisation: every ballot subset S is realisable as agent A's bundle for some ranking report, hence the maximum Borda utility over ballot subsets is at most A's best-response utility.
theorem round_robin_sup_achievable_le_u_best (m : ℕ) (hm : Even m) (rA rB : Fin m ≃ Fin m) :
(Finset.univ.filter (fun S : Finset (Fin m) =>
S.card = m / 2 ∧ ∀ k : Fin (m + 1),
(S.filter (fun g => (rB.symm g).val < k.val)).card ≤ (k.val + 1) / 2)).sup
(borda_bundle_utility m rA) ≤
round_robin_u_best m rA rBround_robin_three_agents_high_count_two_thirds_ef1In LeanFair Division
In a three-agent Round-Robin pure Nash equilibrium with nonnegative additive valuations, if the envied agent j is picked at least three times in the picking sequence, then every other agent i satisfies 2/3-EF1 towards j: some good g of j's bundle can be removed so that i's value for the rest is at most 3/2 times i's value for her own bundle.
theorem round_robin_three_agents_high_count_two_thirds_ef1
(m : ℕ) (w : Fin 3 → Fin m → ℝ) (hw : ∀ i g, 0 ≤ w i g)
(rank : Fin 3 → Fin m ≃ Fin m)
(h : is_picking_sequence_pne
(SocialChoice.FairDivision.Indivisible.AdditiveValuation.toValuation ⟨w⟩)
(round_robin_sequence 3 m) rank)
(i j : Fin 3) (hij : i ≠ j)
(hj : 3 ≤ (round_robin_sequence 3 m).count j)
(hne : (picking_sequence_outcome (round_robin_sequence 3 m) rank j).Nonempty) :
∃ g ∈ picking_sequence_outcome (round_robin_sequence 3 m) rank j,
(2 / 3) *
(∑ x ∈ (picking_sequence_outcome (round_robin_sequence 3 m) rank j) \ {g}, w i x)
≤ ∑ x ∈ picking_sequence_outcome (round_robin_sequence 3 m) rank i, w i xround_robin_three_agents_not_guaranteed_above_two_thirdsIn LeanFair Division
For every α > 2/3 there is a three-agent Round-Robin instance with nonnegative additive valuations that admits a pure Nash equilibrium whose outcome is not α-EF1.
theorem round_robin_three_agents_not_guaranteed_above_two_thirds :
∀ α : ℝ, 2 / 3 < α → ¬ is_guaranteed_round_robin_ef1_factor 3 αround_robin_three_agents_pne_arbitrarily_close_to_two_thirdsIn LeanFair Division
For every α > 2/3, there exists an instance with 3 agents and m goods admitting a pure Nash equilibrium under Round-Robin whose outcome is not α-EF1.
theorem round_robin_three_agents_pne_arbitrarily_close_to_two_thirds :
∀ α : ℝ, 2 / 3 < α → ∃ (m : ℕ) (w : Fin 3 → Fin m → ℝ) (rank : Fin 3 → Fin m ≃ Fin m),
(∀ i g, 0 ≤ w i g) ∧
is_picking_sequence_pne
(SocialChoice.FairDivision.Indivisible.AdditiveValuation.toValuation ⟨w⟩)
(round_robin_sequence 3 m) rank ∧
¬ is_alpha_ef1 α
(SocialChoice.FairDivision.Indivisible.AdditiveValuation.toValuation ⟨w⟩)
(picking_sequence_outcome (round_robin_sequence 3 m) rank)round_robin_three_agents_two_thirds_guaranteedIn LeanFair Division
For three agents, every pure Nash equilibrium of Round-Robin with nonnegative additive valuations induces a (2/3)-EF1 allocation; equivalently 2/3 is a guaranteed EF1 factor.
theorem round_robin_three_agents_two_thirds_guaranteed :
is_guaranteed_round_robin_ef1_factor 3 (2 / 3)round_robin_u_best_eq_sup_achievableIn LeanFair Division
Ballot characterisation: agent A's best response utility equals the maximum Borda utility over the family of ballot subsets S (|S| = m/2, and |S ∩ first k of B's order| ≤ ceil(k/2) for all k). Equivalently the achievable bundles are exactly the ballot subsets.
theorem round_robin_u_best_eq_sup_achievable (m : ℕ) (hm : Even m) (rA rB : Fin m ≃ Fin m) :
round_robin_u_best m rA rB =
(Finset.univ.filter (fun S : Finset (Fin m) =>
S.card = m / 2 ∧ ∀ k : Fin (m + 1),
(S.filter (fun g => (rB.symm g).val < k.val)).card ≤ (k.val + 1) / 2)).sup
(borda_bundle_utility m rA)round_robin_u_best_le_sup_achievableIn LeanFair Division
Necessity half of the ballot characterisation: agent A's best-response utility is at most the maximum Borda utility over all ballot subsets S (|S| = m/2 and, in every prefix of B's order, |S ∩ prefix| ≤ ceil(k/2)).
theorem round_robin_u_best_le_sup_achievable (m : ℕ) (hm : Even m) (rA rB : Fin m ≃ Fin m) :
round_robin_u_best m rA rB ≤
(Finset.univ.filter (fun S : Finset (Fin m) =>
S.card = m / 2 ∧ ∀ k : Fin (m + 1),
(S.filter (fun g => (rB.symm g).val < k.val)).card ≤ (k.val + 1) / 2)).sup
(borda_bundle_utility m rA)rr3_target_ordered_leftIn LeanFair Division
Target statement of the parent in the relative-order case where agent i's turn precedes agent j's in every round (i.val < j.val, so count_i ≥ count_j ≥ 3).
theorem rr3_target_ordered_left
(m : ℕ) (w : Fin 3 → Fin m → ℝ) (hw : ∀ i g, 0 ≤ w i g)
(rank : Fin 3 → Fin m ≃ Fin m)
(h : is_picking_sequence_pne
(SocialChoice.FairDivision.Indivisible.AdditiveValuation.toValuation ⟨w⟩)
(round_robin_sequence 3 m) rank)
(i j : Fin 3) (hij : i ≠ j) (hlt : i.val < j.val)
(hj : 3 ≤ (round_robin_sequence 3 m).count j)
(hne : (picking_sequence_outcome (round_robin_sequence 3 m) rank j).Nonempty) :
∃ g ∈ picking_sequence_outcome (round_robin_sequence 3 m) rank j,
(2 / 3) *
(∑ x ∈ (picking_sequence_outcome (round_robin_sequence 3 m) rank j) \ {g}, w i x)
≤ ∑ x ∈ picking_sequence_outcome (round_robin_sequence 3 m) rank i, w i xrr3_target_ordered_rightIn LeanFair Division
Target statement of the parent in the relative-order case where agent j's turn precedes agent i's in every round (j.val < i.val, so count_i ≤ count_j); this is the geometry of the eight-good counterexample.
theorem rr3_target_ordered_right
(m : ℕ) (w : Fin 3 → Fin m → ℝ) (hw : ∀ i g, 0 ≤ w i g)
(rank : Fin 3 → Fin m ≃ Fin m)
(h : is_picking_sequence_pne
(SocialChoice.FairDivision.Indivisible.AdditiveValuation.toValuation ⟨w⟩)
(round_robin_sequence 3 m) rank)
(i j : Fin 3) (hij : i ≠ j) (hgt : j.val < i.val)
(hj : 3 ≤ (round_robin_sequence 3 m).count j)
(hne : (picking_sequence_outcome (round_robin_sequence 3 m) rank j).Nonempty) :
∃ g ∈ picking_sequence_outcome (round_robin_sequence 3 m) rank j,
(2 / 3) *
(∑ x ∈ (picking_sequence_outcome (round_robin_sequence 3 m) rank j) \ {g}, w i x)
≤ ∑ x ∈ picking_sequence_outcome (round_robin_sequence 3 m) rank i, w i xrr4_agent_zero_bundle_of_first_pickIn LeanFair Division
For the Round-Robin sequence [0,1,2,0] on 3 agents and 4 goods, changing only agent 0's report to a new report r that has the same first-ranked good as its current report (r 0 = (b 0) 0) leaves agent 0's bundle unchanged, because agent 0's bundle is determined entirely by its first pick and the (unchanged) reports of agents 1 and 2.
theorem rr4_agent_zero_bundle_of_first_pick (b : Fin 3 → Fin 4 ≃ Fin 4)
(r : Fin 4 ≃ Fin 4) (h : r 0 = (b 0) 0) :
picking_sequence_outcome (round_robin_sequence 3 4) (Function.update b 0 r) 0
= picking_sequence_outcome (round_robin_sequence 3 4) b 0rr4_irr_step_agent_zeroIn LeanFair Division
For the Round-Robin sequence [0,1,2,0] on 3 agents and 4 goods, any irr_step under item-preserving swap bids is carried out by agent 0: the resulting profile is obtained by replacing only agent 0's report by an item-preserving swap r, and agent 0 strictly increases its additive value.
theorem rr4_irr_step_agent_zero (v : Fin 3 → Fin 4 → ℝ)
(b b' : Fin 3 → Fin 4 ≃ Fin 4)
(h : irr_step v (round_robin_sequence 3 4)
(is_item_preserving_swap_bid (round_robin_sequence 3 4)) b b') :
∃ r : Fin 4 ≃ Fin 4, b' = Function.update b 0 r ∧
is_item_preserving_swap_bid (round_robin_sequence 3 4) b 0 r ∧
∑ g ∈ picking_sequence_outcome (round_robin_sequence 3 4) b 0, v 0 g
< ∑ g ∈ picking_sequence_outcome (round_robin_sequence 3 4) b' 0, v 0 grr4_no_two_consecutive_steps_from_truthfulIn LeanFair Division
For the Round-Robin sequence [0,1,2,0] on 3 agents and 4 goods, from a profile b whose agent 0 first-picks its true top good ((b 0) 0 = (pref 0) 0) there are no two consecutive irr_step steps under item-preserving swap bids: no b' then b'' can both be reached.
theorem rr4_no_two_consecutive_steps_from_truthful
(pref : Fin 3 → Fin 4 ≃ Fin 4) (v : Fin 3 → Fin 4 → ℝ)
(hcons : ∀ (i : Fin 3) (k l : Fin 4), k < l → v i (pref i l) < v i (pref i k))
(b b' b'' : Fin 3 → Fin 4 ≃ Fin 4) (hb : (b 0) 0 = (pref 0) 0)
(h1 : irr_step v (round_robin_sequence 3 4)
(is_item_preserving_swap_bid (round_robin_sequence 3 4)) b b')
(h2 : irr_step v (round_robin_sequence 3 4)
(is_item_preserving_swap_bid (round_robin_sequence 3 4)) b' b'') :
Falserr4_round_robin_outcome_structureIn LeanFair Division
For the Round-Robin sequence [0,1,2,0] on 3 agents and 4 goods, for ANY report profile b, agent 0's bundle has exactly 2 goods, agents 1 and 2 have exactly 1 each, and agent 0's first-ranked good (b 0) 0 lies in agent 0's own bundle.
theorem rr4_round_robin_outcome_structure (b : Fin 3 → Fin 4 ≃ Fin 4) :
(picking_sequence_outcome (round_robin_sequence 3 4) b 0).card = 2 ∧
(picking_sequence_outcome (round_robin_sequence 3 4) b 1).card = 1 ∧
(picking_sequence_outcome (round_robin_sequence 3 4) b 2).card = 1 ∧
(b 0) 0 ∈ picking_sequence_outcome (round_robin_sequence 3 4) b 0rr4_side_agent_item_preserving_bundle_eqIn LeanFair Division
For the Round-Robin sequence [0,1,2,0] on 3 agents and 4 goods, an item-preserving swap bid by a side agent i (i = 1 or 2) leaves that agent's bundle unchanged, because such an agent always ends up with exactly one good and the item-preserving swap must keep the demoted good in the bundle both before and after.
theorem rr4_side_agent_item_preserving_bundle_eq (b : Fin 3 → Fin 4 ≃ Fin 4)
(i : Fin 3) (hi : i ≠ 0) (r : Fin 4 ≃ Fin 4)
(hr : is_item_preserving_swap_bid (round_robin_sequence 3 4) b i r) :
picking_sequence_outcome (round_robin_sequence 3 4) (Function.update b i r) i
= picking_sequence_outcome (round_robin_sequence 3 4) b irule_eq_draft_of_pick_seqIn LeanFair Division
If an allocation rule f that satisfies objectwise Maskin monotonicity agrees with the draft of a picking sequence s on every unanimous profile, then f agrees with that draft on every profile.
theorem rule_eq_draft_of_pick_seq {Agent Object : Type*} [Fintype Object]
[DecidableEq Agent] [DecidableEq Object]
(f : (Agent → LinearOrder Object) → Agent → Finset Object)
(h_mm : satisfies_objectwise_mm f) (s : Fin (Fintype.card Object) → Agent)
(hs : ∀ (e : Object ≃ Fin (Fintype.card Object)) (i : Agent),
(f (fun _ => draft_enum_order e) i).map e.toEmbedding = Finset.univ.filter (fun m => s m = i)) :
f = draft_rule (Agent := Agent) (Object := Object) srule_pick_seq_existsIn LeanFair Division
A non-wasteful, neutral allocation rule is a draft rule on every unanimous profile: there is a picking sequence s such that at every unanimous profile, agent i's bundle consists exactly of the objects she owns at the turns where she picks.
theorem rule_pick_seq_exists {Agent Object : Type*} [Fintype Agent] [Fintype Object]
[DecidableEq Agent] [DecidableEq Object]
(f : (Agent → LinearOrder Object) → Agent → Finset Object)
(h_alloc : is_allocation_rule f) (h_nw : is_non_wasteful_rule f) (h_neut : is_neutral_rule f) :
∃ s : Fin (Fintype.card Object) → Agent,
∀ (e : Object ≃ Fin (Fintype.card Object)) (i : Agent),
(f (fun _ => draft_enum_order e) i).map e.toEmbedding = Finset.univ.filter (fun m => s m = i)rule_unanimous_position_indepIn LeanFair Division
A neutral rule's outcome at a unanimous profile, transported to indices along the enumeration, does not depend on which enumeration realises the common order: the index-sets of the bundles are the same for every enumeration.
theorem rule_unanimous_position_indep {Agent Object : Type*} [Fintype Object]
[DecidableEq Agent] [DecidableEq Object]
(f : (Agent → LinearOrder Object) → Agent → Finset Object) (h_neut : is_neutral_rule f)
(e₁ e₂ : Object ≃ Fin (Fintype.card Object)) (i : Agent) :
(f (fun _ => draft_enum_order e₁) i).map e₁.toEmbedding =
(f (fun _ => draft_enum_order e₂) i).map e₂.toEmbeddingrule_wsp_ef1_deviator_card_eq_of_r_zeroIn LeanFair Division
With k * n objects, n ≥ 3 agents and r = 0, under non-wastefulness, neutrality, weak strategy-proofness and EF1, a single agent's bundle keeps cardinality k after she replaces her preference by an objectwise Maskin improvement.
theorem rule_wsp_ef1_deviator_card_eq_of_r_zero (n k : ℕ) (hn : 3 ≤ n)
(f : (Fin n → LinearOrder (Fin (k * n))) → Fin n → Finset (Fin (k * n)))
(h_alloc : is_allocation_rule f) (h_nw : is_non_wasteful_rule f) (h_neut : is_neutral_rule f)
(h_wsp : is_weakly_strategy_proof_rule f) (h_ef1 : is_ef1_rule f)
(succ : Fin n → LinearOrder (Fin (k * n))) (i : Fin n) (o : LinearOrder (Fin (k * n))) :
(f (Function.update succ i o) i).card = (f succ i).cardrule_wsp_ef1_satisfies_objectwise_mmIn LeanFair Division
Any allocation rule that is non-wasteful, neutral, weakly strategy-proof, and EF1 satisfies objectwise Maskin monotonicity when n ≥ 3, k ≥ 2, and r < n.
theorem rule_wsp_ef1_satisfies_objectwise_mm (n k r : ℕ) (hn : 3 ≤ n) (hk : 2 ≤ k) (hr : r < n)
(f : (Fin n → LinearOrder (Fin (k * n + r))) → Fin n → Finset (Fin (k * n + r)))
(h_alloc : is_allocation_rule f) (h_nw : is_non_wasteful_rule f) (h_neut : is_neutral_rule f)
(h_wsp : is_weakly_strategy_proof_rule f) (h_ef1 : is_ef1_rule f) :
satisfies_objectwise_mm frule_wsp_ef1_single_agent_card_eqIn LeanFair Division
Under non-wastefulness, neutrality, weak strategy-proofness and EF1 (n ≥ 3, k ≥ 2, r < n), if a single agent's preference is an objectwise Maskin improvement of her truthful preference with respect to her own bundle, then the cardinality of her bundle is the same under the two profiles.
theorem rule_wsp_ef1_single_agent_card_eq (n k r : ℕ) (hn : 3 ≤ n) (hk : 2 ≤ k) (hr : r < n)
(f : (Fin n → LinearOrder (Fin (k * n + r))) → Fin n → Finset (Fin (k * n + r)))
(h_alloc : is_allocation_rule f) (h_nw : is_non_wasteful_rule f) (h_neut : is_neutral_rule f)
(h_wsp : is_weakly_strategy_proof_rule f) (h_ef1 : is_ef1_rule f)
(succ : Fin n → LinearOrder (Fin (k * n + r))) (i : Fin n) (o : LinearOrder (Fin (k * n + r)))
(hMM : ∀ y ∈ f succ i, ∀ z : Fin (k * n + r), (succ i).lt z y → o.lt z y) :
(f (Function.update succ i o) i).card = (f succ i).cardrule_wsp_ef1_single_agent_eq_of_card_eqIn LeanFair Division
Under non-wastefulness, neutrality, weak strategy-proofness and EF1 (n ≥ 3, k ≥ 2, r < n), if a single agent's preference is an objectwise Maskin improvement of her truthful preference and her bundle has the same cardinality under the two profiles, then the whole allocation is unchanged.
theorem rule_wsp_ef1_single_agent_eq_of_card_eq (n k r : ℕ) (hn : 3 ≤ n) (hk : 2 ≤ k) (hr : r < n)
(f : (Fin n → LinearOrder (Fin (k * n + r))) → Fin n → Finset (Fin (k * n + r)))
(h_alloc : is_allocation_rule f) (h_nw : is_non_wasteful_rule f) (h_neut : is_neutral_rule f)
(h_wsp : is_weakly_strategy_proof_rule f) (h_ef1 : is_ef1_rule f)
(succ : Fin n → LinearOrder (Fin (k * n + r))) (i : Fin n) (o : LinearOrder (Fin (k * n + r)))
(hMM : ∀ y ∈ f succ i, ∀ z : Fin (k * n + r), (succ i).lt z y → o.lt z y)
(hcard : (f (Function.update succ i o) i).card = (f succ i).card) :
f (Function.update succ i o) = f succrule_wsp_ef1_single_agent_mm_stepIn LeanFair Division
Under non-wastefulness, neutrality, weak strategy-proofness and EF1 (n ≥ 3, k ≥ 2, r < n), if a single agent's preference is an objectwise Maskin improvement of her truthful preference with respect to her own bundle, then the whole allocation is unchanged.
theorem rule_wsp_ef1_single_agent_mm_step (n k r : ℕ) (hn : 3 ≤ n) (hk : 2 ≤ k) (hr : r < n)
(f : (Fin n → LinearOrder (Fin (k * n + r))) → Fin n → Finset (Fin (k * n + r)))
(h_alloc : is_allocation_rule f) (h_nw : is_non_wasteful_rule f) (h_neut : is_neutral_rule f)
(h_wsp : is_weakly_strategy_proof_rule f) (h_ef1 : is_ef1_rule f)
(succ : Fin n → LinearOrder (Fin (k * n + r))) (i : Fin n) (o : LinearOrder (Fin (k * n + r)))
(hMM : ∀ y ∈ f succ i, ∀ z : Fin (k * n + r), (succ i).lt z y → o.lt z y) :
f (Function.update succ i o) = f succscaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_core_of_countsIn LeanFair Division
Normalized two-agent bivalued core from the arithmetic: if both agents' values lie in {1, r} and for every choice of the four type multiplicities the arithmetic feasibility predicate holds, then there is an allocation that is EFX, has nonnegative aggregate (a_0*(v_0(A_0)-v_0(A_1)) + a_1*(v_1(A_1)-v_1(A_0)) >= 0) and admits a positive weight tie (t > 0, with u_0(g) <= t*u_1(g) on agent 1's goods and t*u_1(g) <= u_0(g) on agent 0's goods).
theorem scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_core_of_counts
(m : ℕ) (r : ℝ) (hr : 1 < r) (a0 a1 : ℝ) (h0 : 0 < a0) (hpos : 0 < a1)
(u : Fin 2 → Fin m → ℝ) (hu : ∀ i g, u i g = 1 ∨ u i g = r)
(harith : ∀ n1 n2 n3 n4 : ℕ, bivalued_two_agent_family_feasible n1 n2 n3 n4 r a0 a1) :
∃ σ : Fin m → Fin 2, is_efx_goods u σ ∧
(0 ≤ a0 * (additive_valuation (u 0) (bundle_of σ 0) - additive_valuation (u 0) (bundle_of σ 1))
+ a1 * (additive_valuation (u 1) (bundle_of σ 1) - additive_valuation (u 1) (bundle_of σ 0))) ∧
∃ t : ℝ, 0 < t ∧ ∀ g : Fin m,
(σ g = 1 → u 0 g ≤ t * u 1 g) ∧ (σ g = 0 → t * u 1 g ≤ u 0 g)scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_counts_highIn LeanFair Division
Arithmetic core, regime r*a_0 <= a_1 (agent 1's scale is at least r times agent 0's): for goods of the four types LL, LH, HL, HH with multiplicities n1..n4 and ratio r > 1, some allocation from one of the three weight-tie families is EFX and satisfies the subsidy aggregate inequality.
theorem scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_counts_high
(n1 n2 n3 n4 : ℕ) (r : ℝ) (hr : 1 < r) (a0 a1 : ℝ) (h0 : 0 < a0) (hpos : 0 < a1)
(hhigh : r * a0 ≤ a1) :
bivalued_two_agent_family_feasible n1 n2 n3 n4 r a0 a1scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_counts_lowIn LeanFair Division
Arithmetic core, regime r*a_1 <= a_0 (agent 0's scale is at least r times agent 1's): for goods of the four types LL, LH, HL, HH with multiplicities n1..n4 and ratio r > 1, some allocation from one of the three weight-tie families is EFX and satisfies the subsidy aggregate inequality.
theorem scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_counts_low
(n1 n2 n3 n4 : ℕ) (r : ℝ) (hr : 1 < r) (a0 a1 : ℝ) (h0 : 0 < a0) (hpos : 0 < a1)
(hlow : r * a1 ≤ a0) :
bivalued_two_agent_family_feasible n1 n2 n3 n4 r a0 a1scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_counts_low_dominantIn LeanFair Division
Arithmetic core, regime r*a_1 <= a_0 (agent 0's scale is at least r times agent 1's): for goods of the four types LL, LH, HL, HH with multiplicities n1..n4 and ratio r > 1, some allocation from one of the three weight-tie families is EFX and satisfies the subsidy aggregate inequality.
theorem scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_counts_low_dominant
(n1 n2 n3 n4 : ℕ) (r : ℝ) (hr : 1 < r) (a0 a1 : ℝ) (h0 : 0 < a0) (hpos : 0 < a1)
(hlow : r * a1 ≤ a0) :
bivalued_two_agent_family_feasible n1 n2 n3 n4 r a0 a1scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_counts_low_midIn LeanFair Division
Arithmetic core, regime a_0 < r*a_1 and a_1 <= a_0 (agent 1's scale lies in (a_0/r, a_0]): for goods of the four types LL, LH, HL, HH with multiplicities n1..n4 and ratio r > 1, some allocation from one of the three weight-tie families is EFX and satisfies the subsidy aggregate inequality.
theorem scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_counts_low_mid
(n1 n2 n3 n4 : ℕ) (r : ℝ) (hr : 1 < r) (a0 a1 : ℝ) (h0 : 0 < a0) (hpos : 0 < a1)
(hlo : a0 < r * a1) (hhi : a1 ≤ a0) :
bivalued_two_agent_family_feasible n1 n2 n3 n4 r a0 a1scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_counts_midIn LeanFair Division
Arithmetic core, regime a_0 < a_1 < r*a_0 (the two scales differ by a factor strictly between 1 and r): for goods of the four types LL, LH, HL, HH with multiplicities n1..n4 and ratio r > 1, some allocation from one of the three weight-tie families is EFX and satisfies the subsidy aggregate inequality.
theorem scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_counts_mid
(n1 n2 n3 n4 : ℕ) (r : ℝ) (hr : 1 < r) (a0 a1 : ℝ) (h0 : 0 < a0) (hpos : 0 < a1)
(hlo : a0 < a1) (hhi : a1 < r * a0) :
bivalued_two_agent_family_feasible n1 n2 n3 n4 r a0 a1scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_of_normalized_coreIn LeanFair Division
Assembly step: if, in the normalized valuations v_i/a_i, an allocation is EFX, satisfies the weighted aggregate inequality with weights a_0, a_1, and admits a positive weight tie, then the original profile admits an allocation with nonnegative subsidies that is EFX, envy-free with subsidies and fractionally Pareto optimal.
theorem scaled_common_ratio_bivalued_efx_fpo_envyfreeable_two_agents_of_normalized_core
(m : ℕ) (r : ℝ) (hr : 1 < r)
(a : Fin 2 → ℝ) (ha : ∀ i, 0 < a i)
(v : Fin 2 → Fin m → ℝ) (hv : ∀ i g, v i g = a i ∨ v i g = r * a i)
(σ : Fin m → Fin 2) (t : ℝ) (ht : 0 < t)
(hefx : is_efx_goods (fun i g => v i g / a i) σ)
(htie : ∀ g : Fin m, (σ g = 1 → v 0 g / a 0 ≤ t * (v 1 g / a 1))
∧ (σ g = 0 → t * (v 1 g / a 1) ≤ v 0 g / a 0))
(hagg : 0 ≤ a 0 * (additive_valuation (fun g => v 0 g / a 0) (bundle_of σ 0)
- additive_valuation (fun g => v 0 g / a 0) (bundle_of σ 1))
+ a 1 * (additive_valuation (fun g => v 1 g / a 1) (bundle_of σ 1)
- additive_valuation (fun g => v 1 g / a 1) (bundle_of σ 0))) :
∃ (σ' : Fin m → Fin 2) (s : Fin 2 → ℝ),
is_efx_goods v σ' ∧
is_envy_free_with_subsidy (fun i => additive_valuation (v i)) σ' s ∧
is_fractionally_pareto_optimal v σ'scaled_common_ratio_bivalued_exists_efx_weighted_max_perm_welfare_maxIn LeanFair Division
For every n ≥ 2, finite set of m goods, real ratio r > 1 and positive scales a_i, if v_i(g) is in {a_i, r * a_i}, then there are a complete allocation sigma and positive weights lambda such that sigma is EFX, every good sits with a lambda-weighted-maximising agent, and sigma maximises utilitarian welfare among all permutations of its own bundles.
theorem scaled_common_ratio_bivalued_exists_efx_weighted_max_perm_welfare_max
(n : ℕ) (hn : 2 ≤ n) (m : ℕ)
(r : ℝ) (hr : 1 < r)
(a : Fin n → ℝ) (ha : ∀ i, 0 < a i)
(v : Fin n → Fin m → ℝ) (hv : ∀ i g, v i g = a i ∨ v i g = r * a i) :
∃ (sigma : Fin m → Fin n) (lam : Fin n → ℝ),
(∀ i, 0 < lam i) ∧
(∀ (g : Fin m) (j : Fin n), lam j * v j g ≤ lam (sigma g) * v (sigma g) g) ∧
is_efx_goods v sigma ∧
∀ pi : Equiv.Perm (Fin n),
∑ i, additive_valuation (v i) (bundle_of sigma (pi i)) ≤
∑ i, additive_valuation (v i) (bundle_of sigma i)scaled_common_ratio_bivalued_identical_exists_efx_fpo_perm_welfare_maxIn LeanFair Division
If all agents share the same normalised valuation, v_i(g) = a_i * w(g) with w(g) in {1, r}, then there is an allocation that is EFX, fractionally Pareto optimal, and maximises utilitarian welfare over all permutations of its own bundles.
theorem scaled_common_ratio_bivalued_identical_exists_efx_fpo_perm_welfare_max
(n : ℕ) (hn : 2 ≤ n) (m : ℕ)
(r : ℝ) (hr : 1 < r)
(a : Fin n → ℝ) (ha : ∀ i, 0 < a i)
(w : Fin m → ℝ) (hw : ∀ g, w g = 1 ∨ w g = r)
(v : Fin n → Fin m → ℝ) (hv : ∀ i g, v i g = a i * w g) :
∃ sigma : Fin m → Fin n,
is_efx_goods v sigma ∧
is_fractionally_pareto_optimal v sigma ∧
∀ pi : Equiv.Perm (Fin n),
∑ i, additive_valuation (v i) (bundle_of sigma (pi i)) ≤
∑ i, additive_valuation (v i) (bundle_of sigma i)single_high_additive_valuation_eqIn LeanFair Division
If agent i has a single-high valuation with ratio R and high good a (value R on a, 1 elsewhere), then the additive value of a bundle S is |S| + (R-1) if a lies in S, and |S| otherwise.
theorem single_high_additive_valuation_eq {m : ℕ} (R : ℝ) (a : Fin m) (S : Finset (Fin m)) :
additive_valuation (fun x : Fin m => if x = a then R else 1) S
= (S.card : ℝ) + (R - 1) * (if a ∈ S then (1:ℝ) else 0)social_welfare_bound_from_charity_guaranteeIn LeanFair Division
Under homogeneous nonnegative additive valuations v on Fin m, strictly positive item sizes s, and individual budgets B_i ≥ 0, let O : Fin n → Finset (Fin m) be an optimal budget-feasible allocation maximizing social welfare among all budget-feasible allocations. If a budget-feasible allocation X : Fin n → Finset (Fin m) satisfies γ * knapsack_opt v s (B i) (charity X) ≤ additive_valuation v (X i) for every agent i for some γ in (0, 1], then (γ / (1 + γ)) * social_welfare v O ≤ social_welfare v X.
theorem social_welfare_bound_from_charity_guarantee {m n : ℕ}
(v : Fin m → ℝ) (hv : ∀ g, 0 ≤ v g)
(s : Fin m → ℝ) (hs : ∀ g, 0 < s g)
(B : Fin n → ℝ) (hB : ∀ i, 0 ≤ B i)
(X : Fin n → Finset (Fin m)) (hX : is_budget_feasible s B X)
(O : Fin n → Finset (Fin m)) (hO : is_budget_feasible s B O)
(hO_opt : ∀ O' : Fin n → Finset (Fin m), is_budget_feasible s B O' → social_welfare v O' ≤ social_welfare v O)
(γ : ℝ) (hγ0 : 0 < γ) (hγ1 : γ ≤ 1)
(h_guarantee : ∀ i : Fin n, γ * knapsack_opt v s (B i) (charity X) ≤ additive_valuation v (X i)) :
(γ / (1 + γ)) * social_welfare v O ≤ social_welfare v Xsocial_welfare_bound_from_charity_guarantee_of_feasibleIn LeanFair Division
Let X : Fin n → Finset (Fin m) and let O : Fin n → Finset (Fin m) be a budget-feasible allocation under item sizes s and budgets B. If valuations are given by a homogeneous nonnegative additive valuation v on Fin m and for some γ > 0, every agent i satisfies γ * knapsack_opt v s (B i) (charity X) ≤ additive_valuation v (X i), then (γ / (1 + γ)) * social_welfare v O ≤ social_welfare v X.
theorem social_welfare_bound_from_charity_guarantee_of_feasible {m n : ℕ}
(v : Fin m → ℝ) (hv : ∀ g, 0 ≤ v g)
(s : Fin m → ℝ) (B : Fin n → ℝ)
(X : Fin n → Finset (Fin m))
(O : Fin n → Finset (Fin m)) (hO : is_budget_feasible s B O)
(γ : ℝ) (hγ0 : 0 < γ)
(h_guarantee : ∀ i : Fin n, γ * knapsack_opt v s (B i) (charity X) ≤ additive_valuation v (X i)) :
(γ / (1 + γ)) * social_welfare v O ≤ social_welfare v Xstraight_line_cut_collinear_affineIn LeanFair Division
The restriction of a straight line's affine functional to the x-axis is affine: there are reals A and C with ℓ.cut (x,0) = A * x + C for every x, namely A = ℓ.cut.linear (1,0) and C = ℓ.cut 0.
theorem straight_line_cut_collinear_affine (ℓ : StraightLine) (x : ℝ) :
ℓ.cut (x, 0) = x * ℓ.cut.linear ((1 : ℝ), 0) + ℓ.cut 0straight_line_cut_collinear_monotone_or_antitoneIn LeanFair Division
For any straight line ℓ, the function x ↦ ℓ.cut (x,0) on the x-axis is either nondecreasing or nonincreasing.
theorem straight_line_cut_collinear_monotone_or_antitone (ℓ : StraightLine) :
Monotone (fun x : ℝ => ℓ.cut (x, 0)) ∨ Antitone (fun x : ℝ => ℓ.cut (x, 0))straight_line_parabola_transitions_le_twoIn LeanFair Division
For any straight line ℓ and any boolean assignment s consistent with ℓ on the parabola points pt(i) = (i, i²) for i ∈ ZMod m, the number of cyclic transitions where s(ℓ, pt(i)) ≠ s(ℓ, pt(i+1)) is at most 2.
theorem straight_line_parabola_transitions_le_two (m : ℕ) [NeZero m]
(s : StraightLine → (ℝ × ℝ) → Bool) (ℓ : StraightLine)
(hs : ∀ i : ZMod m,
(0 < ℓ.cut ((i.val : ℝ), (i.val : ℝ)^2) → s ℓ ((i.val : ℝ), (i.val : ℝ)^2) = true) ∧
(ℓ.cut ((i.val : ℝ), (i.val : ℝ)^2) < 0 → s ℓ ((i.val : ℝ), (i.val : ℝ)^2) = false)) :
(Finset.univ.filter (fun (i : ZMod m) =>
s ℓ ((i.val : ℝ), (i.val : ℝ)^2) ≠ s ℓ (((i + 1 : ZMod m).val : ℝ), ((i + 1 : ZMod m).val : ℝ)^2))).card ≤ 2strengthened_large_low_quota_sharp_mms_boundIn LeanFair Division
For positive n, K at least two, 1<=s<n, and m=(K-1)n+s, an agent has positive low cost a and high cost r*a for 1<=r<=2. A bundle of at most K chores containing at least max(0,min(K,floor(|L|/s))+1-floor(K/2)) low chores costs at most (r+1)/2 times her n-agent chore maximin share.
theorem strengthened_large_low_quota_sharp_mms_bound (n K s : ℕ) (hn : 1 ≤ n) (hK : 2 ≤ K) (hs1 : 1 ≤ s) (hsn : s < n) (r a : ℝ) (hr1 : 1 ≤ r) (hr2 : r ≤ 2) (ha : 0 < a) (L : Finset (Fin ((K-1)*n+s))) (u : Fin ((K-1)*n+s) → ℝ) (hu : ∀ g, u g = if g ∈ L then a else r*a) (S : Finset (Fin ((K-1)*n+s))) (hsize : S.card ≤ K) (hquota : min K (L.card / s) + 1 - K/2 ≤ (S ∩ L).card) : additive_valuation u S ≤ ((r+1)/2)*chore_maximin_share n u
tendstoInDistribution_sub_of_tendstoInDistribution_zeroIn LeanFair Division
For random variables on varying probability spaces (Ω_i, μ_i), if X_i converges in distribution to a probability measure μ' on ℝ and Y_i converges in distribution to the Dirac measure at 0, then X_i - Y_i converges in distribution to μ'.
theorem tendstoInDistribution_sub_of_tendstoInDistribution_zero
{ι : Type*} {Ω : ι → Type*} [∀ i, MeasurableSpace (Ω i)]
(μ : (i : ι) → MeasureTheory.Measure (Ω i)) [∀ i, MeasureTheory.IsProbabilityMeasure (μ i)]
(l : Filter ι) [l.IsCountablyGenerated]
(μ' : MeasureTheory.ProbabilityMeasure ℝ)
(X Y : (i : ι) → Ω i → ℝ)
(hX : MeasureTheory.TendstoInDistribution X l (fun x => x) μ (μ' : MeasureTheory.Measure ℝ))
(hY : MeasureTheory.TendstoInDistribution Y l (fun _ => (0 : ℝ)) μ (MeasureTheory.Measure.dirac 0)) :
MeasureTheory.TendstoInDistribution (fun i ω => X i ω - Y i ω) l (fun x => x) μ (μ' : MeasureTheory.Measure ℝ)two_agent_alternating_draft_welfare_regret_limitIn LeanFair Division
There exists a probability measure μ on ℝ supported on [0, ∞), not concentrated on any single point, with expectation 1/3, such that the utilitarian welfare regret of two-agent alternating drafting converges in distribution to μ.
theorem two_agent_alternating_draft_welfare_regret_limit :
∃ (μ : MeasureTheory.ProbabilityMeasure ℝ),
(μ : MeasureTheory.Measure ℝ) (Set.Iio 0) = 0 ∧
(∀ c : ℝ, (μ : MeasureTheory.Measure ℝ) {c} ≠ 1) ∧
(∫ x, x ∂(μ : MeasureTheory.Measure ℝ)) = 1 / 3 ∧
MeasureTheory.TendstoInDistribution
(fun m v => two_agent_welfare_regret m (two_agent_alternating_schedule m) v)
Filter.atTop
(fun x : ℝ => x)
(fun m => (balanced_draft_input_law 2 m : MeasureTheory.Measure (Fin 2 → Fin m → ℝ)))
(μ : MeasureTheory.Measure ℝ)two_agent_balanced_draft_welfare_asymptotic_invarianceIn LeanFair Division
For every sequence of balanced schedules s for two agents, the difference between draft welfare under s m and under the alternating schedule converges in distribution to the Dirac measure at 0 under independent uniform [0, 1] valuations.
theorem two_agent_balanced_draft_welfare_asymptotic_invariance :
∀ (s : (m : ℕ) → Fin m → Fin 2), (∀ m, is_balanced_schedule 2 m (s m)) →
MeasureTheory.TendstoInDistribution
(fun m v => two_agent_draft_welfare m (s m) v -
two_agent_draft_welfare m (two_agent_alternating_schedule m) v)
Filter.atTop
(fun _ => (0 : ℝ))
(fun m => (balanced_draft_input_law 2 m : MeasureTheory.Measure (Fin 2 → Fin m → ℝ)))
(MeasureTheory.Measure.dirac 0)two_agent_const_one_mms_ge_halfIn LeanFair Division
For the all-ones two-agent chore instance on m chores, the maximin share is at least (m+1)/2 (integer division), because in every partition the more expensive of the two bundles has size at least (m+1)/2.
theorem two_agent_const_one_mms_ge_half (m : ℕ) :
((m + 1) / 2 : ℕ) ≤ chore_maximin_share 2 (fun _ : Fin m => (1 : ℝ))
two_agent_divide_and_choose_weight_existsIn LeanFair Division
For two agents with nonnegative additive chore costs, there exist two 1-MMS divide-and-choose allocations σ and τ and a mixing weight w in [0, 1] whose expected costs do not exceed either agent's proportional share.
theorem two_agent_divide_and_choose_weight_exists (m : ℕ) (c : Fin 2 → Fin m → ℝ)
(hc : ∀ i e, 0 ≤ c i e) :
∃ (σ τ : Fin m → Fin 2) (w : ℝ),
0 ≤ w ∧ w ≤ 1 ∧
is_alpha_mms_chores 1 c σ ∧
is_alpha_mms_chores 1 c τ ∧
w * additive_valuation (c 0) (bundle_of σ 0) +
(1 - w) * additive_valuation (c 0) (bundle_of τ 0) ≤ (∑ e : Fin m, c 0 e) / 2 ∧
w * additive_valuation (c 1) (bundle_of σ 1) +
(1 - w) * additive_valuation (c 1) (bundle_of τ 1) ≤ (∑ e : Fin m, c 1 e) / 2two_agent_mms_partition_existsIn LeanFair Division
For any m chores and additive chore costs u, there exists a 2-way partition P where both bundles cost at most the chore maximin share chore_maximin_share 2 u.
theorem two_agent_mms_partition_exists (m : ℕ) (u : Fin m → ℝ) :
∃ P : Fin m → Fin 2, ∀ k : Fin 2,
additive_valuation u (bundle_of P k) ≤ chore_maximin_share 2 utwo_agent_two_allocation_mixture_lotteryIn LeanFair Division
Given two 1-MMS allocations σ and τ, and a convex weight w in [0, 1] whose mixture satisfies the ex-ante proportional share bounds for both agents, the convex mixture lottery w δ_σ + (1 - w) δ_τ is in stdSimplex, ex-ante proportional, and ex-post 1-MMS.
theorem two_agent_two_allocation_mixture_lottery (m : ℕ) (c : Fin 2 → Fin m → ℝ)
(σ τ : Fin m → Fin 2) (hσ : is_alpha_mms_chores 1 c σ) (hτ : is_alpha_mms_chores 1 c τ)
(w : ℝ) (hw0 : 0 ≤ w) (hw1 : w ≤ 1)
(hprop0 : w * additive_valuation (c 0) (bundle_of σ 0) +
(1 - w) * additive_valuation (c 0) (bundle_of τ 0) ≤ (∑ e : Fin m, c 0 e) / 2)
(hprop1 : w * additive_valuation (c 1) (bundle_of σ 1) +
(1 - w) * additive_valuation (c 1) (bundle_of τ 1) ≤ (∑ e : Fin m, c 1 e) / 2) :
∃ p ∈ stdSimplex ℝ (Fin m → Fin 2),
is_ex_ante_proportional_chores c p ∧
is_ex_post_alpha_mms_chores 1 c ptwo_agent_welfare_regret_eq_subIn LeanFair Division
For any number of goods m, schedule s, and valuations v, two_agent_welfare_regret m s v = two_agent_welfare_regret m (two_agent_alternating_schedule m) v - (two_agent_draft_welfare m s v - two_agent_draft_welfare m (two_agent_alternating_schedule m) v).
theorem two_agent_welfare_regret_eq_sub (m : ℕ) (s : Fin m → Fin 2) (v : Fin 2 → Fin m → ℝ) :
two_agent_welfare_regret m s v =
two_agent_welfare_regret m (two_agent_alternating_schedule m) v -
(two_agent_draft_welfare m s v -
two_agent_draft_welfare m (two_agent_alternating_schedule m) v)two_agents_round_alternating_not_wspIn LeanFair Division
For 2 agents and k * 2 + r objects with k ≥ 2 and r < 2, any allocation rule that is non-wasteful, neutral, EF1, and whose unanimous picking sequence is round-alternating is not weakly strategy-proof.
theorem two_agents_round_alternating_not_wsp (k r : ℕ) (hk : 2 ≤ k) (hr : r < 2)
(f : (Fin 2 → LinearOrder (Fin (k * 2 + r))) → Fin 2 → Finset (Fin (k * 2 + r)))
(h_alloc : is_allocation_rule f)
(h_nw : is_non_wasteful_rule f)
(h_neut : is_neutral_rule f)
(h_ef1 : is_ef1_rule f)
(s : Fin (k * 2 + r) → Fin 2)
(hs : ∀ (e : Fin (k * 2 + r) ≃ Fin (k * 2 + r)) (i : Fin 2),
(f (fun _ => draft_enum_order e) i).map e.toEmbedding =
Finset.univ.filter (fun m => s m = i))
(halt : ∀ (t : ℕ) (ht : t < k), s ⟨2 * t, by omega⟩ ≠ s ⟨2 * t + 1, by omega⟩) :
¬ is_weakly_strategy_proof_rule ftwo_agents_rule_pick_seqIn LeanFair Division
A non-wasteful, neutral allocation rule on 2 agents and k * 2 + r objects acts as a picking sequence s at every unanimous profile.
theorem two_agents_rule_pick_seq (k r : ℕ)
(f : (Fin 2 → LinearOrder (Fin (k * 2 + r))) → Fin 2 → Finset (Fin (k * 2 + r)))
(h_alloc : is_allocation_rule f) (h_nw : is_non_wasteful_rule f) (h_neut : is_neutral_rule f) :
∃ s : Fin (k * 2 + r) → Fin 2,
∀ (e : Fin (k * 2 + r) ≃ Fin (k * 2 + r)) (i : Fin 2),
(f (fun _ => draft_enum_order e) i).map e.toEmbedding =
Finset.univ.filter (fun m => s m = i)two_agents_unanimous_round_balanceIn LeanFair Division
If an allocation rule on 2 agents and k * 2 + r objects is EF1 and agrees with picking sequence s at unanimous profiles, then s must be round-alternating: for every round t < k, s(2t) ≠ s(2t+1).
theorem two_agents_unanimous_round_balance (k r : ℕ) (hk : 2 ≤ k) (hr : r < 2)
(f : (Fin 2 → LinearOrder (Fin (k * 2 + r))) → Fin 2 → Finset (Fin (k * 2 + r)))
(h_ef1 : is_ef1_rule f)
(s : Fin (k * 2 + r) → Fin 2)
(hs : ∀ (e : Fin (k * 2 + r) ≃ Fin (k * 2 + r)) (i : Fin 2),
(f (fun _ => draft_enum_order e) i).map e.toEmbedding =
Finset.univ.filter (fun m => s m = i)) :
∀ (t : ℕ) (ht : t < k), s ⟨2 * t, by omega⟩ ≠ s ⟨2 * t + 1, by omega⟩two_type_chores_alpha_below_four_thirds_failsIn LeanFair Division
For every real alpha < 4/3, the universal existence property two_type_chores_have_alpha_pmms_fpo alpha fails.
theorem two_type_chores_alpha_below_four_thirds_fails :
∀ α : ℝ, α < 4 / 3 → ¬ two_type_chores_have_alpha_pmms_fpo αtwo_type_chores_alpha_between_one_and_four_thirds_failsIn LeanFair Division
For every real alpha with 1 < alpha < 4/3, the universal existence property two_type_chores_have_alpha_pmms_fpo alpha fails: there is an instance with no fractionally Pareto optimal allocation that is alpha-PMMS.
theorem two_type_chores_alpha_between_one_and_four_thirds_fails :
∀ α : ℝ, 1 < α → α < 4 / 3 → ¬ two_type_chores_have_alpha_pmms_fpo αtwo_type_chores_alpha_four_thirds_existsIn LeanFair Division
The universal existence property two_type_chores_have_alpha_pmms_fpo holds at alpha = 4/3: for every n ≥ 2, chore totals a, b and strictly positive costs p, q, there is an integer allocation that is both fractionally Pareto optimal and (4/3)-PMMS.
theorem two_type_chores_alpha_four_thirds_exists : two_type_chores_have_alpha_pmms_fpo (4 / 3)
two_type_chores_alpha_le_one_failsIn LeanFair Division
For every real alpha ≤ 1, the universal existence property two_type_chores_have_alpha_pmms_fpo alpha fails.
theorem two_type_chores_alpha_le_one_fails :
∀ α : ℝ, α ≤ 1 → ¬ two_type_chores_have_alpha_pmms_fpo αtwo_type_chores_have_alpha_pmms_fpo_twoIn LeanFair Division
The universal existence property two_type_chores_have_alpha_pmms_fpo holds at alpha = 2, so it is non-vacuous and the sharp constant is at most 2.
theorem two_type_chores_have_alpha_pmms_fpo_two : two_type_chores_have_alpha_pmms_fpo 2
uniform_bivalued_agent_zero_balanced_safeIn LeanFair Division
In a two-agent chore instance where agent 0 assigns cost 1 to every chore, any cardinality-balanced subset S (both |S| and |univ \ S| at most (m+1)/2) gives both bundles additive cost at most agent 0's two-agent chore maximin share.
theorem uniform_bivalued_agent_zero_balanced_safe
(m : ℕ) (c : Fin 2 → Fin m → ℝ)
(hc0 : ∀ g, c 0 g = 1) (S : Finset (Fin m))
(hs : S.card ≤ (m + 1) / 2) (hsc : (Finset.univ \ S).card ≤ (m + 1) / 2) :
additive_valuation (c 0) S ≤ chore_maximin_share 2 (c 0) ∧
additive_valuation (c 0) (Finset.univ \ S) ≤ chore_maximin_share 2 (c 0)uniform_bivalued_exact_mms_necessityIn LeanFair Division
If every two-agent uniform bivalued chores instance of ratio r admits an equal-marginal exact-MMS lottery, then r = 1 or r = 1 + 1/k for some positive integer k.
theorem uniform_bivalued_exact_mms_necessity (r : ℝ) (hr1 : 1 ≤ r) (hr2 : r ≤ 2)
(h : ∀ (m : ℕ) (c : Fin 2 → Fin m → ℝ), is_uniform_bivalued_chores r c →
∃ p ∈ stdSimplex ℝ (Fin m → Fin 2),
is_equal_marginal_lottery p ∧ is_ex_post_alpha_mms_chores 1 c p) :
r = 1 ∨ ∃ k : ℕ, 1 ≤ k ∧ r = 1 + 1 / (k : ℝ)uniform_bivalued_exact_mms_sufficiencyIn LeanFair Division
If r = 1 or r = 1 + 1/k with k >= 1, every two-agent uniform bivalued chores instance admits an equal-marginal lottery all of whose allocations are exactly MMS.
theorem uniform_bivalued_exact_mms_sufficiency (r : ℝ) (hr1 : 1 ≤ r) (hr2 : r ≤ 2)
(hr : r = 1 ∨ ∃ k : ℕ, 1 ≤ k ∧ r = 1 + 1 / (k : ℝ)) :
∀ (m : ℕ) (c : Fin 2 → Fin m → ℝ), is_uniform_bivalued_chores r c →
∃ p ∈ stdSimplex ℝ (Fin m → Fin 2),
is_equal_marginal_lottery p ∧ is_ex_post_alpha_mms_chores 1 c puniform_bivalued_obstruction_cost_is_uniformIn LeanFair Division
The obstruction cost profile is a uniform bivalued chores instance of ratio r: agent 0 pays 1 on every chore, and agent 1 pays either r or 1 on every chore.
theorem uniform_bivalued_obstruction_cost_is_uniform (t : ℕ) (r : ℝ) :
is_uniform_bivalued_chores r (uniform_bivalued_obstruction_cost t r)
upgrade_feasible_exists_cost_increase_agentIn LeanFair Division
Lemma 2.2 of arXiv:2611.00432: in every upgrade-feasible update from an allocation A of m chores to an allocation A' of m + 1 chores with costs c, there exist an agent r and a chore h in r's new bundle (A' h = r) such that for all agents i ≠ r, agent i's total cost under A' is at most her total cost under A, and agent r's total cost under A' without h is at most her total cost under A.
theorem upgrade_feasible_exists_cost_increase_agent {m n : ℕ}
(c : Fin n → Fin (m + 1) → ℝ) (A : Fin m → Fin n) (A' : Fin (m + 1) → Fin n)
(hfeas : is_upgrade_feasible c A A') :
∃ (r : Fin n) (h : Fin (m + 1)),
A' h = r ∧
(∀ i : Fin n, i ≠ r →
additive_valuation (c i) (bundle_of A' i) ≤
additive_valuation (fun d => c i d.castSucc) (bundle_of A i)) ∧
additive_valuation (c r) ((bundle_of A' r).erase h) ≤
additive_valuation (fun d => c r d.castSucc) (bundle_of A r)wsp_bundle_no_strict_subsetIn LeanFair Division
For a weakly strategy-proof rule, a single agent's misreport can never give her a bundle that strictly contains, or is strictly contained in, her truthful bundle.
theorem wsp_bundle_no_strict_subset {Agent Object : Type*} [DecidableEq Agent]
(f : (Agent → LinearOrder Object) → Agent → Finset Object)
(h_wsp : is_weakly_strategy_proof_rule f)
(succ : Agent → LinearOrder Object) (i : Agent) (o : LinearOrder Object) :
¬ (f (Function.update succ i o) i ⊂ f succ i) ∧
¬ (f succ i ⊂ f (Function.update succ i o) i)Ug_cardIn LeanGeneral Equilibrium & Cooperative Games
For 2g+1 < n the number of orderings satisfying Ug for the fixed group g is (n-1)!/(2g+1).
theorem Ug_card (n g : ℕ) (hg : 2 * g + 1 < n) :
(Nat.card {e : Fin (Fintype.card (Fin n)) ≃ Fin n // Ug e g} : ℝ)
= (Nat.factorial (n - 1) : ℝ) / (2 * g + 1)Ug_inter_cardIn LeanGeneral Equilibrium & Cooperative Games
For g < g' with 2g'+1 < n, at most 4(n-2)!/(2g') orderings satisfy both Ug g and Ug g'.
theorem Ug_inter_card (n g g' : ℕ) (hgg : g < g') (hg' : 2 * g' + 1 < n) :
(Nat.card {e : Fin (Fintype.card (Fin n)) ≃ Fin n // Ug e g ∧ Ug e g'} : ℝ)
≤ 4 * (Nat.factorial (n - 2) : ℝ) / (2 * g' + 1)crossPairCount_defectIn LeanGeneral Equilibrium & Cooperative Games
For coalitions A, B the supermodularity defect of N is the number of ordered cross-group pairs separated by A and B.
theorem crossPairCount_defect {n : ℕ} (A B : Finset (Fin n)) :
crossPairCount (A ∪ B) + crossPairCount (A ∩ B) - crossPairCount A - crossPairCount B
= (cutPairCount A B : ℝ)crossPairCount_defect_eq_zero_iffIn LeanGeneral Equilibrium & Cooperative Games
N(A∪B) + N(A∩B) - N(A) - N(B) = 0 if and only if every element of A\B lies in the same group as every element of B\A.
theorem crossPairCount_defect_eq_zero_iff {n : ℕ} (A B : Finset (Fin n)) :
crossPairCount (A ∪ B) + crossPairCount (A ∩ B) - crossPairCount A - crossPairCount B = 0 ↔
(∀ a ∈ A, a ∉ B → ∀ b ∈ B, b ∉ A → a.val / 2 = b.val / 2)ell_defect_leIn LeanGeneral Equilibrium & Cooperative Games
ell(A∪B) + ell(A∩B) - ell(A) - ell(B) is at most numGroups n, in particular bounded independently of the coalitions.
theorem ell_defect_le {n : ℕ} (A B : Finset (Fin n)) :
((ell (A ∪ B) : ℝ) + (ell (A ∩ B) : ℝ)) - ((ell A : ℝ) + (ell B : ℝ)) ≤ (numGroups n : ℝ)ell_ge_iffIn LeanGeneral Equilibrium & Cooperative Games
For g ≤ numGroups n, ell(S) ≥ g if and only if every group h < g is fully contained in S.
theorem ell_ge_iff {n : ℕ} (S : Finset (Fin n)) (g : ℕ) (hg : g ≤ numGroups n) :
(g ≤ ell S ↔ ∀ h < g, groupSet h ⊆ S)exists_violated_pair_of_marginal_not_in_coreIn LeanGeneral Equilibrium & Cooperative Games
Let v be a game with v(∅) = 0 on a finite player set and e a player ordering. If the marginal vector of e is not in the core, there are coalitions A, B and a player i such that (A,B) violates supermodularity, B \ A = {i}, and A is exactly the set of players preceding i in e.
theorem exists_violated_pair_of_marginal_not_in_core {α : Type*} [DecidableEq α] [Fintype α]
(v : Finset α → ℝ) (hv0 : v ∅ = 0) (e : Fin (Fintype.card α) ≃ α)
(h : ¬ is_in_core v (marginal_vector v e)) :
∃ (A B : Finset α) (i : α),
violates_supermodularity v A B ∧ B \ A = {i} ∧ predecessors e i = AgameV_bad_pair_shapeIn LeanGeneral Equilibrium & Cooperative Games
If v_n(S∪U) + v_n(S∩U) < v_n(S) + v_n(U), then S and U differ only inside a single pair-group g, by complementary singletons {a} and {b}, and every group h < g is fully contained in S.
theorem gameV_bad_pair_shape {n : ℕ} (S U : Finset (Fin n))
(h : gameV n (S ∪ U) + gameV n (S ∩ U) - gameV n S - gameV n U < 0) :
∃ (a b : Fin n) (g : ℕ), a ≠ b ∧ a.val / 2 = g ∧ b.val / 2 = g ∧
S \ U = {a} ∧ U \ S = {b} ∧ (∀ h' < g, groupSet h' ⊆ S)gameV_bad_partner_uniqueIn LeanGeneral Equilibrium & Cooperative Games
For a fixed coalition S there is at most one coalition U with v_n(S∪U) + v_n(S∩U) < v_n(S) + v_n(U).
theorem gameV_bad_partner_unique {n : ℕ} (S U U' : Finset (Fin n))
(hU : gameV n (S ∪ U) + gameV n (S ∩ U) - gameV n S - gameV n U < 0)
(hU' : gameV n (S ∪ U') + gameV n (S ∩ U') - gameV n S - gameV n U' < 0) :
U = U'gameV_defect_neg_iffIn LeanGeneral Equilibrium & Cooperative Games
The supermodularity defect of v_n on (A,B) is negative if and only if the cross-group pair count defect vanishes and ell strictly increases in the sense ell(A∪B)+ell(A∩B) > ell(A)+ell(B).
theorem gameV_defect_neg_iff {n : ℕ} (A B : Finset (Fin n)) :
gameV n (A ∪ B) + gameV n (A ∩ B) - gameV n A - gameV n B < 0 ↔
(crossPairCount (A ∪ B) + crossPairCount (A ∩ B) - crossPairCount A - crossPairCount B = 0 ∧
(ell A : ℝ) + (ell B : ℝ) < (ell (A ∪ B) : ℝ) + (ell (A ∩ B) : ℝ))gameV_emptyIn LeanGeneral Equilibrium & Cooperative Games
The constructed game assigns value 0 to the empty coalition.
theorem gameV_empty (n : ℕ) : gameV n ∅ = 0
gameV_two_thirds_convexIn LeanGeneral Equilibrium & Cooperative Games
The game v_n(S) = (4n+1)N(S) - ell(S) is 2/3-convex.
theorem gameV_two_thirds_convex (n : ℕ) : is_two_thirds_convex (gameV n)
gameV_violationIn LeanGeneral Equilibrium & Cooperative Games
If an ordering e satisfies Ug for some group g, then the marginal vector of v_n along e is not in the core.
theorem gameV_violation (n : ℕ) (e : Fin (Fintype.card (Fin n)) ≃ Fin n) (g : ℕ) (h : Ug e g) :
¬ is_in_core (gameV n) (marginal_vector (gameV n) e)groupSet_card_le_twoIn LeanGeneral Equilibrium & Cooperative Games
Each group of players contains at most two elements.
theorem groupSet_card_le_two (n g : ℕ) : (groupSet (n := n) g).card ≤ 2
hierarchical_game_emptyIn LeanGeneral Equilibrium & Cooperative Games
The hierarchical game evaluates to 0 on the empty coalition.
theorem hierarchical_game_empty (n : ℕ) :
(fun S : Finset (Fin n) => (4 * (n : ℝ) + 1) * crossPairCount S - (ell S : ℝ)) ∅ = 0hierarchical_game_two_thirds_convexIn LeanGeneral Equilibrium & Cooperative Games
The hierarchical game on Fin n is 2/3-convex.
theorem hierarchical_game_two_thirds_convex (n : ℕ) :
is_two_thirds_convex (fun S : Finset (Fin n) => (4 * (n : ℝ) + 1) * crossPairCount S - (ell S : ℝ))hierarchical_game_violation_of_UgIn LeanGeneral Equilibrium & Cooperative Games
Any player ordering satisfying the event Ug e g produces a marginal vector outside the core.
theorem hierarchical_game_violation_of_Ug {n : ℕ}
(e : Fin (Fintype.card (Fin n)) ≃ Fin n) (g : ℕ) (hg : Ug e g) :
¬ is_in_core (fun S : Finset (Fin n) => (4 * (n : ℝ) + 1) * crossPairCount S - (ell S : ℝ))
(marginal_vector (fun S : Finset (Fin n) => (4 * (n : ℝ) + 1) * crossPairCount S - (ell S : ℝ)) e)marginal_vector_sum_eqIn LeanGeneral Equilibrium & Cooperative Games
For any game v and ordering e, the sum over players of the marginal vector equals v(univ) - v(∅); the values along e telescope through the prefixes.
theorem marginal_vector_sum_eq {α : Type*} [DecidableEq α] [Fintype α] (v : Finset α → ℝ)
(e : Fin (Fintype.card α) ≃ α) :
(∑ i : α, marginal_vector v e i) = v Finset.univ - v ∅marginal_vector_sum_univIn LeanGeneral Equilibrium & Cooperative Games
For any game with v(∅) = 0 and ordering e, the total payoff of the marginal vector over all players equals v(univ).
theorem marginal_vector_sum_univ {α : Type*} [DecidableEq α] [Fintype α]
(v : Finset α → ℝ) (hv0 : v ∅ = 0) (e : Fin (Fintype.card α) ≃ α) :
∑ i : α, marginal_vector v e i = v Finset.univnoncore_ordering_fraction_le_oneIn LeanGeneral Equilibrium & Cooperative Games
For any game v on a finite player set, the fraction of orderings whose marginal vector is outside the core is at most 1.
theorem noncore_ordering_fraction_le_one {α : Type*} [DecidableEq α] [Fintype α] (v : Finset α → ℝ) :
noncore_ordering_fraction v ≤ 1order_prefix_cardIn LeanGeneral Equilibrium & Cooperative Games
For any ordering bijection e of a finite type α and k ≤ |α|, the prefix of length k has cardinality k.
theorem order_prefix_card {α : Type*} [DecidableEq α] [Fintype α]
(e : Fin (Fintype.card α) ≃ α) (k : ℕ) (hk : k ≤ Fintype.card α) :
(order_prefix e k).card = korder_prefix_monoIn LeanGeneral Equilibrium & Cooperative Games
Order prefixes are monotone with respect to their length: for any j ≤ k, order_prefix e j ⊆ order_prefix e k.
theorem order_prefix_mono {α : Type*} [DecidableEq α] [Fintype α]
(e : Fin (Fintype.card α) ≃ α) {j k : ℕ} (hjk : j ≤ k) :
order_prefix e j ⊆ order_prefix e kthree_distant_convex_blocking_sdiff_card_le_oneIn LeanGeneral Equilibrium & Cooperative Games
In a 3-distant convex game, if S ⊆ order_prefix(k+1) contains player e(k) and its marginal contribution of e(k) strictly exceeds that in the prefix, then the complement of S in order_prefix(k) has cardinality at most 1.
theorem three_distant_convex_blocking_sdiff_card_le_one
{α : Type*} [DecidableEq α] [Fintype α]
(v : Finset α → ℝ) (hv : is_three_distant_convex v)
(e : Fin (Fintype.card α) ≃ α) (k : ℕ) (hk : k < Fintype.card α)
(S : Finset α) (hS : S ⊆ order_prefix e (k + 1))
(h_mem : e ⟨k, hk⟩ ∈ S)
(h_excess : v S - v (S \ {e ⟨k, hk⟩}) > v (order_prefix e (k + 1)) - v (order_prefix e k)) :
(order_prefix e k \ S).card ≤ 1three_distant_convex_marginal_vector_in_core_iff_local_no_swapIn LeanGeneral Equilibrium & Cooperative Games
Let v be a 3-distant convex cooperative game with v(∅) = 0 on a finite player set α, and let e be an ordering bijection of the players. Then the marginal worth vector marginal_vector v e belongs to the core of v (is_in_core v (marginal_vector v e)) if and only if the local no-swap condition local_no_swap v e holds.
theorem three_distant_convex_marginal_vector_in_core_iff_local_no_swap
{α : Type*} [DecidableEq α] [Fintype α]
(v : Finset α → ℝ) (hv0 : v ∅ = 0) (hv : is_three_distant_convex v)
(e : Fin (Fintype.card α) ≃ α) :
is_in_core v (marginal_vector v e) ↔ local_no_swap v etwo_thirds_convex_Ug_fraction_lower_boundIn LeanGeneral Equilibrium & Cooperative Games
The fraction of player orderings satisfying Ug e g for some group g is at least c * log(n) / n for all large n.
theorem two_thirds_convex_Ug_fraction_lower_bound :
∃ c > 0, ∃ n₀ : ℕ, ∀ n ≥ n₀,
c * Real.log (n : ℝ) / (n : ℝ) ≤ (UgCount n : ℝ) / (n.factorial : ℝ)two_thirds_convex_core_nonemptyIn LeanGeneral Equilibrium & Cooperative Games
For every cooperative game v : Finset α → ℝ on a finite type α with decidable equality and at least 3 players (3 ≤ Fintype.card α) satisfying v(∅) = 0, if v is 2/3-convex, then the core of v is nonempty (there exists an allocation x : α → ℝ such that is_in_core v x).
theorem two_thirds_convex_core_nonempty {α : Type*} [DecidableEq α] [Fintype α]
(v : Finset α → ℝ) (hv0 : v ∅ = 0) (h_card : 3 ≤ Fintype.card α)
(h_conv : is_two_thirds_convex v) :
∃ x : α → ℝ, is_in_core v xtwo_thirds_convex_implies_three_distant_convexIn LeanGeneral Equilibrium & Cooperative Games
Every 2/3-convex cooperative game is 3-distant convex.
theorem two_thirds_convex_implies_three_distant_convex {α : Type*} [DecidableEq α]
(v : Finset α → ℝ) (h : is_two_thirds_convex v) :
is_three_distant_convex vtwo_thirds_convex_marginal_vector_in_coreIn LeanGeneral Equilibrium & Cooperative Games
For every cooperative game v : Finset α → ℝ on a finite type α with decidable equality and at least 3 players (3 ≤ Fintype.card α) satisfying v(∅) = 0, if v is 2/3-convex, then there exists an ordering bijection e : Fin (Fintype.card α) ≃ α such that the marginal worth vector marginal_vector v e belongs to the core of v (is_in_core v (marginal_vector v e)).
theorem two_thirds_convex_marginal_vector_in_core {α : Type*} [DecidableEq α] [Fintype α]
(v : Finset α → ℝ) (hv0 : v ∅ = 0) (h_card : 3 ≤ Fintype.card α)
(h_conv : is_two_thirds_convex v) :
∃ e : Fin (Fintype.card α) ≃ α, is_in_core v (marginal_vector v e)two_thirds_convex_max_noncore_fraction_tendsto_of_sharp_boundsIn LeanGeneral Equilibrium & Cooperative Games
Assume every 2/3-convex game on n players with v(∅)=0 has non-core ordering fraction at most (2+ε)log n/n eventually, and that eventually some such game attains at least (2−ε)log n/n. Then n·max_noncore_fraction(n)/log n tends to 2.
theorem two_thirds_convex_max_noncore_fraction_tendsto_of_sharp_bounds
(hupper : ∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in Filter.atTop,
∀ v : Finset (Fin n) → ℝ, v ∅ = 0 → is_two_thirds_convex v →
(n : ℝ) * noncore_ordering_fraction v / Real.log (n : ℝ) ≤ 2 + ε)
(hlower : ∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in Filter.atTop,
∃ v : Finset (Fin n) → ℝ, v ∅ = 0 ∧ is_two_thirds_convex v ∧
2 - ε ≤ (n : ℝ) * noncore_ordering_fraction v / Real.log (n : ℝ)) :
Filter.Tendsto (fun n : ℕ => (n : ℝ) * two_thirds_convex_max_noncore_fraction n / Real.log (n : ℝ))
Filter.atTop (nhds 2)two_thirds_convex_noncore_fraction_lower_sharpIn LeanGeneral Equilibrium & Cooperative Games
For every ε > 0 and all sufficiently large n there is a 2/3-convex game v on n players with v(∅) = 0 whose non-core ordering fraction is at least (2−ε)log n/n.
theorem two_thirds_convex_noncore_fraction_lower_sharp :
∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in Filter.atTop,
∃ v : Finset (Fin n) → ℝ, v ∅ = 0 ∧ is_two_thirds_convex v ∧
2 - ε ≤ (n : ℝ) * noncore_ordering_fraction v / Real.log (n : ℝ)two_thirds_convex_noncore_fraction_upper_sharpIn LeanGeneral Equilibrium & Cooperative Games
For every ε > 0 and all sufficiently large n, every 2/3-convex game v on n players with v(∅) = 0 has at most a (2+ε)log n/n fraction of player orderings whose marginal vector lies outside the core.
theorem two_thirds_convex_noncore_fraction_upper_sharp :
∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in Filter.atTop,
∀ v : Finset (Fin n) → ℝ, v ∅ = 0 → is_two_thirds_convex v →
(n : ℝ) * noncore_ordering_fraction v / Real.log (n : ℝ) ≤ 2 + εtwo_thirds_convex_pairwise_singleton_superadditive_permutationally_convexIn LeanGeneral Equilibrium & Cooperative Games
Let v be a 2/3-convex cooperative game on a finite set of players α with at least 3 players (3 ≤ Fintype.card α) satisfying v ∅ = 0. If v satisfies pairwise singleton superadditivity (v {i} + v {j} ≤ v {i, j} for all distinct i j : α), then v is permutationally convex.
theorem two_thirds_convex_pairwise_singleton_superadditive_permutationally_convex
{α : Type*} [DecidableEq α] [Fintype α]
(v : Finset α → ℝ) (hv0 : v ∅ = 0) (h_card : 3 ≤ Fintype.card α)
(h_conv : is_two_thirds_convex v)
(h_pair : ∀ i j : α, i ≠ j → v {i} + v {j} ≤ v {i, j}) :
is_permutationally_convex vtwo_thirds_convex_violation_witnessIn LeanGeneral Equilibrium & Cooperative Games
There is a 2/3-convex game on two players with v(∅) = 0 that has a violated supermodularity pair, so violates_supermodularity is neither vacuous nor implied by 2/3-convexity.
theorem two_thirds_convex_violation_witness :
∃ (v : Finset (Fin 2) → ℝ) (S T : Finset (Fin 2)),
v ∅ = 0 ∧ is_two_thirds_convex v ∧ violates_supermodularity v S Tviolates_supermodularity_unique_partnerIn LeanGeneral Equilibrium & Cooperative Games
For a 2/3-convex game the violated supermodularity pairs form a matching: if both {S,T} and {S,U} violate supermodularity then T = U.
theorem violates_supermodularity_unique_partner {α : Type*} [DecidableEq α] (v : Finset α → ℝ)
(h : is_two_thirds_convex v) {S T U : Finset α}
(hST : violates_supermodularity v S T) (hSU : violates_supermodularity v S U) : T = Ucyclic_latin_is_stable_matching_iffIn LeanMatching & Market Design
In the opposed cyclic Latin market determined by an ordering bijection a of Z/nZ, a matching μ is stable exactly when no pair of men x, z makes the label a.symm(z + μ x) of the edge (z, μ x) lie strictly between the rank a.symm(x + μ x) that woman μ x pays under μ and the rank a.symm(z + μ z) that man z pays under μ.
theorem cyclic_latin_is_stable_matching_iff (n : ℕ) (a : Fin n ≃ ZMod n) (μ : Equiv.Perm (ZMod n)) :
is_stable_matching (cyclic_latin_market n a) μ ↔
∀ x z : ZMod n, ¬ (a.symm (x + μ x) < a.symm (z + μ x) ∧ a.symm (z + μ x) < a.symm (z + μ z))cyclic_latin_stable_matching_gcd_sequence_transportIn LeanMatching & Market Design
If two ordering bijections a and b of Z/nZ (n >= 3) have the same consecutive gcd sequence, then there is a bijection Φ of the set of all matchings that carries the stable matchings of the a-market onto the stable matchings of the b-market, and that preserves each matching's aggregate proposer rank: μ is a-stable iff Φ μ is b-stable, and for a-stable μ the two rank sums agree.
theorem cyclic_latin_stable_matching_gcd_sequence_transport (n : ℕ) (hn : 3 ≤ n)
(a b : Fin n ≃ ZMod n) (h_gcd : cyclic_consecutive_gcd_eq a b) :
haveI : NeZero n := ⟨by omega⟩
∃ Φ : Equiv.Perm (ZMod n) ≃ Equiv.Perm (ZMod n),
(∀ μ : Equiv.Perm (ZMod n),
is_stable_matching (cyclic_latin_market n a) μ ↔
is_stable_matching (cyclic_latin_market n b) (Φ μ)) ∧
(∀ μ : Equiv.Perm (ZMod n), is_stable_matching (cyclic_latin_market n a) μ →
cyclic_latin_rank_sum n a μ = cyclic_latin_rank_sum n b (Φ μ))cyclic_latin_stable_matching_of_coprime_stepsIn LeanMatching & Market Design
If every consecutive difference of the ordering a is coprime to n (equivalently every consecutive gcd is 1), then the only stable matchings of the cyclic Latin market are the n rotations μ_r(i) = a r - i.
theorem cyclic_latin_stable_matching_of_coprime_steps (n : ℕ) (a : Fin n ≃ ZMod n)
(hcop : ∀ (r : ℕ) (hr : r + 1 < n), Nat.gcd n (a ⟨r + 1, hr⟩ - a ⟨r, by omega⟩).val = 1)
(μ : Equiv.Perm (ZMod n)) (hμ : is_stable_matching (cyclic_latin_market n a) μ) :
∃ r : Fin n, μ = cyclic_latin_rank_matching n a rcyclic_latin_stable_rank_polynomial_add_constIn LeanMatching & Market Design
Translating the cyclic order by a constant (replacing a r by a r + c) does not change the stable-matching rank polynomial.
theorem cyclic_latin_stable_rank_polynomial_add_const (n : ℕ) [NeZero n] (a : Fin n ≃ ZMod n) (c : ZMod n) :
cyclic_latin_rank_polynomial n a = cyclic_latin_rank_polynomial n (a.trans (Equiv.addRight c))cyclic_latin_stable_rank_polynomial_unit_mulIn LeanMatching & Market Design
If the ordering b is obtained from a by multiplying pointwise by a unit u of ZMod n (b r = u * a r), then a and b have the same stable-matching rank polynomial.
theorem cyclic_latin_stable_rank_polynomial_unit_mul (n : ℕ) [NeZero n] (a b : Fin n ≃ ZMod n)
(u : (ZMod n)ˣ) (hb : ∀ r : Fin n, b r = (u : ZMod n) * a r) :
cyclic_latin_rank_polynomial n a = cyclic_latin_rank_polynomial n bcyclic_latin_stable_rank_vector_coset_constantIn LeanMatching & Market Design
If every consecutive difference of the ordering a has gcd (with n) dividing L, and L divides n, then the rank vector i ↦ a.symm(i + μ i) of any stable matching μ is constant on the cosets of the subgroup of ZMod n generated by L: whenever L divides the representative of x - y, one has a.symm(x + μ x) = a.symm(y + μ y).
theorem cyclic_latin_stable_rank_vector_coset_constant (n : ℕ) [NeZero n] (a : Fin n ≃ ZMod n)
(L : ℕ) (hL : ∀ (r : ℕ) (hr : r + 1 < n), Nat.gcd n (a ⟨r + 1, hr⟩ - a ⟨r, by omega⟩).val ∣ L)
(hdvd : L ∣ n) (μ : Equiv.Perm (ZMod n)) (hμ : is_stable_matching (cyclic_latin_market n a) μ)
(x y : ZMod n) (hxy : L ∣ (x - y).val) :
a.symm (x + μ x) = a.symm (y + μ y)opposed_latin_blocking_eq_sum_block_weightIn LeanMatching & Market Design
For every complete matching μ of the opposed Latin marriage market of an n × n array L, the number of blocking pairs of μ equals the sum over all ordered pairs of men (i,k) of latin_block_weight L i k (μ i) (μ k): since k ↦ μ k runs over all women, this is just the count of blocking pairs re-indexed over ordered pairs of men.
theorem opposed_latin_blocking_eq_sum_block_weight {n : ℕ} (L : Fin n → Fin n → Fin n)
(μ : Equiv.Perm (Fin n)) :
{p : Fin n × Fin n | is_blocking_pair (opposed_latin_market L) μ p.1 p.2}.ncard
= ∑ i : Fin n, ∑ k : Fin n, latin_block_weight L i k (μ i) (μ k)opposed_latin_blocking_second_moment_bigOIn LeanMatching & Market Design
There is an absolute constant C such that for every n ≥ 2 and every Latin square L of order n, the second moment E[B^2] of the number of blocking pairs of a uniformly random complete matching in the opposed Latin market of L equals n^4/36 − 19n^3/180 up to an error of at most C·n^2. Together with the exact first moment n(n−2)/6 this gives Var = n^3/180 + O(n^2) uniformly in L, hence the n^3/180 limit.
theorem opposed_latin_blocking_second_moment_bigO :
∃ C : ℝ, 0 ≤ C ∧ ∀ (n : ℕ) (hn : 2 ≤ n) (L : Fin n → Fin n → Fin n), latin_square_is L →
|(∑ μ : Equiv.Perm (Fin n),
((({p : Fin n × Fin n | is_blocking_pair (opposed_latin_market L) μ p.1 p.2}.ncard : ℝ)) ^ 2))
/ (n.factorial : ℝ)
- ((n : ℝ) ^ 4 / 36 - 19 * (n : ℝ) ^ 3 / 180)| ≤ C * (n : ℝ) ^ 2opposed_latin_blocking_variance_tendsto_of_momentsIn LeanMatching & Market Design
Suppose that, uniformly over all n ≥ 2 and all Latin squares L of order n, the mean number of blocking pairs of a uniformly random complete matching is exactly n(n−2)/6 and its second moment is n^4/36 − 19n^3/180 up to an error of at most C·n^2. Then for any sequence of Latin squares L_n, Var(B_n)/n^3 tends to 1/180.
theorem opposed_latin_blocking_variance_tendsto_of_moments
(C : ℝ)
(hmean : ∀ (n : ℕ), 2 ≤ n → ∀ (L : Fin n → Fin n → Fin n), latin_square_is L →
(∑ μ : Equiv.Perm (Fin n),
(({p : Fin n × Fin n | is_blocking_pair (opposed_latin_market L) μ p.1 p.2}.ncard : ℝ)))
= (n.factorial : ℝ) * ((n : ℝ) * ((n : ℝ) - 2) / 6))
(hsecond : ∀ (n : ℕ), 2 ≤ n → ∀ (L : Fin n → Fin n → Fin n), latin_square_is L →
|(∑ μ : Equiv.Perm (Fin n),
((({p : Fin n × Fin n | is_blocking_pair (opposed_latin_market L) μ p.1 p.2}.ncard : ℝ)) ^ 2))
/ (n.factorial : ℝ)
- ((n : ℝ) ^ 4 / 36 - 19 * (n : ℝ) ^ 3 / 180)| ≤ C * (n : ℝ) ^ 2)
(L : (n : ℕ) → Fin n → Fin n → Fin n) (hL : ∀ n, latin_square_is (L n)) :
Filter.Tendsto (fun n : ℕ =>
(∑ μ : Equiv.Perm (Fin n),
(({p : Fin n × Fin n |
is_blocking_pair (opposed_latin_market (L n)) μ p.1 p.2}.ncard : ℝ)
- (∑ ν : Equiv.Perm (Fin n),
({p : Fin n × Fin n |
is_blocking_pair (opposed_latin_market (L n)) ν p.1 p.2}.ncard : ℝ)) /
(n.factorial : ℝ)) ^ 2) / (n.factorial : ℝ) / (n : ℝ) ^ 3)
Filter.atTop (nhds (1 / 180))bilateral_trade_grid_approximation_boundIn LeanMechanism Design & Auctions
For every integer K ≥ 2, let grid be the uniform K × K grid on [0,1]² with points (i/(K-1), j/(K-1)) for i, j ∈ {0, ..., K-1}. For any function F : ℝ² → ℝ that is coordinatewise non-decreasing on [0,1]² with values in [0,1], define the expected profit function r(x) = (1 - x₁ - x₂) F(x) and let OPT = max_{x ∈ grid} r(x). Then 0 ≤ sup_{x ∈ [0,1]²} r(x) - OPT ≤ 2/(K-1).
theorem bilateral_trade_grid_approximation_bound (K : ℕ) (hK : 2 ≤ K)
(F : ℝ × ℝ → ℝ)
(hF_mono : MonotoneOn F (Set.Icc 0 1 ×ˢ Set.Icc 0 1))
(hF_range : ∀ x ∈ Set.Icc (0 : ℝ) 1 ×ˢ Set.Icc (0 : ℝ) 1, 0 ≤ F x ∧ F x ≤ 1) :
let r := fun (x : ℝ × ℝ) => (1 - x.1 - x.2) * F x
let grid : Finset (ℝ × ℝ) :=
(Finset.image (fun (i : Fin K) => (i.val : ℝ) / (K - 1 : ℝ)) Finset.univ) ×ˢ
(Finset.image (fun (i : Fin K) => (i.val : ℝ) / (K - 1 : ℝ)) Finset.univ)
let s := Set.Icc (0 : ℝ) 1 ×ˢ Set.Icc (0 : ℝ) 1
∀ (hgrid : grid.Nonempty),
let opt := grid.sup' hgrid r
0 ≤ sSup (r '' s) - opt ∧ sSup (r '' s) - opt ≤ 2 / (K - 1 : ℝ)bilateral_trade_profit_diff_decompIn LeanMechanism Design & Auctions
For any real-valued function F on ℝ², the profit difference r(x) - r(u) between points x and u decomposes as (1 - x₁ - x₂)(F(x) - F(u)) + (u₁ - x₁ + u₂ - x₂) F(u), where r(x) = (1 - x₁ - x₂) F(x).
theorem bilateral_trade_profit_diff_decomp (F : ℝ × ℝ → ℝ) (x u : ℝ × ℝ) :
(1 - x.1 - x.2) * F x - (1 - u.1 - u.2) * F u =
(1 - x.1 - x.2) * (F x - F u) + (u.1 - x.1 + u.2 - x.2) * F ubilateral_trade_profit_round_diff_leIn LeanMechanism Design & Auctions
For any integer K ≥ 2, any function F : ℝ × ℝ → ℝ, and points x, u ∈ ℝ × ℝ satisfying x₁ + x₂ ≤ 1, F(x) ≤ F(u), 0 ≤ F(u) ≤ 1, 0 ≤ u₁ - x₁ ≤ 1/(K-1), and 0 ≤ u₂ - x₂ ≤ 1/(K-1), it holds that (1 - x₁ - x₂) F(x) - (1 - u₁ - u₂) F(u) ≤ 2/(K-1).
theorem bilateral_trade_profit_round_diff_le (K : ℕ) (hK : 2 ≤ K) (F : ℝ × ℝ → ℝ) (x u : ℝ × ℝ)
(hx : x.1 + x.2 ≤ 1) (hF_mono : F x ≤ F u) (hFu : F u ≤ 1) (hFu0 : 0 ≤ F u)
(hu1_ge : 0 ≤ u.1 - x.1) (hu2_ge : 0 ≤ u.2 - x.2)
(hu1 : u.1 - x.1 ≤ 1 / (K - 1 : ℝ)) (hu2 : u.2 - x.2 ≤ 1 / (K - 1 : ℝ)) :
(1 - x.1 - x.2) * F x - (1 - u.1 - u.2) * F u ≤ 2 / (K - 1 : ℝ)bit_persuasion_even_binom_identityIn LeanMechanism Design & Auctions
For any m ≥ 1, (m + 1) * ((2m).choose(m-1) - (2m-2).choose(m-1)) + 3m * ((2m).choose m - (2m-2).choose m) = 3m * (2m).choose m.
open Finset in
lemma bit_persuasion_even_binom_identity (m : ℕ) (hm : 1 ≤ m) :
((m + 1 : ℝ) * (((2 * m).choose (m - 1) : ℝ) - ((2 * m - 2).choose (m - 1) : ℝ)) +
(3 * (m : ℝ)) * (((2 * m).choose m : ℝ) - ((2 * m - 2).choose m : ℝ))) =
3 * (m : ℝ) * ((2 * m).choose m : ℝ)bit_persuasion_even_coupling_sumIn LeanMechanism Design & Auctions
For any payoff function g, the expectation under bit_persuasion_even_coupling m equals the average over all s ≠ t of g(v s, v t).
open Finset in
lemma bit_persuasion_even_coupling_sum (m : ℕ)
(g : (bit_persuasion_even_coord m → Bool) → (bit_persuasion_even_coord m → Bool) → ℝ) :
∑ x, ∑ y, bit_persuasion_even_coupling m x y * g x y =
∑ s : Fin (2 * m), ∑ t : Fin (2 * m),
if s ≠ t then 1 / (2 * (m : ℝ) * (2 * (m : ℝ) - 1)) *
g (bit_persuasion_even_state m s) (bit_persuasion_even_state m t)
else 0bit_persuasion_even_scheme_receiver_le_maxIn LeanMechanism Design & Auctions
For any natural number m ≥ 1, if bit_persuasion_even_scheme m is a sender-optimal scheme for bit_persuasion_even_prior m, then its receiver utility is at most persuasion_max_receiver_utility (bit_persuasion_even_prior m).
open Finset in
lemma bit_persuasion_even_scheme_receiver_le_max (m : ℕ) (hm : 1 ≤ m)
(hopt : is_sender_optimal_scheme (bit_persuasion_even_prior m) (bit_persuasion_even_scheme m)) :
persuasion_receiver_utility (bit_persuasion_even_scheme m) ≤
persuasion_max_receiver_utility (bit_persuasion_even_prior m)bit_persuasion_even_scheme_sender_optimalIn LeanMechanism Design & Auctions
For every natural number m with 2 ≤ m, the pair-OR scheme bit_persuasion_even_scheme m is a sender-optimal obedient scheme for the two-layer prior bit_persuasion_even_prior m.
theorem bit_persuasion_even_scheme_sender_optimal (m : ℕ) (hm : 2 ≤ m) :
is_sender_optimal_scheme (bit_persuasion_even_prior m) (bit_persuasion_even_scheme m)bit_persuasion_even_state_or_cardIn LeanMechanism Design & Auctions
For any m ≥ 1 and any distinct s ≠ t in Fin (2m), the cardinality of coordinates where bit_persuasion_even_state m s or bit_persuasion_even_state m t is true is 3m * (2m).choose m.
open Finset in
lemma bit_persuasion_even_state_or_card (m : ℕ) (hm : 1 ≤ m) (s t : Fin (2 * m)) (hst : s ≠ t) :
((Finset.univ.filter (fun i : bit_persuasion_even_coord m =>
(bit_persuasion_even_state m s i || bit_persuasion_even_state m t i) = true)).card : ℝ) =
3 * (m : ℝ) * ((2 * m).choose m : ℝ)not_open_problem_1546In LeanMechanism Design & Auctions
The statement open_problem_1546 is false: The first conjunct of the theorem is false for m = 4. It asserts that every bit prior μ supported on at most 2m states satisfies persuasion_max_receiver_utility μ ≤ ((6m - 1)/(4m + 1)) * persuasion_prior_utility μ. For m = 4, the claimed upper bound factor is 23/17 ≈ 1.3529412. However, for non-uniform bit priors supported on 8 states, experiment #23120 provides an explicit 8-state rational prior with 40 coordinate types and prior probabilities [17/200, 137/1000, 13/125, 17/250, 39/250, 147/1000, 53/500, 197/1000] whose sender-optimal scheme achieves an exact receiver utility ratio of 9666430498775 / 7142886093019 ≈ 1.3532948 > 23/17, refuting the bound.
open Finset in
theorem not_open_problem_1546 : ¬ (∀ (m : ℕ) (hm : 1 ≤ m), (∀ (ι : Type*) [Fintype ι] [DecidableEq ι] (μ : (ι → Bool) → ℝ),
is_bit_prior μ →
(univ.filter (fun x => μ x ≠ 0)).card ≤ 2 * m →
persuasion_max_receiver_utility μ ≤
((6 * (m : ℝ) - 1) / (4 * (m : ℝ) + 1)) * persuasion_prior_utility μ) ∧
(2 ≤ m →
is_sender_optimal_scheme (bit_persuasion_even_prior m) (bit_persuasion_even_scheme m) ∧
(4 * (m : ℝ) + 1) * persuasion_max_receiver_utility (bit_persuasion_even_prior m) =
(6 * (m : ℝ) - 1) * persuasion_prior_utility (bit_persuasion_even_prior m)))redistribution_cosine_kernel_integralIn LeanMechanism Design & Auctions
For every real frequency b, the improper integral over (0,∞) of (1 − cos(b·u))/u² equals π|b|/2. Equivalently, ∫_0^∞ (1−cos(bu))/u² du = π|b|/2, the standard Dirichlet-type cosine kernel integral.
theorem redistribution_cosine_kernel_integral (b : ℝ) :
(∫ u : ℝ in Set.Ioi (0:ℝ), (1 - Real.cos (b*u)) / u^2) = Real.pi * |b| / 2redistribution_poisson_inequality_halfplaneIn LeanMechanism Design & Auctions
Half-plane Poisson inequality for the negative log of the empirical characteristic function: for nonnegative reports and every y > 0, the Poisson integral of −log q against the upper half-plane kernel y/(u²+y²) is at most −log‖χ(iy)‖, where q(u) = ‖χ(u)‖² on the real line.
theorem redistribution_poisson_inequality_halfplane {n : ℕ} (hn : 0 < n) (θ : Fin n → ℝ)
(hθ : ∀ j, 0 ≤ θ j) (y : ℝ) (hy : 0 < y) :
MeasureTheory.IntegrableOn
(fun u : ℝ => (-Real.log (redistribution_trade_multiplier θ u)) * (y / (u^2 + y^2)))
(Set.Ioi 0) ∧
(1/Real.pi) * (∫ u : ℝ in Set.Ioi (0:ℝ),
(-Real.log (redistribution_trade_multiplier θ u)) * (y / (u^2 + y^2))) ≤
-Real.log ‖redistribution_characteristic θ ((y : ℂ)*Complex.I)‖redistribution_poisson_jensen_log_boundIn LeanMechanism Design & Auctions
Half-plane Poisson–Jensen log bound: for nonnegative reports, −log q over u² is integrable on (0,∞) and (1/π)∫_0^∞ (−log q(u))/u² du ≤ (Σθ)/n, where q = ‖χ‖².
theorem redistribution_poisson_jensen_log_bound {n : ℕ} (hn : 0 < n) (θ : Fin n → ℝ)
(hθ : ∀ j, 0 ≤ θ j) :
MeasureTheory.IntegrableOn
(fun u : ℝ => (-Real.log (redistribution_trade_multiplier θ u))/u^2) (Set.Ioi 0) ∧
(1/Real.pi) * (∫ u : ℝ in Set.Ioi (0:ℝ),
(-Real.log (redistribution_trade_multiplier θ u))/u^2) ≤ (∑ j, θ j)/nredistribution_residual_power_integrableIn LeanMechanism Design & Auctions
For every natural number m ≥ 1 and every report profile θ on a nonempty player set, the function u ↦ (1 − q(u))^m / u² is integrable on (0, ∞), where q is the squared empirical multiplier. (For m = 0 the function 1/u² is not integrable near 0, so the hypothesis m ≥ 1 is essential.)
theorem redistribution_residual_power_integrable {n : ℕ} (hn : 0 < n) (θ : Fin n → ℝ)
(m : ℕ) (hm : 1 ≤ m) :
MeasureTheory.IntegrableOn (fun u : ℝ => (1 - redistribution_trade_multiplier θ u)^m / u^2) (Set.Ioi 0)redistribution_residual_power_integral_le_logIn LeanMechanism Design & Auctions
For m ≥ 1 and nonnegative reports, ∫_0^∞ (1 − q(u))^m/u² du ≤ (1/H_m)∫_0^∞ (−log q(u))/u² du, where H_m is the m-th harmonic number.
theorem redistribution_residual_power_integral_le_log {n : ℕ} (hn : 0 < n) (θ : Fin n → ℝ)
(m : ℕ) (hm : 1 ≤ m) (hθ : ∀ j, 0 ≤ θ j) :
(∫ u : ℝ in Set.Ioi (0:ℝ), (1 - redistribution_trade_multiplier θ u)^m / u^2) ≤
(1/(harmonic m : ℝ)) * (∫ u : ℝ in Set.Ioi (0:ℝ),
(-Real.log (redistribution_trade_multiplier θ u))/u^2)redistribution_shortfall_cosine_representationIn LeanMechanism Design & Auctions
The shortfall function G(t) = max(1 − t, 0) equals |t−1|/2 − (t−1)/2, equivalently (1/π)∫_0^∞ (1 − cos((t−1)u))/u² du − (t−1)/2.
theorem redistribution_shortfall_cosine_representation (t : ℝ) :
redistribution_shortfall t =
(1/Real.pi) * (∫ u : ℝ in Set.Ioi (0:ℝ), (1 - Real.cos ((t-1)*u))/u^2) - (t-1)/2redistribution_trade_cosineIn LeanMechanism Design & Auctions
Every cosine at a fixed frequency is an eigenfunction of the symmetric trade operator, with the squared empirical multiplier. The phase center c is arbitrary; no nonempty or report bounds are needed.
theorem redistribution_trade_cosine {n : ℕ} (θ : Fin n → ℝ) (u c t : ℝ) :
redistribution_trade θ (fun x => Real.cos ((x-c)*u)) t =
redistribution_trade_multiplier θ u * Real.cos ((t-c)*u)redistribution_trade_error_cosine_representationIn LeanMechanism Design & Auctions
The m-th order residual error evaluated at s equals −(1/π)∫_0^∞ (1 − q(u))^m cos((s−1)u)/u² du, where q is the squared empirical multiplier (the paper's equation (22)).
theorem redistribution_trade_error_cosine_representation {n : ℕ} (hn : 0 < n) (θ : Fin n → ℝ)
(m : ℕ) (hm : 1 ≤ m) (s : ℝ) :
redistribution_trade_error θ m s =
-(1/Real.pi) * (∫ u : ℝ in Set.Ioi (0:ℝ),
(1 - redistribution_trade_multiplier θ u)^m * Real.cos ((s-1)*u) / u^2)redistribution_trade_multiplier_boundsIn LeanMechanism Design & Auctions
The squared empirical characteristic multiplier lies in [0,1]. Reports may be arbitrary real numbers; only nonemptiness of the finite profile is needed.
theorem redistribution_trade_multiplier_bounds {n : ℕ} (hn : 0 < n)
(θ : Fin n → ℝ) (u : ℝ) :
0 ≤ redistribution_trade_multiplier θ u ∧ redistribution_trade_multiplier θ u ≤ 1redistribution_trade_multiplier_pos_aeIn LeanMechanism Design & Auctions
For a nonempty finite report profile, the empirical multiplier is positive almost everywhere for Lebesgue measure, although it can vanish at isolated points. No report bounds are needed.
theorem redistribution_trade_multiplier_pos_ae {n : ℕ} (hn : 0 < n)
(θ : Fin n → ℝ) :
∀ᵐ u : ℝ, 0 < redistribution_trade_multiplier θ uredistribution_trade_residual_cosineIn LeanMechanism Design & Auctions
Iterating the residual operator on a cosine multiplies it by the m-th power of one minus the trade multiplier.
theorem redistribution_trade_residual_cosine {n : ℕ} (θ : Fin n → ℝ)
(m : ℕ) (u c t : ℝ) :
((fun (f : ℝ → ℝ) (x : ℝ) => f x - redistribution_trade θ f x)^[m]
(fun x => Real.cos ((x-c)*u))) t =
(1-redistribution_trade_multiplier θ u)^m * Real.cos ((t-c)*u)two_facility_closest_pair_cost_leIn LeanMechanism Design & Auctions
For an agent at y and candidate set C, if t is a closest candidate to y in C and s is a closest candidate to y in C.erase t, then the pair {t,s} minimises the sum of both distances: dist y t + dist y s ≤ dist y (o 0) + dist y (o 1) for every feasible candidate pair o.
theorem two_facility_closest_pair_cost_le
{X : Type*} [MetricSpace X] [DecidableEq X] (C : Finset X) (y : X)
(t s : X) (ht : IsClosestCandidate C y t) (hs : IsClosestCandidate (C.erase t) y s)
(o : Fin 2 → X) (ho : IsTwoFacilityFeasible C o) :
dist y t + dist y s ≤ dist y (o 0) + dist y (o 1)two_facility_dictator_mechanism_ratio_threeIn LeanMechanism Design & Auctions
If some agent approves both facilities, or all agents approve only the single facility k (and someone approves it), then there is a deterministic mechanism that is strategyproof for p, always outputs two distinct candidates, and has max-cost ratio at most 3.
theorem two_facility_dictator_mechanism_ratio_three
{X : Type*} [MetricSpace X] [DecidableEq X] (C : Finset X) (hC : 2 ≤ C.card)
{ι : Type*} [DecidableEq ι] [Fintype ι] [Nonempty ι]
(p : ι → Fin 2 → Bool) (hp : ∀ i, p i 0 = true ∨ p i 1 = true)
(hcase : (∃ i, p i 0 = true ∧ p i 1 = true) ∨
(∃ k : Fin 2, (∀ a, p a (1 - k) = false) ∧ (∃ i, p i k = true))) :
∃ mech : (ι → X) → Fin 2 → X,
IsTwoFacilityStrategyproof p mech ∧
(∀ x : ι → X, IsTwoFacilityFeasible C (mech x)) ∧
(∀ (x : ι → X) (o : Fin 2 → X), IsTwoFacilityFeasible C o →
two_facility_max_cost x p (mech x) ≤ 3 * two_facility_max_cost x p o)two_facility_guarded_theta_arithmeticIn LeanMechanism Design & Auctions
Lemma 4.18 of arXiv:2610.18006 in variable form. Let A = d(i_j,t(i_j)), B = d(i_j,s(i_j)), M = MC(o) ≥ A and D a distance from the first facility to a candidate c that is discarded for a parameter θ ∈ [1,4/3], meaning 2B ≤ θ(A+B) and D ≤ (1+θ)(A+B). Then B ≤ θM/(2-θ), A+B ≤ 2M/(2-θ) and D ≤ 2(1+θ)M/(2-θ).
theorem two_facility_guarded_theta_arithmetic
(A B D θ M : ℝ) (_ : 0 ≤ A) (_ : 0 ≤ B) (_ : 0 ≤ M)
(_ : 1 ≤ θ) (_ : θ ≤ 4 / 3) (_ : A ≤ M)
(_ : 2 * B ≤ θ * (A + B))
(_ : D ≤ (1 + θ) * (A + B)) :
B ≤ θ * M / (2 - θ) ∧ A + B ≤ 2 * M / (2 - θ) ∧
D ≤ 2 * (1 + θ) * M / (2 - θ)two_facility_max_cost_le_of_first_facilityIn LeanMechanism Design & Auctions
Equation (9) of arXiv:2610.18006 in the two-facility setting, general k. In a singleton profile, suppose facility k is placed at a closest candidate w_k of an agent i approving k, and facility 1-k is placed at a closest candidate w_{1-k} of an agent j approving 1-k subject to the single restriction that some candidate c ≠ w_k is still available (dist (x j) (w (1-k)) ≤ dist (x j) c). Then the max cost of w is at most max(3·MC(o), 2·MC(o) + dist (x j) c).
theorem two_facility_max_cost_le_of_first_facility
{X : Type*} [MetricSpace X] (C : Finset X)
{ι : Type*} [Fintype ι] [Nonempty ι]
(x : ι → X) (p : ι → Fin 2 → Bool)
(hp : ∀ a, p a 0 = true ∨ p a 1 = true)
(hnd : ∀ a, ¬(p a 0 = true ∧ p a 1 = true))
(k : Fin 2) (i : ι) (hi : p i k = true)
(w : Fin 2 → X) (hw : IsClosestCandidate C (x i) (w k))
(j : ι) (hj : p j (1 - k) = true)
(c : X) (hc : c ∈ C) (hcne : c ≠ w k)
(hw1 : dist (x j) (w (1 - k)) ≤ dist (x j) c)
(o : Fin 2 → X) (ho : IsTwoFacilityFeasible C o) :
two_facility_max_cost x p w ≤
max (3 * two_facility_max_cost x p o) (2 * two_facility_max_cost x p o + dist (x j) c)two_facility_ratio_assemblyIn LeanMechanism Design & Auctions
If every approval profile falls into one of two cases — one handled by a ratio-3 deterministic mechanism, and the singleton case handled with some α_sing < 19/5 — then the original existential statement with α < 19/5 holds.
theorem two_facility_ratio_assembly
(hsing : ∃ α : ℝ, α < 19 / 5 ∧
∀ {X : Type*} [MetricSpace X] (C : Finset X) (_ : 2 ≤ C.card)
{ι : Type*} [DecidableEq ι] [Fintype ι] [Nonempty ι] (_ : 2 ≤ Fintype.card ι)
(p : ι → Fin 2 → Bool)
(_ : ∀ i, (p i 0 = true ∨ p i 1 = true) ∧ ¬(p i 0 = true ∧ p i 1 = true))
(_ : ∃ i, p i 0 = true) (_ : ∃ i, p i 1 = true),
∃ (K : Type) (_ : Fintype K) (_ : Nonempty K)
(M : TwoFacilityUniversalMechanism C p K),
TwoFacilityUniversalMechanismHasApproxRatio M α) :
∃ α : ℝ, α < 19 / 5 ∧
∀ {X : Type*} [MetricSpace X] (C : Finset X) (_ : 2 ≤ C.card)
{ι : Type*} [DecidableEq ι] [Fintype ι] [Nonempty ι] (_ : 2 ≤ Fintype.card ι)
(p : ι → Fin 2 → Bool) (_ : ∀ i, p i 0 = true ∨ p i 1 = true),
∃ (K : Type) (_ : Fintype K) (_ : Nonempty K)
(M : TwoFacilityUniversalMechanism C p K), TwoFacilityUniversalMechanismHasApproxRatio M αtwo_facility_serial_dictator_strategyproofIn LeanMechanism Design & Auctions
In a singleton profile (no agent approves both facilities), fix two anchors, one approving facility k and one approving facility 1-k. The serial mechanism that places facility k at a closest candidate to the first anchor and facility 1-k at a closest candidate, avoiding the first placed location, to the second anchor is strategyproof: the anchor whose facility is placed first gets a location minimising her own distance and does not care where the other facility goes, while the second anchor's available set does not depend on her report and she gets the best available location.
theorem two_facility_serial_dictator_strategyproof
{X : Type*} [MetricSpace X] [DecidableEq X] (C : Finset X)
{ι : Type*} [DecidableEq ι] (p : ι → Fin 2 → Bool)
(hnd : ∀ a, ¬(p a 0 = true ∧ p a 1 = true))
(anchor : Fin 2 → ι) (k : Fin 2)
(hk : p (anchor k) k = true) (hk' : p (anchor (1 - k)) (1 - k) = true)
(f : X → X) (hf : ∀ y, IsClosestCandidate C y (f y))
(g : X → X → X) (hg : ∀ y z, IsClosestCandidate (C.erase (f y)) z (g y z)) :
IsTwoFacilityStrategyproof p
(fun x (j : Fin 2) =>
if j = k then f (x (anchor k)) else g (x (anchor k)) (x (anchor (1 - k))))two_facility_singleton_universal_ratio_below_19_5In LeanMechanism Design & Auctions
There is a single α < 19/5 such that in every singleton-approval instance (no agent approves both facilities, both groups nonempty, at least two agents, at least two candidates) on any metric space there is a finite nonempty K and a universally strategyproof mechanism with max-cost ratio α.
theorem two_facility_singleton_universal_ratio_below_19_5 :
∃ α : ℝ, α < 19 / 5 ∧
∀ {X : Type*} [MetricSpace X] (C : Finset X) (_ : 2 ≤ C.card)
{ι : Type*} [DecidableEq ι] [Fintype ι] [Nonempty ι] (_ : 2 ≤ Fintype.card ι)
(p : ι → Fin 2 → Bool)
(_ : ∀ i, (p i 0 = true ∨ p i 1 = true) ∧ ¬(p i 0 = true ∧ p i 1 = true))
(_ : ∃ i, p i 0 = true) (_ : ∃ i, p i 1 = true),
∃ (K : Type*) (_ : Fintype K) (_ : Nonempty K)
(M : TwoFacilityUniversalMechanism C p K),
TwoFacilityUniversalMechanismHasApproxRatio M αtwo_facility_universal_of_deterministicIn LeanMechanism Design & Auctions
Packaging lemma: if a single deterministic mechanism mech is feasible in C, strategyproof for p, and α-approximates the max cost, then there is a finite nonempty index type K (namely PUnit) and a universally strategyproof mechanism M : TwoFacilityUniversalMechanism C p K with TwoFacilityUniversalMechanismHasApproxRatio M α.
theorem two_facility_universal_of_deterministic
{ι : Type*} [DecidableEq ι] [Fintype ι] [Nonempty ι]
{X : Type*} [MetricSpace X] {C : Finset X} {p : ι → Fin 2 → Bool}
(mech : (ι → X) → Fin 2 → X)
(hfeas : ∀ x, IsTwoFacilityFeasible C (mech x))
(hsp : IsTwoFacilityStrategyproof p mech) (α : ℝ)
(hratio : ∀ (x : ι → X) (o : Fin 2 → X), IsTwoFacilityFeasible C o →
two_facility_max_cost x p (mech x) ≤ α * two_facility_max_cost x p o) :
∃ (K : Type) (_ : Fintype K) (_ : Nonempty K)
(M : TwoFacilityUniversalMechanism C p K),
TwoFacilityUniversalMechanismHasApproxRatio M αcondorcet_dimension_le_three_balancedIn LeanSocial Choice Theory
Open sub-problem: every election with at least one voter and at least one candidate in which every set of three candidates is the top choice of at most half of the voters has a Condorcet winning set of size at most three.
theorem condorcet_dimension_le_three_balanced (n m : ℕ) (P : Fin n → Equiv.Perm (Fin m))
(hn : 0 < n) (hm : 0 < m)
(hbal : ∀ S : Finset (Fin m), S.card = 3 →
2 * (Finset.univ.filter fun v => (P v).symm ⟨0, hm⟩ ∈ S).card ≤ n) :
∃ S : Finset (Fin m), S.card ≤ 3 ∧ is_condorcet_winning_set P Scondorcet_dimension_le_three_balanced_of_six_leIn LeanSocial Choice Theory
Every election with at least 6 candidates and at least one voter in which every 3-set of candidates has at most n/2 top choices has a Condorcet winning set of size at most 3.
theorem condorcet_dimension_le_three_balanced_of_six_le (n m : ℕ) (P : Fin n → Equiv.Perm (Fin m))
(hn : 0 < n) (hm : 6 ≤ m)
(hbal : ∀ S : Finset (Fin m), S.card = 3 →
2 * (Finset.univ.filter fun v => (P v).symm ⟨0, by omega⟩ ∈ S).card ≤ n) :
∃ S : Finset (Fin m), S.card ≤ 3 ∧ is_condorcet_winning_set P Sejr_chain_residual_profileIn LeanSocial Choice Theory
Residual case of the EJR-chain problem: if every candidate is approved by at least an n/m fraction of the voters and every ballot is nonempty with at most m-2 candidates, then an EJR chain exists. This is the open crux left after the two profile reductions.
theorem ejr_chain_residual_profile (n m : ℕ) (A : Fin n → Finset (Fin m)) (hn : 0 < n)
(hdense : ∀ c : Fin m, n ≤ m * (Finset.univ.filter fun i => c ∈ A i).card)
(hnonempty : ∀ i, A i ≠ ∅)
(hsmall : ∀ i, (A i).card ≤ m - 2) :
∃ σ : Equiv.Perm (Fin m), ∀ k, k ≤ m →
is_ejr_committee A k (Finset.univ.filter fun c => (σ c : ℕ) < k)ejr_chain_two_voters_ordering_existsIn LeanSocial Choice Theory
For two approval ballots on m candidates, there is a permutation σ of Fin m such that every prefix W_k = {c | σ c < k} has size k, contains (or is contained in) A 0 ∩ A 1 according to whether k ≥ |A 0 ∩ A 1|, and satisfies k ≤ 2 * |A i ∩ W_k| + 1 whenever voter i is not fully satisfied.
theorem ejr_chain_two_voters_ordering_exists {m : ℕ} (A : Fin 2 → Finset (Fin m)) :
∃ σ : Equiv.Perm (Fin m), ∀ k, k ≤ m →
let W := Finset.univ.filter fun c => (σ c : ℕ) < k
W.card = k ∧
(k ≤ (A 0 ∩ A 1).card → W ⊆ A 0 ∩ A 1) ∧
((A 0 ∩ A 1).card ≤ k → A 0 ∩ A 1 ⊆ W) ∧
((A 0 ∩ W).card < (A 0).card → k ≤ 2 * (A 0 ∩ W).card + 1) ∧
((A 1 ∩ W).card < (A 1).card → k ≤ 2 * (A 1 ∩ W).card + 1)exists_cascade_tie_breaking_prefIn LeanSocial Choice Theory
For the cascade agent configuration at 0, 1, ..., n-2, n - 3/2, there exists a preference profile sorting items by distance with ties broken toward smaller index items.
theorem exists_cascade_tie_breaking_pref (n : ℕ) :
∃ pref : Fin n → Equiv.Perm (Fin n),
∀ (i k k' : Fin n), k < k' →
|((if i.val < n - 1 then (i : ℝ) else (n : ℝ) - 3 / 2) - ((pref i k : Fin n) : ℝ))| <
|((if i.val < n - 1 then (i : ℝ) else (n : ℝ) - 3 / 2) - ((pref i k' : Fin n) : ℝ))| ∨
(|((if i.val < n - 1 then (i : ℝ) else (n : ℝ) - 3 / 2) - ((pref i k : Fin n) : ℝ))| =
|((if i.val < n - 1 then (i : ℝ) else (n : ℝ) - 3 / 2) - ((pref i k' : Fin n) : ℝ))| ∧
pref i k < pref i k')line_min_matching_cost_cascadeIn LeanSocial Choice Theory
The minimum matching cost for the cascade agent configuration at 0, 1, ..., n-2, n - 3/2 and equispaced items at 0, 1, ..., n-1 is exactly 1/2.
theorem line_min_matching_cost_cascade (n : ℕ) (hn : 2 ≤ n) :
line_min_matching_cost
(fun (i : Fin n) => if i.val < n - 1 then (i : ℝ) else (n : ℝ) - 3 / 2)
(fun (j : Fin n) => (j : ℝ)) = 1 / 2plackett_luce_entropy_asymptotic_const_oneIn LeanSocial Choice Theory
The first conjunct of the target in the special case of the constant weight profile w = 1 (equivalently w(i/n) = 1).
theorem plackett_luce_entropy_asymptotic_const_one :
Filter.Tendsto (fun n : ℕ =>
(plackett_luce_entropy (fun _ : ℕ => (1 : ℝ)) (Finset.range n) - (n : ℝ) * Real.log (n : ℝ)) / (n : ℝ))
Filter.atTop (nhds (plackett_luce_limiting_entropy_offset (fun _ : ℝ => (1 : ℝ))))plackett_luce_entropy_const_oneIn LeanSocial Choice Theory
For the constant weight profile, all n! rankings are equally likely, so the Plackett-Luce entropy on n items is log(n!).
theorem plackett_luce_entropy_const_one (n : ℕ) :
plackett_luce_entropy (fun _ : ℕ => (1 : ℝ)) (Finset.range n) = Real.log ((Nat.factorial n : ℕ) : ℝ)plackett_luce_entropy_eq_expectation_partial_weightsIn LeanSocial Choice Theory
The Plackett-Luce entropy on {0,...,n-1} is the expectation, under the Plackett-Luce law, of the sum of the logarithms of the partial remaining weight sums, minus the sum of the logarithms of the weights.
lemma plackett_luce_entropy_eq_expectation_partial_weights (w : ℕ → ℝ) (n : ℕ)
(hw : ∀ i ∈ Finset.range n, 0 < w i) :
plackett_luce_entropy w (Finset.range n) =
(∑ l ∈ rankings_of (Finset.range n), plackett_luce_prob w l *
(∑ k ∈ Finset.range n, Real.log (∑ j ∈ (l.drop k).toFinset, w j))) -
∑ i ∈ Finset.range n, Real.log (w i)plackett_luce_laplace_profile_riemann_uniformIn LeanSocial Choice Theory
The finite-n Laplace sums (1/n) Σ_{i<n} w(i/n) exp(-t w(i/n)) converge to the Laplace profile L(t) = ∫_0^1 w(x) exp(-t w(x)) dx, uniformly in t ≥ 0 and with an error O(1/n) in the un-normalised sums.
theorem plackett_luce_laplace_profile_riemann_uniform (w : ℝ → ℝ)
(hw_diff : ContDiffOn ℝ 1 w (Set.Icc (0 : ℝ) 1))
(hw_pos : ∀ x ∈ Set.Icc (0 : ℝ) 1, 0 < w x) :
∃ C : ℝ, 0 ≤ C ∧ ∀ (n : ℕ), 0 < n → ∀ t : ℝ, 0 ≤ t →
|(∑ i ∈ Finset.range n, w ((i : ℝ) / (n : ℝ)) * Real.exp (-t * w ((i : ℝ) / (n : ℝ))))
- (n : ℝ) * plackett_luce_laplace_profile w t| ≤ Cplackett_luce_limiting_entropy_offset_const_oneIn LeanSocial Choice Theory
For the constant weight profile w = 1, the limiting entropy offset is -1.
theorem plackett_luce_limiting_entropy_offset_const_one :
plackett_luce_limiting_entropy_offset (fun _ : ℝ => (1 : ℝ)) = -1plackett_luce_log_factorial_asymptoticIn LeanSocial Choice Theory
Stirling's formula in the normalised form used by the entropy limit: (log(n!) - n log n)/n tends to -1 along atTop.
theorem plackett_luce_log_factorial_asymptotic :
Filter.Tendsto (fun n : ℕ => (Real.log ((Nat.factorial n : ℕ) : ℝ) - (n : ℝ) * Real.log (n : ℝ)) / (n : ℝ))
Filter.atTop (nhds (-1))plackett_luce_log_weight_riemann_sumIn LeanSocial Choice Theory
The left Riemann sums of log w over the uniform grid i/n converge: (1/n) Σ_{i<n} log w(i/n) tends to the integral of log w over [0,1].
theorem plackett_luce_log_weight_riemann_sum (w : ℝ → ℝ)
(hw_cont : ContinuousOn w (Set.Icc (0 : ℝ) 1))
(hw_pos : ∀ x ∈ Set.Icc (0 : ℝ) 1, 0 < w x) :
Filter.Tendsto (fun n : ℕ => (∑ i ∈ Finset.range n, Real.log (w ((i : ℝ) / (n : ℝ)))) / (n : ℝ))
Filter.atTop (nhds (∫ x in Set.Icc (0 : ℝ) 1, Real.log (w x)))plackett_luce_prob_posIn LeanSocial Choice Theory
With positive weights, every ranking of S has strictly positive Plackett-Luce probability.
lemma plackett_luce_prob_pos (w : ℕ → ℝ) (S : Finset ℕ) (l : List ℕ)
(hl : l ∈ rankings_of S) (hw : ∀ b ∈ S, 0 < w b) : 0 < plackett_luce_prob w lplackett_luce_profile_entropy_asymptoticIn LeanSocial Choice Theory
First half of the target, isolated: (H_n - n log n)/n tends to the limiting entropy offset mu(w).
theorem plackett_luce_profile_entropy_asymptotic (w : ℝ → ℝ)
(hw_diff : ContDiffOn ℝ 1 w (Set.Icc (0 : ℝ) 1))
(hw_pos : ∀ x ∈ Set.Icc (0 : ℝ) 1, 0 < w x) :
Filter.Tendsto (fun n : ℕ =>
(plackett_luce_entropy (fun i => w ((i : ℝ) / (n : ℝ))) (Finset.range n) - (n : ℝ) * Real.log (n : ℝ)) / (n : ℝ))
Filter.atTop (nhds (plackett_luce_limiting_entropy_offset w))plackett_luce_profile_surprisal_weak_convergenceIn LeanSocial Choice Theory
Second half of the target, isolated: the standardized surprisal measure converges weakly to the centred Gaussian with variance V(w).
theorem plackett_luce_profile_surprisal_weak_convergence (w : ℝ → ℝ)
(hw_diff : ContDiffOn ℝ 1 w (Set.Icc (0 : ℝ) 1))
(hw_pos : ∀ x ∈ Set.Icc (0 : ℝ) 1, 0 < w x) :
∀ f : BoundedContinuousFunction ℝ ℝ,
Filter.Tendsto (fun n : ℕ =>
∫ x, f x ∂(plackett_luce_surprisal_measure (fun i => w ((i : ℝ) / (n : ℝ))) n))
Filter.atTop (nhds (∫ x, f x ∂(ProbabilityTheory.gaussianReal 0 (Real.toNNReal (plackett_luce_surprisal_variance_profile w)))))plackett_luce_surprisal_eq_sum_log_partial_weightsIn LeanSocial Choice Theory
Pathwise surprisal identity: the surprisal -log P(l) of a ranking l of {0,...,n-1} equals the sum over the positions k of the logarithm of the total remaining weight of the items ranked at position k or later, minus the sum of the logarithms of all the weights.
lemma plackett_luce_surprisal_eq_sum_log_partial_weights (w : ℕ → ℝ) (n : ℕ) (l : List ℕ)
(hl : l ∈ rankings_of (Finset.range n)) (hw : ∀ i ∈ Finset.range n, 0 < w i) :
-Real.log (plackett_luce_prob w l) =
(∑ k ∈ Finset.range n, Real.log (∑ j ∈ (l.drop k).toFinset, w j)) -
∑ i ∈ Finset.range n, Real.log (w i)plackett_luce_surprisal_measure_const_oneIn LeanSocial Choice Theory
For the constant weight profile w = 1 all rankings have equal probability, so the standardized surprisal is identically 0 and the standardized surprisal measure is the Dirac mass at 0.
theorem plackett_luce_surprisal_measure_const_one (n : ℕ) :
plackett_luce_surprisal_measure (fun _ : ℕ => (1 : ℝ)) n = MeasureTheory.Measure.dirac 0plackett_luce_surprisal_measure_integralIn LeanSocial Choice Theory
Integrating against the standardized surprisal measure is the finite sum over rankings of the probability times f evaluated at the standardized surprisal.
theorem plackett_luce_surprisal_measure_integral (w : ℕ → ℝ) (n : ℕ) (f : ℝ → ℝ) :
∫ x, f x ∂(plackett_luce_surprisal_measure w n) =
∑ l ∈ rankings_of (Finset.range n), plackett_luce_prob w l *
f ((-Real.log (plackett_luce_prob w l) - plackett_luce_entropy w (Finset.range n)) / Real.sqrt (n : ℝ))plurality_veto_core_containmentIn LeanSocial Choice Theory
For all m ≥ 3 and n ≥ max(8, m), for any election profile on n voters and m candidates and any 0 < ε < plurality_regularization_threshold n m, the regularized plurality veto core at strength ε is contained in the base unregularized core at strength 0.
theorem plurality_veto_core_containment (m n : ℕ) (hm : 3 ≤ m) (hn : max 8 m ≤ n)
(prof : Fin n → LinearOrder (Fin m)) (ε : ℝ)
(hε_pos : 0 < ε) (hε_lt : ε < plurality_regularization_threshold n m) (a : Fin m) :
in_regularized_plurality_veto_core prof ε a → in_regularized_plurality_veto_core prof 0 aplurality_veto_core_containment_of_small_epsilonIn LeanSocial Choice Theory
For m ≥ 3 and n ≥ 1, if ε ≥ 0 and ε·(m−1)·n < 1, then every candidate in the regularized plurality veto core at strength ε is also in the unregularized core. In particular the core at strength ε is contained in the base core, which is what the exact-threshold target asserts for the strictly smaller range ε < 1/((m−1)n) (note 1/((m−1)n) < 1/((m−2)n − 2m)).
theorem plurality_veto_core_containment_of_small_epsilon {m n : ℕ} (hm : 3 ≤ m) (hn : 1 ≤ n)
(prof : Fin n → LinearOrder (Fin m)) {ε : ℝ} (hε0 : 0 ≤ ε)
(hε : ε * ((m : ℝ) - 1) * n < 1) (a : Fin m)
(ha : in_regularized_plurality_veto_core prof ε a) :
in_regularized_plurality_veto_core prof 0 aplurality_veto_core_membership_iff_countIn LeanSocial Choice Theory
For ε ≥ 0 and at least one voter, a candidate a lies in the regularized plurality veto core at strength ε if and only if for every set N of candidates, k(N) minus the total plurality score of N is at most (n·|N| − m·k(N))·ε, where k(N) is the number of voters whose veto down-set below a lies inside N.
theorem plurality_veto_core_membership_iff_count {V C : Type*} [Fintype V] [Fintype C] [DecidableEq C]
(prof : V → LinearOrder C) (a : C) {ε : ℝ} (hε : 0 ≤ ε) (hV : 0 < Fintype.card V) :
in_regularized_plurality_veto_core prof ε a ↔
∀ N : Finset C, (plurality_veto_inside_count prof a N : ℝ) - (∑ c ∈ N, (plurality_votes prof c : ℝ))
≤ ((Fintype.card V : ℝ) * N.card - (Fintype.card C : ℝ) * (plurality_veto_inside_count prof a N : ℝ)) * εplurality_veto_core_sharpnessIn LeanSocial Choice Theory
For all m ≥ 3 and n ≥ max(8, m), there exists a profile on n voters and m candidates with a candidate in the regularized plurality veto core at the regularization threshold 1/((m-2)n - 2m) who is not in the unregularized core at strength 0.
theorem plurality_veto_core_sharpness (m n : ℕ) (hm : 3 ≤ m) (hn : max 8 m ≤ n) :
∃ (prof : Fin n → LinearOrder (Fin m)) (a : Fin m),
in_regularized_plurality_veto_core prof (plurality_regularization_threshold n m) a ∧
¬ in_regularized_plurality_veto_core prof 0 aplurality_veto_core_threshold_of_extremalIn LeanSocial Choice Theory
Fix m ≥ 3 and n ≥ max(8,m). If (i) every profile with some violating candidate set also has one satisfying the tight inequality n·|N| − m·k(N) ≤ ((m−2)n − 2m)(k(N) − ℓ(N)), and (ii) there is a profile and candidate with a violating set and the reverse inequality for all sets, then the exact regularization threshold conclusion holds for this (m,n): containment for all 0 < ε < plurality_regularization_threshold n m and sharpness at the threshold.
theorem plurality_veto_core_threshold_of_extremal (m n : ℕ) (hm : 3 ≤ m) (hn : max 8 m ≤ n)
(htight : ∀ (prof : Fin n → LinearOrder (Fin m)) (a : Fin m),
(∃ N : Finset (Fin m), (∑ c ∈ N, plurality_votes prof c) < plurality_veto_inside_count prof a N) →
∃ N : Finset (Fin m), (∑ c ∈ N, plurality_votes prof c) < plurality_veto_inside_count prof a N ∧
(n : ℝ) * N.card - (m : ℝ) * (plurality_veto_inside_count prof a N : ℝ)
≤ (((m : ℝ) - 2) * n - 2 * m) * ((plurality_veto_inside_count prof a N : ℝ) - (∑ c ∈ N, (plurality_votes prof c : ℝ))))
(hwit : ∃ (prof : Fin n → LinearOrder (Fin m)) (a : Fin m),
(∃ N : Finset (Fin m), (∑ c ∈ N, plurality_votes prof c) < plurality_veto_inside_count prof a N) ∧
∀ N : Finset (Fin m), (((m : ℝ) - 2) * n - 2 * m) * ((plurality_veto_inside_count prof a N : ℝ) - (∑ c ∈ N, (plurality_votes prof c : ℝ))) ≤ (n : ℝ) * N.card - (m : ℝ) * (plurality_veto_inside_count prof a N : ℝ)) :
(∀ (prof : Fin n → LinearOrder (Fin m)) (ε : ℝ), 0 < ε → ε < plurality_regularization_threshold n m →
∀ a : Fin m, in_regularized_plurality_veto_core prof ε a → in_regularized_plurality_veto_core prof 0 a) ∧
(∃ (prof : Fin n → LinearOrder (Fin m)) (a : Fin m),
in_regularized_plurality_veto_core prof (plurality_regularization_threshold n m) a ∧
¬ in_regularized_plurality_veto_core prof 0 a)plurality_veto_core_threshold_witnessIn LeanSocial Choice Theory
For m ≥ 3 and n ≥ max(8,m) there is a profile on n voters and m candidates and a candidate a having a set N with more veto-down-set voters than plurality score, while for every set N one has ((m−2)n − 2m)(k(N) − ∑_{c∈N} votes) ≤ n·|N| − m·k(N). This is the sharpness half: at ε = 1/((m−2)n − 2m) it puts a in the regularized core but not in the base core.
theorem plurality_veto_core_threshold_witness {m n : ℕ} (hm : 3 ≤ m) (hn : max 8 m ≤ n) :
∃ (prof : Fin n → LinearOrder (Fin m)) (a : Fin m),
(∃ N : Finset (Fin m), (∑ c ∈ N, plurality_votes prof c) < plurality_veto_inside_count prof a N) ∧
∀ N : Finset (Fin m), (((m : ℝ) - 2) * n - 2 * m) * ((plurality_veto_inside_count prof a N : ℝ) - (∑ c ∈ N, (plurality_votes prof c : ℝ))) ≤ (n : ℝ) * N.card - (m : ℝ) * (plurality_veto_inside_count prof a N : ℝ)plurality_veto_core_tight_of_small_setIn LeanSocial Choice Theory
For m ≥ 3 and n ≥ max(8,m), if a candidate set N has more veto-down-set voters than plurality score (∑_{c∈N} votes < k(N)), has at most m−2 elements, and k(N) ≥ 2, then n·|N| − m·k(N) ≤ ((m−2)n − 2m)(k(N) − ∑_{c∈N} votes).
theorem plurality_veto_core_tight_of_small_set {m n : ℕ} (hm : 3 ≤ m) (hn : max 8 m ≤ n)
(prof : Fin n → LinearOrder (Fin m)) (a : Fin m) (N : Finset (Fin m))
(hviol : (∑ c ∈ N, plurality_votes prof c) < plurality_veto_inside_count prof a N)
(hcard : N.card ≤ m - 2)
(hk : 2 ≤ plurality_veto_inside_count prof a N) :
(n : ℝ) * N.card - (m : ℝ) * (plurality_veto_inside_count prof a N : ℝ)
≤ (((m : ℝ) - 2) * n - 2 * m) * ((plurality_veto_inside_count prof a N : ℝ) - (∑ c ∈ N, (plurality_votes prof c : ℝ)))plurality_veto_core_tight_set_existsIn LeanSocial Choice Theory
For m ≥ 3 and n ≥ max(8,m): if for some profile and candidate a there is a candidate set N with more veto-down-set voters than plurality score, then there is such an N which additionally satisfies n·|N| − m·k(N) ≤ ((m−2)n − 2m)(k(N) − ∑_{c∈N} votes). This is the sharp extremal inequality behind the threshold 1/((m−2)n − 2m); it is the containment half of the target.
theorem plurality_veto_core_tight_set_exists {m n : ℕ} (hm : 3 ≤ m) (hn : max 8 m ≤ n)
(prof : Fin n → LinearOrder (Fin m)) (a : Fin m)
(h : ∃ N : Finset (Fin m), (∑ c ∈ N, plurality_votes prof c) < plurality_veto_inside_count prof a N) :
∃ N : Finset (Fin m), (∑ c ∈ N, plurality_votes prof c) < plurality_veto_inside_count prof a N ∧
(n : ℝ) * N.card - (m : ℝ) * (plurality_veto_inside_count prof a N : ℝ)
≤ (((m : ℝ) - 2) * n - 2 * m) * ((plurality_veto_inside_count prof a N : ℝ) - (∑ c ∈ N, (plurality_votes prof c : ℝ)))plurality_veto_core_violating_set_saturateIn LeanSocial Choice Theory
If a candidate set N has strictly more veto-down-set voters than plurality score, then some N' ⊆ N is a union of voter veto down-sets below a, still has strictly more such voters than score, has exactly the same inside count k(N') = k(N), and satisfies n·|N'| − m·k(N') ≤ n·|N| − m·k(N).
theorem plurality_veto_core_violating_set_saturate {m n : ℕ}
(prof : Fin n → LinearOrder (Fin m)) (a : Fin m) (N : Finset (Fin m))
(hviol : (∑ c ∈ N, plurality_votes prof c) < plurality_veto_inside_count prof a N) :
∃ N' : Finset (Fin m), N' ⊆ N ∧
(∑ c ∈ N', plurality_votes prof c) < plurality_veto_inside_count prof a N' ∧
plurality_veto_inside_count prof a N' = plurality_veto_inside_count prof a N ∧
(n : ℝ) * N'.card - (m : ℝ) * (plurality_veto_inside_count prof a N' : ℝ)
≤ (n : ℝ) * N.card - (m : ℝ) * (plurality_veto_inside_count prof a N : ℝ)plurality_veto_threshold_witness_three_eightIn LeanSocial Choice Theory
There is a profile on 8 voters and 3 candidates and a candidate a in the regularized plurality veto core at strength plurality_regularization_threshold 8 3 = 1/2 which is not in the unregularized plurality veto core. This is the sharpness half of the exact-threshold theorem at m = 3, n = 8.
theorem plurality_veto_threshold_witness_three_eight :
∃ (prof : Fin 8 → LinearOrder (Fin 3)) (a : Fin 3),
in_regularized_plurality_veto_core prof (plurality_regularization_threshold 8 3) a ∧
¬ in_regularized_plurality_veto_core prof 0 aprobabilistic_serial_cascade_costIn LeanSocial Choice Theory
Under the left-biased tie-breaking preference profile, the probabilistic serial line cost of the cascade agent configuration is exactly (1 + H_floor(n/2) + H_floor((n-1)/2)) * (1/2).
theorem probabilistic_serial_cascade_cost (n : ℕ) (hn : 2 ≤ n)
(pref : Fin n → Equiv.Perm (Fin n))
(hpref : ∀ (i k k' : Fin n), k < k' →
|((if i.val < n - 1 then (i : ℝ) else (n : ℝ) - 3 / 2) - ((pref i k : Fin n) : ℝ))| <
|((if i.val < n - 1 then (i : ℝ) else (n : ℝ) - 3 / 2) - ((pref i k' : Fin n) : ℝ))| ∨
(|((if i.val < n - 1 then (i : ℝ) else (n : ℝ) - 3 / 2) - ((pref i k : Fin n) : ℝ))| =
|((if i.val < n - 1 then (i : ℝ) else (n : ℝ) - 3 / 2) - ((pref i k' : Fin n) : ℝ))| ∧
pref i k < pref i k')) :
probabilistic_serial_line_cost
(fun (i : Fin n) => if i.val < n - 1 then (i : ℝ) else (n : ℝ) - 3 / 2)
(fun (j : Fin n) => (j : ℝ)) pref =
(1 + (harmonic (n / 2) : ℝ) + (harmonic ((n - 1) / 2) : ℝ)) * (1 / 2)probabilistic_serial_equispaced_items_wait_sum_leIn LeanSocial Choice Theory
For n >= 2 equispaced items at 0, 1, ..., n-1 on the real line and any distance preference profile, the sum of item wait costs in probabilistic serial is at most (H_floor(n/2) + H_floor((n-1)/2)) times the minimum matching cost OPT.
theorem probabilistic_serial_equispaced_items_wait_sum_le (n : ℕ) (hn : 2 ≤ n)
(a : Fin n → ℝ) (pref : Fin n → Equiv.Perm (Fin n))
(h : is_line_distance_preference_profile a (fun (j : Fin n) => (j : ℝ)) pref) :
∑ j, probabilistic_serial_line_item_wait (fun (j : Fin n) => (j : ℝ)) pref j ≤
((harmonic (n / 2) : ℝ) + (harmonic ((n - 1) / 2) : ℝ)) *
line_min_matching_cost a (fun (j : Fin n) => (j : ℝ))probabilistic_serial_line_item_wait_sum_le_line_min_matching_costNeeds helpSocial Choice Theory
For n >= 2 agents at real positions a and n items at real positions b ranked by distance, the total waiting cost of all n items under probabilistic serial is at most (n-1) times OPT, the minimum perfect-matching cost.
theorem probabilistic_serial_line_item_wait_sum_le_line_min_matching_cost (n : ℕ) (hn : 2 ≤ n) (a b : Fin n → ℝ) (pref : Fin n → Equiv.Perm (Fin n)) (h : is_line_distance_preference_profile a b pref) : ∑ j, probabilistic_serial_line_item_wait b pref j ≤ (n - 1 : ℝ) * line_min_matching_cost a b
rank_score_veto_core_side_count_boundNeeds helpSocial Choice Theory
For a candidate a in the rank-score veto core and any candidate c*, put G = #{v : c* <_v a} (voters preferring c*) and D = #{v : a <_v c*} (voters preferring a). If the last-place score is positive then G <= (||s||_1 - s_last) * D. Equivalently: the weight-awarding side cannot outweigh the opposing side by more than the factor Delta.
theorem rank_score_veto_core_side_count_bound :
∀ (C : Type*) [Fintype C] [DecidableEq C] (hm : 3 ≤ Fintype.card C)
(s : Fin (Fintype.card C) → ℚ) (hs : is_positional_scoring_vector (Fintype.card C) s)
(hs_last : 0 < scoring_last (Fintype.card C) (by omega) s)
(V : Type*) [Fintype V] [Nonempty V]
(prof : V → LinearOrder C)
(a : C) (ha : is_rank_score_veto_core s prof a)
(c_star : C),
((Finset.univ.filter (fun v : V => (prof v).lt c_star a)).card : ℝ) ≤
(((scoring_norm_one s - scoring_last (Fintype.card C) (by omega) s) : ℚ) : ℝ) *
((Finset.univ.filter (fun v : V => (prof v).lt a c_star)).card : ℝ)sum_plurality_votes_eq_cardIn LeanSocial Choice Theory
The plurality counts of all candidates sum to the number of voters.
theorem sum_plurality_votes_eq_card {V C : Type*} [Fintype V] [Fintype C] [Nonempty C]
(prof : V → LinearOrder C) : ∑ c : C, plurality_votes prof c = Fintype.card Vsum_regularized_plurality_weight_mulIn LeanSocial Choice Theory
Multiplying the sum over N of the regularized plurality weights by 1 + |C|·ε gives the unregularized total plurality score of N divided by the number of voters, plus |N|·ε.
theorem sum_regularized_plurality_weight_mul {V C : Type*} [Fintype V] [Fintype C] [DecidableEq C]
(prof : V → LinearOrder C) (ε : ℝ) (N : Finset C) :
(1 + (Fintype.card C : ℝ) * ε) * (∑ c ∈ N, regularized_plurality_weight prof ε c)
= (∑ c ∈ N, (plurality_votes prof c : ℝ)) / (Fintype.card V) + (N.card : ℝ) * εswf_interleaved_profile_existsNeeds helpSocial Choice Theory
There exists an interleaved cut-count profile P mapping utility streams in [0, 1]^ℕ into lexicographic streams of extended naturals that simultaneously satisfies monotonicity, stationarity, finite anonymity, upper restricted dominance, and lower restricted dominance.
theorem swf_interleaved_profile_exists :
∃ P : Stream' (Set.Icc (0 : ℝ) 1) → Lex (ℕ → WithTop ℕ),
(∀ x y : Stream' (Set.Icc (0 : ℝ) 1), (∀ t, x t ≤ y t) → P x ≤ P y) ∧
(∀ x y : Stream' (Set.Icc (0 : ℝ) 1), x 0 = y 0 → (P x ≥ P y ↔ P x.tail ≥ P y.tail)) ∧
(∀ (x : Stream' (Set.Icc (0 : ℝ) 1)) (π : Equiv.Perm ℕ), {t | π t ≠ t}.Finite → P (x ∘ ⇑π) = P x) ∧
(∀ (a b : Set.Icc (0 : ℝ) 1), a < b → P (Stream'.cons a (Stream'.const b)) < P (Stream'.const b)) ∧
(∀ (a b : Set.Icc (0 : ℝ) 1), a < b → P (Stream'.const a) < P (Stream'.cons b (Stream'.const a)))swf_lower_profile_existsIn LeanSocial Choice Theory
There exists an upper cut-count profile P mapping utility streams in [0, 1]^ℕ into lexicographic streams of extended naturals that satisfies monotonicity, stationarity, finite anonymity, and lower restricted dominance.
theorem swf_lower_profile_exists :
∃ P : Stream' (Set.Icc (0 : ℝ) 1) → Lex (ℕ → WithTop ℕ),
(∀ x y : Stream' (Set.Icc (0 : ℝ) 1), (∀ t, x t ≤ y t) → P x ≤ P y) ∧
(∀ x y : Stream' (Set.Icc (0 : ℝ) 1), x 0 = y 0 → (P x ≥ P y ↔ P x.tail ≥ P y.tail)) ∧
(∀ (x : Stream' (Set.Icc (0 : ℝ) 1)) (π : Equiv.Perm ℕ), {t | π t ≠ t}.Finite → P (x ∘ ⇑π) = P x) ∧
(∀ (a b : Set.Icc (0 : ℝ) 1), a < b → P (Stream'.const a) < P (Stream'.cons b (Stream'.const a)))swf_upper_dominance_of_lower_swfIn LeanSocial Choice Theory
Given a monotone, stationary, finitely anonymous SWF satisfying lower restricted dominance, the SWF obtained by complementing each utility (v ↦ 1 - v) and negating is monotone, stationary, finitely anonymous, and satisfies upper restricted dominance.
theorem swf_upper_dominance_of_lower_swf (W : Stream' (Set.Icc (0 : ℝ) 1) → ℝ)
(hmono : swf_is_monotone W) (hstat : swf_is_stationary W)
(hanon : swf_is_finitely_anonymous W) (hdom : swf_lower_restricted_dominance W) :
swf_is_monotone (fun x => - W (swf_stream_complement x)) ∧
swf_is_stationary (fun x => - W (swf_stream_complement x)) ∧
swf_is_finitely_anonymous (fun x => - W (swf_stream_complement x)) ∧
swf_upper_restricted_dominance (fun x => - W (swf_stream_complement x))swf_value_complement_iffIn LeanSocial Choice Theory
On the unit interval, complementation v ↦ 1 − v reverses both ≤ and <: 1 − a ≤ 1 − b iff b ≤ a, and 1 − a < 1 − b iff b < a.
theorem swf_value_complement_iff (a b : Set.Icc (0 : ℝ) 1) :
((1 - (a : ℝ) ≤ 1 - (b : ℝ)) ↔ b ≤ a) ∧ ((1 - (a : ℝ) < 1 - (b : ℝ)) ↔ b < a)arithmetic_fourier_bound_fiveIn LeanElementary Number Theory
The arithmetic Fourier bound lambda_5 in dimension 5 equals 11.
theorem arithmetic_fourier_bound_five : arithmetic_fourier_bound 5 = 11
binary_form_compression_bound_recurrenceIn LeanElementary Number Theory
For all integers $a \ge 2$ and $k \ge 1$, the compression bound satisfies the recurrence $h_a(k) = h_a(k-1) + h_{a-1}(k-1)$.
theorem binary_form_compression_bound_recurrence (a k : ℕ) (ha : 2 ≤ a) (hk : 1 ≤ k) :
binary_form_compression_bound a k =
binary_form_compression_bound a (k - 1) + binary_form_compression_bound (a - 1) (k - 1)brown_criterion_of_pos_monoIn LeanElementary Number Theory
Brown's criterion (1961): a positive, nondecreasing integer sequence H starting with H(0)=0 and H(1)=1 is complete if and only if every term H(n+1) is at most 1 plus the sum of all preceding terms.
theorem brown_criterion_of_pos_mono (H : ℕ → ℤ) (h0 : H 0 = 0) (h1 : H 1 = 1)
(hpos : ∀ n ≥ 1, 1 ≤ H n) (hmono : ∀ n ≥ 1, H n ≤ H (n + 1)) :
is_complete_sequence H ↔ ∀ n ≥ 1, H (n + 1) ≤ 1 + ∑ i ∈ Finset.range (n + 1), H icanonical_max_halving_partition_is_halvingIn LeanElementary Number Theory
For every integer $n \ge 1$, the list formed by $\lfloor n / 2^{i+1} \rfloor$ for $0 \le i < \lfloor \log_2 n \rfloor$ followed by $s_2(n)$ copies of $1$ is a halving partition of $n$.
theorem canonical_max_halving_partition_is_halving (n : ℕ) (hn : 1 ≤ n) :
is_halving_partition n
((List.range (Nat.log 2 n)).map (fun i => n / 2 ^ (i + 1)) ++
List.replicate ((Nat.digits 2 n).sum) 1)compression_of_normalized_binary_linear_formsIn LeanElementary Number Theory
Let $V$ be a vector space over $\mathbb{F}_2$ of dimension $k+1$, and let $u \in V \setminus \{0\}$. For every integer $a \ge 1$, any integer-weighted sum $\sum_{i \in \iota} c_i \nu_i(x)$ of linear functionals $\nu_i : V \to \mathbb{F}_2$ normalized at $u$ (with $\nu_i(u) = 1$) can be represented modulo $2^a$ by at most $h_a(k)$ normalized forms: there exist $m \le h_a(k)$, linear functionals $\eta_1, \dots, \eta_m : V \to \mathbb{F}_2$ normalized at $u$ ($\eta_j(u) = 1$), and integer coefficients $d_1, \dots, d_m \in \mathbb{Z}$ such that for all $x \in V$, $\sum_{i \in \iota} c_i \nu_i(x) \equiv \sum_{j=1}^m d_j \eta_j(x) \pmod{2^a}$.
theorem compression_of_normalized_binary_linear_forms
{V : Type*} [AddCommGroup V] [Module (ZMod 2) V]
(k : ℕ) (hdim : Module.finrank (ZMod 2) V = k + 1)
(u : V) (hu : u ≠ 0)
(a : ℕ) (ha : 1 ≤ a)
{ι : Type*} [Fintype ι]
(c : ι → ℤ) (ν : ι → (V →ₗ[ZMod 2] ZMod 2))
(hν : ∀ i, is_normalized_binary_form u (ν i)) :
∃ (m : ℕ) (hm : m ≤ binary_form_compression_bound a k)
(d : Fin m → ℤ) (η : Fin m → (V →ₗ[ZMod 2] ZMod 2))
(hη : ∀ j, is_normalized_binary_form u (η j)),
∀ x : V, (∑ i, c i * ((ν i x).val : ℤ)) ≡ (∑ j, d j * ((η j x).val : ℤ)) [ZMOD (2 ^ a : ℤ)]coprime_matching_base_pow_injectiveIn LeanElementary Number Theory
Let S be the support of F, all members prime, and let the base at p be p when p ∣ b and ζ_p^b otherwise. If k and k' are bounded by F and F p < p whenever p ∤ b, then ∏ p ∈ S, base_p^(k p) = ∏ p ∈ S, base_p^(k' p) forces k = k'.
theorem coprime_matching_base_pow_injective (b : Nat) (hb : 0 < b) (S : Finset Nat) (F : Nat →₀ Nat)
(hFs : F.support = S) (hprime : ∀ p ∈ S, p.Prime) (y : Nat → Complex)
(hy : ∀ p ∈ S, ¬ p ∣ b → IsPrimitiveRoot (y p) p)
(hlt : ∀ p ∈ S, ¬ p ∣ b → F p < p) (k k' : Nat →₀ Nat) (hk : k ≤ F) (hk' : k' ≤ F)
(h : (∏ p ∈ S, (coprime_matching_base b y p) ^ (k p))
= ∏ p ∈ S, (coprime_matching_base b y p) ^ (k' p)) : k = k'coprime_matching_det_ne_zeroIn LeanElementary Number Theory
With ζ_p a primitive p-th root of unity for each prime p dividing m and not b, and m.factorization p < p at those primes, the N×N matrix whose (t,j) entry is the product over the prime factors of m of the row value raised to the exponent of the j-th divisor has nonzero determinant.
theorem coprime_matching_det_ne_zero (m a b : Nat) (hm : 0 < m) (hcop : Nat.Coprime a b)
(z y : Nat → Complex) (hz : ∀ p ∈ m.factorization.support, p.Prime → IsPrimitiveRoot (z p) p)
(hy : ∀ p ∈ m.factorization.support, ¬ p ∣ b → IsPrimitiveRoot (y p) p)
(hlt : ∀ p ∈ m.factorization.support, ¬ p ∣ b → m.factorization p < p)
{N : Nat} (kOf : Fin N ≃ ↥(Finset.Iic m.factorization)) (hN : N = (Nat.divisors m).card) :
(Matrix.of (fun (t : Fin N) (j : Fin N) =>
∏ p ∈ m.factorization.support, (coprime_matching_row_value a b z p (t : Nat)) ^ ((kOf j).val p))).det ≠ 0coprime_matching_entry_ne_zero_iffIn LeanElementary Number Theory
Let p be prime and ζ a primitive p-th root of unity for each prime p in S, where S is the support of the factorization of a positive m. Then for any exponent vector j ≤ m.factorization, the row-t entry of the matrix is nonzero exactly when the divisor prod p^(j p) is coprime to a + b*t.
theorem coprime_matching_entry_ne_zero_iff (m a b : Nat) (hm : 0 < m) (hcop : Nat.Coprime a b)
(ζ : Nat → Complex) (hζ : ∀ p ∈ m.factorization.support, p.Prime → IsPrimitiveRoot (ζ p) p)
(j : Nat →₀ Nat) (hj : j ≤ m.factorization) (t : Nat) :
(∏ p ∈ m.factorization.support, (coprime_matching_row_value a b ζ p t) ^ (j p)) ≠ 0
↔ Nat.Coprime (j.prod (fun p e => p ^ e)) (a + b * t)coprime_matching_of_exponent_lt_primeIn LeanElementary Number Theory
Let m be a positive natural number, and let a and b be coprime natural numbers with 0 < b. If for every prime p dividing m such that ¬(p ∣ b), the p-adic exponent m.factorization p < p, then there exists an equivalence e : Fin (Nat.divisors m).card ≃ Nat.divisors m such that for all i : Fin (Nat.divisors m).card, (e i : ℕ) and a + b * (i : ℕ) are coprime.
theorem coprime_matching_of_exponent_lt_prime (m : ℕ) (hm : 0 < m) (a b : ℕ) (hb : 0 < b)
(hcop : Nat.Coprime a b)
(hexp : ∀ p : ℕ, p.Prime → p ∣ m → ¬ p ∣ b → m.factorization p < p) :
∃ e : Fin (Nat.divisors m).card ≃ Nat.divisors m,
∀ i : Fin (Nat.divisors m).card, Nat.Coprime (e i : ℕ) (a + b * (i : ℕ))coprime_matching_of_nonzero_detIn LeanElementary Number Theory
Suppose ζ_p is a primitive p-th root of unity at each prime p | m, the constructed N×N matrix of row values has nonzero determinant, and divisors of m are enumerated by exponent vectors via the box bijection. Then there is a bijection between positions 0..N−1 and the divisors of m such that each divisor is coprime to the corresponding term a + b*t.
theorem coprime_matching_of_nonzero_det (m a b : Nat) (hm : 0 < m) (hcop : Nat.Coprime a b)
(z : Nat → Complex) (hz : ∀ p ∈ m.factorization.support, p.Prime → IsPrimitiveRoot (z p) p)
{N : Nat} (kOf : Fin N ≃ ↥(Finset.Iic m.factorization)) (hN : N = (Nat.divisors m).card)
(hdet : (Matrix.of (fun (t : Fin N) (j : Fin N) =>
∏ p ∈ m.factorization.support, (coprime_matching_row_value a b z p (t : Nat)) ^ ((kOf j).val p))).det ≠ 0) :
∃ e : Fin (Nat.divisors m).card ≃ Nat.divisors m,
∀ i : Fin (Nat.divisors m).card, Nat.Coprime (e i : Nat) (a + b * (i : Nat))coprime_matching_pow_sub_one_eq_zero_iffIn LeanElementary Number Theory
For a prime p, a primitive p-th root of unity ζ, and naturals a, b, t, j: (ζ^(a+bt) − 1)^j = 0 if and only if p divides a + b*t and j ≠ 0.
theorem coprime_matching_pow_sub_one_eq_zero_iff (p a b t j : Nat) (ζ : Complex)
(hζ : IsPrimitiveRoot ζ p) : (ζ ^ (a + b * t) - 1) ^ j = 0 ↔ p ∣ a + b * t ∧ j ≠ 0coprime_matching_prime_not_dvd_progressionIn LeanElementary Number Theory
If p is prime, p divides b, and a and b are coprime, then p does not divide a + b*t for any t.
theorem coprime_matching_prime_not_dvd_progression (a b t p : Nat) (hp : p.Prime) (hb : p ∣ b)
(hcop : Nat.Coprime a b) : ¬ p ∣ a + b * tcoprime_matching_vandermonde_factorizationIn LeanElementary Number Theory
For every row t and exponent vector j, the product over p of the row value raised to j p equals the sum over k ≤ j of (prod over p of base_p^(k p))^t times the change-of-basis coefficient of k and j.
theorem coprime_matching_vandermonde_factorization (a b : Nat) (S : Finset Nat) (F : Nat →₀ Nat)
(hFs : F.support = S) (z y : Nat → Complex) (t : Nat) (j : Nat →₀ Nat) (hj : j ≤ F) :
(∏ p ∈ S, (coprime_matching_row_value a b z p t) ^ (j p))
= ∑ k ∈ Finset.Iic j,
(∏ p ∈ S, (coprime_matching_base b y p) ^ (k p)) ^ t * coprime_matching_coeff a b z S k jcrystal_components_uniqueIn LeanElementary Number Theory
Crystals have unique components (arXiv:1601.03081, open): if n is a crystal with components a, b and also with components c, d, then {a, b} = {c, d}.
theorem crystal_components_unique (n a b c d : ℕ)
(hab : is_crystal_with_components n a b) (hcd : is_crystal_with_components n c d) :
({a, b} : Finset ℕ) = {c, d}crystal_dvd_pred_sqIn LeanElementary Number Theory
If n is a crystal with components a, b, then (a+1) divides (b-1)^2 and (b+1) divides (a-1)^2.
theorem crystal_dvd_pred_sq (n a b : ℕ) (hab : is_crystal_with_components n a b) :
(a + 1) ∣ (b - 1) ^ 2 ∧ (b + 1) ∣ (a - 1) ^ 2crystal_dvd_prod_sqIn LeanElementary Number Theory
If n is a crystal with components a, b, then (a+1)(b+1) divides (ab+1)^2.
theorem crystal_dvd_prod_sq (n a b : ℕ) (hab : is_crystal_with_components n a b) :
(a + 1) * (b + 1) ∣ (a * b + 1) ^ 2crystal_dvd_succ_sqIn LeanElementary Number Theory
If n is a crystal with components a, b, then (a+1)(b+1) divides (n+1)^2.
theorem crystal_dvd_succ_sq (n a b : ℕ) (hab : is_crystal_with_components n a b) :
(a + 1) * (b + 1) ∣ (n + 1) ^ 2crystal_dvd_sum_sqIn LeanElementary Number Theory
If n is a crystal with components a, b, then (a+1)(b+1) divides (a+b)^2.
theorem crystal_dvd_sum_sq (n a b : ℕ) (hab : is_crystal_with_components n a b) :
(a + 1) * (b + 1) ∣ (a + b) ^ 2crystal_lt_sq_of_ltIn LeanElementary Number Theory
If n is a crystal with components a < b, then b < a^2.
theorem crystal_lt_sq_of_lt (n a b : ℕ) (hab : is_crystal_with_components n a b) (hlt : a < b) :
b < a ^ 2crystal_symmIn LeanElementary Number Theory
If n is a crystal with components a, b, then n is also a crystal with components b, a.
theorem crystal_symm (n a b : ℕ) (hab : is_crystal_with_components n a b) :
is_crystal_with_components n b adavenport_box_corner_deficitIn LeanElementary Number Theory
For m at least two and integers s, t with 1 <= s, t <= 2m, if the three numbers m(s+t)-st, mt, ms have gcd 1, then 4m squared minus the corner area 2m(s+t)-st is at least the smallest prime not dividing m.
theorem davenport_box_corner_deficit (m s t : ℕ) (hm : 2 ≤ m) (hs : 1 ≤ s) (hs2 : s ≤ 2*m)
(ht : 1 ≤ t) (ht2 : t ≤ 2*m)
(hgcd : ((m*(s + t) - s*t).gcd (m*t)).gcd (m*s) = 1) :
4*m^2 - (2*m*(s + t) - s*t) ≥ nat_least_prime_not_dvd mdavenport_box_extremal_sequence_minimalIn LeanElementary Number Theory
For every natural m at least two, the displayed canonical multiset S(m) is a minimal zero-sum multiset.
theorem davenport_box_extremal_sequence_minimal (m : ℕ) (hm : 2 ≤ m) :
multiset_is_minimal_zero_sum (davenport_box_extremal_sequence m)davenport_box_extremal_sequence_uniqueIn LeanElementary Number Theory
For m ≥ 2, any minimal zero-sum sequence over ⟦−m, m⟧² whose length equals D(⟦−m, m⟧²) is the image of S(m) under one of the eight symmetries of the square.
theorem davenport_box_extremal_sequence_unique (m : ℕ) (hm : 2 ≤ m)
(s : Multiset (ℤ × ℤ)) (hbox : ∀ x ∈ s, x ∈ int_box_two m)
(hmin : multiset_is_minimal_zero_sum s)
(hcard : (Multiset.card s : ℕ∞) = davenport_constant (↑(int_box_two m) : Set (ℤ × ℤ))) :
∃ e₁ e₂ : ℤˣ, ∃ sw : Bool,
s = (davenport_box_extremal_sequence m).map (int_square_symmetry e₁ e₂ sw)davenport_box_four_support_near_extremalIn LeanElementary Number Theory
For every natural m at least two there exists a minimal zero-sum multiset in the square [-m,m]^2 with exactly four distinct support points and length 4m squared minus q(m) minus one.
theorem davenport_box_four_support_near_extremal (m : ℕ) (hm : 2 ≤ m) :
∃ s : Multiset (ℤ × ℤ),
multiset_is_minimal_zero_sum s ∧
(∀ v ∈ s, v ∈ int_box_two m) ∧
s.toFinset.card = 4 ∧
s.card = 4*m^2 - nat_least_prime_not_dvd m - 1davenport_box_minimal_zero_sum_card_leIn LeanElementary Number Theory
Every minimal zero-sum sequence over ⟦−m, m⟧² (m ≥ 2) has length at most 4m² − q(m).
theorem davenport_box_minimal_zero_sum_card_le (m : ℕ) (hm : 2 ≤ m)
(s : Multiset (ℤ × ℤ)) (hmin : multiset_is_minimal_zero_sum s)
(hbox : ∀ v ∈ s, v ∈ int_box_two m) :
s.card ≤ 4 * m ^ 2 - nat_least_prime_not_dvd mdavenport_box_minimal_zero_sum_card_le_of_support_ge_fourIn LeanElementary Number Theory
A minimal zero-sum sequence over ⟦−m, m⟧² (m ≥ 2) with at least four distinct terms has length at most 4m² − q(m) − 1, i.e. strictly shorter than the extremal length.
theorem davenport_box_minimal_zero_sum_card_le_of_support_ge_four (m : ℕ) (hm : 2 ≤ m)
(s : Multiset (ℤ × ℤ)) (hmin : multiset_is_minimal_zero_sum s)
(hbox : ∀ v ∈ s, v ∈ int_box_two m) (hsupport : 4 ≤ s.toFinset.card) :
s.card ≤ 4 * m ^ 2 - nat_least_prime_not_dvd m - 1davenport_box_minimal_zero_sum_card_le_of_support_le_twoIn LeanElementary Number Theory
A minimal zero-sum sequence over the box ⟦−m, m⟧² (m ≥ 2) whose set of distinct terms has at most two elements has length at most 2m − 1.
theorem davenport_box_minimal_zero_sum_card_le_of_support_le_two (m : ℕ) (hm : 2 ≤ m)
(s : Multiset (ℤ × ℤ)) (hmin : multiset_is_minimal_zero_sum s)
(hbox : ∀ v ∈ s, v ∈ int_box_two m) (hsupport : s.toFinset.card ≤ 2) :
s.card ≤ 2 * m - 1davenport_box_minimal_zero_sum_card_le_of_support_threeIn LeanElementary Number Theory
Every minimal zero-sum multiset over the integer square [-m,m]^2, for m at least two, with exactly three distinct support points has length at most 4m squared minus the smallest prime not dividing m.
theorem davenport_box_minimal_zero_sum_card_le_of_support_three (m : ℕ) (hm : 2 ≤ m)
(s : Multiset (ℤ × ℤ)) (hmin : multiset_is_minimal_zero_sum s)
(hbox : ∀ v ∈ s, v ∈ int_box_two m) (hsupport : s.toFinset.card = 3) :
s.card ≤ 4*m^2-nat_least_prime_not_dvd mdavenport_box_primitive_triangle_boundIn LeanElementary Number Theory
If a, b, c lie in the box [-m,m]^2 and their three determinants are nonzero with a common sign, then the sum of the absolute determinants divided by their gcd is at most 4m squared minus the smallest prime not dividing m.
theorem davenport_box_primitive_triangle_bound (m : ℕ) (hm : 2 ≤ m) (a b c : ℤ × ℤ)
(ha : a ∈ int_box_two m) (hb : b ∈ int_box_two m) (hc : c ∈ int_box_two m)
(hd : (0 < davenport_det b c ∧ 0 < davenport_det c a ∧ 0 < davenport_det a b) ∨
(davenport_det b c < 0 ∧ davenport_det c a < 0 ∧ davenport_det a b < 0)) :
((davenport_det b c).natAbs + (davenport_det c a).natAbs + (davenport_det a b).natAbs) /
(((davenport_det b c).natAbs.gcd (davenport_det c a).natAbs).gcd
(davenport_det a b).natAbs) ≤ 4*m^2 - nat_least_prime_not_dvd mdavenport_box_three_det_corner_normal_formIn LeanElementary Number Theory
If a, b, c lie in the box [-m,m]^2, their three determinants are nonzero with a common sign, and the sum of absolute determinants exceeds 4m squared minus 2m, then that sum has the corner form 2m(s+t) - st for integers s, t with 1 <= s, t <= 2m, and the gcd of (2m(s+t)-st, mt, ms) equals the gcd of the three absolute determinants.
theorem davenport_box_three_det_corner_normal_form (m : ℕ) (hm : 2 ≤ m) (a b c : ℤ × ℤ)
(ha : a ∈ int_box_two m) (hb : b ∈ int_box_two m) (hc : c ∈ int_box_two m)
(hsign : (0 < davenport_det b c ∧ 0 < davenport_det c a ∧ 0 < davenport_det a b) ∨
(davenport_det b c < 0 ∧ davenport_det c a < 0 ∧ davenport_det a b < 0))
(hbig : 4*m^2 - 2*m < (davenport_det b c).natAbs + (davenport_det c a).natAbs +
(davenport_det a b).natAbs) :
∃ s t : ℕ, 1 ≤ s ∧ s ≤ 2*m ∧ 1 ≤ t ∧ t ≤ 2*m ∧
(davenport_det b c).natAbs + (davenport_det c a).natAbs + (davenport_det a b).natAbs =
2*m*(s + t) - s*t ∧
((m*(s + t) - s*t).gcd (m*t)).gcd (m*s) =
((davenport_det b c).natAbs.gcd (davenport_det c a).natAbs).gcd
(davenport_det a b).natAbsdavenport_box_three_support_extremal_classificationIn LeanElementary Number Theory
A minimal zero-sum sequence over ⟦−m, m⟧² (m ≥ 2) with exactly three distinct terms and extremal length 4m² − q(m) is the image of S(m) under one of the eight symmetries of the square.
theorem davenport_box_three_support_extremal_classification (m : ℕ) (hm : 2 ≤ m)
(s : Multiset (ℤ × ℤ)) (hmin : multiset_is_minimal_zero_sum s)
(hbox : ∀ v ∈ s, v ∈ int_box_two m) (hsupport : s.toFinset.card = 3)
(hcard : s.card = 4 * m ^ 2 - nat_least_prime_not_dvd m) :
∃ e₁ e₂ : ℤˣ, ∃ sw : Bool,
s = (davenport_box_extremal_sequence m).map (int_square_symmetry e₁ e₂ sw)davenport_box_three_support_minimality_transferIn LeanElementary Number Theory
If a multiset α·a + β·b + γ·c with a, b, c pairwise distinct is a minimal zero-sum sequence, then any nonzero sub-count vector (i,j,k) ≤ (α,β,γ) with i·a + j·b + k·c = 0 must be the full vector (α,β,γ).
theorem davenport_box_three_support_minimality_transfer
(a b c : ℤ × ℤ) (α β γ : ℕ)
(hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c)
(hmin : multiset_is_minimal_zero_sum
(Multiset.replicate α a + Multiset.replicate β b + Multiset.replicate γ c)) :
∀ i j k : ℕ, i ≤ α → j ≤ β → k ≤ γ → (i, j, k) ≠ (0, 0, 0) →
(i : ℤ) • a + (j : ℤ) • b + (k : ℤ) • c = 0 → i = α ∧ j = β ∧ k = γdavenport_box_three_support_rank_one_boundIn LeanElementary Number Theory
If the three support points are collinear with the origin (all three determinants vanish), then the length alpha+beta+gamma is at most 2m-1, hence at most 4m squared minus the smallest prime not dividing m.
theorem davenport_box_three_support_rank_one_bound (m : ℕ) (hm : 2 ≤ m) (a b c : ℤ × ℤ)
(α β γ : ℕ) (hα : 0 < α) (hβ : 0 < β) (hγ : 0 < γ)
(ha : a ∈ int_box_two m) (hb : b ∈ int_box_two m) (hc : c ∈ int_box_two m)
(hrel : (α : ℤ) • a + (β : ℤ) • b + (γ : ℤ) • c = 0)
(hmin : ∀ i j k : ℕ, i ≤ α → j ≤ β → k ≤ γ → (i, j, k) ≠ (0, 0, 0) →
(i : ℤ) • a + (j : ℤ) • b + (k : ℤ) • c = 0 → i = α ∧ j = β ∧ k = γ)
(hzero : davenport_det b c = 0 ∧ davenport_det c a = 0 ∧ davenport_det a b = 0) :
α + β + γ ≤ 4*m^2 - nat_least_prime_not_dvd mdavenport_box_three_support_rank_two_formulaIn LeanElementary Number Theory
Let a, b, c be plane points with alpha, beta, gamma positive counts summing (with the points) to zero, satisfying the minimality transfer, and at least one determinant nonzero. Then the three determinants det(b,c), det(c,a), det(a,b) are all nonzero with a common sign, and alpha+beta+gamma equals the sum of their absolute values divided by their gcd.
theorem davenport_box_three_support_rank_two_formula (a b c : ℤ × ℤ) (α β γ : ℕ)
(hα : 0 < α) (hβ : 0 < β) (hγ : 0 < γ)
(hrel : (α : ℤ) • a + (β : ℤ) • b + (γ : ℤ) • c = 0)
(hmin : ∀ i j k : ℕ, i ≤ α → j ≤ β → k ≤ γ → (i, j, k) ≠ (0, 0, 0) →
(i : ℤ) • a + (j : ℤ) • b + (k : ℤ) • c = 0 → i = α ∧ j = β ∧ k = γ)
(hne : davenport_det b c ≠ 0 ∨ davenport_det c a ≠ 0 ∨ davenport_det a b ≠ 0) :
((0 < davenport_det b c ∧ 0 < davenport_det c a ∧ 0 < davenport_det a b) ∨
(davenport_det b c < 0 ∧ davenport_det c a < 0 ∧ davenport_det a b < 0)) ∧
α + β + γ = ((davenport_det b c).natAbs + (davenport_det c a).natAbs +
(davenport_det a b).natAbs) /
(((davenport_det b c).natAbs.gcd (davenport_det c a).natAbs).gcd
(davenport_det a b).natAbs)davenport_box_three_support_structureIn LeanElementary Number Theory
A minimal zero-sum multiset over the box with exactly three distinct support points is, up to naming, alpha copies of a, beta copies of b and gamma copies of c, with a, b, c distinct points of the box, alpha, beta, gamma positive, alpha a + beta b + gamma c = 0, and the transfer of minimality: any nonzero sub-combination (i,j,k) ≤ (alpha,beta,gamma) with i a + j b + k c = 0 must be the full one.
theorem davenport_box_three_support_structure (m : ℕ) (s : Multiset (ℤ × ℤ))
(hmin : multiset_is_minimal_zero_sum s) (hbox : ∀ v ∈ s, v ∈ int_box_two m)
(hsupport : s.toFinset.card = 3) :
∃ a b c : ℤ × ℤ, ∃ α β γ : ℕ,
a ∈ int_box_two m ∧ b ∈ int_box_two m ∧ c ∈ int_box_two m ∧
a ≠ b ∧ a ≠ c ∧ b ≠ c ∧ 0 < α ∧ 0 < β ∧ 0 < γ ∧
s.card = α + β + γ ∧
s = Multiset.replicate α a + Multiset.replicate β b + Multiset.replicate γ c ∧
((α : ℤ) • a + (β : ℤ) • b + (γ : ℤ) • c = 0) ∧
(∀ i j k : ℕ, i ≤ α → j ≤ β → k ≤ γ → (i, j, k) ≠ (0, 0, 0) →
(i : ℤ) • a + (j : ℤ) • b + (k : ℤ) • c = 0 → i = α ∧ j = β ∧ k = γ)davenport_constant_int_box_two_eq_valueIn LeanElementary Number Theory
For m ≥ 2, D(⟦−m, m⟧²) = 4m² − q(m).
theorem davenport_constant_int_box_two_eq_value (m : ℕ) (hm : 2 ≤ m) :
davenport_constant (↑(int_box_two m) : Set (ℤ × ℤ)) =
((4 * m ^ 2 - nat_least_prime_not_dvd m : ℕ) : ℕ∞)davenport_constant_int_box_two_leIn LeanElementary Number Theory
For m ≥ 2, the Davenport constant of ⟦−m, m⟧² is at most 4m² − q(m).
theorem davenport_constant_int_box_two_le (m : ℕ) (hm : 2 ≤ m) :
davenport_constant (↑(int_box_two m) : Set (ℤ × ℤ)) ≤
((4 * m ^ 2 - nat_least_prime_not_dvd m : ℕ) : ℕ∞)davenport_det_relationIn LeanElementary Number Theory
For three points a, b, c of the integer plane, det(b,c) a + det(c,a) b + det(a,b) c = 0.
theorem davenport_det_relation (a b c : ℤ × ℤ) :
davenport_det b c • a + davenport_det c a • b + davenport_det a b • c = 0davenport_int_minimal_zero_sum_card_leIn LeanElementary Number Theory
One-dimensional Davenport bound: a minimal zero-sum multiset of integers, all entries lying in [-m, m], has length at most 2m - 1.
theorem davenport_int_minimal_zero_sum_card_le (m : ℕ) (hm : 1 ≤ m) (s : Multiset ℤ)
(hmin : multiset_is_minimal_zero_sum s) (hbox : ∀ x ∈ s, x ∈ Finset.Icc (-(m:ℤ)) (m:ℤ)) :
s.card ≤ 2*m - 1davenport_three_point_det_sum_le_spreadIn LeanElementary Number Theory
If the three points have x-coordinate spread at most W and y-coordinate spread at most H, and the three determinants det(b,c), det(c,a), det(a,b) are nonzero with a common sign, then the sum of their absolute values is at most W times H. (An inscribed triangle has area at most half the enclosing rectangle.)
theorem davenport_three_point_det_sum_le_spread (a b c : ℤ × ℤ) (W H : ℕ)
(hWab : |a.1 - b.1| ≤ (W:ℤ)) (hWac : |a.1 - c.1| ≤ (W:ℤ)) (hWbc : |b.1 - c.1| ≤ (W:ℤ))
(hHab : |a.2 - b.2| ≤ (H:ℤ)) (hHac : |a.2 - c.2| ≤ (H:ℤ)) (hHbc : |b.2 - c.2| ≤ (H:ℤ))
(hsign : (0 < davenport_det b c ∧ 0 < davenport_det c a ∧ 0 < davenport_det a b) ∨
(davenport_det b c < 0 ∧ davenport_det c a < 0 ∧ davenport_det a b < 0)) :
(davenport_det b c).natAbs + (davenport_det c a).natAbs + (davenport_det a b).natAbs ≤ W * Hderangements_no_two_cycles_count_antiperiodicIn LeanElementary Number Theory
Lemma 2.2 of arXiv:2610.40342 at S = {1,2}: for every prime p ≥ 3 and every n, the number a(n) of permutations of Fin n with no cycles of length 1 or 2 satisfies a(n+p) ≡ -a(n) (mod p).
theorem derangements_no_two_cycles_count_antiperiodic (p n : ℕ) (hp : p.Prime) (hp_odd : Odd p) : (derangements_no_two_cycles_count (n + p) : ZMod p) = - (derangements_no_two_cycles_count n : ZMod p)
derangements_no_two_cycles_count_dvdIn LeanElementary Number Theory
Theorem 3.1(i) of arXiv:2610.40342 at r = 2: the falling factorial (n-1)(n-2) divides the number of permutations of Fin n with no cycles of length 1 or 2, for n ≥ 3.
theorem derangements_no_two_cycles_count_dvd (n : ℕ) (hn : 3 ≤ n) : (n - 1) * (n - 2) ∣ derangements_no_two_cycles_count n
derangements_no_two_cycles_count_recurrence_three_termIn LeanElementary Number Theory
The number a(n) of permutations of Fin n with no cycles of length 1 or 2 satisfies a(n) = (n-1)·a(n-1) + (n-1)(n-2)·a(n-3) for all n ≥ 1.
theorem derangements_no_two_cycles_count_recurrence_three_term (n : ℕ) (hn : 1 ≤ n) : derangements_no_two_cycles_count n = (n - 1) * derangements_no_two_cycles_count (n - 1) + (n - 1) * (n - 2) * derangements_no_two_cycles_count (n - 3)
derangements_no_two_cycles_quotient_antiperiodicIn LeanElementary Number Theory
For every odd prime p and every natural number n ≥ 3, the quotient Q_n of derangements without 2-cycles satisfies Q_{n+p} = -Q_n in ZMod p.
theorem derangements_no_two_cycles_quotient_antiperiodic (p n : ℕ) (hp : p.Prime) (hp_odd : Odd p) (hn : 3 ≤ n) : (derangements_no_two_cycles_quotient (n + p) : ZMod p) = - (derangements_no_two_cycles_quotient n : ZMod p)
derangements_no_two_cycles_quotient_baseIn LeanElementary Number Theory
The three seed cases of the anti-periodicity, for every odd prime p: Q_{3+p} ≡ -Q_3, Q_{4+p} ≡ -Q_4, Q_{5+p} ≡ -Q_5 in ZMod p.
theorem derangements_no_two_cycles_quotient_base (p : ℕ) (hp : p.Prime) (hp_odd : Odd p) : (derangements_no_two_cycles_quotient (3 + p) : ZMod p) = - (derangements_no_two_cycles_quotient 3 : ZMod p) ∧ (derangements_no_two_cycles_quotient (4 + p) : ZMod p) = - (derangements_no_two_cycles_quotient 4 : ZMod p) ∧ (derangements_no_two_cycles_quotient (5 + p) : ZMod p) = - (derangements_no_two_cycles_quotient 5 : ZMod p)
derangements_no_two_cycles_quotient_odd_prime_divisorsIn LeanElementary Number Theory
An odd prime p divides derangements_no_two_cycles_quotient n for some n ≥ 3 if and only if it divides derangements_no_two_cycles_quotient n for some n with 3 ≤ n ≤ p + 2, and the set of odd primes that divide derangements_no_two_cycles_quotient n for some n ≥ 3 is infinite.
theorem derangements_no_two_cycles_quotient_odd_prime_divisors :
(∀ p : ℕ, p.Prime → Odd p →
((∃ n ≥ 3, p ∣ derangements_no_two_cycles_quotient n) ↔
(∃ n, 3 ≤ n ∧ n ≤ p + 2 ∧ p ∣ derangements_no_two_cycles_quotient n))) ∧
{p : ℕ | p.Prime ∧ Odd p ∧ ∃ n ≥ 3, p ∣ derangements_no_two_cycles_quotient n}.Infinitederangements_no_two_cycles_quotient_prime_dvd_iffIn LeanElementary Number Theory
For every odd prime p, p divides derangements_no_two_cycles_quotient n for some n ≥ 3 if and only if p divides derangements_no_two_cycles_quotient n for some n with 3 ≤ n ≤ p + 2.
theorem derangements_no_two_cycles_quotient_prime_dvd_iff (p : ℕ) (hp : p.Prime) (hp_odd : Odd p) : (∃ n ≥ 3, p ∣ derangements_no_two_cycles_quotient n) ↔ ∃ n, 3 ≤ n ∧ n ≤ p + 2 ∧ p ∣ derangements_no_two_cycles_quotient n
derangements_no_two_cycles_quotient_recurrenceIn LeanElementary Number Theory
The quotient Q_n = a(n)/((n-1)(n-2)) satisfies Q_n = (n-3)·Q_{n-1} + (n-4)(n-5)·Q_{n-3} for n ≥ 6.
theorem derangements_no_two_cycles_quotient_recurrence (n : ℕ) (hn : 6 ≤ n) : derangements_no_two_cycles_quotient n = (n - 3) * derangements_no_two_cycles_quotient (n - 1) + (n - 4) * (n - 5) * derangements_no_two_cycles_quotient (n - 3)
derangements_no_two_cycles_quotient_small_valuesIn LeanElementary Number Theory
The small values: Q_4 = 1, Q_5 = 2, Q_6 = 8, Q_7 = 38, Q_8 = 214.
theorem derangements_no_two_cycles_quotient_small_values : derangements_no_two_cycles_quotient 4 = 1 ∧ derangements_no_two_cycles_quotient 5 = 2 ∧ derangements_no_two_cycles_quotient 6 = 8 ∧ derangements_no_two_cycles_quotient 7 = 38 ∧ derangements_no_two_cycles_quotient 8 = 214
designated_odd_part_gen_fun_low_coeffsIn LeanElementary Number Theory
The odd-part designated-summand generating function G (the one used to define B_k(n)) begins 1 + X + 2X^2 + 4X^3: its coefficients in degrees 0, 1, 2, 3 are 1, 1, 2, 4.
theorem designated_odd_part_gen_fun_low_coeffs :
(PowerSeries.coeff 0) designated_odd_part_gen_fun = 1 ∧
(PowerSeries.coeff 1) designated_odd_part_gen_fun = 1 ∧
(PowerSeries.coeff 2) designated_odd_part_gen_fun = 2 ∧
(PowerSeries.coeff 3) designated_odd_part_gen_fun = 4designated_odd_part_gen_fun_pow_const_coeffIn LeanElementary Number Theory
For every k, the constant coefficient of G^k is 1, where G is the odd-part designated-summand generating function.
theorem designated_odd_part_gen_fun_pow_const_coeff (k : ℕ) :
(PowerSeries.coeff 0) (designated_odd_part_gen_fun ^ k) = 1designated_odd_part_gen_fun_pow_one_coeffIn LeanElementary Number Theory
For every k, the coefficient of X in G^k is k.
theorem designated_odd_part_gen_fun_pow_one_coeff (k : ℕ) :
(PowerSeries.coeff 1) (designated_odd_part_gen_fun ^ k) = kdesignated_odd_part_gen_fun_pow_three_coeff_sixIn LeanElementary Number Theory
For every k, 6 * [X^3] G^k = k(k+2)(k+7).
theorem designated_odd_part_gen_fun_pow_three_coeff_six (k : ℕ) :
6 * (PowerSeries.coeff 3) (designated_odd_part_gen_fun ^ k) = k * (k + 2) * (k + 7)designated_odd_part_gen_fun_pow_two_coeff_twiceIn LeanElementary Number Theory
For every k, 2 * [X^2] G^k = k^2 + 3k.
theorem designated_odd_part_gen_fun_pow_two_coeff_twice (k : ℕ) :
2 * (PowerSeries.coeff 2) (designated_odd_part_gen_fun ^ k) = k * k + 3 * kdesignated_odd_partition_b3_formulaIn LeanElementary Number Theory
For every k ≥ 1, the number of designated odd partition k-tuples of size 3 equals k(k+2)(k+7)/6.
theorem designated_odd_partition_b3_formula (k : ℕ) (hk : 1 ≤ k) : designated_odd_partition_k_tuple k 3 = designated_odd_partition_b3 k
designated_odd_partition_b3_two_adicIn LeanElementary Number Theory
Class-by-class 2-adic valuation of b3 k = k(k+2)(k+7)/6: it equals v2(k) when 4 divides k, 2 when k ≡ 2 mod 8, 1 when k ≡ 5 mod 8, is odd when k ≡ 3 or 7 mod 8, and equals 2 when k ≡ 1 mod 16 and 3 when k ≡ 6 mod 16.
theorem designated_odd_partition_b3_two_adic (k : ℕ) (hk : 1 ≤ k) : (4 ∣ k → padicValNat 2 (designated_odd_partition_b3 k) = padicValNat 2 k) ∧ (k % 8 = 2 → padicValNat 2 (designated_odd_partition_b3 k) = 2) ∧ (k % 8 = 5 → padicValNat 2 (designated_odd_partition_b3 k) = 1) ∧ (k % 8 = 3 ∨ k % 8 = 7 → designated_odd_partition_b3 k % 2 = 1) ∧ (k % 16 = 1 → padicValNat 2 (designated_odd_partition_b3 k) = 2) ∧ (k % 16 = 6 → padicValNat 2 (designated_odd_partition_b3 k) = 3)
designated_odd_partition_four_dvd_exact_valuationIn LeanElementary Number Theory
For every k ≥ 1 divisible by 4: for all n, the predicted valuation is at most the 2-adic valuation of B_k(4n+3), and that valuation is attained at some n (namely n = 0). This is the k ≡ 0,4 mod 8 half of the target.
theorem designated_odd_partition_four_dvd_exact_valuation (k : ℕ) (hk : 1 ≤ k) (hk4 : 4 ∣ k) : (∀ n : ℕ, designated_odd_partition_predicted_valuation k ≤ padicValNat 2 (designated_odd_partition_k_tuple k (4 * n + 3))) ∧ (∃ n : ℕ, padicValNat 2 (designated_odd_partition_k_tuple k (4 * n + 3)) = designated_odd_partition_predicted_valuation k)
designated_odd_partition_four_dvd_k_tuple_two_adicIn LeanElementary Number Theory
For every k divisible by 4 and every n, 2^(v_2(k)) divides the number of designated odd partition k-tuples of 4n+3; i.e. the 2-adic valuation of B_k(4n+3) is at least v_2(k).
theorem designated_odd_partition_four_dvd_k_tuple_two_adic (k n : ℕ) (hk : 4 ∣ k) : 2 ^ padicValNat 2 k ∣ designated_odd_partition_k_tuple k (4 * n + 3)
designated_odd_partition_pow_two_odd_coeff_two_adicIn LeanElementary Number Theory
For any integer power series f, any s ≥ 1 and any odd m, the coefficient of X^m in f^(2^s) is divisible by 2^s.
theorem designated_odd_partition_pow_two_odd_coeff_two_adic (f : PowerSeries ℤ) (s m : ℕ) (hs : 1 ≤ s) (hm : Odd m) : (2 : ℤ) ^ s ∣ PowerSeries.coeff m (f ^ 2 ^ s)
designated_odd_partition_three_seven_mod_eight_exact_valuationIn LeanElementary Number Theory
For every k with k ≡ 3 or 7 mod 8: for all n, the predicted valuation (which is 0) is at most the 2-adic valuation of B_k(4n+3), and some n (namely n = 0) attains it. This is the k ≡ 3,7 mod 8 half of the target.
theorem designated_odd_partition_three_seven_mod_eight_exact_valuation (k : ℕ) (hk : k % 8 = 3 ∨ k % 8 = 7) : (∀ n : ℕ, designated_odd_partition_predicted_valuation k ≤ padicValNat 2 (designated_odd_partition_k_tuple k (4 * n + 3))) ∧ (∃ n : ℕ, padicValNat 2 (designated_odd_partition_k_tuple k (4 * n + 3)) = designated_odd_partition_predicted_valuation k)
designated_odd_partition_tuple_b3_oddIn LeanElementary Number Theory
For k ≡ 3 mod 4, B_k(3) is odd.
theorem designated_odd_partition_tuple_b3_odd (k : ℕ) (hmod : k % 4 = 3) :
¬ (2 ∣ designated_odd_partition_tuple_coeff k 3)designated_odd_partition_tuple_coeff_eq_k_tupleIn LeanElementary Number Theory
The two definitions of B_k(n) in this topic, designated_odd_partition_tuple_coeff and designated_odd_partition_k_tuple, are the same function: both are the nth coefficient of the kth power of the generating function of partitions into odd parts with designated summands.
theorem designated_odd_partition_tuple_coeff_eq_k_tuple : designated_odd_partition_tuple_coeff = designated_odd_partition_k_tuple
designated_odd_partition_tuple_coeff_threeIn LeanElementary Number Theory
B_k(3) = k(k+2)(k+7)/6, for every k.
theorem designated_odd_partition_tuple_coeff_three (k : ℕ) :
designated_odd_partition_tuple_coeff k 3 = k * (k + 2) * (k + 7) / 6designated_partition_a3_two_adicIn LeanElementary Number Theory
The 2-adic valuation of designated_partition_a3 k equals v_2(k) when 4 divides k, and equals 0 when k ≡ 1 mod 4.
theorem designated_partition_a3_two_adic (k : ℕ) (hk : 1 ≤ k) :
(4 ∣ k → padicValNat 2 (designated_partition_a3 k) = padicValNat 2 k) ∧
(k % 4 = 1 → padicValNat 2 (designated_partition_a3 k) = 0)designated_partition_four_dvd_exact_valuationIn LeanElementary Number Theory
For every k ≥ 1 divisible by 4, the 2-adic valuation of designated_partition_k_tuple k (4 * n + 3) is at least predicted_valuation k for all n, and equals predicted_valuation k at some n.
theorem designated_partition_four_dvd_exact_valuation (k : ℕ) (hk : 1 ≤ k) (hk4 : 4 ∣ k) :
(∀ n : ℕ, designated_partition_predicted_valuation k ≤ padicValNat 2 (designated_partition_k_tuple k (4 * n + 3))) ∧
(∃ n : ℕ, padicValNat 2 (designated_partition_k_tuple k (4 * n + 3)) = designated_partition_predicted_valuation k)designated_partition_mod_four_eq_one_exact_valuationIn LeanElementary Number Theory
For every k with k % 4 = 1, the 2-adic valuation of designated_partition_k_tuple k (4 * n + 3) is at least predicted_valuation k for all n, and equals predicted_valuation k at n = 0.
theorem designated_partition_mod_four_eq_one_exact_valuation (k : ℕ) (hk : k % 4 = 1) :
(∀ n : ℕ, designated_partition_predicted_valuation k ≤ padicValNat 2 (designated_partition_k_tuple k (4 * n + 3))) ∧
(∃ n : ℕ, padicValNat 2 (designated_partition_k_tuple k (4 * n + 3)) = designated_partition_predicted_valuation k)designated_partition_mod_four_eq_three_exact_valuationIn LeanElementary Number Theory
For every k ≥ 1 with k % 4 = 3, the 2-adic valuation of designated_partition_k_tuple k (4 * n + 3) is at least predicted_valuation k for all n, and equals predicted_valuation k at some n.
theorem designated_partition_mod_four_eq_three_exact_valuation (k : ℕ) (hk : 1 ≤ k) (h3 : k % 4 = 3) :
(∀ n : ℕ, designated_partition_predicted_valuation k ≤ padicValNat 2 (designated_partition_k_tuple k (4 * n + 3))) ∧
(∃ n : ℕ, padicValNat 2 (designated_partition_k_tuple k (4 * n + 3)) = designated_partition_predicted_valuation k)designated_partition_mod_four_eq_two_exact_valuationIn LeanElementary Number Theory
For every k ≥ 1 with k % 4 = 2, the 2-adic valuation of designated_partition_k_tuple k (4 * n + 3) is at least predicted_valuation k for all n, and equals predicted_valuation k at some n.
theorem designated_partition_mod_four_eq_two_exact_valuation (k : ℕ) (hk : 1 ≤ k) (h2 : k % 4 = 2) :
(∀ n : ℕ, designated_partition_predicted_valuation k ≤ padicValNat 2 (designated_partition_k_tuple k (4 * n + 3))) ∧
(∃ n : ℕ, padicValNat 2 (designated_partition_k_tuple k (4 * n + 3)) = designated_partition_predicted_valuation k)designated_partition_mod_four_ge_two_exact_valuationIn LeanElementary Number Theory
For every k ≥ 1 with k % 4 = 2 or k % 4 = 3, the 2-adic valuation of designated_partition_k_tuple k (4 * n + 3) is at least predicted_valuation k for all n, and equals predicted_valuation k at some n.
theorem designated_partition_mod_four_ge_two_exact_valuation (k : ℕ) (hk : 1 ≤ k) (hk23 : k % 4 = 2 ∨ k % 4 = 3) :
(∀ n : ℕ, designated_partition_predicted_valuation k ≤ padicValNat 2 (designated_partition_k_tuple k (4 * n + 3))) ∧
(∃ n : ℕ, padicValNat 2 (designated_partition_k_tuple k (4 * n + 3)) = designated_partition_predicted_valuation k)designated_partition_predicted_valuation_of_mod_four_eq_threeIn LeanElementary Number Theory
For every natural number k with k % 4 = 3, the predicted valuation of k is equal to the 2-adic valuation of designated_partition_a3 k.
theorem designated_partition_predicted_valuation_of_mod_four_eq_three (k : ℕ) (h : k % 4 = 3) :
designated_partition_predicted_valuation k = padicValNat 2 (designated_partition_a3 k)designated_partition_predicted_valuation_of_mod_sixteen_eq_twoIn LeanElementary Number Theory
For every natural number k with k % 16 = 2, the predicted valuation of k is equal to 3.
theorem designated_partition_predicted_valuation_of_mod_sixteen_eq_two (k : ℕ) (h : k % 16 = 2) :
designated_partition_predicted_valuation k = 3designated_partition_six_tuple_universal_mod_243Needs helpElementary Number Theory
For every natural number n, 243 divides the number of designated partition 6-tuples of size 12n + 10.
theorem designated_partition_six_tuple_universal_mod_243 :
∀ n : ℕ, 243 ∣ designated_partition_k_tuple 6 (12 * n + 10)exists_int_vec_orthogonal_no_zero_coord_outside_lineIn LeanElementary Number Theory
Let n ≥ 2, let U ⊆ ℝ^n be the real span of integer vectors w_1,...,w_k with dim U ≤ n - 2, and let z be an integer vector. Then U^⊥ contains an integer vector s with no zero coordinate whose image is not on the real line spanned by z.
open Submodule in
theorem exists_int_vec_orthogonal_no_zero_coord_outside_line {k n : ℕ} (hn : 2 ≤ n)
(w : Fin k → Fin n → ℤ) (U : Submodule ℝ (EuclideanSpace ℝ (Fin n)))
(hU : U = Submodule.span ℝ (Set.range fun i => int_to_euclidean n (w i)))
(h_dim : Module.finrank ℝ U ≤ n - 2) (z : Fin n → ℤ) :
∃ s : Fin n → ℤ, (∀ i, s i ≠ 0) ∧ int_to_euclidean n s ∈ Uᗮ ∧
int_to_euclidean n s ∉ Submodule.span ℝ {int_to_euclidean n z}factorization_factorial_le_prod_mul_add_oneIn LeanElementary Number Theory
For a prime $q$ not dividing $d$, the $q$-adic valuation of $k!$ is at most that of $\prod_{j<k}(dj+1)$: each factor $dj+1$ runs through one residue class modulo $q^e$, and every residue class modulo $q^e$ is met by at least $k/q^e$ indices $j<k$.
theorem factorization_factorial_le_prod_mul_add_one (d k q : ℕ) (hd : 0 < d) (hq : q.Prime) (hqd : ¬ q ∣ d) :
(k.factorial).factorization q ≤ (∏ i ∈ Finset.range k, (d * i + 1)).factorization qfalling_factorial_dvd_restricted_cycle_perms_countIn LeanElementary Number Theory
Theorem 3.1(i) of arXiv:2610.40342 at r = 3: if 1, 2, 3 ∈ S then the falling factorial (n-1)(n-2)(n-3) divides a_S(n) = restricted_cycle_perms_count n S, for n ≥ 1.
theorem falling_factorial_dvd_restricted_cycle_perms_count (n : ℕ) (S : Finset ℕ) (hn : 1 ≤ n) (h1 : 1 ∈ S) (h2 : 2 ∈ S) (h3 : 3 ∈ S) : (n - 1) * (n - 2) * (n - 3) ∣ restricted_cycle_perms_count n S
finset_int_card_threeIn LeanElementary Number Theory
Every 3-element set of integers A can be written in the form {a, a+x, a+y} where a is the minimum element and 0 < x < y.
theorem finset_int_card_three (A : Finset ℤ) (hA : A.card = 3) :
∃ a x y : ℤ, 0 < x ∧ x < y ∧ A = {a, a + x, a + y}finsupp_box_sum_eq_piFinset_sumIn LeanElementary Number Theory
A sum over the exponent box Iic k of a product over the support of F of G p (j p) equals the sum over the product of the coordinate ranges range (k p + 1) of the same product.
theorem finsupp_box_sum_eq_piFinset_sum (F k : Nat →₀ Nat) (hk : k ≤ F) (G : Nat → Nat → Complex) :
(∑ j ∈ Finset.Iic k, ∏ p ∈ F.support, G p (j p))
= ∑ x ∈ Fintype.piFinset (fun p : {p // p ∈ F.support} => Finset.range (k p.1 + 1)),
∏ p : {p // p ∈ F.support}, G p.1 (x p)fourier_threshold_nu_five_le_elevenIn LeanElementary Number Theory
The explicit dimension-5 witness has unique zero at 0 and Fourier support at most 11, hence nu(5) ≤ 11.
theorem fourier_threshold_nu_five_le_eleven : fourier_threshold_nu 5 ≤ 11
fourier_threshold_nu_le_card_of_witnessIn LeanElementary Number Theory
Any explicit function f : (ZMod 2)^d → ZMod 3 with unique zero at 0 whose Fourier support has size at most N shows that the Fourier threshold satisfies nu(d) ≤ N.
theorem fourier_threshold_nu_le_card_of_witness (d N : ℕ)
(f : (Fin d → ZMod 2) → ZMod 3)
(hf : ∀ x, f x = 0 ↔ x = 0)
(hN : (Finset.univ.filter (fun u : Fin d → ZMod 2 =>
((-1 : ZMod 3) ^ d * ∑ x, f x * (if ∑ i, u i * x i = 0 then 1 else -1)) ≠ 0)).card ≤ N) :
fourier_threshold_nu d ≤ Nfourier_threshold_nu_odd_le_arithmetic_boundIn LeanElementary Number Theory
For every integer m >= 1, the arithmetic bound lambda_{2m+1} is an upper bound on the Fourier threshold nu(2m+1).
theorem fourier_threshold_nu_odd_le_arithmetic_bound (m : ℕ) (hm : 1 ≤ m) :
fourier_threshold_nu (2 * m + 1) ≤ arithmetic_fourier_bound (2 * m + 1)fourier_threshold_nu_odd_le_arithmetic_bound_oneIn LeanElementary Number Theory
The first instance m = 1 of the target: nu(3) ≤ lambda_3.
theorem fourier_threshold_nu_odd_le_arithmetic_bound_one :
fourier_threshold_nu (2 * 1 + 1) ≤ arithmetic_fourier_bound (2 * 1 + 1)fourier_threshold_nu_odd_le_arithmetic_bound_twoIn LeanElementary Number Theory
The instance m = 2 of the target: nu(5) ≤ lambda_5 = 11.
theorem fourier_threshold_nu_odd_le_arithmetic_bound_two :
fourier_threshold_nu (2 * 2 + 1) ≤ arithmetic_fourier_bound (2 * 2 + 1)global_gcd_agreement_r_ge_fourIn LeanElementary Number Theory
For every r ≥ 4 and n ≥ r + 2, restricted_cycle_global_gcd r n = restricted_cycle_one_param_gcd r n.
theorem global_gcd_agreement_r_ge_four (r : ℕ) (hr : 4 ≤ r) (n : ℕ) (hn : r + 2 ≤ n) : restricted_cycle_global_gcd r n = restricted_cycle_one_param_gcd r n
global_gcd_agreement_r_three_eqIn LeanElementary Number Theory
For r = 3 and n ≥ 5, if ¬(111 ≤ n ∧ n % 81 = 30), then restricted_cycle_global_gcd 3 n = restricted_cycle_one_param_gcd 3 n.
theorem global_gcd_agreement_r_three_eq (n : ℕ) (hn : 5 ≤ n) (h : ¬ (111 ≤ n ∧ n % 81 = 30)) : restricted_cycle_global_gcd 3 n = restricted_cycle_one_param_gcd 3 n
global_gcd_agreement_r_three_neIn LeanElementary Number Theory
For r = 3, if 111 ≤ n and n % 81 = 30, then restricted_cycle_global_gcd 3 n ≠ restricted_cycle_one_param_gcd 3 n.
theorem global_gcd_agreement_r_three_ne (n : ℕ) (hn : 111 ≤ n) (hmod : n % 81 = 30) : restricted_cycle_global_gcd 3 n ≠ restricted_cycle_one_param_gcd 3 n
good_slopes_105_extract_rectangleIn LeanElementary Number Theory
If a non-extremal permutation modulo 105 has more than 40 good slopes and admits the unit-cover shift, then one of its 35-point CRT fibers has width at most three, a bad unit direction, and all unit directions good outside a two-by-three rectangle of the specified form.
theorem good_slopes_105_extract_rectangle (f : Equiv.Perm (ZMod 105)) (hf : ¬ is_extremal_perm 105 f) (hlarge : 40 < (good_slopes 105 f).card) (hcover : ∃ c : ZMod 105, IsUnit c ∧ ∀ m ∈ good_slopes 105 f, IsUnit (m+c)) : ∃ (S : Finset (ZMod 35 × ZMod 35)) (a₁ a₂ : ZMod 5) (t : ZMod 7), S.card = 35 ∧ (∀ x : ZMod 35, (S.filter fun p => p.1 = x).card ≤ 3) ∧ a₁ ≠ 0 ∧ a₂ ≠ 0 ∧ a₁ ≠ a₂ ∧ t ≠ 0 ∧ (∀ b : ZMod 35, IsUnit b → (((ZMod.castHom (by decide : 5 ∣ 35) (ZMod 5) b ≠ a₁) ∧ (ZMod.castHom (by decide : 5 ∣ 35) (ZMod 5) b ≠ a₂)) ∨ ((ZMod.castHom (by decide : 7 ∣ 35) (ZMod 7) b ≠ t) ∧ (ZMod.castHom (by decide : 7 ∣ 35) (ZMod 7) b ≠ 2*t) ∧ (ZMod.castHom (by decide : 7 ∣ 35) (ZMod 7) b ≠ 4*t))) → b ∈ good_slopes_point_directions 35 S) ∧ (∃ b : ZMod 35, IsUnit b ∧ b ∉ good_slopes_point_directions 35 S)
good_slopes_fiber35_anchored_cross_neighborsIn LeanElementary Number Theory
For a 35-point set containing the normalized bad-line anchors with difference 1, 5 or 7 and having at most three points on that line, at least one of the three neighboring directions sharing its residue modulo 7 is bad, and at least two of the five neighboring directions sharing its residue modulo 5 are bad.
theorem good_slopes_fiber35_anchored_cross_neighbors (S : Finset (ZMod 35 × ZMod 35)) (hcard : S.card = 35) (d : ZMod 35) (hd : d = 1 ∨ d = 5 ∨ d = 7) (h0 : (0,0) ∈ S) (h1 : (d,-d) ∈ S) (hline : (S.filter (fun p => p.2 + p.1 = 0)).card ≤ 3) : (∃ a ∈ ({8,22,29} : Finset (ZMod 35)), a ∉ good_slopes_point_directions 35 S) ∧ ((good_slopes_point_directions 35 S).filter (fun a => a ∈ ({6,11,16,26,31} : Finset (ZMod 35)))).card ≤ 3good_slopes_fiber35_rectangle_linear_casesIn LeanElementary Number Theory
No 35-point set containing (0,0) and (1,34) has all unit directions good outside a rectangle whose two residues modulo 5 are 1 and either 2 or 4 and whose three residues modulo 7 are one of {1,2,3}, {1,2,5}, or {1,2,6}.
theorem good_slopes_fiber35_rectangle_linear_cases (S : Finset (ZMod 35 × ZMod 35)) (hcard : S.card = 35) (h0 : (0,0) ∈ S) (h1 : (1,34) ∈ S) (ratio : ℕ) (hratio : ratio = 2 ∨ ratio = 4) (columns : Finset ℕ) (hcolumns : columns = {1,2,3} ∨ columns = {1,2,5} ∨ columns = {1,2,6}) (hgood : ∀ a : ZMod 35, IsUnit a → ¬ ((a.val % 5 = 1 ∨ a.val % 5 = ratio) ∧ a.val % 7 ∈ columns) → a ∈ good_slopes_point_directions 35 S) : Falsegood_slopes_fiber55_bad_neighborsIn LeanElementary Number Theory
For any 55 points over Z/55Z and any bad unit direction, at least three of its twelve other unit directions sharing a residue modulo 5 or modulo 11 are also bad.
theorem good_slopes_fiber55_bad_neighbors (S : Finset (ZMod 55 × ZMod 55)) (hcard : S.card = 55) (a : ZMod 55) (ha : IsUnit a) (hbad : a ∉ good_slopes_point_directions 55 S) : ((good_slopes_point_directions 55 S).filter (fun b => b ≠ a ∧ (b.val % 5 = a.val % 5 ∨ b.val % 11 = a.val % 11))).card ≤ 9
good_slopes_fiber55_colored_gap_structuralIn LeanElementary Number Theory
A three-colored 55-point set over Z/55 with any bad unit direction has at most 32 good unit directions.
theorem good_slopes_fiber55_colored_gap_structural (S : Finset (ZMod 55 × ZMod 55)) (color : (ZMod 55 × ZMod 55) → Fin 3) (hcard : S.card = 55) (hx : ∀ p ∈ S, ∀ q ∈ S, color p = color q → p.1 = q.1 → p = q) (hc : ∀ b : ZMod 55, IsUnit b → ∀ p ∈ S, ∀ q ∈ S, color p = color q → p.2 + b*p.1 = q.2 + b*q.1 → p = q) (hbad : ∃ b : ZMod 55, IsUnit b ∧ b ∉ good_slopes_point_directions 55 S) : (good_slopes_point_directions 55 S).card ≤ 32
good_slopes_fiber55_many_good_rows_fullIn LeanElementary Number Theory
A three-colored 55-point set over Z/55 with at least 33 good unit directions has at least three fully good mod-5 unit rows.
theorem good_slopes_fiber55_many_good_rows_full (S : Finset (ZMod 55 × ZMod 55)) (color : (ZMod 55 × ZMod 55) → Fin 3) (hcard : S.card = 55) (hx : ∀ p ∈ S, ∀ q ∈ S, color p = color q → p.1 = q.1 → p = q) (hc : ∀ b : ZMod 55, IsUnit b → ∀ p ∈ S, ∀ q ∈ S, color p = color q → p.2 + b*p.1 = q.2 + b*q.1 → p = q) (hgood : 33 ≤ (good_slopes_point_directions 55 S).card) : 3 ≤ ((Finset.univ : Finset (ZMod 5)).filter fun a => IsUnit a ∧ ∀ b : ZMod 55, IsUnit b → b.val % 5 = a.val → b ∈ good_slopes_point_directions 55 S).card
good_slopes_fiber55_three_full_rows_force_allIn LeanElementary Number Theory
For a three-colored 55-point set over Z/55, if three of the four mod-5 unit rows are entirely good, all unit directions are good.
theorem good_slopes_fiber55_three_full_rows_force_all (S : Finset (ZMod 55 × ZMod 55)) (color : (ZMod 55 × ZMod 55) → Fin 3) (hcard : S.card = 55) (hx : ∀ p ∈ S, ∀ q ∈ S, color p = color q → p.1 = q.1 → p = q) (hc : ∀ b : ZMod 55, IsUnit b → ∀ p ∈ S, ∀ q ∈ S, color p = color q → p.2 + b*p.1 = q.2 + b*q.1 → p = q) (hrows : 3 ≤ ((Finset.univ : Finset (ZMod 5)).filter fun a => IsUnit a ∧ ∀ b : ZMod 55, IsUnit b → b.val % 5 = a.val → b ∈ good_slopes_point_directions 55 S).card) : ∀ b : ZMod 55, IsUnit b → b ∈ good_slopes_point_directions 55 S
good_slopes_fiber55_unit_gapIn LeanElementary Number Theory
For any 55 points over Z/55Z, if at least one unit direction fails to be injective, then at most 36 of the 40 unit directions are injective.
theorem good_slopes_fiber55_unit_gap (S : Finset (ZMod 55 × ZMod 55)) (hcard : S.card = 55) (hbad : ∃ a : ZMod 55, IsUnit a ∧ a ∉ good_slopes_point_directions 55 S) : (good_slopes_point_directions 55 S).card ≤ 36
good_slopes_field_units_force_axisIn LeanElementary Number Theory
Let K be a field and S a finite set of points in K squared. If y+b*x is injective on S for every nonzero b in K, then all points of S have a common first coordinate or all points have a common second coordinate.
theorem good_slopes_field_units_force_axis (K : Type*) [Field K] [DecidableEq K] (S : Finset (K × K)) (h : ∀ b : K, b ≠ 0 → Set.InjOn (fun p : K × K => p.2 + b*p.1) S) : (∃ x : K, ∀ p ∈ S, p.1 = x) ∨ (∃ y : K, ∀ p ∈ S, p.2 = y)
good_slopes_full_row_column_axis_parameterizationIn LeanElementary Number Theory
Let K and L be finite fields and S a set of |K|·|L| points in (K×L) squared. Suppose all directions with a nonzero K coordinate and L coordinate 1, and all directions with K coordinate 1 and a nonzero L coordinate, are injective on S. Then the pair (yK+xK,yL+xL) labels the points of S uniquely, and there are choices of a horizontal or vertical axis line and an offset for each fiber over each field such that the input coordinates are given by the corresponding axis-line formulas.
theorem good_slopes_full_row_column_axis_parameterization (K L : Type*) [Field K] [Field L] [Fintype K] [Fintype L] [DecidableEq K] [DecidableEq L] (S : Finset ((K × L) × (K × L))) (hcard : S.card = Fintype.card K * Fintype.card L) (hcol : ∀ a : K, a ≠ 0 → Set.InjOn (fun p : (K × L) × (K × L) => (p.2.1 + a*p.1.1, p.2.2 + p.1.2)) S) (hrow : ∀ b : L, b ≠ 0 → Set.InjOn (fun p : (K × L) × (K × L) => (p.2.1 + p.1.1, p.2.2 + b*p.1.2)) S) : ∃ (verticalK : L → Bool) (offsetK : L → K) (verticalL : K → Bool) (offsetL : K → L), (∀ p ∈ S, let s := p.2.1 + p.1.1; let t := p.2.2 + p.1.2; p.1.1 = (if verticalK t then offsetK t else s - offsetK t) ∧ p.1.2 = (if verticalL s then offsetL s else t - offsetL s)) ∧ (∀ (s : K) (t : L), ∃! p : (K × L) × (K × L), p ∈ S ∧ p.2.1 + p.1.1 = s ∧ p.2.2 + p.1.2 = t)
good_slopes_full_row_column_force_axis_fibersIn LeanElementary Number Theory
Let K and L be fields and let S be a finite set of points in (K×L) squared. Suppose all directions whose K coordinate is nonzero and whose L coordinate is 1 are injective on S, and all directions whose K coordinate is 1 and whose L coordinate is nonzero are injective on S. Then every fiber of yL+xL has all of its K-projected points on one horizontal or vertical line, and every fiber of yK+xK has all of its L-projected points on one horizontal or vertical line.
theorem good_slopes_full_row_column_force_axis_fibers (K L : Type*) [Field K] [Field L] [DecidableEq K] [DecidableEq L] (S : Finset ((K × L) × (K × L))) (hcol : ∀ a : K, a ≠ 0 → Set.InjOn (fun p : (K × L) × (K × L) => (p.2.1 + a*p.1.1, p.2.2 + p.1.2)) S) (hrow : ∀ b : L, b ≠ 0 → Set.InjOn (fun p : (K × L) × (K × L) => (p.2.1 + p.1.1, p.2.2 + b*p.1.2)) S) : (∀ t : L, (∃ x : K, ∀ p ∈ S, p.2.2 + p.1.2 = t → p.1.1 = x) ∨ (∃ y : K, ∀ p ∈ S, p.2.2 + p.1.2 = t → p.2.1 = y)) ∧ (∀ s : K, (∃ x : L, ∀ p ∈ S, p.2.1 + p.1.1 = s → p.1.2 = x) ∨ (∃ y : L, ∀ p ∈ S, p.2.1 + p.1.1 = s → p.2.2 = y))
good_slopes_gap105_from_fiber_boundsIn LeanElementary Number Theory
Assume the unit-cover property for permutations modulo 105, the 35-point unit-direction gap of 20, and the three-color 35-point gap of 16 under the indicated color-wise injectivity conditions. Then every non-extremal permutation modulo 105 has at most 40 good slopes.
theorem good_slopes_gap105_from_fiber_bounds (hcover : ∀ f : Equiv.Perm (ZMod 105), ∃ c : ZMod 105, IsUnit c ∧ ∀ m ∈ good_slopes 105 f, IsUnit (m+c)) (hgap : ∀ S : Finset (ZMod 35 × ZMod 35), S.card = 35 → (∃ a : ZMod 35, IsUnit a ∧ a ∉ good_slopes_point_directions 35 S) → (good_slopes_point_directions 35 S).card ≤ 20) (hcolored : ∀ (S : Finset (ZMod 35 × ZMod 35)) (c : (ZMod 35 × ZMod 35) → Fin 3), S.card = 35 → (∀ p ∈ S, ∀ q ∈ S, c p = c q → p.1 = q.1 → p = q) → (∀ a : ZMod 35, IsUnit a → ∀ p ∈ S, ∀ q ∈ S, c p = c q → p.2 + a*p.1 = q.2 + a*q.1 → p = q) → (∃ a : ZMod 35, IsUnit a ∧ a ∉ good_slopes_point_directions 35 S) → (good_slopes_point_directions 35 S).card ≤ 16) (f : Equiv.Perm (ZMod 105)) (hf : ¬ is_extremal_perm 105 f) : (good_slopes 105 f).card ≤ 40
good_slopes_gap_three_primes_conditionalIn LeanElementary Number Theory
For primes 5≤p and q≥2p−1 with 3(p+1)<2q, the conjectured gap for a nonextremal permutation modulo 3pq follows from the two finite-field direction classifications and the unit-cover normalization.
theorem good_slopes_gap_three_primes_conditional (p q : ℕ)
[Fact (Nat.Prime p)] [Fact (Nat.Prime q)] (hp : 5 ≤ p) (hsep : 2*p-1 ≤ q)
(hsize : (p+1)*3 < 2*q) (hdirP : (∀ T : Finset (ZMod p × ZMod p), T.card = p →
(∃ G : Finset (ZMod p), (p+1)/2 ≤ G.card ∧ ∀ a ∈ G, Set.InjOn (fun z : ZMod p × ZMod p => z.2 + a*z.1) T) →
(∃ x : ZMod p, ∀ z ∈ T, z.1 = x) ∨ (∃ a t : ZMod p, ∀ z ∈ T, z.2 + a*z.1 = t))) (hdirQ : (∀ T : Finset (ZMod q × ZMod q), T.card = q →
(∃ G : Finset (ZMod q), (q+1)/2 ≤ G.card ∧ ∀ a ∈ G, Set.InjOn (fun z : ZMod q × ZMod q => z.2 + a*z.1) T) →
(∃ x : ZMod q, ∀ z ∈ T, z.1 = x) ∨ (∃ a t : ZMod q, ∀ z ∈ T, z.2 + a*z.1 = t)))
(f : Equiv.Perm (ZMod (3*(p*q)))) (hf : ¬ is_extremal_perm (3*(p*q)) f)
(hcover : ∃ c : ZMod (3*(p*q)), ∀ m ∈ good_slopes (3*(p*q)) f, IsUnit (m+c)) :
(good_slopes (3*(p*q)) f).card ≤ 2*(p-1)*(q-2)good_slopes_missing_primeIn LeanElementary Number Theory
For every natural number n >= 2, every prime divisor p of n, and every permutation f of ZMod n, the set of good slopes of f misses at least one residue modulo p under the reduction map.
theorem good_slopes_missing_prime (n : ℕ) [NeZero n] (p : ℕ) (hp : p.Prime) (hd : p ∣ n) (f : Equiv.Perm (ZMod n)) : ∃ a : ZMod p, ∀ m ∈ good_slopes n f, ZMod.castHom hd (ZMod p) m ≠ a
good_slopes_missing_prime165In LeanElementary Number Theory
For a permutation modulo 165 and each prime divisor p, some residue modulo p is not attained by any good slope.
theorem good_slopes_missing_prime165 (p : ℕ) [NeZero p] (hp : p = 3 ∨ p = 5 ∨ p = 11) (hd : p ∣ 165) (f : Equiv.Perm (ZMod 165)) : ∃ a : ZMod p, ∀ m ∈ good_slopes 165 f, ZMod.castHom hd (ZMod p) m ≠ a
good_slopes_prime11_six_good_linesIn LeanElementary Number Theory
Any eleven-point set in the affine plane over the field of eleven elements with six good finite directions is a line.
theorem good_slopes_prime11_six_good_lines (S : Finset (ZMod 11 × ZMod 11)) (G : Finset (ZMod 11)) (hcard : S.card = 11) (hgood : 6 ≤ G.card) (hinj : ∀ a ∈ G, Set.InjOn (fun p : ZMod 11 × ZMod 11 => p.2 + a*p.1) S) : (∃ x : ZMod 11, ∀ p ∈ S, p.1 = x) ∨ (∃ a t : ZMod 11, ∀ p ∈ S, p.2 + a*p.1 = t)
good_slopes_rook_bad_shapesIn LeanElementary Number Theory
A nonempty subset of a four-by-six grid with at most seven cells, each having at least three other selected cells in its row or column, is contained in one row or one column, contains a two-by-three or three-by-two rectangle, or contains a cell with at least four selected cells in both its row and its column.
theorem good_slopes_rook_bad_shapes : ∀ B : Finset (Fin 4 × Fin 6), B.Nonempty → B.card ≤ 7 →
(∀ p ∈ B, 3 ≤ (B.filter fun q => q ≠ p ∧ (q.1 = p.1 ∨ q.2 = p.2)).card) →
(∃ row : Fin 4, ∀ p ∈ B, p.1 = row) ∨
(∃ col : Fin 6, ∀ p ∈ B, p.2 = col) ∨
(∃ rows : Finset (Fin 4), ∃ cols : Finset (Fin 6),
rows.card = 2 ∧ cols.card = 3 ∧ rows.product cols ⊆ B) ∨
(∃ rows : Finset (Fin 4), ∃ cols : Finset (Fin 6),
rows.card = 3 ∧ cols.card = 2 ∧ rows.product cols ⊆ B) ∨
(∃ p ∈ B, 4 ≤ (B.filter fun q => q.1 = p.1).card ∧
4 ≤ (B.filter fun q => q.2 = p.2).card)good_slopes_unit_cover_generalIn LeanElementary Number Theory
For every natural number n at least 2 and every permutation f of Z/nZ, there is a unit c modulo n such that m+c is a unit modulo n for every good slope m of f.
theorem good_slopes_unit_cover_general (n : ℕ) [NeZero n] (hn : 2 ≤ n) (f : Equiv.Perm (ZMod n)) : ∃ c : ZMod n, IsUnit c ∧ ∀ m ∈ good_slopes n f, IsUnit (m+c)
good_slopes_unit_cover_mod165In LeanElementary Number Theory
For every permutation modulo 165, a unit c exists such that adding c to each good slope yields a unit modulo 165.
theorem good_slopes_unit_cover_mod165 (f : Equiv.Perm (ZMod 165)) : ∃ c : ZMod 165, IsUnit c ∧ ∀ m ∈ good_slopes 165 f, IsUnit (m+c)
halving_partition_length_le_maxIn LeanElementary Number Theory
Every halving partition of $n$ has length at most $\lfloor \log_2 n \rfloor + s_2(n)$, where $s_2(n)$ is the sum of the binary digits of $n$.
theorem halving_partition_length_le_max (n : ℕ) (p : List ℕ)
(hp : is_halving_partition n p) :
p.length ≤ Nat.log 2 n + (Nat.digits 2 n).sumhalving_partition_max_length_uniqueIn LeanElementary Number Theory
For every integer $n \ge 1$, every halving partition of $n$ has length at most $\lfloor \log_2 n \rfloor + s_2(n)$ (where $s_2(n)$ is the sum of digits in the binary representation of $n$), and there exists a unique halving partition of $n$ with length exactly $\lfloor \log_2 n \rfloor + s_2(n)$.
theorem halving_partition_max_length_unique (n : ℕ) (hn : 1 ≤ n) :
(∀ p : List ℕ, is_halving_partition n p → p.length ≤ Nat.log 2 n + (Nat.digits 2 n).sum) ∧
∃! p : List ℕ, is_halving_partition n p ∧ p.length = Nat.log 2 n + (Nat.digits 2 n).sumhalving_partition_part_ge_div_pow_twoIn LeanElementary Number Theory
In any halving partition $p$ of $n$, the part at 0-based index $i$ is at least $\lfloor n / 2^{i+1} \rfloor$.
theorem halving_partition_part_ge_div_pow_two (n : ℕ) (p : List ℕ)
(hp : is_halving_partition n p) (i : ℕ) (hi : i < p.length) :
n / 2 ^ (i + 1) ≤ p[i]halving_partition_stable_submodule_existsNeeds helpElementary Number Theory
There exists a finitely generated ℤ-submodule N of ℤ^ℕ containing the sequence n ↦ halving_partition_count n that is stable under decimation by 2n and 2n+1.
theorem halving_partition_stable_submodule_exists :
∃ (N : Submodule ℤ (ℕ → ℤ)), N.FG ∧
(fun n => (halving_partition_count n : ℤ)) ∈ N ∧
(∀ g ∈ N, (fun n => g (2 * n)) ∈ N) ∧
(∀ g ∈ N, (fun n => g (2 * n + 1)) ∈ N)hyperbinary_aeval_omega_eq_countsIn LeanElementary Number Theory
Evaluating H_m(z) at ω expresses in terms of the modular counts as (N_0(m) - N_2(m)) + (N_1(m) - N_2(m)) * ω.
theorem hyperbinary_aeval_omega_eq_counts (m : ℕ) :
Polynomial.aeval eisensteinOmega (hyperbinaryLengthPoly m) =
((hyperbinaryCountMod3 m 0 - hyperbinaryCountMod3 m 2 : ℤ) : ℂ) +
((hyperbinaryCountMod3 m 1 - hyperbinaryCountMod3 m 2 : ℤ) : ℂ) * eisensteinOmegahyperbinary_count_mod3_sumIn LeanElementary Number Theory
The sum of the three modular counts N_0(m) + N_1(m) + N_2(m) equals H_m(1).
theorem hyperbinary_count_mod3_sum (m : ℕ) :
hyperbinaryCountMod3 m 0 + hyperbinaryCountMod3 m 1 + hyperbinaryCountMod3 m 2 =
(hyperbinaryLengthPoly m).eval 1hyperbinary_divisibility_by_cyclotomic_threeIn LeanElementary Number Theory
The cyclotomic polynomial 1 + z + z² divides H_m(z) in ℤ[z] if and only if 3 divides the Stern diatomic sequence term s(m+1).
theorem hyperbinary_divisibility_by_cyclotomic_three (m : ℕ) :
Polynomial.cyclotomic 3 ℤ ∣ hyperbinaryLengthPoly m ↔ 3 ∣ sternDiatomic (m + 1)hyperbinary_eval_oneIn LeanElementary Number Theory
Evaluating the hyperbinary length polynomial H_m(z) at z = 1 gives the Stern diatomic sequence term s(m+1).
theorem hyperbinary_eval_one (m : ℕ) :
(hyperbinaryLengthPoly m).eval 1 = (sternDiatomic (m + 1) : ℤ)hyperbinary_expansion_lengths_mod_three_equidistributionIn LeanElementary Number Theory
For every m ≥ 0, evaluating the hyperbinary length polynomial H_m(z) at the primitive cube root of unity ω satisfies H_m(ω) ∈ {0, ±1, ±ω, ±ω²}, the counts N_0(m), N_1(m), N_2(m) of hyperbinary expansions of m modulo 3 differ pairwise by at most 1, and the multiset {N_0(m), N_1(m), N_2(m)} equals {q, q, q} if s(m+1) ≡ 0 mod 3, {q+1, q, q} if s(m+1) ≡ 1 mod 3, and {q+1, q+1, q} if s(m+1) ≡ 2 mod 3, where q = ⌊s(m+1)/3⌋.
theorem hyperbinary_expansion_lengths_mod_three_equidistribution (m : ℕ) :
(Polynomial.aeval eisensteinOmega (hyperbinaryLengthPoly m) ∈
({0, 1, -1, eisensteinOmega, -eisensteinOmega, eisensteinOmega ^ 2, -eisensteinOmega ^ 2} : Set ℂ)) ∧
(∀ r s : Fin 3, |hyperbinaryCountMod3 m r.val - hyperbinaryCountMod3 m s.val| ≤ 1) ∧
(let q : ℤ := sternDiatomic (m + 1) / 3
let ε := sternDiatomic (m + 1) % 3
({hyperbinaryCountMod3 m 0, hyperbinaryCountMod3 m 1, hyperbinaryCountMod3 m 2} : Multiset ℤ) =
if ε = 0 then ({q, q, q} : Multiset ℤ)
else if ε = 1 then ({q + 1, q, q} : Multiset ℤ)
else ({q + 1, q + 1, q} : Multiset ℤ))int_mem_h_fold_sumset_three_eqIn LeanElementary Number Theory
Every element m in the h-fold sumset of {a, a+x, a+y} can be written in the form m = ha + sx + ty with s, t ≥ 0 and s + t ≤ h.
theorem int_mem_h_fold_sumset_three_eq (h : ℕ) (a x y : ℤ)
(m : ℤ) (hm : int_mem_h_fold_sumset h {a, a + x, a + y} m) :
∃ s t : ℕ, s + t ≤ h ∧ m = (h : ℤ) * a + (s : ℤ) * x + (t : ℤ) * yint_vec_gcd_factorization_primitiveIn LeanElementary Number Theory
An integer vector z ∈ ℤ^n with no zero coordinate is a positive integer multiple of a primitive integer vector, which again has no zero coordinate: z = g·u with g > 0 and u primitive.
theorem int_vec_gcd_factorization_primitive (n : ℕ) (z : Fin n → ℤ) (hz : ∀ i, z i ≠ 0) :
∃ (g : ℕ) (u : Fin n → ℤ), 0 < g ∧ is_primitive_int_vec n u ∧ (∀ i, u i ≠ 0) ∧
∀ i, z i = (g : ℤ) * u iint_vec_mem_orthogonal_iff_rat_equationsIn LeanElementary Number Theory
If U is the real span of integer vectors w_1,...,w_k, then an integer vector z lies in U^⊥ iff for every i the rational dot product of w_i and z vanishes.
open Submodule in
theorem int_vec_mem_orthogonal_iff_rat_equations {k n : ℕ} (w : Fin k → Fin n → ℤ)
(U : Submodule ℝ (EuclideanSpace ℝ (Fin n)))
(hU : U = Submodule.span ℝ (Set.range fun i => int_to_euclidean n (w i))) (z : Fin n → ℤ) :
int_to_euclidean n z ∈ Uᗮ ↔ ∀ i, ∑ j, (w i j : ℚ) * (z j : ℚ) = 0is_rational_subspace_finite_int_spanIn LeanElementary Number Theory
If U ⊆ ℝ^n is the real span of some set of integer vectors, then U is the real span of finitely many integer vectors.
theorem is_rational_subspace_finite_int_span (n : ℕ) (U : Submodule ℝ (EuclideanSpace ℝ (Fin n)))
(h : is_rational_subspace n U) :
∃ (k : ℕ) (w : Fin k → Fin n → ℤ), U = Submodule.span ℝ (Set.range fun i => int_to_euclidean n (w i))is_weakly_consecutive_iff_leIn LeanElementary Number Theory
A permutation is weakly consecutive iff the condition holds for all m <= k, making the property bounded and decidable.
theorem is_weakly_consecutive_iff_le {k : ℕ} (σ : Equiv.Perm (Fin k)) :
is_weakly_consecutive σ ↔
∀ (m : ℕ), m ≤ k → ∀ (i j : Fin k), m ∣ (σ i : ℕ) + 1 → (m : ℤ) ∣ (i : ℤ) - (j : ℤ) → m ∣ (σ j : ℕ) + 1krawtchouk_critical_zeros_classificationIn LeanElementary Number Theory
Let $m \in \{3, 4\}$ and let $n, k, \ell$ be positive integers. Then $k + \ell = m + n - 2$ and $P_{m-1}^{k+\ell}(k) = 0$ if and only if, up to interchanging $k$ and $\ell$, one of the following holds: (i) $m = 3$, $n = t^2 - 1$, $k = t(t-1)/2$, $\ell = t(t+1)/2$ for some integer $t \ge 2$; (ii) $m = 4$, $n = 2t - 2$, $k = t$, $\ell = t$ for some integer $t \ge 2$; (iii) $m = 4$, $n = 3t^2 + 2t - 1$, $k = (3t^2 - t)/2$, $\ell = (3t^2 + 5t + 2)/2$ for some integer $t \ge 1$; (iv) $m = 4$, $n = 3s^2 + 4s$, $k = (3s^2 + s)/2$, $\ell = (3s^2 + 7s + 4)/2$ for some integer $s \ge 1$.
theorem krawtchouk_critical_zeros_classification
(m n k ℓ : ℕ) (hm : m = 3 ∨ m = 4)
(hn : 0 < n) (hk : 0 < k) (hℓ : 0 < ℓ) :
(k + ℓ = m + n - 2 ∧ krawtchouk (k + ℓ) (m - 1) k = 0) ↔
((m = 3 ∧ ∃ t ≥ 2, n = t ^ 2 - 1 ∧
((k = t * (t - 1) / 2 ∧ ℓ = t * (t + 1) / 2) ∨
(k = t * (t + 1) / 2 ∧ ℓ = t * (t - 1) / 2))) ∨
(m = 4 ∧ ∃ t ≥ 2, n = 2 * t - 2 ∧ k = t ∧ ℓ = t) ∨
(m = 4 ∧ ∃ t ≥ 1, n = 3 * t ^ 2 + 2 * t - 1 ∧
((k = (3 * t ^ 2 - t) / 2 ∧ ℓ = (3 * t ^ 2 + 5 * t + 2) / 2) ∨
(k = (3 * t ^ 2 + 5 * t + 2) / 2 ∧ ℓ = (3 * t ^ 2 - t) / 2))) ∨
(m = 4 ∧ ∃ s ≥ 1, n = 3 * s ^ 2 + 4 * s ∧
((k = (3 * s ^ 2 + s) / 2 ∧ ℓ = (3 * s ^ 2 + 7 * s + 4) / 2) ∨
(k = (3 * s ^ 2 + 7 * s + 4) / 2 ∧ ℓ = (3 * s ^ 2 + s) / 2))))krawtchouk_critical_zeros_m_fourIn LeanElementary Number Theory
For positive integers $n, k, \ell$ with $k \le \ell$, the conditions $k + \ell = 4 + n - 2$ and $P_3^{k+\ell}(k) = 0$ hold if and only if one of the following holds: (ii) $n = 2t - 2$, $k = t$, $\ell = t$ for some integer $t \ge 2$; (iii) $n = 3t^2 + 2t - 1$, $k = (3t^2 - t)/2$, $\ell = (3t^2 + 5t + 2)/2$ for some integer $t \ge 1$; or (iv) $n = 3s^2 + 4s$, $k = (3s^2 + s)/2$, $\ell = (3s^2 + 7s + 4)/2$ for some integer $s \ge 1$.
theorem krawtchouk_critical_zeros_m_four
(n k ℓ : ℕ) (hn : 0 < n) (hk : 0 < k) (hℓ : 0 < ℓ) (hkℓ : k ≤ ℓ) :
(k + ℓ = 4 + n - 2 ∧ krawtchouk (k + ℓ) 3 k = 0) ↔
((∃ t ≥ 2, n = 2 * t - 2 ∧ k = t ∧ ℓ = t) ∨
(∃ t ≥ 1, n = 3 * t ^ 2 + 2 * t - 1 ∧ k = (3 * t ^ 2 - t) / 2 ∧ ℓ = (3 * t ^ 2 + 5 * t + 2) / 2) ∨
(∃ s ≥ 1, n = 3 * s ^ 2 + 4 * s ∧ k = (3 * s ^ 2 + s) / 2 ∧ ℓ = (3 * s ^ 2 + 7 * s + 4) / 2))krawtchouk_critical_zeros_m_threeIn LeanElementary Number Theory
For positive integers $n, k, \ell$ with $k \le \ell$, the conditions $k + \ell = 3 + n - 2$ and $P_2^{k+\ell}(k) = 0$ hold if and only if $n = t^2 - 1$, $k = t(t-1)/2$, and $\ell = t(t+1)/2$ for some integer $t \ge 2$.
theorem krawtchouk_critical_zeros_m_three
(n k ℓ : ℕ) (hn : 0 < n) (hk : 0 < k) (hℓ : 0 < ℓ) (hkℓ : k ≤ ℓ) :
(k + ℓ = 3 + n - 2 ∧ krawtchouk (k + ℓ) 2 k = 0) ↔
(∃ t ≥ 2, n = t ^ 2 - 1 ∧ k = t * (t - 1) / 2 ∧ ℓ = t * (t + 1) / 2)krawtchouk_three_formulaIn LeanElementary Number Theory
For any natural numbers $k$ and $\ell$, the binary Krawtchouk polynomial of degree 3 satisfies $P_3^{k+\ell}(k) = (\ell - k)((\ell - k)^2 - 3(k + \ell) + 2) / 6$.
theorem krawtchouk_three_formula (k ℓ : ℕ) :
krawtchouk (k + ℓ) 3 k = ((ℓ : ℝ) - (k : ℝ)) * (((ℓ : ℝ) - (k : ℝ)) ^ 2 - 3 * ((k : ℝ) + (ℓ : ℝ)) + 2) / 6krawtchouk_two_formulaIn LeanElementary Number Theory
For any natural numbers $k$ and $\ell$, the binary Krawtchouk polynomial of degree 2 satisfies $P_2^{k+\ell}(k) = ((\ell - k)^2 - (k + \ell)) / 2$.
theorem krawtchouk_two_formula (k ℓ : ℕ) :
krawtchouk (k + ℓ) 2 k = (((ℓ : ℝ) - (k : ℝ)) ^ 2 - ((k : ℝ) + (ℓ : ℝ))) / 2krawtchouk_zero_swap_k_ellIn LeanElementary Number Theory
For $m \in \{3, 4\}$ and natural numbers $k$ and $\ell$, the binary Krawtchouk polynomial vanishing condition $P_{m-1}^{k+\ell}(k) = 0$ is symmetric under interchanging $k$ and $\ell$, that is, $P_{m-1}^{k+\ell}(k) = 0 \iff P_{m-1}^{k+\ell}(\ell) = 0$.
theorem krawtchouk_zero_swap_k_ell
(m k ℓ : ℕ) (hm : m = 3 ∨ m = 4) :
krawtchouk (k + ℓ) (m - 1) k = 0 ↔ krawtchouk (k + ℓ) (m - 1) ℓ = 0leading_unit_a_stepIn LeanElementary Number Theory
For positive integers g ≥ 1 and m ≥ g + 1, the coefficients of A_g satisfy a_m - 2 a_{m-1} + a_{m-(g+1)} = 1.
theorem leading_unit_a_step (g m : ℕ) (hg : 1 ≤ g) (hm : g + 1 ≤ m) :
leading_unit_a g m - 2 * leading_unit_a g (m - 1) + leading_unit_a g (m - (g + 1)) = 1leading_unit_ag_mul_denomIn LeanElementary Number Theory
The formal power series A_g(X) satisfies A_g(X) * ((1 - X)^2 Q_g(X)) = 1.
theorem leading_unit_ag_mul_denom (g : ℕ) :
leading_unit_ag g * ((1 - PowerSeries.X : PowerSeries ℚ) ^ 2 * leading_unit_qg g) = 1leading_unit_brown_condition_of_leIn LeanElementary Number Theory
If (N : ℚ) ≤ leading_unit_m g k, then the Brown condition H(n+1) ≤ 1 + ∑_{i=0}^n H_i holds for all n ≥ 1.
theorem leading_unit_brown_condition_of_le (g k N : ℕ) (hg : 1 ≤ g) (hk : 1 ≤ k) (hN : 1 ≤ N)
(h : (N : ℚ) ≤ leading_unit_m g k) (n : ℕ) (hn : 1 ≤ n) :
leading_unit_h g k N (n + 1) ≤ 1 + ∑ i ∈ Finset.range (n + 1), leading_unit_h g k N ileading_unit_brown_gap_criticalIn LeanElementary Number Theory
At the critical index n = 2g + k + 1, the Brown gap (1 + ∑_{i=0}^n H_i) - H_{n+1} equals (a_{g+k}^{(g)} + 1) - 2^g * N.
theorem leading_unit_brown_gap_critical (g k N : ℕ) (hg : 1 ≤ g) (hk : 1 ≤ k) :
((1 + ∑ i ∈ Finset.range (2 * g + k + 2), leading_unit_h g k N i : ℤ) - leading_unit_h g k N (2 * g + k + 2) : ℚ) =
(leading_unit_a g (g + k) + 1) - (2 : ℚ) ^ g * (N : ℚ)leading_unit_diff_identityIn LeanElementary Number Theory
For g, k ≥ 1, (a_{g+1+k}^{(g+1)} + 1) - 2 (a_{g+k}^{(g)} + 1) = 2 (a_{g+k}^{(g+1)} - a_{g+k}^{(g)}) - a_{k-1}^{(g+1)}.
theorem leading_unit_diff_identity (g k : ℕ) (hg : 1 ≤ g) (hk : 1 ≤ k) :
leading_unit_a (g + 1) (g + 1 + k) + 1 - 2 * (leading_unit_a g (g + k) + 1) =
2 * (leading_unit_a (g + 1) (g + k) - leading_unit_a g (g + k)) - leading_unit_a (g + 1) (k - 1)leading_unit_exact_completeness_thresholdIn LeanElementary Number Theory
For all natural numbers g, k, N with 1 ≤ g, 1 ≤ k, and 1 ≤ N, the integer sequence leading_unit_h g k N is complete (satisfies is_complete_sequence) if and only if (N : ℚ) ≤ leading_unit_m g k.
theorem leading_unit_exact_completeness_threshold (g k N : ℕ) (hg : 1 ≤ g) (hk : 1 ≤ k) (hN : 1 ≤ N) :
is_complete_sequence (leading_unit_h g k N) ↔ (N : ℚ) ≤ leading_unit_m g kleading_unit_h_monoIn LeanElementary Number Theory
The sequence leading_unit_h g k N is nondecreasing for all n ≥ 1.
theorem leading_unit_h_mono (g k N : ℕ) (hg : 1 ≤ g) (hk : 1 ≤ k) (hN : 1 ≤ N) (n : ℕ) (hn : 1 ≤ n) :
leading_unit_h g k N n ≤ leading_unit_h g k N (n + 1)leading_unit_h_posIn LeanElementary Number Theory
The sequence leading_unit_h g k N is strictly positive (at least 1) for all n ≥ 1.
theorem leading_unit_h_pos (g k N : ℕ) (hg : 1 ≤ g) (hk : 1 ≤ k) (hN : 1 ≤ N) (n : ℕ) (hn : 1 ≤ n) :
1 ≤ leading_unit_h g k N nleading_unit_monotonicityIn LeanElementary Number Theory
For all natural numbers g, k with 1 ≤ g and 1 ≤ k, the unrounded completeness thresholds satisfy leading_unit_m g k < leading_unit_m (g + 1) k, and consequently, for all natural numbers N ≥ 1, if the integer sequence leading_unit_h g k N is complete, then leading_unit_h (g + 1) k N is also complete.
theorem leading_unit_monotonicity (g k : ℕ) (hg : 1 ≤ g) (hk : 1 ≤ k) :
leading_unit_m g k < leading_unit_m (g + 1) k ∧
(∀ N : ℕ, 1 ≤ N → is_complete_sequence (leading_unit_h g k N) → is_complete_sequence (leading_unit_h (g + 1) k N))leading_unit_qg_one_sub_XIn LeanElementary Number Theory
For g ≥ 1, (1 - X) * Q_g(X) = 1 - 2X + X^{g+1}.
theorem leading_unit_qg_one_sub_X (g : ℕ) (hg : 1 ≤ g) :
(1 - PowerSeries.X : PowerSeries ℚ) * leading_unit_qg g = 1 - 2 * PowerSeries.X + PowerSeries.X ^ (g + 1)leading_unit_qg_subIn LeanElementary Number Theory
The difference between consecutive polynomials Q_g(X) and Q_{g+1}(X) is X^{g+1}.
theorem leading_unit_qg_sub (g : ℕ) :
leading_unit_qg g - leading_unit_qg (g + 1) = (PowerSeries.X : PowerSeries ℚ) ^ (g + 1)leading_unit_threshold_diff_posIn LeanElementary Number Theory
For positive integers g, k ≥ 1, the completeness threshold numerators satisfy 2 * (a_{g+k}^{(g)} + 1) < a_{g+1+k}^{(g+1)} + 1.
theorem leading_unit_threshold_diff_pos (g k : ℕ) (hg : 1 ≤ g) (hk : 1 ≤ k) :
2 * (leading_unit_a g (g + k) + 1) < leading_unit_a (g + 1) (g + 1 + k) + 1leading_unit_threshold_strict_monoIn LeanElementary Number Theory
For all positive integers g, k ≥ 1, the unrounded completeness thresholds satisfy M_{g+1,k} > M_{g,k}.
theorem leading_unit_threshold_strict_mono (g k : ℕ) (hg : 1 ≤ g) (hk : 1 ≤ k) :
leading_unit_m g k < leading_unit_m (g + 1) klinear_subset_sum_avoiding_limit_regularIn LeanElementary Number Theory
For every real $c \ge 1$, the ratio $f_c(n) / n$ converges to $c - 1/2$ as $n \to \infty$.
theorem linear_subset_sum_avoiding_limit_regular (c : ℝ) (hc : 1 ≤ c) : Filter.Tendsto (fun n : ℕ => ((linear_max_subset_sum_avoiding_size c n : ℝ) / (n : ℝ))) Filter.atTop (nhds (c - 1 / 2))
linear_subset_sum_avoiding_max_card_regularIn LeanElementary Number Theory
For every real $c \ge 1$ and every integer $n \ge 1$, the maximum cardinality $f_c(n)$ of a subset of $\{1, \dots, \lfloor cn \rfloor\}$ avoiding subset sum $n$ equals $\lfloor cn \rfloor - \lceil n/2 \rceil$.
theorem linear_subset_sum_avoiding_max_card_regular (c : ℝ) (n : ℕ) (hc : 1 ≤ c) (hn : 1 ≤ n) : linear_max_subset_sum_avoiding_size c n = ⌊c * (n : ℝ)⌋₊ - ⌈(n : ℝ) / 2⌉₊
matchable_condition_le_of_dvdIn LeanElementary Number Theory
For natural numbers d, n, and p, if 0 < d, d divides n, p is prime, and p ≤ padicValNat p d, then (padicValNat p d + 1 - p) * (Nat.divisors (d / p ^ padicValNat p d)).card ≤ (padicValNat p n + 1 - p) * (Nat.divisors (n / p ^ padicValNat p n)).card.
theorem matchable_condition_le_of_dvd {d n p : ℕ} (hd : 0 < d) (hdn : d ∣ n) (hp : p.Prime)
(hpd : p ≤ padicValNat p d) :
(padicValNat p d + 1 - p) * (Nat.divisors (d / p ^ padicValNat p d)).card ≤
(padicValNat p n + 1 - p) * (Nat.divisors (n / p ^ padicValNat p n)).cardmatrix_det_eq_prod_diag_of_le_zeroIn LeanElementary Number Theory
If A i j = 0 whenever not (i ≤ j), then det A is the product of the diagonal entries.
theorem matrix_det_eq_prod_diag_of_le_zero {R : Type*} [CommRing R] {α : Type*} [PartialOrder α]
[Fintype α] [DecidableEq α] (A : Matrix α α R) (hA : ∀ i j : α, ¬ i ≤ j → A i j = 0) :
A.det = ∏ i, A i imatrix_exists_perm_of_det_ne_zeroIn LeanElementary Number Theory
A square matrix over a field whose determinant is nonzero has a permutation σ of the index set such that every entry M i (σ i) is nonzero.
theorem matrix_exists_perm_of_det_ne_zero {n : Nat} {R : Type*} [Field R] (M : Matrix (Fin n) (Fin n) R) (hM : M.det ≠ 0) : ∃ σ : Equiv.Perm (Fin n), ∀ i, M i (σ i) ≠ 0moebius_odd_squarefree_indicatorIn LeanElementary Number Theory
For any positive integer $d$, the odd square-free indicator $\mu^*(d)$ is equal to the sum of the Möbius function $\mu(k)$ over all positive divisors $k$ of $d$ such that $k^2$ divides $d$ and $k$ is odd.
open Finset in
theorem moebius_odd_squarefree_indicator (d : ℕ) (hd : 0 < d) :
odd_squarefree_indicator d =
∑ k ∈ (Nat.divisors d).filter (fun k => k ^ 2 ∣ d ∧ Odd k), ArithmeticFunction.moebius kmoebius_odd_squarefree_sum_eq_powersetIn LeanElementary Number Theory
For any positive integer $d$, the sum of $\mu(k)$ over divisors $k$ of $d$ such that $k^2 \mid d$ and $k$ is odd equals the alternating sum $\sum_{t \subseteq S} (-1)^{|t|}$, where $S = \{p \in d.\text{primeFactors} : p \neq 2 \wedge p^2 \mid d\}$.
open Finset in
theorem moebius_odd_squarefree_sum_eq_powerset (d : ℕ) (hd : 0 < d) :
∑ k ∈ (Nat.divisors d).filter (fun k => k ^ 2 ∣ d ∧ Odd k), ArithmeticFunction.moebius k =
∑ t ∈ ((d.primeFactors).filter (fun p => p ≠ 2 ∧ p ^ 2 ∣ d)).powerset, (-1 : ℤ) ^ t.cardmultiset_is_minimal_zero_sum_merge_pairIn LeanElementary Number Theory
Replacing two selected terms a and b of a minimal zero-sum multiset by the single term a+b preserves minimal zero-sum status. The two terms may have the same value.
theorem multiset_is_minimal_zero_sum_merge_pair {G : Type*} [AddCommMonoid G]
(s : Multiset G) (a b : G)
(h : multiset_is_minimal_zero_sum (a ::ₘ b ::ₘ s)) :
multiset_is_minimal_zero_sum ((a+b) ::ₘ s)nat_card_Iic_factorizationIn LeanElementary Number Theory
For m > 0 the number of exponent vectors k with k ≤ m.factorization equals the number of divisors of m.
theorem nat_card_Iic_factorization (m : Nat) (hm : 0 < m) :
Fintype.card ↥(Finset.Iic m.factorization) = (Nat.divisors m).cardnat_iic_factorization_divisors_equivIn LeanElementary Number Theory
For m > 0 there is an equivalence between the exponent vectors k ≤ m.factorization and the divisors of m, whose value at k is the product of p^(k p) over the support of k.
theorem nat_iic_factorization_divisors_equiv (m : Nat) (hm : 0 < m) :
∃ e : ↥(Finset.Iic m.factorization) ≃ Nat.divisors m,
∀ k : ↥(Finset.Iic m.factorization), ((e k : Nat.divisors m) : Nat) = k.val.prod (fun p e => p ^ e)nat_least_prime_not_dvd_le_two_mulIn LeanElementary Number Theory
For m ≥ 1 the smallest prime not dividing m is at most 2m: by Bertrand there is a prime p with m < p ≤ 2m, and such a p cannot divide m.
theorem nat_least_prime_not_dvd_le_two_mul (m : ℕ) (hm : 1 ≤ m) :
nat_least_prime_not_dvd m ≤ 2 * mnat_least_prime_not_dvd_spec_and_boundsIn LeanElementary Number Theory
For m ≥ 2 the number q(m) is prime, does not divide m, and satisfies q(m) ≤ 2m and q(m) ≤ m squared.
theorem nat_least_prime_not_dvd_spec_and_bounds (m : ℕ) (hm : 2 ≤ m) :
Nat.Prime (nat_least_prime_not_dvd m) ∧ ¬ (nat_least_prime_not_dvd m) ∣ m ∧
nat_least_prime_not_dvd m ≤ 2 * m ∧ nat_least_prime_not_dvd m ≤ m^2not_avoids_subset_sum_of_memIn LeanElementary Number Theory
If a finite set of natural numbers contains $n$, then it does not avoid $n$.
lemma not_avoids_subset_sum_of_mem {A : Finset ℕ} {n : ℕ} (hA : n ∈ A) : ¬ avoids_subset_sum A nop_153_cosine_polynomial_small_constantIn LeanElementary Number Theory
For a degree-2 intersective integer polynomial g strictly positive on the positive integers and every sufficiently large N there are a modulus M with 2N < M <= 4N, a finite set S of positive integers at most N each of which is a value g(k) with k > 0, and weights phi on {0} \u222a S \u222a (-S), such that the trigonometric polynomial F(n) = sum_x phi(x)*exp(2*pi*I*x*n/M) has sum of coefficients 1, has nonnegative real part at every n = 0, ..., M-1, and has constant term Re phi(0) <= exp(-c*sqrt(log N * log log N)).
theorem op_153_cosine_polynomial_small_constant (g : Polynomial ℤ)
(hdeg : g.degree = 2) (hint : is_intersective g)
(hpos : ∀ n : ℕ, 0 < n → 0 < g.eval (n : ℤ)) :
∃ c > 0, ∃ N₀ : ℕ, ∀ N : ℕ, N₀ ≤ N →
∃ (M : ℕ) (S : Finset ℕ) (φ : ℤ → ℂ), 2 * N < M ∧ M ≤ 4 * N ∧
(∀ s ∈ S, 0 < s ∧ s ≤ N ∧ ∃ k : ℕ, 0 < k ∧ g.eval (k : ℤ) = (s : ℤ)) ∧
(∀ x : ℤ, x ≠ 0 → (∀ s ∈ S, x ≠ (s : ℤ) ∧ x ≠ -(s : ℤ)) → φ x = 0) ∧
(∑ x ∈ (insert (0 : ℤ) (S.image (fun s : ℕ => (s : ℤ)) ∪ S.image (fun s : ℕ => -(s : ℤ)))), φ x) = 1 ∧
(∀ n ∈ Finset.range M, 0 ≤ (∑ x ∈ (insert (0 : ℤ) (S.image (fun s : ℕ => (s : ℤ)) ∪ S.image (fun s : ℕ => -(s : ℤ)))),
φ x * Complex.exp (2 * Real.pi * Complex.I * (x : ℂ) * (n : ℂ) / (M : ℂ))).re) ∧
(φ 0).re ≤ Real.exp (-c * Real.sqrt (Real.log (N : ℝ) * Real.log (Real.log (N : ℝ))))op_153_eventually_subexp_bound_positive_quadraticIn LeanElementary Number Theory
For a degree-2 intersective integer polynomial g that is strictly positive on all positive integers, there are constants c, C > 0 and a threshold N₀ such that for every N ≥ N₀, every subset A ⊆ {1, ..., N} whose distinct elements never differ by a value g(n) with n a positive integer has cardinality at most C·N·exp(−c√(log N · log log N)).
theorem op_153_eventually_subexp_bound_positive_quadratic (g : Polynomial ℤ)
(hdeg : g.degree = 2) (hint : is_intersective g)
(hpos : ∀ n : ℕ, 0 < n → 0 < g.eval (n : ℤ)) :
∃ c > 0, ∃ C > 0, ∃ N₀ : ℕ, ∀ N : ℕ, N₀ ≤ N →
∀ A ⊆ Finset.Icc 1 N,
(∀ a ∈ A, ∀ b ∈ A, a ≠ b → ¬ ∃ n : ℕ, 0 < n ∧ (a : ℤ) - b = g.eval (n : ℤ)) →
(A.card : ℝ) ≤ C * (N : ℝ) * Real.exp (-c * Real.sqrt (Real.log (N : ℝ) * Real.log (Real.log (N : ℝ))))op_153_quadratic_coefficientsIn LeanElementary Number Theory
A degree-2 integer polynomial that is strictly positive on the positive integers has the form a·x² + b·x + c with a > 0.
theorem op_153_quadratic_coefficients (g : Polynomial ℤ) (hdeg : g.degree = 2)
(hpos : ∀ n : ℕ, 0 < n → 0 < g.eval (n : ℤ)) :
∃ a b c : ℤ, 0 < a ∧ ∀ x : ℤ, g.eval x = a * x ^ 2 + b * x + cop_153_quadratic_cosine_construction_normal_formIn LeanElementary Number Theory
The analytic core: for integers a > 0, b, c whose quadratic is intersective, and every large N, there are M in (2N, 4N], a set S of values a·k²+b·k+c (k > 0) at most N, and weights φ supported on {0} ∪ S ∪ (-S) with total weight 1, nonnegative real part at every n < M, and constant term at most exp(-c'√(log N · log log N)). This is the same content as the target, but with the degree-2 polynomial and its positivity hypothesis replaced by an explicit quadratic, so that only the analysis is visible; the target follows from it and op_153_quadratic_coefficients by pure bookkeeping. It is flagged open: the construction (arXiv:2610.07765, Theorem 1.1 and Proposition 5.1) needs signed averaging over smooth dilations plus a complete-sum sector estimate, for which Mathlib has no machinery.
theorem op_153_quadratic_cosine_construction_normal_form (a b c : ℤ) (ha : 0 < a)
(hint : is_intersective (Polynomial.C c + Polynomial.C b * Polynomial.X + Polynomial.C a * Polynomial.X ^ 2)) :
∃ c' > 0, ∃ N₀ : ℕ, ∀ N : ℕ, N₀ ≤ N →
∃ (M : ℕ) (S : Finset ℕ) (φ : ℤ → ℂ), 2 * N < M ∧ M ≤ 4 * N ∧
(∀ s ∈ S, 0 < s ∧ s ≤ N ∧ ∃ k : ℕ, 0 < k ∧ a * (k : ℤ) ^ 2 + b * (k : ℤ) + c = (s : ℤ)) ∧
(∀ x : ℤ, x ≠ 0 → (∀ s ∈ S, x ≠ (s : ℤ) ∧ x ≠ -(s : ℤ)) → φ x = 0) ∧
(∑ x ∈ (insert (0 : ℤ) (S.image (fun s : ℕ => (s : ℤ)) ∪ S.image (fun s : ℕ => -(s : ℤ)))), φ x) = 1 ∧
(∀ n ∈ Finset.range M, 0 ≤ (∑ x ∈ (insert (0 : ℤ) (S.image (fun s : ℕ => (s : ℤ)) ∪ S.image (fun s : ℕ => -(s : ℤ)))),
φ x * Complex.exp (2 * Real.pi * Complex.I * (x : ℂ) * (n : ℂ) / (M : ℂ))).re) ∧
(φ 0).re ≤ Real.exp (-c' * Real.sqrt (Real.log (N : ℝ) * Real.log (Real.log (N : ℝ))))op_153_quadratic_gauss_sum_coprimeIn LeanElementary Number Theory
For a degree-2 integer polynomial g there is C > 0 such that for every q ≥ 1 and every t coprime to q, the complete sum Σ_{k<q} exp(2πi·t·g(k)/q) has modulus at most C·√q.
theorem op_153_quadratic_gauss_sum_coprime (g : Polynomial ℤ) (hdeg : g.degree = 2) :
∃ C : ℝ, 0 < C ∧ ∀ (q : ℕ), 0 < q → ∀ t : ℤ, Nat.Coprime t.natAbs q →
‖∑ k ∈ Finset.range q,
Complex.exp (2 * Real.pi * Complex.I * (t : ℂ) * (((g.eval (k : ℤ) : ℤ) : ℂ)) / (q : ℂ))‖
≤ C * Real.sqrt (q : ℝ)op_153_quadratic_gauss_sum_gcdIn LeanElementary Number Theory
For a degree-2 integer polynomial g there is C > 0 such that for every q ≥ 1 and every integer t, the complete sum Σ_{k<q} exp(2πi·t·g(k)/q) has modulus at most C·√(q·gcd(t,q)).
theorem op_153_quadratic_gauss_sum_gcd (g : Polynomial ℤ) (hdeg : g.degree = 2) :
∃ C : ℝ, 0 < C ∧ ∀ (q : ℕ), 0 < q → ∀ t : ℤ,
‖∑ k ∈ Finset.range q,
Complex.exp (2 * Real.pi * Complex.I * (t : ℂ) * (((g.eval (k : ℤ) : ℤ) : ℂ)) / (q : ℂ))‖
≤ C * Real.sqrt ((q : ℝ) * ((Int.gcd t (q : ℤ) : ℕ) : ℝ))op_153_quadratic_gauss_sum_second_differenceIn LeanElementary Number Theory
For integers A, B, C, q > 0 and t, the squared modulus of the complete sum Σ_{k<q} exp(2πi·t·(Ak²+Bk+C)/q) is at most q·gcd(2tA, q).
theorem op_153_quadratic_gauss_sum_second_difference (A B C : ℤ) (q : ℕ) (hq : 0 < q) (t : ℤ) :
‖∑ k ∈ Finset.range q,
Complex.exp (2 * Real.pi * Complex.I * (t : ℂ)
* (((A * (k : ℤ) ^ 2 + B * (k : ℤ) + C : ℤ)) : ℂ) / (q : ℂ))‖ ^ 2
≤ (q : ℝ) * ((Int.gcd (2 * t * A) (q : ℤ) : ℕ) : ℝ)op_153_re_fourier_sum_eq_cosine_sumIn LeanElementary Number Theory
If all weights are real, the real part of the trigonometric sum Σ_x φ(x)·exp(2πi·x·n/M) is the cosine sum Σ_x φ(x)·cos(2π·x·n/M).
theorem op_153_re_fourier_sum_eq_cosine_sum (M n : ℕ) (T : Finset ℤ) (φ : ℤ → ℝ) :
(∑ x ∈ T, (φ x : ℂ) * Complex.exp (2 * Real.pi * Complex.I * (x : ℂ) * (n : ℂ) / (M : ℂ))).re
= ∑ x ∈ T, φ x * Real.cos (2 * Real.pi * (x : ℝ) * (n : ℝ) / (M : ℝ))op_153_three_point_cosine_witnessIn LeanElementary Number Theory
For any modulus M and any s > 0 there are weights supported on {0, s, -s} with total weight 1, nonnegative real part at every n < M, and constant term 2/3. Instantiating s ≤ N and 2N < M < 4N these are admissible data for the target's constraint bundle, with 2/3 in place of exp(-c√(log N · log log N)).
theorem op_153_three_point_cosine_witness (M s : ℕ) (hs : 0 < s) :
∃ φ : ℤ → ℂ,
(∀ x : ℤ, x ≠ 0 → x ≠ (s : ℤ) → x ≠ -(s : ℤ) → φ x = 0) ∧
(∑ x ∈ ({(0:ℤ), (s:ℤ), -(s:ℤ)} : Finset ℤ), φ x) = 1 ∧
(∀ n ∈ Finset.range M,
0 ≤ (∑ x ∈ ({(0:ℤ), (s:ℤ), -(s:ℤ)} : Finset ℤ),
φ x * Complex.exp (2 * Real.pi * Complex.I * (x : ℂ) * (n : ℂ) / (M : ℂ))).re) ∧
(φ 0).re = 2/3perm_cycle_gcd_count_eq_sum_moebiusIn LeanElementary Number Theory
Möbius inversion over the divisors of n/g (equivalently, inversion of $b_m(n) = \sum_{m \mid h} C(n,h)$) expresses the number of permutations whose cycle-length gcd is exactly g as $\sum_{j \mid n/g} \mu(j)\, b_{gj}(n)$, where $b_m(n)$ counts the permutations whose cycle-length gcd is a multiple of $m$.
theorem perm_cycle_gcd_count_eq_sum_moebius (n g : ℕ) (hg : 0 < g) (hgn : g ∣ n) :
(perm_cycle_gcd_count n g : ℤ)
= ∑ j ∈ (n / g).divisors, (ArithmeticFunction.moebius j : ℤ) * (perm_cycle_gcd_mult_count n (j * g) : ℤ)perm_cycle_gcd_count_modEq_neg_mult_count_primeIn LeanElementary Number Theory
For a prime p dividing n, C(n,1) ≡ -(number of permutations of Fin n with all cycle lengths divisible by p) modulo p.
theorem perm_cycle_gcd_count_modEq_neg_mult_count_prime (n p : ℕ) (hn : 0 < n) (hp : p.Prime) (hpn : p ∣ n) :
((perm_cycle_gcd_count n 1 : ℤ) ≡ (-(perm_cycle_gcd_mult_count n p : ℤ)) [ZMOD p])perm_cycle_gcd_divisibility_and_coprimalityIn LeanElementary Number Theory
For each natural number n with n at least 4, both of the following conclusions hold. First, for every natural number g dividing n and satisfying n/g at least 3, n squared minus 1 divides C(n,g). Second, independently of g, gcd(C(n,1),n) equals 1. Here C(n,g) is the number of permutations of Fin n whose full cycle lengths have greatest common divisor g, with every fixed point counted as a cycle of length 1.
theorem perm_cycle_gcd_divisibility_and_coprimality (n : ℕ) (hn : 4 ≤ n) :
(∀ g : ℕ, g ∣ n → 3 ≤ n / g → n ^ 2 - 1 ∣ perm_cycle_gcd_count n g) ∧
Nat.gcd (perm_cycle_gcd_count n 1) n = 1perm_cycle_gcd_dvd_cardIn LeanElementary Number Theory
The gcd of the cycle lengths of a permutation of a finite type divides the cardinality of that type, because it divides every cycle length and hence their sum (the fixed points contributing the remaining 1s).
theorem perm_cycle_gcd_dvd_card {α : Type*} [Fintype α] [DecidableEq α] (σ : Equiv.Perm α) : perm_cycle_gcd σ ∣ Fintype.card αperm_cycle_gcd_dvd_predIn LeanElementary Number Theory
Let $n \\ge 2$ and let $g$ be a divisor of $n$. Then $n - 1$ divides $C(n, g)$, the number of permutations of $\{1, \\dots, n\}$ whose cycle lengths have greatest common divisor $g$.
theorem perm_cycle_gcd_dvd_pred (n g : ℕ) (hn : 2 ≤ n) (hg : g ∣ n) :
n - 1 ∣ perm_cycle_gcd_count n gperm_cycle_gcd_dvd_sq_sub_oneIn LeanElementary Number Theory
Let $n \\ge 4$ and let $g$ be a divisor of $n$ such that $n/g \\ge 3$. Then $n^2 - 1$ divides $C(n, g)$, the number of permutations of $\{1, \\dots, n\}$ whose cycle lengths have greatest common divisor $g$.
theorem perm_cycle_gcd_dvd_sq_sub_one (n g : ℕ) (hn : 4 ≤ n) (hg : g ∣ n) (hkg : 3 ≤ n / g) :
n ^ 2 - 1 ∣ perm_cycle_gcd_count n gperm_cycle_gcd_dvd_succIn LeanElementary Number Theory
Let $g$ be a divisor of $n$ such that $n/g \\ge 3$. Then $n + 1$ divides $C(n, g)$, the number of permutations of $\{1, \\dots, n\}$ whose cycle lengths have greatest common divisor $g$.
theorem perm_cycle_gcd_dvd_succ (n g : ℕ) (hg : g ∣ n) (hkg : 3 ≤ n / g) :
n + 1 ∣ perm_cycle_gcd_count n gperm_cycle_gcd_mult_count_closed_formIn LeanElementary Number Theory
The number of permutations of Fin (d*k) all of whose cycle lengths are divisible by d is $(dk)! \prod_{j<k}(dj+1) \big/ (d^k k!)$, stated division-free as $b\cdot d^k k! = (dk)! \prod_{j<k}(dj+1)$. This is Lemma 6.4 of the source paper (arXiv:2610.40342, proved in Appendix A.11.5 via the exponential formula; the exponential formula is replaced here by the elementary cycle-stripping recursion).
theorem perm_cycle_gcd_mult_count_closed_form (d k : ℕ) (hd : 0 < d) :
perm_cycle_gcd_mult_count (d * k) d * (d ^ k * k.factorial) = (d * k).factorial * ∏ i ∈ Finset.range k, (d * i + 1)perm_cycle_gcd_mult_count_closed_form_stepIn LeanElementary Number Theory
The candidate closed form $k \mapsto (dk)!\prod_{j<k}(dj+1)/(d^k k!)$ satisfies the cycle-stripping recursion of perm_cycle_gcd_mult_count_recurrence, stated over $\mathbb{Q}$: $(dk)!\prod_{j<k}(dj+1)/(d^k k!) = \sum_{j<k} \binom{dk-1}{d(j+1)-1}(d(j+1)-1)! \cdot \frac{(d(k-j-1))!\prod_{i<k-j-1}(di+1)}{d^{k-j-1}(k-j-1)!}$.
theorem perm_cycle_gcd_mult_count_closed_form_step (d k : ℕ) (hd : 0 < d) (hk : 0 < k) :
((d * k).factorial : ℚ) * ((∏ i ∈ Finset.range k, (d * i + 1) : ℕ) : ℚ) / ((d ^ k * k.factorial : ℕ) : ℚ)
= ∑ j ∈ Finset.range k,
((Nat.choose (d * k - 1) (d * (j + 1) - 1) * (d * (j + 1) - 1).factorial : ℕ) : ℚ)
* (((d * (k - (j + 1))).factorial : ℚ) * ((∏ i ∈ Finset.range (k - (j + 1)), (d * i + 1) : ℕ) : ℚ)
/ ((d ^ (k - (j + 1)) * (k - (j + 1)).factorial : ℕ) : ℚ))perm_cycle_gcd_mult_count_dvd_of_ne_primeIn LeanElementary Number Theory
For a prime p dividing n and a squarefree divisor d of n with d ≠ p, the number of permutations of Fin n all of whose cycle lengths are divisible by d is divisible by p.
theorem perm_cycle_gcd_mult_count_dvd_of_ne_prime (n p d : ℕ) (hn : 0 < n) (hp : p.Prime) (hpn : p ∣ n)
(hd : d ∈ n.divisors) (hdne : d ≠ p) (hsf : Squarefree d) :
p ∣ perm_cycle_gcd_mult_count n dperm_cycle_gcd_mult_count_dvd_predIn LeanElementary Number Theory
If g divides n ≥ 2 and g > 0, then n-1 divides the number of permutations of {1, ..., n} all of whose cycle lengths are divisible by g (equivalently, whose cycle-length gcd is a multiple of g). This is Theorem 6.1(a) of arXiv:2610.40342 for a single term of its Möbius sum.
theorem perm_cycle_gcd_mult_count_dvd_pred (n g : ℕ) (hn : 2 ≤ n) (hg : 0 < g) (hgn : g ∣ n) :
n - 1 ∣ perm_cycle_gcd_mult_count n gperm_cycle_gcd_mult_count_eq_prodIn LeanElementary Number Theory
The number of permutations of Fin(d*k) all of whose cycle lengths are divisible by d equals (∏ of i in {1,…,dk} with d∤i, i) · (∏_{j<k} (d*j+1)). This is the integer product form P_d·Q_d of the closed form.
theorem perm_cycle_gcd_mult_count_eq_prod (d k : ℕ) (hd : 0 < d) :
perm_cycle_gcd_mult_count (d * k) d
= (∏ i ∈ (Finset.Icc 1 (d * k)).filter (fun i => ¬ d ∣ i), i)
* (∏ j ∈ Finset.range k, (d * j + 1))perm_cycle_gcd_mult_count_eq_sumIn LeanElementary Number Theory
Partitioning the permutations whose cycle-length gcd is a multiple of m according to the exact value k of that gcd: the value k is necessarily a divisor of n and a multiple of m, so the multiples-of-m count equals the sum of the exact counts over k ranging over the divisors of n that are multiples of m.
theorem perm_cycle_gcd_mult_count_eq_sum (n m : ℕ) (hn : 0 < n) (hm : 0 < m) :
perm_cycle_gcd_mult_count n m = ∑ k ∈ n.divisors.filter (fun k => m ∣ k), perm_cycle_gcd_count n kperm_cycle_gcd_mult_count_eq_zero_of_not_dvdIn LeanElementary Number Theory
If m does not divide n then no permutation of Fin n has cycle-length gcd divisible by m, because the gcd always divides n; so the count is 0.
theorem perm_cycle_gcd_mult_count_eq_zero_of_not_dvd (n m : ℕ) (h : ¬ m ∣ n) :
perm_cycle_gcd_mult_count n m = 0perm_cycle_gcd_mult_count_one_eq_factorialIn LeanElementary Number Theory
For m = 1 the condition is vacuous, so the number of permutations of Fin n whose cycle-length gcd is a multiple of 1 is n!.
theorem perm_cycle_gcd_mult_count_one_eq_factorial (n : ℕ) :
perm_cycle_gcd_mult_count n 1 = n.factorialperm_cycle_gcd_mult_count_prime_not_dvdIn LeanElementary Number Theory
For a prime p dividing n, the number of permutations of Fin n with every cycle length divisible by p is NOT divisible by p.
theorem perm_cycle_gcd_mult_count_prime_not_dvd (n p : ℕ) (hn : 0 < n) (hp : p.Prime) (hpn : p ∣ n) :
¬ p ∣ perm_cycle_gcd_mult_count n pperm_cycle_gcd_mult_count_recurrenceIn LeanElementary Number Theory
Removing the cycle through one fixed point of Fin (d*k) gives the recursion $b_d(dk) = \sum_{j=0}^{k-1} \binom{dk-1}{d(j+1)-1}\,(d(j+1)-1)!\, b_d(d(k-j-1))$ for the number b_d of permutations all of whose cycle lengths are divisible by d.
theorem perm_cycle_gcd_mult_count_recurrence (d k : ℕ) (hd : 0 < d) (hk : 0 < k) :
perm_cycle_gcd_mult_count (d * k) d
= ∑ j ∈ Finset.range k, (Nat.choose (d * k - 1) (d * (j + 1) - 1)) * (d * (j + 1) - 1).factorial * perm_cycle_gcd_mult_count (d * (k - (j + 1))) dperm_cycle_gcd_one_coprimeIn LeanElementary Number Theory
Let $n \\ge 4$. The number $C(n, 1)$ of permutations of $\{1, \\dots, n\}$ whose cycle lengths have greatest common divisor 1 satisfies $\\gcd(C(n, 1), n) = 1$.
theorem perm_cycle_gcd_one_coprime (n : ℕ) (hn : 4 ≤ n) :
(perm_cycle_gcd_count n 1).Coprime nplrs_leading_unit_exact_completeness_thresholdIn LeanElementary Number Theory
For all natural numbers g, k, N with 1 ≤ g, 1 ≤ k, and 1 ≤ N, the positive linear recurrence sequence associated with coefficient list [1^g, 0^k, N] is complete if and only if (N : ℚ) ≤ leading_unit_m g k.
theorem plrs_leading_unit_exact_completeness_threshold (g k N : ℕ) (hg : 1 ≤ g) (hk : 1 ≤ k) (hN : 1 ≤ N) :
is_complete_sequence (plrs_seq (List.replicate g 1 ++ List.replicate k 0 ++ [N])) ↔ (N : ℚ) ≤ leading_unit_m g kplrs_seq_one_N_le_two_of_completeIn LeanElementary Number Theory
If the recurrence sequence plrs_seq [1, N] is complete with 1 ≤ N, then N ≤ 2, because for N ≥ 3 the value 4 cannot be represented as a sum of terms.
theorem plrs_seq_one_N_le_two_of_complete (N : ℕ) (hN : 1 ≤ N)
(hcomp : is_complete_sequence (plrs_seq [1, N])) : N ≤ 2plrs_seq_one_one_one_completeIn LeanElementary Number Theory
The recurrence sequence plrs_seq [1, 1, 1] is complete.
theorem plrs_seq_one_one_one_complete : is_complete_sequence (plrs_seq [1, 1, 1])
plrs_seq_one_one_two_completeIn LeanElementary Number Theory
The recurrence sequence plrs_seq [1, 1, 2] is complete.
theorem plrs_seq_one_one_two_complete : is_complete_sequence (plrs_seq [1, 1, 2])
postage_stamp_basis_range_le_of_card_threeIn LeanElementary Number Theory
For every h ≥ 1 and every 3-element set A of integers (negative elements allowed), the h-range n_h(A) -- the largest n with [0, n] contained in the h-fold sumset hA -- is at most ⌊(h² + 6h + 1)/4⌋.
theorem postage_stamp_basis_range_le_of_card_three (h : ℕ) (hh : 1 ≤ h) (A : Finset ℤ)
(hA : A.card = 3) :
postage_stamp_basis_range h A ≤ (h ^ 2 + 6 * h + 1) / 4postage_stamp_basis_range_three_core_boundIn LeanElementary Number Theory
If 0 < x < y, gcd(x, y) = 1, y ≤ h+1, and [0, N] is contained in the h-fold sumset of {a, a+x, a+y}, then N ≤ (h² + 6h + 1)/4.
theorem postage_stamp_basis_range_three_core_bound (h : ℕ) (hh : 1 ≤ h) (a x y : ℤ)
(hx : 0 < x) (hy : x < y) (hcop : IsCoprime x y) (hyh : y ≤ (h : ℤ) + 1)
(N : ℕ) (hsub : ∀ m : ℕ, m ≤ N → int_mem_h_fold_sumset h {a, a + x, a + y} m) :
N ≤ (h ^ 2 + 6 * h + 1) / 4postage_stamp_lemma_two_twoIn LeanElementary Number Theory
If [0, N] is contained in the h-fold sumset of {a, a+x, a+y} with 0 < x < y and N ≥ h+1, then x and y are coprime, and y ≤ h + 1.
theorem postage_stamp_lemma_two_two (h : ℕ) (a x y : ℤ) (hx : 0 < x) (hy : x < y)
(N : ℕ) (hN : h + 1 ≤ N)
(hsub : ∀ m : ℕ, m ≤ N → int_mem_h_fold_sumset h {a, a + x, a + y} m) :
IsCoprime x y ∧ y ≤ (h : ℤ) + 1postage_stamp_number_neg_two_eq_of_mod_four_eq_zeroIn LeanElementary Number Theory
If h ≥ 8 and h ≡ 0 (mod 4), then n♭_h(2) = n_h(2) = (h² + 6h)/4.
theorem postage_stamp_number_neg_two_eq_of_mod_four_eq_zero (h : ℕ) (hh : 8 ≤ h) (h4 : h % 4 = 0) :
postage_stamp_number_neg h 2 = (h ^ 2 + 6 * h) / 4 ∧ postage_stamp_number h 2 = (h ^ 2 + 6 * h) / 4pow_sub_one_eq_sum_chooseIn LeanElementary Number Theory
The product over the support of F of (y p − 1)^(k p) expands as the sum over all exponent vectors j ≤ k of the product over p of binom(k p, j p) y p^(j p) (−1)^(k p − j p).
theorem pow_sub_one_eq_sum_choose (F k : Nat →₀ Nat) (hk : k ≤ F) (y : Nat → Complex) :
∏ p ∈ F.support, (y p - 1) ^ (k p)
= ∑ j ∈ Finset.Iic k, ∏ p ∈ F.support,
((k p).choose (j p) : Complex) * (y p) ^ (j p) * (-1 : Complex) ^ (k p - j p)rat_row_kernel_finrank_ge_twoIn LeanElementary Number Theory
Let w_1,...,w_k be integer vectors in ℤ^n whose real span U ⊆ ℝ^n has dimension at most n - 2, with n ≥ 2. Then the space of rational vectors orthogonal to all of them has ℚ-dimension at least 2.
theorem rat_row_kernel_finrank_ge_two {k n : ℕ} (hn : 2 ≤ n) (w : Fin k → Fin n → ℤ)
(U : Submodule ℝ (EuclideanSpace ℝ (Fin n)))
(hU : U = Submodule.span ℝ (Set.range fun i => int_to_euclidean n (w i)))
(h_dim : Module.finrank ℝ U ≤ n - 2) :
2 ≤ Module.finrank ℚ (rat_row_kernel w)rat_subspace_has_vector_outside_spanIn LeanElementary Number Theory
A ℚ-subspace of ℚ^n of dimension at least 2 contains a vector outside ℚ·y₀ for any prescribed y₀.
theorem rat_subspace_has_vector_outside_span {n : ℕ} (V : Submodule ℚ (Fin n → ℚ))
(hV : 2 ≤ Module.finrank ℚ V) (y₀ : Fin n → ℚ) : ∃ y ∈ V, y ∉ Submodule.span ℚ {y₀}restricted_base_ell_partition_count_oneIn LeanElementary Number Theory
For any integers k >= 1 and ell >= 2, the restricted base-ell partition count of 1 is 1.
theorem restricted_base_ell_partition_count_one (k ℓ : ℕ) (hk : 1 ≤ k) (hℓ : 2 ≤ ℓ) :
restricted_base_ell_partition_count k ℓ 1 = 1restricted_base_ell_partition_count_zeroIn LeanElementary Number Theory
For any natural numbers $k$ and $\ell$ with $\ell \ge 2$, the restricted base-$\ell$ partition count of $0$ with bound $k$ is $1$.
theorem restricted_base_ell_partition_count_zero (k ℓ : ℕ) (hℓ : 2 ≤ ℓ) :
restricted_base_ell_partition_count k ℓ 0 = 1restricted_base_ell_partition_lt_succ_of_not_dvdIn LeanElementary Number Theory
For integers k, ell >= 2, if ell does not divide k + 1, then the restricted base-ell partition count of k + 1 is strictly less than the restricted base-ell partition count of k.
theorem restricted_base_ell_partition_lt_succ_of_not_dvd (k ℓ : ℕ) (hk : 2 ≤ k) (hℓ : 2 ≤ ℓ)
(hdiv : ¬ ℓ ∣ k + 1) :
restricted_base_ell_partition_count k ℓ (k + 1) < restricted_base_ell_partition_count k ℓ krestricted_base_ell_partition_monotone_iff_and_not_strict_monoIn LeanElementary Number Theory
For integers k, ell >= 2, the restricted base-ell partition function n |-> restricted_base_ell_partition_count k ell n is monotone if and only if ell divides k + 1, and it is never strictly monotone.
theorem restricted_base_ell_partition_monotone_iff_and_not_strict_mono (k ℓ : ℕ) (hk : 2 ≤ k) (hℓ : 2 ≤ ℓ) :
(Monotone (restricted_base_ell_partition_count k ℓ) ↔ ℓ ∣ k + 1) ∧
¬ StrictMono (restricted_base_ell_partition_count k ℓ)restricted_base_ell_partition_monotone_of_dvdIn LeanElementary Number Theory
For integers k, ell >= 2, if ell divides k + 1, then the sequence n |-> restricted_base_ell_partition_count k ell n is monotone.
theorem restricted_base_ell_partition_monotone_of_dvd (k ℓ : ℕ) (hk : 2 ≤ k) (hℓ : 2 ≤ ℓ)
(hdiv : ℓ ∣ k + 1) :
Monotone (restricted_base_ell_partition_count k ℓ)restricted_base_ell_partition_not_eventually_log_convexIn LeanElementary Number Theory
Let k, ℓ ≥ 2 be integers with k ≠ ℓ - 1. Then the sequence n ↦ b_{k,ℓ}(n) is not eventually log-convex; that is, there does not exist n₀ such that b_{k,ℓ}(n)² ≤ b_{k,ℓ}(n - 1) * b_{k,ℓ}(n + 1) for all n ≥ n₀.
theorem restricted_base_ell_partition_not_eventually_log_convex
(k ℓ : ℕ) (hk : 2 ≤ k) (hℓ : 2 ≤ ℓ) (hne : k ≠ ℓ - 1) :
¬ ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n →
(restricted_base_ell_partition k ℓ n) ^ 2 ≤
restricted_base_ell_partition k ℓ (n - 1) * restricted_base_ell_partition k ℓ (n + 1)restricted_base_ell_partition_not_eventually_log_convex_of_gtIn LeanElementary Number Theory
Let k, ℓ ≥ 2 be integers with k > ℓ - 1. Then the sequence n ↦ b_{k,ℓ}(n) is not eventually log-convex; that is, there does not exist n₀ such that b_{k,ℓ}(n)² ≤ b_{k,ℓ}(n - 1) * b_{k,ℓ}(n + 1) for all n ≥ n₀.
theorem restricted_base_ell_partition_not_eventually_log_convex_of_gt
(k ℓ : ℕ) (hk : 2 ≤ k) (hℓ : 2 ≤ ℓ) (hgt : ℓ - 1 < k) :
¬ ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n →
(restricted_base_ell_partition k ℓ n) ^ 2 ≤
restricted_base_ell_partition k ℓ (n - 1) * restricted_base_ell_partition k ℓ (n + 1)restricted_base_ell_partition_not_eventually_log_convex_of_ltIn LeanElementary Number Theory
Let k, ℓ ≥ 2 be integers with k < ℓ - 1. Then the sequence n ↦ b_{k,ℓ}(n) is not eventually log-convex; that is, there does not exist n₀ such that b_{k,ℓ}(n)² ≤ b_{k,ℓ}(n - 1) * b_{k,ℓ}(n + 1) for all n ≥ n₀.
theorem restricted_base_ell_partition_not_eventually_log_convex_of_lt
(k ℓ : ℕ) (hk : 2 ≤ k) (hℓ : 2 ≤ ℓ) (hlt : k < ℓ - 1) :
¬ ∃ n₀ : ℕ, ∀ n : ℕ, n₀ ≤ n →
(restricted_base_ell_partition k ℓ n) ^ 2 ≤
restricted_base_ell_partition k ℓ (n - 1) * restricted_base_ell_partition k ℓ (n + 1)restricted_base_ell_partition_not_monotone_of_not_dvdIn LeanElementary Number Theory
For integers k, ell >= 2, if ell does not divide k + 1, then the sequence n |-> restricted_base_ell_partition_count k ell n is not monotone.
theorem restricted_base_ell_partition_not_monotone_of_not_dvd (k ℓ : ℕ) (hk : 2 ≤ k) (hℓ : 2 ≤ ℓ)
(hdiv : ¬ ℓ ∣ k + 1) :
¬ Monotone (restricted_base_ell_partition_count k ℓ)restricted_base_ell_partition_not_strict_monoIn LeanElementary Number Theory
For integers k, ell >= 2, the restricted base-ell partition function n |-> restricted_base_ell_partition_count k ell n is not strictly monotone.
theorem restricted_base_ell_partition_not_strict_mono (k ℓ : ℕ) (hk : 2 ≤ k) (hℓ : 2 ≤ ℓ) :
¬ StrictMono (restricted_base_ell_partition_count k ℓ)restricted_cycle_global_gcd_eq_one_param_gcd_3_6In LeanElementary Number Theory
For r = 3 and n = 6 the global and one-parameter gcds agree (both equal 120).
theorem restricted_cycle_global_gcd_eq_one_param_gcd_3_6 : restricted_cycle_global_gcd 3 6 = restricted_cycle_one_param_gcd 3 6
restricted_cycle_one_param_gcd_three_factorizationIn LeanElementary Number Theory
Theorem 5.1 of arXiv:2610.40342 at r = 3: for n ≥ 5 the one-parameter gcd factors as the falling factorial (n-1)(n-2)(n-3) times a 3-smooth number 2^a·3^b.
theorem restricted_cycle_one_param_gcd_three_factorization (n : ℕ) (hn : 5 ≤ n) : ∃ a b : ℕ, restricted_cycle_one_param_gcd 3 n = (n - 1) * (n - 2) * (n - 3) * 2 ^ a * 3 ^ b
restricted_cycle_perms_count_recurrenceIn LeanElementary Number Theory
Cycle-stripping recurrence ((2.1) of arXiv:2610.40342): for n ≥ 1, the number a_S(n) of permutations of Fin n with all cycle lengths outside S equals the sum, over allowed cycle lengths m ∈ [1,n]∖S, of ((n-1)!/(n-m)!)·a_S(n-m), obtained by stripping off the cycle through a fixed basepoint.
theorem restricted_cycle_perms_count_recurrence (n : ℕ) (S : Finset ℕ) (hn : 0 < n) : restricted_cycle_perms_count n S = Finset.sum ((Finset.Icc 1 n).filter (fun m => m ∉ S)) (fun m => (n - 1).factorial / (n - m).factorial * restricted_cycle_perms_count (n - m) S)
subset_sum_avoiding_card_le_regularIn LeanElementary Number Theory
For integers $1 \le n \le M$, every subset of $\{1, \dots, M\}$ avoiding subset sum $n$ has cardinality at most $M - \lceil n/2 \rceil$.
lemma subset_sum_avoiding_card_le_regular (M n : ℕ) (hn : 1 ≤ n) (hM : n ≤ M) (A : Finset ℕ) (hA : A ⊆ Finset.Icc 1 M) (havoid : avoids_subset_sum A n) : A.card ≤ M - ⌈(n : ℝ) / 2⌉₊
subset_sum_avoiding_max_card_regularIn LeanElementary Number Theory
For all integers $1 \le n \le M$, the maximum cardinality $F(M, n)$ of a subset of $\{1, \dots, M\}$ avoiding subset sum $n$ is equal to $M - \lceil n/2 \rceil$.
theorem subset_sum_avoiding_max_card_regular (M n : ℕ) (hn : 1 ≤ n) (hM : n ≤ M) : max_subset_sum_avoiding_size M n = M - ⌈(n : ℝ) / 2⌉₊
sum_div_pow_two_eq_sub_binary_digit_sumIn LeanElementary Number Theory
For every natural number $n$, the sum of $\lfloor n / 2^i \rfloor$ for $i$ from $1$ to $\lfloor \log_2 n \rfloor$ equals $n$ minus the sum of the digits in the binary representation of $n$.
open BigOperators in
theorem sum_div_pow_two_eq_sub_binary_digit_sum (n : ℕ) :
∑ i ∈ Finset.Icc 1 (Nat.log 2 n), n / 2 ^ i = n - (Nat.digits 2 n).sumthree_power_dvd_restricted_cycle_perms_countIn LeanElementary Number Theory
The 3-primary part of the one-parameter gcd divides a_S(n) for every excluded set S = {1,2,3} ∪ T, for n ≥ 5 outside the exceptional class n ≥ 111, n ≡ 30 (mod 81). This is the p = 3 half of Proposition 11.3(iv) at r = 3 and the open core of Question 14.10 / OP-746.
theorem three_power_dvd_restricted_cycle_perms_count (n : ℕ) (hn : 5 ≤ n) (h : ¬ (111 ≤ n ∧ n % 81 = 30)) (e : ℕ) (he : 3 ^ e ∣ restricted_cycle_one_param_gcd 3 n) (S : Finset ℕ) (hS : S ∈ restricted_cycle_excluded_family 3 n) : 3 ^ e ∣ restricted_cycle_perms_count n S
two_mul_le_four_mul_sq_subIn LeanElementary Number Theory
For m ≥ 2, 2m is at most 4m² − q(m), where q(m) is the smallest prime not dividing m.
theorem two_mul_le_four_mul_sq_sub (m : ℕ) (hm : 2 ≤ m) :
2 * m ≤ 4 * m ^ 2 - nat_least_prime_not_dvd mtwo_mul_sub_one_le_four_mul_sq_subIn LeanElementary Number Theory
For m at least two, 2m - 1 is at most 4m squared minus the smallest prime not dividing m.
theorem two_mul_sub_one_le_four_mul_sq_sub (m : ℕ) (hm : 2 ≤ m) :
2*m - 1 ≤ 4*m^2 - nat_least_prime_not_dvd mtwo_power_dvd_restricted_cycle_perms_countIn LeanElementary Number Theory
The 2-primary part of the one-parameter gcd divides a_S(n) = restricted_cycle_perms_count n S for every excluded set S = {1,2,3} ∪ T, for n ≥ 5 (the p = 2 half of Proposition 11.3(iv) at r = 3).
theorem two_power_dvd_restricted_cycle_perms_count (n : ℕ) (hn : 5 ≤ n) (e : ℕ) (he : 2 ^ e ∣ restricted_cycle_one_param_gcd 3 n) (S : Finset ℕ) (hS : S ∈ restricted_cycle_excluded_family 3 n) : 2 ^ e ∣ restricted_cycle_perms_count n S
view_obstruction_unresolved_node_infinite_witnessesIn LeanElementary Number Theory
Let U be a rational subspace of ℝ^n with dim U ≤ n - 2 such that U^⊥ contains an integer vector with no zero coordinate, and let T > 0. If the offset δ_U^2 satisfies T ≤ δ_U^2, then the set of primitive vectors v ∈ ℤ^n with strictly positive coordinates satisfying view_obstruction_offset n U ≤ d_n(v) is infinite.
open Submodule in
theorem view_obstruction_unresolved_node_infinite_witnesses
(n : ℕ) (U : Submodule ℝ (EuclideanSpace ℝ (Fin n)))
(h_rat : is_rational_subspace n U)
(h_dim : Module.finrank ℝ U ≤ n - 2)
(h_nz : ∃ z : Fin n → ℤ, int_to_euclidean n z ∈ Uᗮ ∧ ∀ i, z i ≠ 0)
(T : ℝ) (hT : 0 < T) (h_offset : T ≤ view_obstruction_offset n U) :
{v : Fin n → ℤ | (∀ i, 0 < v i) ∧ is_primitive_int_vec n v ∧
view_obstruction_offset n U ≤ view_obstruction_ray_dist n v}.Infiniteview_obstruction_witness_set_infinite_of_independent_pairIn LeanElementary Number Theory
If z and s are integer vectors in U^⊥, z has no zero coordinate, and s is not on the real line through z, then there are infinitely many primitive integer vectors v with strictly positive coordinates such that δ_U^2 ≤ d_n(v).
open Submodule in
theorem view_obstruction_witness_set_infinite_of_independent_pair
(n : ℕ) (U : Submodule ℝ (EuclideanSpace ℝ (Fin n))) (z s : Fin n → ℤ)
(hz : int_to_euclidean n z ∈ Uᗮ) (hs : int_to_euclidean n s ∈ Uᗮ)
(hz0 : ∀ i, z i ≠ 0)
(hind : int_to_euclidean n s ∉ Submodule.span ℝ {int_to_euclidean n z}) :
{v : Fin n → ℤ | (∀ i, 0 < v i) ∧ is_primitive_int_vec n v ∧
view_obstruction_offset n U ≤ view_obstruction_ray_dist n v}.Infiniteweakly_consecutive_dvd_iff_modIn LeanElementary Number Theory
Lemma 2.2 of arXiv:2401.09497: the positions holding multiples of m form a single residue class modulo m.
theorem weakly_consecutive_dvd_iff_mod {k : ℕ} (σ : Equiv.Perm (Fin k))
(hσ : is_weakly_consecutive σ) {m : ℕ} (hm : 0 < m) (hmk : m ≤ k)
{i : Fin k} (hi : m ∣ (σ i : ℕ) + 1) (j : Fin k) :
m ∣ (σ j : ℕ) + 1 ↔ (m : ℤ) ∣ (i : ℤ) - (j : ℤ)weakly_consecutive_interior_one_neighbors_evenIn LeanElementary Number Theory
If 1 is at an interior position i, both adjacent positions i-1 and i+1 must hold even values.
theorem weakly_consecutive_interior_one_neighbors_even {k : ℕ} (σ : Equiv.Perm (Fin k))
(hσ : is_weakly_consecutive σ) (i : Fin k) (hi : (σ i : ℕ) = 0)
(h0 : 0 < (i : ℕ)) (hk : (i : ℕ) + 1 < k) :
2 ∣ (σ ⟨(i : ℕ) - 1, by omega⟩ : ℕ) + 1 ∧ 2 ∣ (σ ⟨(i : ℕ) + 1, by omega⟩ : ℕ) + 1weakly_consecutive_mod_geIn LeanElementary Number Theory
Any position i holding a multiple of m satisfies k % m <= i % m, ensuring the residue class has size exactly floor(k/m).
theorem weakly_consecutive_mod_ge {k : ℕ} (σ : Equiv.Perm (Fin k))
(hσ : is_weakly_consecutive σ) {m : ℕ} (hm : 0 < m) (hmk : m ≤ k)
{i : Fin k} (hi : m ∣ (σ i : ℕ) + 1) :
k % m ≤ (i : ℕ) % mzero_sum_constant_s_star_eqIn LeanElementary Number Theory
For every odd prime $p$, the zero-sum constant $\mathsf{s}_p^*$ is equal to $2p + 1$.
theorem zero_sum_constant_s_star_eq (p : ℕ) (hp : p.Prime) (hp_odd : p ≠ 2) :
zero_sum_constant_s_star p = 2 * p + 1zero_sum_constant_s_star_upper_boundIn LeanElementary Number Theory
For every odd prime $p$, every multiset $W$ of size $2p + 1$ of units in $\mathbb{Z}/p^2\mathbb{Z}$ has a sub-multiset $T \le W$ of cardinality $p$ with (T.sum : ZMod (p^2)).val % p = 0 and (T.sum : ZMod (p^2)).val % p^2 ≠ 0.
theorem zero_sum_constant_s_star_upper_bound (p : ℕ) (hp : p.Prime) (hp_odd : p ≠ 2)
(W : Multiset (ZMod (p ^ 2))) (hW_card : W.card = 2 * p + 1) (hW_unit : ∀ x ∈ W, IsUnit x) :
∃ T ≤ W, T.card = p ∧ T.sum.val % p = 0 ∧ T.sum.val % p ^ 2 ≠ 0zero_sum_constant_s_star_upper_bound_count_vector_coreIn LeanElementary Number Theory
Let $p$ be an odd prime and let $n : \mathbb{Z}/p\mathbb{Z} \to \mathbb{N}$ count the terms of a sequence of $2p+1$ nonzero residues, i.e. $n(0) = 0$ and $\sum_r n(r) = 2p+1$. Then there is a profile $t \le n$ of total mass $p$ whose weighted sum $\sum_r t(r)\,r$ vanishes in $\mathbb{Z}/p\mathbb{Z}$, which moreover uses some class only partially ($0 < t(r) < n(r)$).
theorem zero_sum_constant_s_star_upper_bound_count_vector_core (p : ℕ) [NeZero p] (hp : p.Prime) (hp_odd : p ≠ 2)
(n : ZMod p → ℕ) (h0 : n 0 = 0) (hsum : ∑ r : ZMod p, n r = 2 * p + 1) :
∃ t : ZMod p → ℕ, (∀ r : ZMod p, t r ≤ n r) ∧ (∑ r : ZMod p, t r = p) ∧
(∑ r : ZMod p, (t r : ZMod p) * r = 0) ∧
∃ r : ZMod p, 0 < t r ∧ t r < n rzero_sum_constant_s_star_upper_bound_residue_partitionIn LeanElementary Number Theory
The residue classes modulo $p$ partition a multiset $W$ of units of $\mathbb{Z}/p^2\mathbb{Z}$: the cardinalities of the fibres of $x \mapsto x \bmod p$ sum to W.card, and the fibre over $0$ is empty.
theorem zero_sum_constant_s_star_upper_bound_residue_partition (p : ℕ) [NeZero p] (hp : p.Prime)
(W : Multiset (ZMod (p ^ 2))) (hW_unit : ∀ x ∈ W, IsUnit x) :
(∑ r : ZMod p, (W.filter fun x => (ZMod.cast x : ZMod p) = r).card = W.card) ∧
(W.filter fun x => (ZMod.cast x : ZMod p) = 0).card = 0zero_sum_constant_s_star_upper_bound_subset_of_countsIn LeanElementary Number Theory
If a profile $t$ of total mass $p$ with vanishing weighted sum fits inside the residue-class counts of a multiset $W$ of units of $\mathbb{Z}/p^2\mathbb{Z}$ and uses some class only partially, then $W$ has a sub-multiset $T$ of cardinality $p$ whose sum reduces to $0$ modulo $p$ but is a nonzero element of $\mathbb{Z}/p^2\mathbb{Z}$.
theorem zero_sum_constant_s_star_upper_bound_subset_of_counts (p : ℕ) [NeZero p] (hp : p.Prime)
(W : Multiset (ZMod (p ^ 2))) (t : ZMod p → ℕ)
(hle : ∀ r : ZMod p, t r ≤ (W.filter fun x => (ZMod.cast x : ZMod p) = r).card)
(hcard : ∑ r : ZMod p, t r = p) (hzero : ∑ r : ZMod p, (t r : ZMod p) * r = 0)
(hpart : ∃ r : ZMod p, 0 < t r ∧
t r < (W.filter fun x => (ZMod.cast x : ZMod p) = r).card) :
∃ T ≤ W, T.card = p ∧ (ZMod.cast T.sum : ZMod p) = 0 ∧ T.sum ≠ 0zmod_chinese_remainder_primesIn LeanElementary Number Theory
Given prescribed residues r_p in ZMod p for each prime divisor p of n, there exists an element c in ZMod n reducing to r_p modulo p for all prime divisors p of n.
theorem zmod_chinese_remainder_primes (n : ℕ) [NeZero n] (r : (p : ℕ) → p.Prime → p ∣ n → ZMod p) : ∃ c : ZMod n, ∀ (p : ℕ) (hp : p.Prime) (hd : p ∣ n), ZMod.castHom hd (ZMod p) c = r p hp hd
zmod_isUnit_iff_castHom_ne_zero_all_primeIn LeanElementary Number Theory
An element x of ZMod n is a unit if and only if its reduction modulo each prime divisor p of n is nonzero.
theorem zmod_isUnit_iff_castHom_ne_zero_all_prime (n : ℕ) [NeZero n] (x : ZMod n) : IsUnit x ↔ ∀ (p : ℕ) (hp : p.Prime) (hd : p ∣ n), ZMod.castHom hd (ZMod p) x ≠ 0
zmod_pow_two_val_mod_criterionIn LeanElementary Number Theory
For a prime $p$ and $x \in \mathbb{Z}/p^2\mathbb{Z}$, the reduction of $x$ modulo $p$ vanishes exactly when x.val % p = 0, and x.val % p^2 is nonzero exactly when x ≠ 0.
theorem zmod_pow_two_val_mod_criterion (p : ℕ) (hp : p.Prime) (x : ZMod (p ^ 2)) :
((ZMod.cast x : ZMod p) = 0 ↔ x.val % p = 0) ∧ (x.val % p ^ 2 ≠ 0 ↔ x ≠ 0)triangle_homothet_average_containmentIn LeanConvex Analysis
Let $P \subset \mathbb{R}^2$ be a finite set of at least 2 points in general position. The average over all pairs $(p, q) \in P.\text{offDiag}$ of the number of points in $(P \cap \text{triangle\_homothet}(p, q)) \setminus \{p, q\}$, given by $(1 / (|P|(|P|-1))) \sum_{(p,q) \in P.\text{offDiag}} |(P \cap \text{triangle\_homothet}(p, q)) \setminus \{p, q\}|$, is at least $(|P|-7)/12$.
theorem triangle_homothet_average_containment (P : Finset (ℝ × ℝ))
(hgen : triangle_general_position P) (hn : 2 ≤ P.card) :
open scoped Classical in
(1 / ((P.card : ℝ) * ((P.card : ℝ) - 1))) *
∑ pair ∈ P.offDiag,
(((P.filter (· ∈ triangle_homothet pair.1 pair.2) \ {pair.1, pair.2}).card : ℝ)) ≥
((P.card : ℝ) - 7) / 12triangle_homothet_containmentIn LeanConvex Analysis
Let $P \subset \mathbb{R}^2$ be a finite set in general position with respect to the triangle. Then there exists a pair of distinct points $p, q \in P$ such that any triangle homothet $\triangle(a,b,c)$ containing both $p$ and $q$ contains at least $(|P|-7)/12$ other points of $P$.
open Classical in
theorem triangle_homothet_containment (P : Finset (ℝ × ℝ))
(hgen : triangle_general_position P) :
∃ p ∈ P, ∃ q ∈ P, p ≠ q ∧
∀ a b c : ℝ, p ∈ canonical_triangle a b c → q ∈ canonical_triangle a b c →
(P.card - 7 : ℝ) / 12 ≤
((P.filter (fun r => r ∈ canonical_triangle a b c ∧ r ≠ p ∧ r ≠ q)).card : ℝ)triangle_homothet_subset_canonicalIn LeanConvex Analysis
Let $a, b, c \in \mathbb{R}$ and $p, q \in \mathbb{R}^2$. If $p$ and $q$ both belong to $\triangle(a,b,c)$, then the minimal homothet $T(p,q)$ is a subset of $\triangle(a,b,c)$.
theorem triangle_homothet_subset_canonical (a b c : ℝ) (p q : ℝ × ℝ)
(hp : p ∈ canonical_triangle a b c) (hq : q ∈ canonical_triangle a b c) :
triangle_homothet p q ⊆ canonical_triangle a b ctriangle_homothet_sum_containmentIn LeanConvex Analysis
Let $P \subset \mathbb{R}^2$ be a finite set of at least 2 points in general position. The sum over all pairs $(p, q) \in P.\text{offDiag}$ of the number of points in $(P \cap \text{triangle\_homothet}(p, q)) \setminus \{p, q\}$ is at least $(|P|(|P|-1)(|P|-7))/12$.
theorem triangle_homothet_sum_containment (P : Finset (ℝ × ℝ))
(hgen : triangle_general_position P) (hn : 2 ≤ P.card) :
open scoped Classical in
(∑ pair ∈ P.offDiag,
(((P.filter (· ∈ triangle_homothet pair.1 pair.2) \ {pair.1, pair.2}).card : ℝ))) ≥
((P.card : ℝ) * ((P.card : ℝ) - 1) * ((P.card : ℝ) - 7)) / 12triangle_minimal_homothet_containmentIn LeanConvex Analysis
Let $P \subset \mathbb{R}^2$ be a finite set in general position with respect to the triangle. Then there exist distinct points $p, q \in P$ such that the minimal homothet $T(p,q)$ contains at least $(|P|-7)/12$ points of $P$ distinct from $p$ and $q$.
open Classical in
theorem triangle_minimal_homothet_containment (P : Finset (ℝ × ℝ))
(hgen : triangle_general_position P) :
∃ p ∈ P, ∃ q ∈ P, p ≠ q ∧
(P.card - 7 : ℝ) / 12 ≤
((P.filter (fun r => r ∈ triangle_homothet p q ∧ r ≠ p ∧ r ≠ q)).card : ℝ)finset_sum_eq_choose_two_iffIn LeanInteger & Polyhedral Optimization
A finite set T of natural numbers satisfies ∑ T = card T * (card T - 1) / 2 if and only if T = {0, 1, …, card T - 1}.
theorem finset_sum_eq_choose_two_iff (T : Finset ℕ) : T.sum id = T.card.choose 2 ↔ T = Finset.range T.card
matrix_has_psd_factorization_monoIn LeanInteger & Polyhedral Optimization
If a real matrix M has a positive semidefinite factorization of size r₁ and r₁ ≤ r₂, then M has a positive semidefinite factorization of size r₂.
theorem matrix_has_psd_factorization_mono {m n : Type*} (M : Matrix m n ℝ) {r₁ r₂ : ℕ} (hle : r₁ ≤ r₂) (h : matrix_has_psd_factorization M r₁) : matrix_has_psd_factorization M r₂matrix_psd_factorization_zero_entry_rank_add_leIn LeanInteger & Polyhedral Optimization
In a size-r PSD factorization M_ij = tr(A_i B_j) with all factors positive semidefinite, every zero entry M_ij = 0 forces rank A_i + rank B_j ≤ r.
theorem matrix_psd_factorization_zero_entry_rank_add_le {m n : Type*} {M : Matrix m n ℝ} {r : ℕ} {A : m → Matrix (Fin r) (Fin r) ℝ} {B : n → Matrix (Fin r) (Fin r) ℝ} (hA : ∀ i, (A i).PosSemidef) (hB : ∀ j, (B j).PosSemidef) (hM : ∀ i j, M i j = (A i * B j).trace) {i : m} {j : n} (h : M i j = 0) : (A i).rank + (B j).rank ≤ rmatrix_psd_mul_eq_zero_of_trace_mul_eq_zeroIn LeanInteger & Polyhedral Optimization
If A and B are positive semidefinite real matrices and the trace of A * B is zero, then A * B = 0.
theorem matrix_psd_mul_eq_zero_of_trace_mul_eq_zero {r : ℕ} {A B : Matrix (Fin r) (Fin r) ℝ} (hA : A.PosSemidef) (hB : B.PosSemidef) (h : (A * B).trace = 0) : A * B = 0matrix_psd_trace_mul_nonnegIn LeanInteger & Polyhedral Optimization
The trace of the product of two positive semidefinite real matrices is nonnegative.
theorem matrix_psd_trace_mul_nonneg {r : ℕ} {A B : Matrix (Fin r) (Fin r) ℝ} (hA : A.PosSemidef) (hB : B.PosSemidef) : 0 ≤ (A * B).traceoctagon_section_convexHull_eqIn LeanInteger & Polyhedral Optimization
The convex hull of the eight octagon vertices equals the intersection of the eight half-planes {X | 0 ≤ 1 - (a_i X_0 + b_i X_1)}: convexHull(range v) = {x | ∀ i, 0 ≤ facets_val i x}.
theorem octagon_section_convexHull_eq :
convexHull ℝ (Set.range octagon_section_plane_vertices)
= {x : Fin 2 → ℝ | ∀ i, 0 ≤ octagon_section_plane_facets_val i x}octagon_section_convex_polygon_slackIn LeanInteger & Polyhedral Optimization
octagon_section_slack_matrix is the slack matrix of a convex octagon in the plane (the polygon P_2).
theorem octagon_section_convex_polygon_slack :
is_convex_polygon_slack_matrix 8 octagon_section_slack_matrixoctagon_section_extremePointsIn LeanInteger & Polyhedral Optimization
Every octagon vertex is an extreme point of the octagon's convex hull, and conversely: extremePoints(convexHull(range v)) = range v.
theorem octagon_section_extremePoints :
(convexHull ℝ (Set.range octagon_section_plane_vertices)).extremePoints ℝ
= Set.range octagon_section_plane_verticesoctagon_section_slack_psd_fourIn LeanInteger & Polyhedral Optimization
octagon_section_slack_matrix has a positive semidefinite factorization of size 4, built from the octahedron lift: A_i = q_i q_iᵀ and B_j = Σ_k μ_jk c_k c_kᵀ.
theorem octagon_section_slack_psd_four :
matrix_has_psd_factorization octagon_section_slack_matrix 4octagon_section_slack_psd_identityIn LeanInteger & Polyhedral Optimization
For all i, j, the octagon slack entry equals the μ-weighted sum of the squared octahedron facet–vertex inner products: S_ij = Σ_k μ_jk (q_i · c_k)^2. Equivalently, (q_i · c_k)^2 equals the octahedron slack m_ik in {0,1,2,3}, and S_ij = Σ_k μ_jk m_ik.
theorem octagon_section_slack_psd_identity (i j : Fin 8) :
octagon_section_slack_matrix i j
= ∑ k : Fin 6, octagon_vertex_weights j k
* (octahedron_facet_vectors i ⬝ᵥ octahedron_vertex_vectors k)^2permutahedron_five_not_has_psd_factorization_sixIn LeanInteger & Polyhedral Optimization
The slack matrix of the standard five-element permutahedron has no positive semidefinite factorization of size 6.
theorem permutahedron_five_not_has_psd_factorization_six : ¬ matrix_has_psd_factorization (permutahedron_slack_matrix 5) 6
permutahedron_five_slack_matrix_has_psd_factorizationIn LeanInteger & Polyhedral Optimization
The slack matrix of the standard five-element permutahedron has a positive semidefinite factorization of some finite size.
theorem permutahedron_five_slack_matrix_has_psd_factorization : ∃ r, matrix_has_psd_factorization (permutahedron_slack_matrix 5) r
permutahedron_five_slack_matrix_rankIn LeanInteger & Polyhedral Optimization
The slack matrix of the standard five-element permutahedron has ordinary rank 5.
theorem permutahedron_five_slack_matrix_rank : (permutahedron_slack_matrix 5).rank = 5
permutahedron_slack_matrix_eq_zero_iffIn LeanInteger & Polyhedral Optimization
The slack matrix entry at (S, σ) vanishes exactly when σ maps S onto the initial segment {0, 1, …, |S| - 1}.
theorem permutahedron_slack_matrix_eq_zero_iff (n : ℕ) (S : {S : Finset (Fin n) // S.Nonempty ∧ S ≠ Finset.univ}) (σ : Equiv.Perm (Fin n)) : permutahedron_slack_matrix n S σ = 0 ↔ S.val.image (fun i => (σ i).val) = Finset.range S.val.cardpermutahedron_slack_matrix_zero_column_cardIn LeanInteger & Polyhedral Optimization
For every permutation σ of Fin n, exactly n-1 rows S of the slack matrix have zero entry in column σ.
theorem permutahedron_slack_matrix_zero_column_card (n : ℕ) (σ : Equiv.Perm (Fin n)) : {S : {S : Finset (Fin n) // S.Nonempty ∧ S ≠ Finset.univ} | permutahedron_slack_matrix n S σ = 0}.ncard = n - 1polygon_eleven_gon_not_psd_factorization_fourIn LeanInteger & Polyhedral Optimization
For every real matrix S : Matrix (Fin 11) (Fin 11) ℝ, if is_convex_polygon_slack_matrix 11 S holds, then ¬ matrix_has_psd_factorization S 4.
theorem polygon_eleven_gon_not_psd_factorization_four :
∀ (S : Matrix (Fin 11) (Fin 11) ℝ),
is_convex_polygon_slack_matrix 11 S →
¬ matrix_has_psd_factorization S 4polygon_ten_gon_not_psd_factorization_fourIn LeanInteger & Polyhedral Optimization
For every real matrix S : Matrix (Fin 10) (Fin 10) ℝ, if is_convex_polygon_slack_matrix 10 S holds, then ¬ matrix_has_psd_factorization S 4.
theorem polygon_ten_gon_not_psd_factorization_four :
∀ (S : Matrix (Fin 10) (Fin 10) ℝ),
is_convex_polygon_slack_matrix 10 S →
¬ matrix_has_psd_factorization S 4polygon_twelve_gon_not_psd_factorization_fourIn LeanInteger & Polyhedral Optimization
For every real matrix S : Matrix (Fin 12) (Fin 12) ℝ, if is_convex_polygon_slack_matrix 12 S holds, then ¬ matrix_has_psd_factorization S 4.
theorem polygon_twelve_gon_not_psd_factorization_four :
∀ (S : Matrix (Fin 12) (Fin 12) ℝ),
is_convex_polygon_slack_matrix 12 S →
¬ matrix_has_psd_factorization S 4opnorm_bound_imp_p_star_kappaIn LeanLinear Programming & Duality
Let M be an n-by-n real matrix and κ ≥ 0. If for every positive diagonal matrix D in pos_diag_matrices n, 1 + D * M * D is nonsingular and its operator norm ‖(1 + D * M * D)⁻¹‖ is at most Real.sqrt (1 + κ^2 / (1 / 4 + κ)), then M belongs to P*(κ).
lemma opnorm_bound_imp_p_star_kappa (n : ℕ) (M : Matrix (Fin n) (Fin n) ℝ) (κ : ℝ) (hκ : 0 ≤ κ)
(h : ∀ D ∈ pos_diag_matrices n, IsUnit (1 + D * M * D) ∧ Matrix.opNorm (1 + D * M * D)⁻¹ ≤ Real.sqrt (1 + κ ^ 2 / (1 / 4 + κ))) :
is_p_star_kappa n M κp_star_iff_opnorm_characterizationIn LeanLinear Programming & Duality
Let n be a natural number and M an n-by-n real matrix. Then is_p_star n M holds if and only if for every matrix D in pos_diag_matrices n, 1 + D * M * D is invertible (IsUnit) and the set { Matrix.opNorm (1 + D * M * D)⁻¹ | (D : Matrix (Fin n) (Fin n) ℝ) (_ : D ∈ pos_diag_matrices n) } is bounded above (BddAbove). Moreover, if is_p_star n M holds, then the supremum sSup of that set equals Real.sqrt (1 + (handicap_number n M) ^ 2 / (1 / 4 + handicap_number n M)).
theorem p_star_iff_opnorm_characterization (n : ℕ) (M : Matrix (Fin n) (Fin n) ℝ) :
(is_p_star n M ↔
(∀ D ∈ pos_diag_matrices n, IsUnit (1 + D * M * D)) ∧
BddAbove { Matrix.opNorm (1 + D * M * D)⁻¹ | (D : Matrix (Fin n) (Fin n) ℝ) (_ : D ∈ pos_diag_matrices n) }) ∧
(is_p_star n M →
sSup { Matrix.opNorm (1 + D * M * D)⁻¹ | (D : Matrix (Fin n) (Fin n) ℝ) (_ : D ∈ pos_diag_matrices n) } =
Real.sqrt (1 + (handicap_number n M) ^ 2 / (1 / 4 + handicap_number n M)))p_star_kappa_opnorm_boundIn LeanLinear Programming & Duality
For every natural number n, real n-by-n matrix M, and real number κ such that is_p_star_kappa n M κ holds, and for every matrix D in pos_diag_matrices n, 1 + D * M * D is invertible (IsUnit) and Matrix.opNorm (1 + D * M * D)⁻¹ ≤ Real.sqrt (1 + κ ^ 2 / (1 / 4 + κ)).
lemma p_star_kappa_opnorm_bound (n : ℕ) (M : Matrix (Fin n) (Fin n) ℝ) (κ : ℝ)
(hM : is_p_star_kappa n M κ) (D : Matrix (Fin n) (Fin n) ℝ) (hD : D ∈ pos_diag_matrices n) :
IsUnit (1 + D * M * D) ∧
Matrix.opNorm (1 + D * M * D)⁻¹ ≤ Real.sqrt (1 + κ ^ 2 / (1 / 4 + κ))sufficient_matrix_rearrangement_iffIn LeanLinear Programming & Duality
Let κ ≥ 0 and P, N ≥ 0 be scalars. Then (1 + 4 * κ) * P - N ≥ 0 if and only if P - N ≥ - (2 * κ / (1 + 2 * κ)) * (P + N).
lemma sufficient_matrix_rearrangement_iff (κ P N : ℝ) (hκ : 0 ≤ κ) (hP : 0 ≤ P) (hN : 0 ≤ N) :
0 ≤ (1 + 4 * κ) * P - N ↔ - (2 * κ / (1 + 2 * κ)) * (P + N) ≤ P - Nbase_polytope_extreme_bases_finiteIn LeanSubmodular & Combinatorial Optimization
The set of greedy bases of any set function f on Finset (Fin n) is finite, being the image of the finite symmetric group Equiv.Perm (Fin n).
theorem base_polytope_extreme_bases_finite {n : ℕ} (f : Finset (Fin n) → ℝ) :
(base_polytope_extreme_bases f).Finitebase_polytope_extreme_bases_subsetIn LeanSubmodular & Combinatorial Optimization
For any normalized submodular function f, every greedy base generated by Edmonds' algorithm lies in the submodular base polytope B(f).
theorem base_polytope_extreme_bases_subset {n : ℕ} {f : Finset (Fin n) → ℝ}
(hf_zero : f ∅ = 0) (hf_sub : is_submodular f) :
base_polytope_extreme_bases f ⊆ base_polytope_submodular fbase_polytope_lorenz_subset_thermally_reachableIn LeanSubmodular & Combinatorial Optimization
For any natural number n, population vector x in stdSimplex ℝ (Fin n), and strictly positive Gibbs vector γ in stdSimplex ℝ (Fin n), the base polytope submodular_base_polytope of the set function S ↦ relative_lorenz_curve x γ (∑ i ∈ S, γ i) is a subset of thermally_reachable_populations γ x.
theorem base_polytope_lorenz_subset_thermally_reachable {n : ℕ} {x γ : Fin n → ℝ}
(hx : x ∈ stdSimplex ℝ (Fin n)) (hγ : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i) :
submodular_base_polytope (fun S => relative_lorenz_curve x γ (∑ i ∈ S, γ i)) ⊆
thermally_reachable_populations γ xcapacity_deficit_le_prefix_supIn LeanSubmodular & Combinatorial Optimization
For any natural number n > 0, population vectors x, y in stdSimplex ℝ (Fin n), strictly positive Gibbs vector γ in stdSimplex ℝ (Fin n), permutation π sorting y / γ antitonically, and subset S of Fin n, the capacity deficit population_capacity γ y S - population_capacity γ x S is at most the supremum over k : Fin n of the deficit at the prefix thermomajorization_prefix π (k.val + 1).
theorem capacity_deficit_le_prefix_sup {n : ℕ} (hn : 0 < n)
{x y γ : Fin n → ℝ}
(hx : x ∈ stdSimplex ℝ (Fin n)) (hy : y ∈ stdSimplex ℝ (Fin n))
(hγ : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i)
(π : Equiv.Perm (Fin n))
(hπ : Antitone (fun i : Fin n => y (π i) / γ (π i)))
(S : Finset (Fin n)) :
population_capacity γ y S - population_capacity γ x S ≤
⨆ k : Fin n, (population_capacity γ y (thermomajorization_prefix π (k.val + 1)) -
population_capacity γ x (thermomajorization_prefix π (k.val + 1)))cube_dist_le_oneIn LeanSubmodular & Combinatorial Optimization
For any two functions f and g from the n-dimensional Boolean cube into {0, ..., k}, their normalized Hamming distance cube_dist f g is at most 1.
theorem cube_dist_le_one {n k : ℕ} (f g : CubeFunc n k) :
cube_dist f g ≤ 1cube_dist_triangleIn LeanSubmodular & Combinatorial Optimization
For any functions f, g, h from the Boolean hypercube into {0, ..., k}, the normalized Hamming distance satisfies cube_dist f h ≤ cube_dist f g + cube_dist g h.
theorem cube_dist_triangle {n k : ℕ} (f g h : CubeFunc n k) :
cube_dist f h ≤ cube_dist f g + cube_dist g hgreedy_base_sumIn LeanSubmodular & Combinatorial Optimization
For any set function f on Finset (Fin n), the coordinates of every greedy base p sum to f(Finset.univ) - f(∅), by telescoping along the chain of prefixes.
theorem greedy_base_sum {n : ℕ} (f : Finset (Fin n) → ℝ) (p : Fin n → ℝ)
(hp : p ∈ base_polytope_extreme_bases f) :
(∑ i : Fin n, p i) = f Finset.univ - f ∅is_far_from_submodular_monoIn LeanSubmodular & Combinatorial Optimization
If f is ε₂-far from submodular and ε₁ ≤ ε₂, then f is ε₁-far from submodular.
theorem is_far_from_submodular_mono {n k : ℕ} {ε₁ ε₂ : ℝ}
(h : ε₁ ≤ ε₂) (f : CubeFunc n k) (hf : is_far_from_submodular ε₂ f) :
is_far_from_submodular ε₁ fis_submodular_cube_not_farIn LeanSubmodular & Combinatorial Optimization
If f : {0, 1}^n → {0, ..., k} is submodular and ε > 0, then f is not ε-far from submodular.
theorem is_submodular_cube_not_far {n k : ℕ} (f : CubeFunc n k)
(hf : is_submodular_cube f) (ε : ℝ) (hε : 0 < ε) :
¬ is_far_from_submodular ε fis_wolfe_corral_uniqueIn LeanSubmodular & Combinatorial Optimization
A Wolfe corral S uniquely determines its affine minimizer w: if w1 and w2 both satisfy the corral optimality conditions for S, then w1 = w2.
theorem is_wolfe_corral_unique {n : ℕ} {S : Finset (Fin n → ℝ)} {w1 w2 : Fin n → ℝ}
(h1 : is_wolfe_corral S w1) (h2 : is_wolfe_corral S w2) :
w1 = w2matroid_symmetry_gap_integral_lt_eight_seventeenthsIn LeanSubmodular & Combinatorial Optimization
Sharper form of the open question of arXiv:2610.07387: there is a strongly symmetric instance — non-negative submodular f on a finite ground set, matroid M, group G of permutations with f invariant and independence determined by the symmetrized indicator vector — such that the symmetrized fractional optimum sup_{x∈P(M)} F(x̄) is strictly less than 8/17 times the best *integral* value max{f(S) : S independent in M}. This is stronger than the parent statement, whose denominator is the best fractional value sup_{x∈P(M)} F(x).
theorem matroid_symmetry_gap_integral_lt_eight_seventeenths :
∃ (m : ℕ) (M : Matroid (Fin m)) (f : Finset (Fin m) → ℝ) (G : Subgroup (Equiv.Perm (Fin m))),
(∀ S, 0 ≤ f S) ∧ is_submodular f ∧ is_strongly_symmetric_instance M f G ∧
sSup ((fun x => multilinear_extension f (perm_group_symmetrize G x)) '' matroid_polytope M) <
8 / 17 * sSup (f '' {S : Finset (Fin m) | M.Indep ↑S})op737_block_capacity_eq_micro_capacityIn LeanSubmodular & Combinatorial Optimization
For any subset S of the blocks, block_population_capacity proj γ x S equals the micro-capacity of the union of the fibers over S.
theorem op737_block_capacity_eq_micro_capacity {n m : ℕ} (proj : Fin n → Fin m) (γ x : Fin n → ℝ) (hx : x ∈ stdSimplex ℝ (Fin n)) (S : Finset (Fin m)) : block_population_capacity proj γ x S = op737_micro_capacity γ x (op737_fiber_union proj S)op737_block_reachable_eq_base_polytopeIn LeanSubmodular & Combinatorial Optimization
Under the OP-737 hypotheses, the thermally reachable block populations equal the base polytope of the block population capacity.
theorem op737_block_reachable_eq_base_polytope {n m : ℕ} (hnm : m < n) (proj : Fin n → Fin m) (hsurj : Function.Surjective proj) (γ : Fin n → ℝ) (hγ_simplex : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i) (hγ_block : ∀ i j, proj i = proj j → γ i = γ j) (x : Fin n → ℝ) (hx : x ∈ stdSimplex ℝ (Fin n)) : thermally_reachable_block_populations proj γ x = submodular_base_polytope (block_population_capacity proj γ x)op737_concave_marginal_antitoneIn LeanSubmodular & Combinatorial Optimization
For a function L concave on [0,1] and reals 0 ≤ a ≤ b, c ≥ 0 with b + c ≤ 1, the marginal increment L(b+c) - L(b) is at most L(a+c) - L(a).
theorem op737_concave_marginal_antitone {L : ℝ → ℝ} (hL : ConcaveOn ℝ (Set.Icc 0 1) L) {a b c : ℝ} (ha : 0 ≤ a) (hab : a ≤ b) (hc : 0 ≤ c) (hbc : b + c ≤ 1) : L (b + c) - L b ≤ L (a + c) - L aop737_fiber_capacity_submodularIn LeanSubmodular & Combinatorial Optimization
If f is submodular and monotone, then the induced block capacity S ↦ f(union of fibers over S) is submodular.
theorem op737_fiber_capacity_submodular {n m : ℕ} {proj : Fin n → Fin m} {f : Finset (Fin n) → ℝ} (hmono : Monotone f) (hsub : is_submodular f) : is_submodular (op737_fiber_capacity proj f)op737_fiber_sum_image_base_polytopeIn LeanSubmodular & Combinatorial Optimization
The image of the base polytope of a monotone submodular f with f(empty)=0, f(univ)=1 under the fiber-sum projection is the base polytope of the induced block capacity.
theorem op737_fiber_sum_image_base_polytope {n m : ℕ} (proj : Fin n → Fin m) (hsurj : Function.Surjective proj) {f : Finset (Fin n) → ℝ} (hsub : is_submodular f) (hmono : Monotone f) (h0 : f ∅ = 0) (h1 : f Finset.univ = 1) : fiber_sum_vec proj '' submodular_base_polytope f = submodular_base_polytope (op737_fiber_capacity proj f)op737_gibbs_stochastic_image_mem_simplexIn LeanSubmodular & Combinatorial Optimization
If T is Gibbs-stochastic with respect to γ and x lies in the standard simplex, then the image vector i ↦ ∑_j T i j * x j again lies in the standard simplex.
theorem op737_gibbs_stochastic_image_mem_simplex {n : ℕ} {γ x : Fin n → ℝ} {T : Fin n → Fin n → ℝ} (hT : is_gibbs_stochastic γ T) (hx : x ∈ stdSimplex ℝ (Fin n)) : (fun i => ∑ j, T i j * x j) ∈ stdSimplex ℝ (Fin n)op737_mem_micro_reach_selfIn LeanSubmodular & Combinatorial Optimization
The x-identity map (Kronecker delta) is Gibbs-stochastic, hence x is reachable from itself; in particular the reachable set is nonempty.
theorem op737_mem_micro_reach_self {n : ℕ} (γ x : Fin n → ℝ) : x ∈ op737_micro_reach γ xop737_micro_capacity_emptyIn LeanSubmodular & Combinatorial Optimization
The micro-capacity of the empty set of microstates vanishes.
theorem op737_micro_capacity_empty {n : ℕ} (γ x : Fin n → ℝ) : op737_micro_capacity γ x ∅ = 0op737_micro_capacity_monotoneIn LeanSubmodular & Combinatorial Optimization
For A inside B, the micro-capacity of A is at most the micro-capacity of B.
theorem op737_micro_capacity_monotone {n : ℕ} {γ x : Fin n → ℝ} (hx : x ∈ stdSimplex ℝ (Fin n)) : Monotone (op737_micro_capacity γ x)op737_micro_capacity_submodularIn LeanSubmodular & Combinatorial Optimization
The micro-capacity f(A) = sup over reachable z of the population of A is submodular, for a strictly positive Gibbs vector in the simplex and x in the simplex.
theorem op737_micro_capacity_submodular {n : ℕ} {γ x : Fin n → ℝ} (hγ : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i) (hx : x ∈ stdSimplex ℝ (Fin n)) : is_submodular (op737_micro_capacity γ x)op737_micro_capacity_univIn LeanSubmodular & Combinatorial Optimization
The micro-capacity of the full set of microstates equals 1, because every reachable microstate is a probability vector.
theorem op737_micro_capacity_univ {n : ℕ} {γ x : Fin n → ℝ} (hx : x ∈ stdSimplex ℝ (Fin n)) : op737_micro_capacity γ x Finset.univ = 1op737_micro_reach_mem_simplexIn LeanSubmodular & Combinatorial Optimization
If z is reachable from x by a Gibbs-stochastic map and x is in the standard simplex, then z is in the standard simplex.
theorem op737_micro_reach_mem_simplex {n : ℕ} {γ x z : Fin n → ℝ} (hx : x ∈ stdSimplex ℝ (Fin n)) (hz : z ∈ op737_micro_reach γ x) : z ∈ stdSimplex ℝ (Fin n)op737_micro_reachable_eq_base_polytopeIn LeanSubmodular & Combinatorial Optimization
The reachable microstates are exactly the base polytope of the micro-capacity: z is reachable from x by a Gibbs-stochastic map iff every population bound ∑_{i∈A} z i ≤ f(A) holds and the total mass is 1.
theorem op737_micro_reachable_eq_base_polytope {n : ℕ} {γ x : Fin n → ℝ} (hγ : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i) (hx : x ∈ stdSimplex ℝ (Fin n)) : op737_micro_reach γ x = submodular_base_polytope (op737_micro_capacity γ x)op737_reachable_block_eq_fiber_sum_imageIn LeanSubmodular & Combinatorial Optimization
The thermally reachable block populations equal the image of the reachable microstates under the fiber-sum map.
theorem op737_reachable_block_eq_fiber_sum_image {n m : ℕ} (proj : Fin n → Fin m) (γ x : Fin n → ℝ) (hx : x ∈ stdSimplex ℝ (Fin n)) : thermally_reachable_block_populations proj γ x = fiber_sum_vec proj '' op737_micro_reach γ xop737_submodular_of_concave_compIn LeanSubmodular & Combinatorial Optimization
If L is concave on [0,1] and g ≥ 0 has total mass at most 1, then the set function S ↦ L(sum of g over S) is submodular.
theorem op737_submodular_of_concave_comp {n : ℕ} {L : ℝ → ℝ} {g : Fin n → ℝ} (hL : ConcaveOn ℝ (Set.Icc 0 1) L) (hg : ∀ k, 0 ≤ g k) (hg1 : ∑ k, g k ≤ 1) : is_submodular (fun S : Finset (Fin n) => L (∑ k ∈ S, g k))op737_sum_fiber_sum_vecIn LeanSubmodular & Combinatorial Optimization
For any vector y and any set S of blocks, the sum over k in S of the k-th fiber sum of y equals the sum of y over all microstates i whose block proj i lies in S.
theorem op737_sum_fiber_sum_vec {n m : ℕ} (proj : Fin n → Fin m) (y : Fin n → ℝ) (S : Finset (Fin m)) : ∑ k ∈ S, fiber_sum_vec proj y k = ∑ i ∈ op737_fiber_union proj S, y iop_737_base_polytope_subset_reachableIn LeanSubmodular & Combinatorial Optimization
For any natural numbers m < n, any surjective block-assignment map proj : Fin n → Fin m, any Gibbs vector γ in stdSimplex ℝ (Fin n) with strictly positive entries that is constant on the fibers of proj, and any initial vector x in stdSimplex ℝ (Fin n), the base polytope of the block population capacity is contained in the thermally reachable block populations.
theorem op_737_base_polytope_subset_reachable {n m : ℕ} (hnm : m < n) (proj : Fin n → Fin m) (hsurj : Function.Surjective proj) (γ : Fin n → ℝ) (hγ_simplex : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i) (hγ_block : ∀ i j, proj i = proj j → γ i = γ j) (x : Fin n → ℝ) (hx : x ∈ stdSimplex ℝ (Fin n)) : submodular_base_polytope (block_population_capacity proj γ x) ⊆ thermally_reachable_block_populations proj γ xop_737_block_capacity_submodularIn LeanSubmodular & Combinatorial Optimization
For any natural numbers m < n, any surjective block-assignment map proj : Fin n → Fin m, any Gibbs vector γ in stdSimplex ℝ (Fin n) with strictly positive entries that is constant on the fibers of proj, and any initial vector x in stdSimplex ℝ (Fin n), the block population capacity block_population_capacity proj γ x is submodular.
theorem op_737_block_capacity_submodular {n m : ℕ} (hnm : m < n) (proj : Fin n → Fin m) (hsurj : Function.Surjective proj) (γ : Fin n → ℝ) (hγ_simplex : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i) (hγ_block : ∀ i j, proj i = proj j → γ i = γ j) (x : Fin n → ℝ) (hx : x ∈ stdSimplex ℝ (Fin n)) : is_submodular (block_population_capacity proj γ x)op_853_polynomial_submodular_goal_value_bound_exists_goal_function_polyIn LeanSubmodular & Combinatorial Optimization
There are constants c, d such that every connected finite simple graph G admits a submodular goal function whose goal value Q is at most c·|E(G)|^d.
open scoped Classical in
theorem op_853_polynomial_submodular_goal_value_bound_exists_goal_function_poly :
∃ c d : ℕ, ∀ (V : Type) [Fintype V] (G : SimpleGraph V), G.Connected →
∃ (g : (G.edgeSet → Option Bool) → ℕ) (Q : ℕ),
is_submodular_goal_function G g Q ∧ Q ≤ c * (Fintype.card G.edgeSet) ^ doptimal_trace_distance_error_ge_capacity_deficitIn LeanSubmodular & Combinatorial Optimization
For any population vectors x, y in stdSimplex ℝ (Fin n), Gibbs vector γ, and subset S of Fin n, (∑ i ∈ S, y i) - population_capacity γ x S ≤ optimal_trace_distance_error γ x y.
theorem optimal_trace_distance_error_ge_capacity_deficit {n : ℕ}
{x y γ : Fin n → ℝ} (hx : x ∈ stdSimplex ℝ (Fin n)) (hy : y ∈ stdSimplex ℝ (Fin n))
(S : Finset (Fin n)) :
(∑ i ∈ S, y i) - population_capacity γ x S ≤ optimal_trace_distance_error γ x yoptimal_trace_distance_error_le_prefix_supIn LeanSubmodular & Combinatorial Optimization
For any natural number n > 0, population vectors x, y in stdSimplex ℝ (Fin n), strictly positive Gibbs vector γ in stdSimplex ℝ (Fin n), and permutation π sorting y / γ antitonically, the optimal trace distance error optimal_trace_distance_error γ x y is at most the supremum over k : Fin n of the capacity difference on thermomajorization_prefix π (k.val + 1).
theorem optimal_trace_distance_error_le_prefix_sup {n : ℕ} (hn : 0 < n)
{x y γ : Fin n → ℝ}
(hx : x ∈ stdSimplex ℝ (Fin n)) (hy : y ∈ stdSimplex ℝ (Fin n))
(hγ : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i)
(π : Equiv.Perm (Fin n))
(hπ : Antitone (fun i : Fin n => y (π i) / γ (π i))) :
optimal_trace_distance_error γ x y ≤
⨆ k : Fin n, (population_capacity γ y (thermomajorization_prefix π (k.val + 1)) -
population_capacity γ x (thermomajorization_prefix π (k.val + 1)))population_capacity_eq_relative_lorenzIn LeanSubmodular & Combinatorial Optimization
For any natural number n, population vector x in stdSimplex ℝ (Fin n), strictly positive Gibbs vector γ in stdSimplex ℝ (Fin n), and subset S of Fin n, population_capacity γ x S equals relative_lorenz_curve x γ (∑ i ∈ S, γ i).
theorem population_capacity_eq_relative_lorenz {n : ℕ} {x γ : Fin n → ℝ}
(hx : x ∈ stdSimplex ℝ (Fin n)) (hγ : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i)
(S : Finset (Fin n)) :
population_capacity γ x S = relative_lorenz_curve x γ (∑ i ∈ S, γ i)population_capacity_relative_lorenz_polymatroid_base_polytopeIn LeanSubmodular & Combinatorial Optimization
Let n be a natural number, x a population vector in stdSimplex ℝ (Fin n), and γ a strictly positive Gibbs population vector in stdSimplex ℝ (Fin n). Then population_capacity γ x S = relative_lorenz_curve x γ (∑ i ∈ S, γ i) for all subsets S of Fin n, is_polymatroid_rank (population_capacity γ x) with population_capacity γ x Finset.univ = 1, and thermally_reachable_populations γ x = submodular_base_polytope (population_capacity γ x).
theorem population_capacity_relative_lorenz_polymatroid_base_polytope {n : ℕ} {x γ : Fin n → ℝ}
(hx : x ∈ stdSimplex ℝ (Fin n)) (hγ : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i) :
(∀ S : Finset (Fin n), population_capacity γ x S = relative_lorenz_curve x γ (∑ i ∈ S, γ i)) ∧
(is_polymatroid_rank (population_capacity γ x) ∧ population_capacity γ x Finset.univ = 1) ∧
thermally_reachable_populations γ x = submodular_base_polytope (population_capacity γ x)randomized_submod_tester_accept_prob_boundsIn LeanSubmodular & Combinatorial Optimization
For any randomized tester A and function f on the Boolean cube, randomized_submod_tester_accept_prob A f lies in the interval [0, 1].
theorem randomized_submod_tester_accept_prob_bounds {n k q : ℕ}
(A : RandomizedSubmodTester n k q) (f : CubeFunc n k) :
0 ≤ randomized_submod_tester_accept_prob A f ∧ randomized_submod_tester_accept_prob A f ≤ 1submodular_goal_function_min_truncationIn LeanSubmodular & Combinatorial Optimization
If φ is a monotone submodular potential on partial assignments with φ(empty assignment) = 0 and φ(β) ≥ Q exactly on the MST identification certificates, then its truncation min(φ, Q) is a submodular goal function with goal value Q.
open scoped Classical in
theorem submodular_goal_function_min_truncation {V : Type*} [Fintype V]
(G : SimpleGraph V) (φ : (G.edgeSet → Option Bool) → ℕ) (Q : ℕ)
(h0 : φ (fun _ => none) = 0)
(hmono : ∀ β γ, partial_assignment_le β γ → φ β ≤ φ γ)
(hsub : ∀ β γ e s, partial_assignment_le β γ → γ e = none →
φ (Function.update γ e (some s)) + φ β ≤ φ (Function.update β e (some s)) + φ γ)
(hcert : ∀ β, Q ≤ φ β ↔ is_mst_certificate G β) :
is_submodular_goal_function G (fun β => min (φ β) Q) Qsubmodular_goal_value_le_of_goal_functionIn LeanSubmodular & Combinatorial Optimization
If g is a submodular goal function for a finite graph G with goal value Q, then the submodular goal value of G is at most Q.
open scoped Classical in
theorem submodular_goal_value_le_of_goal_function {V : Type*} [Fintype V] (G : SimpleGraph V)
(g : (G.edgeSet → Option Bool) → ℕ) (Q : ℕ) (h : is_submodular_goal_function G g Q) :
stochastic_mst_submodular_goal_value G ≤ Qthermally_reachable_subset_base_polytope_lorenzIn LeanSubmodular & Combinatorial Optimization
For any natural number n, population vector x in stdSimplex ℝ (Fin n), and strictly positive Gibbs vector γ in stdSimplex ℝ (Fin n), thermally_reachable_populations γ x is a subset of the base polytope submodular_base_polytope of the set function S ↦ relative_lorenz_curve x γ (∑ i ∈ S, γ i).
theorem thermally_reachable_subset_base_polytope_lorenz {n : ℕ} {x γ : Fin n → ℝ}
(hx : x ∈ stdSimplex ℝ (Fin n)) (hγ : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i) :
thermally_reachable_populations γ x ⊆
submodular_base_polytope (fun S => relative_lorenz_curve x γ (∑ i ∈ S, γ i))thermomajorization_capacity_rankIn LeanSubmodular & Combinatorial Optimization
For any natural number n, population vector x in stdSimplex ℝ (Fin n), and strictly positive Gibbs vector γ in stdSimplex ℝ (Fin n), the set function S ↦ relative_lorenz_curve x γ (∑ i ∈ S, γ i) on subsets of Fin n is a polymatroid rank function (is_polymatroid_rank) satisfying relative_lorenz_curve x γ (∑ i : Fin n, γ i) = 1.
theorem thermomajorization_capacity_rank {n : ℕ} {x γ : Fin n → ℝ}
(hx : x ∈ stdSimplex ℝ (Fin n)) (hγ : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i) :
is_polymatroid_rank (fun S : Finset (Fin n) => relative_lorenz_curve x γ (∑ i ∈ S, γ i)) ∧
relative_lorenz_curve x γ (∑ i : Fin n, γ i) = 1trace_distance_error_characterizationIn LeanSubmodular & Combinatorial Optimization
For any natural number n with 0 < n, population vectors x, y in stdSimplex ℝ (Fin n), Gibbs vector γ in stdSimplex ℝ (Fin n) with strictly positive entries (∀ i, 0 < γ i), and permutation π of Fin n satisfying Antitone (fun i : Fin n => y (π i) / γ (π i)), the optimal trace-distance approximation error optimal_trace_distance_error γ x y satisfies: (1) it equals ⨆ S : Finset (Fin n), (∑ i ∈ S, y i) - population_capacity γ x S; (2) it equals ⨆ S : Finset (Fin n), population_capacity γ y S - population_capacity γ x S; and (3) it equals ⨆ k : Fin n, population_capacity γ y (thermomajorization_prefix π (k.val + 1)) - population_capacity γ x (thermomajorization_prefix π (k.val + 1)).
theorem trace_distance_error_characterization {n : ℕ} (hn : 0 < n)
{x y γ : Fin n → ℝ}
(hx : x ∈ stdSimplex ℝ (Fin n)) (hy : y ∈ stdSimplex ℝ (Fin n))
(hγ : γ ∈ stdSimplex ℝ (Fin n)) (hγ_pos : ∀ i, 0 < γ i)
(π : Equiv.Perm (Fin n))
(hπ : Antitone (fun i : Fin n => y (π i) / γ (π i))) :
optimal_trace_distance_error γ x y =
(⨆ S : Finset (Fin n), (∑ i ∈ S, y i) - population_capacity γ x S) ∧
optimal_trace_distance_error γ x y =
(⨆ S : Finset (Fin n), population_capacity γ y S - population_capacity γ x S) ∧
optimal_trace_distance_error γ x y =
(⨆ k : Fin n, (population_capacity γ y (thermomajorization_prefix π (k.val + 1)) -
population_capacity γ x (thermomajorization_prefix π (k.val + 1))))wolfe_corral_sum_eqIn LeanSubmodular & Combinatorial Optimization
The affine minimizer w of a Wolfe corral S preserves any constant coordinate sum shared by all atoms in S.
theorem wolfe_corral_sum_eq {n : ℕ} (S : Finset (Fin n → ℝ)) (w : Fin n → ℝ) (c : ℝ)
(hcorral : is_wolfe_corral S w) (hall : ∀ p ∈ S, ∑ i : Fin n, p i = c) :
(∑ i : Fin n, w i) = cwolfe_linopt_run_w_ne_of_ltIn LeanSubmodular & Combinatorial Optimization
In any Wolfe linopt run, the affine minimizers w at distinct steps i < j are distinct, due to strict Euclidean norm decrease across major cycles.
theorem wolfe_linopt_run_w_ne_of_lt {n : ℕ} {atoms : Set (Fin n → ℝ)} {k : ℕ}
{S : Fin (k + 1) → Finset (Fin n → ℝ)} {w : Fin (k + 1) → (Fin n → ℝ)}
(hrun : wolfe_linopt_run atoms k S w) {i j : Fin (k + 1)} (hij : i < j) :
w i ≠ w jyang_mills_b_list_agreesIn LeanClassical Field Theory & Electromagnetism
For all m and a, the length-(a+1) coefficient list b_list m a generated inside the definition of yang_mills_residual_polynomial is the same as the one generated inside yang_mills_resonance_polynomial.
theorem yang_mills_b_list_agrees (m a : ℕ) : yang_mills_residual_polynomial.b_list m a = yang_mills_resonance_polynomial.b_list m a
yang_mills_cube_sum_agreesIn LeanClassical Field Theory & Electromagnetism
The auxiliary cube-sum function used inside the definition of yang_mills_residual_polynomial is exactly the same function as the one used inside yang_mills_resonance_polynomial.
theorem yang_mills_cube_sum_agrees : yang_mills_residual_polynomial.cube_sum = yang_mills_resonance_polynomial.cube_sum
yang_mills_quadratic_monicIn LeanClassical Field Theory & Electromagnetism
For any rationals b and c, the polynomial X^2 + C b * X + C c over ℚ is monic.
theorem yang_mills_quadratic_monic (b c : ℚ) : (Polynomial.X ^ 2 + (Polynomial.C b) * Polynomial.X + Polynomial.C c : Polynomial ℚ).Monic
yang_mills_reduction_coreIn LeanClassical Field Theory & Electromagnetism
Let Q, P be rational polynomials with Q monic, Q dividing P, and Q coprime to P' (so no root of Q is a multiple root of P). Then for any real root z of Q, the quotient P /ₘ Q does not vanish at z.
theorem yang_mills_reduction_core (Q P : Polynomial ℚ) (hmonic : Q.Monic) (hfac : Q ∣ P) (hd : IsCoprime Q P.derivative) (z : ℝ) (hz : Q.aeval z = 0) : (P /ₘ Q).aeval z ≠ 0
yang_mills_residual_eq_divByMonicIn LeanClassical Field Theory & Electromagnetism
Yes.
theorem yang_mills_residual_eq_divByMonic (m : ℕ) :
let d : ℚ := 2 * m + 5
let b_coeff : ℚ := -2 * (d^3 - 16 * d^2 + 89 * d - 146) / ((d - 2) * (d - 1)^2)
let c_coeff : ℚ := ((d - 10) * (d - 5) / ((d - 2) * (d - 1)))^2
let Q : Polynomial ℚ := Polynomial.X ^ 2 + (Polynomial.C b_coeff) * Polynomial.X + Polynomial.C c_coeff
yang_mills_residual_polynomial m = yang_mills_resonance_polynomial m /ₘ Qyang_mills_resonance_extra_roots_simpleIn LeanClassical Field Theory & Electromagnetism
For every m ≥ 12, the two explicit profile roots (the roots of Q_m) are simple roots of the resonance polynomial P_m: Q_m is coprime to the derivative P_m'.
theorem yang_mills_resonance_extra_roots_simple (m : ℕ) (hm : 12 ≤ m) :
let d : ℚ := 2 * m + 5
let b_coeff : ℚ := -2 * (d^3 - 16 * d^2 + 89 * d - 146) / ((d - 2) * (d - 1)^2)
let c_coeff : ℚ := ((d - 10) * (d - 5) / ((d - 2) * (d - 1)))^2
let Q : Polynomial ℚ := Polynomial.X ^ 2 + (Polynomial.C b_coeff) * Polynomial.X + Polynomial.C c_coeff
IsCoprime Q (yang_mills_resonance_polynomial m).derivativeyang_mills_resonance_quadratic_dvdIn LeanClassical Field Theory & Electromagnetism
For every m ≥ 2, with d = 2m+5, the monic quadratic Q_m = X^2 + b_coeff * X + c_coeff whose roots are the two explicit self-similar profile roots divides the rational resonance polynomial P_m = yang_mills_resonance_polynomial m.
theorem yang_mills_resonance_quadratic_dvd (m : ℕ) (hm : 2 ≤ m) :
let d : ℚ := 2 * m + 5
let b_coeff : ℚ := -2 * (d^3 - 16 * d^2 + 89 * d - 146) / ((d - 2) * (d - 1)^2)
let c_coeff : ℚ := ((d - 10) * (d - 5) / ((d - 2) * (d - 1)))^2
let Q : Polynomial ℚ := Polynomial.X ^ 2 + (Polynomial.C b_coeff) * Polynomial.X + Polynomial.C c_coeff
Q ∣ yang_mills_resonance_polynomial maddChar_pi_zmod_two_reconstructionIn LeanQuantum Mechanics
For a finite type ι, an additive character χ of the group (ι → ZMod 2) with values in the multiplicative monoid ℝ satisfies χ x = ∏ i, χ (Pi.single i (x i)) for every x. That is, χ is determined by its values on the single-coordinate vectors.
theorem addChar_pi_zmod_two_reconstruction {ι : Type*} [Fintype ι] [DecidableEq ι]
(χ : AddChar (ι → ZMod 2) ℝ) (x : ι → ZMod 2) :
χ x = ∏ i, χ (Pi.single i (x i))addChar_pi_zmod_two_surjIn LeanQuantum Mechanics
For a finite type ι and a family of signs c : ι → ℝ with c i ∈ {1, -1}, there is an additive character χ of (ι → ZMod 2) into ℝ with χ (Pi.single i 1) = c i for every i.
theorem addChar_pi_zmod_two_surj {ι : Type*} [Fintype ι] [DecidableEq ι]
(c : ι → ℝ) (hc : ∀ i, c i = 1 ∨ c i = -1) :
∃ χ : AddChar (ι → ZMod 2) ℝ, ∀ i, χ (Pi.single i 1) = c ibalanced_multipartite_max_tripartite_info_ge_two_mul_halfIn LeanQuantum Mechanics
For natural numbers k ≥ 2 and s ≥ 4, the maximum tripartite information balanced_multipartite_max_tripartite_info k s is at least 2 * (k / 2), witnessed by the colouring that assigns to the j-th vertex of every part the colour j mod 4.
theorem balanced_multipartite_max_tripartite_info_ge_two_mul_half (k s : ℕ) (hk : 2 ≤ k) (hs : 4 ≤ s) :
2 * ((k / 2 : ℕ) : ℤ) ≤ balanced_multipartite_max_tripartite_info k sbalanced_multipartite_max_tripartite_info_le_two_mul_halfIn LeanQuantum Mechanics
For natural numbers k and s > 0, the maximum tripartite information balanced_multipartite_max_tripartite_info k s of the complete multipartite graph with k parts each of size s is at most 2 * (k / 2).
theorem balanced_multipartite_max_tripartite_info_le_two_mul_half (k s : ℕ) (hs : 0 < s) :
balanced_multipartite_max_tripartite_info k s ≤ 2 * ((k / 2 : ℕ) : ℤ)balanced_multipartite_part_size_two_max_tripartite_info_ge_oneIn LeanQuantum Mechanics
For any k ≥ 3, the complete multipartite graph with k parts of size 2 has maximum tripartite information at least 1.
theorem balanced_multipartite_part_size_two_max_tripartite_info_ge_one (k : ℕ) (hk : 3 ≤ k) :
1 ≤ balanced_multipartite_max_tripartite_info k 2
balanced_multipartite_part_size_two_max_tripartite_info_le_oneIn LeanQuantum Mechanics
For any k ≥ 3, the complete multipartite graph with k parts of size 2 has maximum tripartite information at most 1.
theorem balanced_multipartite_part_size_two_max_tripartite_info_le_one (k : ℕ) (hk : 3 ≤ k) :
balanced_multipartite_max_tripartite_info k 2 ≤ 1
balanced_multipartite_three_three_max_tripartite_info_ge_twoIn LeanQuantum Mechanics
The complete tripartite graph K_{3,3,3} has maximum tripartite information at least 2, witnessed by a four-coloring with parts of sizes {2,1}, {1,2}, {1,1,1}.
theorem balanced_multipartite_three_three_max_tripartite_info_ge_two :
2 ≤ balanced_multipartite_max_tripartite_info 3 3balanced_multipartite_three_three_max_tripartite_info_le_twoIn LeanQuantum Mechanics
The complete tripartite graph K_{3,3,3} has maximum tripartite information at most 2, following from the general upper bound 2 * floor(k/2) with k = 3 and s = 3.
theorem balanced_multipartite_three_three_max_tripartite_info_le_two :
balanced_multipartite_max_tripartite_info 3 3 ≤ 2balanced_multipartite_two_two_max_tripartite_info_eq_zeroIn LeanQuantum Mechanics
The maximum tripartite information of the balanced complete multipartite graph K_{2,2} (isomorphic to the 4-cycle C_4) is 0.
theorem balanced_multipartite_two_two_max_tripartite_info_eq_zero :
balanced_multipartite_max_tripartite_info 2 2 = 0
cauchy_of_block_subadditiveIn LeanQuantum Mechanics
For any real sequence M on ℕ bounded by C n^2 satisfying the 2D block subadditivity bounds |M(mk) - m^2 M(k)| ≤ C m^2 k and remainder bounds |M(n) - M(n - n % k)| ≤ C n k, the sequence M(n)/n^2 is Cauchy.
theorem cauchy_of_block_subadditive
(M : ℕ → ℝ) (C : ℝ) (hC : 0 ≤ C)
(h_block : ∀ (m k : ℕ), 0 < k → |M (m * k) - (m : ℝ) ^ 2 * M k| ≤ C * (m : ℝ) ^ 2 * (k : ℝ))
(h_rem : ∀ (n k : ℕ), 0 < k → |M n - M (n - n % k)| ≤ C * (n : ℝ) * (k : ℝ))
(h_bound : ∀ (n : ℕ), |M n| ≤ C * (n : ℝ) ^ 2) :
CauchySeq (fun n : ℕ => M n / (n : ℝ) ^ 2)ccz_edge_distribution_decidableRel_irrelIn LeanQuantum Mechanics
The CCZ edge-distribution atom of an edge set does not depend on which DecidableRel G.Adj instance is used, since Decidable is a subsingleton.
theorem ccz_edge_distribution_decidableRel_irrel {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (i j : DecidableRel G.Adj) (F : Finset (Sym2 V)) :
@ccz_edge_distribution V _ _ G i F = @ccz_edge_distribution V _ _ G j Fccz_edge_distribution_eq_zero_of_not_subsetIn LeanQuantum Mechanics
An edge set that is not a subset of the edge set of G has probability zero as an induced edge set.
theorem ccz_edge_distribution_eq_zero_of_not_subset {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {F : Finset (Sym2 V)}
(hF : ¬ F ⊆ G.edgeFinset) : ccz_edge_distribution G F = 0ccz_edge_distribution_nonnegIn LeanQuantum Mechanics
Every atom of the CCZ induced-edge distribution is nonnegative: for a graph G on a finite type V and any edge set F, ccz_edge_distribution G F ≥ 0.
theorem ccz_edge_distribution_nonneg {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (F : Finset (Sym2 V)) :
0 ≤ ccz_edge_distribution G Fccz_path_graph_four_rpow_half_sumIn LeanQuantum Mechanics
For the path graph on 4 vertices, the sum over all edge sets of (induced-edge probability)^(1/2) equals 1 + √2.
theorem ccz_path_graph_four_rpow_half_sum :
letI : DecidableRel (SimpleGraph.pathGraph 4).Adj := inferInstance
(∑ F : Finset (Sym2 (Fin 4)), ccz_edge_distribution (SimpleGraph.pathGraph 4) F ^ ((1 : ℝ) / 2))
= 1 + Real.sqrt 2ccz_path_graph_four_rpow_half_supportIn LeanQuantum Mechanics
For the path on 4 vertices, the order-1/2 power sum over all edge subsets equals the sum restricted to the seven edge sets that arise as induced edge sets.
theorem ccz_path_graph_four_rpow_half_support :
letI : DecidableRel (SimpleGraph.pathGraph 4).Adj := inferInstance
(∑ F : Finset (Sym2 (Fin 4)), ccz_edge_distribution (SimpleGraph.pathGraph 4) F ^ ((1 : ℝ) / 2))
= ∑ F ∈ ({∅, {s(0,1)}, {s(1,2)}, {s(2,3)}, {s(0,1),s(1,2)}, {s(1,2),s(2,3)}, {s(0,1),s(1,2),s(2,3)}} : Finset (Finset (Sym2 (Fin 4)))),
ccz_edge_distribution (SimpleGraph.pathGraph 4) F ^ ((1 : ℝ) / 2)ccz_path_graph_four_rpow_half_termIn LeanQuantum Mechanics
For the path on 4 vertices and any edge set F whose induced-edge fibre has size k, the term (probability)^(1/2) equals √k / 4.
theorem ccz_path_graph_four_rpow_half_term (F : Finset (Sym2 (Fin 4))) (k : ℕ)
(hk : (Finset.univ.filter (fun S : Finset (Fin 4) =>
ccz_induced_edges (SimpleGraph.pathGraph 4) S = F)).card = k) :
letI : DecidableRel (SimpleGraph.pathGraph 4).Adj := inferInstance
ccz_edge_distribution (SimpleGraph.pathGraph 4) F ^ ((1 : ℝ) / 2) = Real.sqrt k / 4ccz_path_rpow_sum_large_deviationIn LeanQuantum Mechanics
For every real α with 0 < α < 1 there is ε > 0 and N such that for all n ≥ N the order-α power sum of the path graph's induced-edge distribution is at most 2^{(1-α-ε)n}. Equivalently the random induced-edge set of a uniformly random vertex subset of the path has Rényi rate strictly below log 2.
theorem ccz_path_rpow_sum_large_deviation (α : ℝ) (hα0 : 0 < α) (hα1 : α < 1) :
∃ ε : ℝ, 0 < ε ∧ ∀ᶠ (n : ℕ) in Filter.atTop,
∑ F : Finset (Sym2 (Fin n)),
(ccz_edge_distribution (SimpleGraph.pathGraph n) F) ^ α
≤ (2 : ℝ) ^ ((1 - α - ε) * (n : ℝ))ccz_path_rpow_sum_trivial_boundIn LeanQuantum Mechanics
For n ≥ 1 and 0 < α ≤ 1, the order-α power sum of the path graph's induced-edge distribution is at most 2^{(n-1)(1-α)}: the distribution is supported on the at most 2^{n-1} subsets of the n-1 edges of the path, and each atom is at most 1.
theorem ccz_path_rpow_sum_trivial_bound (n : ℕ) (hn : 1 ≤ n) {α : ℝ}
(hα0 : 0 < α) (hα1 : α ≤ 1) :
∑ F : Finset (Sym2 (Fin n)),
(ccz_edge_distribution (SimpleGraph.pathGraph n) F) ^ α
≤ (2 : ℝ) ^ (((n : ℝ) - 1) * (1 - α))ccz_renyi_entropy_congr_isoIn LeanQuantum Mechanics
Graph isomorphism preserves CCZ Rényi entropy: isomorphic graphs have identical induced-edge distributions up to vertex permutation, and hence equal Rényi entropy.
theorem ccz_renyi_entropy_congr_iso {V W : Type*} [Fintype V] [DecidableEq V] [Fintype W] [DecidableEq W]
(α : ℝ) (G : SimpleGraph V) (H : SimpleGraph W) [DecidableRel G.Adj] [DecidableRel H.Adj]
(e : G ≃g H) :
ccz_renyi_entropy α G = ccz_renyi_entropy α Hccz_renyi_entropy_half_eq_two_log_rpow_sumIn LeanQuantum Mechanics
At order α = 1/2 the CCZ Rényi entropy equals twice the logarithm of the order-1/2 power sum of the induced-edge distribution, since log(∑ p^(1/2))/(1 - 1/2) = 2 log(∑ p^(1/2)).
theorem ccz_renyi_entropy_half_eq_two_log_rpow_sum {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
ccz_renyi_entropy (1 / 2) G
= 2 * Real.log (∑ F : Finset (Sym2 V), ccz_edge_distribution G F ^ ((1 : ℝ) / 2))ccz_renyi_entropy_le_of_refl_trans_gen_tree_shiftIn LeanQuantum Mechanics
If T₂ is reachable from T₁ by a sequence of generalized tree shifts, then for every α ≥ 1, the CCZ Rényi entropy of T₂ is at most that of T₁.
theorem ccz_renyi_entropy_le_of_refl_trans_gen_tree_shift
(α : ℝ) (hα : 1 ≤ α) (n : ℕ) (T₁ T₂ : SimpleGraph (Fin n))
[DecidableRel T₁.Adj] [DecidableRel T₂.Adj]
(h : Relation.ReflTransGen is_generalized_tree_shift T₁ T₂) :
ccz_renyi_entropy α T₂ ≤ ccz_renyi_entropy α T₁ccz_renyi_entropy_le_of_rpow_sum_geIn LeanQuantum Mechanics
For α > 1, if the α-power sum of the induced-edge distribution of G is at most that of G', then H_α(G') ≤ H_α(G).
theorem ccz_renyi_entropy_le_of_rpow_sum_ge {V : Type*} [Fintype V] [DecidableEq V]
(G G' : SimpleGraph V) [DecidableRel G.Adj] [DecidableRel G'.Adj] {α : ℝ} (hα : 1 < α)
(hG : 0 < ∑ F : Finset (Sym2 V), (ccz_edge_distribution G F) ^ α)
(h : ∑ F : Finset (Sym2 V), (ccz_edge_distribution G F) ^ α ≤
∑ F : Finset (Sym2 V), (ccz_edge_distribution G' F) ^ α) :
ccz_renyi_entropy α G' ≤ ccz_renyi_entropy α Gccz_renyi_entropy_lt_of_rpow_sum_ltIn LeanQuantum Mechanics
For 0 < α < 1, if the α-power sum of the induced-edge distribution of G' is strictly smaller than that of G, then H_α(G') < H_α(G).
theorem ccz_renyi_entropy_lt_of_rpow_sum_lt {V : Type*} [Fintype V] [DecidableEq V]
(G G' : SimpleGraph V) [DecidableRel G.Adj] [DecidableRel G'.Adj] {α : ℝ}
(hα0 : 0 < α) (hα1 : α < 1)
(hG' : 0 < ∑ F : Finset (Sym2 V), (ccz_edge_distribution G' F) ^ α)
(h : ∑ F : Finset (Sym2 V), (ccz_edge_distribution G' F) ^ α <
∑ F : Finset (Sym2 V), (ccz_edge_distribution G F) ^ α) :
ccz_renyi_entropy α G' < ccz_renyi_entropy α Gccz_rpow_sum_posIn LeanQuantum Mechanics
For α > 0 the sum over all edge sets F of ccz_edge_distribution G F to the power α is strictly positive.
theorem ccz_rpow_sum_pos {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {α : ℝ} (hα : 0 < α) :
0 < ∑ F : Finset (Sym2 V), (ccz_edge_distribution G F) ^ αccz_star_graph_edge_distribution_emptyIn LeanQuantum Mechanics
For the star on n ≥ 1 vertices, exactly 2^{n-1} + 1 vertex subsets induce no edge (the 2^{n-1} subsets avoiding the centre, plus the subset {centre}), so the empty edge set carries mass (2^{n-1}+1)/2^n.
theorem ccz_star_graph_edge_distribution_empty {n : ℕ} (hn : 1 ≤ n) :
letI : DecidableRel (ccz_star_graph n).Adj := Classical.decRel _
ccz_edge_distribution (ccz_star_graph n) (∅ : Finset (Sym2 (Fin n)))
= ((2 : ℝ) ^ (n - 1) + 1) / (2 : ℝ) ^ nccz_star_graph_edge_distribution_of_nonemptyIn LeanQuantum Mechanics
For the star on n ≥ 1 vertices, every nonempty subset F of its edge set is the induced edge set of exactly one vertex subset (the centre together with the leaves named by F), and any other nonempty edge set has probability zero.
theorem ccz_star_graph_edge_distribution_of_nonempty {n : ℕ} (hn : 1 ≤ n)
(F : Finset (Sym2 (Fin n))) (hF : F.Nonempty) :
letI : DecidableRel (ccz_star_graph n).Adj := Classical.decRel _
ccz_edge_distribution (ccz_star_graph n) F
= if F ⊆ (ccz_star_graph n).edgeFinset then 1 / (2 : ℝ) ^ n else 0ccz_star_graph_four_rpow_half_sumIn LeanQuantum Mechanics
For the star graph on 4 vertices (knowledge-base ccz_star_graph 4), the sum over all edge sets of (induced-edge probability)^(1/2) equals 5/2, for any DecidableRel instance.
theorem ccz_star_graph_four_rpow_half_sum (i : DecidableRel (ccz_star_graph 4).Adj) :
letI : DecidableRel (ccz_star_graph 4).Adj := i
(∑ F : Finset (Sym2 (Fin 4)), ccz_edge_distribution (ccz_star_graph 4) F ^ ((1 : ℝ) / 2)) = 5 / 2ccz_star_graph_rpow_sumIn LeanQuantum Mechanics
For n ≥ 1 and α > 0, the order-α power sum of the star's induced-edge distribution is 2^{n-1}-1 atoms of size 2^{-n} plus one atom of size (2^{n-1}+1)/2^n.
theorem ccz_star_graph_rpow_sum {n : ℕ} (hn : 1 ≤ n) {α : ℝ} (hα : 0 < α) :
letI : DecidableRel (ccz_star_graph n).Adj := Classical.decRel _
∑ F : Finset (Sym2 (Fin n)), (ccz_edge_distribution (ccz_star_graph n) F) ^ α
= ((2 : ℝ) ^ (n - 1) - 1) * ((2 : ℝ) ^ n) ^ (-α)
+ (((2 : ℝ) ^ (n - 1) + 1) / (2 : ℝ) ^ n) ^ αccz_star_graph_rpow_sum_geIn LeanQuantum Mechanics
For n ≥ 2 and every real α > 0, the order-α power sum of the star's induced-edge distribution is at least 2^{(1-α)n}/4.
theorem ccz_star_graph_rpow_sum_ge {n : ℕ} (hn : 2 ≤ n) {α : ℝ} (hα : 0 < α) :
letI : DecidableRel (ccz_star_graph n).Adj := Classical.decRel _
(2 : ℝ) ^ ((1 - α) * (n : ℝ)) / 4 ≤
∑ F : Finset (Sym2 (Fin n)), (ccz_edge_distribution (ccz_star_graph n) F) ^ αcfc_rpow_conj_transposeIn LeanQuantum Mechanics
For a symmetric matrix A and an orthogonal matrix U (UᵀU = 1), the rpow functional calculus commutes with conjugation by U: cfc (x ↦ x^β) (UᵀAU) = Uᵀ · cfc (x ↦ x^β) A · U.
theorem cfc_rpow_conj_transpose {n : Type*} [Fintype n] [DecidableEq n]
(β : ℝ) (A U : Matrix n n ℝ) (hA : A.IsSymm) (hU : U.transpose * U = 1) :
cfc (fun x : ℝ => x ^ β) (U.transpose * A * U) =
U.transpose * cfc (fun x : ℝ => x ^ β) A * Ucfc_rpow_smulIn LeanQuantum Mechanics
For c > 0 and a positive semidefinite matrix A, the rpow functional calculus scales: cfc (x ↦ x^β) (c • A) = c^β • cfc (x ↦ x^β) A.
theorem cfc_rpow_smul {n : Type*} [Fintype n] [DecidableEq n] (β : ℝ)
(c : ℝ) (hc : 0 < c) (A : Matrix n n ℝ) (hA : A.PosSemidef) :
cfc (fun x : ℝ => x ^ β) (c • A) = c ^ β • cfc (fun x : ℝ => x ^ β) Aclaw_free_tree_degree_le_twoIn LeanQuantum Mechanics
If a finite tree T admits no induced claw (maximum claw packing 0), then every vertex of T has degree at most 2.
theorem claw_free_tree_degree_le_two {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) (hclaw : max_claw_packing T = 0) :
∀ v : V, T.degree v ≤ 2complete_bipartite_graph_connected_clique_free_threeIn LeanQuantum Mechanics
The complete bipartite graph with both parts nonempty is connected, triangle-free, and has exactly a*b edges.
theorem complete_bipartite_graph_connected_clique_free_three (a b : ℕ) (ha : 1 ≤ a) (hb : 1 ≤ b) :
(completeBipartiteGraph (Fin a) (Fin b)).Connected ∧
(completeBipartiteGraph (Fin a) (Fin b)).CliqueFree 3 ∧
Nat.card (completeBipartiteGraph (Fin a) (Fin b)).edgeSet = a * bcore_constant_b_attainedIn LeanQuantum Mechanics
For any integers d >= 2 and c >= 0, the core constant B(d, c) is attained by some marked core graph (J, s).
theorem core_constant_b_attained (d c : ℕ) (hd : 2 ≤ d) :
∃ (J : SimpleGraph (Fin (sparse_graph_state_fisher_core_k d c + 1)))
(s : Fin (sparse_graph_state_fisher_core_k d c + 1)),
is_marked_core_graph (sparse_graph_state_fisher_core_k d c) d c J s ∧
graph_state_fisher_q J - 1 = core_constant_b d ccore_k_satisfies_ineqIn LeanQuantum Mechanics
For any non-negative integers d and c, the core size k = sparse_graph_state_fisher_core_k d c satisfies d * k + c <= k^2 / 4.
theorem core_k_satisfies_ineq (d c : ℕ) :
d * sparse_graph_state_fisher_core_k d c + c ≤ (sparse_graph_state_fisher_core_k d c) ^ 2 / 4cycle_weighted_adjacency_matrix_mulVec_applyIn LeanQuantum Mechanics
For any commutative ring α, natural number n ≥ 3, weights t : Fin n → α, and vector v : Fin n → α, the matrix-vector multiplication (cycle_weighted_adjacency_matrix n t).mulVec v at index i equals (t i + t (i - 1)) * v (i - 1) + (t i + t (i + 1)) * v (i + 1).
theorem cycle_weighted_adjacency_matrix_mulVec_apply
{α : Type*} [CommRing α] (n : ℕ) (hn : 3 ≤ n) (t : Fin n → α) (v : Fin n → α) (i : Fin n) :
letI : NeZero n := ⟨by omega⟩
(cycle_weighted_adjacency_matrix n t).mulVec v i =
(t i + t (i - 1)) * v (i - 1) + (t i + t (i + 1)) * v (i + 1)cycle_weighted_adjacency_matrix_rank_full_of_differing_productsIn LeanQuantum Mechanics
For any field F of characteristic 2, natural number m ≥ 3, and injective nonzero function t : Fin (2 * m) → F, if the alternating edge weight products along the 2m-cycle differ, then the cycle weighted adjacency matrix has full rank 2m.
theorem cycle_weighted_adjacency_matrix_rank_full_of_differing_products
(m : ℕ) (hm : 3 ≤ m) {F : Type*} [Field F] [CharP F 2]
(t : Fin (2 * m) → F) (ht_inj : Function.Injective t) (ht_nz : ∀ i, t i ≠ 0)
(h_diff : (∏ i : Fin m, (t ⟨2 * i.val, by omega⟩ + t ⟨2 * i.val + 1, by omega⟩)) ≠
(∏ i : Fin m, (t ⟨2 * i.val + 1, by omega⟩ + t ⟨(2 * i.val + 2) % (2 * m), Nat.mod_lt _ (by omega)⟩))) :
(cycle_weighted_adjacency_matrix (2 * m) t).rank = 2 * mcycle_weighted_adjacency_matrix_rank_sub_two_of_matching_productsIn LeanQuantum Mechanics
For any field F of characteristic 2, natural number m ≥ 3, and injective nonzero function s : Fin (2 * m) → F, if the alternating edge weight products along the 2m-cycle are equal, then the cycle weighted adjacency matrix has rank 2m - 2.
theorem cycle_weighted_adjacency_matrix_rank_sub_two_of_matching_products
(m : ℕ) (hm : 3 ≤ m) {F : Type*} [Field F] [CharP F 2]
(s : Fin (2 * m) → F) (hs_inj : Function.Injective s) (hs_nz : ∀ i, s i ≠ 0)
(h_match : (∏ i : Fin m, (s ⟨2 * i.val, by omega⟩ + s ⟨2 * i.val + 1, by omega⟩)) =
(∏ i : Fin m, (s ⟨2 * i.val + 1, by omega⟩ + s ⟨(2 * i.val + 2) % (2 * m), Nat.mod_lt _ (by omega)⟩))) :
(cycle_weighted_adjacency_matrix (2 * m) s).rank = 2 * m - 2dephased_binary_kernel_gap_one_lipschitzIn LeanQuantum Mechanics
Adding one supported vertex changes the tripartite cut-kernel dimension gap by at most one, for any finite graph.
theorem dephased_binary_kernel_gap_one_lipschitz {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (P A B C : Finset V) (hAB : Disjoint A B) (hAC : Disjoint A C) (hBC : Disjoint B C) (v : V) : |dephased_binary_kernel_gap G (insert v P) A B C - dephased_binary_kernel_gap G P A B C| ≤ 1dephased_entropy_eq_supported_entropyIn LeanQuantum Mechanics
For a valid dephasing profile, the subsystem entropy is unchanged when the full cut kernel is replaced by its subspace supported on nonzero-parameter vertices, with the corresponding dimension and character distribution.
theorem dephased_entropy_eq_supported_entropy {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (q : V → ℝ) (hq : ∀ v, q v ∈ Set.Icc (0 : ℝ) 1) (S : Finset V) : dephased_tree_entropy G q S = dephased_supported_entropy G q Sdephased_graph_disconnected_entropy_additiveIn LeanQuantum Mechanics
If a finite graph has no edges between a vertex subset and its complement, the dephased entropy of any subsystem is the sum of its entropies in the two induced components.
theorem dephased_graph_disconnected_entropy_additive {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (q : V → ℝ) (hq : ∀ v, q v ∈ Set.Icc (0 : ℝ) 1) (L S : Finset V) (hsep : ∀ u ∈ L, ∀ v ∉ L, ¬ G.Adj u v) : dephased_tree_entropy G q S = dephased_tree_entropy (G.induce (↑L : Set V)) (fun v => q v.1) (Finset.univ.filter fun v : ↥L => v.1 ∈ S) + dephased_tree_entropy (G.induce (↑(Lᶜ : Finset V) : Set V)) (fun v => q v.1) (Finset.univ.filter fun v : ↥(Lᶜ : Finset V) => v.1 ∈ S)dephased_graph_zero_edge_entropy_invariantIn LeanQuantum Mechanics
Removing an edge between two vertices whose dephasing parameters are zero leaves every subsystem entropy unchanged, for any finite simple graph.
theorem dephased_graph_zero_edge_entropy_invariant {V : Type*} [Fintype V] [DecidableEq V] (G G' : SimpleGraph V) [DecidableRel G.Adj] [DecidableRel G'.Adj] (u v : V) (hedge : ∀ x y : V, G'.Adj x y ↔ G.Adj x y ∧ ¬ ((x = u ∧ y = v) ∨ (x = v ∧ y = u))) (q : V → ℝ) (hq : ∀ w, q w ∈ Set.Icc (0 : ℝ) 1) (hu : q u = 0) (hv : q v = 0) (S : Finset V) : dephased_tree_entropy G q S = dephased_tree_entropy G' q Sdephased_path_active_position_add_greedy_countIn LeanQuantum Mechanics
Among the positions of S ∩ P, those not struck by the greedy scan and right-compatible, plus the number of edges the greedy matching chose, equals |S ∩ P|. In words: the greedy matching is maximal on the active-edge path, and every active vertex is either the endpoint of a chosen edge or counted once by the filter.
open scoped Classical in
theorem dephased_path_active_position_add_greedy_count
(n : ℕ) (S P : Finset (Fin n)) (left right : Bool) :
(Finset.univ.filter (fun b : Fin n =>
dephased_path_active_position n (S.image Fin.val) (P.image Fin.val) left right b.val)).card
+ (dephased_path_greedy_state n (S.image Fin.val) (P.image Fin.val) left right (n + 1)).2
= (S ∩ P).carddephased_path_aux_adj_iffIn LeanQuantum Mechanics
Two vertices u, w of the subsystem are adjacent in the auxiliary equality graph of the path exactly when they are two apart with the intervening vertex outside the subsystem.
theorem dephased_path_aux_adj_iff (n : ℕ) (S : Finset (Fin n)) (u w : ↥S) :
(dephased_path_aux_graph n S).Adj u w ↔
∃ k : Fin n, k ∉ S ∧
((u.1.val + 1 = k.val ∧ k.val + 1 = w.1.val) ∨
(w.1.val + 1 = k.val ∧ k.val + 1 = u.1.val))dephased_path_aux_reachable_fillIn LeanQuantum Mechanics
If k lies between u and w and has the parity of u, and u is reachable from w in the auxiliary graph, then k is in the subsystem and in u's connected component.
theorem dephased_path_aux_reachable_fill (n : ℕ) (S : Finset (Fin n)) (u w : ↥S)
(hle : u.1.val ≤ w.1.val) (h : (dephased_path_aux_graph n S).Reachable u w)
(k : Fin n) (hk1 : u.1.val ≤ k.val) (hk2 : k.val ≤ w.1.val)
(hk : k.val % 2 = u.1.val % 2) :
∃ hkS : k ∈ S, (dephased_path_aux_graph n S).connectedComponentMk ⟨k, hkS⟩ =
(dephased_path_aux_graph n S).connectedComponentMk udephased_path_aux_reachable_of_step_chainIn LeanQuantum Mechanics
Two subsystem vertices of the same parity, with every vertex strictly between them of the opposite parity outside the subsystem, are reachable in the auxiliary equality graph.
theorem dephased_path_aux_reachable_of_step_chain (n : ℕ) (S : Finset (Fin n)) (u w : ↥S)
(hpar : u.1.val % 2 = w.1.val % 2)
(hhole : ∀ k : Fin n, min u.1.val w.1.val < k.val → k.val < max u.1.val w.1.val →
k.val % 2 ≠ u.1.val % 2 → k ∉ S) :
(dephased_path_aux_graph n S).Reachable u wdephased_path_aux_reachable_parity_holesIn LeanQuantum Mechanics
Vertices joined in the auxiliary equality graph of a path have the same parity, and every vertex strictly between them of the opposite parity lies outside the subsystem.
theorem dephased_path_aux_reachable_parity_holes (n : ℕ) (S : Finset (Fin n)) (u w : ↥S)
(h : (dephased_path_aux_graph n S).Reachable u w) :
u.1.val % 2 = w.1.val % 2 ∧
∀ k : Fin n, min u.1.val w.1.val < k.val → k.val < max u.1.val w.1.val →
k.val % 2 ≠ u.1.val % 2 → k ∉ Sdephased_path_block_card_eq_active_position_cardIn LeanQuantum Mechanics
The unpinned alternating blocks are in bijection with the active positions, via the right endpoint; hence the two cardinalities agree. No nonemptiness of the path is needed.
open scoped Classical in
theorem dephased_path_block_card_eq_active_position_card
(n : ℕ) (S P : Finset (Fin n)) (left right : Bool) :
(Finset.univ.filter fun ab : Fin n × Fin n =>
let a := ab.1
let b := ab.2
a.val ≤ b.val ∧ a.val % 2 = b.val % 2 ∧
dephased_path_interval_block n a b ⊆ (S ∩ P) ∧
(∀ k : Fin n, a.val < k.val → k.val < b.val → k.val % 2 ≠ a.val % 2 → k ∉ S) ∧
(∀ k : Fin n, k.val + 1 = a.val ∨ b.val + 1 = k.val → k ∈ S) ∧
(a.val = 0 → left = false) ∧ (b.val + 1 = n → right = false)).card
= (Finset.univ.filter (fun b : Fin n =>
dephased_path_active_position n (S.image Fin.val) (P.image Fin.val) left right b.val)).carddephased_path_block_image_sndIn LeanQuantum Mechanics
A position b is the right endpoint of an unpinned alternating block if and only if b lies in S ∩ P, the greedy scan did not choose the edge at b+1, and b is right-compatible (b+1 = n with right = false, or b+1 ∈ S).
open scoped Classical in
theorem dephased_path_block_image_snd
(n : ℕ) (S P : Finset (Fin n)) (left right : Bool) :
(Finset.univ.filter fun ab : Fin n × Fin n =>
let a := ab.1
let b := ab.2
a.val ≤ b.val ∧ a.val % 2 = b.val % 2 ∧
dephased_path_interval_block n a b ⊆ (S ∩ P) ∧
(∀ k : Fin n, a.val < k.val → k.val < b.val → k.val % 2 ≠ a.val % 2 → k ∉ S) ∧
(∀ k : Fin n, k.val + 1 = a.val ∨ b.val + 1 = k.val → k ∈ S) ∧
(a.val = 0 → left = false) ∧ (b.val + 1 = n → right = false)).image Prod.snd
= Finset.univ.filter (fun b : Fin n =>
dephased_path_active_position n (S.image Fin.val) (P.image Fin.val) left right b.val)dephased_path_block_right_endpoint_injectiveIn LeanQuantum Mechanics
If (a,b) and (a',b') are both unpinned alternating blocks and b = b', then a = a'. Equivalently, the second projection is injective on the set of blocks.
open scoped Classical in
theorem dephased_path_block_right_endpoint_injective
(n : ℕ) (S P : Finset (Fin n)) (left right : Bool) :
Set.InjOn (fun ab : Fin n × Fin n => ab.2)
↑((Finset.univ : Finset (Fin n × Fin n)).filter fun ab =>
let a := ab.1
let b := ab.2
a.val ≤ b.val ∧ a.val % 2 = b.val % 2 ∧
dephased_path_interval_block n a b ⊆ (S ∩ P) ∧
(∀ k : Fin n, a.val < k.val → k.val < b.val → k.val % 2 ≠ a.val % 2 → k ∉ S) ∧
(∀ k : Fin n, k.val + 1 = a.val ∨ b.val + 1 = k.val → k ∈ S) ∧
(a.val = 0 → left = false) ∧ (b.val + 1 = n → right = false))dephased_path_canonical_sites_certificateIn LeanQuantum Mechanics
The canonical segment selection bounds every binary path interval gap by its sum of local defects.
open scoped Classical BigOperators in
theorem dephased_path_canonical_sites_certificate (n : ℕ) (color : Fin n → Fin 4) (left right : Finset (Fin 4)) (P : Finset (Fin n)) : (∑ i ∈ dephased_path_canonical_sites n color, (dephased_path_binary_weight n P i.val - dephased_path_binary_weight n P (i.val - 1) * dephased_path_binary_weight n P (i.val + 1))) ≤ dephased_path_interval_polynomial n color left right (fun i => if i ∈ P then 1 else 0)
dephased_path_constant_gap_certificateIn LeanQuantum Mechanics
For every colored path with arbitrary endpoint leaf colors there is a set of internal sites whose local-gap sum bounds the interval polynomial from below on every binary support.
open scoped Classical BigOperators in
theorem dephased_path_constant_gap_certificate (n : ℕ) (color : Fin n → Fin 4) (left right : Finset (Fin 4)) : ∃ E : Finset (Fin n), (∀ i ∈ E, 0 < i.val ∧ i.val + 1 < n) ∧ ∀ P : Finset (Fin n), (∑ i ∈ E, (dephased_path_binary_weight n P i.val - dephased_path_binary_weight n P (i.val - 1) * dephased_path_binary_weight n P (i.val + 1))) ≤ dephased_path_interval_polynomial n color left right (fun i => if i ∈ P then 1 else 0)
dephased_path_entropy_internal_singletonIn LeanQuantum Mechanics
For n : ℕ, q : Fin n → ℝ, and 1 ≤ i with i + 1 < n, the dephased path entropy of the singleton {i} equals 1.
theorem dephased_path_entropy_internal_singleton
(n : ℕ) (q : Fin n → ℝ) (i : ℕ) (h1 : 1 ≤ i) (h2 : i + 1 < n) :
dephased_path_entropy n q {⟨i, by omega⟩} = 1dephased_path_entropy_punctured_pathIn LeanQuantum Mechanics
For n : ℕ, q : Fin n → ℝ, and 1 ≤ i with i + 1 < n, the dephased path entropy of the punctured path {j : Fin n | j.val ≠ i} equals 1 + binaryEntropy ((1 - q ⟨i - 1, by omega⟩ * q ⟨i + 1, by omega⟩) / 2) + ∑_{j + 1 < i} binaryEntropy ((1 - q j) / 2) + ∑_{i + 1 < j} binaryEntropy ((1 - q j) / 2).
theorem dephased_path_entropy_punctured_path
(n : ℕ) (q : Fin n → ℝ) (i : ℕ) (h1 : 1 ≤ i) (h2 : i + 1 < n) :
dephased_path_entropy n q (Finset.univ.filter (fun j => j.val ≠ i)) =
1 + binaryEntropy ((1 - q ⟨i - 1, by omega⟩ * q ⟨i + 1, by omega⟩) / 2) +
∑ j ∈ Finset.univ.filter (fun j => j.val + 1 < i), binaryEntropy ((1 - q j) / 2) +
∑ j ∈ Finset.univ.filter (fun j => i + 1 < j.val), binaryEntropy ((1 - q j) / 2)dephased_path_entropy_three_block_AIn LeanQuantum Mechanics
For n : ℕ, q : Fin n → ℝ, and 1 ≤ i with i + 1 < n, the dephased path entropy of the initial block {j : Fin n | j.val < i} equals 1 + ∑_{j + 1 < i} binaryEntropy ((1 - q j) / 2).
theorem dephased_path_entropy_three_block_A
(n : ℕ) (q : Fin n → ℝ) (i : ℕ) (h1 : 1 ≤ i) (h2 : i + 1 < n) :
dephased_path_entropy n q (Finset.univ.filter (fun j => j.val < i)) =
1 + ∑ j ∈ Finset.univ.filter (fun j => j.val + 1 < i), binaryEntropy ((1 - q j) / 2)dephased_path_entropy_three_block_ABIn LeanQuantum Mechanics
For n : ℕ, q : Fin n → ℝ, and 1 ≤ i with i + 1 < n, the dephased path entropy of {j : Fin n | j.val < i + 1} equals 1 + binaryEntropy ((1 - q ⟨i - 1, by omega⟩) / 2) + ∑_{j + 1 < i} binaryEntropy ((1 - q j) / 2).
theorem dephased_path_entropy_three_block_AB
(n : ℕ) (q : Fin n → ℝ) (i : ℕ) (h1 : 1 ≤ i) (h2 : i + 1 < n) :
dephased_path_entropy n q (Finset.univ.filter (fun j => j.val < i + 1)) =
1 + binaryEntropy ((1 - q ⟨i - 1, by omega⟩) / 2) +
∑ j ∈ Finset.univ.filter (fun j => j.val + 1 < i), binaryEntropy ((1 - q j) / 2)dephased_path_entropy_three_block_BCIn LeanQuantum Mechanics
For n : ℕ, q : Fin n → ℝ, and 1 ≤ i with i + 1 < n, the dephased path entropy of {j : Fin n | i ≤ j.val} equals 1 + binaryEntropy ((1 - q ⟨i + 1, by omega⟩) / 2) + ∑_{i + 1 < j} binaryEntropy ((1 - q j) / 2).
theorem dephased_path_entropy_three_block_BC
(n : ℕ) (q : Fin n → ℝ) (i : ℕ) (h1 : 1 ≤ i) (h2 : i + 1 < n) :
dephased_path_entropy n q (Finset.univ.filter (fun j => i ≤ j.val)) =
1 + binaryEntropy ((1 - q ⟨i + 1, by omega⟩) / 2) +
∑ j ∈ Finset.univ.filter (fun j => i + 1 < j.val), binaryEntropy ((1 - q j) / 2)dephased_path_entropy_three_block_CIn LeanQuantum Mechanics
For n : ℕ, q : Fin n → ℝ, and 1 ≤ i with i + 1 < n, the dephased path entropy of the final block {j : Fin n | i < j.val} equals 1 + ∑_{i + 1 < j} binaryEntropy ((1 - q j) / 2).
theorem dephased_path_entropy_three_block_C
(n : ℕ) (q : Fin n → ℝ) (i : ℕ) (h1 : 1 ≤ i) (h2 : i + 1 < n) :
dephased_path_entropy n q (Finset.univ.filter (fun j => i < j.val)) =
1 + ∑ j ∈ Finset.univ.filter (fun j => i + 1 < j.val), binaryEntropy ((1 - q j) / 2)dephased_path_entropy_univ_three_block_partitionIn LeanQuantum Mechanics
For n : ℕ, q : Fin n → ℝ, and 1 ≤ i with i + 1 < n, the dephased path entropy of Finset.univ equals binaryEntropy ((1 - q ⟨i, by omega⟩) / 2) + binaryEntropy ((1 - q ⟨i - 1, by omega⟩) / 2) + binaryEntropy ((1 - q ⟨i + 1, by omega⟩) / 2) + ∑_{j + 1 < i} binaryEntropy ((1 - q j) / 2) + ∑_{i + 1 < j} binaryEntropy ((1 - q j) / 2).
theorem dephased_path_entropy_univ_three_block_partition
(n : ℕ) (q : Fin n → ℝ) (i : ℕ) (h1 : 1 ≤ i) (h2 : i + 1 < n) :
dephased_path_entropy n q Finset.univ =
binaryEntropy ((1 - q ⟨i, by omega⟩) / 2) +
binaryEntropy ((1 - q ⟨i - 1, by omega⟩) / 2) +
binaryEntropy ((1 - q ⟨i + 1, by omega⟩) / 2) +
∑ j ∈ Finset.univ.filter (fun j => j.val + 1 < i), binaryEntropy ((1 - q j) / 2) +
∑ j ∈ Finset.univ.filter (fun j => i + 1 < j.val), binaryEntropy ((1 - q j) / 2)dephased_path_free_component_indicator_mem_supported_kernelIn LeanQuantum Mechanics
If every vertex of a connected component of the auxiliary graph is unmarked and has nonzero parameter, the indicator of that component lies in the supported cut kernel.
open scoped Classical in
theorem dephased_path_free_component_indicator_mem_supported_kernel
(n : ℕ) (q : Fin n → ℝ) (S : Finset (Fin n))
(c : (dephased_path_aux_graph n S).ConnectedComponent)
(hc : dephased_path_free_component n S c)
(hq : ∀ u : ↥S, (dephased_path_aux_graph n S).connectedComponentMk u = c → q u.1 ≠ 0) :
(fun i : ↥S => if (dephased_path_aux_graph n S).connectedComponentMk i = c then (1 : ZMod 2) else 0)
∈ dephased_supported_kernel (SimpleGraph.pathGraph n) q Sdephased_path_greedy_chosen_succIn LeanQuantum Mechanics
chosen(b+1) = (edge(b+1) and not chosen(b)), where chosen(b) records whether the edge at position b was chosen by the left-to-right greedy scan.
open scoped Classical in
theorem dephased_path_greedy_chosen_succ (n : ℕ) (I D : Finset ℕ) (left right : Bool) (b : ℕ) :
dephased_path_greedy_chosen n I D left right (b + 1) =
(dephased_path_active_edge n I D left right (b + 1) &&
!dephased_path_greedy_chosen n I D left right b)dephased_path_interval_block_minimalIn LeanQuantum Mechanics
If a supported kernel vector is the indicator of the alternating block of an interval [a,b] contained in the subsystem with all intervening opposite-parity vertices outside it, then it is nonzero and minimal among nonzero supported vectors whose 1-set is contained in its own.
open scoped Classical in
theorem dephased_path_interval_block_minimal
(n : ℕ) (q : Fin n → ℝ) (S : Finset (Fin n))
(x : dephased_supported_kernel (SimpleGraph.pathGraph n) q S) (a b : Fin n)
(hab : a.val ≤ b.val) (hpar : a.val % 2 = b.val % 2)
(hsub : dephased_path_interval_block n a b ⊆ S)
(hout : ∀ k : Fin n, a.val < k.val → k.val < b.val →
k.val % 2 ≠ a.val % 2 → k ∉ S)
(hx : ∀ i : ↥S, x.1 i = 1 ↔ i.1 ∈ dephased_path_interval_block n a b) :
x ≠ 0 ∧ ∀ y : dephased_supported_kernel (SimpleGraph.pathGraph n) q S,
y ≠ 0 → (∀ i : ↥S, y.1 i = 1 → x.1 i = 1) → y = xdephased_path_interval_eq_block_gapIn LeanQuantum Mechanics
For an ordinary path, the alternating-interval polynomial is exactly the tripartite gap of supported-kernel block weights.
open scoped Classical in
theorem dephased_path_interval_eq_block_gap (n : ℕ) (color : Fin n → Fin 4) (q : Fin n → ℝ) : let A := Finset.univ.filter (fun i : Fin n => color i = 0); let B := Finset.univ.filter (fun i : Fin n => color i = 1); let C := Finset.univ.filter (fun i : Fin n => color i = 2); let weight := dephased_kernel_block_weight (SimpleGraph.pathGraph n) q; dephased_path_interval_polynomial n color ∅ ∅ q = weight A + weight B + weight C - weight (A ∪ B) - weight (A ∪ C) - weight (B ∪ C) + weight (A ∪ B ∪ C)
dephased_path_interval_equal_color_splitIn LeanQuantum Mechanics
Cutting an edge between two equally colored path vertices splits the interval polynomial into the sum of the two smaller interval polynomials, with the opposite endpoint color recorded as a leaf.
open scoped Classical in
theorem dephased_path_interval_equal_color_split (m k : ℕ) (hm : 0 < m) (hk : 0 < k) (cl : Fin m → Fin 4) (cr : Fin k → Fin 4) (ql : Fin m → ℝ) (qr : Fin k → ℝ) (left right : Finset (Fin 4)) (hcolor : cl ⟨m - 1, by omega⟩ = cr ⟨0, hk⟩) : dephased_path_interval_polynomial (m + k) (Fin.addCases cl cr) left right (Fin.addCases ql qr) = dephased_path_interval_polynomial m cl left {cr ⟨0, hk⟩} ql + dephased_path_interval_polynomial k cr {cl ⟨m - 1, by omega⟩} right qrdephased_path_interval_polynomial_nonnegativeIn LeanQuantum Mechanics
For any path coloring and endpoint leaf colors, the explicit alternating-interval polynomial is nonnegative under the local noise inequalities.
theorem dephased_path_interval_polynomial_nonnegative (n : ℕ) (color : Fin n → Fin 4) (left right : Finset (Fin 4)) (q : Fin n → ℝ) (hq : ∀ i, q i ∈ Set.Icc (0 : ℝ) 1) (hlocal : ∀ i j k : Fin n, i.val + 1 = j.val → j.val + 1 = k.val → q j ≥ q i * q k) : 0 ≤ dephased_path_interval_polynomial n color left right q
dephased_path_kernel_aux_adj_eqIn LeanQuantum Mechanics
If two vertices u, w of the subsystem have a common neighbour v outside the subsystem, then any cut-kernel vector takes the same value at u and at w.
open scoped Classical in
theorem dephased_path_kernel_aux_adj_eq (n : ℕ) (S : Finset (Fin n)) (y : ↥S → ZMod 2)
(hy : y ∈ tree_submatrix_ker (SimpleGraph.pathGraph n) S) {u w : ↥S}
(h : (dephased_path_aux_graph n S).Adj u w) : y u = y wdephased_path_kernel_eq_of_reachableIn LeanQuantum Mechanics
Vertices joined by a path in the auxiliary equality graph have equal entries in every cut-kernel vector.
open scoped Classical in
theorem dephased_path_kernel_eq_of_reachable (n : ℕ) (S : Finset (Fin n)) (y : ↥S → ZMod 2)
(hy : y ∈ tree_submatrix_ker (SimpleGraph.pathGraph n) S) {u w : ↥S}
(h : (dephased_path_aux_graph n S).Reachable u w) : y u = y wdephased_path_kernel_interval_block_constIn LeanQuantum Mechanics
If the alternating block of the interval [a,b] lies in the subsystem and every intervening opposite-parity vertex is outside it, then every cut-kernel vector takes the same value at any two positions of the block.
open scoped Classical in
theorem dephased_path_kernel_interval_block_const (n : ℕ) (S : Finset (Fin n)) (y : ↥S → ZMod 2)
(hy : y ∈ tree_submatrix_ker (SimpleGraph.pathGraph n) S)
(a b : Fin n) (hab : a.val ≤ b.val) (hpar : a.val % 2 = b.val % 2)
(hsub : dephased_path_interval_block n a b ⊆ S)
(hout : ∀ k : Fin n, a.val < k.val → k.val < b.val → k.val % 2 ≠ a.val % 2 → k ∉ S)
(i j : ↥S) (hi : i.1 ∈ dephased_path_interval_block n a b)
(hj : j.1 ∈ dephased_path_interval_block n a b) : y i = y jdephased_path_kernel_marked_zeroIn LeanQuantum Mechanics
If u in the subsystem is the only subsystem neighbour of some vertex outside the subsystem, then every cut-kernel vector vanishes at u.
open scoped Classical in
theorem dephased_path_kernel_marked_zero (n : ℕ) (S : Finset (Fin n)) (y : ↥S → ZMod 2)
(hy : y ∈ tree_submatrix_ker (SimpleGraph.pathGraph n) S) {u : ↥S}
(hu : u.1 ∈ dephased_path_marked n S) : y u = 0dephased_path_kernel_row_sumIn LeanQuantum Mechanics
A binary vector on the subsystem S lies in the cut kernel of the path graph exactly when, for every vertex v outside S, the sum of its entries at the S-neighbours of v (counted with multiplicity 1 over ZMod 2) is zero.
open scoped Classical in
theorem dephased_path_kernel_row_sum (n : ℕ) (S : Finset (Fin n)) (y : ↥S → ZMod 2) :
y ∈ tree_submatrix_ker (SimpleGraph.pathGraph n) S ↔
∀ v : Fin n, v ∉ S →
(∑ u : ↥S, (if (SimpleGraph.pathGraph n).Adj v u.1 then (1 : ZMod 2) else 0) * y u) = 0dephased_path_min_support_is_free_componentIn LeanQuantum Mechanics
A nonzero supported cut-kernel vector whose 1-set is minimal among those of nonzero supported vectors is the indicator of a single free component of the auxiliary equality graph.
open scoped Classical in
theorem dephased_path_min_support_is_free_component
(n : ℕ) (q : Fin n → ℝ) (S : Finset (Fin n))
(x : dephased_supported_kernel (SimpleGraph.pathGraph n) q S)
(hx : x ≠ 0 ∧ ∀ y : dephased_supported_kernel (SimpleGraph.pathGraph n) q S,
y ≠ 0 → (∀ i : ↥S, y.1 i = 1 → x.1 i = 1) → y = x) :
∃ c : (dephased_path_aux_graph n S).ConnectedComponent,
dephased_path_free_component n S c ∧
∀ i : ↥S, x.1 i = 1 ↔ (dephased_path_aux_graph n S).connectedComponentMk i = cdephased_path_min_support_is_interval_blockIn LeanQuantum Mechanics
A nonzero supported cut-kernel vector minimal among such vectors has its support equal to the alternating block of an interval [a,b] contained in the subsystem, all of whose intervening opposite-parity vertices lie outside the subsystem.
open scoped Classical in
theorem dephased_path_min_support_is_interval_block
(n : ℕ) (q : Fin n → ℝ) (S : Finset (Fin n))
(x : dephased_supported_kernel (SimpleGraph.pathGraph n) q S)
(hx : x ≠ 0 ∧ ∀ y : dephased_supported_kernel (SimpleGraph.pathGraph n) q S,
y ≠ 0 → (∀ i : ↥S, y.1 i = 1 → x.1 i = 1) → y = x) :
∃ a b : Fin n, a.val ≤ b.val ∧ a.val % 2 = b.val % 2 ∧
dephased_path_interval_block n a b ⊆ S ∧
(∀ k : Fin n, a.val < k.val → k.val < b.val →
k.val % 2 ≠ a.val % 2 → k ∉ S) ∧
∀ i : ↥S, x.1 i = 1 ↔ i.1 ∈ dephased_path_interval_block n a bdephased_path_minimal_supported_kernel_intervalIn LeanQuantum Mechanics
For a path cut and any real parameter profile, a supported binary cut-kernel vector has minimal nonempty support exactly when that support consists of alternating vertices in a path interval whose intervening vertices are outside the subsystem.
theorem dephased_path_minimal_supported_kernel_interval
(n : ℕ) (q : Fin n → ℝ) (S : Finset (Fin n))
(x : dephased_supported_kernel (SimpleGraph.pathGraph n) q S) :
(x ≠ 0 ∧ ∀ y : dephased_supported_kernel (SimpleGraph.pathGraph n) q S,
y ≠ 0 → (∀ i : ↥S, y.1 i = 1 → x.1 i = 1) → y = x) ↔
∃ a b : Fin n, a.val ≤ b.val ∧ a.val % 2 = b.val % 2 ∧
dephased_path_interval_block n a b ⊆ S ∧
(∀ k : Fin n, a.val < k.val → k.val < b.val →
k.val % 2 ≠ a.val % 2 → k ∉ S) ∧
∀ i : ↥S, x.1 i = 1 ↔ i.1 ∈ dephased_path_interval_block n a bdephased_path_tripartite_info_n_eq_three_le_zero_iffIn LeanQuantum Mechanics
For n = 3, tripartite information is nonpositive for all pairwise disjoint triples if and only if it is nonpositive for the singleton triple {0}, {1}, {2}.
theorem dephased_path_tripartite_info_n_eq_three_le_zero_iff (q : Fin 3 → ℝ) :
(∀ A B C : Finset (Fin 3), Disjoint A B → Disjoint A C → Disjoint B C →
dephased_path_tripartite_info 3 q A B C ≤ 0) ↔
dephased_path_tripartite_info 3 q {⟨0, by decide⟩} {⟨1, by decide⟩} {⟨2, by decide⟩} ≤ 0dephased_path_tripartite_info_n_eq_three_singletonIn LeanQuantum Mechanics
The tripartite information of the three singleton sets {0}, {1}, {2} for a path of length 3 equals binaryEntropy ((1 - q 1) / 2) - binaryEntropy ((1 - q 0 * q 2) / 2).
theorem dephased_path_tripartite_info_n_eq_three_singleton (q : Fin 3 → ℝ) :
dephased_path_tripartite_info 3 q {⟨0, by decide⟩} {⟨1, by decide⟩} {⟨2, by decide⟩} =
binaryEntropy ((1 - q ⟨1, by decide⟩) / 2) -
binaryEntropy ((1 - q ⟨0, by decide⟩ * q ⟨2, by decide⟩) / 2)dephased_path_unpinned_intervals_add_greedy_matchingIn LeanQuantum Mechanics
On a nonempty path, the number of unpinned alternating blocks of active subsystem vertices plus the number of edges chosen by the left-to-right greedy matching of active cut edges equals the number of active subsystem vertices. The two Boolean flags encode possible pin edges at the ends.
open scoped Classical in
theorem dephased_path_unpinned_intervals_add_greedy_matching
(n : ℕ) (hn : 0 < n) (S P : Finset (Fin n)) (left right : Bool) :
let I : Finset ℕ := S.image Fin.val
let D : Finset ℕ := P.image Fin.val
let blocks : Finset (Fin n × Fin n) := Finset.univ.filter fun ab =>
let a := ab.1
let b := ab.2
a.val ≤ b.val ∧ a.val % 2 = b.val % 2 ∧
dephased_path_interval_block n a b ⊆ (S ∩ P) ∧
(∀ k : Fin n, a.val < k.val → k.val < b.val → k.val % 2 ≠ a.val % 2 → k ∉ S) ∧
(∀ k : Fin n, k.val + 1 = a.val ∨ b.val + 1 = k.val → k ∈ S) ∧
(a.val = 0 → left = false) ∧ (b.val + 1 = n → right = false)
let edge : ℕ → Bool := fun e =>
if e = 0 then left && decide (0 ∈ I ∧ 0 ∈ D)
else if e = n then right && decide (n - 1 ∈ I ∧ n - 1 ∈ D)
else decide (((e - 1 ∈ I ∧ e - 1 ∈ D) ∧ e ∉ I) ∨
((e ∈ I ∧ e ∈ D) ∧ e - 1 ∉ I))
let scan : Bool × ℕ := (List.range (n + 1)).foldl
(fun acc e => if edge e && !acc.1 then (true, acc.2 + 1) else (false, acc.2))
(false, 0)
blocks.card + scan.2 = (S ∩ P).carddephased_periodic_path_interval_formulaIn LeanQuantum Mechanics
For a path colored cyclically with the three party colors and no endpoint leaves, the interval polynomial is the sum of internal weights minus the sum of products at distance two.
open scoped Classical BigOperators in
theorem dephased_periodic_path_interval_formula (n : ℕ) (q : ℕ → ℝ) : dephased_path_interval_polynomial n (fun i : Fin n => ⟨i.val % 3, by omega⟩) ∅ ∅ (fun i => q i.val) = (∑ i ∈ Finset.range (n - 2), q (i + 1)) - (∑ i ∈ Finset.range (n - 2), q i * q (i + 2))
dephased_pruned_zero_vertex_degree_le_oneIn LeanQuantum Mechanics
After removing all zero-zero edges, every zero-parameter vertex has degree at most one under the local criterion.
theorem dephased_pruned_zero_vertex_degree_le_one {V : Type*} [Fintype V] [DecidableEq V] (G H : SimpleGraph V) [DecidableRel G.Adj] [DecidableRel H.Adj] (q : V → ℝ) (hq : ∀ v, q v ∈ Set.Icc (0 : ℝ) 1) (hlocal : dephased_tree_local_noise_criterion G q) (hedge : ∀ x y, H.Adj x y ↔ G.Adj x y ∧ (q x ≠ 0 ∨ q y ≠ 0)) (v : V) (hv : q v = 0) : H.degree v ≤ 1dephased_reduced_even_binary_nonnegativeIn LeanQuantum Mechanics
Every even-length reduced four-color path has nonnegative binary interval gap, for arbitrary endpoint leaves.
open scoped Classical in
theorem dephased_reduced_even_binary_nonnegative (n : ℕ) (color : Fin n → Fin 4) (left right : Finset (Fin 4)) (P : Finset (Fin n)) (hproper : ∀ i j : Fin n, i.val + 1 = j.val → color i ≠ color j) (heven : n % 2 = 0) : 0 ≤ dephased_path_interval_polynomial n color left right (fun i => if i ∈ P then 1 else 0)
dephased_reduced_odd_binary_local_gapIn LeanQuantum Mechanics
Every odd-position rainbow site supplies a binary local-gap certificate on a reduced odd-length path.
open scoped Classical in
theorem dephased_reduced_odd_binary_local_gap (n : ℕ) (color : Fin n → Fin 4) (left right : Finset (Fin 4)) (P : Finset (Fin n)) (hproper : ∀ i j : Fin n, i.val + 1 = j.val → color i ≠ color j) (hodd : n % 2 = 1) (j : Fin n) (hjodd : j.val % 2 = 1) (hrainbow : dephased_path_rainbow_site n color j) : dephased_path_binary_weight n P j.val - dephased_path_binary_weight n P (j.val - 1) * dephased_path_binary_weight n P (j.val + 1) ≤ dephased_path_interval_polynomial n color left right (fun i => if i ∈ P then 1 else 0)
dephased_reduced_odd_binary_no_rainbowIn LeanQuantum Mechanics
A reduced odd-length path with no odd-position rainbow site has nonnegative binary interval gap.
open scoped Classical in
theorem dephased_reduced_odd_binary_no_rainbow (n : ℕ) (color : Fin n → Fin 4) (left right : Finset (Fin 4)) (P : Finset (Fin n)) (hproper : ∀ i j : Fin n, i.val + 1 = j.val → color i ≠ color j) (hodd : n % 2 = 1) (hnone : ∀ j : Fin n, j.val % 2 = 1 → ¬ dephased_path_rainbow_site n color j) : 0 ≤ dephased_path_interval_polynomial n color left right (fun i => if i ∈ P then 1 else 0)
dephased_tree_binary_entropy_eq_nullityIn LeanQuantum Mechanics
For a zero-one noise profile, the entropy equals the subsystem size minus the cut-kernel dimension restricted to the one-parameter support.
open scoped Classical in
theorem dephased_tree_binary_entropy_eq_nullity {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (P S : Finset V) : dephased_tree_entropy G (fun v => if v ∈ P then 1 else 0) S = (S.card : ℝ) - (dephased_binary_kernel_nullity G P S : ℝ)dephased_tree_block_polynomial_mmiIn LeanQuantum Mechanics
For a locally admissible noise profile on a finite tree, the inclusion-minimal supported-kernel product sum has nonnegative tripartite alternating sum on every three disjoint regions.
theorem dephased_tree_block_polynomial_mmi {V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) (q : V → ℝ) (hq : ∀ v, q v ∈ Set.Icc (0 : ℝ) 1) (hlocal : dephased_tree_local_noise_criterion T q) (A B C : Finset V) (hAB : Disjoint A B) (hAC : Disjoint A C) (hBC : Disjoint B C) : 0 ≤ dephased_kernel_block_weight T q A + dephased_kernel_block_weight T q B + dephased_kernel_block_weight T q C - dephased_kernel_block_weight T q (A ∪ B) - dephased_kernel_block_weight T q (A ∪ C) - dephased_kernel_block_weight T q (B ∪ C) + dephased_kernel_block_weight T q (A ∪ B ∪ C)dephased_tree_block_series_implies_mmiIn LeanQuantum Mechanics
If the block-polynomial tripartite inequality holds at every positive even power of the noise profile, then the dephased tripartite information is nonpositive.
theorem dephased_tree_block_series_implies_mmi {V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj] (q : V → ℝ) (hq : ∀ v, q v ∈ Set.Icc (0 : ℝ) 1) (hlocal : dephased_tree_local_noise_criterion T q) (A B C : Finset V) (hAB : Disjoint A B) (hAC : Disjoint A C) (hBC : Disjoint B C) (hpoly : ∀ n : ℕ, let z : V → ℝ := fun v => (q v) ^ (2*(n+1)); 0 ≤ dephased_kernel_block_weight T z A + dephased_kernel_block_weight T z B + dephased_kernel_block_weight T z C - dephased_kernel_block_weight T z (A ∪ B) - dephased_kernel_block_weight T z (A ∪ C) - dephased_kernel_block_weight T z (B ∪ C) + dephased_kernel_block_weight T z (A ∪ B ∪ C)) : dephased_tree_tripartite_info T q A B C ≤ 0dephased_tree_entropy_of_no_constraintsIn LeanQuantum Mechanics
If every row of the cut matrix of S is zero (no vertex outside S is adjacent to any vertex of S), then the kernel is everything and the dephased entropy of S is the sum of the binary entropies bin((1-q s)/2) over s in S.
theorem dephased_tree_entropy_of_no_constraints
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj]
(q : V → ℝ) (hq : ∀ v : V, q v ∈ Set.Icc (0 : ℝ) 1)
(S : Finset V)
(hrow : ∀ r : V, r ∉ S → ∀ s ∈ S, ¬ T.Adj r s) :
dephased_tree_entropy T q S = ∑ s ∈ S, binaryEntropy ((1 - q s) / 2)dephased_tree_entropy_of_pair_constraintIn LeanQuantum Mechanics
If every row of the cut matrix is supported on {u,w} (with u ≠ w, both in S) and every row adjacent to u is also adjacent to w, and some row is adjacent to both, then the kernel is {x : x u = x w} and the dephased entropy of S equals 1 + bin((1-q u q w)/2) plus the sum of bin((1-q s)/2) over the remaining coordinates.
theorem dephased_tree_entropy_of_pair_constraint
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj]
(q : V → ℝ) (hq : ∀ v : V, q v ∈ Set.Icc (0 : ℝ) 1)
(S : Finset V) (u w : V) (huS : u ∈ S) (hwS : w ∈ S) (huw : u ≠ w)
(hrow : ∀ r : V, r ∉ S → ∀ s ∈ S, T.Adj r s → (s = u ∨ s = w))
(hpair : ∀ r : V, r ∉ S → (T.Adj r u ↔ T.Adj r w))
(hex : ∃ r : V, r ∉ S ∧ T.Adj r u ∧ T.Adj r w) :
dephased_tree_entropy T q S =
1 + binaryEntropy ((1 - q u * q w) / 2) +
∑ s ∈ (S.erase u).erase w, binaryEntropy ((1 - q s) / 2)dephased_tree_entropy_of_single_constraintIn LeanQuantum Mechanics
If every row of the cut matrix is supported on the single coordinate v (and some row is nonzero), the kernel is {x : x v = 0}, and the dephased entropy of S equals 1 plus the sum of bin((1-q s)/2) over S \ {v}.
theorem dephased_tree_entropy_of_single_constraint
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj]
(q : V → ℝ) (hq : ∀ v : V, q v ∈ Set.Icc (0 : ℝ) 1)
(S : Finset V) (v : V) (hvS : v ∈ S)
(hrow : ∀ r : V, r ∉ S → ∀ s ∈ S, T.Adj r s → s = v)
(hex : ∃ r : V, r ∉ S ∧ T.Adj r v) :
dephased_tree_entropy T q S = 1 + ∑ s ∈ S.erase v, binaryEntropy ((1 - q s) / 2)dephased_tree_entropy_zeroIn LeanQuantum Mechanics
For the zero noise profile q = fun _ => 0, the dephased tree entropy of any subset S is equal to the cardinality of S.
theorem dephased_tree_entropy_zero
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (S : Finset V) :
dephased_tree_entropy T (fun _ => 0) S = (S.card : ℝ)dephased_tree_prob_eq_supported_prob_scaledIn LeanQuantum Mechanics
A full-kernel character probability is the corresponding supported-kernel probability scaled by the reciprocal number of character extensions.
theorem dephased_tree_prob_eq_supported_prob_scaled {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (q : V → ℝ) (S : Finset V) (χ : AddChar (tree_submatrix_ker G S) ℝ) : dephased_tree_prob G q S χ = (1 / 2 : ℝ) ^ (tree_submatrix_dim G S - Module.finrank (ZMod 2) (dephased_supported_kernel G q S)) * dephased_supported_prob G q S (dephased_supported_character_restrict G q S χ)dephased_tree_prob_zeroIn LeanQuantum Mechanics
For the zero noise profile q = fun _ => 0, the dephased tree probability for any subset S and character χ is exactly (1/2)^(tree_submatrix_dim T S).
theorem dephased_tree_prob_zero
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (S : Finset V)
(χ : AddChar (tree_submatrix_ker T S) ℝ) :
dephased_tree_prob T (fun _ => 0) S χ = (1 / 2 : ℝ) ^ (tree_submatrix_dim T S)dephased_tree_tripartite_info_branch_degree_twoIn LeanQuantum Mechanics
At a degree-two vertex v with neighbours u,w, the tripartite information of the three blocks (branch at w, {v}, branch at u) equals bin((1-q v)/2) - bin((1-q u q w)/2).
theorem dephased_tree_tripartite_info_branch_degree_two
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree)
(q : V → ℝ) (hq : ∀ v : V, q v ∈ Set.Icc (0 : ℝ) 1)
{v u w : V} (hdeg : T.degree v = 2) (hu : T.Adj v u) (hw : T.Adj v w) (huw : u ≠ w)
(U W : Finset V) (huU : u ∈ U) (hwW : w ∈ W)
(hvU : v ∉ U) (hvW : v ∉ W) (hdUW : Disjoint U W)
(hUclos : ∀ x ∈ U, ∀ y : V, T.Adj x y → y ∈ U ∨ y = v)
(hUuniq : ∀ x ∈ U, T.Adj x v → x = u)
(hWclos : ∀ x ∈ W, ∀ y : V, T.Adj x y → y ∈ W ∨ y = v)
(hWuniq : ∀ x ∈ W, T.Adj x v → x = w)
(hcover : U ∪ W ∪ {v} = Finset.univ) :
dephased_tree_tripartite_info T q W {v} U =
binaryEntropy ((1 - q v) / 2) - binaryEntropy ((1 - q u * q w) / 2)dephased_tree_tripartite_info_branch_high_degreeIn LeanQuantum Mechanics
At a vertex v of degree at least three with two distinct neighbours u,w, the tripartite information of the three blocks ({v}, branch at u, branch at w) equals 1 - bin((1-q u q w)/2).
theorem dephased_tree_tripartite_info_branch_high_degree
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree)
(q : V → ℝ) (hq : ∀ v : V, q v ∈ Set.Icc (0 : ℝ) 1)
{v u w : V} (hdeg : 3 ≤ T.degree v) (hu : T.Adj v u) (hw : T.Adj v w) (huw : u ≠ w)
(U W : Finset V) (huU : u ∈ U) (hwW : w ∈ W)
(hvU : v ∉ U) (hvW : v ∉ W) (hdUW : Disjoint U W)
(hUclos : ∀ x ∈ U, ∀ y : V, T.Adj x y → y ∈ U ∨ y = v)
(hUuniq : ∀ x ∈ U, T.Adj x v → x = u)
(hWclos : ∀ x ∈ W, ∀ y : V, T.Adj x y → y ∈ W ∨ y = v)
(hWuniq : ∀ x ∈ W, T.Adj x v → x = w)
(hthird : ∃ z : V, z ∉ U ∪ W ∪ {v} ∧ T.Adj v z) :
dephased_tree_tripartite_info T q {v} U W = 1 - binaryEntropy ((1 - q u * q w) / 2)exists_claw_of_max_claw_packing_ge_oneIn LeanQuantum Mechanics
If a finite simple graph G satisfies max_claw_packing G ≥ 1, then there exists a finite subset of vertices s : Finset V such that s induces a claw (is_induced_claw G s).
theorem exists_claw_of_max_claw_packing_ge_one
{V : Type*} [Fintype V] (G : SimpleGraph V) (hclaw : 1 ≤ max_claw_packing G) :
∃ s : Finset V, is_induced_claw G sexists_connected_spanning_subgraph_card_eqIn LeanQuantum Mechanics
A connected finite simple graph has, for every edge count between |V|-1 and |E|, a connected spanning subgraph with exactly that many edges.
theorem exists_connected_spanning_subgraph_card_eq {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (hG : G.Connected) (e : ℕ) (h₁ : Fintype.card V - 1 ≤ e)
(h₂ : e ≤ Nat.card G.edgeSet) :
∃ G' : SimpleGraph V, G' ≤ G ∧ G'.Connected ∧ Nat.card G'.edgeSet = eexists_connected_triangle_free_graph_on_fin_edge_cardIn LeanQuantum Mechanics
For k ≥ 2 and k−1 ≤ e ≤ ⌊k²/4⌋ there exists a connected triangle-free simple graph on Fin k with exactly e edges.
theorem exists_connected_triangle_free_graph_on_fin_edge_card (k e : ℕ) (hk : 2 ≤ k)
(h₁ : k - 1 ≤ e) (h₂ : e ≤ k ^ 2 / 4) :
∃ G : SimpleGraph (Fin k), G.Connected ∧ G.CliqueFree 3 ∧ Nat.card G.edgeSet = eexists_even_cycle_matching_and_differing_vectorsIn LeanQuantum Mechanics
For every integer m ≥ 3, there exists a finite field F of characteristic 2 and two injective functions t, s : Fin (2*m) → F taking nonzero values such that the alternating cycle edge weight products differ for t and match for s.
theorem exists_even_cycle_matching_and_differing_vectors (m : ℕ) (hm : 3 ≤ m) :
∃ (F : Type) (_ : Field F) (_ : Fintype F) (_ : CharP F 2)
(t s : Fin (2 * m) → F),
Function.Injective t ∧ (∀ i, t i ≠ 0) ∧
Function.Injective s ∧ (∀ i, s i ≠ 0) ∧
((∏ i : Fin m, (t ⟨2 * i.val, by omega⟩ + t ⟨2 * i.val + 1, by omega⟩)) ≠
(∏ i : Fin m, (t ⟨2 * i.val + 1, by omega⟩ + t ⟨(2 * i.val + 2) % (2 * m), Nat.mod_lt _ (by omega)⟩))) ∧
((∏ i : Fin m, (s ⟨2 * i.val, by omega⟩ + s ⟨2 * i.val + 1, by omega⟩)) =
(∏ i : Fin m, (s ⟨2 * i.val + 1, by omega⟩ + s ⟨(2 * i.val + 2) % (2 * m), Nat.mod_lt _ (by omega)⟩)))exists_field_char_two_six_tuplesIn LeanQuantum Mechanics
There exists a finite field F of characteristic 2 and two injective nonzero 6-tuples t, s : Fin 6 → F whose alternating edge weight products along C_6 differ for t and are equal for s.
theorem exists_field_char_two_six_tuples :
∃ (F : Type) (_ : Field F) (_ : Fintype F) (_ : CharP F 2)
(t s : Fin 6 → F),
Function.Injective t ∧ (∀ i, t i ≠ 0) ∧
Function.Injective s ∧ (∀ i, s i ≠ 0) ∧
((∏ i : Fin 3, (t ⟨2 * i.val, by omega⟩ + t ⟨2 * i.val + 1, by omega⟩)) ≠
(∏ i : Fin 3, (t ⟨2 * i.val + 1, by omega⟩ + t ⟨(2 * i.val + 2) % 6, Nat.mod_lt _ (by omega)⟩))) ∧
((∏ i : Fin 3, (s ⟨2 * i.val, by omega⟩ + s ⟨2 * i.val + 1, by omega⟩)) =
(∏ i : Fin 3, (s ⟨2 * i.val + 1, by omega⟩ + s ⟨(2 * i.val + 2) % 6, Nat.mod_lt _ (by omega)⟩)))exists_fin_representation_expand_coreIn LeanQuantum Mechanics
For k < n, expanding the marked vertex s of a marked core graph (J, s) by n - k independent vertices preserves connectivity and triangle-freeness, has d*n + c edges, and can be represented on Fin n with Q = (n - k)^2 + (Q(J) - 1).
theorem exists_fin_representation_expand_core
{k d c n : ℕ} (hkn : k < n)
(J : SimpleGraph (Fin (k + 1))) (s : Fin (k + 1))
(hJ : is_marked_core_graph k d c J s) :
∃ (G : SimpleGraph (Fin n)),
G.Connected ∧
G.CliqueFree 3 ∧
Nat.card G.edgeSet = d * n + c ∧
graph_state_fisher_q G = (n - k) ^ 2 + (graph_state_fisher_q J - 1) ∧
Nonempty (G ≃g expand_vertex (W := Fin (n - k)) J s)f2_real_character_extension_cardIn LeanQuantum Mechanics
The extensions of a real-valued character from a binary subspace form a fiber with two to the codimension elements.
theorem f2_real_character_extension_card {M : Type*} [AddCommGroup M] [Module (ZMod 2) M] [Fintype M] (L : Submodule (ZMod 2) M) (χ : AddChar L ℝ) : Nat.card {ψ : AddChar M ℝ // ∀ x : L, ψ x.1 = χ x} = 2 ^ (Module.finrank (ZMod 2) M - Module.finrank (ZMod 2) L)false_twin_not_adjacentIn LeanQuantum Mechanics
Two vertices of a simple graph with the same neighbour finset are not adjacent (fibres of the neighbour map are independent sets).
theorem false_twin_not_adjacent {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {u v : V}
(h : G.neighborFinset u = G.neighborFinset v) : ¬ G.Adj u vfour_partition_empty_tripartite_info_zeroIn LeanQuantum Mechanics
For any simple graph G and four-partition A, B, C, D of its vertices, if any part is empty, the cut ranks in tree_graph_state_tripartite_info cancel pairwise by complement symmetry (simple_graph_cut_rank_compl) and cut rank of empty set being zero, resulting in 0.
theorem four_partition_empty_tripartite_info_zero {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (A B C D : Finset V)
(hpart : is_four_partition A B C D) (hempty : A = ∅ ∨ B = ∅ ∨ C = ∅ ∨ D = ∅) :
tree_graph_state_tripartite_info G A B C D = 0graph_state_fisher_deficit_three_halves_lower_boundIn LeanQuantum Mechanics
The deficit n² - Q_max(n, ⌊3n/2⌋) is at least 2√2·n^(3/2) minus a linear error, for all large n.
theorem graph_state_fisher_deficit_three_halves_lower_bound :
∃ C : ℝ, ∀ᶠ (n : ℕ) in Filter.atTop,
2 * Real.sqrt 2 * (n : ℝ) ^ (3 / 2 : ℝ) - C * (n : ℝ) ≤
(n : ℝ) ^ 2 - (graph_state_max_fisher_info n ⌊(3 / 2 : ℝ) * (n : ℝ)⌋₊ : ℝ)graph_state_fisher_deficit_three_halves_upper_boundIn LeanQuantum Mechanics
The deficit n² - Q_max(n, ⌊3n/2⌋) is at most 2√2·n^(3/2) plus a linear error, for all large n.
theorem graph_state_fisher_deficit_three_halves_upper_bound :
∃ C : ℝ, ∀ᶠ (n : ℕ) in Filter.atTop,
(n : ℝ) ^ 2 - (graph_state_max_fisher_info n ⌊(3 / 2 : ℝ) * (n : ℝ)⌋₊ : ℝ) ≤
2 * Real.sqrt 2 * (n : ℝ) ^ (3 / 2 : ℝ) + C * (n : ℝ)graph_state_fisher_info_eq_sum_fiber_sqIn LeanQuantum Mechanics
For any finite simple graph G, its graph-state Fisher information equals the sum over all distinct neighbor finsets s of the square of the size of the fiber {v | G.neighborFinset v = s}.
theorem graph_state_fisher_info_eq_sum_fiber_sq {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
graph_state_fisher_info G =
∑ s ∈ Finset.univ.image (fun v => G.neighborFinset v),
(Finset.univ.filter (fun v => G.neighborFinset v = s)).card ^ 2graph_state_fisher_info_ge_cardIn LeanQuantum Mechanics
For any finite simple graph G on vertex type V, the collective-X quantum Fisher information graph_state_fisher_info G is at least Fintype.card V.
theorem graph_state_fisher_info_ge_card {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
Fintype.card V ≤ graph_state_fisher_info Ggraph_state_fisher_info_le_sqIn LeanQuantum Mechanics
For any finite simple graph G on vertex type V, the collective-X quantum Fisher information graph_state_fisher_info G is at most (Fintype.card V)^2.
theorem graph_state_fisher_info_le_sq {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
graph_state_fisher_info G ≤ (Fintype.card V) ^ 2inhomogeneous_dephased_path_local_noise_criterion_implies_mmiIn LeanQuantum Mechanics
For n ≥ 3 and q : Fin n → [0, 1], if q satisfies the local noise criterion dephased_path_local_noise_criterion n q, then dephased_path_tripartite_info n q A B C ≤ 0 for all pairwise disjoint triples A, B, C.
theorem inhomogeneous_dephased_path_local_noise_criterion_implies_mmi
(n : ℕ) (hn : 3 ≤ n) (q : Fin n → ℝ) (hq : ∀ i : Fin n, q i ∈ Set.Icc (0 : ℝ) 1) :
dephased_path_local_noise_criterion n q →
∀ A B C : Finset (Fin n), Disjoint A B → Disjoint A C → Disjoint B C →
dephased_path_tripartite_info n q A B C ≤ 0inhomogeneous_dephased_path_mmi_implies_local_noise_criterionIn LeanQuantum Mechanics
For n ≥ 3 and q : Fin n → [0, 1], if dephased_path_tripartite_info n q A B C ≤ 0 for all pairwise disjoint triples A, B, C, then q satisfies the local noise criterion dephased_path_local_noise_criterion n q.
theorem inhomogeneous_dephased_path_mmi_implies_local_noise_criterion
(n : ℕ) (hn : 3 ≤ n) (q : Fin n → ℝ) (hq : ∀ i : Fin n, q i ∈ Set.Icc (0 : ℝ) 1) :
(∀ A B C : Finset (Fin n), Disjoint A B → Disjoint A C → Disjoint B C →
dephased_path_tripartite_info n q A B C ≤ 0) →
dephased_path_local_noise_criterion n qis_induced_claw_of_tree_three_neighborsIn LeanQuantum Mechanics
In a tree T, a vertex v together with three distinct neighbours a, b, c spans an induced claw: the induced subgraph on {v,a,b,c} is isomorphic to K_{1,3}.
theorem is_induced_claw_of_tree_three_neighbors {V : Type*} [DecidableEq V]
(T : SimpleGraph V) (hT : T.IsTree) {v a b c : V}
(ha : T.Adj v a) (hb : T.Adj v b) (hc : T.Adj v c)
(hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) :
is_induced_claw T ({v, a, b, c} : Finset V)ising_amplitude_scalar_eightIn LeanQuantum Mechanics
The eighth power of the normalisation constant 1/√(2^n) of the Ising graph state is 1/16^n.
theorem ising_amplitude_scalar_eight (n : ℕ) :
((1 / Real.sqrt (2 ^ n : ℝ) : ℝ) : ℂ) ^ 8 = 1 / (16 ^ n : ℂ)ising_diff_addIn LeanQuantum Mechanics
For bitstrings x, y : Fin n → Fin 2 and vertices u, v, the difference bit of x + y at (u,v) is the sum in Fin 2 of the difference bits of x and of y at (u,v).
theorem ising_diff_add {n : ℕ} (x y : Fin n → Fin 2) (u v : Fin n) :
(if (x + y) u = (x + y) v then (0:Fin 2) else 1) =
(if x u = x v then (0:Fin 2) else 1) + (if y u = y v then (0:Fin 2) else 1)ising_edge_prod_replica_weight_eq_spin_weightIn LeanQuantum Mechanics
For every graph G, edge angle function θ and bitstrings a, x1, x2, x3, the product over the edges of the four-replica edge weight evaluated at the difference pattern of (a,x1,x2,x3) equals the product over the edges of the sixteen-spin edge weight evaluated at the transformed pattern (d₃, d₂+d₃, d₁+d₃, d₀).
open scoped BigOperators Classical in
theorem ising_edge_prod_replica_weight_eq_spin_weight (n : ℕ) (G : SimpleGraph (Fin n))
[DecidableRel G.Adj] (θ : Sym2 (Fin n) → ℝ) (a x1 x2 x3 : Fin n → Fin 2) :
(∏ e ∈ G.edgeFinset,
ising_replica_edge_weight (θ e) (Sym2.lift ⟨fun u v =>
![if a u = a v then (0:Fin 2) else 1, if x1 u = x1 v then (0:Fin 2) else 1,
if x2 u = x2 v then (0:Fin 2) else 1, if x3 u = x3 v then (0:Fin 2) else 1],
fun u v => by funext i; fin_cases i <;> simp [eq_comm]⟩ e))
= ∏ e ∈ G.edgeFinset,
sixteen_spin_weight (θ e) (Sym2.lift ⟨fun u v =>
![if x3 u = x3 v then (0:Fin 2) else 1,
(if x2 u = x2 v then (0:Fin 2) else 1) + (if x3 u = x3 v then (0:Fin 2) else 1),
(if x1 u = x1 v then (0:Fin 2) else 1) + (if x3 u = x3 v then (0:Fin 2) else 1),
if a u = a v then (0:Fin 2) else 1],
fun u v => by funext i; fin_cases i <;> simp [eq_comm]⟩ e)ising_eight_fold_product_eq_edge_prodIn LeanQuantum Mechanics
For every graph G, edge angle function θ and bitstrings a, x1, x2, x3 with x4 = x1+x2+x3, the product of the eight amplitudes conj ψ(x1), ψ(x1+a), ψ(x2), conj ψ(x2+a), conj ψ(x3), ψ(x3+a), ψ(x4), conj ψ(x4+a) equals (1/16^n) times the product over the edges of the four-replica edge weight evaluated at the four difference bits of (a,x1,x2,x3) at that edge.
open scoped BigOperators Classical in
theorem ising_eight_fold_product_eq_edge_prod (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(θ : Sym2 (Fin n) → ℝ) (a x1 x2 x3 : Fin n → Fin 2) :
(let x4 : Fin n → Fin 2 := fun v => x1 v + x2 v + x3 v
starRingEnd ℂ ((ising_graph_state n G θ) x1) * (ising_graph_state n G θ) (fun v => x1 v + a v) *
(ising_graph_state n G θ) x2 * starRingEnd ℂ ((ising_graph_state n G θ) (fun v => x2 v + a v)) *
starRingEnd ℂ ((ising_graph_state n G θ) x3) * (ising_graph_state n G θ) (fun v => x3 v + a v) *
(ising_graph_state n G θ) x4 * starRingEnd ℂ ((ising_graph_state n G θ) (fun v => x4 v + a v)))
= (1 / (16 ^ n : ℂ)) * ∏ e ∈ G.edgeFinset,
ising_replica_edge_weight (θ e) (Sym2.lift ⟨fun u v =>
![if a u = a v then (0:Fin 2) else 1, if x1 u = x1 v then (0:Fin 2) else 1,
if x2 u = x2 v then (0:Fin 2) else 1, if x3 u = x3 v then (0:Fin 2) else 1],
fun u v => by funext i; fin_cases i <;> simp [eq_comm]⟩ e)ising_eight_fold_product_exp_formIn LeanQuantum Mechanics
For every graph G, edge angle function θ and bitstrings a, x1, x2, x3 with x4 = x1+x2+x3, the product of the eight amplitudes conj ψ(x1), ψ(x1+a), ψ(x2), conj ψ(x2+a), conj ψ(x3), ψ(x3+a), ψ(x4), conj ψ(x4+a) equals (1/16^n) exp(i ∑_{e ∈ E} θ_e (1-δ_e)(s¹_e - s²_e + s³_e - s¹_e s²_e s³_e)), where δ_e, s¹_e, s²_e, s³_e are the ±1 agreement signs of a, x1, x2, x3 at the endpoints of e.
open scoped BigOperators Classical in
theorem ising_eight_fold_product_exp_form (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(θ : Sym2 (Fin n) → ℝ) (a x1 x2 x3 : Fin n → Fin 2) :
(let x4 : Fin n → Fin 2 := fun v => x1 v + x2 v + x3 v
starRingEnd ℂ ((ising_graph_state n G θ) x1) * (ising_graph_state n G θ) (fun v => x1 v + a v) *
(ising_graph_state n G θ) x2 * starRingEnd ℂ ((ising_graph_state n G θ) (fun v => x2 v + a v)) *
starRingEnd ℂ ((ising_graph_state n G θ) x3) * (ising_graph_state n G θ) (fun v => x3 v + a v) *
(ising_graph_state n G θ) x4 * starRingEnd ℂ ((ising_graph_state n G θ) (fun v => x4 v + a v)))
= (1 / (16 ^ n : ℂ)) * Complex.exp (Complex.I * (∑ e ∈ G.edgeFinset,
((θ e : ℂ) * Sym2.lift ⟨fun u v =>
(1 - (if a u = a v then (1:ℝ) else -1)) *
((if x1 u = x1 v then (1:ℝ) else -1) - (if x2 u = x2 v then (1:ℝ) else -1) +
(if x3 u = x3 v then (1:ℝ) else -1) - (if x1 u = x1 v then (1:ℝ) else -1) *
(if x2 u = x2 v then (1:ℝ) else -1) * (if x3 u = x3 v then (1:ℝ) else -1)),
fun u v => by simp [eq_comm]⟩ e)))ising_four_replica_edge_sum_eq_partition_fnIn LeanQuantum Mechanics
(1/16^n) times the sum over all (a,x1,x2,x3) of the product over the edges of the sixteen-spin edge weight evaluated at the transformed pattern (d₃, d₂+d₃, d₁+d₃, d₀) equals the sixteen-spin partition function of G at θ.
open scoped BigOperators Classical in
theorem ising_four_replica_edge_sum_eq_partition_fn (n : ℕ) (G : SimpleGraph (Fin n))
[DecidableRel G.Adj] (θ : Sym2 (Fin n) → ℝ) :
(1 / (16 ^ n : ℂ)) * (∑ a : Fin n → Fin 2, ∑ x1 : Fin n → Fin 2,
∑ x2 : Fin n → Fin 2, ∑ x3 : Fin n → Fin 2,
∏ e ∈ G.edgeFinset,
sixteen_spin_weight (θ e) (Sym2.lift ⟨fun u v =>
![if x3 u = x3 v then (0:Fin 2) else 1,
(if x2 u = x2 v then (0:Fin 2) else 1) + (if x3 u = x3 v then (0:Fin 2) else 1),
(if x1 u = x1 v then (0:Fin 2) else 1) + (if x3 u = x3 v then (0:Fin 2) else 1),
if a u = a v then (0:Fin 2) else 1],
fun u v => by funext i; fin_cases i <;> simp [eq_comm]⟩ e))
= sixteen_spin_partition_fn G θising_four_replica_sum_reindexIn LeanQuantum Mechanics
Summing an arbitrary function of four bitstrings a, x1, x2, x3 over all of them is the same as summing over all spin configurations s : Fin n → Fin 4 → Fin 2 the function evaluated at a = s(-)(3), x1 = s(-)(2) + s(-)(0), x2 = s(-)(1) + s(-)(0), x3 = s(-)(0).
open scoped BigOperators Classical in
theorem ising_four_replica_sum_reindex (n : ℕ)
(F : (Fin n → Fin 2) → (Fin n → Fin 2) → (Fin n → Fin 2) → (Fin n → Fin 2) → ℂ) :
(∑ a : Fin n → Fin 2, ∑ x1 : Fin n → Fin 2, ∑ x2 : Fin n → Fin 2, ∑ x3 : Fin n → Fin 2,
F a x1 x2 x3)
= ∑ s : Fin n → Fin 4 → Fin 2,
F (fun v => s v 3) (fun v => s v 2 + s v 0) (fun v => s v 1 + s v 0) (fun v => s v 0)ising_graph_state_applyIn LeanQuantum Mechanics
Evaluating the Ising graph state on a computational basis bitstring x gives (1/√(2^n)) exp(-i ∑_{e ∈ E} θ_e σ_x(e)), where σ_x(e) is +1 if the two endpoints of e carry equal bits in x and -1 otherwise, applied through Sym2.lift.
theorem ising_graph_state_apply (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(θ : Sym2 (Fin n) → ℝ) (x : Fin n → Fin 2) :
(ising_graph_state n G θ) x = (1 / Real.sqrt (2 ^ n : ℝ) : ℂ) *
Complex.exp (- Complex.I * ∑ e ∈ G.edgeFinset,
((θ e : ℂ) * Sym2.lift ⟨fun u v => if x u = x v then (1 : ℂ) else (-1 : ℂ),
fun u v => by simp [eq_comm]⟩ e))ising_graph_state_conjIn LeanQuantum Mechanics
Conjugating the amplitude of the Ising graph state on a bitstring x gives (1/√(2^n)) exp(+i ∑_{e ∈ E} θ_e σ_x(e)), the exponential of the edge phase with the sign flipped.
theorem ising_graph_state_conj (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(θ : Sym2 (Fin n) → ℝ) (x : Fin n → Fin 2) :
starRingEnd ℂ ((ising_graph_state n G θ) x) = (1 / Real.sqrt (2 ^ n : ℝ) : ℂ) *
Complex.exp (Complex.I * ∑ e ∈ G.edgeFinset,
((θ e : ℂ) * Sym2.lift ⟨fun u v => if x u = x v then (1 : ℂ) else (-1 : ℂ),
fun u v => by simp [eq_comm]⟩ e))ising_graph_state_four_replica_sum_eq_sixteen_spin_partition_fnIn LeanQuantum Mechanics
For every simple graph G on Fin n and edge angle function θ, the 4-replica correlation sum of ising_graph_state n G θ factors edge-by-edge over G.edgeFinset and equals sixteen_spin_partition_fn G θ.
open scoped BigOperators Classical in
theorem ising_graph_state_four_replica_sum_eq_sixteen_spin_partition_fn (n : ℕ)
(G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (θ : Sym2 (Fin n) → ℝ) :
(∑ a : Fin n → Fin 2,
∑ x1 : Fin n → Fin 2,
∑ x2 : Fin n → Fin 2,
∑ x3 : Fin n → Fin 2,
let x4 : Fin n → Fin 2 := fun v => x1 v + x2 v + x3 v
starRingEnd ℂ ((ising_graph_state n G θ) x1) * (ising_graph_state n G θ) (fun v => x1 v + a v) *
(ising_graph_state n G θ) x2 * starRingEnd ℂ ((ising_graph_state n G θ) (fun v => x2 v + a v)) *
starRingEnd ℂ ((ising_graph_state n G θ) x3) * (ising_graph_state n G θ) (fun v => x3 v + a v) *
(ising_graph_state n G θ) x4 * starRingEnd ℂ ((ising_graph_state n G θ) (fun v => x4 v + a v))) =
sixteen_spin_partition_fn G θising_replica_edge_weight_eq_sixteen_spin_weightIn LeanQuantum Mechanics
For every angle θ and every difference pattern d in (Fin 2)^4, the four-replica edge weight exp(i θ (1-δ)(s₁-s₂+s₃-s₁s₂s₃)) equals the sixteen-spin edge weight of the transformed pattern (d₃, d₂+d₃, d₁+d₃, d₀). This is the crux local identity: 96 of the 20160 matrices in GL(4,F2) work, and this one is the cleanest.
theorem ising_replica_edge_weight_eq_sixteen_spin_weight (θ : ℝ) (d : Fin 4 → Fin 2) :
ising_replica_edge_weight θ d = sixteen_spin_weight θ ![d 3, d 2 + d 3, d 1 + d 3, d 0]ising_replica_edge_weight_sanityIn LeanQuantum Mechanics
The replica edge weight is 1 whenever the a-replica pair agrees at the endpoints, and it equals exp(-8 i θ) on the difference pattern (1,1,0,1); so the weight is neither constantly 1 nor vacuous.
theorem ising_replica_edge_weight_sanity (θ : ℝ) :
ising_replica_edge_weight θ (fun _ => 0) = 1 ∧
ising_replica_edge_weight θ ![1, 1, 0, 1] = Complex.exp (-8 * Complex.I * θ)ising_signed_agree_addIn LeanQuantum Mechanics
For bitstrings x, y : Fin n → Fin 2 and vertices u, v, the agreement sign ±1 of x + y (pointwise mod-2 addition) at the pair (u,v) is the product of the agreement signs of x and of y at (u,v).
theorem ising_signed_agree_add {n : ℕ} (x y : Fin n → Fin 2) (u v : Fin n) :
(if (x + y) u = (x + y) v then (1:ℝ) else -1) =
(if x u = x v then (1:ℝ) else -1) * (if y u = y v then (1:ℝ) else -1)ladder_graph_state_tripartite_info_lower_bound_base_largeIn LeanQuantum Mechanics
For 6 ≤ n ≤ 10 the witness colouring attains tripartite information floor((n-2)/3).
theorem ladder_graph_state_tripartite_info_lower_bound_base_large (n : ℕ) (h6 : 6 ≤ n) (h10 : n ≤ 10) :
tree_graph_state_tripartite_info (SimpleGraph.pathGraph n □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part n 0)
(ladder_graph_state_tripartite_info_lower_bound_part n 1)
(ladder_graph_state_tripartite_info_lower_bound_part n 2)
(ladder_graph_state_tripartite_info_lower_bound_part n 3) = (((n - 2) / 3 : ℕ) : ℤ)ladder_graph_state_tripartite_info_lower_bound_base_smallIn LeanQuantum Mechanics
For 2 ≤ n ≤ 5 the witness colouring attains tripartite information floor((n-2)/3).
theorem ladder_graph_state_tripartite_info_lower_bound_base_small (n : ℕ) (h2 : 2 ≤ n) (h5 : n ≤ 5) :
tree_graph_state_tripartite_info (SimpleGraph.pathGraph n □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part n 0)
(ladder_graph_state_tripartite_info_lower_bound_part n 1)
(ladder_graph_state_tripartite_info_lower_bound_part n 2)
(ladder_graph_state_tripartite_info_lower_bound_part n 3) = (((n - 2) / 3 : ℕ) : ℤ)ladder_graph_state_tripartite_info_lower_bound_formulaIn LeanQuantum Mechanics
For every n ≥ 2 the witness four-partition attains tree_graph_state_tripartite_info = floor((n-2)/3).
theorem ladder_graph_state_tripartite_info_lower_bound_formula (n : ℕ) (hn : 2 ≤ n) :
tree_graph_state_tripartite_info (SimpleGraph.pathGraph n □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part n 0)
(ladder_graph_state_tripartite_info_lower_bound_part n 1)
(ladder_graph_state_tripartite_info_lower_bound_part n 2)
(ladder_graph_state_tripartite_info_lower_bound_part n 3) = (((n - 2) / 3 : ℕ) : ℤ)ladder_graph_state_tripartite_info_lower_bound_partitionIn LeanQuantum Mechanics
The four colour classes of the witness colouring are pairwise disjoint and cover all vertices of the 2-by-n ladder.
theorem ladder_graph_state_tripartite_info_lower_bound_partition (n : ℕ) :
is_four_partition (ladder_graph_state_tripartite_info_lower_bound_part n 0)
(ladder_graph_state_tripartite_info_lower_bound_part n 1)
(ladder_graph_state_tripartite_info_lower_bound_part n 2)
(ladder_graph_state_tripartite_info_lower_bound_part n 3)ladder_graph_state_tripartite_info_lower_bound_stepIn LeanQuantum Mechanics
For the witness colouring, each of the seven relevant cut ranks on the (n+9)-ladder equals the corresponding rank on the n-ladder plus 5, 5, 5, 3, 5, 5, 5 respectively.
theorem ladder_graph_state_tripartite_info_lower_bound_step (n : ℕ) (hn : 2 ≤ n) :
(simple_graph_cut_rank (SimpleGraph.pathGraph (n + 9) □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part (n + 9) 0)
= simple_graph_cut_rank (SimpleGraph.pathGraph n □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part n 0) + 5) ∧
(simple_graph_cut_rank (SimpleGraph.pathGraph (n + 9) □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part (n + 9) 1)
= simple_graph_cut_rank (SimpleGraph.pathGraph n □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part n 1) + 5) ∧
(simple_graph_cut_rank (SimpleGraph.pathGraph (n + 9) □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part (n + 9) 2)
= simple_graph_cut_rank (SimpleGraph.pathGraph n □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part n 2) + 5) ∧
(simple_graph_cut_rank (SimpleGraph.pathGraph (n + 9) □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part (n + 9) 3)
= simple_graph_cut_rank (SimpleGraph.pathGraph n □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part n 3) + 3) ∧
(simple_graph_cut_rank (SimpleGraph.pathGraph (n + 9) □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part (n + 9) 0 ∪
ladder_graph_state_tripartite_info_lower_bound_part (n + 9) 1)
= simple_graph_cut_rank (SimpleGraph.pathGraph n □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part n 0 ∪
ladder_graph_state_tripartite_info_lower_bound_part n 1) + 5) ∧
(simple_graph_cut_rank (SimpleGraph.pathGraph (n + 9) □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part (n + 9) 0 ∪
ladder_graph_state_tripartite_info_lower_bound_part (n + 9) 2)
= simple_graph_cut_rank (SimpleGraph.pathGraph n □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part n 0 ∪
ladder_graph_state_tripartite_info_lower_bound_part n 2) + 5) ∧
(simple_graph_cut_rank (SimpleGraph.pathGraph (n + 9) □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part (n + 9) 1 ∪
ladder_graph_state_tripartite_info_lower_bound_part (n + 9) 2)
= simple_graph_cut_rank (SimpleGraph.pathGraph n □ SimpleGraph.completeGraph (Fin 2))
(ladder_graph_state_tripartite_info_lower_bound_part n 1 ∪
ladder_graph_state_tripartite_info_lower_bound_part n 2) + 5)matrix_cfc_eq_affine_of_spectrum_subsetIn LeanQuantum Mechanics
If a real symmetric matrix X has spectrum contained in the two-point set {l1, l2} with l1 ≠ l2, then for every f : ℝ → ℝ its continuous functional calculus is the affine function of X that interpolates f at l1 and l2: cfc f X = ((f l1 − f l2)/(l1 − l2)) • X + ((l1·f l2 − l2·f l1)/(l1 − l2)) • 1.
theorem matrix_cfc_eq_affine_of_spectrum_subset {n : Type*} [Fintype n] [DecidableEq n]
(f : ℝ → ℝ) (X : Matrix n n ℝ) (hX : X.IsSymm) (l1 l2 : ℝ) (hne : l1 ≠ l2)
(hsp : spectrum ℝ X ⊆ {l1, l2}) :
cfc f X = ((f l1 - f l2) / (l1 - l2)) • X + ((l1 * f l2 - l2 * f l1) / (l1 - l2)) • 1matrix_charpoly_eq_of_trace_pow_eqIn LeanQuantum Mechanics
Two complex square matrices of the same size whose power traces agree for all 1 ≤ k ≤ size have the same characteristic polynomial.
theorem matrix_charpoly_eq_of_trace_pow_eq {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] (hcard : Fintype.card ι = Fintype.card κ) (M : Matrix ι ι ℂ) (N : Matrix κ κ ℂ) (h : ∀ k : ℕ, 1 ≤ k → k ≤ Fintype.card ι → Matrix.trace (M ^ k) = Matrix.trace (N ^ k)) : Matrix.charpoly M = Matrix.charpoly Nmatrix_le_rank_of_submatrix_det_ne_zeroIn LeanQuantum Mechanics
For any matrix M over ZMod 2 and any square submatrix of size k, if the determinant of the submatrix is nonzero, then the rank of M is at least k.
theorem matrix_le_rank_of_submatrix_det_ne_zero {α β : Type*} [Fintype α] [Fintype β]
[DecidableEq α] [DecidableEq β] {k : ℕ} (M : Matrix α β (ZMod 2))
(r : Fin k → α) (c : Fin k → β) (h : (M.submatrix r c).det ≠ 0) : k ≤ M.rankmatrix_rank_eq_of_factorization_and_minorIn LeanQuantum Mechanics
If M = A * B where A has k columns and B has k rows, and some k×k submatrix of M (rows r, columns c) has nonzero determinant over a field, then the rank of M is k.
theorem matrix_rank_eq_of_factorization_and_minor {m n : Type*} [Fintype m] [Fintype n]
{K : Type*} [Field K] (M : Matrix m n K) (k : ℕ)
(A : Matrix m (Fin k) K) (B : Matrix (Fin k) n K) (hAB : M = A * B)
(r : Fin k → m) (c : Fin k → n) (hdet : (M.submatrix r c).det ≠ 0) :
M.rank = kmatrix_rank_le_of_factorIn LeanQuantum Mechanics
For any matrix M over ZMod 2, if M factors as U * V with inner dimension k, then the rank of M is at most k.
theorem matrix_rank_le_of_factor {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β]
{k : ℕ} (M : Matrix α β (ZMod 2)) (U : Matrix α (Fin k) (ZMod 2)) (V : Matrix (Fin k) β (ZMod 2))
(h : M = U * V) : M.rank ≤ kmatrix_rank_submatrix_leIn LeanQuantum Mechanics
For any matrix M over ZMod 2 and any row/column index maps, the rank of the submatrix is at most the rank of M.
theorem matrix_rank_submatrix_le {α β l o : Type*} [Fintype α] [Fintype β] [Fintype l] [Fintype o]
[DecidableEq α] [DecidableEq β] [DecidableEq l] [DecidableEq o]
(M : Matrix α β (ZMod 2)) (r : l → α) (c : o → β) :
(M.submatrix r c).rank ≤ M.rankmatrix_trace_pow_kroneckerIn LeanQuantum Mechanics
For square matrices A (indexed by ι) and B (indexed by κ) over ℂ and every k, the trace of the k-th power of Matrix.kronecker A B equals the product of the k-th power traces: tr((A ⊗ B)^k) = tr(A^k) * tr(B^k).
theorem matrix_trace_pow_kronecker {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] (A : Matrix ι ι ℂ) (B : Matrix κ κ ℂ) (k : ℕ) : Matrix.trace ((Matrix.kronecker A B) ^ k) = Matrix.trace (A ^ k) * Matrix.trace (B ^ k)max_claw_packing_monoIn LeanQuantum Mechanics
If every induced claw of G is an induced claw of H, then max_claw_packing G is at most max_claw_packing H.
theorem max_claw_packing_mono {V : Type*} [Fintype V]
(G H : SimpleGraph V)
(h : ∀ s : Finset V, is_induced_claw G s → is_induced_claw H s) :
max_claw_packing G ≤ max_claw_packing Hmultipartite_color_cut_alt_sum_le_two_mul_halfIn LeanQuantum Mechanics
For any finite family of nonempty colour sets T i on four colours, the alternating seven-term sum of multipartite_upper_bound_color_cut at {0},{1},{2},{3} minus {0,1},{0,2},{1,2} is at most 2 * floor(|ι| / 2).
theorem multipartite_color_cut_alt_sum_le_two_mul_half {ι : Type*} [Fintype ι]
(T : ι → Finset (Fin 4)) (hne : ∀ i, (T i).Nonempty) :
multipartite_upper_bound_color_cut T ({0} : Finset (Fin 4))
+ multipartite_upper_bound_color_cut T {1}
+ multipartite_upper_bound_color_cut T {2}
+ multipartite_upper_bound_color_cut T {3}
- multipartite_upper_bound_color_cut T {0, 1}
- multipartite_upper_bound_color_cut T {0, 2}
- multipartite_upper_bound_color_cut T {1, 2}
≤ 2 * (((Fintype.card ι) / 2 : ℕ) : ℤ)multipartite_exists_coloring_tripartite_info_geIn LeanQuantum Mechanics
For any complete multipartite graph with nonempty parts, there exists a four-coloring achieving tripartite information at least 2 * (a / 2), where a is the number of parts of size at least 4.
theorem multipartite_exists_coloring_tripartite_info_ge
{ι : Type*} [Fintype ι] [DecidableEq ι]
(V : ι → Type*) [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] [∀ i, Nonempty (V i)] :
∃ c : ((i : ι) × V i) → Fin 4,
2 * ((complete_multipartite_num_large_parts V / 2 : ℕ) : ℤ) ≤
tree_graph_state_tripartite_info (SimpleGraph.completeMultipartiteGraph (V := V))
(Finset.univ.filter (fun v => c v = 0))
(Finset.univ.filter (fun v => c v = 1))
(Finset.univ.filter (fun v => c v = 2))
(Finset.univ.filter (fun v => c v = 3))multipartite_graph_state_tripartite_info_four_uniformIn LeanQuantum Mechanics
For any natural number a, the complete multipartite graph with a parts each of size 4 achieves maximum tripartite information equal to 2 * (a / 2).
theorem multipartite_graph_state_tripartite_info_four_uniform (a : ℕ) :
simple_graph_max_tripartite_info
(SimpleGraph.completeMultipartiteGraph (fun _ : Fin a => Fin 4)) =
2 * ((a / 2 : ℕ) : ℤ)multipartite_graph_state_tripartite_info_lower_sharpIn LeanQuantum Mechanics
For every natural number a, there exists a complete multipartite graph with a parts of size at least 4 achieving maximum tripartite information equal to 2 * (a / 2).
theorem multipartite_graph_state_tripartite_info_lower_sharp (a : ℕ) :
∃ (ι : Type) (_ : Fintype ι) (_ : DecidableEq ι)
(V : ι → Type) (_ : ∀ i, Fintype (V i)) (_ : ∀ i, DecidableEq (V i)) (_ : ∀ i, Nonempty (V i)),
complete_multipartite_num_large_parts V = a ∧
simple_graph_max_tripartite_info (SimpleGraph.completeMultipartiteGraph V) =
2 * ((a / 2 : ℕ) : ℤ)multipartite_sharp_even_config_valueIn LeanQuantum Mechanics
For even a, the colour-set family consisting of a parts carrying all four colours, two copies of the 3-element colour set {0,1,2} and one copy each of {0,1,3}, {0,2,3}, {1,2,3} has alternating seven-term colour-cut sum exactly a + 3.
theorem multipartite_sharp_even_config_value (a : ℕ) (ha : a % 2 = 0) :
let T : (Fin a ⊕ Fin 5) → Finset (Fin 4) :=
fun i => match i with
| Sum.inl _ => Finset.univ
| Sum.inr j => if j = 0 then ({0,1,2} : Finset (Fin 4)) else if j = 1 then {0,1,2}
else if j = 2 then {0,1,3} else if j = 3 then {0,2,3} else {1,2,3}
multipartite_upper_bound_color_cut T ({0} : Finset (Fin 4)) + multipartite_upper_bound_color_cut T {1} +
multipartite_upper_bound_color_cut T {2} + multipartite_upper_bound_color_cut T {3} -
multipartite_upper_bound_color_cut T {0,1} - multipartite_upper_bound_color_cut T {0,2} -
multipartite_upper_bound_color_cut T {1,2} = (a : ℤ) + 3multipartite_sharp_lower_boundIn LeanQuantum Mechanics
For every natural number a there is a finite complete multipartite graph with nonempty parts, exactly a of size at least 4, carrying a four-colouring whose tripartite information equals a + 3.
theorem multipartite_sharp_lower_bound (a : ℕ) :
∃ (ι : Type) (_ : Fintype ι) (_ : DecidableEq ι)
(V : ι → Type) (_ : ∀ i, Fintype (V i)) (_ : ∀ i, DecidableEq (V i)) (_ : ∀ i, Nonempty (V i)),
complete_multipartite_num_large_parts V = a ∧
∃ c : (Σ i, V i) → Fin 4,
tree_graph_state_tripartite_info (SimpleGraph.completeMultipartiteGraph V)
(multipartite_upper_bound_color_class V c {0})
(multipartite_upper_bound_color_class V c {1})
(multipartite_upper_bound_color_class V c {2})
(multipartite_upper_bound_color_class V c {3}) = (a : ℤ) + 3multipartite_sharp_odd_config_valueIn LeanQuantum Mechanics
For odd a, the colour-set family consisting of a parts carrying all four colours together with one copy each of the 3-element colour sets {0,1,2}, {0,1,3}, {0,2,3}, {1,2,3} has alternating seven-term colour-cut sum exactly a + 3.
theorem multipartite_sharp_odd_config_value (a : ℕ) (ha : a % 2 = 1) :
let T : (Fin a ⊕ Fin 4) → Finset (Fin 4) :=
fun i => match i with
| Sum.inl _ => Finset.univ
| Sum.inr j => if j = 0 then ({0,1,2} : Finset (Fin 4)) else if j = 1 then {0,1,3}
else if j = 2 then {0,2,3} else {1,2,3}
multipartite_upper_bound_color_cut T ({0} : Finset (Fin 4)) + multipartite_upper_bound_color_cut T {1} +
multipartite_upper_bound_color_cut T {2} + multipartite_upper_bound_color_cut T {3} -
multipartite_upper_bound_color_cut T {0,1} - multipartite_upper_bound_color_cut T {0,2} -
multipartite_upper_bound_color_cut T {1,2} = (a : ℤ) + 3multipartite_tripartite_info_eq_color_cut_sumIn LeanQuantum Mechanics
For a finite complete multipartite graph with nonempty finite parts and any four-colouring c of its vertex set, the tripartite information of the four colour classes equals the alternating seven-term sum of the colour-cut values multipartite_upper_bound_color_cut of the part colour sets, at the index sets {0},{1},{2},{3},{0,1},{0,2},{1,2}.
theorem multipartite_tripartite_info_eq_color_cut_sum
{ι : Type*} [Fintype ι] [DecidableEq ι]
(V : ι → Type*) [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] [∀ i, Nonempty (V i)]
(c : (Σ i, V i) → Fin 4) :
tree_graph_state_tripartite_info (SimpleGraph.completeMultipartiteGraph V)
(multipartite_upper_bound_color_class V c {0})
(multipartite_upper_bound_color_class V c {1})
(multipartite_upper_bound_color_class V c {2})
(multipartite_upper_bound_color_class V c {3})
= multipartite_upper_bound_color_cut (multipartite_upper_bound_part_color_set V c) ({0} : Finset (Fin 4))
+ multipartite_upper_bound_color_cut (multipartite_upper_bound_part_color_set V c) {1}
+ multipartite_upper_bound_color_cut (multipartite_upper_bound_part_color_set V c) {2}
+ multipartite_upper_bound_color_cut (multipartite_upper_bound_part_color_set V c) {3}
- multipartite_upper_bound_color_cut (multipartite_upper_bound_part_color_set V c) {0, 1}
- multipartite_upper_bound_color_cut (multipartite_upper_bound_part_color_set V c) {0, 2}
- multipartite_upper_bound_color_cut (multipartite_upper_bound_part_color_set V c) {1, 2}multipartite_upper_bound_color_cut_boundIn LeanQuantum Mechanics
For any family of nonempty colour sets T i on four colours, the alternating sum of multipartite_upper_bound_color_cut over the seven sets {0},{1},{2},{3},{0,1},{0,2},{1,2} is at most 3 plus the number of parts on which all four colours occur.
theorem multipartite_upper_bound_color_cut_bound {ι : Type*} [Fintype ι]
(T : ι → Finset (Fin 4)) (hne : ∀ i, (T i).Nonempty) :
multipartite_upper_bound_color_cut T ({0} : Finset (Fin 4))
+ multipartite_upper_bound_color_cut T {1}
+ multipartite_upper_bound_color_cut T {2}
+ multipartite_upper_bound_color_cut T {3}
- multipartite_upper_bound_color_cut T {0, 1}
- multipartite_upper_bound_color_cut T {0, 2}
- multipartite_upper_bound_color_cut T {1, 2}
≤ ((Finset.univ.filter (fun i => T i = Finset.univ)).card : ℤ) + 3multipartite_upper_bound_cut_rank_le_splitIn LeanQuantum Mechanics
For a complete multipartite graph with nonempty parts and a colouring c, the GF(2) cut rank at the colour class of X is at most the number of parts split by X, plus one.
theorem multipartite_upper_bound_cut_rank_le_split
{ι : Type*} [Fintype ι] [DecidableEq ι]
(V : ι → Type*) [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] [∀ i, Nonempty (V i)]
(c : (Σ i, V i) → Fin 4) (X : Finset (Fin 4)) :
simple_graph_cut_rank (SimpleGraph.completeMultipartiteGraph V)
(multipartite_upper_bound_color_class V c X)
≤ (multipartite_upper_bound_split_parts (multipartite_upper_bound_part_color_set V c) X).card + 1multipartite_upper_bound_cut_rank_sevenIn LeanQuantum Mechanics
For a four-colouring c of a complete multipartite graph with nonempty parts, and any X : Finset (Fin 4), the GF(2) cut rank at the colour class of X equals multipartite_upper_bound_color_cut applied to the part colour sets.
theorem multipartite_upper_bound_cut_rank_seven
{ι : Type*} [Fintype ι] [DecidableEq ι]
(V : ι → Type*) [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] [∀ i, Nonempty (V i)]
(c : (Σ i, V i) → Fin 4) :
(∀ X : Finset (Fin 4),
(simple_graph_cut_rank (SimpleGraph.completeMultipartiteGraph V)
(multipartite_upper_bound_color_class V c X) : ℤ)
= multipartite_upper_bound_color_cut (multipartite_upper_bound_part_color_set V c) X)multipartite_upper_bound_four_coloringIn LeanQuantum Mechanics
For a complete multipartite graph with nonempty parts and any four-colouring c, the tripartite information tree_graph_state_tripartite_info at the four colour classes is at most the number of parts on which all four colours occur, plus 3.
theorem multipartite_upper_bound_four_coloring
{ι : Type*} [Fintype ι] [DecidableEq ι]
(V : ι → Type*) [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] [∀ i, Nonempty (V i)]
(c : (Σ i, V i) → Fin 4) :
tree_graph_state_tripartite_info (SimpleGraph.completeMultipartiteGraph V)
(multipartite_upper_bound_color_class V c {0})
(multipartite_upper_bound_color_class V c {1})
(multipartite_upper_bound_color_class V c {2})
(multipartite_upper_bound_color_class V c {3})
≤ ((Finset.univ.filter
(fun i => multipartite_upper_bound_part_color_set V c i = Finset.univ)).card : ℤ) + 3multipartite_upper_bound_max_all_fourIn LeanQuantum Mechanics
For a complete multipartite graph with nonempty parts, the maximum tripartite information is at most the number of parts carrying all four colours, plus three.
theorem multipartite_upper_bound_max_all_four
{ι : Type*} [Fintype ι] [DecidableEq ι]
(V : ι → Type*) [∀ i, Fintype (V i)] [∀ i, DecidableEq (V i)] [∀ i, Nonempty (V i)] :
simple_graph_max_tripartite_info (SimpleGraph.completeMultipartiteGraph V) ≤
((Finset.univ.filter (fun i => 4 ≤ Fintype.card (V i))).card : ℤ) + 3multipartite_upper_bound_part_color_set_univ_cardIn LeanQuantum Mechanics
If every one of the four colours occurs on the part V i, then V i has at least four vertices.
theorem multipartite_upper_bound_part_color_set_univ_card
{ι : Type*} [Fintype ι]
(V : ι → Type*) [∀ i, Fintype (V i)]
(c : (Σ i, V i) → Fin 4) {i : ι}
(hi : multipartite_upper_bound_part_color_set V c i = Finset.univ) :
4 ≤ Fintype.card (V i)multipartite_upper_bound_part_trichotomyIn LeanQuantum Mechanics
For any part colour sets T and any X : Finset (Fin 4), every index i is in exactly one of the three classes: T i ⊆ X, T i ∩ X = ∅, or i ∈ split_parts T X. Moreover if T i is nonempty and neither T i ⊆ X nor T i ∩ X = ∅ then i ∈ split_parts T X.
theorem multipartite_upper_bound_part_trichotomy {ι : Type*} [Fintype ι]
(T : ι → Finset (Fin 4)) (X : Finset (Fin 4)) (i : ι) :
(T i ⊆ X → i ∉ multipartite_upper_bound_split_parts T X) ∧
(T i ∩ X = ∅ → i ∉ multipartite_upper_bound_split_parts T X) ∧
((T i).Nonempty → ¬ T i ⊆ X → T i ∩ X ≠ ∅ → i ∈ multipartite_upper_bound_split_parts T X)op1347_monotone_halfIn LeanQuantum Mechanics
For every real α ≥ 1, every generalized tree shift T → T' between trees on a finite vertex set satisfies H_α(T') ≤ H_α(T).
theorem op1347_monotone_half :
∀ (α : ℝ) (hα : 1 ≤ α) {V : Type} [Fintype V] [DecidableEq V]
(T T' : SimpleGraph V) [DecidableRel T.Adj] [DecidableRel T'.Adj]
(hshift : is_generalized_tree_shift T T'),
ccz_renyi_entropy α T' ≤ ccz_renyi_entropy α Top1347_subunit_halfIn LeanQuantum Mechanics
For every real order 0 < α < 1 there is n ≥ 1 such that H_α(P_n) < H_α(S_n).
theorem op1347_subunit_half :
∀ (α : ℝ) (hα0 : 0 < α) (hα1 : α < 1),
∃ (n : ℕ) (_hn : 1 ≤ n),
letI : DecidableRel (SimpleGraph.pathGraph n).Adj := inferInstance
letI : DecidableRel (ccz_star_graph n).Adj := Classical.decRel _
ccz_renyi_entropy α (SimpleGraph.pathGraph n) < ccz_renyi_entropy α (ccz_star_graph n)op_1440_four_fifths_scalar_gapIn LeanQuantum Mechanics
With the closed scalar expressions A (from the bipartite value) and B (from the tripartite value) at p = 1/2, a = q = 1/1600, t = 180/8099, one has 1 - 2·A + B < 0; equivalently the subadditivity slack 2·I(X:Y) - I(X:YZ) of the Petz (4/5)-power information is strictly negative (it equals (1 - 2A + B)/((4/5)(1-4/5)) ≈ -2.7220155969930917e-5).
theorem op_1440_four_fifths_scalar_gap :
1 - 2 * (let u : ℝ := (8099 / 8101 : ℝ) ^ 2 * (1599 / 1600) + (180 / 8101 : ℝ) ^ 2 * (1 / 1600)
let w : ℝ := (180 / 8101 : ℝ) ^ 2 * (1599 / 1600) + (8099 / 8101 : ℝ) ^ 2 * (1 / 1600)
let alpha : ℝ := ((1599 / 1600 : ℝ) ^ ((4 : ℝ) / 5) + (1 / 1600 : ℝ) ^ ((4 : ℝ) / 5)) / 2
let delta : ℝ := ((1599 / 1600 : ℝ) ^ ((4 : ℝ) / 5) - (1 / 1600 : ℝ) ^ ((4 : ℝ) / 5)) / (799 / 800)
(alpha + delta * ((u - w) / 2)) * u ^ ((1 : ℝ) / 5) +
(alpha - delta * ((u - w) / 2)) * w ^ ((1 : ℝ) / 5))
+ (let u : ℝ := (8099 / 8101 : ℝ) ^ 2 * (1599 / 1600) + (180 / 8101 : ℝ) ^ 2 * (1 / 1600)
let w : ℝ := (180 / 8101 : ℝ) ^ 2 * (1599 / 1600) + (8099 / 8101 : ℝ) ^ 2 * (1 / 1600)
let v : ℝ := (8099 / 8101 : ℝ) * (180 / 8101) * (799 / 800)
let alpha : ℝ := ((1599 / 1600 : ℝ) ^ ((4 : ℝ) / 5) + (1 / 1600 : ℝ) ^ ((4 : ℝ) / 5)) / 2
let delta : ℝ := ((1599 / 1600 : ℝ) ^ ((4 : ℝ) / 5) - (1 / 1600 : ℝ) ^ ((4 : ℝ) / 5)) / (799 / 800)
let e1 : ℝ := alpha + delta * ((u - w) / 2)
let e2 : ℝ := alpha - delta * ((u - w) / 2)
let disc : ℝ := Real.sqrt ((u ^ 2 - w ^ 2) ^ 2 + 4 * v ^ 4)
let lp : ℝ := (u ^ 2 + w ^ 2 + disc) / 2
let lm : ℝ := (u ^ 2 + w ^ 2 - disc) / 2
let AA : ℝ := (lp ^ ((1 : ℝ) / 5) + lm ^ ((1 : ℝ) / 5)) / 2
let BB : ℝ := (lp ^ ((1 : ℝ) / 5) - lm ^ ((1 : ℝ) / 5)) / disc
let nu1 : ℝ := AA + BB * (u ^ 2 - w ^ 2) / 2
let nu2 : ℝ := BB * v ^ 2
let nu3 : ℝ := AA - BB * (u ^ 2 - w ^ 2) / 2
let eta1 : ℝ := ((u * w + v ^ 2) ^ ((1 : ℝ) / 5) + (u * w - v ^ 2) ^ ((1 : ℝ) / 5)) / 2
let eta2 : ℝ := ((u * w + v ^ 2) ^ ((1 : ℝ) / 5) - (u * w - v ^ 2) ^ ((1 : ℝ) / 5)) / 2
nu1 * e1 ^ 2 + nu3 * e2 ^ 2 + 2 * (nu2 + eta2) * (delta * v) ^ 2 + 2 * eta1 * e1 * e2) < 0op_1440_four_fifths_xy_petz_valueIn LeanQuantum Mechanics
For p = 1/2, a = q = 1/1600 and t = 180/8099, the Petz (4/5)-power information of the bipartite symmetric qubit fork equals (1 - A)/c with c = (4/5)(1 - 4/5), where A is the explicit closed scalar expression: with u = (8099/8101)^2·(1599/1600) + (180/8101)^2·(1/1600), w = (180/8101)^2·(1599/1600) + (8099/8101)^2·(1/1600) (the diagonal entries of the W-conjugated single-qubit state, u + w = 1), alpha = ((1599/1600)^(4/5) + (1/1600)^(4/5))/2 and delta = ((1599/1600)^(4/5) - (1/1600)^(4/5))/(799/800) (the two-point interpolation of x ↦ x^(4/5) at the eigenvalues 1599/1600 and 1/1600), one has A = (alpha + delta·((u - w)/2))·u^(1/5) + (alpha - delta·((u - w)/2))·w^(1/5).
theorem op_1440_four_fifths_xy_petz_value :
petz_power_information (4 / 5)
(symmetric_qubit_fork_xy (1 / 2 : ℝ) (1 / 1600 : ℝ) (1 / 1600 : ℝ) (180 / 8099 : ℝ))
= (let u : ℝ := (8099 / 8101 : ℝ) ^ 2 * (1599 / 1600) + (180 / 8101 : ℝ) ^ 2 * (1 / 1600)
let w : ℝ := (180 / 8101 : ℝ) ^ 2 * (1599 / 1600) + (8099 / 8101 : ℝ) ^ 2 * (1 / 1600)
let alpha : ℝ := ((1599 / 1600 : ℝ) ^ ((4 : ℝ) / 5) + (1 / 1600 : ℝ) ^ ((4 : ℝ) / 5)) / 2
let delta : ℝ := ((1599 / 1600 : ℝ) ^ ((4 : ℝ) / 5) - (1 / 1600 : ℝ) ^ ((4 : ℝ) / 5)) / (799 / 800)
(1 - ((alpha + delta * ((u - w) / 2)) * u ^ ((1 : ℝ) / 5) +
(alpha - delta * ((u - w) / 2)) * w ^ ((1 : ℝ) / 5))) / ((4 / 5) * (1 - 4 / 5)))op_1440_four_fifths_xyz_petz_valueIn LeanQuantum Mechanics
For p = 1/2, a = q = 1/1600 and t = 180/8099, the Petz (4/5)-power information of the tripartite symmetric qubit fork equals (1 - B)/c with the same c = (4/5)(1 - 4/5), where B is the explicit closed scalar expression built from: u, w, v (entries of the W-conjugated single-qubit state, u + w = 1), alpha, delta (two-point interpolation of x^(4/5) at 1599/1600 and 1/1600), e1 = alpha + delta(u-w)/2, e2 = alpha - delta(u-w)/2 (the diagonal of cfc(x^(4/5)) of that state), disc = sqrt((u²-w²)² + 4v⁴), lp, lm the two eigenvalues of M = [[u²,v²],[v²,w²]], AA, BB the two-point interpolation of x^(1/5) at lp, lm, nu1, nu2, nu3 the entries of cfc(x^(1/5))(M), and eta1, eta2 the entries of cfc(x^(1/5))(N) with N = [[u·w,v²],[v²,u·w]]; then B = nu1·e1² + nu3·e2² + 2·(nu2 + eta2)·(delta·v)² + 2·eta1·e1·e2.
theorem op_1440_four_fifths_xyz_petz_value :
petz_power_information (4 / 5)
(symmetric_qubit_fork_xyz (1 / 2 : ℝ) (1 / 1600 : ℝ) (1 / 1600 : ℝ) (180 / 8099 : ℝ))
= (let u : ℝ := (8099 / 8101 : ℝ) ^ 2 * (1599 / 1600) + (180 / 8101 : ℝ) ^ 2 * (1 / 1600)
let w : ℝ := (180 / 8101 : ℝ) ^ 2 * (1599 / 1600) + (8099 / 8101 : ℝ) ^ 2 * (1 / 1600)
let v : ℝ := (8099 / 8101 : ℝ) * (180 / 8101) * (799 / 800)
let alpha : ℝ := ((1599 / 1600 : ℝ) ^ ((4 : ℝ) / 5) + (1 / 1600 : ℝ) ^ ((4 : ℝ) / 5)) / 2
let delta : ℝ := ((1599 / 1600 : ℝ) ^ ((4 : ℝ) / 5) - (1 / 1600 : ℝ) ^ ((4 : ℝ) / 5)) / (799 / 800)
let e1 : ℝ := alpha + delta * ((u - w) / 2)
let e2 : ℝ := alpha - delta * ((u - w) / 2)
let disc : ℝ := Real.sqrt ((u ^ 2 - w ^ 2) ^ 2 + 4 * v ^ 4)
let lp : ℝ := (u ^ 2 + w ^ 2 + disc) / 2
let lm : ℝ := (u ^ 2 + w ^ 2 - disc) / 2
let AA : ℝ := (lp ^ ((1 : ℝ) / 5) + lm ^ ((1 : ℝ) / 5)) / 2
let BB : ℝ := (lp ^ ((1 : ℝ) / 5) - lm ^ ((1 : ℝ) / 5)) / disc
let nu1 : ℝ := AA + BB * (u ^ 2 - w ^ 2) / 2
let nu2 : ℝ := BB * v ^ 2
let nu3 : ℝ := AA - BB * (u ^ 2 - w ^ 2) / 2
let eta1 : ℝ := ((u * w + v ^ 2) ^ ((1 : ℝ) / 5) + (u * w - v ^ 2) ^ ((1 : ℝ) / 5)) / 2
let eta2 : ℝ := ((u * w + v ^ 2) ^ ((1 : ℝ) / 5) - (u * w - v ^ 2) ^ ((1 : ℝ) / 5)) / 2
(1 - (nu1 * e1 ^ 2 + nu3 * e2 ^ 2 + 2 * (nu2 + eta2) * (delta * v) ^ 2 +
2 * eta1 * e1 * e2)) / ((4 / 5) * (1 - 4 / 5)))op_1440_petz_power_information_subadditivity_violation_tenthIn LeanQuantum Mechanics
Partial result for OP-1440 at a single small exponent: there exist rational p, a, q, t in (0,1) with 2·I(X:Y) < I(X:YZ) at β = 1/10, where I is the Petz power information of the symmetric qubit forks. (Witness: a = 1/2, p = 1/4, q = 1/25, t = 1/2.)
theorem op_1440_petz_power_information_subadditivity_violation_tenth :
∃ (p a q t : ℚ), (0 : ℚ) < p ∧ p < 1 ∧ (0 : ℚ) < a ∧ a < 1 ∧ (0 : ℚ) < q ∧ q < 1 ∧ (0 : ℚ) < t ∧ t < 1 ∧
2 * petz_power_information (1 / 10) (symmetric_qubit_fork_xy (p : ℝ) (a : ℝ) (q : ℝ) (t : ℝ)) <
petz_power_information (1 / 10) (symmetric_qubit_fork_xyz (p : ℝ) (a : ℝ) (q : ℝ) (t : ℝ))op_1668_binom_weight_sqrt_ratio_leIn LeanQuantum Mechanics
For 0 < p < 1/2 and w ≤ n, the binomial weight p^w (1-p)^(n-w) times (√(p/(1-p)))^|n-2w| is at most (√(p(1-p)))^n.
theorem op_1668_binom_weight_sqrt_ratio_le (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1 / 2) (n w : ℕ) (hw : w ≤ n) : p ^ w * (1 - p) ^ (n - w) * (Real.sqrt (p / (1 - p))) ^ ((n : ℤ) - 2 * (w : ℤ)).natAbs ≤ (Real.sqrt (p * (1 - p))) ^ n
op_1668_central_binomial_two_sidedIn LeanQuantum Mechanics
There are positive constants a, b with a·2^n/√n ≤ C(n,⌊n/2⌋) ≤ b·2^n/√n for every n ≥ 1. (Explicitly a = 1/2 and b = 1 work.)
theorem op_1668_central_binomial_two_sided : ∃ a > (0:ℝ), ∃ b > (0:ℝ), ∀ n : ℕ, 1 ≤ n → a * 2 ^ n / Real.sqrt (n : ℝ) ≤ (Nat.choose n (n / 2) : ℝ) ∧ (Nat.choose n (n / 2) : ℝ) ≤ b * 2 ^ n / Real.sqrt (n : ℝ)
op_1668_hypergraph_deficit_h_ratio_boundsIn LeanQuantum Mechanics
For 0 < p < 1/2 and every natural j, the kernel hypergraph_deficit_h p j is trapped between the j-th powers of the ratio t = p/(1-p): t^j ≤ hypergraph_deficit_h p j ≤ 4 t^j.
theorem op_1668_hypergraph_deficit_h_ratio_bounds (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1 / 2) (j : ℕ) : (p / (1 - p)) ^ j ≤ hypergraph_deficit_h p j ∧ hypergraph_deficit_h p j ≤ 4 * (p / (1 - p)) ^ j
op_1668_hypergraph_deficit_lower_coreIn LeanQuantum Mechanics
For 0 < p < 1/2 there is k > 0 with k·n·C(n,⌊n/2⌋)·(√(p(1-p)))^n ≤ hypergraph_binomial_deficit n p for all n ≥ 3.
theorem op_1668_hypergraph_deficit_lower_core (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1 / 2) : ∃ k > (0:ℝ), ∀ n : ℕ, 3 ≤ n → k * (n : ℝ) * (Nat.choose n (n / 2) : ℝ) * (Real.sqrt (p * (1 - p))) ^ n ≤ hypergraph_binomial_deficit n p
op_1668_hypergraph_deficit_upper_coreIn LeanQuantum Mechanics
For 0 < p < 1/2 there is K > 0 with hypergraph_binomial_deficit n p ≤ K·n·C(n,⌊n/2⌋)·(√(p(1-p)))^n for all n ≥ 3.
theorem op_1668_hypergraph_deficit_upper_core (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1 / 2) : ∃ K > (0:ℝ), ∀ n : ℕ, 3 ≤ n → hypergraph_binomial_deficit n p ≤ K * (n : ℝ) * (Nat.choose n (n / 2) : ℝ) * (Real.sqrt (p * (1 - p))) ^ n
op_1693_bessel_I0_continuousIn LeanQuantum Mechanics
The modified Bessel function I_0, defined as the series Σ_j (z^2/4)^j/(j!)^2, is continuous on ℝ.
theorem op_1693_bessel_I0_continuous : Continuous bessel_I0
op_1693_bessel_I0_le_expIn LeanQuantum Mechanics
For z ≥ 0, the modified Bessel function is dominated by the exponential: I_0(z) ≤ exp z.
theorem op_1693_bessel_I0_le_exp (z : ℝ) (hz : 0 ≤ z) : bessel_I0 z ≤ Real.exp z
op_1693_bessel_I0_posIn LeanQuantum Mechanics
The modified Bessel function is strictly positive at every real argument: 0 < I_0(z) for all z.
theorem op_1693_bessel_I0_pos (z : ℝ) : 0 < bessel_I0 z
op_1693_bessel_I0_strictMonoOnIn LeanQuantum Mechanics
The modified Bessel function is strictly increasing on the non-negative axis: 0 ≤ a < b implies I_0(a) < I_0(b).
theorem op_1693_bessel_I0_strictMonoOn : StrictMonoOn bessel_I0 (Set.Ici 0)
op_1693_bessel_I0_summableIn LeanQuantum Mechanics
The defining series of the modified Bessel function I_0 converges at every real argument: for every real z the family j ↦ (z^2/4)^j / (j!)^2 is summable.
theorem op_1693_bessel_I0_summable (z : ℝ) :
Summable (fun j : ℕ => (z ^ 2 / 4) ^ j / ((j.factorial : ℝ) ^ 2))op_1693_bessel_I0_zeroIn LeanQuantum Mechanics
The modified Bessel function at the origin is one: I_0(0) = 1.
theorem op_1693_bessel_I0_zero : bessel_I0 0 = 1
op_1693_bessel_cross_cauchy_schwarzIn LeanQuantum Mechanics
For a, b ≥ 0, the mixed Bessel term is bounded by the geometric mean of the two collision probabilities: exp(-(a+b)) I_0(2√(ab)) ≤ √(G(a) G(b)), where G(a) = exp(-2a) I_0(2a).
theorem op_1693_bessel_cross_cauchy_schwarz (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) :
Real.exp (-(a + b)) * bessel_I0 (2 * Real.sqrt (a * b)) ≤
Real.sqrt ((Real.exp (-2 * a) * bessel_I0 (2 * a)) *
(Real.exp (-2 * b) * bessel_I0 (2 * b)))op_1693_bessel_g_collision_identityIn LeanQuantum Mechanics
For a ≥ 0, the collision probability G(a) = exp(-2a) I_0(2a) equals the ℓ²-norm squared of the Poisson mass function: G(a) = Σ_j (exp(-a) a^j/j!)^2. In particular G(0) = 1.
theorem op_1693_bessel_g_collision_identity (a : ℝ) (ha : 0 ≤ a) :
Real.exp (-2 * a) * bessel_I0 (2 * a) =
∑' j : ℕ, (Real.exp (-a) * a ^ j / (j.factorial : ℝ)) ^ 2op_1693_bessel_g_strictAntiOnIn LeanQuantum Mechanics
The Poisson collision probability a ↦ Σ_j (exp(-a) a^j/j!)^2 = exp(-2a) I_0(2a) is strictly decreasing in a on [0, ∞).
theorem op_1693_bessel_g_strictAntiOn :
StrictAntiOn (fun a : ℝ => Real.exp (-2 * a) * bessel_I0 (2 * a)) (Set.Ici 0)op_1693_bessel_g_summableIn LeanQuantum Mechanics
For a ≥ 0 the sequence of squared Poisson masses j ↦ (exp(-a) a^j/j!)^2 is summable.
theorem op_1693_bessel_g_summable (a : ℝ) (ha : 0 ≤ a) :
Summable (fun j : ℕ => (Real.exp (-a) * a ^ j / (j.factorial : ℝ)) ^ 2)op_1693_bessel_g_tendsto_zeroIn LeanQuantum Mechanics
The Poisson collision probability exp(-2a) I_0(2a) tends to 0 as a → +∞ (it is asymptotic to 1/√(4πa)).
theorem op_1693_bessel_g_tendsto_zero :
Filter.Tendsto (fun a : ℝ => Real.exp (-2 * a) * bessel_I0 (2 * a)) Filter.atTop (nhds 0)op_1693_bessel_poisson_product_identityIn LeanQuantum Mechanics
For a, b ≥ 0, the mixed Bessel term equals the inner product of the two Poisson mass functions: exp(-(a+b)) I_0(2√(ab)) = Σ_j (exp(-a) a^j/j!) (exp(-b) b^j/j!).
theorem op_1693_bessel_poisson_product_identity (a b : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) :
Real.exp (-(a + b)) * bessel_I0 (2 * Real.sqrt (a * b)) =
∑' j : ℕ, (Real.exp (-a) * a ^ j / (j.factorial : ℝ)) *
(Real.exp (-b) * b ^ j / (j.factorial : ℝ))op_1693_bessel_poisson_shift_identityIn LeanQuantum Mechanics
For a ≥ 0 and every j, the Poisson mass function satisfies a ⋅ (exp(-a) a^j/j!) = (j+1) ⋅ (exp(-a) a^(j+1)/(j+1)!).
theorem op_1693_bessel_poisson_shift_identity (a : ℝ) (ha : 0 ≤ a) (j : ℕ) :
a * (Real.exp (-a) * a ^ j / (j.factorial : ℝ)) =
((j : ℝ) + 1) * (Real.exp (-a) * a ^ (j + 1) / ((j + 1).factorial : ℝ))op_1693_factorial_two_mul_le_four_powIn LeanQuantum Mechanics
For every natural number j, (2j)! ≤ 4^j (j!)^2; equivalently the central binomial coefficient C(2j,j) is at most 4^j.
theorem op_1693_factorial_two_mul_le_four_pow (j : ℕ) :
(2 * j).factorial ≤ 4 ^ j * j.factorial ^ 2op_1693_noon_binomial_sum_oneIn LeanQuantum Mechanics
For every natural number N and every real x, the binomial masses sum to one: ∑_{k=0}^{N} C(N,k) x^k (1-x)^{N-k} = 1.
theorem op_1693_noon_binomial_sum_one (N : ℕ) (x : ℝ) :
∑ k ∈ Finset.range (N + 1), (Nat.choose N k : ℝ) * x ^ k * (1 - x) ^ (N - k) = 1op_1693_noon_binomial_summand_nonnegIn LeanQuantum Mechanics
For x ∈ [0,1] the binomial masses are non-negative: 0 ≤ C(N,k) x^k (1-x)^{N-k}.
theorem op_1693_noon_binomial_summand_nonneg (N k : ℕ) (x : ℝ) (hx : x ∈ Set.Icc 0 1) :
0 ≤ (Nat.choose N k : ℝ) * x ^ k * (1 - x) ^ (N - k)op_1693_noon_realign_witness_at_one_oneIn LeanQuantum Mechanics
At x = y = 1 every binomial summand of W_N(q, x, y) vanishes except k = N, where it equals 1; hence W_N(q, 1, 1) = 1 + 4q(1-q), the same value as the scaling surface at the origin.
theorem op_1693_noon_realign_witness_at_one_one (N : ℕ) (q : ℝ) :
noon_realign_witness N q 1 1 = 1 + 4 * q * (1 - q)op_1693_noon_realign_witness_continuousIn LeanQuantum Mechanics
For every natural number N and real q, the map (x, y) ↦ W_N(q, x, y) is continuous on ℝ²; it is a finite sum of polynomials in x and y.
theorem op_1693_noon_realign_witness_continuous (N : ℕ) (q : ℝ) :
Continuous (fun p : ℝ × ℝ => noon_realign_witness N q p.1 p.2)op_1693_noon_realign_witness_nonnegIn LeanQuantum Mechanics
For q ∈ [0,1] and transmissivities x, y ∈ [0,1], the realignment witness is non-negative: 0 ≤ W_N(q, x, y).
theorem op_1693_noon_realign_witness_nonneg (N : ℕ) (q x y : ℝ)
(hq : q ∈ Set.Icc 0 1) (hx : x ∈ Set.Icc 0 1) (hy : y ∈ Set.Icc 0 1) :
0 ≤ noon_realign_witness N q x yop_1693_noon_scaling_surface_at_originIn LeanQuantum Mechanics
At zero loss the scaling surface equals 1 + 4q(1-q): F_q(0,0) = q² + (1-q)² + 2q(1-q) + 4q(1-q).
theorem op_1693_noon_scaling_surface_at_origin (q : ℝ) :
noon_scaling_surface q 0 0 = 1 + 4 * q * (1 - q)op_1693_noon_scaling_surface_continuousIn LeanQuantum Mechanics
For every q, the scaling surface (a,b) ↦ F_q(a,b) is continuous on ℝ².
theorem op_1693_noon_scaling_surface_continuous (q : ℝ) :
Continuous (fun p : ℝ × ℝ => noon_scaling_surface q p.1 p.2)op_1693_noon_scaling_surface_unique_ray_crossingIn LeanQuantum Mechanics
For every real q in the open interval (0, 1) and all real numbers u ≥ 0, v ≥ 0 with (u, v) ≠ (0, 0), there exists a unique real number t > 0 such that noon_scaling_surface q (t * u) (t * v) = 1.
theorem op_1693_noon_scaling_surface_unique_ray_crossing :
∀ (q : ℝ) (hq : q ∈ Set.Ioo 0 1) (u v : ℝ)
(hu : 0 ≤ u) (hv : 0 ≤ v) (hnz : (u, v) ≠ (0, 0)),
∃! t : ℝ, 0 < t ∧ noon_scaling_surface q (t * u) (t * v) = 1op_1693_noon_witness_deriv_nonnegIn LeanQuantum Mechanics
For every natural number N ≥ 1 and all real numbers q, x, y in the open interval (0, 1), if noon_realign_witness N q x y > 1, then 0 ≤ deriv (fun u => noon_realign_witness N q u y) x and 0 ≤ deriv (fun v => noon_realign_witness N q x v) y.
theorem op_1693_noon_witness_deriv_nonneg :
∀ (N : ℕ) (hN : 1 ≤ N) (q x y : ℝ)
(hq : q ∈ Set.Ioo 0 1) (hx : x ∈ Set.Ioo 0 1) (hy : y ∈ Set.Ioo 0 1),
noon_realign_witness N q x y > 1 →
0 ≤ deriv (fun u => noon_realign_witness N q u y) x ∧
0 ≤ deriv (fun v => noon_realign_witness N q x v) yop_1693_noon_witness_detection_upward_closedIn LeanQuantum Mechanics
For every natural number N ≥ 1, real number q in (0, 1), and transmissivities 0 < x ≤ x' < 1 and 0 < y ≤ y' < 1, if noon_realign_witness N q x y > 1, then noon_realign_witness N q x' y' > 1.
theorem op_1693_noon_witness_detection_upward_closed :
∀ (N : ℕ) (hN : 1 ≤ N) (q x y x' y' : ℝ)
(hq : q ∈ Set.Ioo 0 1)
(hx : 0 < x ∧ x ≤ x' ∧ x' < 1) (hy : 0 < y ∧ y ≤ y' ∧ y' < 1),
noon_realign_witness N q x y > 1 →
noon_realign_witness N q x' y' > 1op_1693_noon_witness_uniform_scaling_convergenceIn LeanQuantum Mechanics
For every real q in the open interval (0, 1) and every compact subset K ⊆ Set.Ici 0 ×ˢ Set.Ici 0, there exist C > 0 and N₀ ∈ ℕ such that for all N ≥ N₀ and all p ∈ K, |noon_realign_witness N q (1 - p.1 / (N : ℝ)) (1 - p.2 / (N : ℝ)) - noon_scaling_surface q p.1 p.2| ≤ C / (N : ℝ).
theorem op_1693_noon_witness_uniform_scaling_convergence :
∀ (q : ℝ) (hq : q ∈ Set.Ioo 0 1) (K : Set (ℝ × ℝ)) (hK : IsCompact K)
(hKpos : K ⊆ Set.Ici 0 ×ˢ Set.Ici 0),
∃ (C : ℝ) (hC : 0 < C) (N₀ : ℕ), ∀ (N : ℕ) (hN : N₀ ≤ N) (p : ℝ × ℝ) (hp : p ∈ K),
|noon_realign_witness N q (1 - p.1 / (N : ℝ)) (1 - p.2 / (N : ℝ)) -
noon_scaling_surface q p.1 p.2| ≤ C / (N : ℝ)op_1695_bipartite_magic_castIn LeanQuantum Mechanics
Coercing the real number bipartite_subgraph_magic_poly G to a complex number gives 8^{-|V|} times the complex subset sum over edge subsets A ⊆ E that are bipartite, of (-2)^{|A|} 8^{k(V,A)}.
open scoped Classical in
theorem op_1695_bipartite_magic_cast {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
(bipartite_subgraph_magic_poly G : ℂ)
= (1 / (8 : ℂ) ^ Fintype.card V) * ∑ A ∈ G.edgeFinset.powerset,
(if (SimpleGraph.fromEdgeSet (↑A : Set (Sym2 V))).IsBipartite then
(-2 : ℂ) ^ A.card *
(8 : ℂ) ^ Fintype.card (SimpleGraph.fromEdgeSet (↑A : Set (Sym2 V))).ConnectedComponent
else 0)op_1695_spin_config_countIn LeanQuantum Mechanics
For an edge subset A ⊆ E(G) of a finite simple graph G, summing over all sixteen-spin configurations the product over e ∈ A of the π/8 weight factor (-2)·[pattern] gives (-2)^{|A|} · 2^{|V|} · 8^{k} if the spanning subgraph (V, A) is bipartite, and 0 otherwise, where k is its number of connected components.
open scoped Classical in
theorem op_1695_spin_config_count {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (A : Finset (Sym2 V)) (hA : A ⊆ G.edgeFinset) :
(∑ sp : V → Fin 4 → Fin 2,
∏ e ∈ A, (-2 : ℂ) * (if sixteen_spin_diff_pattern sp e then (1 : ℂ) else 0))
= if (SimpleGraph.fromEdgeSet (A : Set (Sym2 V))).IsBipartite then
(-2 : ℂ) ^ A.card * (2 : ℂ) ^ Fintype.card V *
(8 : ℂ) ^ Fintype.card (SimpleGraph.fromEdgeSet (A : Set (Sym2 V))).ConnectedComponent
else 0op_1695_spin_partition_complexIn LeanQuantum Mechanics
At constant edge angle π/8, the sixteen-spin partition function of a finite simple graph G equals 8^{-|V|} times the sum over edge subsets A ⊆ E(G) of (-2)^{|A|} 8^{k(V,A)} when the spanning subgraph (V, A) is bipartite and 0 otherwise.
open scoped Classical in
theorem op_1695_spin_partition_complex {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
sixteen_spin_partition_fn G (fun _ => Real.pi / 8)
= (1 / (8 : ℂ) ^ Fintype.card V) * ∑ A ∈ G.edgeFinset.powerset,
(if (SimpleGraph.fromEdgeSet (↑A : Set (Sym2 V))).IsBipartite then
(-2 : ℂ) ^ A.card *
(8 : ℂ) ^ Fintype.card (SimpleGraph.fromEdgeSet (↑A : Set (Sym2 V))).ConnectedComponent
else 0)op_1695_spin_pattern_iffIn LeanQuantum Mechanics
For an edge subset A of a simple graph G and a sixteen-spin configuration sp, the pattern holds on every e ∈ A exactly when, on every edge {u,v} of the spanning subgraph (V, A), component 1 differs, component 2 agrees and component 3 differs. The hypothesis A ⊆ E(G) is needed to know that the edges of A are not loops.
open scoped Classical in
theorem op_1695_spin_pattern_iff {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (A : Finset (Sym2 V)) (hA : A ⊆ G.edgeFinset)
(sp : V → Fin 4 → Fin 2) :
(∀ e ∈ A, sixteen_spin_diff_pattern sp e) ↔
((∀ u v : V, (SimpleGraph.fromEdgeSet (A : Set (Sym2 V))).Adj u v → sp u 1 ≠ sp v 1) ∧
(∀ u v : V, (SimpleGraph.fromEdgeSet (A : Set (Sym2 V))).Adj u v → sp u 2 = sp v 2) ∧
(∀ u v : V, (SimpleGraph.fromEdgeSet (A : Set (Sym2 V))).Adj u v → sp u 3 ≠ sp v 3))op_1695_spin_triple_countIn LeanQuantum Mechanics
For a finite simple graph H, the number of sixteen-spin configurations whose components 1 and 3 are proper 2-colourings of H and whose component 2 is constant on every edge of H equals 2^{|V|} times 8^{k} if H is bipartite and 0 otherwise, where k is the number of connected components of H.
open scoped Classical in
theorem op_1695_spin_triple_count {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] :
(∑ sp : V → Fin 4 → Fin 2,
(if (∀ u v : V, H.Adj u v → sp u 1 ≠ sp v 1) ∧
(∀ u v : V, H.Adj u v → sp u 2 = sp v 2) ∧
(∀ u v : V, H.Adj u v → sp u 3 ≠ sp v 3) then (1 : ℂ) else 0))
= (2 : ℂ) ^ Fintype.card V *
(if H.IsBipartite then (8 : ℂ) ^ Fintype.card H.ConnectedComponent else 0)pathGraph_tripartite_info_nonposIn LeanQuantum Mechanics
For the path P_n and every four-partition A,B,C,D of its vertices, the tripartite information of the path at A,B,C,D is at most 0.
theorem pathGraph_tripartite_info_nonpos (n : ℕ) (A B C D : Finset (Fin n))
(hpart : is_four_partition A B C D) :
tree_graph_state_tripartite_info (SimpleGraph.pathGraph n) A B C D ≤ 0path_graph_cut_rank_two_mulIn LeanQuantum Mechanics
For the path P_n and any vertex subset S, twice the GF(2) rank of the cut matrix of S equals the number of edges crossing the cut plus the number of maximal odd-length runs of crossing edges.
theorem path_graph_cut_rank_two_mul (n : ℕ) (S : Finset (Fin n)) :
2 * simple_graph_cut_rank (SimpleGraph.pathGraph n) S =
(path_cut_word n S).countP id + odd_run_count (path_cut_word n S)petz_power_information_diagonalIn LeanQuantum Mechanics
For a diagonal joint state diag(P) (P : u × v → ℝ, P ≥ 0), the Petz power information equals (1 − Σ_{ij} P_ij^β · ((Σ_j' P_ij')·(Σ_i' P_i'j))^{1−β}) / (β(1−β)).
theorem petz_power_information_diagonal {u v : Type*} [Fintype u] [Fintype v] [DecidableEq u] [DecidableEq v]
(β : ℝ) (P : u × v → ℝ) (hP : ∀ i, 0 ≤ P i) :
petz_power_information β (Matrix.diagonal P) =
(1 - ∑ i : u × v, (P i) ^ β * ((∑ j : v, P (i.1, j)) * (∑ j : u, P (j, i.2))) ^ (1 - β)) /
(β * (1 - β))simple_graph_constant_two_coloring_countIn LeanQuantum Mechanics
For a finite simple graph H, the number of maps c : V → Fin 2 that are constant on every edge of H equals 2 to the number of connected components of H.
open scoped Classical in
theorem simple_graph_constant_two_coloring_count {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] :
(∑ c : V → Fin 2, (if ∀ u v : V, H.Adj u v → c u = c v then (1 : ℂ) else 0))
= (2 : ℂ) ^ Fintype.card H.ConnectedComponentsimple_graph_cut_rank_complIn LeanQuantum Mechanics
For any finite simple graph G and subset X of vertices, the cut rank of Xᶜ equals the cut rank of X, because adjacency is symmetric and the cut matrix of Xᶜ is the transpose of the cut matrix of X up to index equivalence.
theorem simple_graph_cut_rank_compl {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (X : Finset V) :
simple_graph_cut_rank G Xᶜ = simple_graph_cut_rank G Xsimple_graph_cut_rank_delete_edge_geIn LeanQuantum Mechanics
The GF(2) cut rank of G.deleteEdges {e} at X is at most 1 plus the GF(2) cut rank of G at X.
theorem simple_graph_cut_rank_delete_edge_ge {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (e : Sym2 V) (X : Finset V)
[DecidableRel (G.deleteEdges {e}).Adj] :
simple_graph_cut_rank (G.deleteEdges {e}) X ≤ simple_graph_cut_rank G X + 1simple_graph_cut_rank_delete_edge_leIn LeanQuantum Mechanics
The GF(2) cut rank of G at X is at most 1 plus the GF(2) cut rank of G.deleteEdges {e} at X.
theorem simple_graph_cut_rank_delete_edge_le {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (e : Sym2 V) (X : Finset V)
[DecidableRel (G.deleteEdges {e}).Adj] :
simple_graph_cut_rank G X ≤ simple_graph_cut_rank (G.deleteEdges {e}) X + 1simple_graph_cut_rank_ge_two_of_cross_minorIn LeanQuantum Mechanics
If u1, u2 lie in X, w1, w2 outside X, u1 is adjacent to w1 but not w2, and u2 is adjacent to w2 but not w1, then the cut rank of X is at least 2.
theorem simple_graph_cut_rank_ge_two_of_cross_minor {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (X : Finset V) (u₁ u₂ w₁ w₂ : V)
(hu₁ : u₁ ∈ X) (hu₂ : u₂ ∈ X) (hw₁ : w₁ ∉ X) (hw₂ : w₂ ∉ X)
(h11 : G.Adj u₁ w₁) (h22 : G.Adj u₂ w₂) (h12 : ¬ G.Adj u₁ w₂) (h21 : ¬ G.Adj u₂ w₁) :
2 ≤ simple_graph_cut_rank G Xsimple_graph_cut_rank_le_cardIn LeanQuantum Mechanics
For any finite simple graph G on vertex type V and any vertex subset X, the cut rank simple_graph_cut_rank G X is bounded by the cardinality of V.
theorem simple_graph_cut_rank_le_card {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (X : Finset V) :
simple_graph_cut_rank G X ≤ Fintype.card Vsimple_graph_cut_rank_le_card_leftIn LeanQuantum Mechanics
For any finite simple graph G and vertex subset X, the cut rank of X is at most the cardinality of X.
theorem simple_graph_cut_rank_le_card_left {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (X : Finset V) :
simple_graph_cut_rank G X ≤ X.cardsimple_graph_cut_rank_pos_of_cross_edgeIn LeanQuantum Mechanics
If u lies in X, v lies outside X, and u is adjacent to v, then the cut rank of X is at least 1.
theorem simple_graph_cut_rank_pos_of_cross_edge {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (X : Finset V) {u v : V}
(hu : u ∈ X) (hv : v ∉ X) (hadj : G.Adj u v) :
1 ≤ simple_graph_cut_rank G Xsimple_graph_proper_two_coloring_countIn LeanQuantum Mechanics
For a finite simple graph H, the number of proper 2-colourings c : V → Fin 2 (colourings with c u ≠ c v on every edge) equals 2 to the number of connected components of H if H is bipartite, and 0 otherwise.
open scoped Classical in
theorem simple_graph_proper_two_coloring_count {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] :
(∑ c : V → Fin 2, (if ∀ u v : V, H.Adj u v → c u ≠ c v then (1 : ℂ) else 0))
= if H.IsBipartite then (2 : ℂ) ^ Fintype.card H.ConnectedComponent else 0simple_graph_triangle_free_edge_card_le_sq_div_fourIn LeanQuantum Mechanics
Mantel's theorem: a triangle-free finite simple graph on n vertices has at most n²/4 edges, equivalently 4 * |E| ≤ n².
theorem simple_graph_triangle_free_edge_card_le_sq_div_four {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hG : G.CliqueFree 3) :
4 * G.edgeFinset.card ≤ (Fintype.card V) ^ 2sixteen_spin_diff_pattern_witnessIn LeanQuantum Mechanics
The π/8 difference pattern is neither always true nor always false: on the pair (false, true) of Bool, the spin configuration that flips in components 1 and 3 and preserves component 2 satisfies it, while the constant spin configuration does not.
theorem sixteen_spin_diff_pattern_witness :
sixteen_spin_diff_pattern (fun (x : Bool) (i : Fin 4) => if i = 1 ∨ i = 3 then (if x then 1 else 0) else 0)
s(false, true) ∧
¬ sixteen_spin_diff_pattern (fun (_ : Bool) (_ : Fin 4) => (0 : Fin 2)) s(false, true)sixteen_spin_weight_pair_pi_div_eightIn LeanQuantum Mechanics
At θ = π/8, the edge weight attached by a sixteen-spin configuration sp to an unordered pair {u, v} is 1 - 2·[the π/8 difference pattern holds on {u, v}], i.e. it is -1 exactly when components 1 and 3 flip and component 2 is preserved.
open scoped Classical in
theorem sixteen_spin_weight_pair_pi_div_eight {V : Type*} (sp : V → Fin 4 → Fin 2) (u v : V) :
sixteen_spin_weight (Real.pi / 8) (fun i => if sp u i = sp v i then (0 : Fin 2) else 1)
= 1 + (-2 : ℂ) * (if sixteen_spin_diff_pattern sp s(u, v) then 1 else 0)sixteen_spin_weight_pi_div_eightIn LeanQuantum Mechanics
At θ = π/8 the sixteen-spin edge weight of a difference vector d equals 1 - 2·[d₁ = 1 ∧ d₂ = 0 ∧ d₃ = 1]; that is, both exponentials collapse to exp(±iπ) = -1, so the weight is -1 exactly when the first three components read (1,0,1).
theorem sixteen_spin_weight_pi_div_eight (d : Fin 4 → Fin 2) :
sixteen_spin_weight (Real.pi / 8) d
= 1 + (-2 : ℂ) * (if d 1 = 1 ∧ d 2 = 0 ∧ d 3 = 1 then 1 else 0)sparse_graph_state_fisher_core_k_eventually_lt_nIn LeanQuantum Mechanics
When c_n = o(n), the core size k(d, c_n) is strictly less than n for all sufficiently large n.
theorem sparse_graph_state_fisher_core_k_eventually_lt_n
(d : ℕ) (c : ℕ → ℕ)
(hc : (fun n => (c n : ℝ)) =o[Filter.atTop] fun n => (n : ℝ)) :
∀ᶠ (n : ℕ) in Filter.atTop, sparse_graph_state_fisher_core_k d (c n) < nsparse_graph_state_fisher_q_max_asymptotic_classificationIn LeanQuantum Mechanics
For large n with c_n = o(n), every valid connected triangle-free graph G on n vertices with d*n + c_n edges satisfies Q(G) <= (n - k)^2 + B(d, c_n), and equality forces G to be isomorphic to the expansion of an optimal marked core graph.
theorem sparse_graph_state_fisher_q_max_asymptotic_classification
(d : ℕ) (hd : 2 ≤ d) (c : ℕ → ℕ)
(hc : (fun n => (c n : ℝ)) =o[Filter.atTop] fun n => (n : ℝ)) :
∀ᶠ (n : ℕ) in Filter.atTop,
let k := sparse_graph_state_fisher_core_k d (c n)
(∀ (G : SimpleGraph (Fin n)),
G.Connected → G.CliqueFree 3 → Nat.card G.edgeSet = d * n + c n →
graph_state_fisher_q G ≤ (n - k) ^ 2 + core_constant_b d (c n)) ∧
(∀ (G : SimpleGraph (Fin n)),
G.Connected → G.CliqueFree 3 → Nat.card G.edgeSet = d * n + c n →
graph_state_fisher_q G = (n - k) ^ 2 + core_constant_b d (c n) →
∃ (J : SimpleGraph (Fin (k + 1))) (s : Fin (k + 1)),
is_marked_core_graph k d (c n) J s ∧
graph_state_fisher_q J - 1 = core_constant_b d (c n) ∧
Nonempty (G ≃g expand_vertex (W := Fin (n - k)) J s))square_grid_graph_max_tripartite_info_abs_leIn LeanQuantum Mechanics
For every natural number n, the maximum tripartite information square_grid_graph_max_tripartite_info n of the n-by-n square grid graph state satisfies |square_grid_graph_max_tripartite_info n| ≤ 28 n^2.
theorem square_grid_graph_max_tripartite_info_abs_le (n : ℕ) :
|(square_grid_graph_max_tripartite_info n : ℝ)| ≤ 28 * (n : ℝ) ^ 2square_grid_graph_max_tripartite_info_block_leIn LeanQuantum Mechanics
For all m and k > 0, |square_grid_graph_max_tripartite_info (m * k) - m^2 * square_grid_graph_max_tripartite_info k| ≤ 28 * m^2 * k.
theorem square_grid_graph_max_tripartite_info_block_le (m k : ℕ) (hk : 0 < k) :
|(square_grid_graph_max_tripartite_info (m * k) : ℝ) - (m : ℝ) ^ 2 * (square_grid_graph_max_tripartite_info k : ℝ)| ≤
28 * (m : ℝ) ^ 2 * (k : ℝ)square_grid_graph_max_tripartite_info_rem_leIn LeanQuantum Mechanics
For all n and k > 0, |square_grid_graph_max_tripartite_info n - square_grid_graph_max_tripartite_info (n - n % k)| ≤ 28 * n * k.
theorem square_grid_graph_max_tripartite_info_rem_le (n k : ℕ) (hk : 0 < k) :
|(square_grid_graph_max_tripartite_info n : ℝ) - (square_grid_graph_max_tripartite_info (n - n % k) : ℝ)| ≤
28 * (n : ℝ) * (k : ℝ)square_grid_two_cut_rank_pair_ge_oneIn LeanQuantum Mechanics
On the 2-by-2 grid graph, the cut rank of any two distinct vertices is at least 1.
theorem square_grid_two_cut_rank_pair_ge_one (a b : Fin 2 × Fin 2) (hab : a ≠ b) :
1 ≤ simple_graph_cut_rank (SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2)
({a, b} : Finset (Fin 2 × Fin 2))square_grid_two_cut_rank_pair_of_adjIn LeanQuantum Mechanics
On the 2-by-2 grid graph, the cut rank of a pair of adjacent vertices is exactly 2.
theorem square_grid_two_cut_rank_pair_of_adj (a b : Fin 2 × Fin 2)
(h : (SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2).Adj a b) :
simple_graph_cut_rank (SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2)
({a, b} : Finset (Fin 2 × Fin 2)) = 2square_grid_two_cut_rank_singletonIn LeanQuantum Mechanics
On the 2-by-2 grid graph, the cut rank of a single vertex is 1.
theorem square_grid_two_cut_rank_singleton (u : Fin 2 × Fin 2) :
simple_graph_cut_rank (SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2)
({u} : Finset (Fin 2 × Fin 2)) = 1square_grid_two_four_parts_card_dichotomyIn LeanQuantum Mechanics
For any four-partition A, B, C, D of the four vertices of the 2-by-2 grid, either one of the parts is empty or all four parts are singletons.
theorem square_grid_two_four_parts_card_dichotomy (A B C D : Finset (Fin 2 × Fin 2))
(hpart : is_four_partition A B C D) :
(A = ∅ ∨ B = ∅ ∨ C = ∅ ∨ D = ∅) ∨
(A.card = 1 ∧ B.card = 1 ∧ C.card = 1 ∧ D.card = 1)square_grid_two_four_parts_tripartite_info_le_zeroIn LeanQuantum Mechanics
For the 2-by-2 grid graph (a 4-cycle) and every four-partition A, B, C, D of its vertices, the tripartite information is at most 0.
theorem square_grid_two_four_parts_tripartite_info_le_zero (A B C D : Finset (Fin 2 × Fin 2))
(hpart : is_four_partition A B C D) :
tree_graph_state_tripartite_info (SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2)
A B C D ≤ 0square_grid_two_pair_cuts_sum_ge_fourIn LeanQuantum Mechanics
For three distinct vertices a, b, c of the 2-by-2 grid, the sum of the cut ranks of the three unordered pairs {a,b}, {a,c}, {b,c} is at least 4.
theorem square_grid_two_pair_cuts_sum_ge_four (a b c : Fin 2 × Fin 2)
(hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) :
4 ≤ simple_graph_cut_rank (SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2)
({a, b} : Finset (Fin 2 × Fin 2)) +
simple_graph_cut_rank (SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2)
({a, c} : Finset (Fin 2 × Fin 2)) +
simple_graph_cut_rank (SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2)
({b, c} : Finset (Fin 2 × Fin 2))square_grid_two_singletons_tripartite_info_nonposIn LeanQuantum Mechanics
For four vertices a, b, c, d of the 2-by-2 grid with a, b, c pairwise distinct, the tripartite information of the parts {a}, {b}, {c}, {d} is at most 0.
theorem square_grid_two_singletons_tripartite_info_nonpos (a b c d : Fin 2 × Fin 2)
(hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) :
tree_graph_state_tripartite_info (SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2)
({a} : Finset (Fin 2 × Fin 2)) ({b} : Finset (Fin 2 × Fin 2))
({c} : Finset (Fin 2 × Fin 2)) ({d} : Finset (Fin 2 × Fin 2)) ≤ 0square_grid_two_three_distinct_has_adjacent_pairIn LeanQuantum Mechanics
Among any three distinct vertices of the 2-by-2 grid (a 4-cycle) some two are adjacent.
theorem square_grid_two_three_distinct_has_adjacent_pair (a b c : Fin 2 × Fin 2)
(hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) :
(SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2).Adj a b ∨
(SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2).Adj a c ∨
(SimpleGraph.pathGraph 2 □ SimpleGraph.pathGraph 2).Adj b csquare_grid_two_tripartite_info_le_zeroIn LeanQuantum Mechanics
For every four-coloring c of the 2-by-2 square grid graph state, the tripartite information is at most 0.
theorem square_grid_two_tripartite_info_le_zero
(c : Fin 2 × Fin 2 → Fin 4) :
square_grid_graph_tripartite_info 2 c ≤ 0sum_ccz_edge_distribution_eq_oneIn LeanQuantum Mechanics
The induced-edge distribution of a uniformly random vertex subset is a probability distribution: its total mass is 1.
theorem sum_ccz_edge_distribution_eq_one {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
∑ F : Finset (Sym2 V), ccz_edge_distribution G F = 1sum_rpow_le_sum_fiber_rpowIn LeanQuantum Mechanics
For α ≥ 1 and nonnegative weights p, coarsening the weight vector by pushing it forward along any map does not decrease the sum of α-th powers: ∑_i p_i^α ≤ ∑_k (∑_{i : g i = k} p_i)^α.
theorem sum_rpow_le_sum_fiber_rpow {ι κ : Type*} [Fintype ι] [Fintype κ] [DecidableEq κ]
(p : ι → ℝ) (hp : ∀ i, 0 ≤ p i) (g : ι → κ) {α : ℝ} (hα : 1 ≤ α) :
∑ i : ι, p i ^ α ≤
∑ k : κ, (∑ i ∈ Finset.univ.filter (fun i => g i = k), p i) ^ αsymmetric_qubit_fork_diagonal_halfIn LeanQuantum Mechanics
At parameter a = 1/2, qubit_state_0 (1/2) t is 1/2 • 1, and both forks become fully diagonal: the XY fork is diagonal with entries (p/2) for the first index 0 and (1−p)·(1−q or q) for first index 1, and the XYZ fork is diagonal with entries p/4 or (1−p)·s1_j·s1_k.
theorem symmetric_qubit_fork_diagonal_half (p q t : ℝ) :
qubit_state_0 (1 / 2) t = (1 / 2 : ℝ) • (1 : Matrix (Fin 2) (Fin 2) ℝ) ∧
symmetric_qubit_fork_xy p (1 / 2) q t =
Matrix.diagonal (fun ij : Fin 2 × Fin 2 => if ij.1 = 0 then p * (1 / 2) else (1 - p) * (if ij.2 = 0 then 1 - q else q)) ∧
symmetric_qubit_fork_xyz p (1 / 2) q t =
Matrix.diagonal (fun ijk : Fin 2 × (Fin 2 × Fin 2) =>
if ijk.1 = 0 then p * (1 / 4) else (1 - p) * (if ijk.2.1 = 0 then 1 - q else q) * (if ijk.2.2 = 0 then 1 - q else q))symmetric_qubit_fork_posSemidef_traceIn LeanQuantum Mechanics
Both symmetric qubit forks are density matrices: positive semidefinite with trace 1, for parameters p, a, q in [0,1] and arbitrary real t.
theorem symmetric_qubit_fork_posSemidef_trace (p a q t : ℝ) (hp : 0 ≤ p) (hp1 : p ≤ 1)
(ha0 : 0 ≤ a) (ha1 : a ≤ 1) (hq0 : 0 ≤ q) (hq1 : q ≤ 1) :
(symmetric_qubit_fork_xy p a q t).PosSemidef ∧ (symmetric_qubit_fork_xy p a q t).trace = 1 ∧
(symmetric_qubit_fork_xyz p a q t).PosSemidef ∧ (symmetric_qubit_fork_xyz p a q t).trace = 1tendsto_deficit_three_halves_of_linear_errorIn LeanQuantum Mechanics
If a sequence f(n) is asymptotically bounded between L * n^(3/2) - C₁ * n and L * n^(3/2) + C₂ * n, then f(n) / n^(3/2) tends to L.
theorem tendsto_deficit_three_halves_of_linear_error
(f : ℕ → ℝ) (L C₁ C₂ : ℝ)
(h_lower : ∀ᶠ (n : ℕ) in Filter.atTop, L * (n : ℝ) ^ (3 / 2 : ℝ) - C₁ * (n : ℝ) ≤ f n)
(h_upper : ∀ᶠ (n : ℕ) in Filter.atTop, f n ≤ L * (n : ℝ) ^ (3 / 2 : ℝ) + C₂ * (n : ℝ)) :
Filter.Tendsto (fun n : ℕ => f n / (n : ℝ) ^ (3 / 2 : ℝ)) Filter.atTop (nhds L)thermomajorization_diff_le_oneIn LeanQuantum Mechanics
For any dimension n, probability vectors x and y in the standard simplex, and any rank j, thermomajorization_diff x y j is at most 1.
lemma thermomajorization_diff_le_one {n : ℕ} (x y : Fin n → ℝ)
(hx : x ∈ stdSimplex ℝ (Fin n)) (hy : y ∈ stdSimplex ℝ (Fin n)) (j : ℕ) :
thermomajorization_diff x y j ≤ 1thermomajorization_diff_univIn LeanQuantum Mechanics
For any dimension n and probability vectors x and y in the standard simplex, the thermomajorization difference thermomajorization_diff x y n equals 0.
lemma thermomajorization_diff_univ {n : ℕ} {x y : Fin n → ℝ}
(hx : x ∈ stdSimplex ℝ (Fin n)) (hy : y ∈ stdSimplex ℝ (Fin n)) :
thermomajorization_diff x y n = 0thermomajorization_fixed_budget_scalingIn LeanQuantum Mechanics
For each fixed integer budget m ≥ 1, the deficit 1 - thermomajorization_minimax_error n m in optimal nonadaptive binary probe testing of thermomajorization at uniform Gibbs weights is asymptotically equivalent along Filter.atTop to 4^(m/(2m+1)) * n^(-1/(2m+1)).
theorem thermomajorization_fixed_budget_scaling :
∀ (m : ℕ) (_ : 1 ≤ m),
Asymptotics.IsEquivalent Filter.atTop
(fun (n : ℕ) => (1 : ℝ) - thermomajorization_minimax_error n m)
(fun (n : ℕ) => 4 ^ ((m : ℝ) / (2 * (m : ℝ) + 1)) * (n : ℝ) ^ (- (1 : ℝ) / (2 * (m : ℝ) + 1)))thermomajorization_log_budget_scalingIn LeanQuantum Mechanics
For each fixed c > 0, the minimax missed error under a logarithmic probe budget ⌊c * Real.log n⌋₊ converges along Filter.atTop to Real.tanh (1 / (4 * c)).
theorem thermomajorization_log_budget_scaling :
∀ (c : ℝ) (_ : 0 < c),
Filter.Tendsto
(fun (n : ℕ) => thermomajorization_minimax_error n ⌊c * Real.log (n : ℝ)⌋₊)
Filter.atTop
(nhds (Real.tanh (1 / (4 * c))))thermomajorization_probe_error_monoIn LeanQuantum Mechanics
For any dimension n, probe sets F₁ ⊆ F₂, and vectors x and y, thermomajorization_probe_error n F₁ x y ≤ thermomajorization_probe_error n F₂ x y.
lemma thermomajorization_probe_error_mono (n : ℕ) {F₁ F₂ : Finset ℕ} (hF : F₁ ⊆ F₂) (x y : Fin n → ℝ) :
thermomajorization_probe_error n F₁ x y ≤ thermomajorization_probe_error n F₂ x ythermomajorization_probe_error_nonnegIn LeanQuantum Mechanics
For any dimension n, probe set F, and vectors x and y, the detected conversion error thermomajorization_probe_error n F x y is nonnegative.
lemma thermomajorization_probe_error_nonneg (n : ℕ) (F : Finset ℕ) (x y : Fin n → ℝ) :
0 ≤ thermomajorization_probe_error n F x ytree_branch_parts_exists_degree_twoIn LeanQuantum Mechanics
In a tree, the two components of T - v at a degree-two vertex v, together with {v}, partition the vertex set; each component is closed except for the edge to v, and only its attachment vertex is adjacent to v.
theorem tree_branch_parts_exists_degree_two
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree)
{v u w : V} (hdeg : T.degree v = 2) (hu : T.Adj v u) (hw : T.Adj v w) (huw : u ≠ w) :
∃ U W : Finset V,
u ∈ U ∧ w ∈ W ∧ v ∉ U ∧ v ∉ W ∧ Disjoint U W ∧
(∀ x ∈ U, ∀ y : V, T.Adj x y → y ∈ U ∨ y = v) ∧
(∀ x ∈ U, T.Adj x v → x = u) ∧
(∀ x ∈ W, ∀ y : V, T.Adj x y → y ∈ W ∨ y = v) ∧
(∀ x ∈ W, T.Adj x v → x = w) ∧
U ∪ W ∪ {v} = Finset.univtree_branch_parts_exists_high_degreeIn LeanQuantum Mechanics
In a tree, at a vertex v of degree at least three, two of the components of T - v satisfy the same closure properties (closed except for the edge to v, unique attachment vertex), and there is a further neighbour of v outside both of them.
theorem tree_branch_parts_exists_high_degree
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree)
{v u w : V} (hdeg : 3 ≤ T.degree v) (hu : T.Adj v u) (hw : T.Adj v w) (huw : u ≠ w) :
∃ U W : Finset V,
u ∈ U ∧ w ∈ W ∧ v ∉ U ∧ v ∉ W ∧ Disjoint U W ∧
(∀ x ∈ U, ∀ y : V, T.Adj x y → y ∈ U ∨ y = v) ∧
(∀ x ∈ U, T.Adj x v → x = u) ∧
(∀ x ∈ W, ∀ y : V, T.Adj x y → y ∈ W ∨ y = v) ∧
(∀ x ∈ W, T.Adj x v → x = w) ∧
(∃ z : V, z ∉ U ∪ W ∪ {v} ∧ T.Adj v z)tree_degree_le_two_tripartite_info_nonposIn LeanQuantum Mechanics
For a finite tree T in which every vertex has degree at most 2, and every four-partition A,B,C,D of its vertices, the tripartite information of T at A,B,C,D is at most 0.
theorem tree_degree_le_two_tripartite_info_nonpos {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree)
(hdeg : ∀ v : V, T.degree v ≤ 2)
(A B C D : Finset V) (hpart : is_four_partition A B C D) :
tree_graph_state_tripartite_info T A B C D ≤ 0tree_degree_sq_sum_pathIn LeanQuantum Mechanics
For n ≥ 3, the degree-square sum of the path graph P_n on Fin n equals 4n-6.
theorem tree_degree_sq_sum_path (n : ℕ) (hn : 3 ≤ n) : tree_degree_sq_sum (SimpleGraph.pathGraph n) = 4*(n:ℤ)-6
tree_degree_sq_sum_starIn LeanQuantum Mechanics
For n ≥ 1, the degree-square sum of the star graph S_n (starGraph 0 on Fin n) equals n(n-1).
theorem tree_degree_sq_sum_star (n : ℕ) [NeZero n] : tree_degree_sq_sum (SimpleGraph.starGraph (0:Fin n)) = (n:ℤ)*((n:ℤ)-1)
tree_from_claw_tripartite_info_posIn LeanQuantum Mechanics
For every finite tree T with decidable equality and decidable adjacency, and every finite subset s : Finset V that induces a claw in T, there exists a four-partition A, B, C, D : Finset V satisfying is_four_partition A B C D such that tree_graph_state_tripartite_info T A B C D ≥ 1.
theorem tree_from_claw_tripartite_info_pos
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree)
(s : Finset V) (hs : is_induced_claw T s) :
∃ A B C D : Finset V, is_four_partition A B C D ∧
1 ≤ tree_graph_state_tripartite_info T A B C Dtree_graph_state_tripartite_info_exists_eq_max_claw_packingIn LeanQuantum Mechanics
For every finite tree T with decidable equality and decidable adjacency, there exists a four-partition A, B, C, D : Finset V satisfying is_four_partition A B C D such that tree_graph_state_tripartite_info T A B C D = max_claw_packing T.
theorem tree_graph_state_tripartite_info_exists_eq_max_claw_packing
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) :
∃ A B C D : Finset V, is_four_partition A B C D ∧
tree_graph_state_tripartite_info T A B C D = (max_claw_packing T : ℤ)tree_graph_state_tripartite_info_induction_stepIn LeanQuantum Mechanics
For any finite tree T with max_claw_packing T ≥ 1 and four-partition A, B, C, D, there exists a tree T' with max_claw_packing T' < max_claw_packing T and a four-partition A', B', C', D' such that I_3(T) ≤ I_3(T') + 1.
universe u in
theorem tree_graph_state_tripartite_info_induction_step
{V : Type u} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree)
(A B C D : Finset V) (hpart : is_four_partition A B C D)
(hclaw : 1 ≤ max_claw_packing T) :
∃ (W : Type u) (_ : Fintype W) (_ : DecidableEq W)
(T' : SimpleGraph W) (_ : DecidableRel T'.Adj) (_ : T'.IsTree)
(A' B' C' D' : Finset W) (_ : is_four_partition A' B' C' D'),
max_claw_packing T' < max_claw_packing T ∧
tree_graph_state_tripartite_info T A B C D ≤
tree_graph_state_tripartite_info T' A' B' C' D' + 1tree_graph_state_tripartite_info_isoIn LeanQuantum Mechanics
The tripartite information is invariant under graph isomorphism: if e : G ≃g H is an isomorphism of finite simple graphs, then for every four-partition A,B,C,D of the vertices of G the images of A,B,C,D under e are again a four-partition, and the tripartite information of G at A,B,C,D equals that of H at the images.
theorem tree_graph_state_tripartite_info_iso {V W : Type*} [Fintype V] [Fintype W]
[DecidableEq V] [DecidableEq W]
(G : SimpleGraph V) [DecidableRel G.Adj] (H : SimpleGraph W) [DecidableRel H.Adj]
(e : G ≃g H) (A B C D : Finset V) (hpart : is_four_partition A B C D) :
is_four_partition (A.map e.toEquiv.toEmbedding) (B.map e.toEquiv.toEmbedding)
(C.map e.toEquiv.toEmbedding) (D.map e.toEquiv.toEmbedding) ∧
tree_graph_state_tripartite_info G A B C D =
tree_graph_state_tripartite_info H (A.map e.toEquiv.toEmbedding) (B.map e.toEquiv.toEmbedding)
(C.map e.toEquiv.toEmbedding) (D.map e.toEquiv.toEmbedding)tree_graph_state_tripartite_info_le_max_claw_packingIn LeanQuantum Mechanics
For every finite tree T with decidable equality and decidable adjacency, and every four-partition A, B, C, D : Finset V (satisfying is_four_partition A B C D), the tripartite information tree_graph_state_tripartite_info T A B C D is at most max_claw_packing T.
theorem tree_graph_state_tripartite_info_le_max_claw_packing
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree)
(A B C D : Finset V) (hpart : is_four_partition A B C D) :
tree_graph_state_tripartite_info T A B C D ≤ (max_claw_packing T : ℤ)tree_graph_state_tripartite_info_le_simple_graph_maxIn LeanQuantum Mechanics
For any finite simple graph G and four-coloring c, the tripartite information of the partition induced by c is at most simple_graph_max_tripartite_info G.
theorem tree_graph_state_tripartite_info_le_simple_graph_max
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (c : V → Fin 4) :
tree_graph_state_tripartite_info G
(Finset.univ.filter (fun v => c v = 0))
(Finset.univ.filter (fun v => c v = 1))
(Finset.univ.filter (fun v => c v = 2))
(Finset.univ.filter (fun v => c v = 3)) ≤
simple_graph_max_tripartite_info Gtree_katz_ising_F_pathIn LeanQuantum Mechanics
For n ≥ 3, the invariant F(P_n) of the path graph equals 6440 - 3120n.
theorem tree_katz_ising_F_path (n : ℕ) (hn : 3 ≤ n) : tree_katz_ising_F (SimpleGraph.pathGraph n) = 6440 - 3120*(n:ℤ)
tree_katz_ising_F_starIn LeanQuantum Mechanics
For n ≥ 1, the invariant F(S_n) of the star graph (starGraph 0 on Fin n) equals 140n^3 - 1480n^2 + 2640n - 1300.
theorem tree_katz_ising_F_star (n : ℕ) [NeZero n] : tree_katz_ising_F (SimpleGraph.starGraph (0:Fin n)) = 140*(n:ℤ)^3 - 1480*(n:ℤ)^2 + 2640*(n:ℤ) - 1300
tree_max_claw_packing_delete_edges_leIn LeanQuantum Mechanics
For every finite tree T and edge set s, the maximum claw packing number of T.deleteEdges s is at most that of T.
theorem tree_max_claw_packing_delete_edges_le {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) (hT : T.IsTree) (s : Set (Sym2 V)) :
max_claw_packing (T.deleteEdges s) ≤ max_claw_packing Ttree_secant_functional_eqIn LeanQuantum Mechanics
For every tree T on n ≥ 4 vertices, N(T)=N(P_n) holds (with N as above) if and only if T is isomorphic to the path P_n or to the star S_n.
theorem tree_secant_functional_eq (n : ℕ) [NeZero n] (hn : 4 ≤ n) (T : SimpleGraph (Fin n)) [DecidableRel T.Adj] (hT : T.IsTree) :
((n - 2 : ℤ) * tree_katz_ising_F T - 20 * (7 * (n:ℤ)^2 - 53 * (n:ℤ) + 129) * tree_degree_sq_sum T = (n - 2 : ℤ) * tree_katz_ising_F (SimpleGraph.pathGraph n) - 20 * (7 * (n:ℤ)^2 - 53 * (n:ℤ) + 129) * tree_degree_sq_sum (SimpleGraph.pathGraph n))
↔ Nonempty (T ≃g SimpleGraph.pathGraph n) ∨ Nonempty (T ≃g SimpleGraph.starGraph (0:Fin n))tree_secant_functional_ineqIn LeanQuantum Mechanics
For every tree T on n ≥ 4 vertices, N(T) ≤ N(P_n) where N(G)=(n-2)F(G)-20(7n^2-53n+129)D(G); i.e. the sharp degree-invariant tree inequality tight at the path (and star).
theorem tree_secant_functional_ineq (n : ℕ) [NeZero n] (hn : 4 ≤ n) (T : SimpleGraph (Fin n)) [DecidableRel T.Adj] (hT : T.IsTree) :
(n - 2 : ℤ) * tree_katz_ising_F T - 20 * (7 * (n:ℤ)^2 - 53 * (n:ℤ) + 129) * tree_degree_sq_sum T
≤ (n - 2 : ℤ) * tree_katz_ising_F (SimpleGraph.pathGraph n) - 20 * (7 * (n:ℤ)^2 - 53 * (n:ℤ) + 129) * tree_degree_sq_sum (SimpleGraph.pathGraph n)tree_secant_gap_identityIn LeanQuantum Mechanics
For n ≥ 4 and any graph T on Fin n, the difference between the two sides of the target's secant inequality, (F(T)-F(P))·(D(S)-D(P)) - (F(S)-F(P))·(D(T)-D(P)), equals (n-3) times N(T)-N(P), where N(G)=(n-2)F(G)-20(7n^2-53n+129)D(G). So the target inequality is equivalent (n≥4) to N(T)≤N(P), and its equality to N(T)=N(P).
theorem tree_secant_gap_identity (n : ℕ) [NeZero n] (hn : 4 ≤ n)
(T : SimpleGraph (Fin n)) [DecidableRel T.Adj] :
(tree_katz_ising_F T - tree_katz_ising_F (SimpleGraph.pathGraph n)) *
(tree_degree_sq_sum (SimpleGraph.starGraph (0:Fin n)) - tree_degree_sq_sum (SimpleGraph.pathGraph n)) -
(tree_katz_ising_F (SimpleGraph.starGraph (0:Fin n)) - tree_katz_ising_F (SimpleGraph.pathGraph n)) *
(tree_degree_sq_sum T - tree_degree_sq_sum (SimpleGraph.pathGraph n)) =
(n - 3 : ℤ) *
((n - 2 : ℤ) * (tree_katz_ising_F T - tree_katz_ising_F (SimpleGraph.pathGraph n)) -
20 * (7 * (n:ℤ)^2 - 53 * (n:ℤ) + 129) * (tree_degree_sq_sum T - tree_degree_sq_sum (SimpleGraph.pathGraph n)))tree_submatrix_card_addChar_kerIn LeanQuantum Mechanics
The number of additive characters from the kernel tree_submatrix_ker T S into ℝ is 2^(tree_submatrix_dim T S).
theorem tree_submatrix_card_addChar_ker
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (S : Finset V) :
Fintype.card (AddChar (tree_submatrix_ker T S) ℝ) = 2 ^ (tree_submatrix_dim T S)triangle_free_neighbor_set_independentIn LeanQuantum Mechanics
In a triangle-free simple graph, the open neighbor set of any vertex is an independent set.
theorem triangle_free_neighbor_set_independent {V : Type*} [DecidableEq V]
(G : SimpleGraph V) (hG : G.CliqueFree 3) (v : V) :
∀ u w : V, u ∈ G.neighborSet v → w ∈ G.neighborSet v → ¬G.Adj u wtwo_qubit_bell_fidelity_ge_candidateIn LeanQuantum Mechanics
For every real number ε with 0 ≤ ε and ε ≤ Real.log 2, two_qubit_candidate_fidelity_bound ε ≤ two_qubit_min_bell_fidelity ε.
theorem two_qubit_bell_fidelity_ge_candidate (ε : ℝ) (hε0 : 0 ≤ ε) (hε1 : ε ≤ Real.log 2) :
two_qubit_candidate_fidelity_bound ε ≤ two_qubit_min_bell_fidelity εtwo_qubit_candidate_state_fully_entangled_fractionIn LeanQuantum Mechanics
For all real numbers p and q satisfying 0 ≤ p ≤ 1 and 0 ≤ q ≤ 1, the fully entangled fraction of candidate_density_matrix p q equals max (p * (1 + 2 * Real.sqrt (q * (1 - q))) / 2) ((1 - p) / 2).
theorem two_qubit_candidate_state_fully_entangled_fraction (p q : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1)
(hq0 : 0 ≤ q) (hq1 : q ≤ 1) :
fully_entangled_fraction (candidate_density_matrix p q) =
max (p * (1 + 2 * Real.sqrt (q * (1 - q))) / 2) ((1 - p) / 2)two_qubit_candidate_state_trace_left_entropyIn LeanQuantum Mechanics
For all real numbers p and q satisfying 0 ≤ p ≤ 1 and 0 ≤ q ≤ 1, the von Neumann entropy of the partial trace of candidate_density_matrix p q is equal to binary_entropy_nats (p * q).
theorem two_qubit_candidate_state_trace_left_entropy (p q : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1)
(hq0 : 0 ≤ q) (hq1 : q ≤ 1) :
von_neumann_entropy (Matrix.traceLeft (candidate_density_matrix p q)) = binary_entropy_nats (p * q)two_qubit_candidate_state_von_neumann_entropyIn LeanQuantum Mechanics
For all real numbers p and q satisfying 0 ≤ p ≤ 1 and 0 ≤ q ≤ 1, the von Neumann entropy of candidate_density_matrix p q is equal to binary_entropy_nats p.
theorem two_qubit_candidate_state_von_neumann_entropy (p q : ℝ) (hp0 : 0 ≤ p) (hp1 : p ≤ 1)
(hq0 : 0 ≤ q) (hq1 : q ≤ 1) :
von_neumann_entropy (candidate_density_matrix p q) = binary_entropy_nats pxz_matrix_a_applyIn LeanQuantum Mechanics
For all s t : Fin L → Fin 2, the (s,t) entry of xz_matrix_a L is 2^{-L} times the product over sites j of the xz_pauli matrix entry at (s j, t j) for the label determined by whether s and t agree at j and at the cyclic successor of j.
theorem xz_matrix_a_apply (L : ℕ) (s t : Fin L → Fin 2) : (xz_matrix_a L) s t = (1 / (2 : ℂ) ^ L) * ∏ j : Fin L, (xz_pauli (if s j = t j then 1 else 0) (if s (xz_cyclic_succ j) = t (xz_cyclic_succ j) then 1 else 0)).toMatrix (s j) (t j)
xz_purity_eq_trace_transfer_matrix_powIn LeanQuantum Mechanics
For every natural number L ≥ 1, the purity Matrix.trace ((xz_rho L) * (xz_rho L)) equals (1 / (16 : ℂ) ^ L) * Matrix.trace (xz_transfer_matrix ^ L).
theorem xz_purity_eq_trace_transfer_matrix_pow (L : ℕ) (hL : 1 ≤ L) : Matrix.trace ((xz_rho L) * (xz_rho L)) = (1 / (16 : ℂ) ^ L) * Matrix.trace (xz_transfer_matrix ^ L)
xz_replica_transfer_matrix_one_trace_powIn LeanQuantum Mechanics
For every 1 ≤ L, the trace of the L-th power of the q = 1 replica transfer matrix is 4^L.
theorem xz_replica_transfer_matrix_one_trace_pow (L : ℕ) (hL : 1 ≤ L) : Matrix.trace ((xz_replica_transfer_matrix 1) ^ L) = (4 : ℂ) ^ L
xz_replica_transfer_trace_doublingIn LeanQuantum Mechanics
For 1 ≤ q and odd L, the trace of the (2*L)-th power of the q-replica transfer matrix equals the square of the trace of its L-th power.
theorem xz_replica_transfer_trace_doubling (q L : ℕ) (hq : 1 ≤ q) (hodd : Odd L) : Matrix.trace ((xz_replica_transfer_matrix q) ^ (2 * L)) = (Matrix.trace ((xz_replica_transfer_matrix q) ^ L)) ^ 2
xz_scar_reduced_spectrum_doubling_power_sumsIn LeanQuantum Mechanics
For odd L ≥ 1 and every q ≥ 1: tr((xz_rho (2*L))^q) = (tr((xz_rho L)^q))^2. The full moment tower, not just the purity q = 2.
theorem xz_scar_reduced_spectrum_doubling_power_sums (L q : ℕ) (hL : 1 ≤ L) (hq : 1 ≤ q) (hodd : Odd L) : Matrix.trace ((xz_rho (2 * L)) ^ q) = (Matrix.trace ((xz_rho L) ^ q)) ^ 2
xz_trace_rho_pow_eq_replica_transferIn LeanQuantum Mechanics
For 1 ≤ L and 1 ≤ q: tr((xz_rho L)^q) = 2^(-(2qL)) * tr((xz_replica_transfer_matrix q)^L).
theorem xz_trace_rho_pow_eq_replica_transfer (L q : ℕ) (hL : 1 ≤ L) (hq : 1 ≤ q) : Matrix.trace ((xz_rho L) ^ q) = (1 / (2 : ℂ) ^ (2 * q * L)) * Matrix.trace ((xz_replica_transfer_matrix q) ^ L)
xz_transfer_matrix_trace_doubling_of_oddIn LeanQuantum Mechanics
For every odd natural number L, the trace of the (2 * L)-th power of the 16x16 Pauli transfer matrix xz_transfer_matrix equals the square of the trace of its L-th power.
theorem xz_transfer_matrix_trace_doubling_of_odd (L : ℕ) (hodd : Odd L) : Matrix.trace (xz_transfer_matrix ^ (2 * L)) = (Matrix.trace (xz_transfer_matrix ^ L)) ^ 2
cubic_card_edgesIn LeanStatistical Mechanics & Thermodynamics
In any finite 3-regular simple graph, twice the number of edges equals three times the number of vertices.
theorem cubic_card_edges {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hreg : G.IsRegularOfDegree 3) :
2 * (G.edgeFinset.card : ℝ) = 3 * (Fintype.card V : ℝ)cubic_divergence_of_signs_sq_sum_geIn LeanStatistical Mechanics & Thermodynamics
For any assignment of ±1 signs to the edges of an oriented 3-regular simple graph, the vertex divergence at each vertex is an odd integer (hence has absolute value at least 1), so the sum of squared vertex divergences is at least |V|.
theorem cubic_divergence_of_signs_sq_sum_ge
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(o : SimpleGraphOrientation G)
(s : G.edgeFinset → ℝ)
(hs : ∀ e, s e = 1 ∨ s e = -1) :
(∑ v : V, (∑ e, ((if (o.dir e).1 = v then s e else 0) - if (o.dir e).2 = v then s e else 0))^2) ≥
(Fintype.card V : ℝ)cubic_edge_entropy_asymptotic_oneIn LeanStatistical Mechanics & Thermodynamics
The edge entropy phi(t)=|t|log((1+|t|)/(1-|t|)) satisfies phi(t)/log(1/(1-t)) -> 1 as t -> 1 from below.
theorem cubic_edge_entropy_asymptotic_one :
Filter.Tendsto
(fun t : ℝ => cubic_edge_entropy t / Real.log (1 / (1 - t)))
(nhdsWithin (1:ℝ) (Set.Iio (1:ℝ))) (nhds (1:ℝ))cubic_edge_entropy_scaled_vanishesIn LeanStatistical Mechanics & Thermodynamics
The half-edge entropy term phi(t/2)/log(1/(1-t)) -> 0 as t -> 1 from below (phi(1/2) is finite while the log diverges).
theorem cubic_edge_entropy_scaled_vanishes :
Filter.Tendsto
(fun t : ℝ => cubic_edge_entropy (t/2) / Real.log (1 / (1 - t)))
(nhdsWithin (1:ℝ) (Set.Iio (1:ℝ))) (nhds (0:ℝ))cubic_gradient_sq_sum_leIn LeanStatistical Mechanics & Thermodynamics
For any potential phi on the vertices of a finite 3-regular simple graph with orientation o, the sum of (phi(u) - phi(v))^2 over all edges is at most 6 times the sum of phi(v)^2 over all vertices.
theorem cubic_gradient_sq_sum_le
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(o : SimpleGraphOrientation G)
(phi : V → ℝ) :
(∑ e : G.edgeFinset, (phi (o.dir e).1 - phi (o.dir e).2)^2) ≤
6 * ∑ v : V, (phi v)^2cubic_half_integral_current_existsIn LeanStatistical Mechanics & Thermodynamics
Every finite bridgeless cubic simple graph admits a half-integral stationary current whose absolute edge currents sum to the number of vertices.
theorem cubic_half_integral_current_exists
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(hbridge : ∀ e ∈ G.edgeSet, ¬ G.IsBridge e)
(o : SimpleGraphOrientation G) :
∃ j : G.edgeFinset → ℝ,
is_stationary_current G o j ∧
is_half_integral_current G j ∧
∑ e : G.edgeFinset, |j e| = Fintype.card Vcubic_half_integral_cycle_bipartite_coloringIn LeanStatistical Mechanics & Thermodynamics
For any finite simple cubic graph G with orientation o and any half-integral stationary current j on G.edgeFinset with sum of |j(e)| equal to the number of vertices n, there exists a 2-coloring of the vertices such that every edge e with |j(e)| = 1/2 has different colors on its endpoints.
theorem cubic_half_integral_cycle_bipartite_coloring
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(o : SimpleGraphOrientation G)
(j : G.edgeFinset → ℝ)
(hj_stat : is_stationary_current G o j)
(hj_half : is_half_integral_current G j)
(hj_sum : ∑ e : G.edgeFinset, |j e| = Fintype.card V) :
∃ c : V → Bool, ∀ e : G.edgeFinset, |j e| = 1/2 →
Sym2.lift ⟨fun u v => c u == c v, fun _ _ => by dsimp; rw [Bool.beq_comm]⟩ e.1 = falsecubic_half_integral_saturated_edges_ge_bipartite_frustration_boundIn LeanStatistical Mechanics & Thermodynamics
For any finite bridgeless cubic simple graph G with orientation o, the minimal number of saturated edges b(G) among half-integral stationary currents of total capacity n is at least ceil((n + f(G))/2).
theorem cubic_half_integral_saturated_edges_ge_bipartite_frustration_bound
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(hbridge : ∀ e ∈ G.edgeSet, ¬ G.IsBridge e)
(o : SimpleGraphOrientation G) :
⌈((Fintype.card V : ℝ) + (bipartite_frustration G : ℝ)) / 2⌉₊ ≤
cubic_half_integral_saturated_edges_min G ocubic_half_integral_saturated_edges_min_nullIn LeanStatistical Mechanics & Thermodynamics
For the empty graph (card V = 0) the invariant b(G) equals 0.
theorem cubic_half_integral_saturated_edges_min_null
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(o : SimpleGraphOrientation G)
(h : Fintype.card V = 0) :
cubic_half_integral_saturated_edges_min G o = 0cubic_half_integral_vertex_abs_sumIn LeanStatistical Mechanics & Thermodynamics
For a half-integral stationary current with total |j| = n on a cubic graph, at every vertex the sum of |j_e| over the three incident edges equals exactly 2.
theorem cubic_half_integral_vertex_abs_sum
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(o : SimpleGraphOrientation G)
(j : ↥G.edgeFinset → ℝ)
(hj_stat : is_stationary_current G o j)
(hj_half : is_half_integral_current G j)
(hj_sum : ∑ e : G.edgeFinset, |j e| = (Fintype.card V : ℝ))
(v : V) :
(∑ e : G.edgeFinset, if (o.dir e).1 = v then |j e| else 0) +
(∑ e : G.edgeFinset, if (o.dir e).2 = v then |j e| else 0) = 2cubic_signing_potential_dissipation_energyIn LeanStatistical Mechanics & Thermodynamics
Combinatorial core of the sharp inequality: for every signing s of the edges of a cubic graph with |s_e| ≤ 1 there is a potential u : V → ℝ whose squared deviation from matching s on the edges is at most 4n/3 − f/6, where f is the bipartite frustration index of G.
theorem cubic_signing_potential_dissipation_energy
{V : Type*} [Fintype V] [Nonempty V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(o : SimpleGraphOrientation G)
(s : G.edgeFinset → ℝ) (hs : ∀ e, |s e| ≤ 1) :
∃ u : V → ℝ, ∑ e : G.edgeFinset,
(u (o.dir e).1 - u (o.dir e).2 - s e)^2 ≤
(4 * (Fintype.card V : ℝ) / 3 - (bipartite_frustration G : ℝ) / 6)cubic_stationary_current_gradient_orthogonalityIn LeanStatistical Mechanics & Thermodynamics
A stationary current is orthogonal to every gradient: for any potential u : V → ℝ, the sum over the edges of j_e times the oriented difference of u vanishes.
theorem cubic_stationary_current_gradient_orthogonality
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(o : SimpleGraphOrientation G)
(j : G.edgeFinset → ℝ)
(hj : is_stationary_current G o j)
(u : V → ℝ) :
∑ e : G.edgeFinset, j e * (u (o.dir e).1 - u (o.dir e).2) = 0cubic_stationary_current_naive_dissipation_boundIn LeanStatistical Mechanics & Thermodynamics
For any nonempty finite simple cubic graph G on n vertices, any orientation o of G, and any stationary current j on G, the squared sum of |j_e| over all edges e is at most (4n/3) times the sum of j_e^2 over all edges e.
theorem cubic_stationary_current_naive_dissipation_bound
{V : Type*} [Fintype V] [Nonempty V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(o : SimpleGraphOrientation G)
(j : G.edgeFinset → ℝ)
(hj : is_stationary_current G o j) :
(∑ e : G.edgeFinset, |j e|)^2 ≤
(4 * (Fintype.card V : ℝ) / 3) * ∑ e : G.edgeFinset, (j e)^2cubic_stationary_current_reduces_to_signing_potentialIn LeanStatistical Mechanics & Thermodynamics
If every signing s with |s_e| ≤ 1 admits a potential u with ∑_e (u_{e.1} - u_{e.2} - s_e)^2 ≤ 4n/3 - f/6, then the sharp dissipation bound holds for every stationary current: (∑_e |j_e|)^2 ≤ (4n/3 - f/6) · ∑_e j_e^2.
theorem cubic_stationary_current_reduces_to_signing_potential
{V : Type*} [Fintype V] [Nonempty V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(o : SimpleGraphOrientation G)
(hsign : ∀ (s : G.edgeFinset → ℝ), (∀ e, |s e| ≤ 1) →
∃ u : V → ℝ, ∑ e : G.edgeFinset,
(u (o.dir e).1 - u (o.dir e).2 - s e)^2 ≤
(4 * (Fintype.card V : ℝ) / 3 - (bipartite_frustration G : ℝ) / 6)) :
∀ (j : G.edgeFinset → ℝ), is_stationary_current G o j →
(∑ e : G.edgeFinset, |j e|)^2 ≤
(4 * (Fintype.card V : ℝ) / 3 - (bipartite_frustration G : ℝ) / 6) *
∑ e : G.edgeFinset, (j e)^2cubic_stationary_entropy_ratio_lower_boundIn LeanStatistical Mechanics & Thermodynamics
Lower limit bound: eventually (as J -> n from below), the infimal stationary entropy production S_G(J) is at least (b(G)-eps)*log(1/(1-J/n)). Equivalently liminf of the ratio is >= b(G).
theorem cubic_stationary_entropy_ratio_lower_bound
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(hbridge : ∀ e ∈ G.edgeSet, ¬ G.IsBridge e)
(o : SimpleGraphOrientation G) :
∀ ε : ℝ, 0 < ε → ∀ᶠ J : ℝ in
nhdsWithin (Fintype.card V : ℝ) (Set.Iio (Fintype.card V : ℝ)),
((cubic_half_integral_saturated_edges_min G o : ℝ) - ε) *
Real.log (1 / (1 - J / (Fintype.card V : ℝ))) ≤
cubic_stationary_entropy_inf G o Jcubic_stationary_entropy_ratio_tendsto_half_integral_saturatedIn LeanStatistical Mechanics & Thermodynamics
For any finite bridgeless cubic simple graph G on n vertices with orientation o, the ratio of the infimal stationary entropy production S_G(J) to log(1/(1-J/n)) tends to b(G) as J approaches n from below within the interval (-infinity, n).
theorem cubic_stationary_entropy_ratio_tendsto_half_integral_saturated
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(hbridge : ∀ e ∈ G.edgeSet, ¬ G.IsBridge e)
(o : SimpleGraphOrientation G) :
Filter.Tendsto
(fun J : ℝ => cubic_stationary_entropy_inf G o J /
Real.log (1 / (1 - J / (Fintype.card V : ℝ))))
(nhdsWithin (Fintype.card V : ℝ) (Set.Iio (Fintype.card V : ℝ)))
(nhds (cubic_half_integral_saturated_edges_min G o : ℝ))cubic_stationary_entropy_ratio_upper_boundIn LeanStatistical Mechanics & Thermodynamics
Upper limit bound: eventually (as J -> n from below), the infimal stationary entropy production S_G(J) is at most (b(G)+eps)*log(1/(1-J/n)).
theorem cubic_stationary_entropy_ratio_upper_bound
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3)
(hbridge : ∀ e ∈ G.edgeSet, ¬ G.IsBridge e)
(o : SimpleGraphOrientation G) :
∀ ε : ℝ, 0 < ε → ∀ᶠ J : ℝ in
nhdsWithin (Fintype.card V : ℝ) (Set.Iio (Fintype.card V : ℝ)),
cubic_stationary_entropy_inf G o J ≤
((cubic_half_integral_saturated_edges_min G o : ℝ) + ε) *
Real.log (1 / (1 - J / (Fintype.card V : ℝ)))energy_filter_centered_binomial_shift_correlationIn LeanStatistical Mechanics & Thermodynamics
For natural k and h, the autocorrelation at nonnegative shift h of the zero-extended centered weights is choose(4k,2k+h) divided by choose(2k,k)².
theorem energy_filter_centered_binomial_shift_correlation (k h : ℕ) :
(∑' t : ℤ, energy_filter_centered_binomial_weight k t *
energy_filter_centered_binomial_weight k (t + (h : ℤ))) =
(Nat.choose (4 * k) (2 * k + h) : ℝ) / (Nat.choose (2 * k) k : ℝ) ^ 2energy_filter_centered_binomial_shift_l2_vanishIn LeanStatistical Mechanics & Thermodynamics
For any fixed integer h, the sum of squared differences between the centered binomial weights and their shift by h, divided by √k, tends to zero.
theorem energy_filter_centered_binomial_shift_l2_vanish (h : ℤ) :
Filter.Tendsto (fun k : ℕ =>
(∑' t : ℤ, (energy_filter_centered_binomial_weight k (t + h) -
energy_filter_centered_binomial_weight k t) ^ 2) / Real.sqrt (k : ℝ))
Filter.atTop (nhds 0)energy_filter_centered_binomial_square_mass_asymptoticIn LeanStatistical Mechanics & Thermodynamics
The sum of squared centered binomial weights divided by √k tends to √(π/2).
theorem energy_filter_centered_binomial_square_mass_asymptotic :
Filter.Tendsto (fun k : ℕ =>
(∑' t : ℤ, energy_filter_centered_binomial_weight k t ^ 2) / Real.sqrt (k : ℝ))
Filter.atTop (nhds (Real.sqrt (Real.pi / 2)))energy_filter_char_sumIn LeanStatistical Mechanics & Thermodynamics
Character sum of the two-species energies: for every t, the sum over all configurations s of exp(I * e(s) * t) equals (2 cos t)^k * (2 cos(alpha t))^k, where e(s) = sum_j (if s.1 j then 1 else -1) + alpha * sum_j (if s.2 j then 1 else -1).
theorem energy_filter_char_sum (k : ℕ) (α t : ℝ) :
let e : (Fin k → Bool) × (Fin k → Bool) → ℝ :=
fun s => (∑ j, if s.1 j then (1:ℝ) else -1) + α * ∑ j, if s.2 j then (1:ℝ) else -1;
(∑ s : (Fin k → Bool) × (Fin k → Bool),
Complex.exp (Complex.I * ((e s : ℝ) : ℂ) * (t : ℂ)))
= (((2 * Real.cos t) ^ k * (2 * Real.cos (α * t)) ^ k : ℝ) : ℂ)energy_filter_cos_abs_eq_one_iffIn LeanStatistical Mechanics & Thermodynamics
For any real x, |cos x| = 1 if and only if x = n * pi for some integer n.
theorem energy_filter_cos_abs_eq_one_iff (x : ℝ) :
|Real.cos x| = 1 ↔ ∃ n : ℤ, x = (n : ℝ) * Real.pienergy_filter_critical_gaussian_kernel_integral_fourIn LeanStatistical Mechanics & Thermodynamics
The integral of the fourth power of the critical Gaussian kernel g(x)^4 over the real line equals 4 / (pi * sqrt pi).
theorem energy_filter_critical_gaussian_kernel_integral_four :
∫ x : ℝ, (energy_filter_critical_gaussian_kernel x) ^ 4 = 4 / (Real.pi * Real.sqrt Real.pi)energy_filter_critical_gaussian_kernel_integral_sqIn LeanStatistical Mechanics & Thermodynamics
The integral of the squared critical Gaussian kernel g(x)^2 over the real line equals sqrt(2 / pi).
theorem energy_filter_critical_gaussian_kernel_integral_sq :
∫ x : ℝ, (energy_filter_critical_gaussian_kernel x) ^ 2 = Real.sqrt (2 / Real.pi)energy_filter_critical_overlap_integral_tendstoIn LeanStatistical Mechanics & Thermodynamics
As c approaches 0 from above, the scaled overlap integral D_c / c converges to sqrt(2 / pi).
theorem energy_filter_critical_overlap_integral_tendsto :
Filter.Tendsto (fun c => energy_filter_critical_overlap_integral c / c)
(nhdsWithin 0 (Set.Ioi 0))
(nhds (Real.sqrt (2 / Real.pi)))energy_filter_critical_window_integral_sq_tendstoIn LeanStatistical Mechanics & Thermodynamics
As c approaches 0 from above, the scaled numerator integral (∫ g^2 F_c^2) / c^2 converges to 4 / (pi * sqrt pi).
theorem energy_filter_critical_window_integral_sq_tendsto :
Filter.Tendsto
(fun c => (∫ x, (energy_filter_critical_gaussian_kernel x) ^ 2 *
(energy_filter_critical_window_integral c x) ^ 2) / c ^ 2)
(nhdsWithin 0 (Set.Ioi 0))
(nhds (4 / (Real.pi * Real.sqrt Real.pi)))energy_filter_crossover_linvIn LeanStatistical Mechanics & Thermodynamics
The inverse of the 3x3 matrix L with diagonal 2 and adjacent off-diagonal entries -1 is (1/4) times the matrix with rows (3,2,1), (2,4,2), (1,2,3).
theorem energy_filter_crossover_linv :
(let L : Matrix (Fin 3) (Fin 3) ℝ := !![2, -1, 0; -1, 2, -1; 0, -1, 2]
L⁻¹) = (1/4 : ℝ) • (!![3,2,1; 2,4,2; 1,2,3] : Matrix (Fin 3) (Fin 3) ℝ)energy_filter_crossover_quad_form_coerciveIn LeanStatistical Mechanics & Thermodynamics
For every v in R^3, v_1^2 + v_2^2 + v_3^2 <= 4 * (v^T L^{-1} v); hence the quadratic form is coercive and dominates the Euclidean norm.
theorem energy_filter_crossover_quad_form_coercive (v : Fin 3 → ℝ) :
(v 0)^2 + (v 1)^2 + (v 2)^2
≤ 4 * (let L : Matrix (Fin 3) (Fin 3) ℝ := !![2, -1, 0; -1, 2, -1; 0, -1, 2]
dotProduct v (Matrix.mulVec L⁻¹ v))energy_filter_crossover_quad_form_neg_middleIn LeanStatistical Mechanics & Thermodynamics
For all reals a, b, c, the quadratic form v^T L^{-1} v (L the 3x3 matrix with diagonal 2 and adjacent off-diagonals -1) evaluated at the vector (a, -b, c) equals (3/4)a^2 + b^2 + (3/4)c^2 - ab + (1/2)ac - bc.
theorem energy_filter_crossover_quad_form_neg_middle (a b c : ℝ) :
(let L : Matrix (Fin 3) (Fin 3) ℝ := !![2, -1, 0; -1, 2, -1; 0, -1, 2]
let v : Fin 3 → ℝ := ![a, -b, c]
dotProduct v (Matrix.mulVec L⁻¹ v))
= (3/4) * a^2 + b^2 + (3/4) * c^2 - a * b + (1/2) * a * c - b * cenergy_filter_crossover_quad_form_sosIn LeanStatistical Mechanics & Thermodynamics
For every v in R^3, the quadratic form v^T L^{-1} v equals ((v_1+v_2)^2 + (v_2+v_3)^2)/2 + (v_1+v_3)^2/4, an explicit sum of squares.
theorem energy_filter_crossover_quad_form_sos (v : Fin 3 → ℝ) :
(let L : Matrix (Fin 3) (Fin 3) ℝ := !![2, -1, 0; -1, 2, -1; 0, -1, 2]
dotProduct v (Matrix.mulVec L⁻¹ v))
= ((v 0 + v 1)^2 + (v 1 + v 2)^2) / 2 + (v 0 + v 2)^2 / 4energy_filter_crossover_s4_posIn LeanStatistical Mechanics & Thermodynamics
For tau > 0, coprime positive p, q and real c, the three-dimensional theta sum S_4 = sum over v in Z^3 of exp(-pi^2 q^2 (v^T L^{-1} v)/tau^2 - pi^2 c^2 q^4 (v^2 + (v_1+v_2+v_3)^2)/(8(p^2+q^2))) is strictly positive.
theorem energy_filter_crossover_s4_pos
(τ : ℝ) (hτ : 0 < τ) (p q : ℕ) (hp : 0 < p) (hq : 0 < q) (c : ℝ) :
let L : Matrix (Fin 3) (Fin 3) ℝ := !![2, -1, 0; -1, 2, -1; 0, -1, 2]
let D : ℝ := (p : ℝ)^2 + (q : ℝ)^2
let S4 : ℝ := ∑' (v : Fin 3 → ℤ),
let vR : Fin 3 → ℝ := fun i => (v i : ℝ)
let vT_Linv_v := dotProduct vR (Matrix.mulVec L⁻¹ vR)
let quad2 := dotProduct vR vR + (∑ i : Fin 3, vR i)^2
Real.exp (- (Real.pi^2 * (q:ℝ)^2 * vT_Linv_v / τ^2) -
(Real.pi^2 * c^2 * (q:ℝ)^4 * quad2 / (8 * D)))
0 < S4energy_filter_crossover_s4_summableIn LeanStatistical Mechanics & Thermodynamics
For tau > 0 and coprime positive p, q and real c, the summand v : Z^3 |-> exp(-pi^2 q^2 (v^T L^{-1} v)/tau^2 - pi^2 c^2 q^4 (v^T v + (v_1+v_2+v_3)^2)/(8(p^2+q^2))) is summable.
theorem energy_filter_crossover_s4_summable
(τ : ℝ) (hτ : 0 < τ) (p q : ℕ) (hp : 0 < p) (hq : 0 < q) (c : ℝ) :
let L : Matrix (Fin 3) (Fin 3) ℝ := !![2, -1, 0; -1, 2, -1; 0, -1, 2]
let D : ℝ := (p : ℝ)^2 + (q : ℝ)^2
Summable (fun v : Fin 3 → ℤ =>
let vR : Fin 3 → ℝ := fun i => (v i : ℝ)
let vT_Linv_v := dotProduct vR (Matrix.mulVec L⁻¹ vR)
let quad2 := dotProduct vR vR + (∑ i : Fin 3, vR i)^2
Real.exp (- (Real.pi^2 * (q:ℝ)^2 * vT_Linv_v / τ^2) -
(Real.pi^2 * c^2 * (q:ℝ)^4 * quad2 / (8 * D))))energy_filter_delta_memlp_four_thirdsIn LeanStatistical Mechanics & Thermodynamics
The Kronecker delta sequence on Z (1 at 0, 0 elsewhere) belongs to the weighted Lebesgue space l^{4/3}.
theorem energy_filter_delta_memlp_four_thirds : Memℓp (fun j : ℤ => if j = 0 then (1 : ℝ) else 0) ((4 / 3 : ENNReal))
energy_filter_delta_purity_limit_of_universalIn LeanStatistical Mechanics & Thermodynamics
If the universal lattice-purity limit holds for every nonzero l^{4/3} sequence a, then the scaled purity of the Kronecker delta filter converges to 2 / sqrt(pi).
theorem energy_filter_delta_purity_limit_of_universal
(huni : ∀ (a : ℤ → ℝ), a ≠ 0 → Memℓp a ((4 / 3 : ENNReal)) →
Filter.Tendsto
(fun k : ℕ => Real.sqrt (4 * (k : ℝ)) * energy_filter_sequence_purity a k)
Filter.atTop (nhds (energy_filter_sequence_purity_constant a))) :
let delta : ℤ → ℝ := fun j => if j = 0 then 1 else 0
Filter.Tendsto
(fun k : ℕ => Real.sqrt (4 * (k : ℝ)) * energy_filter_sequence_purity delta k)
Filter.atTop
(nhds (2 / Real.sqrt Real.pi))energy_filter_fourier_exp_orthogonalityIn LeanStatistical Mechanics & Thermodynamics
The interval integral of exp(i * n * θ) over [0, 2 pi] equals 2 pi if n = 0 and 0 otherwise.
theorem energy_filter_fourier_exp_orthogonality (n : ℤ) :
∫ θ in (0 : ℝ)..(2 * Real.pi), Complex.exp (Complex.I * (n : ℝ) * (θ : ℝ)) =
if n = 0 then (2 * Real.pi : ℂ) else 0energy_filter_fourier_integral_four_eq_s4In LeanStatistical Mechanics & Thermodynamics
For any finitely supported real sequence a on Z, the normalized L^4 integral of its Fourier symbol over [0, 2 pi] equals the fourth-moment discrete convolution sum.
theorem energy_filter_fourier_integral_four_eq_s4 (a : ℤ → ℝ) (ha_fin : Function.HasFiniteSupport a) :
(1 / (2 * Real.pi)) * ∫ θ in (0 : ℝ)..(2 * Real.pi),
‖energy_filter_fourier_symbol a θ‖ ^ (2 * (2 : ℝ)) =
∑' m : ℤ, (∑' j : ℤ, a j * a (m - j))^2energy_filter_laplace_one_dim_irrationalIn LeanStatistical Mechanics & Thermodynamics
For irrational alpha > 0 the scaled one-dimensional Gaussian integral satisfies sqrt(k) * I1(k,tau,alpha) / 16^k -> sqrt(pi/(1 + alpha^2)).
theorem energy_filter_laplace_one_dim_irrational (τ α : ℝ) (hτ : 0 < τ) (hirr : Irrational α) :
Filter.Tendsto
(fun k : ℕ => Real.sqrt (k:ℝ) * energy_filter_integral_1d k τ α / 16 ^ k)
Filter.atTop (nhds (Real.sqrt (Real.pi / (1 + α^2))))energy_filter_laplace_one_dim_rationalIn LeanStatistical Mechanics & Thermodynamics
For alpha = p/q in lowest terms, sqrt(k) * I1(k,tau,p/q)/16^k tends to sqrt(pi/(1+(p/q)^2)) times P2 = sum over m in Z of exp(-(pi m)^2/(2 tau^2 (1/q)^2)).
theorem energy_filter_laplace_one_dim_rational (τ : ℝ) (hτ : 0 < τ) (p q : ℕ) (hp : 0 < p)
(hq : 0 < q) (hcop : Nat.Coprime p q) :
let P2 : ℝ := ∑' m : ℤ, Real.exp (-((Real.pi * (m:ℝ))^2 / (2 * τ^2 * (1/(q:ℝ))^2)));
Filter.Tendsto
(fun k : ℕ => Real.sqrt (k:ℝ) * energy_filter_integral_1d k τ ((p:ℝ)/(q:ℝ)) / 16 ^ k)
Filter.atTop (nhds (Real.sqrt (Real.pi / (1 + ((p:ℝ)/(q:ℝ))^2)) * P2))energy_filter_laplace_three_dim_irrationalIn LeanStatistical Mechanics & Thermodynamics
For irrational alpha > 0 the scaled three-dimensional Gaussian integral satisfies k^(3/2) * I3(k,tau,alpha) / 256^k -> sqrt(2) * (pi/(1+alpha^2))^(3/2).
theorem energy_filter_laplace_three_dim_irrational (τ α : ℝ) (hτ : 0 < τ) (hirr : Irrational α) :
Filter.Tendsto
(fun k : ℕ => ((k:ℝ) * Real.sqrt (k:ℝ)) * energy_filter_integral_3d k τ α / 256 ^ k)
Filter.atTop (nhds (Real.sqrt 2 * (Real.pi / (1 + α^2)) ^ (3/2 : ℝ)))energy_filter_laplace_three_dim_rationalIn LeanStatistical Mechanics & Thermodynamics
For alpha = p/q in lowest terms, k^(3/2) * I3(k,tau,p/q)/256^k tends to sqrt(2) (pi/(1+(p/q)^2))^(3/2) times P4 = sum over v in Z^3 of exp(-(pi^2/(tau^2 (1/q)^2)) Q(v)).
theorem energy_filter_laplace_three_dim_rational (τ : ℝ) (hτ : 0 < τ) (p q : ℕ) (hp : 0 < p)
(hq : 0 < q) (hcop : Nat.Coprime p q) :
let P4 : ℝ := ∑' v : ℤ × ℤ × ℤ, Real.exp (-(Real.pi^2 / (τ^2 * (1/(q:ℝ))^2) *
((3/4) * (v.1:ℝ)^2 + (v.2.1:ℝ)^2 + (3/4) * (v.2.2:ℝ)^2 - (v.1:ℝ) * (v.2.1:ℝ)
+ (1/2) * (v.1:ℝ) * (v.2.2:ℝ) - (v.2.1:ℝ) * (v.2.2:ℝ))));
Filter.Tendsto
(fun k : ℕ => ((k:ℝ) * Real.sqrt (k:ℝ)) * energy_filter_integral_3d k τ ((p:ℝ)/(q:ℝ)) / 256 ^ k)
Filter.atTop (nhds (Real.sqrt 2 * (Real.pi / (1 + ((p:ℝ)/(q:ℝ))^2)) ^ (3/2 : ℝ) * P4))energy_filter_lattice_ratio_continuum_limitIn LeanStatistical Mechanics & Thermodynamics
As h approaches 0 from above, the ratio h S_4(tau, h) / S_2(tau, h)^2 converges to sqrt(pi) / tau.
theorem energy_filter_lattice_ratio_continuum_limit (τ : ℝ) (hτ : 0 < τ) :
Filter.Tendsto
(fun h : ℝ => h * energy_filter_lattice_s4 τ h / (energy_filter_lattice_s2 τ h)^2)
(nhdsWithin 0 (Set.Ioi 0))
(nhds (Real.sqrt Real.pi / τ))energy_filter_lattice_s4_eq_even_oddIn LeanStatistical Mechanics & Thermodynamics
The discrete fourth-moment sum S_4 decomposes into an even-parity convolution part equal to S_2^2 * Theta(4 tau^2 h^2) and an odd-parity part equal to the product of odd Gaussian sums.
theorem energy_filter_lattice_s4_eq_even_odd (τ h : ℝ) (hτ : 0 < τ) (hh : 0 < h) :
energy_filter_lattice_s4 τ h =
(energy_filter_lattice_s2 τ h)^2 * (∑' (j : ℤ), Real.exp (- 4 * τ^2 * h^2 * (j : ℝ)^2)) +
(∑' (j : ℤ), Real.exp (- τ^2 * h^2 * ((2 * j + 1 : ℤ) : ℝ)^2)) *
(∑' (n : ℤ), Real.exp (- (τ^2 * h^2 / 2) * ((2 * n - 1 : ℤ) : ℝ)^2))^2energy_filter_lattice_s4_theta_identityIn LeanStatistical Mechanics & Thermodynamics
For tau, h > 0, put c = tau^2 h^2 and Theta(x) = sum over n in Z of exp(-x n^2). Then twice the fourth-moment convolution sum S_4(tau,h) equals Theta(c)^3 + (2 Theta(4c) - Theta(c))^3.
theorem energy_filter_lattice_s4_theta_identity (τ h : ℝ) (hτ : 0 < τ) (hh : 0 < h) :
2 * energy_filter_lattice_s4 τ h
= (∑' n : ℤ, Real.exp (-(τ^2 * h^2) * (n : ℝ)^2))^3
+ (2 * (∑' n : ℤ, Real.exp (-4 * (τ^2 * h^2) * (n : ℝ)^2))
- (∑' n : ℤ, Real.exp (-(τ^2 * h^2) * (n : ℝ)^2)))^3energy_filter_peak_set_irrationalIn LeanStatistical Mechanics & Thermodynamics
For irrational alpha the only points where |cos x * cos(alpha x)| attains its maximum 1 are the origin: {x : |cos x * cos(alpha x)| = 1} = {0}.
theorem energy_filter_peak_set_irrational (α : ℝ) (hirr : Irrational α) :
{x : ℝ | |Real.cos x * Real.cos (α * x)| = 1} = {0}energy_filter_peak_set_rationalIn LeanStatistical Mechanics & Thermodynamics
For alpha = p/q in lowest terms with p, q > 0, the maximum set {x : |cos x * cos((p/q) x)| = 1} is exactly the lattice pi * q * Z.
theorem energy_filter_peak_set_rational (p q : ℕ) (hp : 0 < p) (hq : 0 < q)
(hcop : Nat.Coprime p q) :
{x : ℝ | |Real.cos x * Real.cos ((p:ℝ)/(q:ℝ) * x)| = 1}
= {x : ℝ | ∃ n : ℤ, x = Real.pi * (q:ℝ) * (n:ℝ)}energy_filter_purity_limit_of_integral_asymptoticsIn LeanStatistical Mechanics & Thermodynamics
Abstract assembly step: if sqrt(k) * I1(k,tau,alpha)/16^k tends to A > 0 and k^(3/2) * I3(k,tau,alpha)/256^k tends to B > 0, then sqrt(4k) * two_species_purity(k,tau,alpha) tends to 2B/(tau sqrt(pi) A^2). This is the exact algebraic combination of the trace reduction, the two integral representations and the exponential growth rates 16^k, 256^k = 16^(2k).
theorem energy_filter_purity_limit_of_integral_asymptotics
(τ α : ℝ) (hτ : 0 < τ) (A B : ℝ) (hA : 0 < A) (hB : 0 < B)
(h1 : Filter.Tendsto
(fun k : ℕ => Real.sqrt (k:ℝ) * energy_filter_integral_1d k τ α / 16 ^ k)
Filter.atTop (nhds A))
(h3 : Filter.Tendsto
(fun k : ℕ => ((k:ℝ) * Real.sqrt (k:ℝ)) * energy_filter_integral_3d k τ α / 256 ^ k)
Filter.atTop (nhds B)) :
Filter.Tendsto (fun k : ℕ => Real.sqrt (4 * (k : ℝ)) * two_species_purity k τ α)
Filter.atTop (nhds (2 * B / (τ * Real.sqrt Real.pi * A^2)))energy_filter_qform_cyclic_sq_decompositionIn LeanStatistical Mechanics & Thermodynamics
The quartic form Q(a,b,c) = (3/4)a^2 + b^2 + (3/4)c^2 - ab + (1/2)ac - bc coming from the four cyclic energy sums equals (a-b)^2/2 + (c-b)^2/2 + (a+c)^2/4.
theorem energy_filter_qform_cyclic_sq_decomposition (a b c : ℝ) :
(3/4) * a^2 + b^2 + (3/4) * c^2 - a * b + (1/2) * a * c - b * c
= (a - b)^2 / 2 + (c - b)^2 / 2 + (a + c)^2 / 4energy_filter_rational_resonance_const_algebraIn LeanStatistical Mechanics & Thermodynamics
For tau > 0, positive p, q and any reals S2, S4: 2 (sqrt 2 (pi q^2/(p^2+q^2))^(3/2) S4) / (tau sqrt(pi) (sqrt(pi q^2/(p^2+q^2)) S2)^2) equals (2 sqrt 2 q /(tau sqrt(p^2+q^2))) (S4/S2^2).
theorem energy_filter_rational_resonance_const_algebra
(τ : ℝ) (hτ : 0 < τ) (p q : ℕ) (hp : 0 < p) (hq : 0 < q) (S2 S4 : ℝ) :
(let D : ℝ := (p:ℝ)^2 + (q:ℝ)^2
2 * (Real.sqrt 2 * (Real.pi * (q:ℝ)^2 / D)^(3/2:ℝ) * S4) /
(τ * Real.sqrt Real.pi * (Real.sqrt (Real.pi * (q:ℝ)^2 / D) * S2)^2))
= (let D : ℝ := (p:ℝ)^2 + (q:ℝ)^2
(2 * Real.sqrt 2 * (q:ℝ) / (τ * Real.sqrt D)) * (S4 / S2^2))energy_filter_rational_resonance_purity_assemblyIn LeanStatistical Mechanics & Thermodynamics
If S2 > 0, sqrt(k) I1(k,tau,alpha_k)/16^k tends to sqrt(pi q^2/D) S2 and k^(3/2) I3(k,tau,alpha_k)/256^k tends to sqrt 2 (pi q^2/D)^(3/2) S4, with alpha_k = p/q + c/sqrt(4k), then sqrt(4k) two_species_purity(k,tau,alpha_k) tends to (2 sqrt 2 q/(tau sqrt D)) (S4/S2^2).
theorem energy_filter_rational_resonance_purity_assembly
(τ : ℝ) (hτ : 0 < τ) (p q : ℕ) (hp : 0 < p) (hq : 0 < q) (hcop : Nat.Coprime p q) (c : ℝ) :
let L : Matrix (Fin 3) (Fin 3) ℝ := !![2, -1, 0; -1, 2, -1; 0, -1, 2]
let D : ℝ := (p : ℝ)^2 + (q : ℝ)^2
let u : ℝ := Real.pi^2 * (q : ℝ)^2 / (2 * τ^2) + Real.pi^2 * c^2 * (q : ℝ)^4 / (4 * D)
let S2 : ℝ := ∑' (k : ℤ), Real.exp (- u * (k : ℝ)^2)
let S4 : ℝ := ∑' (v : Fin 3 → ℤ),
let vR : Fin 3 → ℝ := fun i => (v i : ℝ)
let vT_Linv_v := dotProduct vR (Matrix.mulVec L⁻¹ vR)
let quad2 := dotProduct vR vR + (∑ i : Fin 3, vR i)^2
Real.exp (- (Real.pi^2 * (q:ℝ)^2 * vT_Linv_v / τ^2) -
(Real.pi^2 * c^2 * (q:ℝ)^4 * quad2 / (8 * D)))
(0 < S2) →
(Filter.Tendsto
(fun k : ℕ => Real.sqrt (k : ℝ) * energy_filter_integral_1d k τ
((p : ℝ) / (q : ℝ) + c / Real.sqrt (4 * (k : ℝ))) / 16 ^ k)
Filter.atTop
(nhds (Real.sqrt (Real.pi * (q : ℝ)^2 / D) * S2))) →
(Filter.Tendsto
(fun k : ℕ => ((k : ℝ) * Real.sqrt (k : ℝ)) *
energy_filter_integral_3d k τ
((p : ℝ) / (q : ℝ) + c / Real.sqrt (4 * (k : ℝ))) / 256 ^ k)
Filter.atTop
(nhds (Real.sqrt 2 * (Real.pi * (q : ℝ)^2 / D) ^ (3/2 : ℝ) * S4))) →
Filter.Tendsto
(fun k : ℕ => Real.sqrt (4 * (k : ℝ)) *
two_species_purity k τ ((p : ℝ) / (q : ℝ) + c / Real.sqrt (4 * (k : ℝ))))
Filter.atTop
(nhds ((2 * Real.sqrt 2 * (q : ℝ) / (τ * Real.sqrt D)) * (S4 / S2^2)))energy_filter_rational_resonance_s2_asymptoticsIn LeanStatistical Mechanics & Thermodynamics
With the k-dependent frequency alpha_k = p/q + c/sqrt(4k), sqrt(k) times the one-dimensional energy-filter integral I1(k,tau,alpha_k) divided by 16^k tends to sqrt(pi q^2/(p^2+q^2)) times S_2 = sum over n in Z of exp(-u n^2) with u = pi^2 q^2/(2 tau^2) + pi^2 c^2 q^4/(4(p^2+q^2)).
theorem energy_filter_rational_resonance_s2_asymptotics
(τ : ℝ) (hτ : 0 < τ) (p q : ℕ) (hp : 0 < p) (hq : 0 < q) (hcop : Nat.Coprime p q) (c : ℝ) :
let D : ℝ := (p : ℝ)^2 + (q : ℝ)^2
let u : ℝ := Real.pi^2 * (q : ℝ)^2 / (2 * τ^2) + Real.pi^2 * c^2 * (q : ℝ)^4 / (4 * D)
let S2 : ℝ := ∑' (k : ℤ), Real.exp (- u * (k : ℝ)^2)
Filter.Tendsto
(fun k : ℕ => Real.sqrt (k : ℝ) * energy_filter_integral_1d k τ
((p : ℝ) / (q : ℝ) + c / Real.sqrt (4 * (k : ℝ))) / 16 ^ k)
Filter.atTop
(nhds (Real.sqrt (Real.pi * (q : ℝ)^2 / D) * S2))energy_filter_rational_resonance_s2_posIn LeanStatistical Mechanics & Thermodynamics
The one-dimensional theta sum S_2 = sum over k in Z of exp(-u k^2) with u = pi^2 q^2/(2 tau^2) + pi^2 c^2 q^4/(4(p^2+q^2)) is strictly positive.
theorem energy_filter_rational_resonance_s2_pos
(τ : ℝ) (hτ : 0 < τ) (p q : ℕ) (hp : 0 < p) (hq : 0 < q) (c : ℝ) :
let D : ℝ := (p : ℝ)^2 + (q : ℝ)^2
let u : ℝ := Real.pi^2 * (q : ℝ)^2 / (2 * τ^2) + Real.pi^2 * c^2 * (q : ℝ)^4 / (4 * D)
let S2 : ℝ := ∑' (k : ℤ), Real.exp (- u * (k : ℝ)^2)
0 < S2energy_filter_rational_resonance_s4_asymptoticsIn LeanStatistical Mechanics & Thermodynamics
With alpha_k = p/q + c/sqrt(4k), k^(3/2) times the three-dimensional energy-filter integral I3(k,tau,alpha_k) divided by 256^k tends to sqrt 2 times (pi q^2/(p^2+q^2))^(3/2) times S_4 = sum over v in Z^3 of exp(-pi^2 q^2 (v^T L^{-1} v)/tau^2 - pi^2 c^2 q^4 (v^T v + (v_1+v_2+v_3)^2)/(8(p^2+q^2))), where L has diagonal 2 and adjacent off-diagonals -1.
theorem energy_filter_rational_resonance_s4_asymptotics
(τ : ℝ) (hτ : 0 < τ) (p q : ℕ) (hp : 0 < p) (hq : 0 < q) (hcop : Nat.Coprime p q) (c : ℝ) :
let L : Matrix (Fin 3) (Fin 3) ℝ := !![2, -1, 0; -1, 2, -1; 0, -1, 2]
let D : ℝ := (p : ℝ)^2 + (q : ℝ)^2
let S4 : ℝ := ∑' (v : Fin 3 → ℤ),
let vR : Fin 3 → ℝ := fun i => (v i : ℝ)
let vT_Linv_v := dotProduct vR (Matrix.mulVec L⁻¹ vR)
let quad2 := dotProduct vR vR + (∑ i : Fin 3, vR i)^2
Real.exp (- (Real.pi^2 * (q:ℝ)^2 * vT_Linv_v / τ^2) -
(Real.pi^2 * c^2 * (q:ℝ)^4 * quad2 / (8 * D)))
Filter.Tendsto
(fun k : ℕ => ((k : ℝ) * Real.sqrt (k : ℝ)) *
energy_filter_integral_3d k τ
((p : ℝ) / (q : ℝ) + c / Real.sqrt (4 * (k : ℝ))) / 256 ^ k)
Filter.atTop
(nhds (Real.sqrt 2 * (Real.pi * (q : ℝ)^2 / D) ^ (3/2 : ℝ) * S4))energy_filter_reduced_entropy_eventually_pos_traceIn LeanStatistical Mechanics & Thermodynamics
For any nonzero finitely supported sequence a and growing bipartition, the trace of M M^T is eventually strictly positive.
theorem energy_filter_reduced_entropy_eventually_pos_trace
(a : ℤ → ℝ) (hsupp : (Function.support a).Finite) (ha : a ≠ 0)
(n m : ℕ → ℕ) (heven : ∀ k, Even (n k))
(hm_lt : ∀ k, 1 ≤ m k ∧ m k < n k)
(hm_inf : Filter.Tendsto m Filter.atTop Filter.atTop)
(hnm_inf : Filter.Tendsto (fun k => n k - m k) Filter.atTop Filter.atTop) :
Filter.Eventually
(fun k =>
let l := n k - m k
let wA : (Fin (m k) → Bool) → ℤ := fun s => ∑ j : Fin (m k), if s j then 1 else 0
let wB : (Fin l → Bool) → ℤ := fun s => ∑ j : Fin l, if s j then 1 else 0
let M : Matrix (Fin (m k) → Bool) (Fin l → Bool) ℝ :=
fun sA sB => a ((n k : ℤ) / 2 - wA sA - wB sB)
let hR := Matrix.isHermitian_mul_conjTranspose_self M
0 < ∑ s, hR.eigenvalues s)
Filter.atTopenergy_filter_reduced_entropy_sum_eigenvalues_eq_traceIn LeanStatistical Mechanics & Thermodynamics
For any sequence a and dimensions n, m, the sum of eigenvalues of the Gram matrix M M^T in the reduced state definition equals the matrix trace Tr(M M^T).
theorem energy_filter_reduced_entropy_sum_eigenvalues_eq_trace
(a : ℤ → ℝ) (n m : ℕ) :
let l := n - m
let wA : (Fin m → Bool) → ℤ := fun s => ∑ j : Fin m, if s j then 1 else 0
let wB : (Fin l → Bool) → ℤ := fun s => ∑ j : Fin l, if s j then 1 else 0
let M : Matrix (Fin m → Bool) (Fin l → Bool) ℝ :=
fun sA sB => a ((n : ℤ) / 2 - wA sA - wB sB)
let hR := Matrix.isHermitian_mul_conjTranspose_self M
∑ s, hR.eigenvalues s = (M * M.transpose).traceenergy_filter_renyi_denominator_asymptoticIn LeanStatistical Mechanics & Thermodynamics
For any nonzero finitely supported sequence a, the normalized eigenvalue sum sqrt(2 pi k) / 2^(4k) * (∑ s, λ_s) converges to the lattice sum S_2(a) as k tends to infinity.
theorem energy_filter_renyi_denominator_asymptotic
(a : ℤ → ℝ) (ha_ne : a ≠ 0) (ha_fin : Function.HasFiniteSupport a) :
Filter.Tendsto
(fun k : ℕ =>
let w : (Fin (2 * k) → Bool) → ℤ := fun s => ∑ j : Fin (2 * k), if s j then 1 else 0
let M : Matrix (Fin (2 * k) → Bool) (Fin (2 * k) → Bool) ℝ :=
fun sA sB => a (2 * (k : ℤ) - w sA - w sB)
let hR := Matrix.isHermitian_mul_conjTranspose_self M
Real.sqrt (2 * Real.pi * (k : ℝ)) / ((2 : ℝ) ^ (4 * k)) * (∑ s, hR.eigenvalues s))
Filter.atTop
(nhds (energy_filter_sequence_lattice_s2 a))energy_filter_renyi_moment_limit_assemblyIn LeanStatistical Mechanics & Thermodynamics
Combines the asymptotic convergence of the normalized numerator and denominator via the quotient law for limits and definition unfolding to deduce the convergence of the scaled Renyi moment to the Renyi constant.
theorem energy_filter_renyi_moment_limit_assembly
(a : ℤ → ℝ) (q : ℝ)
(h_num : Filter.Tendsto
(fun k : ℕ =>
let w : (Fin (2 * k) → Bool) → ℤ := fun s => ∑ j : Fin (2 * k), if s j then 1 else 0
let M : Matrix (Fin (2 * k) → Bool) (Fin (2 * k) → Bool) ℝ :=
fun sA sB => a (2 * (k : ℤ) - w sA - w sB)
let hR := Matrix.isHermitian_mul_conjTranspose_self M
((4 * (k : ℝ)) ^ ((q - 1) / 2)) * (∑ s, (hR.eigenvalues s) ^ q) /
((((2 : ℝ) ^ (4 * k)) / Real.sqrt (2 * Real.pi * (k : ℝ))) ^ q))
Filter.atTop
(nhds ((4 / Real.sqrt (2 * Real.pi)) ^ q * Real.sqrt (Real.pi / (8 * q)) *
((1 / (2 * Real.pi)) * ∫ θ in (0 : ℝ)..(2 * Real.pi),
‖energy_filter_fourier_symbol a θ‖ ^ (2 * q)))))
(h_den : Filter.Tendsto
(fun k : ℕ =>
let w : (Fin (2 * k) → Bool) → ℤ := fun s => ∑ j : Fin (2 * k), if s j then 1 else 0
let M : Matrix (Fin (2 * k) → Bool) (Fin (2 * k) → Bool) ℝ :=
fun sA sB => a (2 * (k : ℤ) - w sA - w sB)
let hR := Matrix.isHermitian_mul_conjTranspose_self M
Real.sqrt (2 * Real.pi * (k : ℝ)) / ((2 : ℝ) ^ (4 * k)) * (∑ s, hR.eigenvalues s))
Filter.atTop
(nhds (energy_filter_sequence_lattice_s2 a)))
(hS_pos : 0 < energy_filter_sequence_lattice_s2 a) :
Filter.Tendsto
(fun k : ℕ => ((4 * (k : ℝ)) ^ ((q - 1) / 2)) * energy_filter_renyi_moment a k q)
Filter.atTop
(nhds (energy_filter_renyi_constant a q))energy_filter_renyi_moment_sum_eigenvalues_eq_traceIn LeanStatistical Mechanics & Thermodynamics
For any filter sequence a and parameter k, the sum of the eigenvalues of the Gram matrix M M† in the definition of the Renyi moment equals the matrix trace Tr(M M^T).
theorem energy_filter_renyi_moment_sum_eigenvalues_eq_trace (a : ℤ → ℝ) (k : ℕ) :
let w : (Fin (2 * k) → Bool) → ℤ := fun s => ∑ j : Fin (2 * k), if s j then 1 else 0
let M : Matrix (Fin (2 * k) → Bool) (Fin (2 * k) → Bool) ℝ :=
fun sA sB => a (2 * (k : ℤ) - w sA - w sB)
let hR := Matrix.isHermitian_mul_conjTranspose_self M
∑ s, hR.eigenvalues s = (M * M.transpose).traceenergy_filter_renyi_numerator_asymptoticIn LeanStatistical Mechanics & Thermodynamics
For any nonzero finitely supported sequence a and real q > 1, the scaled and normalized spectral power sum (4k)^((q-1)/2) * (∑ s, λ_s^q) / (2^(4k) / sqrt(2 pi k))^q converges to C_q * (1 / (2 pi)) * ∫_0^{2 pi} ‖A(θ)‖^(2q) dθ.
theorem energy_filter_renyi_numerator_asymptotic
(a : ℤ → ℝ) (ha_ne : a ≠ 0) (ha_fin : Function.HasFiniteSupport a)
(q : ℝ) (hq : 1 < q) :
let Cq := (4 / Real.sqrt (2 * Real.pi)) ^ q * Real.sqrt (Real.pi / (8 * q))
let integ := (1 / (2 * Real.pi)) * ∫ θ in (0 : ℝ)..(2 * Real.pi),
‖energy_filter_fourier_symbol a θ‖ ^ (2 * q)
Filter.Tendsto
(fun k : ℕ =>
let w : (Fin (2 * k) → Bool) → ℤ := fun s => ∑ j : Fin (2 * k), if s j then 1 else 0
let M : Matrix (Fin (2 * k) → Bool) (Fin (2 * k) → Bool) ℝ :=
fun sA sB => a (2 * (k : ℤ) - w sA - w sB)
let hR := Matrix.isHermitian_mul_conjTranspose_self M
((4 * (k : ℝ)) ^ ((q - 1) / 2)) * (∑ s, (hR.eigenvalues s) ^ q) /
((((2 : ℝ) ^ (4 * k)) / Real.sqrt (2 * Real.pi * (k : ℝ))) ^ q))
Filter.atTop
(nhds (Cq * integ))energy_filter_renyi_prefactor_twoIn LeanStatistical Mechanics & Thermodynamics
The Renyi-2 prefactor (4 / sqrt(2 pi))^2 * sqrt(pi / 16) simplifies to 2 / sqrt(pi).
theorem energy_filter_renyi_prefactor_two :
(4 / Real.sqrt (2 * Real.pi)) ^ (2 : ℝ) * Real.sqrt (Real.pi / (8 * 2)) = 2 / Real.sqrt Real.pienergy_filter_sequence_binomial_gaussian_pointwiseIn LeanStatistical Mechanics & Thermodynamics
For fixed offset s, C(2k, k+s) * sqrt(pi k) / 2^(2k) tends to e^(-s^2/k) in the limit, i.e. the normalized binomial weight tends to 1 for each fixed offset.
theorem energy_filter_sequence_binomial_gaussian_pointwise (s : ℤ) :
Filter.Tendsto
(fun k : ℕ => (Nat.choose (2 * k) ((k : ℤ) + s).toNat : ℝ) * Real.sqrt (Real.pi * (k : ℝ))
/ (2 : ℝ) ^ (2 * k))
Filter.atTop (nhds 1)energy_filter_sequence_gaussian_lattice_sum_limitIn LeanStatistical Mechanics & Thermodynamics
For a nonzero l^{4/3} sequence a, (2/sqrt(pi k)) times the four-fold Gaussian-weighted lattice sum of the cyclic a-products converges to S4 = sum over m of the squared convolution.
theorem energy_filter_sequence_gaussian_lattice_sum_limit (a : ℤ → ℝ)
(ha_ne : a ≠ 0) (ha_lp : Memℓp a (4 / 3)) :
Filter.Tendsto
(fun k : ℕ => (2 / Real.sqrt (Real.pi * (k : ℝ))) *
(∑' α : ℤ, ∑' β : ℤ, ∑' γ : ℤ, ∑' δ : ℤ,
Real.exp (-((((α : ℝ) ^ 2 + (β : ℝ) ^ 2 + (γ : ℝ) ^ 2 + (δ : ℝ) ^ 2)) / (k : ℝ))) *
(a (-α - β) * a (-β - γ) * a (-γ - δ) * a (-δ - α))))
Filter.atTop (nhds (energy_filter_sequence_lattice_s4 a))energy_filter_sequence_lattice_s2_posIn LeanStatistical Mechanics & Thermodynamics
If a is a nonzero l^{4/3} sequence then the second lattice sum S2 = sum of a j^2 is strictly positive.
theorem energy_filter_sequence_lattice_s2_pos (a : ℤ → ℝ) (ha_ne : a ≠ 0) (ha_lp : Memℓp a (4 / 3)) :
0 < energy_filter_sequence_lattice_s2 aenergy_filter_sequence_lattice_s2_pos_of_finitely_supportedIn LeanStatistical Mechanics & Thermodynamics
For any nonzero finitely supported real sequence a on ℤ, the second-moment lattice sum S_2(a) = ∑' j : ℤ, (a j)^2 is strictly positive.
theorem energy_filter_sequence_lattice_s2_pos_of_finitely_supported
(a : ℤ → ℝ) (ha_ne : a ≠ 0) (ha_fin : Function.HasFiniteSupport a) :
0 < energy_filter_sequence_lattice_s2 aenergy_filter_sequence_lattice_s2_summableIn LeanStatistical Mechanics & Thermodynamics
If a is in l^{4/3} then the squares a j^2 are summable over Z.
theorem energy_filter_sequence_lattice_s2_summable (a : ℤ → ℝ) (ha_lp : Memℓp a (4 / 3)) :
Summable (fun j : ℤ => (a j) ^ 2)energy_filter_sequence_lattice_s4_rademacher_filterIn LeanStatistical Mechanics & Thermodynamics
The lattice S4 energy of a length-m Rademacher filter equals the finite four-fold sum over indices in Fin m with i1 + i2 = i3 + i4 of the four-sign product.
theorem energy_filter_sequence_lattice_s4_rademacher_filter (m : ℕ) (s : Fin m → Bool) :
energy_filter_sequence_lattice_s4 (rademacher_filter m s) =
∑ i1 : Fin m, ∑ i2 : Fin m, ∑ i3 : Fin m, ∑ i4 : Fin m,
if i1.val + i2.val = i3.val + i4.val then
(if s i1 = true then (1 : ℝ) else -1) *
(if s i2 = true then (1 : ℝ) else -1) *
(if s i3 = true then (1 : ℝ) else -1) *
(if s i4 = true then (1 : ℝ) else -1)
else 0energy_filter_sequence_purity_delta_eq_choose_fourthIn LeanStatistical Mechanics & Thermodynamics
For the Kronecker delta filter the purity is the Franel-type quotient (sum_p C(2k,p)^4)/C(4k,2k)^2.
theorem energy_filter_sequence_purity_delta_eq_choose_fourth (k : ℕ) :
energy_filter_sequence_purity (fun j => if j = 0 then (1 : ℝ) else 0) k
= (∑ p ∈ Finset.range (2 * k + 1), (Nat.choose (2 * k) p : ℝ) ^ 4) /
(Nat.choose (4 * k) (2 * k) : ℝ) ^ 2energy_filter_sequence_purity_eq_hamming_sumsIn LeanStatistical Mechanics & Thermodynamics
For any sequence a and k, the purity equals the ratio of the raw 4-fold trace of M^4 to the square of the raw 2-fold trace of M^2, where the matrix entries are indexed by spin configurations sA, sB in Fin (2k) -> Bool and M sA sB = a (2k - w sA - w sB) with w s the Hamming weight of s.
theorem energy_filter_sequence_purity_eq_hamming_sums (a : ℤ → ℝ) (k : ℕ) :
energy_filter_sequence_purity a k =
(∑ sA : Fin (2 * k) → Bool, ∑ sB : Fin (2 * k) → Bool,
∑ sC : Fin (2 * k) → Bool, ∑ sD : Fin (2 * k) → Bool,
a (2 * (k : ℤ) - (∑ i, if sA i = true then (1 : ℤ) else 0) - (∑ i, if sB i = true then (1 : ℤ) else 0)) *
a (2 * (k : ℤ) - (∑ i, if sB i = true then (1 : ℤ) else 0) - (∑ i, if sC i = true then (1 : ℤ) else 0)) *
a (2 * (k : ℤ) - (∑ i, if sC i = true then (1 : ℤ) else 0) - (∑ i, if sD i = true then (1 : ℤ) else 0)) *
a (2 * (k : ℤ) - (∑ i, if sD i = true then (1 : ℤ) else 0) - (∑ i, if sA i = true then (1 : ℤ) else 0)))
/ (∑ sA : Fin (2 * k) → Bool, ∑ sB : Fin (2 * k) → Bool,
(a (2 * (k : ℤ) - (∑ i, if sA i = true then (1 : ℤ) else 0) - (∑ i, if sB i = true then (1 : ℤ) else 0))) ^ 2) ^ 2energy_filter_sequence_purity_limit_assemblyIn LeanStatistical Mechanics & Thermodynamics
If the purity reduces to Tr4/Tr2^2 and the two normalized traces converge to S2 > 0 and S4 respectively, then sqrt(4k) times the purity converges to the purity constant (2/sqrt pi) S4/S2^2.
theorem energy_filter_sequence_purity_limit_assembly (a : ℤ → ℝ) (ha_ne : a ≠ 0) (ha_lp : Memℓp a (4 / 3))
(hred : ∀ k : ℕ, energy_filter_sequence_purity a k =
(∑ p ∈ Finset.range (2 * k + 1), ∑ q ∈ Finset.range (2 * k + 1),
∑ r ∈ Finset.range (2 * k + 1), ∑ s ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) * (Nat.choose (2 * k) q : ℝ) *
(Nat.choose (2 * k) r : ℝ) * (Nat.choose (2 * k) s : ℝ) *
(a (2 * (k : ℤ) - (p : ℤ) - (q : ℤ)) * a (2 * (k : ℤ) - (q : ℤ) - (r : ℤ)) *
a (2 * (k : ℤ) - (r : ℤ) - (s : ℤ)) * a (2 * (k : ℤ) - (s : ℤ) - (p : ℤ))))
/ (∑ p ∈ Finset.range (2 * k + 1), ∑ q ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) * (Nat.choose (2 * k) q : ℝ) *
(a (2 * (k : ℤ) - (p : ℤ) - (q : ℤ))) ^ 2) ^ 2)
(h2 : Filter.Tendsto
(fun k : ℕ =>
(∑ p ∈ Finset.range (2 * k + 1), ∑ q ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) * (Nat.choose (2 * k) q : ℝ) *
(a (2 * (k : ℤ) - (p : ℤ) - (q : ℤ))) ^ 2)
* Real.sqrt (2 * Real.pi * (k : ℝ)) / (2 : ℝ) ^ (4 * k))
Filter.atTop (nhds (energy_filter_sequence_lattice_s2 a)))
(h2pos : 0 < energy_filter_sequence_lattice_s2 a)
(h4 : Filter.Tendsto
(fun k : ℕ =>
(∑ p ∈ Finset.range (2 * k + 1), ∑ q ∈ Finset.range (2 * k + 1),
∑ r ∈ Finset.range (2 * k + 1), ∑ s ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) * (Nat.choose (2 * k) q : ℝ) *
(Nat.choose (2 * k) r : ℝ) * (Nat.choose (2 * k) s : ℝ) *
(a (2 * (k : ℤ) - (p : ℤ) - (q : ℤ)) * a (2 * (k : ℤ) - (q : ℤ) - (r : ℤ)) *
a (2 * (k : ℤ) - (r : ℤ) - (s : ℤ)) * a (2 * (k : ℤ) - (s : ℤ) - (p : ℤ))))
* (2 * Real.pi ^ (3 / 2 : ℝ) * (k : ℝ) ^ (3 / 2 : ℝ)) / (2 : ℝ) ^ (8 * k))
Filter.atTop (nhds (energy_filter_sequence_lattice_s4 a))) :
Filter.Tendsto
(fun k : ℕ => Real.sqrt (4 * (k : ℝ)) * energy_filter_sequence_purity a k)
Filter.atTop
(nhds (energy_filter_sequence_purity_constant a))energy_filter_sequence_purity_limit_of_trace_asymptoticsIn LeanStatistical Mechanics & Thermodynamics
If T2*sqrt(2 pi k)/2^(4k) tends to S2 > 0 and T4*2pi^(3/2)k^(3/2)/2^(8k) tends to S4, then sqrt(4k)*T4/T2^2 tends to (2/sqrt pi) S4/S2^2.
theorem energy_filter_sequence_purity_limit_of_trace_asymptotics
(T2 T4 : ℕ → ℝ) (S2 S4 : ℝ) (hS2 : 0 < S2)
(h2 : Filter.Tendsto
(fun k : ℕ => T2 k * Real.sqrt (2 * Real.pi * (k : ℝ)) / (2 : ℝ) ^ (4 * k))
Filter.atTop (nhds S2))
(h4 : Filter.Tendsto
(fun k : ℕ => T4 k * (2 * Real.pi ^ (3 / 2 : ℝ) * (k : ℝ) ^ (3 / 2 : ℝ)) / (2 : ℝ) ^ (8 * k))
Filter.atTop (nhds S4)) :
Filter.Tendsto
(fun k : ℕ => Real.sqrt (4 * (k : ℝ)) * (T4 k / (T2 k) ^ 2))
Filter.atTop (nhds (2 / Real.sqrt Real.pi * S4 / S2 ^ 2))energy_filter_sequence_purity_normalization_identityIn LeanStatistical Mechanics & Thermodynamics
For k >= 1 with T2 nonzero, sqrt(4k) * T4/T2^2 equals (2/sqrt pi) times the ratio of the two normalized traces T4*2pi^(3/2)k^(3/2)/2^(8k) and (T2*sqrt(2 pi k)/2^(4k))^2.
theorem energy_filter_sequence_purity_normalization_identity (T2 T4 : ℝ) (k : ℕ) (hk : k ≠ 0)
(hT2 : T2 ≠ 0) :
Real.sqrt (4 * (k : ℝ)) * (T4 / T2 ^ 2) =
(2 / Real.sqrt Real.pi) *
(T4 * (2 * Real.pi ^ (3 / 2 : ℝ) * (k : ℝ) ^ (3 / 2 : ℝ)) / (2 : ℝ) ^ (8 * k)) /
((T2 * Real.sqrt (2 * Real.pi * (k : ℝ)) / (2 : ℝ) ^ (4 * k)) ^ 2)energy_filter_sequence_purity_trace_reductionIn LeanStatistical Mechanics & Thermodynamics
Since M is symmetric, the purity is the ratio of the four-fold cyclic binomial-weighted sum of a-products to the square of the two-fold binomial-weighted sum of a-squares.
theorem energy_filter_sequence_purity_trace_reduction (a : ℤ → ℝ) (k : ℕ) :
energy_filter_sequence_purity a k =
(∑ p ∈ Finset.range (2 * k + 1), ∑ q ∈ Finset.range (2 * k + 1),
∑ r ∈ Finset.range (2 * k + 1), ∑ s ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) * (Nat.choose (2 * k) q : ℝ) *
(Nat.choose (2 * k) r : ℝ) * (Nat.choose (2 * k) s : ℝ) *
(a (2 * (k : ℤ) - (p : ℤ) - (q : ℤ)) * a (2 * (k : ℤ) - (q : ℤ) - (r : ℤ)) *
a (2 * (k : ℤ) - (r : ℤ) - (s : ℤ)) * a (2 * (k : ℤ) - (s : ℤ) - (p : ℤ))))
/ (∑ p ∈ Finset.range (2 * k + 1), ∑ q ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) * (Nat.choose (2 * k) q : ℝ) *
(a (2 * (k : ℤ) - (p : ℤ) - (q : ℤ))) ^ 2) ^ 2energy_filter_sequence_sum_fin_bool_hamming_weightIn LeanStatistical Mechanics & Thermodynamics
For any n and any function f of an integer, summing f of the Hamming weight over all spin configurations in Fin n -> Bool equals the binomial-weighted sum of f over p in range (n+1).
theorem energy_filter_sequence_sum_fin_bool_hamming_weight (n : ℕ) (f : ℤ → ℝ) :
(∑ s : Fin n → Bool, f (∑ i, if s i = true then (1 : ℤ) else 0)) =
∑ p ∈ Finset.range (n + 1), (Nat.choose n p : ℝ) * f (p : ℤ)energy_filter_sequence_trace2_asymptoticIn LeanStatistical Mechanics & Thermodynamics
The normalized second trace converges to the second lattice sum S2.
theorem energy_filter_sequence_trace2_asymptotic (a : ℤ → ℝ) (ha_ne : a ≠ 0) (ha_lp : Memℓp a (4 / 3)) :
Filter.Tendsto
(fun k : ℕ =>
(∑ p ∈ Finset.range (2 * k + 1), ∑ q ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) * (Nat.choose (2 * k) q : ℝ) *
(a (2 * (k : ℤ) - (p : ℤ) - (q : ℤ))) ^ 2)
* Real.sqrt (2 * Real.pi * (k : ℝ)) / (2 : ℝ) ^ (4 * k))
Filter.atTop (nhds (energy_filter_sequence_lattice_s2 a))energy_filter_sequence_trace2_vandermondeIn LeanStatistical Mechanics & Thermodynamics
The two-fold binomial trace sum equals the single sum over t in range (4k+1) of C(4k,t) a(2k-t)^2.
theorem energy_filter_sequence_trace2_vandermonde (a : ℤ → ℝ) (k : ℕ) :
(∑ p ∈ Finset.range (2 * k + 1), ∑ q ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) * (Nat.choose (2 * k) q : ℝ) *
(a (2 * (k : ℤ) - (p : ℤ) - (q : ℤ))) ^ 2)
= ∑ t ∈ Finset.range (4 * k + 1), (Nat.choose (4 * k) t : ℝ) * (a (2 * (k : ℤ) - (t : ℤ))) ^ 2energy_filter_single_species_char_sumIn LeanStatistical Mechanics & Thermodynamics
For every k and t, the sum over all configurations s : Fin k -> Bool of exp(I * (sum_j if s j then 1 else -1) * t) equals (2 cos t)^k.
theorem energy_filter_single_species_char_sum (k : ℕ) (t : ℝ) :
(∑ s : Fin k → Bool, Complex.exp (Complex.I * ((∑ j, if s j then (1:ℝ) else (-1:ℝ)) : ℂ) * (t : ℂ)))
= (((2 * Real.cos t) ^ k : ℝ) : ℂ)energy_filter_theta_qform_lattice_sumIn LeanStatistical Mechanics & Thermodynamics
For lam > 0, the sum over v in Z^3 of exp(-lam * Q(v)), where Q(a,b,c) = (3/4)a^2 + b^2 + (3/4)c^2 - ab + (1/2)ac - bc, equals Theta(lam)^3 + Theta_odd(lam)^3, where Theta(lam) = sum over n in Z of exp(-lam n^2) and Theta_odd(lam) = sum over n in Z of exp(-(lam/4)(2n+1)^2) (the latter being sum over odd m of exp(-lam m^2/4)).
theorem energy_filter_theta_qform_lattice_sum (lam : ℝ) (hlam : 0 < lam) :
(∑' v : ℤ × ℤ × ℤ, Real.exp (-lam * ((3/4) * (v.1 : ℝ)^2 + (v.2.1 : ℝ)^2 + (3/4) * (v.2.2 : ℝ)^2
- (v.1 : ℝ) * (v.2.1 : ℝ) + (1/2) * (v.1 : ℝ) * (v.2.2 : ℝ) - (v.2.1 : ℝ) * (v.2.2 : ℝ))))
= (∑' n : ℤ, Real.exp (-lam * (n : ℝ)^2))^3
+ (∑' n : ℤ, Real.exp (-(lam / 4) * ((2 * n + 1 : ℤ) : ℝ)^2))^3energy_filter_theta_s2In LeanStatistical Mechanics & Thermodynamics
The one-dimensional Jacobi theta transformation: for tau, h > 0, the sum over m in Z of exp(-(pi m)^2/(2 tau^2 h^2)) equals tau sqrt(2) h / sqrt(pi) times energy_filter_lattice_s2(tau,h) = sum over k in Z of exp(-2 tau^2 h^2 k^2).
theorem energy_filter_theta_s2 (τ h : ℝ) (hτ : 0 < τ) (hh : 0 < h) :
(∑' m : ℤ, Real.exp (-((Real.pi * (m:ℝ))^2 / (2 * τ^2 * h^2))))
= τ * Real.sqrt 2 * h / Real.sqrt Real.pi * energy_filter_lattice_s2 τ henergy_filter_theta_s4In LeanStatistical Mechanics & Thermodynamics
For tau, h > 0, the sum over v in Z^3 of exp(-(pi^2/(tau^2 h^2)) Q(v)), with Q(a,b,c) = (3/4)a^2 + b^2 + (3/4)c^2 - ab + (1/2)ac - bc, equals 2 tau^3 h^3 / sqrt(pi)^3 times energy_filter_lattice_s4(tau,h).
theorem energy_filter_theta_s4 (τ h : ℝ) (hτ : 0 < τ) (hh : 0 < h) :
(∑' v : ℤ × ℤ × ℤ, Real.exp (-(Real.pi^2 / (τ^2 * h^2) *
((3/4) * (v.1:ℝ)^2 + (v.2.1:ℝ)^2 + (3/4) * (v.2.2:ℝ)^2 - (v.1:ℝ) * (v.2.1:ℝ)
+ (1/2) * (v.1:ℝ) * (v.2.2:ℝ) - (v.2.1:ℝ) * (v.2.2:ℝ)))))
= 2 * τ^3 * h^3 / Real.sqrt Real.pi ^ 3 * energy_filter_lattice_s4 τ henergy_filter_trace2_integralIn LeanStatistical Mechanics & Thermodynamics
Exact one-dimensional Gaussian-integral representation of Tr(M M^T): the sum over a, b of exp(-tau^2 (e a + e b)^2/2) equals 1/(sqrt2 tau sqrt pi) times the integral over R of exp(-s^2/(2 tau^2)) (4 cos s cos(alpha s))^(2k) ds.
theorem energy_filter_trace2_integral (k : ℕ) (τ α : ℝ) (hτ : 0 < τ) :
let e : (Fin k → Bool) × (Fin k → Bool) → ℝ :=
fun s => (∑ j, if s.1 j then (1:ℝ) else -1) + α * ∑ j, if s.2 j then (1:ℝ) else -1;
(∑ a : (Fin k → Bool) × (Fin k → Bool), ∑ b, Real.exp (-(τ^2 * (e a + e b)^2 / 2)))
= 1 / (Real.sqrt 2 * τ * Real.sqrt Real.pi) * energy_filter_integral_1d k τ αenergy_filter_trace4_integralIn LeanStatistical Mechanics & Thermodynamics
Exact three-dimensional Gaussian-integral representation of Tr((M M^T)^2): the four-fold cyclic energy sum equals 1/(2 tau^3 sqrt(pi)^3) times the integral over R^3 of exp(-Q(p)/tau^2) times the four factors (4 cos p_i cos(alpha p_i))^k and (4 cos(p1+p3-p2) cos(alpha(p1+p3-p2)))^k, with Q(a,b,c) = (3/4)a^2 + b^2 + (3/4)c^2 - ab + (1/2)ac - bc.
theorem energy_filter_trace4_integral (k : ℕ) (τ α : ℝ) (hτ : 0 < τ) :
let e : (Fin k → Bool) × (Fin k → Bool) → ℝ :=
fun s => (∑ j, if s.1 j then (1:ℝ) else -1) + α * ∑ j, if s.2 j then (1:ℝ) else -1;
(∑ a : (Fin k → Bool) × (Fin k → Bool), ∑ b, ∑ c, ∑ d,
Real.exp (-(τ^2 * ((e a + e b)^2 + (e b + e c)^2 + (e c + e d)^2 + (e d + e a)^2) / 4)))
= 1 / (2 * τ^3 * Real.sqrt Real.pi ^ 3) * energy_filter_integral_3d k τ αenergy_filter_trace_reductionIn LeanStatistical Mechanics & Thermodynamics
The purity equals Tr(M^4)/Tr(M^2)^2 written as energy sums: two_species_purity k tau alpha is the four-fold cyclic sum of exp(-(tau^2/4)[(e a + e b)^2 + (e b + e c)^2 + (e c + e d)^2 + (e d + e a)^2]) divided by the square of the two-fold sum of exp(-tau^2 (e a + e b)^2/2).
theorem energy_filter_trace_reduction (k : ℕ) (τ α : ℝ) :
let e : (Fin k → Bool) × (Fin k → Bool) → ℝ :=
fun s => (∑ j, if s.1 j then (1:ℝ) else -1) + α * ∑ j, if s.2 j then (1:ℝ) else -1;
two_species_purity k τ α
= (∑ a : (Fin k → Bool) × (Fin k → Bool), ∑ b, ∑ c, ∑ d,
Real.exp (-(τ^2 * ((e a + e b)^2 + (e b + e c)^2 + (e c + e d)^2 + (e d + e a)^2) / 4)))
/ (∑ a : (Fin k → Bool) × (Fin k → Bool), ∑ b,
Real.exp (-(τ^2 * (e a + e b)^2 / 2)))^2energy_filter_unbalanced_spectral_entropy_asymptoticIn LeanStatistical Mechanics & Thermodynamics
The normalized eigenvalue Shannon entropy difference converges to (1/2) log(2 pi e V_k) - C as k tends to infinity.
theorem energy_filter_unbalanced_spectral_entropy_asymptotic
(a : ℤ → ℝ) (hsupp : (Function.support a).Finite) (ha : a ≠ 0)
(n m : ℕ → ℕ) (heven : ∀ k, Even (n k))
(hm_lt : ∀ k, 1 ≤ m k ∧ m k < n k)
(hm_inf : Filter.Tendsto m Filter.atTop Filter.atTop)
(hnm_inf : Filter.Tendsto (fun k => n k - m k) Filter.atTop Filter.atTop) :
let V : ℕ → ℝ := fun k => (m k : ℝ) * ((n k - m k : ℕ) : ℝ) / (4 * (n k : ℝ))
let C := energy_filter_fourier_entropy_constant a
Filter.Tendsto
(fun k =>
let l := n k - m k
let wA : (Fin (m k) → Bool) → ℤ := fun s => ∑ j : Fin (m k), if s j then 1 else 0
let wB : (Fin l → Bool) → ℤ := fun s => ∑ j : Fin l, if s j then 1 else 0
let M : Matrix (Fin (m k) → Bool) (Fin l → Bool) ℝ :=
fun sA sB => a ((n k : ℤ) / 2 - wA sA - wB sB)
let hR := Matrix.isHermitian_mul_conjTranspose_self M
let tr := ∑ s, hR.eigenvalues s
(∑ s, Real.negMulLog (hR.eigenvalues s / tr)) -
((1 / 2 : ℝ) * Real.log (2 * Real.pi * Real.exp 1 * V k) - C))
Filter.atTop (nhds 0)energy_filter_unbalanced_trace_asymptoticIn LeanStatistical Mechanics & Thermodynamics
For any nonzero finitely supported sequence a, the normalized trace of M M^T converges to the lattice sum S_2(a) as k tends to infinity.
theorem energy_filter_unbalanced_trace_asymptotic
(a : ℤ → ℝ) (hsupp : (Function.support a).Finite) (ha : a ≠ 0)
(n m : ℕ → ℕ) (heven : ∀ k, Even (n k))
(hm_inf : Filter.Tendsto m Filter.atTop Filter.atTop)
(hnm_inf : Filter.Tendsto (fun k => n k - m k) Filter.atTop Filter.atTop) :
Filter.Tendsto
(fun k =>
let l := n k - m k
let wA : (Fin (m k) → Bool) → ℤ := fun s => ∑ j : Fin (m k), if s j then 1 else 0
let wB : (Fin l → Bool) → ℤ := fun s => ∑ j : Fin l, if s j then 1 else 0
let M : Matrix (Fin (m k) → Bool) (Fin l → Bool) ℝ :=
fun sA sB => a ((n k : ℤ) / 2 - wA sA - wB sB)
Real.sqrt (Real.pi * (n k : ℝ) / 2) / ((2 : ℝ) ^ (n k)) * (M * M.transpose).trace)
Filter.atTop
(nhds (energy_filter_sequence_lattice_s2 a))energy_filter_unbalanced_von_neumann_assemblyIn LeanStatistical Mechanics & Thermodynamics
Assembles the spectral entropy convergence and eventual trace positivity to conclude convergence of the full reduced entropy energy_filter_reduced_entropy.
theorem energy_filter_unbalanced_von_neumann_assembly
(a : ℤ → ℝ) (n m : ℕ → ℕ)
(V : ℕ → ℝ) (C : ℝ)
(h_entropy_diff : Filter.Tendsto
(fun k =>
let l := n k - m k
let wA : (Fin (m k) → Bool) → ℤ := fun s => ∑ j : Fin (m k), if s j then 1 else 0
let wB : (Fin l → Bool) → ℤ := fun s => ∑ j : Fin l, if s j then 1 else 0
let M : Matrix (Fin (m k) → Bool) (Fin l → Bool) ℝ :=
fun sA sB => a ((n k : ℤ) / 2 - wA sA - wB sB)
let hR := Matrix.isHermitian_mul_conjTranspose_self M
let tr := ∑ s, hR.eigenvalues s
(∑ s, Real.negMulLog (hR.eigenvalues s / tr)) -
((1 / 2 : ℝ) * Real.log (2 * Real.pi * Real.exp 1 * V k) - C))
Filter.atTop (nhds 0))
(h_pos : Filter.Eventually
(fun k =>
let l := n k - m k
let wA : (Fin (m k) → Bool) → ℤ := fun s => ∑ j : Fin (m k), if s j then 1 else 0
let wB : (Fin l → Bool) → ℤ := fun s => ∑ j : Fin l, if s j then 1 else 0
let M : Matrix (Fin (m k) → Bool) (Fin l → Bool) ℝ :=
fun sA sB => a ((n k : ℤ) / 2 - wA sA - wB sB)
let hR := Matrix.isHermitian_mul_conjTranspose_self M
0 < ∑ s, hR.eigenvalues s)
Filter.atTop) :
Filter.Tendsto
(fun k => energy_filter_reduced_entropy a (n k) (m k) -
((1 / 2 : ℝ) * Real.log (2 * Real.pi * Real.exp 1 * V k) - C))
Filter.atTop (nhds 0)fin_pairing_sumIn LeanStatistical Mechanics & Thermodynamics
The sum over (Fin m)^4 of the pairing indicator (i1 = i3 ∧ i2 = i4) ∨ (i1 = i4 ∧ i2 = i3) equals 2 * m^2 - m.
theorem fin_pairing_sum (m : ℕ) :
(∑ i1 : Fin m, ∑ i2 : Fin m, ∑ i3 : Fin m, ∑ i4 : Fin m,
if (i1 = i3 ∧ i2 = i4) ∨ (i1 = i4 ∧ i2 = i3) then (1 : ℝ) else 0) =
2 * (m : ℝ)^2 - (m : ℝ)gaussian_lattice_sum_odd_shiftIn LeanStatistical Mechanics & Thermodynamics
The odd-integer lattice sum with parameter 2n-1 equals the odd sum with parameter 2j+1 via the index reflection j = -n.
theorem gaussian_lattice_sum_odd_shift (c : ℝ) :
(∑' (n : ℤ), Real.exp (- c * ((2 * n - 1 : ℤ) : ℝ)^2)) =
(∑' (j : ℤ), Real.exp (- c * ((2 * j + 1 : ℤ) : ℝ)^2))gaussian_lattice_sum_odd_splitIn LeanStatistical Mechanics & Thermodynamics
The sum of exp(-c (2j+1)^2) over odd integers equals the full Gaussian lattice sum over all integers minus the even sum sum_j exp(-4c j^2).
theorem gaussian_lattice_sum_odd_split (c : ℝ) (hc : 0 < c) :
(∑' (j : ℤ), Real.exp (- c * ((2 * j + 1 : ℤ) : ℝ)^2)) =
(∑' (k : ℤ), Real.exp (- c * (k : ℝ)^2)) - (∑' (j : ℤ), Real.exp (- 4 * c * (j : ℝ)^2))gaussian_lattice_sum_tendsto_zeroIn LeanStatistical Mechanics & Thermodynamics
The scaled 1D Gaussian lattice sum h sum_{n in Z} exp(-c h^2 n^2) converges to sqrt(pi / c) as h -> 0+ from above.
theorem gaussian_lattice_sum_tendsto_zero (c : ℝ) (hc : 0 < c) :
Filter.Tendsto (fun h : ℝ => h * ∑' (n : ℤ), Real.exp (- c * h^2 * (n : ℝ)^2))
(nhdsWithin 0 (Set.Ioi 0)) (nhds (Real.sqrt Real.pi / Real.sqrt c))hard_core_closed_neighborhood_bound_congrIn LeanStatistical Mechanics & Thermodynamics
For any two simple graphs G1 and G2 on a finite type V with decidable equality and vertex fugacities lam, if G1 = G2 then hardCoreClosedNeighborhoodBound G1 lam = hardCoreClosedNeighborhoodBound G2 lam.
theorem hard_core_closed_neighborhood_bound_congr {V : Type*} [Fintype V] [DecidableEq V]
(G1 G2 : SimpleGraph V) [DecidableRel G1.Adj] [DecidableRel G2.Adj] (h : G1 = G2)
(lam : V → ℝ) :
hardCoreClosedNeighborhoodBound G1 lam = hardCoreClosedNeighborhoodBound G2 lamhard_core_singleton_ge_closed_neighborhood_boundIn LeanStatistical Mechanics & Thermodynamics
For positive heterogeneous fugacities, the sum of squared occupancy probabilities divided by fugacities is at least the closed-neighborhood expression.
theorem hard_core_singleton_ge_closed_neighborhood_bound {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (lam : V → ℝ) (hlam : ∀ v, 0 < lam v) : hardCoreClosedNeighborhoodBound G lam ≤ hardCoreSingletonVarianceLowerBound G lamhard_core_var_size_congrIn LeanStatistical Mechanics & Thermodynamics
For any two simple graphs G1 and G2 on a finite type V with decidable equality and vertex fugacities lam, if G1 = G2 then hardCoreVarSize G1 lam = hardCoreVarSize G2 lam.
theorem hard_core_var_size_congr {V : Type*} [Fintype V] [DecidableEq V]
(G1 G2 : SimpleGraph V) [DecidableRel G1.Adj] [DecidableRel G2.Adj] (h : G1 = G2)
(lam : V → ℝ) :
hardCoreVarSize G1 lam = hardCoreVarSize G2 lamhard_core_variance_ge_singleton_and_cluster_equalityIn LeanStatistical Mechanics & Thermodynamics
For positive fugacities, the hard-core variance is at least the sum of squared occupancy probabilities divided by fugacities, with equality exactly on disjoint unions of cliques.
theorem hard_core_variance_ge_singleton_and_cluster_equality {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (lam : V → ℝ) (hlam : ∀ v, 0 < lam v) : hardCoreSingletonVarianceLowerBound G lam ≤ hardCoreVarSize G lam ∧ (hardCoreVarSize G lam = hardCoreSingletonVarianceLowerBound G lam ↔ ∀ c : G.ConnectedComponent, G.IsClique c.supp)ising_inverse_square_bulk_field_polynomial_at_most_one_nonpositive_rootIn LeanStatistical Mechanics & Thermodynamics
For every order n at least 2 and every representing polynomial P, any two complex zeros of P with real part at most 0 coincide.
theorem ising_inverse_square_bulk_field_polynomial_at_most_one_nonpositive_root (n : ℕ) (hn : 2 ≤ n) (P : Polynomial ℝ) (hP : ising_inverse_square_bulk_field_polynomial n P) : ∀ z w : ℂ, (P.map (algebraMap ℝ ℂ)).IsRoot z → (P.map (algebraMap ℝ ℂ)).IsRoot w → z.re ≤ 0 → w.re ≤ 0 → z = w
ising_inverse_square_bulk_field_polynomial_eval_oneIn LeanStatistical Mechanics & Thermodynamics
For every order n at least 2 and every representing polynomial P, P evaluated at 1 is 0.
theorem ising_inverse_square_bulk_field_polynomial_eval_one (n : ℕ) (hn : 2 ≤ n) (P : Polynomial ℝ) (hP : ising_inverse_square_bulk_field_polynomial n P) : P.eval 1 = 0
ising_inverse_square_bulk_field_polynomial_existsIn LeanStatistical Mechanics & Thermodynamics
For every natural number n at least 2 there is a real polynomial P such that at every real field h the finite-ring order-n coefficients tend to P(tanh(h)^2) as the ring size tends to infinity.
theorem ising_inverse_square_bulk_field_polynomial_exists (n : ℕ) (hn : 2 ≤ n) : ∃ P : Polynomial ℝ, ising_inverse_square_bulk_field_polynomial n P
ising_inverse_square_bulk_field_polynomial_leading_coefficientIn LeanStatistical Mechanics & Thermodynamics
For every order n at least 1 and every real polynomial P representing the order-n bulk field coefficient, the coefficient of y^n in P is (-1)^(n+1)/(2n(2n+1)).
theorem ising_inverse_square_bulk_field_polynomial_leading_coefficient (n : ℕ) (hn : 1 ≤ n) (P : Polynomial ℝ) (hP : ising_inverse_square_bulk_field_polynomial n P) : P.coeff n = (-1 : ℝ) ^ (n + 1) / ((2 * (n : ℝ)) * (2 * (n : ℝ) + 1))
ising_inverse_square_bulk_field_polynomial_ne_zeroIn LeanStatistical Mechanics & Thermodynamics
For every order n at least 2, every real polynomial representing the order-n bulk field coefficient is nonzero.
theorem ising_inverse_square_bulk_field_polynomial_ne_zero (n : ℕ) (hn : 2 ≤ n) (P : Polynomial ℝ) (hP : ising_inverse_square_bulk_field_polynomial n P) : P ≠ 0
ising_inverse_square_bulk_field_polynomial_roots_le_oneIn LeanStatistical Mechanics & Thermodynamics
For every order n at least 2 and every representing polynomial P, every complex zero of P has real part at most 1.
theorem ising_inverse_square_bulk_field_polynomial_roots_le_one (n : ℕ) (hn : 2 ≤ n) (P : Polynomial ℝ) (hP : ising_inverse_square_bulk_field_polynomial n P) : ∀ z : ℂ, (P.map (algebraMap ℝ ℂ)).IsRoot z → z.re ≤ 1
ising_inverse_square_bulk_field_polynomial_roots_realIn LeanStatistical Mechanics & Thermodynamics
For every order n at least 2 and every representing polynomial P, every complex zero of P is real.
theorem ising_inverse_square_bulk_field_polynomial_roots_real (n : ℕ) (hn : 2 ≤ n) (P : Polynomial ℝ) (hP : ising_inverse_square_bulk_field_polynomial n P) : ∀ z : ℂ, (P.map (algebraMap ℝ ℂ)).IsRoot z → z.im = 0
ising_inverse_square_bulk_field_polynomial_roots_simpleIn LeanStatistical Mechanics & Thermodynamics
For every order n at least 2 and every representing polynomial P, the derivative of P does not vanish at any complex zero of P.
theorem ising_inverse_square_bulk_field_polynomial_roots_simple (n : ℕ) (hn : 2 ≤ n) (P : Polynomial ℝ) (hP : ising_inverse_square_bulk_field_polynomial n P) : ∀ z : ℂ, (P.map (algebraMap ℝ ℂ)).IsRoot z → (P.map (algebraMap ℝ ℂ)).derivative.eval z ≠ 0
ising_inverse_square_bulk_field_polynomial_uniqueIn LeanStatistical Mechanics & Thermodynamics
At each order there is at most one real polynomial representing the bulk field coefficient at every real field.
theorem ising_inverse_square_bulk_field_polynomial_unique (n : ℕ) (P Q : Polynomial ℝ) (hP : ising_inverse_square_bulk_field_polynomial n P) (hQ : ising_inverse_square_bulk_field_polynomial n Q) : P = Q
ising_inverse_square_ring_coefficient_two_formulaIn LeanStatistical Mechanics & Thermodynamics
For each natural ring size L at least 2 and each real field h, the second coupling coefficient of the finite-ring reduced free energy equals (1-y²)b/4 + y(1-y)(a²-b)/2, where y=tanh(h)², a=(1-L⁻²)/3, and b=(1+10L⁻²-11L⁻⁴)/45.
theorem ising_inverse_square_ring_coefficient_two_formula (L : ℕ) (hL : 2 ≤ L) (h : ℝ) :
ising_inverse_square_ring_coefficient 2 L h =
let u : ℝ := (L : ℝ)⁻¹
let a := (1-u^2)/3
let b := (1+10*u^2-11*u^4)/45
let y := (Real.tanh h)^2
(1-y^2)/4*b + y*(1-y)/2*(a^2-b)ising_inverse_square_ring_coefficient_zeroIn LeanStatistical Mechanics & Thermodynamics
For every ring size L at least 1 and every real h, the zeroth coupling coefficient of the finite-ring reduced free energy equals log(2 cosh h).
theorem ising_inverse_square_ring_coefficient_zero (L : ℕ) (hL : 1 ≤ L) (h : ℝ) : ising_inverse_square_ring_coefficient 0 L h = Real.log (2 * Real.cosh h)
ising_inverse_square_ring_energy_half_sumIn LeanStatistical Mechanics & Thermodynamics
For every spin configuration, the ordered interaction energy sum over i with i.val < j.val equals one half of the symmetric double sum over all distinct pairs.
theorem ising_inverse_square_ring_energy_half_sum (L : ℕ) (s : Fin L → Bool) : (∑ i : Fin L, ∑ j : Fin L, if i.val < j.val then ising_inverse_square_ring_kernel L i j * ising_ring_spin (s i) * ising_ring_spin (s j) else 0) = (1/2) * (∑ i : Fin L, ∑ j : Fin L, if i ≠ j then ising_inverse_square_ring_kernel L i j * ising_ring_spin (s i) * ising_ring_spin (s j) else 0)
ising_inverse_square_ring_kernel_symmIn LeanStatistical Mechanics & Thermodynamics
The periodized inverse-square ring kernel is symmetric in its two sites.
theorem ising_inverse_square_ring_kernel_symm (L : ℕ) (i j : Fin L) : ising_inverse_square_ring_kernel L i j = ising_inverse_square_ring_kernel L j i
ising_two_layer_abs_div_sub_leIn LeanStatistical Mechanics & Thermodynamics
If |y − K| < ε₁ ≤ K/2 and |x − K·T| < ε₂ then |x/y − T| ≤ (2/K)(ε₂ + |T|·ε₁).
theorem ising_two_layer_abs_div_sub_le (x y T K ε₁ ε₂ : ℝ) (hK : 0 < K) (hε₁ : ε₁ ≤ K / 2)
(hy : |y - K| < ε₁) (hx : |x - K * T| < ε₂) :
|x / y - T| ≤ (2 / K) * (ε₂ + |T| * ε₁)ising_two_layer_bad_fraction_eq_deviation_fractionIn LeanStatistical Mechanics & Thermodynamics
The bad fraction of the two-layer Gibbs expectation equals the deviation fraction of E_0[tilt·f]/E_0[tilt] from the quartic expectation T.
theorem ising_two_layer_bad_fraction_eq_deviation_fraction (d n : ℕ) (c ε : ℝ) (f : BoundedContinuousFunction (ℝ × ℝ) ℝ) :
ising_two_layer_bad_fraction d n c ε f =
ising_two_layer_deviation_fraction d n ε (fun p => ising_two_layer_uncoupled_expectation d n p.1 p.2 (fun σ τ => ising_two_layer_tilt n c σ τ * f (ising_two_layer_observable n σ τ)) / ising_two_layer_uncoupled_expectation d n p.1 p.2 (ising_two_layer_tilt n c) - ising_two_layer_quartic_expectation d c f)ising_two_layer_deviation_fraction_le_addIn LeanStatistical Mechanics & Thermodynamics
If on every regular pair with |Φ| ≥ ε either |Ψ₁| ≥ ε₁ or |Ψ₂| ≥ ε₂, then the Φ-deviation fraction is at most the sum of the Ψ₁- and Ψ₂-deviation fractions.
theorem ising_two_layer_deviation_fraction_le_add (d n : ℕ) (ε ε₁ ε₂ : ℝ)
(Φ Ψ₁ Ψ₂ : SimpleGraph (Fin n) × SimpleGraph (Fin n) → ℝ)
(h : ∀ p, p ∈ ising_regular_pair_base d n → ε ≤ |Φ p| → ε₁ ≤ |Ψ₁ p| ∨ ε₂ ≤ |Ψ₂ p|) :
ising_two_layer_deviation_fraction d n ε Φ ≤
ising_two_layer_deviation_fraction d n ε₁ Ψ₁ + ising_two_layer_deviation_fraction d n ε₂ Ψ₂ising_two_layer_gibbs_expectation_eq_uncoupled_tilt_ratioIn LeanStatistical Mechanics & Thermodynamics
The two-layer Gibbs expectation equals E_0[tilt·f(obs)] / E_0[tilt], where E_0 is the product of the two single-layer Gibbs laws.
theorem ising_two_layer_gibbs_expectation_eq_uncoupled_tilt_ratio (d n : ℕ) (c : ℝ) (G H : SimpleGraph (Fin n)) (f : BoundedContinuousFunction (ℝ × ℝ) ℝ) :
ising_two_layer_gibbs_expectation d n c G H f =
ising_two_layer_uncoupled_expectation d n G H (fun σ τ => ising_two_layer_tilt n c σ τ * f (ising_two_layer_observable n σ τ)) /
ising_two_layer_uncoupled_expectation d n G H (ising_two_layer_tilt n c)ising_two_layer_gibbs_expectation_mem_IccIn LeanStatistical Mechanics & Thermodynamics
If the test function f takes values in [lo,hi] then its two-layer Gibbs expectation also lies in [lo,hi].
theorem ising_two_layer_gibbs_expectation_mem_Icc (d n : ℕ) (c : ℝ) (G H : SimpleGraph (Fin n)) (f : BoundedContinuousFunction (ℝ × ℝ) ℝ) {lo hi : ℝ} (hlo : ∀ x, lo ≤ f x) (hhi : ∀ x, f x ≤ hi) :
lo ≤ ising_two_layer_gibbs_expectation d n c G H f ∧ ising_two_layer_gibbs_expectation d n c G H f ≤ hiising_two_layer_ratio_boundIn LeanStatistical Mechanics & Thermodynamics
If B is within K/2 of K > 0, then the error |A/B - T| of the ratio is bounded by (2/K) times the sum of the numerator perturbation |A - K*T| and |T| times the denominator perturbation |B - K|.
theorem ising_two_layer_ratio_bound (A B K T : ℝ) (hK : 0 < K)
(hB : |B - K| < K / 2) :
|A / B - T| ≤ (2 / K) * (|A - K * T| + |T| * |B - K|)ising_two_layer_tilt_convergesIn LeanStatistical Mechanics & Thermodynamics
Quenched two-layer tilt crossover: there is a positive constant K (depending only on d and c) such that, over a uniformly random ordered pair of d-regular graphs, both E_0[exp(c n^{-1/2}⟨σ,τ⟩) f(x,y)] − K·(quartic expectation of f) and E_0[exp(c n^{-1/2}⟨σ,τ⟩)] − K tend to 0 in probability, along n with d·n even.
theorem ising_two_layer_tilt_converges (d : ℕ) (hd : 3 ≤ d) (c : ℝ) (hc : 0 ≤ c) :
∃ K : ℝ, 0 < K ∧ ∀ (f : BoundedContinuousFunction (ℝ × ℝ) ℝ) (ε δ : ℝ), 0 < ε → 0 < δ →
∃ N : ℕ, ∀ n : ℕ, N ≤ n → Even (d * n) →
ising_two_layer_deviation_fraction d n ε (fun p => ising_two_layer_uncoupled_expectation d n p.1 p.2 (fun σ τ => ising_two_layer_tilt n c σ τ * f (ising_two_layer_observable n σ τ)) - K * ising_two_layer_quartic_expectation d c f) < δ ∧
ising_two_layer_deviation_fraction d n ε (fun p => ising_two_layer_uncoupled_expectation d n p.1 p.2 (ising_two_layer_tilt n c) - K) < δising_two_layer_uncoupled_expectation_const_oneIn LeanStatistical Mechanics & Thermodynamics
The uncoupled reference measure is normalized: E_0[1] = 1.
theorem ising_two_layer_uncoupled_expectation_const_one (d n : ℕ) (G H : SimpleGraph (Fin n)) :
ising_two_layer_uncoupled_expectation d n G H (fun _ _ => 1) = 1ising_two_layer_weak_matching_of_tilt_convergenceIn LeanStatistical Mechanics & Thermodynamics
Given the tilt-convergence input at a positive constant K, the quartic crossover holds: the bad fraction of the two-layer Gibbs expectation tends to 0 in probability.
theorem ising_two_layer_weak_matching_of_tilt_convergence
(d : ℕ) (hd : 3 ≤ d) (c : ℝ) (hc : 0 ≤ c) (K : ℝ) (hK : 0 < K)
(hconv : ∀ (f : BoundedContinuousFunction (ℝ × ℝ) ℝ) (ε δ : ℝ), 0 < ε → 0 < δ →
∃ N : ℕ, ∀ n : ℕ, N ≤ n → Even (d * n) →
ising_two_layer_deviation_fraction d n ε (fun p => ising_two_layer_uncoupled_expectation d n p.1 p.2 (fun σ τ => ising_two_layer_tilt n c σ τ * f (ising_two_layer_observable n σ τ)) - K * ising_two_layer_quartic_expectation d c f) < δ ∧
ising_two_layer_deviation_fraction d n ε (fun p => ising_two_layer_uncoupled_expectation d n p.1 p.2 (ising_two_layer_tilt n c) - K) < δ) :
∀ (f : BoundedContinuousFunction (ℝ × ℝ) ℝ) (ε δ : ℝ), 0 < ε → 0 < δ →
∃ N : ℕ, ∀ n : ℕ, N ≤ n → Even (d * n) → ising_two_layer_bad_fraction d n c ε f < δising_two_layer_weight_factorizesIn LeanStatistical Mechanics & Thermodynamics
The two-layer Gibbs weight factors as w_G(σ)·w_H(τ)·tilt(σ,τ): the product of the two critical single-layer weights and the overlap tilt.
theorem ising_two_layer_weight_factorizes (d n : ℕ) (c : ℝ) (G H : SimpleGraph (Fin n)) (σ τ : Fin n → Bool) :
ising_two_layer_weight d n c G H σ τ =
ising_single_layer_gibbs_weight d n G σ * ising_single_layer_gibbs_weight d n H τ * ising_two_layer_tilt n c σ τlift20_variance_crossover_existsIn LeanStatistical Mechanics & Thermodynamics
For every upper endpoint x_end strictly greater than the crossover root petersen_lift20_crossover_root, there exists an activity x in (0, x_end] where the per-vertex variance of the 20-vertex Petersen 2-lift is strictly less than that of the Petersen graph.
theorem lift20_variance_crossover_exists (x_end : ℝ) (h : petersen_lift20_crossover_root < x_end) :
∃ x : ℝ, 0 < x ∧ x ≤ x_end ∧ lift20_poly_variance_per_vertex x < petersen_poly_variance_per_vertex xop_1340_closed_neighborhood_bound_component_sumIn LeanStatistical Mechanics & Thermodynamics
For any finite simple graph G and vertex fugacities lam, hardCoreClosedNeighborhoodBound G lam is the sum over connected components c of hardCoreClosedNeighborhoodBound on G.induce c.supp.
theorem op_1340_closed_neighborhood_bound_component_sum
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(lam : V → ℝ) :
hardCoreClosedNeighborhoodBound G lam =
open scoped Classical in
∑ c : G.ConnectedComponent,
hardCoreClosedNeighborhoodBound (G.induce c.supp) (fun v => lam v.val)op_1340_connected_closed_neighborhood_variance_boundIn LeanStatistical Mechanics & Thermodynamics
For any connected finite simple graph G and positive vertex fugacities lam, the hard-core variance hardCoreVarSize G lam is at least hardCoreClosedNeighborhoodBound G lam, with equality if and only if G is a clique.
theorem op_1340_connected_closed_neighborhood_variance_bound
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(lam : V → ℝ) (hlam : ∀ v, 0 < lam v) (hconn : G.Connected) :
hardCoreClosedNeighborhoodBound G lam ≤ hardCoreVarSize G lam ∧
(hardCoreVarSize G lam = hardCoreClosedNeighborhoodBound G lam ↔
G.IsClique Set.univ)op_1340_connected_component_induce_connectedIn LeanStatistical Mechanics & Thermodynamics
For any simple graph G on type V and any connected component c of G, the induced subgraph on c.supp is connected.
theorem op_1340_connected_component_induce_connected
{V : Type*} (G : SimpleGraph V) (c : G.ConnectedComponent) :
(G.induce c.supp).Connectedop_1340_var_size_component_sumIn LeanStatistical Mechanics & Thermodynamics
For any finite simple graph G and positive fugacities lam, the variance hardCoreVarSize G lam is the sum over connected components c of hardCoreVarSize on G.induce c.supp.
theorem op_1340_var_size_component_sum
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(lam : V → ℝ) (hlam : ∀ v, 0 < lam v) :
hardCoreVarSize G lam =
open scoped Classical in
∑ c : G.ConnectedComponent,
hardCoreVarSize (G.induce c.supp) (fun v => lam v.val)op_1354_triangle_free_cubic_petersen_variance_lower_boundIn LeanStatistical Mechanics & Thermodynamics
For every nonempty finite simple triangle-free cubic graph G and every activity x with 0 < x ≤ petersen_lift20_crossover_root, the per-vertex hard-core variance hardCoreVarSize G (fun _ => x) / |V(G)| is at least hardCoreVarSize petersen_graph (fun _ => x) / 10.
theorem op_1354_triangle_free_cubic_petersen_variance_lower_bound :
letI : DecidableRel petersen_graph.Adj := fun s t => inferInstanceAs (Decidable (Disjoint s.1 t.1))
∀ {V : Type} [Fintype V] [Nonempty V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hreg : G.IsRegularOfDegree 3) (htri : G.CliqueFree 3) (x : ℝ)
(hx_pos : 0 < x) (hx_le : x ≤ petersen_lift20_crossover_root),
hardCoreVarSize petersen_graph (fun _ => x) / 10 ≤
hardCoreVarSize G (fun _ => x) / (Fintype.card V : ℝ)op_1355_claw_free_local_partition_quadraticIn LeanStatistical Mechanics & Thermodynamics
For a claw-free graph and nonnegative vertex activities, the independent-set partition function of any open neighborhood is at most the square of one plus its activity sum.
open scoped Classical BigOperators in
theorem op_1355_claw_free_local_partition_quadratic
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hclaw : IsClawFree G) (c : V) (lam : V → ℝ) (hlam : ∀ x, 0 ≤ lam x) :
(∑ I ∈ (G.neighborFinset c).powerset.filter (fun I => G.IsIndepSet (I : Set V)), ∏ x ∈ I, lam x) ≤
(1 + ∑ x ∈ G.neighborFinset c, lam x)^2op_1355_claw_free_single_vertex_boundIn LeanStatistical Mechanics & Thermodynamics
For any claw-free graph and positive vertex activities, the weighted local variance bound holds when the observable counts one specified vertex.
open scoped Classical BigOperators in
theorem op_1355_claw_free_single_vertex_bound
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hclaw : IsClawFree G) (lam : V → ℝ) (hlam : ∀ x, 0 < lam x) (c : V) :
hardCoreWeightedClosedNeighborhoodBound G lam (fun x => if x = c then 1 else 0) ≤
hardCoreWeightedVar G lam (fun x => if x = c then 1 else 0)petersen_lift20_graph_existsIn LeanStatistical Mechanics & Thermodynamics
There exists a 20-vertex simple graph G (the Petersen 2-lift / dodecahedron) with decidable adjacency which is 3-regular, triangle-free, and whose per-vertex hard-core variance equals lift20_poly_variance_per_vertex x for all activities x.
theorem petersen_lift20_graph_exists :
∃ (G : SimpleGraph (Fin 20)) (_ : DecidableRel G.Adj),
G.IsRegularOfDegree 3 ∧ G.CliqueFree 3 ∧
∀ x : ℝ, hardCoreVarSize G (fun _ => x) / 20 = lift20_poly_variance_per_vertex xpolynomial_alternating_coeffs_at_most_one_nonpositive_rootIn LeanStatistical Mechanics & Thermodynamics
If the coefficients p_0,...,p_n of a real polynomial are all nonzero and alternate in sign, then for every strictly negative y the polynomial's values alternate in sign with...
theorem polynomial_alternating_coeffs_at_most_one_nonpositive_root (P : Polynomial ℝ) (n : ℕ) (hdeg : P.natDegree = n) (hne : ∀ m : ℕ, m ≤ n → P.coeff m ≠ 0) (halt : ∀ m : ℕ, m + 1 ≤ n → (P.coeff (m + 1) < 0 ↔ 0 < P.coeff m)) : ∀ x y : ℝ, x ≤ 0 → y ≤ 0 → P.eval x = 0 → P.eval y = 0 → x = y
polynomial_alternating_nonconstant_coeffs_at_most_one_nonpositive_rootIn LeanStatistical Mechanics & Thermodynamics
If the nonconstant coefficients of a real polynomial alternate in sign (starting positive at degree 1) and the constant term is nonzero, then the polynomial has at most one root on (-infinity, 0].
theorem polynomial_alternating_nonconstant_coeffs_at_most_one_nonpositive_root (P : Polynomial ℝ) (n : ℕ) (hdeg : P.natDegree ≤ n) (h0 : P.coeff 0 ≠ 0) (h1 : P.coeff 1 ≠ 0) (halt : ∀ m : ℕ, 1 ≤ m → m + 1 ≤ n → (P.coeff (m + 1) < 0 ↔ 0 < P.coeff m)) : ∀ x y : ℝ, x ≤ 0 → y ≤ 0 → P.eval x = 0 → P.eval y = 0 → x = y
rademacher_autocorr_energy_eq_shift_sumIn LeanStatistical Mechanics & Thermodynamics
The aperiodic autocorrelation energy equals the three-index signed sum sum_{u,v,w} a(u) a(v) a(w) a(u+w-v).
theorem rademacher_autocorr_energy_eq_shift_sum (m : ℕ) (s : Fin m → Bool) :
rademacher_autocorr_energy m s =
∑ u ∈ Finset.range m, ∑ v ∈ Finset.range m, ∑ w ∈ Finset.range m,
rademacher_filter m s (u : ℤ) * rademacher_filter m s (v : ℤ) *
rademacher_filter m s (w : ℤ) * rademacher_filter m s ((u : ℤ) + (w : ℤ) - (v : ℤ))rademacher_autocorr_energy_expectedIn LeanStatistical Mechanics & Thermodynamics
For any positive integer m, the uniform expectation of rademacher_autocorr_energy m s over s : Fin m → Bool equals 2 * m^2 - m.
theorem rademacher_autocorr_energy_expected (m : ℕ) (hm : 0 < m) :
rademacher_expect m (fun s => rademacher_autocorr_energy m s) = 2 * (m : ℝ)^2 - (m : ℝ)rademacher_autocorr_energy_ge_sqIn LeanStatistical Mechanics & Thermodynamics
The autocorrelation energy is at least m^2 (the zero-shift term alone contributes m^2).
theorem rademacher_autocorr_energy_ge_sq (m : ℕ) (s : Fin m → Bool) :
(m : ℝ) ^ 2 ≤ rademacher_autocorr_energy m srademacher_autocorr_energy_mean_sq_tendstoIn LeanStatistical Mechanics & Thermodynamics
The uniform expectation of (rademacher_autocorr_energy m s / m^2 - 2)^2 converges to 0 as m tends to infinity.
theorem rademacher_autocorr_energy_mean_sq_tendsto :
Filter.Tendsto
(fun m : ℕ => rademacher_expect m (fun s => (rademacher_autocorr_energy m s / ((m : ℝ)^2) - 2)^2))
Filter.atTop
(nhds 0)rademacher_autocorr_energy_tendstoIn LeanStatistical Mechanics & Thermodynamics
For any δ > 0, the probability under uniform Rademacher signs that |rademacher_autocorr_energy m s / m^2 - 2| > δ tends to 0 as m tends to infinity.
theorem rademacher_autocorr_energy_tendsto (δ : ℝ) (hδ : 0 < δ) :
Filter.Tendsto
(fun m : ℕ => rademacher_prob m (fun s => δ < |rademacher_autocorr_energy m s / ((m : ℝ)^2) - 2|))
Filter.atTop
(nhds 0)rademacher_autocorr_energy_uniform_quadratic_boundIn LeanStatistical Mechanics & Thermodynamics
There is a constant C with rademacher_autocorr_energy m s / m^2 <= C for all m and all sign configurations s.
theorem rademacher_autocorr_energy_uniform_quadratic_bound :
∃ C : ℝ, 0 < C ∧ ∀ (m : ℕ) (s : Fin m → Bool),
rademacher_autocorr_energy m s / ((m : ℝ) ^ 2) ≤ Crademacher_expect_four_sign_productIn LeanStatistical Mechanics & Thermodynamics
For any four indices in Fin m summing to the same total, the uniform expectation of their sign product is 1 if they pair up and 0 otherwise.
theorem rademacher_expect_four_sign_product (m : ℕ) (i1 i2 i3 i4 : Fin m)
(h_sum : i1.val + i2.val = i3.val + i4.val) :
rademacher_expect m (fun s =>
(if s i1 = true then (1 : ℝ) else -1) *
(if s i2 = true then (1 : ℝ) else -1) *
(if s i3 = true then (1 : ℝ) else -1) *
(if s i4 = true then (1 : ℝ) else -1)) =
if (i1 = i3 ∧ i2 = i4) ∨ (i1 = i4 ∧ i2 = i3) then 1 else 0rademacher_expect_prod_apply_factorizationIn LeanStatistical Mechanics & Thermodynamics
For any family of univariate real functions f j : Bool → ℝ indexed by the coordinates j : Fin m, the uniform expectation over the Boolean cube of the product of the coordinate values factorizes: E[∏_j f j (s j)] = ∏_j ((f j true + f j false) / 2).
theorem rademacher_expect_prod_apply_factorization (m : ℕ) (f : (j : Fin m) → Bool → ℝ) :
rademacher_expect m (fun s => ∏ j, f j (s j)) =
∏ j, ((f j true + f j false) / 2)rademacher_expect_sq_sub_constIn LeanStatistical Mechanics & Thermodynamics
For any real random variable X on the Boolean cube Fin m → Bool and any real constant c, the uniform mean squared deviation expands as E[(X - c)^2] = E[X^2] - 2 c E[X] + c^2 (linearity of the uniform expectation together with E[1] = 1).
theorem rademacher_expect_sq_sub_const (m : ℕ) (X : (Fin m → Bool) → ℝ) (c : ℝ) :
rademacher_expect m (fun s => (X s - c) ^ 2) =
rademacher_expect m (fun s => X s ^ 2) - 2 * c * rademacher_expect m X + c ^ 2rademacher_expect_sumIn LeanStatistical Mechanics & Thermodynamics
The uniform expectation over sign configurations distributes over finite sums.
theorem rademacher_expect_sum {ι : Type*} [Fintype ι] (m : ℕ) (F : ι → (Fin m → Bool) → ℝ) :
rademacher_expect m (fun s => ∑ i : ι, F i s) = ∑ i : ι, rademacher_expect m (fun s => F i s)rademacher_filter_abs_and_supportIn LeanStatistical Mechanics & Thermodynamics
A Rademacher filter takes values in {1, -1} on its window 0 <= j < m and vanishes outside it.
theorem rademacher_filter_abs_and_support (m : ℕ) (s : Fin m → Bool) :
(∀ j : ℤ, |rademacher_filter m s j| ≤ 1) ∧
(∀ j : ℤ, rademacher_filter m s j ≠ 0 → 0 ≤ j ∧ j < (m : ℤ))rademacher_filter_expect_prod_fourIn LeanStatistical Mechanics & Thermodynamics
For four integers i₁, i₂, i₃, i₄ inside the window of the Rademacher filter, the uniform expectation of the product of the four filter entries is 1 if the four positions split into two equal pairs — that is, if (i₁ = i₂ ∧ i₃ = i₄) or (i₁ = i₃ ∧ i₂ = i₄) or (i₁ = i₄ ∧ i₂ = i₃), equivalently if every position is hit an even number of times — and 0 otherwise. No hypothesis relating the sum i₁ + i₂ to i₃ + i₄ is needed; the three-way disjunction is the general condition.
theorem rademacher_filter_expect_prod_four (m : ℕ) (i₁ i₂ i₃ i₄ : ℤ)
(h₁ : 0 ≤ i₁ ∧ i₁ < (m : ℤ)) (h₂ : 0 ≤ i₂ ∧ i₂ < (m : ℤ))
(h₃ : 0 ≤ i₃ ∧ i₃ < (m : ℤ)) (h₄ : 0 ≤ i₄ ∧ i₄ < (m : ℤ)) :
rademacher_expect m (fun s =>
rademacher_filter m s i₁ * rademacher_filter m s i₂ *
rademacher_filter m s i₃ * rademacher_filter m s i₄)
= if (i₁ = i₂ ∧ i₃ = i₄) ∨ (i₁ = i₃ ∧ i₂ = i₄) ∨ (i₁ = i₄ ∧ i₂ = i₃)
then 1 else 0rademacher_filter_pair_expectIn LeanStatistical Mechanics & Thermodynamics
For two integers j and l inside the window of the Rademacher filter (0 ≤ j, l < m), the uniform expectation of the product of the two filter entries is 1 if j = l and 0 otherwise: distinct Rademacher coordinates are orthogonal, equal ones are perfectly correlated.
theorem rademacher_filter_pair_expect (m : ℕ) (j l : ℤ)
(hj : 0 ≤ j ∧ j < (m : ℤ)) (hl : 0 ≤ l ∧ l < (m : ℤ)) :
rademacher_expect m (fun s => rademacher_filter m s j * rademacher_filter m s l)
= if j = l then 1 else 0rademacher_filter_purity_denom_eq_window_sumIn LeanStatistical Mechanics & Thermodynamics
The purity denominator for a Rademacher filter collapses to the deterministic sum over its window of C(4k, 2k-j), independent of the sign configuration.
theorem rademacher_filter_purity_denom_eq_window_sum (m : ℕ) (s : Fin m → Bool) (k : ℕ) :
(∑ p ∈ Finset.range (2 * k + 1), ∑ q ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) * (Nat.choose (2 * k) q : ℝ) *
(rademacher_filter m s (2 * (k : ℤ) - (p : ℤ) - (q : ℤ))) ^ 2)
= ∑ j ∈ (Finset.range m).filter (fun j => j ≤ 2 * k),
(Nat.choose (4 * k) (2 * k - j) : ℝ)rademacher_filter_purity_denominator_asymptoticIn LeanStatistical Mechanics & Thermodynamics
For c > 0 and m_k = floor(c √(4k)), the window sum Σ_{j < m_k} C(4k, 2k - j), normalised by C(4k, 2k) √k, converges to the interval integral ∫_0^{2c} exp(-y²/2) dy. Equivalently, the ratio (Σ_{j<m_k} C(4k,2k-j)) / C(4k,2k) grows like √k times that integral; m_k/√k tends to 2c, so [0, m_k/√k] exhausts [0, 2c] at the CLT scale j = O(√k).
theorem rademacher_filter_purity_denominator_asymptotic
(c : ℝ) (hc : 0 < c) :
Filter.Tendsto
(fun k : ℕ =>
(∑ j ∈ Finset.range (Nat.floor (c * Real.sqrt (4 * (k : ℝ)))),
(Nat.choose (4 * k) (2 * k - j) : ℝ)) /
((Nat.choose (4 * k) (2 * k) : ℝ) * Real.sqrt (k : ℝ)))
Filter.atTop
(nhds (∫ y in (0 : ℝ)..(2 * c), Real.exp (- y ^ 2 / 2)))rademacher_filter_purity_mean_tendstoIn LeanStatistical Mechanics & Thermodynamics
For c > 0, the uniform mean over sign configurations of the scaled purity √(4k) * Tr(rho_n^2) of the random signed energy filter with m_k = floor(c √(4k)) Rademacher signs on n = 4k spins converges to the critical purity constant energy_filter_critical_purity_constant c.
theorem rademacher_filter_purity_mean_tendsto
(c : ℝ) (hc : 0 < c) :
Filter.Tendsto
(fun k : ℕ => rademacher_expect
(Nat.floor (c * Real.sqrt (4 * (k : ℝ))))
(fun s => Real.sqrt (4 * (k : ℝ)) *
energy_filter_sequence_purity
(rademacher_filter (Nat.floor (c * Real.sqrt (4 * (k : ℝ)))) s) k))
Filter.atTop
(nhds (energy_filter_critical_purity_constant c))rademacher_filter_purity_numer_uniform_decouplingIn LeanStatistical Mechanics & Thermodynamics
Uniformly over all 2^m sign configurations, the purity numerator (the four-fold cyclic binomial-weighted a-product sum) equals the Franel sum times the autocorrelation energy up to a vanishing relative error.
theorem rademacher_filter_purity_numer_uniform_decoupling
(m : ℕ → ℕ) (hm_pos : ∀ k, 0 < m k)
(hm_top : Filter.Tendsto (fun k => (m k : ℝ)) Filter.atTop Filter.atTop)
(hm_sub : Filter.Tendsto (fun k => (m k : ℝ) / Real.sqrt (4 * (k : ℝ))) Filter.atTop (nhds 0))
(η : ℝ) (hη : 0 < η) :
∀ᶠ k in Filter.atTop, ∀ s : Fin (m k) → Bool,
|(∑ p ∈ Finset.range (2 * k + 1), ∑ q ∈ Finset.range (2 * k + 1),
∑ r ∈ Finset.range (2 * k + 1), ∑ t ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) * (Nat.choose (2 * k) q : ℝ) *
(Nat.choose (2 * k) r : ℝ) * (Nat.choose (2 * k) t : ℝ) *
(rademacher_filter (m k) s (2 * (k : ℤ) - (p : ℤ) - (q : ℤ)) *
rademacher_filter (m k) s (2 * (k : ℤ) - (q : ℤ) - (r : ℤ)) *
rademacher_filter (m k) s (2 * (k : ℤ) - (r : ℤ) - (t : ℤ)) *
rademacher_filter (m k) s (2 * (k : ℤ) - (t : ℤ) - (p : ℤ)))) -
(∑ p ∈ Finset.range (2 * k + 1), (Nat.choose (2 * k) p : ℝ) ^ 4) *
rademacher_autocorr_energy (m k) s| ≤
η * (∑ p ∈ Finset.range (2 * k + 1), (Nat.choose (2 * k) p : ℝ) ^ 4) *
rademacher_autocorr_energy (m k) srademacher_filter_purity_second_moment_tendstoIn LeanStatistical Mechanics & Thermodynamics
For c > 0, the uniform second moment over sign configurations of the scaled purity √(4k) * Tr(rho_n^2) of the random signed energy filter with m_k = floor(c √(4k)) Rademacher signs on n = 4k spins converges to the square of the critical purity constant energy_filter_critical_purity_constant c. Together with the mean limit this says the scaled purity concentrates around K(c).
theorem rademacher_filter_purity_second_moment_tendsto
(c : ℝ) (hc : 0 < c) :
Filter.Tendsto
(fun k : ℕ => rademacher_expect
(Nat.floor (c * Real.sqrt (4 * (k : ℝ))))
(fun s => (Real.sqrt (4 * (k : ℝ)) *
energy_filter_sequence_purity
(rademacher_filter (Nat.floor (c * Real.sqrt (4 * (k : ℝ)))) s) k) ^ 2))
Filter.atTop
(nhds (energy_filter_critical_purity_constant c ^ 2))rademacher_filter_sq_indicatorIn LeanStatistical Mechanics & Thermodynamics
For any m, any sign configuration s : Fin m → Bool and any integer j, the square of the Rademacher filter entry rademacher_filter m s j is 1 when 0 ≤ j < m and 0 otherwise. In particular every entry lies in {-1, 0, 1} and the square of the filter is the indicator function of its supporting window.
theorem rademacher_filter_sq_indicator (m : ℕ) (s : Fin m → Bool) (j : ℤ) :
rademacher_filter m s j ^ 2 = if 0 ≤ j ∧ j < (m : ℤ) then 1 else 0rademacher_franel_shift_symmetryIn LeanStatistical Mechanics & Thermodynamics
Every symmetric shift has the same Franel-weighted mass: sum_p C(2k,p)^3 C(2k,p+d) = sum_p C(2k,p)^4 for each d with |d| <= 2k. This is the exact oddness cancellation that kills the shift-linear term.
theorem rademacher_franel_shift_symmetry (k : ℕ) :
∑ p ∈ Finset.range (2 * k + 1),
(Nat.choose (2 * k) p : ℝ) ^ 4 * ((k : ℝ) - (p : ℝ)) = 0rademacher_prob_le_expect_sqIn LeanStatistical Mechanics & Thermodynamics
For any random variable X on the boolean cube Fin m → Bool, constant c, and δ > 0, the uniform probability that |X - c| > δ is at most E[(X - c)^2] / δ^2.
theorem rademacher_prob_le_expect_sq (m : ℕ) (X : (Fin m → Bool) → ℝ) (c : ℝ) (δ : ℝ) (hδ : 0 < δ) :
rademacher_prob m (fun s => δ < |X s - c|) ≤
rademacher_expect m (fun s => (X s - c)^2) / δ^2rademacher_prob_tendsto_zero_of_mean_sq_tendstoIn LeanStatistical Mechanics & Thermodynamics
Let m : ℕ → ℕ, let X_k be a real random variable on the sign cube Fin (m k) → Bool and let K be a real constant. If the uniform mean squared deviation E[(X_k - K)^2] tends to 0, then for every ε > 0 the probability that |X_k - K| > ε tends to 0, i.e. X_k converges to K in probability under the uniform Rademacher measure.
theorem rademacher_prob_tendsto_zero_of_mean_sq_tendsto
(m : ℕ → ℕ) (X : (k : ℕ) → (Fin (m k) → Bool) → ℝ) (K : ℝ)
(h : Filter.Tendsto
(fun k : ℕ => rademacher_expect (m k) (fun s => (X k s - K) ^ 2))
Filter.atTop (nhds 0)) :
∀ ε : ℝ, 0 < ε →
Filter.Tendsto
(fun k : ℕ => rademacher_prob (m k) (fun s => ε < |X k s - K|))
Filter.atTop (nhds 0)random_signed_widening_energy_filter_scaled_purity_coupling_eventuallyIn LeanStatistical Mechanics & Thermodynamics
In the subdiffusive window m(k) / sqrt(4k) -> 0, the scaled purity of rademacher_filter (m k) s couples uniformly across all sign configurations s to the product of the scaled delta-filter purity and the normalized autocorrelation energy.
theorem random_signed_widening_energy_filter_scaled_purity_coupling_eventually
(m : ℕ → ℕ) (hm_pos : ∀ k, 0 < m k)
(hm_top : Filter.Tendsto (fun k => (m k : ℝ)) Filter.atTop Filter.atTop)
(hm_sub : Filter.Tendsto (fun k => (m k : ℝ) / Real.sqrt (4 * (k : ℝ))) Filter.atTop (nhds 0))
(ε : ℝ) (hε : 0 < ε) :
let delta : ℤ → ℝ := fun j => if j = 0 then 1 else 0
∀ᶠ k in Filter.atTop, ∀ s : Fin (m k) → Bool,
|Real.sqrt (4 * (k : ℝ)) * energy_filter_sequence_purity (rademacher_filter (m k) s) k -
(Real.sqrt (4 * (k : ℝ)) * energy_filter_sequence_purity delta k) * (rademacher_autocorr_energy (m k) s / ((m k : ℝ)^2))| < εreal_tanh_sq_range_infiniteIn LeanStatistical Mechanics & Thermodynamics
The set of real numbers of the form tanh(h)^2 for real h is infinite.
theorem real_tanh_sq_range_infinite : (Set.range fun h : ℝ => (Real.tanh h) ^ 2).Infinite
sum_gradient_mul_stationary_current_eq_zeroIn LeanStatistical Mechanics & Thermodynamics
For any potential phi on the vertices and any stationary current j on an oriented finite simple graph, the sum of (phi(u) - phi(v)) * j(e) over all edges is zero.
theorem sum_gradient_mul_stationary_current_eq_zero
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(o : SimpleGraphOrientation G)
(phi : V → ℝ) (j : G.edgeFinset → ℝ)
(hj : is_stationary_current G o j) :
∑ e : G.edgeFinset, (phi (o.dir e).1 - phi (o.dir e).2) * j e = 0sum_vertex_abs_currentIn LeanStatistical Mechanics & Thermodynamics
For any finite simple graph G with orientation o and any current j on G.edgeFinset, the sum over all vertices of the absolute current on incident edges equals twice the total sum of |j(e)| over all edges.
theorem sum_vertex_abs_current {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(o : SimpleGraphOrientation G) (j : G.edgeFinset → ℝ) :
∑ v : V, ∑ e : G.edgeFinset,
((if (o.dir e).1 = v then |j e| else 0) + (if (o.dir e).2 = v then |j e| else 0)) =
2 * ∑ e : G.edgeFinset, |j e|three_real_sum_zero_abs_eq_two_maxIn LeanStatistical Mechanics & Thermodynamics
The sum of the absolute values of three real numbers that sum to zero equals twice the largest of the three absolute values.
theorem three_real_sum_zero_abs_eq_two_max (a b c : ℝ) (h : a + b + c = 0) :
|a| + |b| + |c| = 2 * max (max |a| |b|) |c|three_real_sum_zero_sq_ge_max_sqIn LeanStatistical Mechanics & Thermodynamics
Three real numbers summing to zero have sum of squares at least 3/2 times the square of the largest absolute value.
theorem three_real_sum_zero_sq_ge_max_sq (a b c : ℝ) (h : a + b + c = 0) :
(3 / 2 : ℝ) * (max (max |a| |b|) |c|)^2 ≤ a^2 + b^2 + c^2two_species_purity_zeroIn LeanStatistical Mechanics & Thermodynamics
For any tau and alpha, two_species_purity(0, tau, alpha) = 1.
theorem two_species_purity_zero (τ α : ℝ) : two_species_purity 0 τ α = 1
coin_problem_dominance_of_unequal_allocationsIn LeanConcentration of Measure
Let a, b ≥ 1 be positive integers and δ ∈ (0,1). Let X_A and X_B be independent binomial random variables with parameters a and 1/2, and b and 1/2, respectively, on a probability space (Ω, μ). Let A = 2 * X_A - a, B = 2 * X_B - b, and C_AB = A + B. If b ≤ 0.02 * a * δ^2 / ln(4/δ), then the probability that the sign of C_AB equals the sign of A is at least 1 - δ. Conversely, if a ≤ 0.02 * b * δ^2 / ln(4/δ), then the probability that the sign of C_AB equals the sign of B is at least 1 - δ.
open MeasureTheory ProbabilityTheory
open scoped unitInterval
theorem coin_problem_dominance_of_unequal_allocations
{Ω : Type*} [MeasurableSpace Ω] {μ : Measure Ω} [IsProbabilityMeasure μ]
(a b : ℕ) (ha : 1 ≤ a) (hb : 1 ≤ b)
(X_A X_B : Ω → ℕ)
(hX_A : HasLaw X_A (binomial a ⟨1/2, by norm_num⟩) μ)
(hX_B : HasLaw X_B (binomial b ⟨1/2, by norm_num⟩) μ)
(h_indep : IndepFun X_A X_B μ)
(δ : ℝ) (hδ_pos : 0 < δ) (hδ_lt_one : δ < 1) :
let A : Ω → ℝ := fun ω ↦ 2 * (X_A ω : ℝ) - a
let B : Ω → ℝ := fun ω ↦ 2 * (X_B ω : ℝ) - b
let C_AB : Ω → ℝ := fun ω ↦ A ω + B ω
((b : ℝ) ≤ 0.02 * a * δ ^ 2 / Real.log (4 / δ) →
1 - δ ≤ μ.real {ω | SignType.sign (C_AB ω) = SignType.sign (A ω)}) ∧
((a : ℝ) ≤ 0.02 * b * δ ^ 2 / Real.log (4 / δ) →
1 - δ ≤ μ.real {ω | SignType.sign (C_AB ω) = SignType.sign (B ω)})f2_nonzero_outer_product_rigidIn LeanAlgebraic & Lattice-Based Complexity
Two equal outer products over the two-element field with the first pair of factors nonzero have equal corresponding factors.
theorem f2_nonzero_outer_product_rigid {I J : Type*}
(u w : I → ZMod 2) (v z : J → ZMod 2)
(hu : u ≠ 0) (hv : v ≠ 0)
(h : ∀ i j, u i * v j = w i * z j) : u = w ∧ v = zkoszul_binom_marginIn LeanAlgebraic & Lattice-Based Complexity
For n ≥ 4, setting p = ⌊(n-1)/2⌋, the maximal Koszul rank n·binom(n,p) strictly exceeds (2n-4)·binom(n-1,p).
theorem koszul_binom_margin (n : ℕ) (hn : 4 ≤ n) :
(2 * n - 4) * (n - 1).choose ((n - 1) / 2) < n * n.choose ((n - 1) / 2)koszul_flattening_pure_rank_leIn LeanAlgebraic & Lattice-Based Complexity
For every pure tensor x ⊗ y ⊗ z in (ℂⁿ)⊗³, the Koszul flattening K_p has rank at most binom(n-1, p).
theorem koszul_flattening_pure_rank_le (n p : ℕ) (x y z : Fin n → ℂ) :
((koszul_flattening n p) (tensor3_pure x y z)).rank ≤ (n - 1).choose pkoszul_flattening_rank_witnessIn LeanAlgebraic & Lattice-Based Complexity
For 2p+1 ≤ n there is a tensor T in (ℂⁿ)⊗³ whose Koszul flattening K_p has rank at least n·binom(n,p) (the maximal possible, since the format is n·binom(n,p) × n·binom(n,p+1)).
theorem koszul_flattening_rank_witness (n p : ℕ) (hp : 2 * p + 1 ≤ n) :
∃ T : Fin n → Fin n → Fin n → ℂ,
n * n.choose p ≤ ((koszul_flattening n p) T).ranklinear_flattening_testable_even_dimensionIn LeanAlgebraic & Lattice-Based Complexity
For every even natural number n ≥ 6, the secant variety σ_{2n-2}((ℂⁿ)⊗³) is testable by the linear flattening method.
theorem linear_flattening_testable_even_dimension (n : ℕ) (hn : 6 ≤ n) (heven : Even n) : linear_flattening_testable n (2 * n - 2)
linear_flattening_testable_even_stepIn LeanAlgebraic & Lattice-Based Complexity
For every even integer k ≥ 4, if the secant variety σ_{2k-2}((ℂᵏ)⊗³) is testable by the linear flattening method, then σ_{2(k+2)-2}((ℂ^{k+2})⊗³) is also testable.
theorem linear_flattening_testable_even_step (k : ℕ) (hk : 4 ≤ k) (heven : Even k) :
linear_flattening_testable k (2 * k - 2) →
linear_flattening_testable (k + 2) (2 * (k + 2) - 2)linear_flattening_testable_odd_dimensionIn LeanAlgebraic & Lattice-Based Complexity
For every odd natural number n ≥ 5, the secant variety σ_{2n-2}((ℂⁿ)⊗³) is testable by the linear flattening method.
theorem linear_flattening_testable_odd_dimension (n : ℕ) (hn : 5 ≤ n) (hodd : ¬ Even n) : linear_flattening_testable n (2 * n - 2)
linear_flattening_testable_order_gap_fourIn LeanAlgebraic & Lattice-Based Complexity
At the fixed dimension n = k+2 (k ≥ 4), testability at order 2k-2 upgrades to testability at order 2k+2 = 2(k+2)-2; i.e. if the optimal potency at dimension k+2 exceeds 2k-2 then it exceeds 2(k+2)-2.
theorem linear_flattening_testable_order_gap_four (k : ℕ) (hk : 4 ≤ k)
(h : linear_flattening_testable (k + 2) (2 * k - 2)) :
linear_flattening_testable (k + 2) (2 * (k + 2) - 2)linear_flattening_testable_order_gap_twoIn LeanAlgebraic & Lattice-Based Complexity
At dimension n = k+2 with k ≥ 4, testability by linear flattenings at order 2k - 2 implies testability at order 2k.
theorem linear_flattening_testable_order_gap_two (k : ℕ) (hk : 4 ≤ k)
(h : linear_flattening_testable (k + 2) (2 * k - 2)) :
linear_flattening_testable (k + 2) (2 * k)linear_flattening_testable_order_gap_two_secondIn LeanAlgebraic & Lattice-Based Complexity
At dimension n = k+2 with k ≥ 4, testability by linear flattenings at order 2k implies testability at order 2(k+2) - 2 = 2k + 2.
theorem linear_flattening_testable_order_gap_two_second (k : ℕ) (hk : 4 ≤ k)
(h : linear_flattening_testable (k + 2) (2 * k)) :
linear_flattening_testable (k + 2) (2 * (k + 2) - 2)linear_flattening_testable_order_two_mul_sub_fourIn LeanAlgebraic & Lattice-Based Complexity
For every n ≥ 6, σ_{2n-4}((ℂⁿ)⊗³) is testable by the linear flattening method (the central Koszul flattening has potency greater than 2n-4).
theorem linear_flattening_testable_order_two_mul_sub_four (n : ℕ) (hn : 6 ≤ n) :
linear_flattening_testable n (2 * n - 4)matrix3_eval_decomposition_appendIn LeanAlgebraic & Lattice-Based Complexity
Evaluating a concatenation of two lists of triads gives the sum of the two evaluations: eval (L₁ ++ L₂) A B = eval L₁ A B + eval L₂ A B, over any commutative semiring.
theorem matrix3_eval_decomposition_append {R : Type*} [CommSemiring R] (L₁ L₂ : List (Matrix3Triad R)) (A B : Matrix (Fin 3) (Fin 3) R) : eval_matrix3_decomposition (L₁ ++ L₂) A B = eval_matrix3_decomposition L₁ A B + eval_matrix3_decomposition L₂ A Bmatrix3_eval_decomposition_erase_dup_of_two_eq_zeroIn LeanAlgebraic & Lattice-Based Complexity
In a commutative ring of characteristic 2 (2 = 0), two occurrences of the same triad cancel: for every list split L₁ ++ t :: L₂ ++ t :: L₃, deleting both copies gives the same evaluation on all inputs, eval (L₁ ++ t :: L₂ ++ t :: L₃) A B = eval (L₁ ++ L₂ ++ L₃) A B.
theorem matrix3_eval_decomposition_erase_dup_of_two_eq_zero {R : Type*} [CommRing R] (h2 : (2 : R) = 0) (L₁ L₂ L₃ : List (Matrix3Triad R)) (t : Matrix3Triad R) (A B : Matrix (Fin 3) (Fin 3) R) : eval_matrix3_decomposition (L₁ ++ t :: L₂ ++ t :: L₃) A B = eval_matrix3_decomposition (L₁ ++ L₂ ++ L₃) A Bmatrix3_eval_decomposition_erase_of_eval_zeroIn LeanAlgebraic & Lattice-Based Complexity
If a triad evaluates to the zero matrix on every pair of inputs (in particular if its u, v or w component is zero), then deleting it from a decomposition does not change the evaluation: eval (L₁ ++ t :: L₂) A B = eval (L₁ ++ L₂) A B for all A, B.
theorem matrix3_eval_decomposition_erase_of_eval_zero {R : Type*} [CommSemiring R] (L₁ L₂ : List (Matrix3Triad R)) (t : Matrix3Triad R) (h : ∀ A B, eval_matrix3_triad t A B = 0) (A B : Matrix (Fin 3) (Fin 3) R) : eval_matrix3_decomposition (L₁ ++ t :: L₂) A B = eval_matrix3_decomposition (L₁ ++ L₂) A Bmatrix3_gram_change_basisIn LeanAlgebraic & Lattice-Based Complexity
The rank-one-defect Gram equations are preserved by the displayed invertible changes of bases in all three slots, with the displayed changes of defect vectors.
theorem matrix3_gram_change_basis {K : Type*} [Field K]
{I : Type*} [DecidableEq I]
(a b c : I → Matrix (Fin 3) (Fin 3) K) (l m : I → Fin 3 → K)
(hg : ∀ t s, a t*b s*c t*a s=
(if t=s then a s else 0)+Matrix.vecMulVec (l t) (m s))
(P Q R : Matrix (Fin 3) (Fin 3) K)
(hP : IsUnit P.det) (hQ : IsUnit Q.det) (hR : IsUnit R.det) :
∀ t s,
(P*a t*Q)*(Q⁻¹*b s*R)*(R⁻¹*c t*P⁻¹)*(P*a s*Q)=
(if t=s then P*a s*Q else 0)+
Matrix.vecMulVec (P.mulVec (l t)) (Qᵀ.mulVec (m s))matrix3_gram_excess_one_invertible_pair_ranksIn LeanAlgebraic & Lattice-Based Complexity
In a rank-one-defect Gram family over the two-element field, two invertible first factors at different indices force the four corresponding second and third factors to have rank two.
theorem matrix3_gram_excess_one_invertible_pair_ranks {r : ℕ}
(a b c : Fin r → Matrix (Fin 3) (Fin 3) (ZMod 2))
(l m : Fin r → Fin 3 → ZMod 2)
(hg : ∀ t s, a t*b s*c t*a s =
(if t=s then a s else 0) + Matrix.vecMulVec (l t) (m s))
(t s : Fin r) (hts : t ≠ s) (ht : (a t).det ≠ 0) (hs : (a s).det ≠ 0) :
(b t).rank = 2 ∧ (c t).rank = 2 ∧ (b s).rank = 2 ∧ (c s).rank = 2matrix3_gram_reindexIn LeanAlgebraic & Lattice-Based Complexity
The rank-one-defect Gram equations are preserved by simultaneous reindexing of all matrix and vector coordinates.
theorem matrix3_gram_reindex {K : Type*} [Field K]
{I : Type*} [DecidableEq I]
(a b c : I → Matrix (Fin 3) (Fin 3) K) (l m : I → Fin 3 → K)
(hg : ∀ t s, a t*b s*c t*a s=
(if t=s then a s else 0)+Matrix.vecMulVec (l t) (m s))
(e : Fin 3 ≃ Fin 3) :
∀ t s,
(a t).submatrix e e*(b s).submatrix e e*(c t).submatrix e e*(a s).submatrix e e=
(if t=s then (a s).submatrix e e else 0)+
Matrix.vecMulVec ((l t) ∘ e) ((m s) ∘ e)matrix3_rank_two_diagonal_reindexIn LeanAlgebraic & Lattice-Based Complexity
Every rank-two diagonal projection given by a reindexing of the two-plus-one block form can be reindexed to diag(0,1,1).
theorem matrix3_rank_two_diagonal_reindex :
∀ e : Fin 3 ≃ (Fin 2 ⊕ Fin 1), ∃ p : Fin 3 ≃ Fin 3,
(((Matrix.fromBlocks (1 : Matrix (Fin 2) (Fin 2) (ZMod 2)) 0 0
(0 : Matrix (Fin 1) (Fin 1) (ZMod 2))).submatrix e e).submatrix p p) =
Matrix.diagonal ![0,1,1]matrix3_singular_rank_le_twoIn LeanAlgebraic & Lattice-Based Complexity
A singular 3-by-3 matrix over a field has rank at most two.
theorem matrix3_singular_rank_le_two {K : Type*} [Field K]
(A : Matrix (Fin 3) (Fin 3) K) (hd : A.det = 0) : A.rank ≤ 2matrix3_tensor_rank_int_ge_9In LeanAlgebraic & Lattice-Based Complexity
The tensor rank of 3x3 matrix multiplication over ℤ is at least 9.
theorem matrix3_tensor_rank_int_ge_9 : matrix3_tensor_rank_ge ℤ 9
matrix3_tensor_rank_le_zmod2_iff_reduced_unit_checkIn LeanAlgebraic & Lattice-Based Complexity
For every r, 3x3 matrix multiplication over ZMod 2 has a valid decomposition with at most r triads if and only if there is a list L of at most r triads over ZMod 2 that is duplicate-free, has no triad with a zero u, v or w component, and passes the computable unit check matrix3_unit_check. This is an equivalence, not the open bound itself: it says the search for a 22-product algorithm may be restricted to subsets (of size at most r) of the 2^27 triads over ZMod 2, each triad having all three components nonzero.
theorem matrix3_tensor_rank_le_zmod2_iff_reduced_unit_check (r : ℕ) : matrix3_tensor_rank_le (ZMod 2) r ↔ ∃ L : List (Matrix3Triad (ZMod 2)), L.length ≤ r ∧ L.Nodup ∧ (∀ t ∈ L, t.u ≠ 0 ∧ t.v ≠ 0 ∧ t.w ≠ 0) ∧ matrix3_unit_check L = true
matrix3_trace_cyclic_rotateIn LeanAlgebraic & Lattice-Based Complexity
Cyclic rotation (a, b, c) ↦ (b, c, a) of any finite indexed family satisfying the cyclic trace coefficient identities of 3x3 matrix multiplication satisfies the same identities.
theorem matrix3_trace_cyclic_rotate {R : Type*} [CommSemiring R] {r : ℕ} (a b c : Fin r → Matrix (Fin 3) (Fin 3) R)
(h : ∀ i j j' k k' i' : Fin 3,
∑ s, a s i j * b s j' k * c s k' i' =
if j = j' ∧ k = k' ∧ i = i' then 1 else 0) :
∀ i j j' k k' i' : Fin 3,
∑ s, b s i j * c s j' k * a s k' i' =
if j = j' ∧ k = k' ∧ i = i' then 1 else 0matrix3_trace_excess_one_invertible_pair_ranksIn LeanAlgebraic & Lattice-Based Complexity
In a cyclic trace decomposition over the two-element field with first-factor rank sum 28, two invertible first factors at different indices force the four corresponding second and third factors to have rank two.
theorem matrix3_trace_excess_one_invertible_pair_ranks {r : ℕ}
(a b c : Fin r → Matrix (Fin 3) (Fin 3) (ZMod 2))
(hc : ∀ i j j' k k' i' : Fin 3,
∑ q, a q i j * b q j' k * c q k' i' =
if j=j' ∧ k=k' ∧ i=i' then 1 else 0)
(hd : ∑ q, (a q).rank = 28)
(t s : Fin r) (hts : t ≠ s) (ht : (a t).det ≠ 0) (hs : (a s).det ≠ 0) :
(b t).rank = 2 ∧ (c t).rank = 2 ∧ (b s).rank = 2 ∧ (c s).rank = 2matrix3_trace_length_ge_9In LeanAlgebraic & Lattice-Based Complexity
Every cyclic trace decomposition of 3x3 matrix multiplication over a field K has length at least 9.
theorem matrix3_trace_length_ge_9 {K : Type*} [Field K] {r : ℕ} (a b c : Fin r → Matrix (Fin 3) (Fin 3) K)
(h : ∀ i j j' k k' i' : Fin 3,
∑ s, a s i j * b s j' k * c s k' i' =
if j = j' ∧ k = k' ∧ i = i' then 1 else 0) :
9 ≤ rmatrix3_trace_total_rank_sum_ge_81In LeanAlgebraic & Lattice-Based Complexity
For any cyclic trace decomposition of 3x3 matrix multiplication over a field K, the sum of all matrix ranks across all three factor positions is at least 81.
theorem matrix3_trace_total_rank_sum_ge_81 {K : Type*} [Field K] {r : ℕ} (a b c : Fin r → Matrix (Fin 3) (Fin 3) K)
(h : ∀ i j j' k k' i' : Fin 3,
∑ s, a s i j * b s j' k * c s k' i' =
if j = j' ∧ k = k' ∧ i = i' then 1 else 0) :
81 ≤ ∑ s, ((a s).rank + (b s).rank + (c s).rank)matrix3_trace_transpose_swapIn LeanAlgebraic & Lattice-Based Complexity
Transpose-swap (a, b, c) ↦ (bᵀ, aᵀ, cᵀ) of any family satisfying the cyclic trace identities satisfies the same identities.
theorem matrix3_trace_transpose_swap {R : Type*} [CommSemiring R] {r : ℕ} (a b c : Fin r → Matrix (Fin 3) (Fin 3) R)
(h : ∀ i j j' k k' i' : Fin 3,
∑ s, a s i j * b s j' k * c s k' i' =
if j = j' ∧ k = k' ∧ i = i' then 1 else 0) :
∀ i j j' k k' i' : Fin 3,
∑ s, (b s).transpose i j * (a s).transpose j' k * (c s).transpose k' i' =
if j = j' ∧ k = k' ∧ i = i' then 1 else 0matrix3_unit_sandwich_injectiveIn LeanAlgebraic & Lattice-Based Complexity
Multiplication on both sides by matrices with unit determinant is injective.
theorem matrix3_unit_sandwich_injective {K : Type*} [Field K]
(P Q A B : Matrix (Fin 3) (Fin 3) K) (hP : IsUnit P.det) (hQ : IsUnit Q.det)
(h : P*A*Q=P*B*Q) : A=Bmatrix3_valid_erase_dup_of_two_eq_zeroIn LeanAlgebraic & Lattice-Based Complexity
In a commutative ring of characteristic 2, if the list L₁ ++ t :: L₂ ++ t :: L₃ is a valid decomposition of matrix multiplication (contains two copies of the same triad t), then deleting both copies gives a valid decomposition: is_valid (L₁ ++ L₂ ++ L₃).
theorem matrix3_valid_erase_dup_of_two_eq_zero {R : Type*} [CommRing R] (h2 : (2 : R) = 0) (L₁ L₂ L₃ : List (Matrix3Triad R)) (t : Matrix3Triad R) (hv : is_valid_matrix3_decomposition (L₁ ++ t :: L₂ ++ t :: L₃)) : is_valid_matrix3_decomposition (L₁ ++ L₂ ++ L₃)matrix3_valid_erase_of_zero_slotIn LeanAlgebraic & Lattice-Based Complexity
If L₁ ++ t :: L₂ is a valid decomposition of 3x3 matrix multiplication over a commutative semiring and the triad t has a zero u, zero v or zero w component, then L₁ ++ L₂ is a valid decomposition too.
theorem matrix3_valid_erase_of_zero_slot {R : Type*} [CommSemiring R] (L₁ L₂ : List (Matrix3Triad R)) (t : Matrix3Triad R) (hv : is_valid_matrix3_decomposition (L₁ ++ t :: L₂)) (h0 : t.u = 0 ∨ t.v = 0 ∨ t.w = 0) : is_valid_matrix3_decomposition (L₁ ++ L₂)matrix3_valid_reduced_normal_formIn LeanAlgebraic & Lattice-Based Complexity
Every valid decomposition of 3x3 matrix multiplication over ZMod 2 can be replaced by one that is no longer, still valid, contains no repeated triad, and contains no triad with a zero u, v or w component. (Minimal-length valid decompositions have both properties, because a zero-slot triad can be deleted and in characteristic 2 two copies of one triad cancel.)
theorem matrix3_valid_reduced_normal_form (L : List (Matrix3Triad (ZMod 2))) (h : is_valid_matrix3_decomposition L) : ∃ L' : List (Matrix3Triad (ZMod 2)), L'.length ≤ L.length ∧ is_valid_matrix3_decomposition L' ∧ L'.Nodup ∧ ∀ t ∈ L', t.u ≠ 0 ∧ t.v ≠ 0 ∧ t.w ≠ 0
matrix_rank_add_le_sumIn LeanAlgebraic & Lattice-Based Complexity
The rank of a sum of two finite matrices over a field is at most the sum of their ranks.
theorem matrix_rank_add_le_sum {K : Type*} [Field K]
{I J : Type*} [Fintype I] [Fintype J] (A B : Matrix I J K) :
(A+B).rank ≤ A.rank+B.rankncabp_eval_poly_of_sink_lt_sourceIn LeanAlgebraic & Lattice-Based Complexity
For any ncABP A over a commutative semiring F, if A.sink < A.source, then ncabp_eval_poly A = 0.
theorem ncabp_eval_poly_of_sink_lt_source {F : Type*} [CommSemiring F] {m S : ℕ}
(A : NcABP F m S) (h : A.sink < A.source) : ncabp_eval_poly A = 0ncabp_eval_poly_of_source_eq_sinkIn LeanAlgebraic & Lattice-Based Complexity
For any ncABP A over a commutative semiring F, if A.source = A.sink, then ncabp_eval_poly A = 1.
theorem ncabp_eval_poly_of_source_eq_sink {F : Type*} [CommSemiring F] {m S : ℕ}
(A : NcABP F m S) (h : A.source = A.sink) : ncabp_eval_poly A = 1ncabp_hitting_tuple_of_kernel_trivialIn LeanAlgebraic & Lattice-Based Complexity
A matrix tuple T is an ncABP hitting tuple if for every ncABP A with S vertices on m variables, (FreeAlgebra.lift F T) (ncabp_eval_poly A) = 0 implies ncabp_eval_poly A = 0.
theorem ncabp_hitting_tuple_of_kernel_trivial {F : Type*} [Field F] (m S R : ℕ)
(T : Fin m → Matrix (Fin R) (Fin R) F)
(h : ∀ (A : NcABP F m S), (FreeAlgebra.lift F T) (ncabp_eval_poly A) = 0 → ncabp_eval_poly A = 0) :
is_ncabp_hitting_tuple m S R Tncabp_hitting_tuple_s_oneIn LeanAlgebraic & Lattice-Based Complexity
For any field F and natural number m, the 1-by-1 zero matrix tuple is an ncABP hitting tuple for ncABPs with 1 vertex on m variables.
theorem ncabp_hitting_tuple_s_one {F : Type*} [Field F] (m : ℕ) :
is_ncabp_hitting_tuple m 1 1 (fun _ : Fin m => (0 : Matrix (Fin 1) (Fin 1) F))ncabp_matrix_entry_of_leIn LeanAlgebraic & Lattice-Based Complexity
For any ncABP A over a commutative semiring F, if v ≤ u then the (u, v) entry of the transition matrix ncabp_matrix A is 0.
theorem ncabp_matrix_entry_of_le {F : Type*} [CommSemiring F] {m S : ℕ}
(A : NcABP F m S) (u v : Fin S) (h : v ≤ u) : ncabp_matrix A u v = 0ncabp_matrix_pow_entry_of_lt_addIn LeanAlgebraic & Lattice-Based Complexity
For any ncABP A over a commutative semiring F, natural number k, and vertices u, v, if v < u + k then (ncabp_matrix A ^ k) u v = 0.
theorem ncabp_matrix_pow_entry_of_lt_add {F : Type*} [CommSemiring F] {m S : ℕ}
(A : NcABP F m S) (k : ℕ) (u v : Fin S) (h : (v : ℕ) < (u : ℕ) + k) :
(ncabp_matrix A ^ k) u v = 0ncabp_matrix_pow_ge_dim_eq_zeroIn LeanAlgebraic & Lattice-Based Complexity
For any ncABP A of size S over a commutative semiring F, and k ≥ S, the k-th power of ncabp_matrix A is zero.
theorem ncabp_matrix_pow_ge_dim_eq_zero {F : Type*} [CommSemiring F] {m S : ℕ}
(A : NcABP F m S) (k : ℕ) (hk : S ≤ k) :
ncabp_matrix A ^ k = 0not_matrix3_tensor_rank_zmod2_le_22In LeanAlgebraic & Lattice-Based Complexity
The statement matrix3_tensor_rank_zmod2_le_22 is false: The statement asserts rank <= 22 of the 3x3 matrix-multiplication tensor over F2. Unfolding the KB definitions: eval_matrix3_triad t A B = ((Σ u_ij A_ij)*(Σ v_ij B_ij)) • w and is_valid_matrix3_decomposition L = ∀ A B, eval L A B = A * B, so matrix3_tensor_rank_le (ZMod 2) 22 says exactly that A*B over ZMod 2 has a bilinear algorithm with at most 22 products. Per this knowledge base's recorded literature (arXiv:2610.11823, "The rank of 3x3 matrix multiplication over F2 is 23", rev. 2026-10-19) the rank over F2 is 23, so the statement is false: the negation (rank >= 23) holds. A kernel-only Lean 4 development accompanies that paper (github.com/tejasvi/rank333-f2-kernel at 0c7c6173c3dc91cf63972f1fe8980b726dd6a8e6, final theorem R22K.Final.rank_ge_23 : Top.RankGe23), but its final dependency graph is 14,185,917 generated modules (public import closure 17,017 modules, most proof bodies withheld) on Lean/Mathlib 4.30.0, with a reported source-regeneration cost of ~529,504 CPU-hours; it can be neither imported nor rebuilt in this environment (Lean 4.33.1, no network), so no verified local refutation is available. Concretely, in this KB the target is equivalent to the finite statement ∃ L : List (Matrix3Triad (ZMod 2)), L.length ≤ 22 ∧ matrix3_unit_check L = true (proved node matrix3_tensor_rank_le_zmod2_iff_unit_check applied to r = 22): a witness check on 729 cubic F2 identities among 2^594 candidate lists, with no witness existing. I verified first-hand this session that the only known 23-triad scheme matrix3_triads_23 (ZMod 2) passes matrix3_unit_check and that no drop-one sublist does (the indices whose removal still passes evaluate to []), consistent with the KB's exhaustive refutations of all local shortenings (no mergeable pairs; none of 1771 triples is replaceable by 2 products; none of 350 quadruples by 3; all 2,831,323 subset replacements of sizes 5..10 obstructed). The statement is not merely unproved but false; the missing object (a 22-triad scheme) does not exist, and a Lean proof of the negation is a research-scale verified exhaustive computation. Note also that the negation would immediately give rank >= 23 over Z via the proved transfer matrix3_tensor_rank_int_ge_of_zmod2, i.e. it would settle the integer case too.
theorem not_matrix3_tensor_rank_zmod2_le_22 : ¬ (matrix3_tensor_rank_le (ZMod 2) 22)
step_function_sigma_cubed_sub_leIn LeanAlgebraic & Lattice-Based Complexity
For all real numbers t, the difference |t^3 - σ(t)| between t^3 and the step function σ(t) is bounded by 3 t^2 |t^2 - 1|.
lemma step_function_sigma_cubed_sub_le (t : ℝ) : |t ^ 3 - (step_function_sigma t : ℝ)| ≤ 3 * t ^ 2 * |t ^ 2 - 1|
step_function_sigma_zeroIn LeanAlgebraic & Lattice-Based Complexity
The step function evaluates to 0 at 0.
lemma step_function_sigma_zero : step_function_sigma 0 = 0
symmetric_oct_f_ge_of_power_sum_one_ne_zeroIn LeanAlgebraic & Lattice-Based Complexity
For any vector x with non-zero first power sum p_1(x) ≠ 0, the degree-8 symmetric function satisfies F(x) ≥ 16 p_1(x)^8.
lemma symmetric_oct_f_ge_of_power_sum_one_ne_zero {n : ℕ} (x : Fin n → ℝ) (h : symmetric_power_sum 1 x ≠ 0) : 16 * (symmetric_power_sum 1 x) ^ 8 ≤ symmetric_oct_f xsymmetric_oct_f_of_power_sum_one_zeroIn LeanAlgebraic & Lattice-Based Complexity
If the first power sum p_1(x) vanishes, then the degree-8 symmetric function F(x) simplifies to 9 p_2(x) p_6(x).
lemma symmetric_oct_f_of_power_sum_one_zero {n : ℕ} (x : Fin n → ℝ) (h : symmetric_power_sum 1 x = 0) : symmetric_oct_f x = 9 * symmetric_power_sum 2 x * symmetric_power_sum 6 xsymmetric_oct_f_pos_defIn LeanAlgebraic & Lattice-Based Complexity
The homogeneous degree-8 symmetric function F is any-dimensional positive definite: for every natural number n and every non-zero vector x : Fin n → ℝ, F(x) > 0.
theorem symmetric_oct_f_pos_def {n : ℕ} (x : Fin n → ℝ) (hx : x ≠ 0) : 0 < symmetric_oct_f xsymmetric_oct_f_pos_of_power_sum_one_zeroIn LeanAlgebraic & Lattice-Based Complexity
For any non-zero vector x with vanishing first power sum p_1(x) = 0, the degree-8 symmetric function F(x) is strictly positive.
lemma symmetric_oct_f_pos_of_power_sum_one_zero {n : ℕ} (x : Fin n → ℝ) (hne : x ≠ 0) (h : symmetric_power_sum 1 x = 0) : 0 < symmetric_oct_f xsymmetric_oct_f_zeroIn LeanAlgebraic & Lattice-Based Complexity
The degree-8 symmetric function evaluates to 0 at the zero vector.
lemma symmetric_oct_f_zero {n : ℕ} : symmetric_oct_f (0 : Fin n → ℝ) = 0symmetric_power_sum_zeroIn LeanAlgebraic & Lattice-Based Complexity
For any positive integer r and dimension n, the r-th power sum of the zero vector in Fin n → ℝ is zero.
lemma symmetric_power_sum_zero {n : ℕ} {r : ℕ} (hr : 0 < r) : symmetric_power_sum r (0 : Fin n → ℝ) = 0augmented_cycle_area_eq_kemenyIn LeanAlgorithm Design & Analysis
For any factor vectors h_1, ..., h_n in R^2 and any item permutation π in S_n, the doubled signed area of the closed polygon formed by augmenting the cycle with the closing vector h_0 = -∑_i h_i equals the weighted Kemeny objective ∑_{r < s} det(h_{π_r}, h_{π_s}).
theorem augmented_cycle_area_eq_kemeny {n : ℕ} (h : Fin n → ℝ × ℝ) (π : Equiv.Perm (Fin n)) :
(let g : Fin (n + 1) → ℝ × ℝ := Fin.cases (-∑ i, h i) (fun r => h (π r))
∑ a : Fin (n + 1), ∑ b : Fin (n + 1),
if a < b then (g a).1 * (g b).2 - (g a).2 * (g b).1 else 0) =
∑ r : Fin n, ∑ s : Fin n,
if r < s then (h (π r)).1 * (h (π s)).2 - (h (π r)).2 * (h (π s)).1 else 0boruvka_round_cost_leIn LeanAlgorithm Design & Analysis
In any Borůvka round from F to F' under profile π : V → LinearOrder V consistent with pseudometric d : V → V → ℝ on finite type V, the cost difference graph_cost d F' - graph_cost d F is at most 2 * graph_cost d T_mst, where T_mst is a minimum spanning tree under d.
theorem boruvka_round_cost_le
{V : Type*} [Fintype V] [DecidableEq V]
(d : V → V → ℝ) (hd : is_pseudometric d)
(π : V → LinearOrder V) (hπ : ordinal_profile_consistent d π)
(F F' : SimpleGraph V) (h_round : boruvka_round π F F')
(T_mst : SimpleGraph V) (h_mst : is_mst d T_mst) :
graph_cost d F' - graph_cost d F ≤ 2 * graph_cost d T_mstboruvka_round_edges_sum_le_two_mst_costIn LeanAlgorithm Design & Analysis
For any forest F and tree T, charging each proposed edge (r(c), g(c)) to the prefix of the path in T from r(c) to g(c) up to the first vertex outside c implies that the sum of costs of the proposed edges is at most 2 * graph_cost d T.
theorem boruvka_round_edges_sum_le_two_mst_cost
{V : Type*} [Fintype V] [DecidableEq V]
(d : V → V → ℝ) (hd : is_pseudometric d)
(π : V → LinearOrder V) (hπ : ordinal_profile_consistent d π)
(F : SimpleGraph V) (hF : F.IsAcyclic)
(r g : F.ConnectedComponent → V)
(hr : ∀ c, F.connectedComponentMk (r c) = c)
(hg : ∀ c, is_globally_best_outside F π (r c) (g c))
(T : SimpleGraph V) (hT : T.IsTree) :
(∑ c : F.ConnectedComponent, d (r c) (g c)) ≤ 2 * graph_cost d Tbpe_deviation_prob_le_oneIn LeanAlgorithm Design & Analysis
For any source bias p ∈ (0, 1), step count k, input length N, target constant c, and tolerance ε, the deviation probability bpe_deviation_prob p hp k N c ε is ≤ 1.
theorem bpe_deviation_prob_le_one (p : ℝ) (hp : 0 < p ∧ p < 1) (k N : ℕ) (c ε : ℝ) : bpe_deviation_prob p hp k N c ε ≤ 1
bpe_greedy_run_length_posIn LeanAlgorithm Design & Analysis
If s is a non-empty string and t is obtained by k greedy BPE merge steps from s, then t is also non-empty (0 < t.length).
theorem bpe_greedy_run_length_pos (k : ℕ) (s t : List ℕ) (h : bpe_greedy_run k s t) (hs : 0 < s.length) : 0 < t.length
bpe_run_token_length_boundsIn LeanAlgorithm Design & Analysis
Given any binary sequence w : Fin N → Bool and any k-step greedy BPE run t on its list representation, the output length satisfies N ≤ 2^k * t.length and t.length ≤ N.
theorem bpe_run_token_length_bounds (k N : ℕ) (w : Fin N → Bool) (t : List ℕ) (h : bpe_greedy_run k (List.ofFn (fun i => if w i then 1 else 0)) t) : N ≤ 2^k * t.length ∧ t.length ≤ N
bpe_worst_case_ratio_three_matching_lower_boundIn LeanAlgorithm Design & Analysis
The worst-case ratio of greedy Byte-Pair Encoding to optimal partial-merge utility for three merges is at least 7/12.
theorem bpe_worst_case_ratio_three_matching_lower_bound : (7 : ℝ) / 12 ≤ bpe_worst_ratio 3
bpe_worst_ratio_bdd_belowIn LeanAlgorithm Design & Analysis
For any budget k, the set of greedy-to-optimal length reduction ratios is bounded below by 0.
theorem bpe_worst_ratio_bdd_below (k : ℕ) :
BddBelow {r : ℝ | ∃ s t : List ℕ, bpe_steps bpe_greedy_step k s t ∧
0 < bpe_optimal_utility s k ∧ r = ((s.length - t.length : ℕ) : ℝ) / bpe_optimal_utility s k}bpe_worst_ratio_le_runIn LeanAlgorithm Design & Analysis
For any budget k, any k-step greedy run from s to t with positive optimal utility bounds bpe_worst_ratio k from above.
theorem bpe_worst_ratio_le_run (k : ℕ) (s t : List ℕ)
(h_step : bpe_steps bpe_greedy_step k s t)
(h_opt : 0 < bpe_optimal_utility s k) :
bpe_worst_ratio k ≤ ((s.length - t.length : ℕ) : ℝ) / bpe_optimal_utility s kclosesort_exact_weighted_kemenyIn LeanAlgorithm Design & Analysis
Let W be a real n × n skew-symmetric matrix (W.transpose = -W) of rank at most 2. There exist factor vectors h : Fin n → ℝ × ℝ such that W i j = (h i).1 * (h j).2 - (h i).2 * (h j).1 for all i, j : Fin n. For u : ℝ × ℝ, define the polar angle θ(u) ∈ [0, 2π) by letting a = Complex.arg ⟨u.1, u.2⟩ and returning a + 2π if a < 0 else a, and define the relative polar angle rel(u) ∈ [0, 2π) by letting d = θ(u) - θ(-∑ i, h i) and returning d + 2π if d < 0 else d. Then for every permutation π : Equiv.Perm (Fin n) such that the map r ↦ rel(h (π r)) is Monotone, and for every permutation σ : Equiv.Perm (Fin n), the sum over all r, s : Fin n of (if r < s then W (σ r) (σ s) else 0) is at most the sum over all r, s : Fin n of (if r < s then W (π r) (π s) else 0).
theorem closesort_exact_weighted_kemeny {n : ℕ} (W : Matrix (Fin n) (Fin n) ℝ)
(h_skew : W.transpose = -W) (h_rank : W.rank ≤ 2) :
∃ h : Fin n → ℝ × ℝ,
(∀ i j : Fin n, W i j = (h i).1 * (h j).2 - (h i).2 * (h j).1) ∧
(let θ (u : ℝ × ℝ) : ℝ :=
let a := Complex.arg ⟨u.1, u.2⟩
if a < 0 then a + 2 * Real.pi else a
let rel (u : ℝ × ℝ) : ℝ :=
let d := θ u - θ (-∑ i, h i)
if d < 0 then d + 2 * Real.pi else d
∀ π : Equiv.Perm (Fin n), Monotone (fun r : Fin n => rel (h (π r))) →
∀ σ : Equiv.Perm (Fin n),
(∑ r : Fin n, ∑ s : Fin n, if r < s then W (σ r) (σ s) else 0) ≤
∑ r : Fin n, ∑ s : Fin n, if r < s then W (π r) (π s) else 0)closesort_maximizes_kemeny_from_factorsIn LeanAlgorithm Design & Analysis
For any natural number n and any factor vectors h : Fin n → ℝ × ℝ, define the polar angle θ(u) for u : ℝ × ℝ by letting a = Complex.arg ⟨u.1, u.2⟩ and returning a + 2π if a < 0 else a, and define the relative angle rel(u) by letting d = θ(u) - θ(-∑ i, h i) and returning d + 2π if d < 0 else d. If π : Equiv.Perm (Fin n) satisfies that the map r ↦ rel(h (π r)) is Monotone, then for every permutation σ : Equiv.Perm (Fin n), the sum over all r, s : Fin n of (if r < s then (h (σ r)).1 * (h (σ s)).2 - (h (σ r)).2 * (h (σ s)).1 else 0) is at most the sum over all r, s : Fin n of (if r < s then (h (π r)).1 * (h (π s)).2 - (h (π r)).2 * (h (π s)).1 else 0).
theorem closesort_maximizes_kemeny_from_factors {n : ℕ} (h : Fin n → ℝ × ℝ)
(π : Equiv.Perm (Fin n))
(hπ : let θ (u : ℝ × ℝ) : ℝ :=
let a := Complex.arg ⟨u.1, u.2⟩
if a < 0 then a + 2 * Real.pi else a
let rel (u : ℝ × ℝ) : ℝ :=
let d := θ u - θ (-∑ i, h i)
if d < 0 then d + 2 * Real.pi else d
Monotone (fun r : Fin n => rel (h (π r))))
(σ : Equiv.Perm (Fin n)) :
(∑ r : Fin n, ∑ s : Fin n,
if r < s then (h (σ r)).1 * (h (σ s)).2 - (h (σ r)).2 * (h (σ s)).1 else 0) ≤
∑ r : Fin n, ∑ s : Fin n,
if r < s then (h (π r)).1 * (h (π s)).2 - (h (π r)).2 * (h (π s)).1 else 0closure_span_embedding_of_isometric_embeddingIn LeanAlgorithm Design & Analysis
Let V be a metric space with a base point v₀ and f : V → H an isometric embedding into a complete real inner product space H with f v₀ = 0. Then there is a complete real inner product space H' and an isometric embedding φ : V → H' with φ v₀ = 0 whose image has dense linear span in H'.
theorem closure_span_embedding_of_isometric_embedding.{u}
{V : Type u} [MetricSpace V] (v₀ : V)
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H] [CompleteSpace H]
(f : V → H) (hf : ∀ a b : V, dist (f a) (f b) = dist a b) (hf₀ : f v₀ = 0) :
∃ (H' : Type u) (_ : NormedAddCommGroup H') (_ : InnerProductSpace ℝ H') (_ : CompleteSpace H'),
∃ φ : V → H', (∀ a b : V, dist (φ a) (φ b) = dist a b) ∧ φ v₀ = 0 ∧
Submodule.topologicalClosure (Submodule.span ℝ (Set.range φ)) = ⊤dist_best_outside_leIn LeanAlgorithm Design & Analysis
Given an ordinal profile π consistent with pseudometric d, if g is globally best outside for r, then d(r, g) ≤ d(r, w) for any vertex w outside the component of r.
theorem dist_best_outside_le
{V : Type*} (d : V → V → ℝ)
(π : V → LinearOrder V) (hπ : ordinal_profile_consistent d π)
(F : SimpleGraph V) (r g w : V)
(h_best : is_globally_best_outside F π r g)
(hw : F.connectedComponentMk w ≠ F.connectedComponentMk r) :
d r g ≤ d r wexact_terminal_embedding_of_two_strongly_euclideanIn LeanAlgorithm Design & Analysis
Let X be a metric space and let V be a nonempty subset of X. If V is 2-strongly Euclidean in X, then there exists a real Hilbert space H and a map φ from X to H such that φ is a terminal embedding for V, meaning that φ is 1-Lipschitz and for every x in V and every y in X, dist (φ x) (φ y) = dist x y.
theorem exact_terminal_embedding_of_two_strongly_euclidean.{u}
{X : Type u} [MetricSpace X] (V : Set X) (hV : V.Nonempty)
(hE : IsTwoStronglyEuclidean V) :
∃ (H : Type u) (_ : NormedAddCommGroup H) (_ : InnerProductSpace ℝ H) (_ : CompleteSpace H),
∃ φ : X → H, IsTerminalEmbedding V φfinite_metric_hilbert_distortion_compactnessIn LeanAlgorithm Design & Analysis
If every finite subset of a metric space embeds into a real Hilbert space with a common distortion bound D, then the whole space embeds into a real Hilbert space with the same distortion bound.
theorem finite_metric_hilbert_distortion_compactness.{u} (X : Type u) [MetricSpace X] [DecidableEq X] (D : ℝ) (hD : 0 ≤ D) (hfin : ∀ F : Finset X, EmbedsIntoHilbertWithDistortion {x // x ∈ F} D) : EmbedsIntoHilbertWithDistortion X Dgraph_cost_sub_le_sum_boruvka_edgesIn LeanAlgorithm Design & Analysis
In a Borůvka round from F to F', the cost difference graph_cost d F' - graph_cost d F is at most the sum of distances of proposed round edges d(r(c), g(c)).
theorem graph_cost_sub_le_sum_boruvka_edges
{V : Type*} [Fintype V] [DecidableEq V]
(d : V → V → ℝ) (hd : is_pseudometric d)
(π : V → LinearOrder V) (F F' : SimpleGraph V)
(h_round : boruvka_round π F F')
(r g : F.ConnectedComponent → V)
(hr : ∀ c, F.connectedComponentMk (r c) = c)
(hg : ∀ c, is_globally_best_outside F π (r c) (g c))
(h_edges : ∀ u v, F'.Adj u v → F.Adj u v ∨ ∃ c, (u = r c ∧ v = g c) ∨ (u = g c ∧ v = r c)) :
graph_cost d F' - graph_cost d F ≤ ∑ c : F.ConnectedComponent, d (r c) (g c)height_eq_zero_of_memIn LeanAlgorithm Design & Analysis
If u x = φ x for x ∈ V, φ is isometric with φ v₀ = 0, and dist x v₀ ² = ‖u x‖² + a x² with a x ≥ 0, then a x = 0.
theorem height_eq_zero_of_mem.{u}
{X : Type u} [MetricSpace X] (V : Set X) (v₀ : V)
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H]
(φ : V → H) (hφ : ∀ a b : V, dist (φ a) (φ b) = dist a b) (hφ₀ : φ v₀ = 0)
(u : X → H) (a : X → ℝ) (ha0 : ∀ x : X, 0 ≤ a x)
(ha : ∀ x : X, dist x (v₀ : X) ^ 2 = ‖u x‖ ^ 2 + a x ^ 2)
{x : X} (hx : x ∈ V) (hu : u x = φ ⟨x, hx⟩) : a x = 0height_family_of_two_strongly_euclideanIn LeanAlgorithm Design & Analysis
Let V be 2-strongly Euclidean in a metric space X, v₀ ∈ V, and φ : V → H an isometric embedding into a complete real inner product space with φ v₀ = 0 and dense linear span. Then there are u : X → H and a : X → ℝ with ‖u x‖ ≤ dist x v₀, 0 ≤ a x, dist x v₀ ² = ‖u x‖² + a x², the inner products ⟪u x, φ v⟫ prescribed by the squared distances, and with u x = φ x and a x = 0 whenever x ∈ V.
theorem height_family_of_two_strongly_euclidean.{u}
{X : Type u} [MetricSpace X] (V : Set X) (v₀ : V) (hE : IsTwoStronglyEuclidean V)
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H] [CompleteSpace H]
(φ : V → H) (hφ : ∀ a b : V, dist (φ a) (φ b) = dist a b) (hφ₀ : φ v₀ = 0)
(hden : DenseRange φ) :
∃ (u : X → H) (a : X → ℝ),
(∀ x : X, ‖u x‖ ≤ dist x (v₀ : X)) ∧
(∀ x : X, 0 ≤ a x) ∧
(∀ x : X, dist x (v₀ : X) ^ 2 = ‖u x‖ ^ 2 + a x ^ 2) ∧
(∀ (x : X) (v : V),
inner ℝ (u x) (φ v) = (‖φ v‖ ^ 2 - dist x (v : X) ^ 2 + dist x (v₀ : X) ^ 2) / 2) ∧
(∀ (x : X) (hx : x ∈ V), u x = φ ⟨x, hx⟩ ∧ a x = 0)height_lipschitz_of_ambient_decompositionIn LeanAlgorithm Design & Analysis
Let S : H → K be a linear isometry, p, r ∈ K, u, u' ∈ H realised from p, r as in the Riesz decomposition, and let a = ‖p - S u‖, a' = ‖r - S u'‖. Then ‖u - u'‖² + (a - a')² ≤ ‖p - r‖².
theorem height_lipschitz_of_ambient_decomposition.{u}
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H]
{K : Type u} [NormedAddCommGroup K] [InnerProductSpace ℝ K]
(S : H →ₗᵢ[ℝ] K) (p r : K) (u u' : H) (a a' : ℝ)
(hu : ∀ y : H, inner ℝ u y = inner ℝ p (S y))
(hu' : ∀ y : H, inner ℝ u' y = inner ℝ r (S y))
(ha : a = ‖p - S u‖) (ha' : a' = ‖r - S u'‖) :
‖u - u'‖ ^ 2 + (a - a') ^ 2 ≤ ‖p - r‖ ^ 2height_lipschitz_of_two_strongly_euclideanIn LeanAlgorithm Design & Analysis
Let V be 2-strongly Euclidean in X, v₀ ∈ V, φ : V → H an isometric embedding into a complete real inner product space with φ v₀ = 0 and dense linear span, and let u : X → H, a : X → ℝ be the height family. Then for all x, y ∈ X, ‖u x - u y‖² + (a x - a y)² ≤ dist x y ².
theorem height_lipschitz_of_two_strongly_euclidean.{u}
{X : Type u} [MetricSpace X] (V : Set X) (v₀ : V)
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H] [CompleteSpace H]
(φ : V → H) (hφ : ∀ a b : V, dist (φ a) (φ b) = dist a b) (hφ₀ : φ v₀ = 0)
(hden : DenseRange φ) (u : X → H) (a : X → ℝ)
(ha : ∀ x : X, dist x (v₀ : X) ^ 2 = ‖u x‖ ^ 2 + a x ^ 2)
(ha0 : ∀ x : X, 0 ≤ a x)
(hin : ∀ (x : X) (v : V),
inner ℝ (u x) (φ v) = (‖φ v‖ ^ 2 - dist x (v : X) ^ 2 + dist x (v₀ : X) ^ 2) / 2)
(hE : IsTwoStronglyEuclidean V) :
∀ x y : X, ‖u x - u y‖ ^ 2 + (a x - a y) ^ 2 ≤ dist x y ^ 2inner_eq_of_dense_spanIn LeanAlgorithm Design & Analysis
Let φ : V → H have dense linear span in H, S : H → K a linear isometry, u ∈ H, w ∈ K. If ⟪u, φ v⟫ = ⟪w, S (φ v)⟫ for all v, then ⟪u, y⟫ = ⟪w, S y⟫ for all y ∈ H.
theorem inner_eq_of_dense_span.{u}
{V : Type u} {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H]
{K : Type u} [NormedAddCommGroup K] [InnerProductSpace ℝ K]
(φ : V → H) (hφ : (Submodule.span ℝ (Set.range φ)).topologicalClosure = ⊤)
(S : H →ₗᵢ[ℝ] K) (u : H) (w : K)
(h : ∀ v : V, inner ℝ u (φ v) = inner ℝ w (S (φ v))) :
∀ y : H, inner ℝ u y = inner ℝ w (S y)isometric_embedding_zero_of_two_strongly_euclideanIn LeanAlgorithm Design & Analysis
Let X be a metric space, V a subset of X and v₀ a point of V. If V is 2-strongly Euclidean in X, then there is a real Hilbert space H and an isometric embedding f : V → H with f v₀ = 0.
theorem isometric_embedding_zero_of_two_strongly_euclidean.{u}
{X : Type u} [MetricSpace X] (V : Set X) (v₀ : V) (hE : IsTwoStronglyEuclidean V) :
∃ (H : Type u) (_ : NormedAddCommGroup H) (_ : InnerProductSpace ℝ H) (_ : CompleteSpace H),
∃ f : V → H, (∀ a b : V, dist (f a) (f b) = dist a b) ∧ f v₀ = 0kmeans_lemma_local_factor_fiveIn LeanAlgorithm Design & Analysis
For every target set P and center c₁ with positive cost kmeans_cost_one P c₁ > 0, sampling a second center x in P with probability proportional to ||x - c₁||² yields an expected 2-means cost on P of at most 5 * OPT₁(P).
theorem kmeans_lemma_local_factor_five {E : Type*} [NormedAddCommGroup E] (P : Finset E) (c₁ : E) (hS : 0 < kmeans_cost_one P c₁) : (kmeans_cost_one P c₁)⁻¹ * ∑ x ∈ P, ‖x - c₁‖^2 * kmeans_cost_two P c₁ x ≤ 5 * kmeans_opt_one Pkmeans_opt_one_pos_implies_card_ge_twoIn LeanAlgorithm Design & Analysis
If a finite point set P has strictly positive optimal 1-means cost OPT₁(P) > 0, then P contains at least two distinct points.
theorem kmeans_opt_one_pos_implies_card_ge_two {E : Type*} [NormedAddCommGroup E] (P : Finset E) (h : 0 < kmeans_opt_one P) : 2 ≤ P.cardkmeans_plus_plus_two_competitive_ratio_upperIn LeanAlgorithm Design & Analysis
For every finite set of points X with OPT₂(X) > 0, the expected cost of the two centers chosen by k-means++ satisfies E[Phi₂] <= (5 - 2/|X|) * OPT₂(X).
theorem kmeans_plus_plus_two_competitive_ratio_upper {E : Type*} [NormedAddCommGroup E] (X : Finset E) (hopt : 0 < kmeans_opt_two X) : kmeans_plus_plus_two_expected_cost X ≤ (5 - 2 / (X.card : ℝ)) * kmeans_opt_two Xkmeans_plus_plus_two_ratioIn LeanAlgorithm Design & Analysis
For every finite set X subset R^d of n = |X| distinct points with OPT_2(X) > 0, the expected cost of the two centers chosen by k-means++ satisfies E[Phi_2] <= (5 - 2/n) OPT_2(X). Furthermore, the worst-case ratio satisfies R_2 = sup_{X, OPT_2(X)>0} E[Phi_2] / OPT_2(X) = 5, and this supremum is not attained.
theorem kmeans_plus_plus_two_ratio : (∀ (d : ℕ) (X : Finset (EuclideanSpace ℝ (Fin d))), 0 < kmeans_opt_two X → kmeans_plus_plus_two_expected_cost X ≤ (5 - 2 / (X.card : ℝ)) * kmeans_opt_two X) ∧ kmeans_two_worst_case_ratio = 5 ∧ ∀ r ∈ kmeans_two_competitive_ratios, r < 5
kmeans_prop_uniform_one_center_costIn LeanAlgorithm Design & Analysis
For any nonempty finite set P in a real inner product space, the uniform average over c in P of the 1-means cost kmeans_cost_one P c equals 2 * OPT₁(P).
theorem kmeans_prop_uniform_one_center_cost {E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℝ E] (P : Finset E) (hP : P.Nonempty) : (P.card : ℝ)⁻¹ * ∑ c ∈ P, kmeans_cost_one P c = 2 * kmeans_opt_one Plinear_isometry_extend_of_dense_submoduleIn LeanAlgorithm Design & Analysis
Let S be a submodule of a complete real inner product space H whose closure is everything, and K a complete real inner product space. Every linear isometry S → K extends to a linear isometry H → K.
theorem linear_isometry_extend_of_dense_submodule.{u}
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H] [CompleteSpace H]
{K : Type u} [NormedAddCommGroup K] [InnerProductSpace ℝ K] [CompleteSpace K]
(S : Submodule ℝ H) (hS : S.topologicalClosure = ⊤)
(L : ↥S →ₗᵢ[ℝ] K) :
∃ L' : H →ₗᵢ[ℝ] K, ∀ y : ↥S, L' (y : H) = L ylinear_isometry_on_span_of_isometric_embeddingsIn LeanAlgorithm Design & Analysis
Let V be a metric space with base point v₀, and let φ : V → H, g : V → K be isometric embeddings into real inner product spaces with φ v₀ = 0. Then there is a linear isometry from the span of range φ to K sending φ v to g v - g v₀.
theorem linear_isometry_on_span_of_isometric_embeddings.{u}
{V : Type u} [MetricSpace V] (v₀ : V)
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H]
{K : Type u} [NormedAddCommGroup K] [InnerProductSpace ℝ K]
(φ : V → H) (g : V → K)
(hφ : ∀ a b : V, dist (φ a) (φ b) = dist a b) (hφ₀ : φ v₀ = 0)
(hg : ∀ a b : V, dist (g a) (g b) = dist a b) :
∃ L : Submodule.span ℝ (Set.range φ) →ₗᵢ[ℝ] K,
∀ v : V, L ⟨φ v, Submodule.subset_span ⟨v, rfl⟩⟩ = g v - g v₀one_point_height_of_two_strongly_euclideanIn LeanAlgorithm Design & Analysis
Let V be 2-strongly Euclidean in X, v₀ ∈ V, and φ : V → H an isometric embedding into a complete real inner product space with φ v₀ = 0 and dense linear span. For every x ∈ X there is u ∈ H with ⟪u, φ v⟫ = (‖φ v‖² - dist x v ² + dist x v₀²)/2 for all v ∈ V, ‖u‖ ≤ dist x v₀, and u = φ x when x ∈ V.
theorem one_point_height_of_two_strongly_euclidean.{u}
{X : Type u} [MetricSpace X] (V : Set X) (v₀ : V) (hE : IsTwoStronglyEuclidean V)
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H] [CompleteSpace H]
(φ : V → H) (hφ : ∀ a b : V, dist (φ a) (φ b) = dist a b) (hφ₀ : φ v₀ = 0)
(hspan : (Submodule.span ℝ (Set.range φ)).topologicalClosure = ⊤) (x : X) :
∃ u : H,
(∀ v : V, inner ℝ u (φ v) = (‖φ v‖ ^ 2 - dist x (v : X) ^ 2 + dist x (v₀ : X) ^ 2) / 2) ∧
‖u‖ ≤ dist x (v₀ : X) ∧ (∀ (hx : x ∈ V), u = φ ⟨x, hx⟩)one_strongly_euclidean_bounded_projection_unboundedNeeds helpAlgorithm Design & Analysis
For every real C, a finite metric space is the union of two 1-strongly Euclidean sets. One is isometric to points on the unit sphere at mutual distances at least one, and the two points x,y of the other set have unit-height one-point realizations with projections in the core’s affine span and of norm at most one, but those projections are farther than C times d(x,y) apart.
theorem one_strongly_euclidean_bounded_projection_unbounded : ∀ C : ℝ,
∃ (n : ℕ) (M : MetricSpace (Fin (n+2))) (A : Set (Fin (n+2)))
(u : A → EuclideanSpace ℝ (Fin n))
(x y : Fin (n+2)) (px py : EuclideanSpace ℝ (Fin n)),
letI := M
IsOneStronglyEuclidean A ∧ IsOneStronglyEuclidean ({x,y} : Set (Fin (n+2))) ∧
A ∪ {x,y} = Set.univ ∧
(∀ a b : A, dist (u a) (u b) = dist a b) ∧
(∀ a : A, ‖u a‖ = 1) ∧
(∀ a b : A, a ≠ b → 1 ≤ dist (u a) (u b)) ∧
‖px‖ ≤ 1 ∧ ‖py‖ ≤ 1 ∧
px ∈ affineSpan ℝ (Set.range u) ∧ py ∈ affineSpan ℝ (Set.range u) ∧
(∀ a : A, dist (a : Fin (n+2)) x ^ 2 = dist (u a) px ^ 2 + 1) ∧
(∀ a : A, dist (a : Fin (n+2)) y ^ 2 = dist (u a) py ^ 2 + 1) ∧
C * dist x y < dist px pyoptimal_stochastic_mst_strategy_aux_is_tutteIn LeanAlgorithm Design & Analysis
From any state (Z, D), every strategy that is optimal for the subproblem from state (Z, D) is a Tutte strategy from state (Z, D).
theorem optimal_stochastic_mst_strategy_aux_is_tutte {V : Type*} [DecidableEq V]
(G : SimpleGraph V) (p : Sym2 V → ℝ)
(hp : ∀ e ∈ G.edgeSet, 0 < p e ∧ p e < 1)
(Z D : Finset (Sym2 V)) (T : StochasticMstStrategy (Sym2 V))
(hT : stochastic_mst_solves_aux G Z D T ∧
∀ T', stochastic_mst_solves_aux G Z D T' →
stochastic_mst_strategy_cost p T ≤ stochastic_mst_strategy_cost p T') :
stochastic_mst_is_tutte_aux G Z D Toptimal_stochastic_mst_strategy_continuation_optimalIn LeanAlgorithm Design & Analysis
If a strategy querying edge e with children s₀ and s₁ is optimal at state (Z, D), then continuation s₀ is optimal at state (insert e Z, D) and s₁ is optimal at state (Z, insert e D).
theorem optimal_stochastic_mst_strategy_continuation_optimal {V : Type*} [DecidableEq V]
(G : SimpleGraph V) (p : Sym2 V → ℝ)
(hp : ∀ e ∈ G.edgeSet, 0 < p e ∧ p e < 1)
(Z D : Finset (Sym2 V)) (e : Sym2 V)
(s₀ s₁ : StochasticMstStrategy (Sym2 V))
(hT : stochastic_mst_solves_aux G Z D (StochasticMstStrategy.query e s₀ s₁) ∧
∀ T', stochastic_mst_solves_aux G Z D T' →
stochastic_mst_strategy_cost p (StochasticMstStrategy.query e s₀ s₁) ≤ stochastic_mst_strategy_cost p T') :
(stochastic_mst_solves_aux G (insert e Z) D s₀ ∧
∀ T', stochastic_mst_solves_aux G (insert e Z) D T' →
stochastic_mst_strategy_cost p s₀ ≤ stochastic_mst_strategy_cost p T') ∧
(stochastic_mst_solves_aux G Z (insert e D) s₁ ∧
∀ T', stochastic_mst_solves_aux G Z (insert e D) T' →
stochastic_mst_strategy_cost p s₁ ≤ stochastic_mst_strategy_cost p T')optimal_stochastic_mst_strategy_is_tutteIn LeanAlgorithm Design & Analysis
Consider an instance of the adaptive MST-ID problem on a connected graph G with edge probabilities p taking values strictly between 0 and 1. If T is an optimal strategy solving this instance, then T is a Tutte strategy for G.
theorem optimal_stochastic_mst_strategy_is_tutte {V : Type*} [DecidableEq V]
(G : SimpleGraph V) (hG : G.Connected) (p : Sym2 V → ℝ)
(hp : ∀ e ∈ G.edgeSet, 0 < p e ∧ p e < 1)
(T : StochasticMstStrategy (Sym2 V))
(hT : is_optimal_stochastic_mst_strategy G p T) :
stochastic_mst_is_tutte G Toptimal_stochastic_mst_strategy_query_eligibleIn LeanAlgorithm Design & Analysis
If a strategy querying edge e with children s₀ and s₁ is optimal at state (Z, D), then e is query-eligible at state (Z, D).
theorem optimal_stochastic_mst_strategy_query_eligible {V : Type*} [DecidableEq V]
(G : SimpleGraph V) (p : Sym2 V → ℝ)
(hp : ∀ e ∈ G.edgeSet, 0 < p e ∧ p e < 1)
(Z D : Finset (Sym2 V)) (e : Sym2 V)
(s₀ s₁ : StochasticMstStrategy (Sym2 V))
(hT : stochastic_mst_solves_aux G Z D (StochasticMstStrategy.query e s₀ s₁) ∧
∀ T', stochastic_mst_solves_aux G Z D T' →
stochastic_mst_strategy_cost p (StochasticMstStrategy.query e s₀ s₁) ≤ stochastic_mst_strategy_cost p T') :
stochastic_mst_query_eligible G Z D eordinal_mst_boruvka_distortion_leIn LeanAlgorithm Design & Analysis
Let V be a finite type with at least 2 vertices, d : V → V → ℝ a pseudometric, and π : V → LinearOrder V an ordinal profile consistent with d. If F is an output of Algorithm 1 on π and T_mst is a minimum spanning tree under d, then graph_cost d F ≤ 2 * (Nat.clog 2 (Fintype.card V) : ℝ) * graph_cost d T_mst.
theorem ordinal_mst_boruvka_distortion_le
{V : Type*} [Fintype V] [DecidableEq V]
(d : V → V → ℝ) (hd : is_pseudometric d)
(π : V → LinearOrder V) (hπ : ordinal_profile_consistent d π)
(F : SimpleGraph V) (hF : is_algorithm1_output π F)
(T_mst : SimpleGraph V) (h_mst : is_mst d T_mst)
(hn : 2 ≤ Fintype.card V) :
graph_cost d F ≤ 2 * (Nat.clog 2 (Fintype.card V) : ℝ) * graph_cost d T_mstordinal_mst_round_cost_and_contractionIn LeanAlgorithm Design & Analysis
In Algorithm 1 on finite vertex type V with decidable equality, for any round from forest F to forest F' (boruvka_round π F F') under profile π : V → LinearOrder V consistent with pseudometric d : V → V → ℝ, and any minimum spanning tree T_mst under d (is_mst d T_mst), the cost difference graph_cost d F' - graph_cost d F is at most 2 * graph_cost d T_mst, and the number of connected components Fintype.card F'.ConnectedComponent is at most Fintype.card F.ConnectedComponent / 2.
theorem ordinal_mst_round_cost_and_contraction
{V : Type*} [Fintype V] [DecidableEq V]
(d : V → V → ℝ) (hd : is_pseudometric d)
(π : V → LinearOrder V) (hπ : ordinal_profile_consistent d π)
(F F' : SimpleGraph V) (h_round : boruvka_round π F F')
(T_mst : SimpleGraph V) (h_mst : is_mst d T_mst) :
graph_cost d F' - graph_cost d F ≤ 2 * graph_cost d T_mst ∧
Fintype.card F'.ConnectedComponent ≤ Fintype.card F.ConnectedComponent / 2pseudometric_nonnegIn LeanAlgorithm Design & Analysis
For any pseudometric d and vertices u, v, d(u, v) ≥ 0.
theorem pseudometric_nonneg {V : Type*} {d : V → V → ℝ} (hd : is_pseudometric d) (u v : V) : 0 ≤ d u vriesz_vector_of_linear_isometryIn LeanAlgorithm Design & Analysis
Let S : H → K be a linear isometry between real inner product spaces with H complete, and let w ∈ K. Then there is u ∈ H with ⟪u, y⟫ = ⟪w, S y⟫ for all y ∈ H, ‖u‖ ≤ ‖w‖, and ‖w‖² = ‖u‖² + ‖w - S u‖².
theorem riesz_vector_of_linear_isometry.{u}
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H] [CompleteSpace H]
{K : Type u} [NormedAddCommGroup K] [InnerProductSpace ℝ K]
(S : H →ₗᵢ[ℝ] K) (w : K) :
∃ u : H, (∀ y : H, inner ℝ u y = inner ℝ w (S y)) ∧ ‖u‖ ≤ ‖w‖ ∧
‖w‖ ^ 2 = ‖u‖ ^ 2 + ‖w - S u‖ ^ 2skew_rank_two_factor_representationIn LeanAlgorithm Design & Analysis
Every skew-symmetric real n × n matrix of rank at most 2 admits a factor representation by vectors h₁, ..., hₙ ∈ ℝ² such that W_{ij} = (h_i)₁ (h_j)₂ - (h_i)₂ (h_j)₁ for all i, j ∈ {1, ..., n}.
theorem skew_rank_two_factor_representation {n : ℕ} (W : Matrix (Fin n) (Fin n) ℝ)
(h_skew : W.transpose = -W) (h_rank : W.rank ≤ 2) :
∃ h : Fin n → ℝ × ℝ, ∀ i j, W i j = (h i).1 * (h j).2 - (h i).2 * (h j).1stochastic_mst_adaptive_cost_aux_le_queryIn LeanAlgorithm Design & Analysis
If the edge e is eligible at the state (Z,D), then the optimal adaptive cost of k+1 further queries is at most 1 + p e * (value at fuel k from (Z, insert e D)) + (1 - p e) * (value at fuel k from (insert e Z, D)): querying e is one admissible first move.
open Classical in
theorem stochastic_mst_adaptive_cost_aux_le_query {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p : Sym2 V → ℝ) (k : ℕ) (Z D : Finset (Sym2 V))
{e : Sym2 V} (he : stochastic_mst_query_eligible G Z D e) :
stochastic_mst_adaptive_cost_aux G p (k+1) Z D ≤
1 + p e * stochastic_mst_adaptive_cost_aux G p k Z (insert e D)
+ (1 - p e) * stochastic_mst_adaptive_cost_aux G p k (insert e Z) Dstochastic_mst_adaptive_cost_aux_succIn LeanAlgorithm Design & Analysis
For any graph G, probability function p, fuel k+1 and state of queried edge sets (Z, D), the optimal adaptive cost of k+1 further queries equals 0 if no edge of G is eligible at (Z,D), and otherwise equals the minimum over the eligible edges e of 1 + p e * (value at fuel k from state (Z, insert e D)) + (1 - p e) * (value at fuel k from (insert e Z, D)).
open Classical in
theorem stochastic_mst_adaptive_cost_aux_succ {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p : Sym2 V → ℝ) (k : ℕ) (Z D : Finset (Sym2 V)) :
stochastic_mst_adaptive_cost_aux G p (k+1) Z D =
(if h : (G.edgeFinset.filter (fun e => stochastic_mst_query_eligible G Z D e)).Nonempty then
(G.edgeFinset.filter (fun e => stochastic_mst_query_eligible G Z D e)).inf' h
(fun e => 1 + p e * stochastic_mst_adaptive_cost_aux G p k Z (insert e D)
+ (1 - p e) * stochastic_mst_adaptive_cost_aux G p k (insert e Z) D)
else 0)stochastic_mst_priority_cost_aux_succIn LeanAlgorithm Design & Analysis
For any graph G, probability function p, edge ordering pi, fuel k+1 and state of queried edge sets (Z, D), the expected number of further queries of the fixed-priority strategy is 0 if pi contains no edge eligible at (Z,D), and otherwise is 1 + p e * (value at fuel k from (Z, insert e D)) + (1 - p e) * (value at fuel k from (insert e Z, D)), where e is the first eligible edge of pi.
open Classical in
theorem stochastic_mst_priority_cost_aux_succ {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p : Sym2 V → ℝ) (π : List (Sym2 V)) (k : ℕ)
(Z D : Finset (Sym2 V)) :
stochastic_mst_priority_cost_aux G p π (k+1) Z D =
(match π.find? (fun e => decide (stochastic_mst_query_eligible G Z D e)) with
| none => 0
| some e => 1 + p e * stochastic_mst_priority_cost_aux G p π k Z (insert e D)
+ (1 - p e) * stochastic_mst_priority_cost_aux G p π k (insert e Z) D)stochastic_mst_priority_cost_eq_minIn LeanAlgorithm Design & Analysis
There is an ordering pi of the edges of G at which the infimum defining P(G,p) is attained: the fixed-priority cost P(G,p) equals stochastic_mst_priority_cost_aux G p pi (card of edges) ∅ ∅.
theorem stochastic_mst_priority_cost_eq_min {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p : Sym2 V → ℝ) :
∃ π : List (Sym2 V), π.Perm G.edgeFinset.toList ∧
stochastic_mst_priority_cost G p = stochastic_mst_priority_cost_aux G p π G.edgeFinset.card ∅ ∅stochastic_mst_priority_cost_le_aux_of_permIn LeanAlgorithm Design & Analysis
For every ordering pi of the edges of G, the fixed-priority cost P(G,p) is at most the expected number of queries of that particular order, stochastic_mst_priority_cost_aux G p pi (card of edges) ∅ ∅.
theorem stochastic_mst_priority_cost_le_aux_of_perm {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p : Sym2 V → ℝ) (π : List (Sym2 V))
(hπ : π.Perm G.edgeFinset.toList) :
stochastic_mst_priority_cost G p ≤ stochastic_mst_priority_cost_aux G p π G.edgeFinset.card ∅ ∅stochastic_mst_priority_cost_value_set_finiteIn LeanAlgorithm Design & Analysis
The set of real numbers x for which some permutation pi of the edge list of G satisfies x = stochastic_mst_priority_cost_aux G p pi (card of edges) ∅ ∅ (the set whose infimum defines P(G,p)) is finite and nonempty.
theorem stochastic_mst_priority_cost_value_set_finite {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (p : Sym2 V → ℝ) :
({x : ℝ | ∃ π : List (Sym2 V), π.Perm G.edgeFinset.toList ∧
x = stochastic_mst_priority_cost_aux G p π G.edgeFinset.card ∅ ∅}).Finite ∧
({x : ℝ | ∃ π : List (Sym2 V), π.Perm G.edgeFinset.toList ∧
x = stochastic_mst_priority_cost_aux G p π G.edgeFinset.card ∅ ∅}).Nonemptystochastic_mst_priority_find_none_iffIn LeanAlgorithm Design & Analysis
If the list pi is a permutation of the edge list of G, then the fixed-priority rule finds no eligible edge in pi at state (Z,D) if and only if G has no edge at all that is eligible at (Z,D).
open Classical in
theorem stochastic_mst_priority_find_none_iff {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (Z D : Finset (Sym2 V)) (π : List (Sym2 V))
(hπ : π.Perm G.edgeFinset.toList) :
(π.find? (fun e => decide (stochastic_mst_query_eligible G Z D e)) = none) ↔
¬ (G.edgeFinset.filter (fun e => stochastic_mst_query_eligible G Z D e)).Nonemptystochastic_mst_priority_gap_of_not_cactusIn LeanAlgorithm Design & Analysis
If G is connected and not a cactus then some p with 0 < p e < 1 on the edges of G makes the optimal adaptive cost strictly smaller than the optimal fixed-priority cost.
theorem stochastic_mst_priority_gap_of_not_cactus {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hG : G.Connected) (hc : ¬ simple_graph_is_cactus G) :
∃ p : Sym2 V → ℝ, (∀ e ∈ G.edgeSet, 0 < p e ∧ p e < 1) ∧
stochastic_mst_adaptive_cost G p < stochastic_mst_priority_cost G pstochastic_mst_priority_optimal_of_cactusIn LeanAlgorithm Design & Analysis
If G is a connected cactus then for every p with 0 < p e < 1 on the edges of G the optimal fixed-priority cost equals the optimal adaptive cost.
theorem stochastic_mst_priority_optimal_of_cactus {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hG : G.Connected) (hc : simple_graph_is_cactus G) :
∀ p : Sym2 V → ℝ, (∀ e ∈ G.edgeSet, 0 < p e ∧ p e < 1) →
stochastic_mst_priority_cost G p = stochastic_mst_adaptive_cost G pstrong_euclidean_extension_exponent_product_boundIn LeanAlgorithm Design & Analysis
At exponent 179/200, the multiplicative extension factor in equation (14) of arXiv:2611.08546 is at most exp(179/200) times (m+1) to that exponent.
theorem strong_euclidean_extension_exponent_product_bound (m : ℕ) : (∏ r ∈ Finset.range m, (1 + (179 / 200 : ℝ) / ((r : ℝ) + 1))) ≤ Real.exp (179 / 200 : ℝ) * ((m : ℝ) + 1) ^ (179 / 200 : ℝ)
strong_euclidean_one_point_energy_scalar_boundIn LeanAlgorithm Design & Analysis
For nonnegative internal and crossing energies, the scalar upper bound in equation (17) of arXiv:2611.08546 is bounded by the quadratic extension factors associated with exponent 179/200.
theorem strong_euclidean_one_point_energy_scalar_bound (I J : ℝ) (hI : 0 ≤ I) (hJ : 0 ≤ J) : (1/2 : ℝ) * (Real.sqrt J + Real.sqrt (J + I + Real.sqrt (I * (I + J))))^2 ≤ (1 + (179/200 : ℝ))^2 * I + (1 + (179/400 : ℝ))^2 * J
strong_euclidean_resolvent_scalar_inequalityIn LeanAlgorithm Design & Analysis
The scalar inequalities m² ≤ I(m−v) and 0 ≤ v ≤ m ≤ I imply the numerical estimate used for the one-strongly-Euclidean elimination energy in arXiv:2611.08546, Section 4.7.
theorem strong_euclidean_resolvent_scalar_inequality (I J m v : ℝ) (hI : 0 ≤ I) (hJ : 0 ≤ J) (hv : 0 ≤ v) (hvm : v ≤ m) (hmI : m ≤ I) (hquad : m^2 ≤ I * (m-v)) : 2*m + 2*Real.sqrt (J*v) ≤ I + Real.sqrt (I*(I+J))
tarski_box_query_le_five_log_sqIn LeanAlgorithm Design & Analysis
The residual open content of the target, in box form: five-dimensional Tarski search has O(log² n) query complexity on every box, uniformly in the box.
theorem tarski_box_query_le_five_log_sq :
∃ C : ℝ, ∀ n : ℕ, 2 ≤ n → ∃ q : ℕ,
tarski_box_query_le n 5 q ∧ (q : ℝ) ≤ C * Real.logb 2 n ^ 2terminal_embedding_of_height_lipschitzIn LeanAlgorithm Design & Analysis
Let φ : V → H be isometric, u : X → H, a : X → ℝ, with u x = φ x and a x = 0 on V, dist x v₀ ² = ‖u x‖² + a x², the prescribed inner products, and the Lipschitz inequality ‖u x - u y‖² + (a x - a y)² ≤ dist x y ². Then x ↦ (u x, a x) into WithLp 2 (H × ℝ) is a terminal embedding for V.
theorem terminal_embedding_of_height_lipschitz.{u}
{X : Type u} [MetricSpace X] (V : Set X) (v₀ : V)
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H] [CompleteSpace H]
(φ : V → H) (hφ : ∀ a b : V, dist (φ a) (φ b) = dist a b)
(u : X → H) (a : X → ℝ)
(huV : ∀ (x : X) (hx : x ∈ V), u x = φ ⟨x, hx⟩ ∧ a x = 0)
(ha : ∀ x : X, dist x (v₀ : X) ^ 2 = ‖u x‖ ^ 2 + a x ^ 2)
(hin : ∀ (x : X) (v : V),
inner ℝ (u x) (φ v) = (‖φ v‖ ^ 2 - dist x (v : X) ^ 2 + dist x (v₀ : X) ^ 2) / 2)
(hlip : ∀ x y : X, ‖u x - u y‖ ^ 2 + (a x - a y) ^ 2 ≤ dist x y ^ 2) :
IsTerminalEmbedding V (fun x : X => WithLp.toLp 2 (u x, a x))two_point_decomposition_in_ambientIn LeanAlgorithm Design & Analysis
Let S : H → K be a linear isometry, p, r ∈ K, and u, u' ∈ H with ⟪u, y⟫ = ⟪p, S y⟫ and ⟪u', y⟫ = ⟪r, S y⟫ for all y. Then dist p r squared equals ‖u - u'‖² + ‖(p - S u) - (r - S u')‖².
theorem two_point_decomposition_in_ambient.{u}
{H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℝ H] [CompleteSpace H]
{K : Type u} [NormedAddCommGroup K] [InnerProductSpace ℝ K]
(S : H →ₗᵢ[ℝ] K) (p r : K) (u u' : H)
(hu : ∀ y : H, inner ℝ u y = inner ℝ p (S y))
(hu' : ∀ y : H, inner ℝ u' y = inner ℝ r (S y)) :
dist p r ^ 2 = ‖u - u'‖ ^ 2 + ‖(p - S u) - (r - S u')‖ ^ 2v_selection_sixteen_eight_le_twenty_eightNeeds helpAlgorithm Design & Analysis
The worst-case comparison complexity of finding the 8th smallest element among 16 elements is at most 28, that is, V_8(16) ≤ 28.
theorem v_selection_sixteen_eight_le_twenty_eight : v_selection 16 8 ≤ 28
dist_induce_compl_eq_of_leafIn LeanApproximation & Inapproximability
If w is a leaf of the subcubic tree H and u, v are distinct from w, then the distance between u and v in the induced subgraph on W \ {w} equals their distance in H.
theorem dist_induce_compl_eq_of_leaf {W : Type} [Fintype W] (H : SimpleGraph W)
(hH : is_subcubic_tree H) {w : W} (hleaf : open Classical in H.degree w = 1)
(u v : {x : W // x ≠ w}) :
(H.induce {x : W | x ≠ w}).dist u v = H.dist u.val v.valexists_min_vertex_coverIn LeanApproximation & Inapproximability
Every finite simple graph G has a minimum vertex cover U as a Finset of vertices whose cardinality equals G.vertexCoverNum.toNat.
theorem exists_min_vertex_cover
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) :
∃ U : Finset V, G.IsVertexCover (U : Set V) ∧ U.card = G.vertexCoverNum.toNatgenerating_rank_corpus_lower_boundIn LeanApproximation & Inapproximability
For any connected finite simple graph G, the generating rank of corpus_words G is at least 3 * |E(G)| + vertexCoverNum(G).
theorem generating_rank_corpus_lower_bound
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hG : G.Connected) :
3 * G.edgeFinset.card + G.vertexCoverNum.toNat ≤ word_generating_rank (corpus_words G)generating_rank_corpus_upper_boundIn LeanApproximation & Inapproximability
The generating rank of corpus_words G is at most 3 * |E(G)| + vertexCoverNum(G).
theorem generating_rank_corpus_upper_bound
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] :
word_generating_rank (corpus_words G) ≤ 3 * G.edgeFinset.card + G.vertexCoverNum.toNatgenerating_rank_corpus_vertex_coverIn LeanApproximation & Inapproximability
For any simple undirected connected finite graph G with decidable equality and decidable adjacency, the generating rank word_generating_rank (corpus_words G) of the reduction corpus equals 3 * G.edgeFinset.card + G.vertexCoverNum.toNat, where G.vertexCoverNum.toNat is the minimum vertex cover size of G.
theorem generating_rank_corpus_vertex_cover
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hG : G.Connected) :
word_generating_rank (corpus_words G) = 3 * G.edgeFinset.card + G.vertexCoverNum.toNatgreedy_rc_compression_halfIn LeanApproximation & Inapproximability
Let cm be an involution on a type Γ with decidable equality and T an RC-substring-free finite set of lists. If some execution of GREEDY-RC (greedy_rc_step, any tie-breaking) leads from T to the singleton {t}, then 2·|t| ≤ (Σ_{u ∈ T} |u|) + scs_rc_opt cm T; equivalently the compression Σ|u| − |t| is at least half the optimal compression Σ|u| − |OPT(T)|.
theorem greedy_rc_compression_half {Γ : Type*} [DecidableEq Γ] (cm : Γ → Γ)
(hcm : Function.Involutive cm) (T : Finset (List Γ)) (hfree : rc_substring_free cm T)
(t : List Γ) (hrun : Relation.ReflTransGen (greedy_rc_step cm) T {t}) :
2 * t.length ≤ (∑ u ∈ T, u.length) + scs_rc_opt cm Tle_spanning_tree_congestionIn LeanApproximation & Inapproximability
If H has at least one spanning tree and every spanning tree of H has some fundamental cut of load at least c, then the weighted spanning tree congestion of H is at least c.
theorem le_spanning_tree_congestion {α : Type*} [Fintype α] [DecidableEq α]
(H : SimpleGraph α) [DecidableRel H.Adj] (w : Sym2 α → ℕ)
(hne : ∃ T : SimpleGraph α, T ≤ H ∧ T.IsTree) (c : ℕ)
(h : ∀ T : SimpleGraph α, T ≤ H → T.IsTree →
c ≤ (open scoped Classical in T.edgeFinset.sup (fundamental_cut_load H w T))) :
c ≤ spanning_tree_congestion H wmgreedy_rc_output_length_sum_le_three_optIn LeanApproximation & Inapproximability
Let cm be an involution on a type Γ with decidable equality and S an RC-substring-free finite set of lists. If some execution of MGREEDY-RC (mgreedy_rc_step, any tie-breaking) leads from (S, ∅) to (∅, T), then Σ_{u ∈ T} |u| ≤ 3 · scs_rc_opt cm S: the concatenation of T, which is MGREEDY-RC's output, has length at most three times the optimum.
theorem mgreedy_rc_output_length_sum_le_three_opt {Γ : Type*} [DecidableEq Γ] (cm : Γ → Γ)
(hcm : Function.Involutive cm) (S T : Finset (List Γ)) (hfree : rc_substring_free cm S)
(hrun : Relation.ReflTransGen (mgreedy_rc_step cm) (S, ∅) (∅, T)) :
(∑ u ∈ T, u.length) ≤ 3 * scs_rc_opt cm Smgreedy_rc_output_rc_substring_freeIn LeanApproximation & Inapproximability
Let cm be an involution on a type Γ with decidable equality and S an RC-substring-free finite set of lists. If some execution of MGREEDY-RC (mgreedy_rc_step, any tie-breaking) leads from (S, ∅) to (∅, T), then T is RC-substring-free: no element of T is an infix of another element or of its reverse complement.
theorem mgreedy_rc_output_rc_substring_free {Γ : Type*} [DecidableEq Γ] (cm : Γ → Γ)
(hcm : Function.Involutive cm) (S T : Finset (List Γ)) (hfree : rc_substring_free cm S)
(hrun : Relation.ReflTransGen (mgreedy_rc_step cm) (S, ∅) (∅, T)) :
rc_substring_free cm Tmgreedy_rc_output_scs_rc_opt_le_two_optIn LeanApproximation & Inapproximability
Let cm be an involution on a type Γ with decidable equality and S an RC-substring-free finite set of lists. If some execution of MGREEDY-RC leads from (S, ∅) to (∅, T), then scs_rc_opt cm T ≤ 2 · scs_rc_opt cm S.
theorem mgreedy_rc_output_scs_rc_opt_le_two_opt {Γ : Type*} [DecidableEq Γ] (cm : Γ → Γ)
(hcm : Function.Involutive cm) (S T : Finset (List Γ)) (hfree : rc_substring_free cm S)
(hrun : Relation.ReflTransGen (mgreedy_rc_step cm) (S, ∅) (∅, T)) :
scs_rc_opt cm T ≤ 2 * scs_rc_opt cm Sop_98_degree_step_packing_boundIn LeanApproximation & Inapproximability
Inductive step extending the (9/4)-approximation bound from packings with maximum conflict degree ≤ d to conflict degree ≤ d + 1 for any d ≥ 2.
theorem op_98_degree_step_packing_bound {α : Type*} [DecidableEq α]
(inst : WeightedSetPackingInstance α 4) (A O : Finset (Finset α))
(hA : is_square_locally_optimal inst 4 A) (hO : is_packing inst O) (d : ℕ) (hd : 2 ≤ d)
(hind : ∀ (O' : Finset (Finset α)), is_packing inst O' →
(∀ o ∈ O', (conflict_neighborhood A {o}).card ≤ d) →
packing_weight inst O' ≤ (9 / 4 : ℚ) * packing_weight inst A)
(h_deg : ∀ o ∈ O, (conflict_neighborhood A {o}).card ≤ d + 1) :
packing_weight inst O ≤ (9 / 4 : ℚ) * packing_weight inst Aop_98_degree_three_step_packing_boundIn LeanApproximation & Inapproximability
In any weighted 4-set packing instance inst where A is square locally optimal for size-4 exchanges, if every packing O' of maximum conflict degree ≤ 3 satisfies weight(O') ≤ (9/4)·weight(A), then any packing O of maximum conflict degree ≤ 4 satisfies weight(O) ≤ (9/4)·weight(A).
theorem op_98_degree_three_step_packing_bound {α : Type*} [DecidableEq α]
(inst : WeightedSetPackingInstance α 4) (A O : Finset (Finset α))
(hA : is_square_locally_optimal inst 4 A) (hO : is_packing inst O)
(hind : ∀ (O' : Finset (Finset α)), is_packing inst O' →
(∀ o ∈ O', (conflict_neighborhood A {o}).card ≤ 3) →
packing_weight inst O' ≤ (9 / 4 : ℚ) * packing_weight inst A)
(h_deg : ∀ o ∈ O, (conflict_neighborhood A {o}).card ≤ 4) :
packing_weight inst O ≤ (9 / 4 : ℚ) * packing_weight inst Aop_98_degree_two_step_packing_boundIn LeanApproximation & Inapproximability
In any weighted 4-set packing instance inst where A is square locally optimal for size-4 exchanges, if every packing O' of maximum conflict degree ≤ 2 satisfies weight(O') ≤ (9/4)·weight(A), then any packing O of maximum conflict degree ≤ 3 satisfies weight(O) ≤ (9/4)·weight(A).
theorem op_98_degree_two_step_packing_bound {α : Type*} [DecidableEq α]
(inst : WeightedSetPackingInstance α 4) (A O : Finset (Finset α))
(hA : is_square_locally_optimal inst 4 A) (hO : is_packing inst O)
(hind : ∀ (O' : Finset (Finset α)), is_packing inst O' →
(∀ o ∈ O', (conflict_neighborhood A {o}).card ≤ 2) →
packing_weight inst O' ≤ (9 / 4 : ℚ) * packing_weight inst A)
(h_deg : ∀ o ∈ O, (conflict_neighborhood A {o}).card ≤ 3) :
packing_weight inst O ≤ (9 / 4 : ℚ) * packing_weight inst Aop_98_empty_repairs_reductionIn LeanApproximation & Inapproximability
If there is c < 5/2 with weight(O) ≤ c·weight(A) for every packing O, then the target holds: take R = ∅, which is a compatible repair family vacuously, and apply_repairs A ∅ = A.
theorem op_98_empty_repairs_reduction
(h : ∃ c : ℚ, c < 5 / 2 ∧ ∀ (α : Type) [DecidableEq α] (inst : WeightedSetPackingInstance α 4)
(A : Finset (Finset α)), is_square_locally_optimal inst 4 A → ∀ O, is_packing inst O →
packing_weight inst O ≤ c * packing_weight inst A) :
∃ c : ℚ, c < 5 / 2 ∧ ∀ (α : Type) [DecidableEq α] (inst : WeightedSetPackingInstance α 4)
(A : Finset (Finset α)), is_square_locally_optimal inst 4 A → ∃ R : Finset (Finset (Finset α)),
(∀ X ∈ R, is_repair inst A X) ∧ is_compatible_repair_family R ∧ ∀ O, is_packing inst O →
packing_weight inst O ≤ c * packing_weight inst (apply_repairs A R)op_98_repairs_free_boundIn LeanApproximation & Inapproximability
There is a rational c < 5/2 such that for every weighted 4-set packing instance and every square locally optimal packing A, every packing O satisfies weight(O) ≤ c·weight(A).
theorem op_98_repairs_free_bound :
∃ c : ℚ, c < 5 / 2 ∧ ∀ (α : Type) [DecidableEq α] (inst : WeightedSetPackingInstance α 4)
(A : Finset (Finset α)), is_square_locally_optimal inst 4 A → ∀ O, is_packing inst O →
packing_weight inst O ≤ c * packing_weight inst Aop_98_two_cluster_degree_boundIn LeanApproximation & Inapproximability
Each a ∈ A conflicts with at most 4 sets of the packing O.
theorem op_98_two_cluster_degree_bound {α : Type*} [DecidableEq α]
(inst : WeightedSetPackingInstance α 4) (A O : Finset (Finset α))
(hA : is_square_locally_optimal inst 4 A) (hO : is_packing inst O)
(a : Finset α) (ha : a ∈ A) :
(O.filter (fun o => ¬ Disjoint a o)).card ≤ 4op_98_two_cluster_exchange_subsetIn LeanApproximation & Inapproximability
For any sub-packing X ⊆ O with at most 4 sets, the squared weight of X is at most the squared weight of its conflict neighbourhood in A.
theorem op_98_two_cluster_exchange_subset {α : Type*} [DecidableEq α]
(inst : WeightedSetPackingInstance α 4) (A O X : Finset (Finset α))
(hA : is_square_locally_optimal inst 4 A) (hO : is_packing inst O)
(hX : X ⊆ O) (hXc : X.card ≤ 4) :
∑ o ∈ X, (inst.weight o) ^ 2 ≤ ∑ a ∈ conflict_neighborhood A X, (inst.weight a) ^ 2op_98_two_cluster_packing_boundIn LeanApproximation & Inapproximability
When every set o in a packing O has at most 2 conflict neighbors in A, packing_weight inst O ≤ (9/4) * packing_weight inst A under square local optimality.
theorem op_98_two_cluster_packing_bound {α : Type*} [DecidableEq α]
(inst : WeightedSetPackingInstance α 4) (A O : Finset (Finset α))
(hA : is_square_locally_optimal inst 4 A) (hO : is_packing inst O)
(h2 : ∀ o ∈ O, (conflict_neighborhood A {o}).card ≤ 2) :
packing_weight inst O ≤ (9 / 4 : ℚ) * packing_weight inst Aop_98_two_cluster_subset_packingIn LeanApproximation & Inapproximability
Any sub-collection X of a packing O is again a packing.
theorem op_98_two_cluster_subset_packing {α : Type*} [DecidableEq α] {k : ℕ}
(inst : WeightedSetPackingInstance α k) {O X : Finset (Finset α)}
(hO : is_packing inst O) (hX : X ⊆ O) : is_packing inst Xop_98_two_cluster_weight_aggregationIn LeanApproximation & Inapproximability
Abstract two-cluster aggregation: given nonnegative weights u on A and v on O, every o ∈ O having at most 2 conflict-neighbours in A, empty conflict neighbourhood forcing v ≤ 0, every a ∈ A having conflict degree ≤ 4 in O, and the squared 4-exchange inequalities for all sub-collections of O of size at most 4, one has weight(O) ≤ (9/4)·weight(A). Equivalently: on the multigraph with vertices A and edges O (each edge touching its 1 or 2 conflict-neighbours), with max degree ≤ 4 and ∑_{e∈S} v_e² ≤ ∑_{a∈V(S)} u_a² for every |S| ≤ 4, one has ∑_e v_e ≤ (9/4) ∑_a u_a.
theorem op_98_two_cluster_weight_aggregation {α : Type*} [DecidableEq α]
(A O : Finset (Finset α)) (u v : Finset α → ℚ)
(hu : ∀ a ∈ A, 0 ≤ u a) (hv : ∀ o ∈ O, 0 ≤ v o)
(hT : ∀ o ∈ O, (conflict_neighborhood A {o}).card ≤ 2)
(hzero : ∀ o ∈ O, conflict_neighborhood A {o} = ∅ → v o ≤ 0)
(hdeg : ∀ a ∈ A, (O.filter (fun o => ¬ Disjoint a o)).card ≤ 4)
(hex : ∀ X : Finset (Finset α), X ⊆ O → X.card ≤ 4 →
∑ o ∈ X, (v o) ^ 2 ≤ ∑ a ∈ conflict_neighborhood A X, (u a) ^ 2) :
∑ o ∈ O, v o ≤ (9 / 4 : ℚ) * ∑ a ∈ A, u aop_98_two_cluster_zero_neighborhood_weightIn LeanApproximation & Inapproximability
If a set o ∈ O has empty conflict neighbourhood in A, then its weight is at most 0.
theorem op_98_two_cluster_zero_neighborhood_weight {α : Type*} [DecidableEq α]
(inst : WeightedSetPackingInstance α 4) (A O : Finset (Finset α))
(hA : is_square_locally_optimal inst 4 A) (hO : is_packing inst O)
(o : Finset α) (ho : o ∈ O)
(hzero : conflict_neighborhood A {o} = ∅) :
inst.weight o ≤ 0spanning_tree_congestion_le_of_witnessIn LeanApproximation & Inapproximability
If some spanning tree of H has all fundamental-cut loads at most c, then the weighted spanning tree congestion of H is at most c.
theorem spanning_tree_congestion_le_of_witness {α : Type*} [Fintype α] [DecidableEq α]
(H : SimpleGraph α) [DecidableRel H.Adj] (w : Sym2 α → ℕ)
(T : SimpleGraph α) (hT : T ≤ H) (htree : T.IsTree) (c : ℕ)
(hc : (open scoped Classical in T.edgeFinset.sup (fundamental_cut_load H w T)) ≤ c) :
spanning_tree_congestion H w ≤ cstar_routing_distance_sum_lower_boundIn LeanApproximation & Inapproximability
If H is a subcubic tree, w is a vertex of degree at most 3, and A is a finite set of vertices not containing w, then the sum over a in A of dist_H(w,a) is at least 2|A| − 3.
theorem star_routing_distance_sum_lower_bound {W : Type} [Fintype W] (H : SimpleGraph W)
(hH : is_subcubic_tree H) (w : W) (A : Finset W) (hw : w ∉ A) :
2 * A.card - 3 ≤ ∑ a ∈ A, H.dist w astc_reduction_gadget_adj_iffIn LeanApproximation & Inapproximability
Two vertices of H_A are adjacent iff they are adjacent in Q, or one is s_i (resp. t_i) and the other is w_{ij} for some j.
theorem stc_reduction_gadget_adj_iff {V : Type*} (Q : SimpleGraph V) {p : ℕ}
(s t : Fin p → V) (A : ℕ) (x y : Sum V (Fin p × Fin A)) :
(stc_reduction_gadget Q s t A).Adj x y ↔
(match x, y with
| Sum.inl u, Sum.inl v => Q.Adj u v
| Sum.inl u, Sum.inr (i, _) => u = s i ∨ u = t i
| Sum.inr (i, _), Sum.inl u => u = s i ∨ u = t i
| Sum.inr _, Sum.inr _ => False)stc_reduction_gadget_connectedIn LeanApproximation & Inapproximability
If Q is connected then H_A is connected.
theorem stc_reduction_gadget_connected {V : Type*} (Q : SimpleGraph V) (hQ : Q.Connected)
{p : ℕ} (s t : Fin p → V) (A : ℕ) :
(stc_reduction_gadget Q s t A).Connectedstc_reduction_weight_aux_edgesIn LeanApproximation & Inapproximability
For s i ≠ t i, the weight of the heavy edge joining w_{ij} to t_i is A + 1, and the weight of the light edge joining w_{ij} to s_i is 1.
theorem stc_reduction_weight_aux_edges {V : Type*} [DecidableEq V] {p : ℕ}
(s t : Fin p → V) (A : ℕ) (i : Fin p) (j : Fin A) (h : s i ≠ t i) :
stc_reduction_weight s t A (Sym2.mk (Sum.inl (t i)) (Sum.inr (i, j))) = A + 1 ∧
stc_reduction_weight s t A (Sym2.mk (Sum.inl (s i)) (Sum.inr (i, j))) = 1steiner_elimination_for_hostIn LeanApproximation & Inapproximability
For any graph T on V, any subcubic tree H on W and any injection f : V ↪ W, there is a subcubic tree H' on V whose routing cost is at most that of H under f.
theorem steiner_elimination_for_host {V : Type} [Fintype V] [Nonempty V]
{W : Type} [Fintype W] (T : SimpleGraph V) (H : SimpleGraph W) (hH : is_subcubic_tree H)
(f : V ↪ W) :
∃ (H' : SimpleGraph V), is_subcubic_tree H' ∧
tree_routing_cost T H' id ≤ tree_routing_cost T H fsteiner_elimination_for_host_of_all_nont_degree_threeIn LeanApproximation & Inapproximability
Let T be a graph on V, H a subcubic tree on W, f : V ↪ W injective, and suppose every vertex of W outside the image of f has degree exactly 3 in H. Then there is a subcubic tree H' on V with tree_routing_cost T H' id ≤ tree_routing_cost T H f.
theorem steiner_elimination_for_host_of_all_nont_degree_three {V : Type} [Fintype V]
[Nonempty V] {W : Type} [Fintype W] (T : SimpleGraph V) (H : SimpleGraph W)
(hH : is_subcubic_tree H) (f : V ↪ W)
(h3 : ∀ w : W, w ∉ Set.range f → (open Classical in H.degree w = 3)) :
∃ (H' : SimpleGraph V), is_subcubic_tree H' ∧ tree_routing_cost T H' id ≤ tree_routing_cost T H fsteiner_elimination_for_host_of_surjectiveIn LeanApproximation & Inapproximability
If the injection f : V ↪ W is surjective, then H is (up to the bijection f) already a subcubic tree on the terminal set, so there is a subcubic tree H' on V with tree_routing_cost T H' id = tree_routing_cost T H f.
theorem steiner_elimination_for_host_of_surjective {V : Type} [Fintype V] [Nonempty V]
{W : Type} [Fintype W] (T : SimpleGraph V) (H : SimpleGraph W) (hH : is_subcubic_tree H)
(f : V ↪ W) (hsurj : Function.Surjective f) :
∃ (H' : SimpleGraph V), is_subcubic_tree H' ∧ tree_routing_cost T H' id = tree_routing_cost T H fsteiner_host_nont_degree_two_eliminationIn LeanApproximation & Inapproximability
If H is a subcubic tree on W, w is not in the image of f, and H.degree w = 2 with neighbours a and b, then the graph obtained from H by deleting w and adding the edge ab is a subcubic tree on W \ {w} (retaining the same embedding, restricted) whose routing cost is at most that of H, using strictly fewer vertices.
theorem steiner_host_nont_degree_two_elimination {V : Type} [Fintype V] [Nonempty V]
{W : Type} [Fintype W] (T : SimpleGraph V) (H : SimpleGraph W) (hH : is_subcubic_tree H)
(f : V ↪ W) (w : W) (hnont : ∀ v, f v ≠ w) (hdeg : open Classical in H.degree w = 2) :
∃ (W' : Type) (_ : Fintype W') (H' : SimpleGraph W') (_ : is_subcubic_tree H') (f' : V ↪ W'),
tree_routing_cost T H' f' ≤ tree_routing_cost T H f ∧ Fintype.card W' < Fintype.card Wsteiner_host_nont_leaf_eliminationIn LeanApproximation & Inapproximability
If H is a subcubic tree on W, f : V ↪ W is injective, and w ∈ W is not in the image of f and is a leaf of H, then the induced subgraph of H on W \ {w} is a subcubic tree and, with the same embedding f, has exactly the same routing cost, using strictly fewer vertices.
theorem steiner_host_nont_leaf_elimination {V : Type} [Fintype V] [Nonempty V] {W : Type} [Fintype W]
(T : SimpleGraph V) (H : SimpleGraph W) (hH : is_subcubic_tree H) (f : V ↪ W) (w : W)
(hnont : ∀ v, f v ≠ w) (hleaf : open Classical in H.degree w = 1) :
∃ (W' : Type) (_ : Fintype W') (H' : SimpleGraph W') (_ : is_subcubic_tree H') (f' : V ↪ W'),
tree_routing_cost T H' f' = tree_routing_cost T H f ∧ Fintype.card W' < Fintype.card Wsteiner_host_reduce_to_cubic_nontIn LeanApproximation & Inapproximability
Given a tree T on V and a subcubic tree host H on W with terminals embedded by f, there is another subcubic tree host H' on W' with embedding f' whose routing cost is at most that of H, in which every vertex not in the image of f' has degree exactly 3 in H'.
theorem steiner_host_reduce_to_cubic_nont {V : Type} [Fintype V] [Nonempty V]
{W : Type} [Fintype W] (T : SimpleGraph V) (H : SimpleGraph W) (hH : is_subcubic_tree H)
(f : V ↪ W) :
∃ (W' : Type) (_ : Fintype W') (H' : SimpleGraph W') (_ : is_subcubic_tree H') (f' : V ↪ W'),
tree_routing_cost T H' f' ≤ tree_routing_cost T H f ∧
(∀ w : W', w ∉ Set.range f' → (open Classical in H'.degree w = 3))subcubic_tree_existsIn LeanApproximation & Inapproximability
Every finite non-empty type admits a subcubic tree.
theorem subcubic_tree_exists (V : Type) [Fintype V] [Nonempty V] :
∃ (H : SimpleGraph V), is_subcubic_tree Hsubcubic_tree_leaf_count_eq_degree_three_count_add_twoIn LeanApproximation & Inapproximability
For a subcubic tree H on W with |W| ≥ 2 in which no vertex has degree 2, the number of degree-1 vertices equals the number of degree-3 vertices plus 2.
theorem subcubic_tree_leaf_count_eq_degree_three_count_add_two {W : Type} [Fintype W]
[DecidableEq W] (H : SimpleGraph W) [DecidableRel H.Adj] (hH : is_subcubic_tree H)
(hcard : 2 ≤ Fintype.card W) (hno2 : ∀ w, H.degree w ≠ 2) :
(Finset.univ.filter (fun w => H.degree w = 1)).card =
(Finset.univ.filter (fun w => H.degree w = 3)).card + 2tbt_opt_le_tree_routing_costIn LeanApproximation & Inapproximability
Every subcubic tree H on V is an admissible terminal-only host, so its routing cost is an upper bound for the terminal-only optimum: tbt_opt T <= tree_routing_cost T H id.
theorem tbt_opt_le_tree_routing_cost {V : Type} [Fintype V] (T : SimpleGraph V)
{H : SimpleGraph V} (hH : is_subcubic_tree H) :
tbt_opt T ≤ tree_routing_cost T H idtbt_sn_opt_le_tree_routing_cost_of_hostIn LeanApproximation & Inapproximability
Any subcubic tree H on any finite type W together with an injection f : V ↪ W is an admissible Steiner host, so tbt_sn_opt T <= tree_routing_cost T H f.
theorem tbt_sn_opt_le_tree_routing_cost_of_host {V : Type} [Fintype V] (T : SimpleGraph V)
{W : Type} [Fintype W] {H : SimpleGraph W} (hH : is_subcubic_tree H) (f : V ↪ W) :
tbt_sn_opt T ≤ tree_routing_cost T H ftgreedy_rc_two_point_five_approxIn LeanApproximation & Inapproximability
Let Γ be a type with decidable equality, cm : Γ → Γ an involution, and S : Finset (List Γ) with rc_substring_free cm S. If t : List Γ satisfies tgreedy_rc_output cm S t (t is an output of some execution of TGREEDY-RC on S, with the knowledge-base definitions of MGREEDY-RC and GREEDY-RC steps), then 2 * t.length ≤ 5 * scs_rc_opt cm S in ℕ, i.e. |t| ≤ 2.5 · |OPT(S)| where scs_rc_opt cm S is the least length of a list containing s or rev_comp cm s as an infix for every s ∈ S.
theorem tgreedy_rc_two_point_five_approx {Γ : Type*} [DecidableEq Γ] (cm : Γ → Γ)
(hcm : Function.Involutive cm) (S : Finset (List Γ)) (hfree : rc_substring_free cm S)
(t : List Γ) (ht : tgreedy_rc_output cm S t) :
2 * t.length ≤ 5 * scs_rc_opt cm Stree_binary_embedding_steiner_optimum_equality_of_eliminationIn LeanApproximation & Inapproximability
If every subcubic tree host with injective terminal map can be replaced by a terminal-only subcubic tree of no larger routing cost, then tbt_opt T = tbt_sn_opt T for every finite tree T on V with at least two vertices.
theorem tree_binary_embedding_steiner_optimum_equality_of_elimination
(h : ∀ {V : Type} [Fintype V], ∀ (T : SimpleGraph V),
∀ {W : Type} [Fintype W], ∀ (H : SimpleGraph W), is_subcubic_tree H → ∀ (f : V ↪ W),
∃ (H' : SimpleGraph V), is_subcubic_tree H' ∧
tree_routing_cost T H' id ≤ tree_routing_cost T H f)
{V : Type} [Fintype V] (T : SimpleGraph V) (hT : T.IsTree) (hn : 2 ≤ Fintype.card V) :
tbt_opt T = tbt_sn_opt Ttree_routing_cost_le_of_dist_leIn LeanApproximation & Inapproximability
If two graphs H, H' on the same vertex type W satisfy dist_{H'}(x,y) ≤ dist_H(x,y) for all x, y, then tree_routing_cost T H' f ≤ tree_routing_cost T H f for every graph T and every f.
theorem tree_routing_cost_le_of_dist_le {V : Type} [Fintype V] {W : Type}
(T : SimpleGraph V) (H H' : SimpleGraph W) (f : V → W)
(h : ∀ u v : W, H'.dist u v ≤ H.dist u v) :
tree_routing_cost T H' f ≤ tree_routing_cost T H ftsp_opt_boundsIn LeanApproximation & Inapproximability
For every TSP instance on a finite set V with at least 3 vertices and symmetric edge weights ℓ, assuming there exists a tour, the optimal tour length OPT satisfies ∑_{v ∈ V} short(v) ≤ OPT ≤ ∑_{v ∈ V} long(v).
theorem tsp_opt_bounds {V : Type*} [Fintype V] [DecidableEq V] (hn : 3 ≤ Fintype.card V) (ℓ : V → V → ℝ) (h_symm : ∀ u v, ℓ u v = ℓ v u) (h_exists : ∃ σ : Equiv.Perm V, is_tsp_tour σ) : ∑ v : V, tsp_short ℓ v ≤ tsp_opt ℓ ∧ tsp_opt ℓ ≤ ∑ v : V, tsp_long ℓ vtsp_tour_length_ge_sum_shortIn LeanApproximation & Inapproximability
For any tour σ on a finite vertex set V and any edge weights ℓ, the sum of tsp_short ℓ v over all v ∈ V is at most the length of the tour σ.
theorem tsp_tour_length_ge_sum_short {V : Type*} [Fintype V] [DecidableEq V] (ℓ : V → V → ℝ) (σ : Equiv.Perm V) (hσ : is_tsp_tour σ) : ∑ v : V, tsp_short ℓ v ≤ tsp_tour_length ℓ σtsp_tour_length_le_sum_longIn LeanApproximation & Inapproximability
For any tour σ on a finite vertex set V and any edge weights ℓ, the length of the tour σ is at most the sum of long(v) over all v ∈ V.
theorem tsp_tour_length_le_sum_long {V : Type*} [Fintype V] [DecidableEq V] (ℓ : V → V → ℝ) (σ : Equiv.Perm V) (hσ : is_tsp_tour σ) : tsp_tour_length ℓ σ ≤ ∑ v : V, tsp_long ℓ vweighted_spanning_tree_congestion_hardness_gapIn LeanApproximation & Inapproximability
Let V be a finite type with decidable equality, and let Q be a connected simple graph on V where every vertex has degree at most 3. Let p be a natural number, and let s, t : Fin p -> V be endpoints of p disjoint pairs such that all 2p vertices are distinct and have degree 1 in Q. Let B = max(|E(Q)|, 2), and fix an integer A >= 2. Let H_A be the simple graph on V ⊕ (Fin p × Fin A) with edges of Q on V, and auxiliary edges between s(i) and (i, j) and between t(i) and (i, j) for all i and j. Let w : Sym2 (V ⊕ (Fin p × Fin A)) -> ℕ assign weight 1 to edges of Q, weight 1 to edges {s(i), (i, j)}, weight A + 1 to edges {t(i), (i, j)}, and 0 elsewhere. Let STC_w(H_A) be the infimum in ℕ of the maximum fundamental cut load in H_A with weights w over all spanning trees of H_A. Let DisjointPathsExist be the proposition that there exists a tuple of paths in Q connecting each s_i to t_i that are pairwise vertex-disjoint. Then DisjointPathsExist implies STC_w(H_A) <= A + B, and (not DisjointPathsExist) implies 2 * A <= STC_w(H_A).
theorem weighted_spanning_tree_congestion_hardness_gap
{V : Type*} [Fintype V] [DecidableEq V]
(Q : SimpleGraph V) [DecidableRel Q.Adj] (hQ_conn : Q.Connected) (hQ_deg : ∀ v, Q.degree v ≤ 3)
(p : ℕ) (s t : Fin p → V)
(h_term_inj : Function.Injective (Sum.elim s t))
(h_deg_s : ∀ i, Q.degree (s i) = 1)
(h_deg_t : ∀ i, Q.degree (t i) = 1)
(A : ℕ) (hA : 2 ≤ A) :
let B := max (open scoped Classical in Q.edgeFinset.card) 2
let H_adj : Sum V (Fin p × Fin A) → Sum V (Fin p × Fin A) → Prop := fun
| Sum.inl u, Sum.inl v => Q.Adj u v
| Sum.inl u, Sum.inr (i, _) => u = s i ∨ u = t i
| Sum.inr (i, _), Sum.inl u => u = s i ∨ u = t i
| Sum.inr _, Sum.inr _ => False
let H : SimpleGraph (Sum V (Fin p × Fin A)) :=
⟨H_adj, ⟨fun x y h => by
rcases x with u | ⟨i, j⟩ <;> rcases y with v | ⟨i', j'⟩
· exact h.symm
· exact h
· exact h
· contradiction⟩,
⟨fun x h => by
rcases x with u | ⟨i, j⟩
· exact Q.irrefl h
· contradiction⟩⟩
let w_aux : Sum V (Fin p × Fin A) → Sum V (Fin p × Fin A) → ℕ := fun
| Sum.inl _, Sum.inl _ => 1
| Sum.inl u, Sum.inr (i, _) => if u = t i then A + 1 else 1
| Sum.inr (i, _), Sum.inl u => if u = t i then A + 1 else 1
| Sum.inr _, Sum.inr _ => 0
let w : Sym2 (Sum V (Fin p × Fin A)) → ℕ :=
Sym2.lift ⟨w_aux, fun x y => by cases x <;> cases y <;> rfl⟩
let cut_load (T : SimpleGraph (Sum V (Fin p × Fin A))) (e : Sym2 (Sum V (Fin p × Fin A))) : ℕ :=
open scoped Classical in
∑ uv ∈ H.edgeFinset,
if Sym2.lift ⟨fun u v => ¬ (T.deleteEdges {e}).Reachable u v,
fun _ _ => propext ⟨fun h hr => h hr.symm, fun h hr => h hr.symm⟩⟩ uv
then w uv else 0
let stc : ℕ :=
sInf {c : ℕ | ∃ T : SimpleGraph (Sum V (Fin p × Fin A)),
T ≤ H ∧ T.IsTree ∧ (open scoped Classical in T.edgeFinset.sup (cut_load T)) = c}
let has_vdp : Prop :=
∃ P : (i : Fin p) → Q.Walk (s i) (t i),
(∀ i, (P i).IsPath) ∧ ∀ i j, i ≠ j → (P i).support.Disjoint (P j).support
(has_vdp → stc ≤ A + B) ∧ (¬ has_vdp → 2 * A ≤ stc)weighted_spanning_tree_congestion_no_boundIn LeanApproximation & Inapproximability
Let V be a finite type with decidable equality, and let Q be a connected simple graph on V where every vertex has degree at most 3. Let p be a natural number, and let s, t : Fin p -> V be endpoints of p disjoint pairs such that all 2p vertices are distinct and have degree 1 in Q. Let B = max(|E(Q)|, 2), and fix an integer A >= 2. Let H_A be the simple graph on V ⊕ (Fin p × Fin A) with edges of Q on V, and auxiliary edges between s(i) and (i, j) and between t(i) and (i, j) for all i and j. Let w : Sym2 (V ⊕ (Fin p × Fin A)) -> ℕ assign weight 1 to edges of Q, weight 1 to edges {s(i), (i, j)}, weight A + 1 to edges {t(i), (i, j)}, and 0 elsewhere. Let STC_w(H_A) be the infimum in ℕ of the maximum fundamental cut load in H_A with weights w over all spanning trees of H_A. Let DisjointPathsExist be the proposition that there exists a tuple of paths in Q connecting each s_i to t_i that are pairwise vertex-disjoint. Then (not DisjointPathsExist) implies that STC_w(H_A) >= 2 * A.
theorem weighted_spanning_tree_congestion_no_bound
{V : Type*} [Fintype V] [DecidableEq V]
(Q : SimpleGraph V) [DecidableRel Q.Adj] (hQ_conn : Q.Connected) (hQ_deg : ∀ v, Q.degree v ≤ 3)
(p : ℕ) (s t : Fin p → V)
(h_term_inj : Function.Injective (Sum.elim s t))
(h_deg_s : ∀ i, Q.degree (s i) = 1)
(h_deg_t : ∀ i, Q.degree (t i) = 1)
(A : ℕ) (hA : 2 ≤ A) :
let B := max (open scoped Classical in Q.edgeFinset.card) 2
let H_adj : Sum V (Fin p × Fin A) → Sum V (Fin p × Fin A) → Prop := fun
| Sum.inl u, Sum.inl v => Q.Adj u v
| Sum.inl u, Sum.inr (i, _) => u = s i ∨ u = t i
| Sum.inr (i, _), Sum.inl u => u = s i ∨ u = t i
| Sum.inr _, Sum.inr _ => False
let H : SimpleGraph (Sum V (Fin p × Fin A)) :=
⟨H_adj, ⟨fun x y h => by
rcases x with u | ⟨i, j⟩ <;> rcases y with v | ⟨i', j'⟩
· exact h.symm
· exact h
· exact h
· contradiction⟩,
⟨fun x h => by
rcases x with u | ⟨i, j⟩
· exact Q.irrefl h
· contradiction⟩⟩
let w_aux : Sum V (Fin p × Fin A) → Sum V (Fin p × Fin A) → ℕ := fun
| Sum.inl _, Sum.inl _ => 1
| Sum.inl u, Sum.inr (i, _) => if u = t i then A + 1 else 1
| Sum.inr (i, _), Sum.inl u => if u = t i then A + 1 else 1
| Sum.inr _, Sum.inr _ => 0
let w : Sym2 (Sum V (Fin p × Fin A)) → ℕ :=
Sym2.lift ⟨w_aux, fun x y => by cases x <;> cases y <;> rfl⟩
let cut_load (T : SimpleGraph (Sum V (Fin p × Fin A))) (e : Sym2 (Sum V (Fin p × Fin A))) : ℕ :=
open scoped Classical in
∑ uv ∈ H.edgeFinset,
if Sym2.lift ⟨fun u v => ¬ (T.deleteEdges {e}).Reachable u v,
fun _ _ => propext ⟨fun h hr => h hr.symm, fun h hr => h hr.symm⟩⟩ uv
then w uv else 0
let stc : ℕ :=
sInf {c : ℕ | ∃ T : SimpleGraph (Sum V (Fin p × Fin A)),
T ≤ H ∧ T.IsTree ∧ (open scoped Classical in T.edgeFinset.sup (cut_load T)) = c}
let has_vdp : Prop :=
∃ P : (i : Fin p) → Q.Walk (s i) (t i),
(∀ i, (P i).IsPath) ∧ ∀ i j, i ≠ j → (P i).support.Disjoint (P j).support
¬ has_vdp → 2 * A ≤ stcweighted_spanning_tree_congestion_yes_boundIn LeanApproximation & Inapproximability
Let V be a finite type with decidable equality, and let Q be a connected simple graph on V where every vertex has degree at most 3. Let p be a natural number, and let s, t : Fin p -> V be endpoints of p disjoint pairs such that all 2p vertices are distinct and have degree 1 in Q. Let B = max(|E(Q)|, 2), and fix an integer A >= 2. Let H_A be the simple graph on V ⊕ (Fin p × Fin A) with edges of Q on V, and auxiliary edges between s(i) and (i, j) and between t(i) and (i, j) for all i and j. Let w : Sym2 (V ⊕ (Fin p × Fin A)) -> ℕ assign weight 1 to edges of Q, weight 1 to edges {s(i), (i, j)}, weight A + 1 to edges {t(i), (i, j)}, and 0 elsewhere. Let STC_w(H_A) be the infimum in ℕ of the maximum fundamental cut load in H_A with weights w over all spanning trees of H_A. Let DisjointPathsExist be the proposition that there exists a tuple of paths in Q connecting each s_i to t_i that are pairwise vertex-disjoint. Then DisjointPathsExist implies that STC_w(H_A) <= A + B.
theorem weighted_spanning_tree_congestion_yes_bound
{V : Type*} [Fintype V] [DecidableEq V]
(Q : SimpleGraph V) [DecidableRel Q.Adj] (hQ_conn : Q.Connected) (hQ_deg : ∀ v, Q.degree v ≤ 3)
(p : ℕ) (s t : Fin p → V)
(h_term_inj : Function.Injective (Sum.elim s t))
(h_deg_s : ∀ i, Q.degree (s i) = 1)
(h_deg_t : ∀ i, Q.degree (t i) = 1)
(A : ℕ) (hA : 2 ≤ A) :
let B := max (open scoped Classical in Q.edgeFinset.card) 2
let H_adj : Sum V (Fin p × Fin A) → Sum V (Fin p × Fin A) → Prop := fun
| Sum.inl u, Sum.inl v => Q.Adj u v
| Sum.inl u, Sum.inr (i, _) => u = s i ∨ u = t i
| Sum.inr (i, _), Sum.inl u => u = s i ∨ u = t i
| Sum.inr _, Sum.inr _ => False
let H : SimpleGraph (Sum V (Fin p × Fin A)) :=
⟨H_adj, ⟨fun x y h => by
rcases x with u | ⟨i, j⟩ <;> rcases y with v | ⟨i', j'⟩
· exact h.symm
· exact h
· exact h
· contradiction⟩,
⟨fun x h => by
rcases x with u | ⟨i, j⟩
· exact Q.irrefl h
· contradiction⟩⟩
let w_aux : Sum V (Fin p × Fin A) → Sum V (Fin p × Fin A) → ℕ := fun
| Sum.inl _, Sum.inl _ => 1
| Sum.inl u, Sum.inr (i, _) => if u = t i then A + 1 else 1
| Sum.inr (i, _), Sum.inl u => if u = t i then A + 1 else 1
| Sum.inr _, Sum.inr _ => 0
let w : Sym2 (Sum V (Fin p × Fin A)) → ℕ :=
Sym2.lift ⟨w_aux, fun x y => by cases x <;> cases y <;> rfl⟩
let cut_load (T : SimpleGraph (Sum V (Fin p × Fin A))) (e : Sym2 (Sum V (Fin p × Fin A))) : ℕ :=
open scoped Classical in
∑ uv ∈ H.edgeFinset,
if Sym2.lift ⟨fun u v => ¬ (T.deleteEdges {e}).Reachable u v,
fun _ _ => propext ⟨fun h hr => h hr.symm, fun h hr => h hr.symm⟩⟩ uv
then w uv else 0
let stc : ℕ :=
sInf {c : ℕ | ∃ T : SimpleGraph (Sum V (Fin p × Fin A)),
T ≤ H ∧ T.IsTree ∧ (open scoped Classical in T.edgeFinset.sup (cut_load T)) = c}
let has_vdp : Prop :=
∃ P : (i : Fin p) → Q.Walk (s i) (t i),
(∀ i, (P i).IsPath) ∧ ∀ i j, i ≠ j → (P i).support.Disjoint (P j).support
has_vdp → stc ≤ A + Bword_generating_rank_leIn LeanApproximation & Inapproximability
If a finite set of words Y can generate every word in X by concatenation, then the generating rank of X is at most the cardinality of Y.
theorem word_generating_rank_le {α : Type*} (X : Finset (List α)) (Y : Finset (List α))
(h : ∀ w ∈ X, ∃ L : List (List α), w = L.flatten ∧ ∀ y ∈ L, y ∈ Y) :
word_generating_rank X ≤ Y.cardbinary_extremizer_convolution_sumIn LeanAutomata & Formal Languages
For n ≥ 3, the convolution sum of the zeros run count and ones run count over Fin n equals (n + 2) * 2^(n - 3).
open Classical in
theorem binary_extremizer_convolution_sum (n : ℕ) (hn : 3 ≤ n) :
(∑ s : Fin n,
(if s.val = 0 then 1 else 2 ^ (s.val - 1)) *
(if s.val + 1 = n then 1 else 2 ^ (n - 2 - s.val)))
= (n + 2) * 2 ^ (n - 3)binary_extremizer_ones_run_countIn LeanAutomata & Formal Languages
For n ≥ 3, the number of runs of 1^(n-1) from state s to state n - 1 in binary_extremizer_nfa n is 1 if s = n - 1 and 2^(n - 2 - s) if s < n - 1.
open Classical in
theorem binary_extremizer_ones_run_count (n : ℕ) (hn : 3 ≤ n) (s : Fin n) :
nfa_run_count_list (binary_extremizer_nfa n) (List.replicate (n - 1) (1 : Fin 2))
s ⟨n - 1, by omega⟩ = if s.val + 1 = n then 1 else 2 ^ (n - 2 - s.val)binary_extremizer_word_run_countIn LeanAutomata & Formal Languages
The extremizer word 0^(n-1) ++ 1^(n-1) has exactly (n + 2) * 2^(n - 3) runs from state 0 to state n - 1 in binary_extremizer_nfa n.
open Classical in
theorem binary_extremizer_word_run_count (n : ℕ) (hn : 3 ≤ n) :
nfa_run_count_list (binary_extremizer_nfa n)
(List.replicate (n - 1) (0 : Fin 2) ++ List.replicate (n - 1) (1 : Fin 2))
⟨0, by omega⟩ ⟨n - 1, by omega⟩ = (n + 2) * 2 ^ (n - 3)binary_extremizer_zeros_run_countIn LeanAutomata & Formal Languages
For n ≥ 3, the number of runs of 0^(n-1) from state 0 to state q in binary_extremizer_nfa n is 1 if q = 0 and 2^(q - 1) if q > 0.
open Classical in
theorem binary_extremizer_zeros_run_count (n : ℕ) (hn : 3 ≤ n) (q : Fin n) :
nfa_run_count_list (binary_extremizer_nfa n) (List.replicate (n - 1) (0 : Fin 2))
⟨0, by omega⟩ q = if q.val = 0 then 1 else 2 ^ (q.val - 1)bipartite_cactus_nfa_color_flipIn LeanAutomata & Formal Languages
For a loop-free bipartite cactus NFA there is a 2-colouring of the states under which every transition of the automaton connects two differently coloured states.
theorem bipartite_cactus_nfa_color_flip {α : Type*} {σ : Type} (A : NFA α σ) (hc : is_bipartite_cactus_nfa A) (hloop : ∀ (q : σ) (a : α), ¬ (q ∈ A.step q a)) : ∃ χ : σ → ZMod 2, ∀ (q : σ) (a : α) (r : σ), r ∈ A.step q a → χ r = χ q + 1bipartite_cactus_nfa_unionIn LeanAutomata & Formal Languages
If L₁ and L₂ are each accepted by a bipartite cactus NFA, then L₁ ∪ L₂ is accepted by a bipartite cactus NFA.
theorem bipartite_cactus_nfa_union {α : Type*} {L₁ L₂ : Language α}
(h₁ : ∃ (σ : Type) (_ : Fintype σ) (A : NFA α σ), A.accepts = L₁ ∧ is_bipartite_cactus_nfa A)
(h₂ : ∃ (τ : Type) (_ : Fintype τ) (B : NFA α τ), B.accepts = L₂ ∧ is_bipartite_cactus_nfa B) :
∃ (ρ : Type) (_ : Fintype ρ) (C : NFA α ρ), C.accepts = L₁ + L₂ ∧ is_bipartite_cactus_nfa Cdfa_box_prod_eval_fromIn LeanAutomata & Formal Languages
Evaluating the sequential box product A₁ □ A₂ from state (q₁, q₂) on a word w in (α₁ ⊕ α₂)* results in the pair (A₁.evalFrom q₁ (w.filterMap Sum.getLeft?), A₂.evalFrom q₂ (w.filterMap Sum.getRight?)).
theorem dfa_box_prod_eval_from {α₁ α₂ σ₁ σ₂ : Type*} (A₁ : DFA α₁ σ₁) (A₂ : DFA α₂ σ₂)
(q₁ : σ₁) (q₂ : σ₂) (w : List (Sum α₁ α₂)) :
(dfa_box_prod A₁ A₂).evalFrom (q₁, q₂) w =
(A₁.evalFrom q₁ (w.filterMap Sum.getLeft?), A₂.evalFrom q₂ (w.filterMap Sum.getRight?))dfa_box_prod_is_synchronizable_iffIn LeanAutomata & Formal Languages
The sequential box product A₁ □ A₂ of two DFAs is synchronizable if and only if both A₁ and A₂ are synchronizable.
theorem dfa_box_prod_is_synchronizable_iff {α₁ α₂ σ₁ σ₂ : Type*}
(A₁ : DFA α₁ σ₁) (A₂ : DFA α₂ σ₂) :
dfa_is_synchronizable (dfa_box_prod A₁ A₂) ↔
dfa_is_synchronizable A₁ ∧ dfa_is_synchronizable A₂dfa_box_prod_is_synchronizing_iffIn LeanAutomata & Formal Languages
A word w in (α₁ ⊕ α₂)* is synchronizing for the sequential box product A₁ □ A₂ if and only if the projection w.filterMap Sum.getLeft? is synchronizing for A₁ and the projection w.filterMap Sum.getRight? is synchronizing for A₂.
theorem dfa_box_prod_is_synchronizing_iff {α₁ α₂ σ₁ σ₂ : Type*}
(A₁ : DFA α₁ σ₁) (A₂ : DFA α₂ σ₂) (w : List (Sum α₁ α₂)) :
dfa_is_synchronizing (dfa_box_prod A₁ A₂) w ↔
dfa_is_synchronizing A₁ (w.filterMap Sum.getLeft?) ∧
dfa_is_synchronizing A₂ (w.filterMap Sum.getRight?)dfa_box_prod_reset_threshold_and_synchronizable_iffIn LeanAutomata & Formal Languages
For any two DFAs A₁ and A₂ with disjoint input alphabets, their sequential box product A₁ □ A₂ is synchronizable if and only if both A₁ and A₂ are synchronizable, and the reset threshold of A₁ □ A₂ equals the sum of the reset thresholds of A₁ and A₂ in WithTop ℕ.
theorem dfa_box_prod_reset_threshold_and_synchronizable_iff {α₁ α₂ σ₁ σ₂ : Type*}
(A₁ : DFA α₁ σ₁) (A₂ : DFA α₂ σ₂) :
(dfa_is_synchronizable (dfa_box_prod A₁ A₂) ↔
dfa_is_synchronizable A₁ ∧ dfa_is_synchronizable A₂) ∧
dfa_reset_threshold (dfa_box_prod A₁ A₂) =
dfa_reset_threshold A₁ + dfa_reset_threshold A₂dfa_box_prod_reset_threshold_eqIn LeanAutomata & Formal Languages
The reset threshold of the sequential box product A₁ □ A₂ of two DFAs equals the sum of the reset thresholds of A₁ and A₂ in WithTop ℕ.
theorem dfa_box_prod_reset_threshold_eq {α₁ α₂ σ₁ σ₂ : Type*}
(A₁ : DFA α₁ σ₁) (A₂ : DFA α₂ σ₂) :
dfa_reset_threshold (dfa_box_prod A₁ A₂) =
dfa_reset_threshold A₁ + dfa_reset_threshold A₂dfa_is_seq_subset_sync_choice_iffIn LeanAutomata & Formal Languages
Unfolding: ws is a sequential subset synchronization choice iff for every stage i the word ws i subset-synchronizes the image set of the flattened previous choices and its length equals that set's subset reset threshold.
theorem dfa_is_seq_subset_sync_choice_iff {α : Type*} {k : ℕ} {σ : Fin k → Type*}
(A : (i : Fin k) → DFA α (σ i)) (ws : Fin k → List α) :
dfa_is_seq_subset_sync_choice A ws ↔
∀ i : Fin k,
dfa_is_subset_synchronizing (A i)
(Set.range fun q : σ i =>
(A i).evalFrom q (List.take (i : ℕ) (List.ofFn ws)).flatten) (ws i) ∧
((ws i).length : WithTop ℕ) =
dfa_subset_reset_threshold (A i)
(Set.range fun q : σ i =>
(A i).evalFrom q (List.take (i : ℕ) (List.ofFn ws)).flatten)dfa_parallel_prod_evalFromIn LeanAutomata & Formal Languages
For any two deterministic finite automata A₁ : DFA α₁ σ₁ and A₂ : DFA α₂ σ₂, states q₁ : σ₁ and q₂ : σ₂, and word w : List (α₁ × α₂), evaluating w from (q₁, q₂) in dfa_parallel_prod A₁ A₂ yields (A₁.evalFrom q₁ w.unzip.1, A₂.evalFrom q₂ w.unzip.2).
theorem dfa_parallel_prod_evalFrom {α₁ α₂ σ₁ σ₂ : Type*} (A₁ : DFA α₁ σ₁) (A₂ : DFA α₂ σ₂) (q₁ : σ₁) (q₂ : σ₂) (w : List (α₁ × α₂)) : (dfa_parallel_prod A₁ A₂).evalFrom (q₁, q₂) w = (A₁.evalFrom q₁ w.unzip.1, A₂.evalFrom q₂ w.unzip.2)dfa_parallel_prod_is_synchronizable_iffIn LeanAutomata & Formal Languages
The parallel two-tape product dfa_parallel_prod A₁ A₂ of two deterministic finite automata over nonempty alphabets is synchronizable if and only if both A₁ and A₂ are synchronizable.
theorem dfa_parallel_prod_is_synchronizable_iff {α₁ α₂ σ₁ σ₂ : Type*} [Nonempty α₁] [Nonempty α₂] (A₁ : DFA α₁ σ₁) (A₂ : DFA α₂ σ₂) : dfa_is_synchronizable (dfa_parallel_prod A₁ A₂) ↔ dfa_is_synchronizable A₁ ∧ dfa_is_synchronizable A₂dfa_parallel_prod_is_synchronizing_iffIn LeanAutomata & Formal Languages
A word w : List (α₁ × α₂) is synchronizing for the parallel two-tape product dfa_parallel_prod A₁ A₂ if and only if its first projection w.unzip.1 is synchronizing for A₁ and its second projection w.unzip.2 is synchronizing for A₂.
theorem dfa_parallel_prod_is_synchronizing_iff {α₁ α₂ σ₁ σ₂ : Type*} (A₁ : DFA α₁ σ₁) (A₂ : DFA α₂ σ₂) (w : List (α₁ × α₂)) : dfa_is_synchronizing (dfa_parallel_prod A₁ A₂) w ↔ dfa_is_synchronizing A₁ w.unzip.1 ∧ dfa_is_synchronizing A₂ w.unzip.2dfa_parallel_prod_is_synchronizing_zip_paddedIn LeanAutomata & Formal Languages
If w₁ is a synchronizing word for A₁, w₂ is a synchronizing word for A₂, w₂.length ≤ w₁.length, and a₂ : α₂ is any letter, then the zipped word w₁.zip (List.replicate (w₁.length - w₂.length) a₂ ++ w₂) is synchronizing for the parallel two-tape product dfa_parallel_prod A₁ A₂.
theorem dfa_parallel_prod_is_synchronizing_zip_padded {α₁ α₂ σ₁ σ₂ : Type*} (A₁ : DFA α₁ σ₁) (A₂ : DFA α₂ σ₂) (w₁ : List α₁) (w₂ : List α₂) (hw₁ : dfa_is_synchronizing A₁ w₁) (hw₂ : dfa_is_synchronizing A₂ w₂) (hle : w₂.length ≤ w₁.length) (a₂ : α₂) : dfa_is_synchronizing (dfa_parallel_prod A₁ A₂) (w₁.zip (List.replicate (w₁.length - w₂.length) a₂ ++ w₂))dfa_parallel_prod_reset_thresholdIn LeanAutomata & Formal Languages
For any two deterministic finite automata A₁ : DFA α₁ σ₁ and A₂ : DFA α₂ σ₂ over nonempty alphabets, the reset threshold of their parallel two-tape product dfa_parallel_prod A₁ A₂ equals the maximum of the reset thresholds of A₁ and A₂: dfa_reset_threshold (dfa_parallel_prod A₁ A₂) = max (dfa_reset_threshold A₁) (dfa_reset_threshold A₂).
theorem dfa_parallel_prod_reset_threshold {α₁ α₂ σ₁ σ₂ : Type*} [Nonempty α₁] [Nonempty α₂] (A₁ : DFA α₁ σ₁) (A₂ : DFA α₂ σ₂) : dfa_reset_threshold (dfa_parallel_prod A₁ A₂) = max (dfa_reset_threshold A₁) (dfa_reset_threshold A₂)dfa_reset_threshold_eq_of_exists_and_leIn LeanAutomata & Formal Languages
For any deterministic finite automaton A and natural number k, if there exists a synchronizing word of length k and all synchronizing words have length at least k, then the reset threshold of A is k.
theorem dfa_reset_threshold_eq_of_exists_and_le {α σ : Type*} (A : DFA α σ) (k : ℕ)
(hex : ∃ w : List α, dfa_is_synchronizing A w ∧ w.length = k)
(hle : ∀ w : List α, dfa_is_synchronizing A w → k ≤ w.length) :
dfa_reset_threshold A = (k : WithTop ℕ)dfa_simultaneous_reset_threshold_eq_iff_forall_length_leIn LeanAutomata & Formal Languages
A simultaneously synchronizing word w is optimal (its length equals the simultaneous reset threshold) if and only if every simultaneously synchronizing word is at least as long.
theorem dfa_simultaneous_reset_threshold_eq_iff_forall_length_le {α : Type*}
{k : ℕ} {σ : Fin k → Type*} (A : (i : Fin k) → DFA α (σ i)) (w : List α)
(h : dfa_is_simultaneously_synchronizing A w) :
((w.length : WithTop ℕ) = dfa_simultaneous_reset_threshold A) ↔
∀ v : List α, dfa_is_simultaneously_synchronizing A v → w.length ≤ v.lengthdfa_simultaneous_reset_threshold_le_of_simultaneously_synchronizingIn LeanAutomata & Formal Languages
The simultaneous reset threshold of A is at most the length of any simultaneously synchronizing word.
theorem dfa_simultaneous_reset_threshold_le_of_simultaneously_synchronizing {α : Type*}
{k : ℕ} {σ : Fin k → Type*} (A : (i : Fin k) → DFA α (σ i)) (w : List α)
(h : dfa_is_simultaneously_synchronizing A w) :
dfa_simultaneous_reset_threshold A ≤ (w.length : WithTop ℕ)dfa_state_complexity_attainedIn LeanAutomata & Formal Languages
For every regular language L there is a DFA whose number of states is exactly dfa_state_complexity L and which recognizes L.
theorem dfa_state_complexity_attained {α : Type*} (L : Language α) (hL : L.IsRegular) : ∃ (σ : Type) (x : Fintype σ) (M : DFA α σ), @Fintype.card σ x = dfa_state_complexity L ∧ M.accepts = Ldfa_state_complexity_eq_nat_card_left_quotientIn LeanAutomata & Formal Languages
For a regular language L, the deterministic state complexity of L equals the number of distinct left quotients of L.
theorem dfa_state_complexity_eq_nat_card_left_quotient {α : Type*} {L : Language α}
(hL : L.IsRegular) : dfa_state_complexity L = Nat.card (Set.range L.leftQuotient)dfa_state_complexity_le_of_acceptsIn LeanAutomata & Formal Languages
If a DFA M on state set σ in Type recognizes language L, then the deterministic state complexity of L is at most the cardinality of σ.
theorem dfa_state_complexity_le_of_accepts {α : Type*} (L : Language α) (σ : Type) [Fintype σ] (M : DFA α σ) (hM : M.accepts = L) : dfa_state_complexity L ≤ Fintype.card σdfa_state_complexity_le_of_dfaIn LeanAutomata & Formal Languages
If a DFA M with finite state type σ accepts exactly the language L, then the deterministic state complexity of L is at most the number of states of M.
theorem dfa_state_complexity_le_of_dfa {α : Type*} {L : Language α} {σ : Type} [Fintype σ]
(M : DFA α σ) (hM : M.accepts = L) : dfa_state_complexity L ≤ Fintype.card σdfa_subset_reset_threshold_eq_iff_forall_length_leIn LeanAutomata & Formal Languages
A subset-synchronizing word w for S in A is optimal (its length equals the subset reset threshold) if and only if every subset-synchronizing word for S is at least as long.
theorem dfa_subset_reset_threshold_eq_iff_forall_length_le {α σ : Type*}
(A : DFA α σ) (S : Set σ) (w : List α)
(h : dfa_is_subset_synchronizing A S w) :
((w.length : WithTop ℕ) = dfa_subset_reset_threshold A S) ↔
∀ v : List α, dfa_is_subset_synchronizing A S v → w.length ≤ v.lengthdfa_subset_reset_threshold_le_of_subset_synchronizingIn LeanAutomata & Formal Languages
The subset reset threshold of S in A is at most the length of any word that subset-synchronizes S.
theorem dfa_subset_reset_threshold_le_of_subset_synchronizing {α σ : Type*}
(A : DFA α σ) (S : Set σ) (w : List α)
(h : dfa_is_subset_synchronizing A S w) :
dfa_subset_reset_threshold A S ≤ (w.length : WithTop ℕ)dfa_to_bipartite_cactus_nfa_poly_sizeIn LeanAutomata & Formal Languages
There are constants C and D such that every DFA with n states has an equivalent bipartite cactus NFA with at most C·n^D + C states.
theorem dfa_to_bipartite_cactus_nfa_poly_size : ∃ (C D : ℕ), ∀ (α : Type) [Fintype α] (σ : Type) (x : Fintype σ) (M : DFA α σ), ∃ (τ : Type) (y : Fintype τ) (A : NFA α τ), A.accepts = M.accepts ∧ is_bipartite_cactus_nfa A ∧ @Fintype.card τ y ≤ C * (@Fintype.card σ x) ^ D + C
dfa_to_bipartite_cactus_nfa_poly_size_implies_targetIn LeanAutomata & Formal Languages
If there are constants C and D such that every DFA on n states has an equivalent bipartite cactus NFA on at most C·n^D + C states, then the minimum number of states of a bipartite cactus NFA for a regular language L is at most C·(dfa_state_complexity L)^D + C.
theorem dfa_to_bipartite_cactus_nfa_poly_size_implies_target (h : ∃ (C D : ℕ), ∀ (α : Type) [Fintype α] (σ : Type) (x : Fintype σ) (M : DFA α σ), ∃ (τ : Type) (y : Fintype τ) (A : NFA α τ), A.accepts = M.accepts ∧ is_bipartite_cactus_nfa A ∧ @Fintype.card τ y ≤ C * (@Fintype.card σ x) ^ D + C) : ∃ (c d : ℕ), ∀ (α : Type) [Fintype α] (L : Language α), L.IsRegular → min_bipartite_cactus_nfa_states L ≤ c * (dfa_state_complexity L) ^ d + c
dfa_to_nfa_acceptsIn LeanAutomata & Formal Languages
The NFA obtained from a DFA by replacing each deterministic step δ(q,a) with the singleton set {δ(q,a)} accepts exactly the same language as the DFA.
theorem dfa_to_nfa_accepts {α : Type*} {σ : Type} (M : DFA α σ) : (DFA.toNFA M).accepts = M.acceptsdiag_two_counter_boundary_update_reach_nonemptyIn LeanAutomata & Formal Languages
The diagonal symmetric 2-counter machine (a single update (1,1) from false to true) has an update-only run from the boundary configuration (false, (0,0)) to the boundary configuration (true, (1,1)).
theorem diag_two_counter_boundary_update_reach_nonempty : two_counter_machine_boundary ((false : Bool), (0, 0)) ∧ Relation.ReflTransGen (two_counter_machine_update_step (⟨{(false, TwoCounterInstr.update 1 1, true)}⟩ : TwoCounterMachine Bool)) (false, ((0, 0) : ℕ × ℕ)) (true, ((1, 1) : ℕ × ℕ))has_strongly_cactus_nfa_atomicIn LeanAutomata & Formal Languages
The empty language has a strongly cactus automaton of either parity, the language {[]} one of parity 0, and {[a]} one of parity 1 for every letter a.
theorem has_strongly_cactus_nfa_atomic {α : Type*} :
(∀ p : ZMod 2, has_strongly_cactus_nfa (0 : Language α) p) ∧
has_strongly_cactus_nfa (1 : Language α) 0 ∧
(∀ a : α, has_strongly_cactus_nfa ({([a] : List α)} : Language α) 1)has_strongly_cactus_nfa_kstarIn LeanAutomata & Formal Languages
If L has a strongly cactus automaton of parity 0, then L* has a strongly cactus automaton of parity 0.
theorem has_strongly_cactus_nfa_kstar {α : Type*} {L : Language α}
(h : has_strongly_cactus_nfa L 0) : has_strongly_cactus_nfa (KStar.kstar L) 0has_strongly_cactus_nfa_mulIn LeanAutomata & Formal Languages
If L₁ has a strongly cactus automaton of parity p and L₂ one of parity q, then the concatenation L₁L₂ has one of parity p+q.
theorem has_strongly_cactus_nfa_mul {α : Type*} {L₁ L₂ : Language α} {p q : ZMod 2}
(h₁ : has_strongly_cactus_nfa L₁ p) (h₂ : has_strongly_cactus_nfa L₂ q) :
has_strongly_cactus_nfa (L₁ * L₂) (p + q)has_strongly_cactus_nfa_unionIn LeanAutomata & Formal Languages
If L₁ and L₂ both have strongly cactus automata of the same parity p, then L₁ ∪ L₂ has one of parity p.
theorem has_strongly_cactus_nfa_union {α : Type*} {L₁ L₂ : Language α} {p : ZMod 2}
(h₁ : has_strongly_cactus_nfa L₁ p) (h₂ : has_strongly_cactus_nfa L₂ p) :
has_strongly_cactus_nfa (L₁ + L₂) pisSemilinearSet_boundary_configurationsIn LeanAutomata & Formal Languages
The set of pairs (u, v) of counter vectors such that at least one coordinate of u is zero and at least one coordinate of v is zero is a semilinear subset of (ℕ × ℕ) × (ℕ × ℕ).
theorem isSemilinearSet_boundary_configurations : IsSemilinearSet { p : (ℕ × ℕ) × (ℕ × ℕ) | (p.1.1 = 0 ∨ p.1.2 = 0) ∧ (p.2.1 = 0 ∨ p.2.2 = 0) }is_regular_iff_exists_regular_expressionIn LeanAutomata & Formal Languages
A language L over α is regular if and only if there is a regular expression r with L(r) = L.
theorem is_regular_iff_exists_regular_expression {α : Type*} (L : Language α) :
L.IsRegular ↔ ∃ r : RegularExpression α, r.matches' = Llist_isSuffix_of_isSuffix_of_length_leIn LeanAutomata & Formal Languages
If r and s are both suffixes of u and r is no longer than s, then r is a suffix of s.
theorem list_isSuffix_of_isSuffix_of_length_le {α : Type*} {r s u : List α}
(hu : r <:+ u) (hs : s <:+ u) (h : r.length ≤ s.length) : r <:+ slist_longest_suffix_mem_specIn LeanAutomata & Formal Languages
list_longest_suffix_mem B h0 u lies in B, is a suffix of u, and is at least as long as every member of B that is a suffix of u.
theorem list_longest_suffix_mem_spec {α : Type*} [DecidableEq α]
(B : Finset (List α)) (h0 : ([] : List α) ∈ B) (u : List α) :
list_longest_suffix_mem B h0 u ∈ B ∧ list_longest_suffix_mem B h0 u <:+ u ∧
∀ t : List α, t ∈ B → t <:+ u → t.length ≤ (list_longest_suffix_mem B h0 u).lengthlist_longest_suffix_mem_uniqueIn LeanAutomata & Formal Languages
The longest member of B that is a suffix of u is unique: any t ∈ B that is a suffix of u and has that length equals it.
theorem list_longest_suffix_mem_unique {α : Type*} [DecidableEq α] (B : Finset (List α))
(h0 : ([] : List α) ∈ B) (u t : List α) (ht : t ∈ B) (htu : t <:+ u)
(hlen : t.length = (list_longest_suffix_mem B h0 u).length) :
t = list_longest_suffix_mem B h0 umin_bipartite_cactus_nfa_states_le_of_bipartite_cactus_dfaIn LeanAutomata & Formal Languages
If the symmetrised transition graph of a DFA M with n states is a bipartite cactus, then min_bipartite_cactus_nfa_states of the language of M is at most n.
theorem min_bipartite_cactus_nfa_states_le_of_bipartite_cactus_dfa {α : Type*} {σ : Type} [Fintype σ] (M : DFA α σ) (hg : simple_graph_is_cactus (SimpleGraph.fromRel (fun u v => ∃ a, M.step u a = v))) (hcol : (SimpleGraph.fromRel (fun u v => ∃ a, M.step u a = v)).Colorable 2) : min_bipartite_cactus_nfa_states M.accepts ≤ Fintype.card σmin_bipartite_cactus_nfa_states_le_of_nfaIn LeanAutomata & Formal Languages
If an epsilon-free NFA A with finite state type τ of cardinality k recognizes L and its transition graph is a bipartite cactus, then min_bipartite_cactus_nfa_states L ≤ k.
theorem min_bipartite_cactus_nfa_states_le_of_nfa {α : Type*} {L : Language α} {τ : Type} (x : Fintype τ) (A : NFA α τ) (h : A.accepts = L) (hc : is_bipartite_cactus_nfa A) : min_bipartite_cactus_nfa_states L ≤ @Fintype.card τ xmin_bipartite_cactus_nfa_states_univ_le_oneIn LeanAutomata & Formal Languages
The language of all words over α is recognized by a bipartite cactus NFA with one state, so min_bipartite_cactus_nfa_states ⊤ ≤ 1.
theorem min_bipartite_cactus_nfa_states_univ_le_one (α : Type*) : min_bipartite_cactus_nfa_states (⊤ : Language α) ≤ 1
nat_card_range_left_quotient_ge_of_pairwiseIn LeanAutomata & Formal Languages
If k words have pairwise distinct left quotients with respect to a regular language L, then L has at least k left quotients.
theorem nat_card_range_left_quotient_ge_of_pairwise {α : Type*} {L : Language α} (hL : L.IsRegular)
(k : ℕ) (f : Fin k → List α) (h : ∀ i j, i ≠ j → L.leftQuotient (f i) ≠ L.leftQuotient (f j)) :
k ≤ Nat.card (Set.range L.leftQuotient)nfa_accepting_run_encard_le_of_wordIn LeanAutomata & Formal Languages
For every natural number n ≥ 3, every trim finitely ambiguous binary NFA M with n states, singleton strongly connected components, one initial state s and one distinct accepting state t, and every word w, the number of accepting runs of M on w is at most (n+2)·2^(n−3).
theorem nfa_accepting_run_encard_le_of_word (n : ℕ) (hn : 3 ≤ n) {σ : Type*} [Fintype σ]
[DecidableEq σ] (hcard : Fintype.card σ = n) (M : NFA (Fin 2) σ)
(htrim : nfa_is_trim M) (hscc : nfa_has_singleton_sccs M)
(hfin : nfa_is_finitely_ambiguous M) {s t : σ} (hst : s ≠ t)
(hstart : M.start = {s}) (haccept : M.accept = {t}) (w : List (Fin 2)) :
{r : Fin (w.length + 1) → σ |
r 0 ∈ M.start ∧ r (Fin.last w.length) ∈ M.accept ∧
∀ i : Fin w.length, r i.succ ∈ M.step (r i.castSucc) (w.get i)}.encard
≤ ((n + 2) * 2 ^ (n - 3) : ℕ∞)nfa_eval_parity_of_color_flipIn LeanAutomata & Formal Languages
If a colouring of the states of an NFA flips along every transition, then the colour of any state reachable from a set S after reading a word w differs from the colour of some state of S by the length of w modulo 2. Equivalently: every accepted word of a bipartite cactus NFA has a well-defined parity, determined by the colours of the initial and accepting states.
theorem nfa_eval_parity_of_color_flip {α : Type*} {σ : Type} (A : NFA α σ) (χ : σ → ZMod 2) (hχ : ∀ (q : σ) (a : α) (r : σ), r ∈ A.step q a → χ r = χ q + 1) : ∀ (S : Set σ) (w : List α) (q : σ), q ∈ A.evalFrom S w → ∃ p ∈ S, χ q = χ p + (w.length : ZMod 2)nfa_max_ambiguity_asymptotic_upper_boundIn LeanAutomata & Formal Languages
Sharp asymptotic upper bound: for every ε > 0 and all sufficiently large n, the maximum degree of ambiguity M(n) of trim finitely ambiguous n-state NFAs is at most (1 + √2 + ε)^n.
theorem nfa_max_ambiguity_asymptotic_upper_bound :
∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in Filter.atTop,
ENNReal.toReal (nfa_max_ambiguity n) ≤ (1 + Real.sqrt 2 + ε) ^ nnfa_max_ambiguity_limit_of_eventual_boundsIn LeanAutomata & Formal Languages
Reduction of the asymptotic base constant to two one-sided bounds: if M(n) dominates twice the (n-2)-nd Pell number eventually, and if for every ε > 0 one has M(n) ≤ (1+√2+ε)^n eventually, then M(n)^(1/n) → 1+√2.
theorem nfa_max_ambiguity_limit_of_eventual_bounds
(hlower : ∀ᶠ n : ℕ in Filter.atTop,
(2 * (pell_number (n - 2) : ℝ)) ≤ ENNReal.toReal (nfa_max_ambiguity n))
(hupper : ∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in Filter.atTop,
ENNReal.toReal (nfa_max_ambiguity n) ≤ (1 + Real.sqrt 2 + ε) ^ n) :
Filter.Tendsto (fun n : ℕ => (ENNReal.toReal (nfa_max_ambiguity n)) ^ ((1 : ℝ) / (n : ℝ)))
Filter.atTop (nhds (1 + Real.sqrt 2))nfa_max_ambiguity_pell_lower_boundIn LeanAutomata & Formal Languages
Pell lower bound for the maximum ambiguity: for all sufficiently large n, twice the (n-2)-nd Pell number is at most the maximum degree of ambiguity M(n) of trim finitely ambiguous n-state NFAs.
theorem nfa_max_ambiguity_pell_lower_bound :
∀ᶠ n : ℕ in Filter.atTop,
(2 * (pell_number (n - 2) : ℝ)) ≤ ENNReal.toReal (nfa_max_ambiguity n)nfa_no_ida_of_trim_finitely_ambiguousIn LeanAutomata & Formal Languages
A trim NFA that is finitely ambiguous does not comply with IDA. If there were distinct states p, q and a word v with p reached from p, q from p, and q from q by v, then any word α·v^k·β — where α leads from an initial state to p and β leads from q to an accepting state, which trim provides — has at least k distinct accepting runs, one for each choice of the copy of v that performs the switch p → q, contradicting a uniform bound on the number of accepting runs.
theorem nfa_no_ida_of_trim_finitely_ambiguous {α σ : Type*} (M : NFA α σ)
(htrim : nfa_is_trim M) (hfin : nfa_is_finitely_ambiguous M) :
¬ nfa_complies_ida Mnfa_no_ida_run_count_image_le_cardIn LeanAutomata & Formal Languages
Let M be a binary NFA with singleton strongly connected components that does not comply with IDA. Fix a word w and a set C of states which is a chain for reachability and contains s and t. Then at most |C| runs of M on w go from s to t while visiting exactly the states of C. This is tight: in the extremal automaton every chain C has exactly |C| such runs.
theorem nfa_no_ida_run_count_image_le_card
{σ : Type*} [Fintype σ] (M : NFA (Fin 2) σ)
(hscc : nfa_has_singleton_sccs M) (hida : ¬ nfa_complies_ida M)
{s t : σ} {C : Finset σ} (hsC : s ∈ C) (htC : t ∈ C)
(hchain : ∀ p ∈ C, ∀ q ∈ C, p ≠ q →
(∃ w : List (Fin 2), q ∈ M.evalFrom {p} w) ∨ (∃ w : List (Fin 2), p ∈ M.evalFrom {q} w))
(w : List (Fin 2)) :
{r : Fin (w.length + 1) → σ |
r 0 = s ∧ r (Fin.last w.length) = t ∧
(∀ i : Fin w.length, r i.succ ∈ M.step (r i.castSucc) (w.get i)) ∧
Set.range r = (C : Set σ)}.ncard ≤ C.cardnfa_no_ida_single_letterIn LeanAutomata & Formal Languages
If an NFA does not comply with IDA, then no single letter can simultaneously loop at a state p, move p to a different state q, and loop at q: for p ≠ q with p in step p c and q in step p c, we have q not in step q c.
theorem nfa_no_ida_single_letter {σ : Type*} (M : NFA (Fin 2) σ)
(hida : ¬ nfa_complies_ida M) {p q : σ} (hpq : p ≠ q) {c : Fin 2}
(hloop : p ∈ M.step p c) (hstep : q ∈ M.step p c) :
q ∉ M.step q cnfa_run_count_list_appendIn LeanAutomata & Formal Languages
The number of runs of a concatenated word u ++ v from state p to state q in an NFA M equals the convolution sum over all intermediate states s of the runs of u from p to s times the runs of v from s to q.
open Classical in
theorem nfa_run_count_list_append {α σ : Type*} [Fintype σ] (M : NFA α σ)
(u v : List α) (p q : σ) :
nfa_run_count_list M (u ++ v) p q =
∑ s : σ, nfa_run_count_list M u p s * nfa_run_count_list M v s qnfa_run_image_is_chainIn LeanAutomata & Formal Languages
In an NFA with singleton strongly connected components, the set of states visited by a single run is a chain for reachability: any two distinct states of the image of a run are comparable by reachability.
theorem nfa_run_image_is_chain {σ : Type*} (M : NFA (Fin 2) σ)
(hscc : nfa_has_singleton_sccs M) {w : List (Fin 2)} {r : Fin (w.length + 1) → σ}
(hr : ∀ i : Fin w.length, r i.succ ∈ M.step (r i.castSucc) (w.get i))
{C : Finset σ} (hC : Set.range r = (C : Set σ)) :
∀ p ∈ C, ∀ q ∈ C, p ≠ q →
(∃ u : List (Fin 2), q ∈ M.evalFrom {p} u) ∨
(∃ u : List (Fin 2), p ∈ M.evalFrom {q} u)nfa_run_segment_mem_evalFromIn LeanAutomata & Formal Languages
Any segment of a run of an NFA witnesses reachability: if a state sequence r follows the transitions of a word w and i ≤ j, then r j is reached from r i by the subword of w between positions i and j.
theorem nfa_run_segment_mem_evalFrom {α σ : Type*} (M : NFA α σ) {w : List α}
{r : Fin (w.length + 1) → σ}
(hr : ∀ i : Fin w.length, r i.succ ∈ M.step (r i.castSucc) (w.get i))
{i j : Fin (w.length + 1)} (hij : i ≤ j) :
r j ∈ M.evalFrom {r i} ((w.drop i.val).take (j.val - i.val))nfa_run_visit_times_convexIn LeanAutomata & Formal Languages
In an NFA with singleton strongly connected components, the set of times at which a run visits a given state is convex: if r i = r j = p and i ≤ k ≤ j, then r k = p. Consequently a run never returns to a state after leaving it except through self-loops inside one contiguous block, so every run decomposes into p_1^{e_1} … p_h^{e_h} with all p_i distinct.
theorem nfa_run_visit_times_convex {α σ : Type*} (M : NFA α σ)
(hscc : nfa_has_singleton_sccs M) {w : List α} {r : Fin (w.length + 1) → σ}
(hr : ∀ i : Fin w.length, r i.succ ∈ M.step (r i.castSucc) (w.get i))
{p : σ} {i j : Fin (w.length + 1)} (hi : r i = p) (hj : r j = p) :
∀ k : Fin (w.length + 1), i ≤ k → k ≤ j → r k = pnfa_transition_graph_dfa_to_nfaIn LeanAutomata & Formal Languages
The undirected transition graph of the NFA associated with a DFA is the symmetrised graph on the DFA states joining u and v whenever some input letter maps u to v.
theorem nfa_transition_graph_dfa_to_nfa {α : Type*} {σ : Type} (M : DFA α σ) : nfa_transition_graph (DFA.toNFA M) = SimpleGraph.fromRel (fun u v => ∃ a, M.step u a = v)op1716_exists_family_exact_lengthsIn LeanAutomata & Formal Languages
For any natural numbers k ≥ 2 and L ≥ k + 5, there exists a family of k finite-state synchronizable DFAs over Bool, a sequential subset synchronization choice ws where every stage has a unique shortest choice, and an optimal simultaneously synchronizing word w_opt of length L + 1 whose length equals the simultaneous reset threshold, such that the sum of stage choice lengths is exactly k * L - (k - 1).
theorem op1716_exists_family_exact_lengths :
∀ (k : ℕ) (hk : 2 ≤ k) (L : ℕ) (hL : k + 5 ≤ L),
∃ (σ : Fin k → Type) (_ : ∀ i, Fintype (σ i)) (A : (i : Fin k) → DFA Bool (σ i)),
(∀ i, dfa_is_synchronizable (A i)) ∧
∃ (ws : Fin k → List Bool),
dfa_is_seq_subset_sync_choice A ws ∧
(∀ i, dfa_stage_has_unique_shortest_choice A ws i) ∧
∃ (w_opt : List Bool),
dfa_is_simultaneously_synchronizing A w_opt ∧
(w_opt.length : WithTop ℕ) = dfa_simultaneous_reset_threshold A ∧
w_opt.length = L + 1 ∧
(∑ i : Fin k, (ws i).length) = k * L - (k - 1)op1716_length_arithmeticIn LeanAutomata & Formal Languages
For every k ≥ 2 and ε > 0 there is L ≥ k+5 with (k - ε)(L+1) ≤ kL - (k-1).
theorem op1716_length_arithmetic (k : ℕ) (hk : 2 ≤ k) (ε : ℝ) (hε : 0 < ε) :
∃ L : ℕ, k + 5 ≤ L ∧ ((k : ℝ) - ε) * ((L : ℝ) + 1) ≤ ((k * L - (k - 1) : ℕ) : ℝ)op_1667_opposite_cerny_direct_product_exists_sync_wordIn LeanAutomata & Formal Languages
For every integer n ≥ 2, there exists a binary word of length 2(n-1)(n-2) + 2 that synchronizes the direct product of the Černý automaton C_n and its letter-swapped counterpart C_n^swap.
theorem op_1667_opposite_cerny_direct_product_exists_sync_word (n : ℕ) (hn : 2 ≤ n) :
∃ w : List Bool, dfa_is_synchronizing (dfa_prod (cerny_dfa n) (cerny_swap_dfa n)) w ∧
w.length = 2 * (n - 1) * (n - 2) + 2op_1667_opposite_cerny_direct_product_exists_sync_word_ge_fourIn LeanAutomata & Formal Languages
For every integer n ≥ 4, there exists a binary word of length 2(n-1)(n-2) + 2 that synchronizes the direct product of the Černý automaton C_n and its letter-swapped counterpart C_n^swap.
theorem op_1667_opposite_cerny_direct_product_exists_sync_word_ge_four (n : ℕ) (hn : 4 ≤ n) :
∃ w : List Bool, dfa_is_synchronizing (dfa_prod (cerny_dfa n) (cerny_swap_dfa n)) w ∧
w.length = 2 * (n - 1) * (n - 2) + 2op_1667_opposite_cerny_direct_product_sync_word_length_geIn LeanAutomata & Formal Languages
For every integer n ≥ 2, every binary word synchronizing the direct product of C_n and C_n^swap has length at least 2(n-1)(n-2) + 2.
theorem op_1667_opposite_cerny_direct_product_sync_word_length_ge (n : ℕ) (hn : 2 ≤ n)
(w : List Bool) (hw : dfa_is_synchronizing (dfa_prod (cerny_dfa n) (cerny_swap_dfa n)) w) :
2 * (n - 1) * (n - 2) + 2 ≤ w.lengthop_1667_opposite_cerny_product_three_is_synchronizingIn LeanAutomata & Formal Languages
The binary word [false, true, true, false, false, true] of length 6 synchronizes the direct product of the 3-state Černý automaton and its letter-swapped counterpart.
theorem op_1667_opposite_cerny_product_three_is_synchronizing :
dfa_is_synchronizing (dfa_prod (cerny_dfa 3) (cerny_swap_dfa 3))
[false, true, true, false, false, true]op_1670_opposite_cerny_product_exists_sync_wordIn LeanAutomata & Formal Languages
For all natural numbers n and m with 2 ≤ n and n ≤ m, there exists a binary word of length (m - 1)^2 + max (n - 2) ((n - 1) * (n - 2) + 3 - m) that synchronizes the direct product of the Černý automaton C_n and the letter-swapped Černý automaton C_m^swap.
theorem op_1670_opposite_cerny_product_exists_sync_word
(n m : ℕ) (hn : 2 ≤ n) (hmn : n ≤ m) :
∃ w : List Bool, dfa_is_synchronizing (dfa_prod (cerny_dfa n) (cerny_swap_dfa m)) w ∧
w.length = (m - 1) ^ 2 + max (n - 2) ((n - 1) * (n - 2) + 3 - m)op_1670_opposite_cerny_product_large_factor_exists_sync_wordIn LeanAutomata & Formal Languages
For any natural numbers n and m with 2 ≤ n ≤ m and n^2 - 4*n + 7 ≤ m, there exists a binary word of length (m - 1)^2 + (n - 2) that synchronizes the direct product of the Černý automaton C_n and the swapped Černý automaton C_m^swap.
theorem op_1670_opposite_cerny_product_large_factor_exists_sync_word
(n m : ℕ) (hn : 2 ≤ n) (hmn : n ≤ m) (hm : n ^ 2 - 4 * n + 7 ≤ m) :
∃ w : List Bool, dfa_is_synchronizing (dfa_prod (cerny_dfa n) (cerny_swap_dfa m)) w ∧
w.length = (m - 1) ^ 2 + (n - 2)op_1670_opposite_cerny_product_large_factor_sync_word_length_geIn LeanAutomata & Formal Languages
For any natural numbers n and m with 2 ≤ n ≤ m and n^2 - 4*n + 7 ≤ m, every binary word synchronizing the direct product of C_n and C_m^swap has length at least (m - 1)^2 + (n - 2).
theorem op_1670_opposite_cerny_product_large_factor_sync_word_length_ge
(n m : ℕ) (hn : 2 ≤ n) (hmn : n ≤ m) (hm : n ^ 2 - 4 * n + 7 ≤ m)
(w : List Bool) (hw : dfa_is_synchronizing (dfa_prod (cerny_dfa n) (cerny_swap_dfa m)) w) :
(m - 1) ^ 2 + (n - 2) ≤ w.lengthop_1670_opposite_cerny_product_sync_word_length_geIn LeanAutomata & Formal Languages
For all natural numbers n and m with 2 ≤ n and n ≤ m, every binary word synchronizing the direct product of C_n and C_m^swap has length at least (m - 1)^2 + max (n - 2) ((n - 1) * (n - 2) + 3 - m).
theorem op_1670_opposite_cerny_product_sync_word_length_ge
(n m : ℕ) (hn : 2 ≤ n) (hmn : n ≤ m)
(w : List Bool) (hw : dfa_is_synchronizing (dfa_prod (cerny_dfa n) (cerny_swap_dfa m)) w) :
(m - 1) ^ 2 + max (n - 2) ((n - 1) * (n - 2) + 3 - m) ≤ w.lengthparity_typed_regular_expression_has_strongly_cactus_nfaIn LeanAutomata & Formal Languages
Every regular expression typed with parity p is matched by a language that has a strongly cactus automaton of parity p.
theorem parity_typed_regular_expression_has_strongly_cactus_nfa {α : Type*} (r : RegularExpression α)
(p : ZMod 2) (hr : regular_expression_typed_parity r p) : has_strongly_cactus_nfa r.matches' ppell_nfa_ambiguity_lower_boundIn LeanAutomata & Formal Languages
For every natural number n ≥ 3, there exists an NFA M with alphabet Fin 5 and states Fin n, and a word u : List (Fin 5), such that M is trim, M does not comply with IDA, M has singleton strongly connected components, and the number of accepting runs of M on u (measured by Set.encard) is at least 2 * pell_number (n - 2).
theorem pell_nfa_ambiguity_lower_bound (n : ℕ) (hn : 3 ≤ n) :
∃ (M : NFA (Fin 5) (Fin n)) (u : List (Fin 5)),
nfa_is_trim M ∧
¬ nfa_complies_ida M ∧
nfa_has_singleton_sccs M ∧
((2 * pell_number (n - 2) : ℕ) : ℕ∞) ≤
Set.encard {r : Fin (u.length + 1) → Fin n |
r 0 ∈ M.start ∧
r (Fin.last u.length) ∈ M.accept ∧
∀ i : Fin u.length, r i.succ ∈ M.step (r i.castSucc) (u.get i)}pell_nfa_degree_lower_boundIn LeanAutomata & Formal Languages
The degree of ambiguity of the n-state Pell NFA pell_nfa n in ℕ∞ is at least 2 * pell_number (n - 2).
theorem pell_nfa_degree_lower_bound (n : ℕ) (hn : 3 ≤ n) : (2 * pell_number (n - 2) : ℕ∞) ≤ nfa_degree_of_ambiguity (pell_nfa n)
pell_nfa_run_count_lower_boundIn LeanAutomata & Formal Languages
In the n-state automaton A_n, the word u_n = c_1c_2c_2c_3…c_(n-2)c_(n-1) has at least 2·P(n-2) accepting runs from the initial state q_1 to the final state q_n.
theorem pell_nfa_run_count_lower_bound (n : ℕ) (hn : 3 ≤ n) :
((2 * pell_number (n - 2) : ℕ) : ℕ∞) ≤
Set.encard {r : Fin ((pell_word n).length + 1) → Fin n |
r 0 ∈ (pell_nfa n).start ∧
r (Fin.last (pell_word n).length) ∈ (pell_nfa n).accept ∧
∀ i : Fin (pell_word n).length,
r i.succ ∈ (pell_nfa n).step (r i.castSucc) ((pell_word n).get i)}pell_prefix_block_stepIn LeanAutomata & Formal Languages
Appending one two-letter block to a prefix whose run counts vanish off q_i, q_(i+1) with x runs at q_i and y at q_(i+1) gives a vector vanishing off q_(i+1), q_(i+2) with x+y runs at q_(i+1) and 2x+y at q_(i+2).
open Classical in
theorem pell_prefix_block_step (n i : ℕ) (hn : 3 ≤ n) (h1 : 1 ≤ i) (hi : i + 1 ≤ n - 2)
(hzero : ∀ s : Fin n, s.val ≠ i → s.val ≠ i + 1 → s.val ≠ i + 2 →
nfa_run_count_list (pell_nfa n) (pell_word_prefix i) ⟨0, by omega⟩ s = 0)
(hx : nfa_run_count_list (pell_nfa n) (pell_word_prefix i) ⟨0, by omega⟩
⟨i, by omega⟩ = pell_number (i + 1) - pell_number i)
(hy : nfa_run_count_list (pell_nfa n) (pell_word_prefix i) ⟨0, by omega⟩
⟨i + 1, by omega⟩ = 2 * pell_number i) :
(∀ s : Fin n, s.val ≠ i + 1 → s.val ≠ i + 2 → s.val ≠ i + 3 →
nfa_run_count_list (pell_nfa n) (pell_word_prefix (i + 1)) ⟨0, by omega⟩ s = 0)
∧ nfa_run_count_list (pell_nfa n) (pell_word_prefix (i + 1)) ⟨0, by omega⟩
⟨i + 1, by omega⟩ = pell_number (i + 2) - pell_number (i + 1)
∧ nfa_run_count_list (pell_nfa n) (pell_word_prefix (i + 1)) ⟨0, by omega⟩
⟨i + 2, by omega⟩ = 2 * pell_number (i + 1)pell_prefix_count_vectorIn LeanAutomata & Formal Languages
After i two-letter blocks the number of runs from q_1 vanishes off q_i, q_(i+1), q_(i+2), equals P(i+1)-P(i) at q_i and 2P(i) at q_(i+1).
open Classical in
theorem pell_prefix_count_vector (n i : ℕ) (hn : 3 ≤ n) (h1 : 1 ≤ i) (hi : i ≤ n - 2) :
(∀ s : Fin n, s.val ≠ i → s.val ≠ i + 1 → s.val ≠ i + 2 →
nfa_run_count_list (pell_nfa n) (pell_word_prefix i) ⟨0, by omega⟩ s = 0)
∧ nfa_run_count_list (pell_nfa n) (pell_word_prefix i) ⟨0, by omega⟩
⟨i, by omega⟩ = pell_number (i + 1) - pell_number i
∧ nfa_run_count_list (pell_nfa n) (pell_word_prefix i) ⟨0, by omega⟩
⟨i + 1, by omega⟩ = 2 * pell_number ipell_prefix_two_letter_vectorIn LeanAutomata & Formal Languages
From the one-letter vector (x at q_i, y at q_(i+1), x+y at q_(i+2)), appending c_(i+2) yields the block-step conclusion: vanish off q_(i+1),q_(i+2),q_(i+3); P(i+2)-P(i+1) at q_(i+1); 2P(i+1) at q_(i+2).
open Classical in
theorem pell_prefix_two_letter_vector (n i : ℕ) (hn : 3 ≤ n) (h1 : 1 ≤ i) (hi : i + 1 ≤ n - 2)
(hV1 : ∀ s : Fin n,
nfa_run_count_list (pell_nfa n) (pell_word_prefix i ++ [⟨(i + 1) % 5, by omega⟩])
⟨0, by omega⟩ s
= (if s.val = i then (pell_number (i + 1) - pell_number i) else 0)
+ (if s.val = i + 1 then (2 * pell_number i) else 0)
+ (if s.val = i + 2 then ((pell_number (i + 1) - pell_number i) + 2 * pell_number i) else 0)) :
(∀ s : Fin n, s.val ≠ i + 1 → s.val ≠ i + 2 → s.val ≠ i + 3 →
nfa_run_count_list (pell_nfa n) (pell_word_prefix (i + 1)) ⟨0, by omega⟩ s = 0)
∧ nfa_run_count_list (pell_nfa n) (pell_word_prefix (i + 1)) ⟨0, by omega⟩
⟨i + 1, by omega⟩ = pell_number (i + 2) - pell_number (i + 1)
∧ nfa_run_count_list (pell_nfa n) (pell_word_prefix (i + 1)) ⟨0, by omega⟩
⟨i + 2, by omega⟩ = 2 * pell_number (i + 1)pell_runs_exact_countIn LeanAutomata & Formal Languages
The word u_n has exactly 2·P(n-2) runs from q_1 to q_n in A_n.
open Classical in
theorem pell_runs_exact_count (n : ℕ) (hn : 3 ≤ n) :
nfa_run_count_list (pell_nfa n) (pell_word n) ⟨0, by omega⟩ ⟨n - 1, by omega⟩
= 2 * pell_number (n - 2)prioritized_borel_adam_to_dual_eveIn LeanAutomata & Formal Languages
An arbitrary-memory winning strategy for Adam in a three-priority game transfers, without changing its memory type, to a winning strategy for Eve in the dual game.
theorem prioritized_borel_adam_to_dual_eve {Q : Type} (G : PrioritizedBorelGame Q 3) {M : Type} (σ : FiniteMemoryStrategy G BorelGamePlayer.Adam M) (hwin : PrioritizedBorelStrategyWins G BorelGamePlayer.Adam σ) : ∃ τ : FiniteMemoryStrategy (prioritized_borel_dual_game G) BorelGamePlayer.Eve M, PrioritizedBorelStrategyWins (prioritized_borel_dual_game G) BorelGamePlayer.Eve τprioritized_borel_bounded_state_history_one_state_reductionIn LeanAutomata & Formal Languages
Consider a finite-state three-priority tree game. Suppose that for every tree node and current state, at most d distinct state sequences of legal finite plays reach that node and state; priority histories are not counted. If every one-state three-priority game has a winning strategy using at most b memory states, then the given game has a winning strategy using at most b times d memory states.
theorem prioritized_borel_bounded_state_history_one_state_reduction {Q : Type} [Fintype Q] (G : PrioritizedBorelGame Q 3) (d b : ℕ) (hfinite : ∀ (v : List Bool) (q : Q), Set.ncard {h : Fin (v.length + 1) → Q | h 0 = G.init_state ∧ h (Fin.last v.length) = q ∧ ∀ i : Fin v.length, ∃ e ∈ G.edges, e.source_node = v.take i.val ∧ e.source_state = h i.castSucc ∧ e.dir = v.get i ∧ e.target_state = h i.succ} ≤ d) (hone : ∀ H : PrioritizedBorelGame Unit 3, HasWinningStrategyInMem H b) : HasWinningStrategyInMem G (b * d)prioritized_borel_branch_width_recodeIn LeanAutomata & Formal Languages
Fix a three-priority tree game, a node-dependent invariant R of its reachable states, and a node-dependent encoding of those states into Fin w that is injective on R. If every three-priority game with state type Fin w has a winning strategy with at most b memory states, then the original game also has a winning strategy with at most b memory states. The invariant must contain the initial state and be closed under every game edge from an invariant state.
theorem prioritized_borel_branch_width_recode {Q : Type} (G : PrioritizedBorelGame Q 3) (w b : ℕ) (R : List Bool → Q → Prop) (encode : List Bool → Q → Fin w) (hinit : R [] G.init_state) (hclosed : ∀ e ∈ G.edges, R e.source_node e.source_state → R (e.source_node ++ [e.dir]) e.target_state) (hinj : ∀ v q q', R v q → R v q' → encode v q = encode v q' → q = q') (hbound : ∀ H : PrioritizedBorelGame (Fin w) 3, HasWinningStrategyInMem H b) : HasWinningStrategyInMem G bprioritized_borel_dual_eve_to_adamIn LeanAutomata & Formal Languages
An arbitrary-memory winning strategy for Eve in the dual game transfers, without changing its memory type, to a winning strategy for Adam in the original three-priority game.
theorem prioritized_borel_dual_eve_to_adam {Q : Type} (G : PrioritizedBorelGame Q 3) {M : Type} (τ : FiniteMemoryStrategy (prioritized_borel_dual_game G) BorelGamePlayer.Eve M) (hwin : PrioritizedBorelStrategyWins (prioritized_borel_dual_game G) BorelGamePlayer.Eve τ) : ∃ σ : FiniteMemoryStrategy G BorelGamePlayer.Adam M, PrioritizedBorelStrategyWins G BorelGamePlayer.Adam σprioritized_borel_game_witness_existsIn LeanAutomata & Formal Languages
There exists a prioritized Borel game G with state space Unit and 1 priority, and a winning strategy using at most 1 memory state (HasWinningStrategyInMem G 1).
theorem prioritized_borel_game_witness_exists : ∃ G : PrioritizedBorelGame Unit 1, HasWinningStrategyInMem G 1
prioritized_borel_reverse_deterministic_one_state_reductionIn LeanAutomata & Formal Languages
In a finite-state three-priority tree game, suppose that at each parent node and child direction, any two legal edges with the same target state also have the same source state. If every three-priority one-state game has a winning strategy with at most b memory states, then this game has a winning strategy with at most b memory states. Distinct priorities on otherwise identical edges remain allowed.
theorem prioritized_borel_reverse_deterministic_one_state_reduction {Q : Type} [Fintype Q] (G : PrioritizedBorelGame Q 3) (b : ℕ) (hback : ∀ e ∈ G.edges, ∀ e' ∈ G.edges, e.source_node = e'.source_node → e.dir = e'.dir → e.target_state = e'.target_state → e.source_state = e'.source_state) (hone : ∀ H : PrioritizedBorelGame Unit 3, HasWinningStrategyInMem H b) : HasWinningStrategyInMem G bprioritized_borel_strategy_histories_finiteIn LeanAutomata & Formal Languages
For a finite state space, only finitely many encoded histories consistent with an arbitrary-memory strategy reach a fixed public node and state.
theorem prioritized_borel_strategy_histories_finite {Q : Type} [Fintype Q] {k : ℕ} (G : PrioritizedBorelGame Q k) (pl : BorelGamePlayer) {M : Type} (σ : FiniteMemoryStrategy G pl M) (v : List Bool) (q : Q) : Set.Finite {h : List (Bool × Q × Fin k) | ∃ m, PrioritizedBorelStrategyHistory G pl σ h m v q}prioritized_borel_strategy_history_directionsIn LeanAutomata & Formal Languages
The directions recorded in a consistent encoded history are precisely its current public node.
theorem prioritized_borel_strategy_history_directions {Q : Type} {k : ℕ} {G : PrioritizedBorelGame Q k} {pl : BorelGamePlayer} {M : Type} {σ : FiniteMemoryStrategy G pl M} {h : List (Bool × Q × Fin k)} {m : M} {v : List Bool} {q : Q} (hh : PrioritizedBorelStrategyHistory G pl σ h m v q) : h.map Prod.fst = vprioritized_borel_threshold_controller_guaranteesIn LeanAutomata & Formal Languages
Every infinite sequence of inputs between 1 and s admits a memory sequence taking values from 0 through s under the threshold update; resets occur infinitely often and the maximal recurrent input triggers an even action infinitely often.
theorem prioritized_borel_threshold_controller_guarantees
(s : ℕ) (f : ℕ → ℕ) (hf : ∀ n, 1 ≤ f n ∧ f n ≤ s) :
∃ m : ℕ → ℕ,
m 0 = 0 ∧ (∀ n, m n ≤ s) ∧
(∀ n, m (n+1) = if m n < f n then f n else 0) ∧
(∀ N, ∃ n ≥ N, f n ≤ m n) ∧
(∀ I N0, 0 < I → (∀ n, N0 ≤ n → f n ≤ I) →
(∀ N, ∃ n ≥ N, f n = I) →
∀ K, ∃ n ≥ K, f n = I ∧ m n < I)prioritized_borel_two_priorities_two_memory_from_strategyIn LeanAutomata & Formal Languages
For every finite type Q, every two-priority prioritized Borel game G on Q, every player pl, every memory type M, and every strategy σ for pl with memory M, if σ wins then there exist a type M' equipped with a Fintype instance and cardinality at most two and a strategy τ for pl with memory M' that wins. The conclusion allows any such finite type M'; it does not require M' to be Fin 2.
theorem prioritized_borel_two_priorities_two_memory_from_strategy (Q : Type) [Fintype Q] (G : PrioritizedBorelGame Q 2) (pl : BorelGamePlayer) (M : Type) (σ : FiniteMemoryStrategy G pl M) (hwin : PrioritizedBorelStrategyWins G pl σ) : ∃ (M' : Type) (_ : Fintype M'), Fintype.card M' ≤ 2 ∧ ∃ τ : FiniteMemoryStrategy G pl M', PrioritizedBorelStrategyWins G pl τ
simple_graph_cactus_cycle_toSubgraph_eq_of_not_mem_edgeIn LeanAutomata & Formal Languages
Any two simple cycles in G ⊔ {{x, y}} that do not contain {x, y} and share an edge have equal subgraphs.
theorem simple_graph_cactus_cycle_toSubgraph_eq_of_not_mem_edge {V : Type*} {G : SimpleGraph V} {x y : V}
(hG : simple_graph_is_cactus G)
{u₁ u₂ : V}
(c₁ : (G ⊔ SimpleGraph.fromEdgeSet {Sym2.mk x y}).Walk u₁ u₁)
(c₂ : (G ⊔ SimpleGraph.fromEdgeSet {Sym2.mk x y}).Walk u₂ u₂)
(hc₁ : c₁.IsCycle) (hc₂ : c₂.IsCycle)
(h₁ : Sym2.mk x y ∉ c₁.edges) (h₂ : Sym2.mk x y ∉ c₂.edges)
(he : ∃ e, e ∈ c₁.edges ∧ e ∈ c₂.edges) :
c₁.toSubgraph = c₂.toSubgraphsimple_graph_cycle_not_share_edge_of_unique_path_mixedIn LeanAutomata & Formal Languages
In the graph obtained by adding {x, y} to G, a simple cycle containing {x, y} and a simple cycle not containing {x, y} cannot share any edge.
theorem simple_graph_cycle_not_share_edge_of_unique_path_mixed {V : Type*} {G : SimpleGraph V} {x y : V}
(hxy : x ≠ y)
(huniq : ∀ (w₁ w₂ : G.Walk x y), w₁.IsPath → w₂.IsPath → w₁.support = w₂.support)
{u₁ u₂ : V}
(c₁ : (G ⊔ SimpleGraph.fromEdgeSet {Sym2.mk x y}).Walk u₁ u₁)
(c₂ : (G ⊔ SimpleGraph.fromEdgeSet {Sym2.mk x y}).Walk u₂ u₂)
(hc₁ : c₁.IsCycle) (hc₂ : c₂.IsCycle)
(h₁ : Sym2.mk x y ∈ c₁.edges) (h₂ : Sym2.mk x y ∉ c₂.edges) :
¬ ∃ e, e ∈ c₁.edges ∧ e ∈ c₂.edgessimple_graph_cycle_toSubgraph_eq_of_unique_path_and_mem_edgeIn LeanAutomata & Formal Languages
Any two simple cycles in G ⊔ {{x, y}} that both contain {x, y} have equal subgraphs under the unique simple path hypothesis.
theorem simple_graph_cycle_toSubgraph_eq_of_unique_path_and_mem_edge {V : Type*} {G : SimpleGraph V} {x y : V}
(hxy : x ≠ y)
(huniq : ∀ (w₁ w₂ : G.Walk x y), w₁.IsPath → w₂.IsPath → w₁.support = w₂.support)
{u₁ u₂ : V}
(c₁ : (G ⊔ SimpleGraph.fromEdgeSet {Sym2.mk x y}).Walk u₁ u₁)
(c₂ : (G ⊔ SimpleGraph.fromEdgeSet {Sym2.mk x y}).Walk u₂ u₂)
(hc₁ : c₁.IsCycle) (hc₂ : c₂.IsCycle)
(h₁ : Sym2.mk x y ∈ c₁.edges) (h₂ : Sym2.mk x y ∈ c₂.edges) :
c₁.toSubgraph = c₂.toSubgraphsimple_graph_is_cactus_sumIn LeanAutomata & Formal Languages
If G and H are cacti then their disjoint sum is a cactus.
theorem simple_graph_is_cactus_sum {V W : Type*} {G : SimpleGraph V} {H : SimpleGraph W}
(hG : simple_graph_is_cactus G) (hH : simple_graph_is_cactus H) :
simple_graph_is_cactus (SimpleGraph.sum G H)simple_graph_is_cactus_sup_edge_of_unique_pathIn LeanAutomata & Formal Languages
If a simple graph G is a cactus and x ≠ y are the endpoints of a unique simple path in G, then the graph obtained by adding the edge {x,y} is again a cactus.
theorem simple_graph_is_cactus_sup_edge_of_unique_path {V : Type*} {G : SimpleGraph V} {x y : V}
(hxy : x ≠ y) (hG : simple_graph_is_cactus G)
(huniq : ∀ (w₁ w₂ : G.Walk x y), w₁.IsPath → w₂.IsPath → w₁.support = w₂.support) :
simple_graph_is_cactus (G ⊔ SimpleGraph.fromEdgeSet {Sym2.mk x y})strongly_cactus_nfa_is_bipartite_cactus_nfaIn LeanAutomata & Formal Languages
If A is a strongly cactus NFA of parity p with initial state s, then its transition graph is a cactus and 2-colourable, i.e. A is a bipartite cactus NFA.
theorem strongly_cactus_nfa_is_bipartite_cactus_nfa {α σ : Type*} {A : NFA α σ} {s : σ} {p : ZMod 2}
(h : strongly_cactus_nfa A s p) : is_bipartite_cactus_nfa Asum_card_subsets_containing_two_leIn LeanAutomata & Formal Languages
Let σ be a finite type with n = |σ| elements and let s ≠ t be two of them. Then the sum of |C| over all subsets C of σ containing both s and t is at most (n+2)·2^(n−3).
theorem sum_card_subsets_containing_two_le {σ : Type*} [Fintype σ] [DecidableEq σ]
(s t : σ) (hst : s ≠ t) (n : ℕ) (hcard : Fintype.card σ = n) :
(∑ C ∈ Finset.univ.filter (fun C : Finset σ => s ∈ C ∧ t ∈ C), C.card)
≤ (n + 2) * 2 ^ (n - 3)sum_range_mul_choose_leIn LeanAutomata & Formal Languages
For every natural number n ≥ 3, the sum over k from 2 to n of k times the binomial coefficient (n−2 choose k−2) is at most (n+2)·2^(n−3); in fact the two sides are equal.
theorem sum_range_mul_choose_le (n : ℕ) (hn : 3 ≤ n) :
(∑ k ∈ Finset.Icc 2 n, k * (n - 2).choose (k - 2)) ≤ (n + 2) * 2 ^ (n - 3)symmetric_two_counter_boundary_reachability_semilinearIn LeanAutomata & Formal Languages
For every symmetric 2-counter machine M with finite state type Q and states q, q', the reachability relation restricted to source and target boundary configurations (where at least one counter is zero) is semilinear.
theorem symmetric_two_counter_boundary_reachability_semilinear {Q : Type*} [Finite Q] (M : TwoCounterMachine Q) (hM : two_counter_machine_is_symmetric M) (q q' : Q) : IsSemilinearSet { p : (ℕ × ℕ) × (ℕ × ℕ) | (p.1.1 = 0 ∨ p.1.2 = 0) ∧ (p.2.1 = 0 ∨ p.2.2 = 0) ∧ Relation.ReflTransGen (two_counter_machine_step M) (q, p.1) (q', p.2) }symmetric_two_counter_boundary_update_reach_semilinearIn LeanAutomata & Formal Languages
For a symmetric 2-counter machine M, the update-only reachability relation from a boundary configuration to a boundary configuration is semilinear.
theorem symmetric_two_counter_boundary_update_reach_semilinear {Q : Type*} [Finite Q] (M : TwoCounterMachine Q) (hM : two_counter_machine_is_symmetric M) (q q' : Q) : IsSemilinearSet { p : (ℕ × ℕ) × (ℕ × ℕ) | (p.1.1 = 0 ∨ p.1.2 = 0) ∧ (p.2.1 = 0 ∨ p.2.2 = 0) ∧ Relation.ReflTransGen (two_counter_machine_update_step M) (q, p.1) (q', p.2) }two_counter_machine_reach_split_at_zero_testIn LeanAutomata & Formal Languages
Reachability from c to c' either consists entirely of update steps, or factors as an update-only run from c to some configuration m, followed by a single zero test from m to m', followed by reachability from m' to c'.
theorem two_counter_machine_reach_split_at_zero_test {Q : Type*} (M : TwoCounterMachine Q) (c c' : Q × ℕ × ℕ) : Relation.ReflTransGen (two_counter_machine_step M) c c' ↔ Relation.ReflTransGen (two_counter_machine_update_step M) c c' ∨ ∃ m m' : Q × ℕ × ℕ, Relation.ReflTransGen (two_counter_machine_update_step M) c m ∧ two_counter_machine_zero_test_step M m m' ∧ Relation.ReflTransGen (two_counter_machine_step M) m' c'two_counter_machine_step_iff_update_or_zero_testIn LeanAutomata & Formal Languages
A one-step transition of a 2-counter machine is either an update step or a zero test.
theorem two_counter_machine_step_iff_update_or_zero_test {Q : Type*} (M : TwoCounterMachine Q) (c₁ c₂ : Q × ℕ × ℕ) : two_counter_machine_step M c₁ c₂ ↔ (two_counter_machine_update_step M c₁ c₂ ∨ two_counter_machine_zero_test_step M c₁ c₂)two_counter_machine_update_reach_swapIn LeanAutomata & Formal Languages
For a symmetric 2-counter machine M, update-only reachability from c₁ to c₂ implies update-only reachability from the coordinate swap of c₁ to the coordinate swap of c₂.
theorem two_counter_machine_update_reach_swap {Q : Type*} (M : TwoCounterMachine Q) (hM : two_counter_machine_is_symmetric M) {c₁ c₂ : Q × ℕ × ℕ} (h : Relation.ReflTransGen (two_counter_machine_update_step M) c₁ c₂) : Relation.ReflTransGen (two_counter_machine_update_step M) (c₁.1, (c₁.2.2, c₁.2.1)) (c₂.1, (c₂.2.2, c₂.2.1))two_counter_machine_update_step_swapIn LeanAutomata & Formal Languages
For a symmetric 2-counter machine M, if c₂ is reachable from c₁ by one update step, then the coordinate-swapped c₂ is reachable from the coordinate-swapped c₁ by one update step.
theorem two_counter_machine_update_step_swap {Q : Type*} (M : TwoCounterMachine Q) (hM : two_counter_machine_is_symmetric M) {c₁ c₂ : Q × ℕ × ℕ} (h : two_counter_machine_update_step M c₁ c₂) : two_counter_machine_update_step M (c₁.1, (c₁.2.2, c₁.2.1)) (c₂.1, (c₂.2.2, c₂.2.1))two_counter_machine_zero_test_state_reach_semilinearIn LeanAutomata & Formal Languages
For any 2-counter machine M the set of boundary counter vectors p at which q' is reachable from q by zero tests alone is a semilinear subset of ℕ × ℕ.
theorem two_counter_machine_zero_test_state_reach_semilinear {Q : Type*} (M : TwoCounterMachine Q) (q q' : Q) : IsSemilinearSet { p : ℕ × ℕ | (p.1 = 0 ∨ p.2 = 0) ∧ two_counter_machine_zero_test_state_reach M p q q' }two_counter_machine_zero_test_state_reach_zero_patternIn LeanAutomata & Formal Languages
Whether q' is zero-test reachable from q at counter vector p depends only on which coordinates of p are zero: if p and p' agree on the vanishing of both coordinates then q' is reachable from q at p iff it is at p'.
theorem two_counter_machine_zero_test_state_reach_zero_pattern {Q : Type*} (M : TwoCounterMachine Q) (q q' : Q) {p p' : ℕ × ℕ} (h₁ : p.1 = 0 ↔ p'.1 = 0) (h₂ : p.2 = 0 ↔ p'.2 = 0) : (two_counter_machine_zero_test_state_reach M p q q' ↔ two_counter_machine_zero_test_state_reach M p' q q')two_counter_machine_zero_test_step_boundaryIn LeanAutomata & Formal Languages
If c₂ is reached from c₁ by a zero test then c₂ and c₁ have the same counter vector and c₁ is a boundary configuration.
theorem two_counter_machine_zero_test_step_boundary {Q : Type*} (M : TwoCounterMachine Q) {c₁ c₂ : Q × ℕ × ℕ} (h : two_counter_machine_zero_test_step M c₁ c₂) : c₂.2 = c₁.2 ∧ two_counter_machine_boundary c₁walk_isPath_edge_not_mem_cycle_of_unique_pathIn LeanAutomata & Formal Languages
Under the uniqueness hypothesis for paths between x and y, no edge of any simple path between x and y lies on a simple cycle in G.
theorem walk_isPath_edge_not_mem_cycle_of_unique_path {V : Type*} {G : SimpleGraph V} {x y : V}
(huniq : ∀ (w₁ w₂ : G.Walk x y), w₁.IsPath → w₂.IsPath → w₁.support = w₂.support)
{p : G.Walk x y} (hp : p.IsPath) {u : V} {c : G.Walk u u} (hc : c.IsCycle) {e : Sym2 V}
(he_p : e ∈ p.edges) (he_c : e ∈ c.edges) : Falseword_a_gaps_append_replicateIn LeanAutomata & Formal Languages
Concatenating a block of p copies of a between l and m merges the last gap of l with the first gap of m, adding p to their total.
theorem word_a_gaps_append_replicate {α : Type*} [DecidableEq α] (a : α) (l m : List α) (p : ℕ) :
word_a_gaps a (l ++ List.replicate p a ++ m) =
(word_a_gaps a l).dropLast ++
[(word_a_gaps a l).getLastD 0 + p + (word_a_gaps a m).headD 0] ++
(word_a_gaps a m).tailword_a_gaps_mask_count_true_le_runsIn LeanAutomata & Formal Languages
For a unary source u = a^n with n > 0, the number of gaps of a mask of w that contain a true-labelled copy of a is at most the number of U-runs of the mask.
theorem word_a_gaps_mask_count_true_le_runs {α : Type*} [DecidableEq α] (a : α) (n : ℕ) (hn : 0 < n)
(v w : List α) (M : List Bool) (hM : is_word_mask (List.replicate n a) v w M) :
(word_a_gaps_mask a w M).countP (fun q => decide (0 < q.2)) ≤ mask_u_runs Mword_a_gaps_mask_fstIn LeanAutomata & Formal Languages
If u is a nonempty power of a and M is a mask of w with respect to u and v, then the first components of the masked gap profile of w under M give the 'a'-gap profile of v.
theorem word_a_gaps_mask_fst {α : Type*} [DecidableEq α] (a : α) (n : ℕ) (hn : 0 < n)
(v w : List α) (M : List Bool) (hM : is_word_mask (List.replicate n a) v w M) :
(word_a_gaps_mask a w M).map Prod.fst = word_a_gaps a vword_a_gaps_mask_sumIn LeanAutomata & Formal Languages
Adding the false-labelled and true-labelled counts of a in each gap of the masked gap profile recovers the 'a'-gap profile of w.
theorem word_a_gaps_mask_sum {α : Type*} [DecidableEq α] (a : α) (w : List α) (M : List Bool) :
(word_a_gaps_mask a w M).map (fun q => q.1 + q.2) = word_a_gaps a wword_block_exchange_after_insertion_degree_leIn LeanAutomata & Formal Languages
For any words u, v and pure block exchange E with respect to a mask M having run count r, the insertion degree of the exchanged word is at most r - 1.
theorem word_block_exchange_after_insertion_degree_le {α : Type*}
(u v : List α) (E : WordBlockExchange α) (M : List Bool) (r : ℕ)
(hM_mask : is_word_mask u v (word_block_exchange_before E) M)
(hM_deg : mask_u_runs M = r)
(h_pure : word_block_exchange_is_pure E M) :
word_insertion_degree u v (word_block_exchange_after E) ≤ ((r - 1 : ℕ) : WithTop ℕ)word_block_exchange_exact_obstructionIn LeanAutomata & Formal Languages
For nonempty words u and v, a block exchange E = (X, A, B, Y), and a minimum mask M of word_block_exchange_before E with run count r > 1 such that word_insertion_degree u v (word_block_exchange_before E) = r and word_block_exchange_is_pure E M: the commuting minimum c_E(z) equals r - 1, the insertion degree of the exchanged word z = word_block_exchange_after E is min (r - 1) (b_E(z)), and the exchange is exact (degree equals r - 1) if and only if b_E(z) ≥ r - 1.
theorem word_block_exchange_exact_obstruction {α : Type*}
(u v : List α) (hu : u ≠ []) (hv : v ≠ [])
(E : WordBlockExchange α) (M : List Bool) (r : ℕ) (hr : 1 < r)
(hM_mask : is_word_mask u v (word_block_exchange_before E) M)
(hM_deg : mask_u_runs M = r)
(h_min : word_insertion_degree u v (word_block_exchange_before E) = (r : WithTop ℕ))
(h_pure : word_block_exchange_is_pure E M) :
word_block_exchange_c E u v = ((r - 1 : ℕ) : WithTop ℕ) ∧
word_insertion_degree u v (word_block_exchange_after E) =
min ((r - 1 : ℕ) : WithTop ℕ) (word_block_exchange_b E u v) ∧
(word_insertion_degree u v (word_block_exchange_after E) = ((r - 1 : ℕ) : WithTop ℕ) ↔
word_block_exchange_b E u v ≥ ((r - 1 : ℕ) : WithTop ℕ))word_block_exchange_pure_slice_replicateIn LeanAutomata & Formal Languages
If u = a^n and M is a valid mask of XABY whose A-slice is all true, then A = a^{|A|}, and likewise for B.
theorem word_block_exchange_pure_slice_replicate {α : Type*} (a : α) (n : ℕ)
(u v : List α) (E : WordBlockExchange α) (M : List Bool)
(hu : u = List.replicate n a)
(hM : is_word_mask u v (word_block_exchange_before E) M) :
(is_pure_mask (List.take E.A.length (List.drop E.X.length M)) true →
E.A = List.replicate E.A.length a) ∧
(is_pure_mask (List.take E.B.length (List.drop (E.X.length + E.A.length) M)) true →
E.B = List.replicate E.B.length a)word_block_exchange_transport_back_mask_u_runs_leIn LeanAutomata & Formal Languages
For any words u, v and block exchange E, if N is a mask of XBAY, then backward transport to XABY satisfies mask_u_runs (word_block_exchange_transport_back E N) ≤ mask_u_runs N + 1.
theorem word_block_exchange_transport_back_mask_u_runs_le {α : Type*}
(E : WordBlockExchange α) (u v : List α) (N : List Bool)
(hN : is_word_mask u v (word_block_exchange_after E) N) :
mask_u_runs (word_block_exchange_transport_back E N) ≤ mask_u_runs N + 1word_block_exchange_transport_forward_maskIn LeanAutomata & Formal Languages
If M is a valid mask of XABY and E is pure for M, then the forward transport of M is a valid mask of XBAY with mask_u_runs equal to mask_u_runs M - 1.
theorem word_block_exchange_transport_forward_mask {α : Type*} (u v : List α)
(E : WordBlockExchange α) (M : List Bool)
(hM : is_word_mask u v (word_block_exchange_before E) M)
(hpure : word_block_exchange_is_pure E M) :
is_word_mask u v (word_block_exchange_after E) (word_block_exchange_transport_forward E M) ∧
mask_u_runs (word_block_exchange_transport_forward E M) = mask_u_runs M - 1word_block_exchange_transport_forward_pure_is_commuting_maskIn LeanAutomata & Formal Languages
For any words u, v and block exchange E, if M is a valid mask of XABY and E is pure for M, then the forward transport of M is a valid mask of XBAY and is commuting for E.
theorem word_block_exchange_transport_forward_pure_is_commuting_mask {α : Type*}
(u v : List α) (E : WordBlockExchange α) (M : List Bool)
(hM : is_word_mask u v (word_block_exchange_before E) M)
(hpure : word_block_exchange_is_pure E M) :
is_word_mask u v (word_block_exchange_after E) (word_block_exchange_transport_forward E M) ∧
word_block_exchange_is_commuting E (word_block_exchange_transport_forward E M)word_gap_occ_le_mask_u_runsIn LeanAutomata & Formal Languages
For a unary source u = a^n with n > 0, every valid mask M of w has at least word_gap_occ a v w U-runs.
theorem word_gap_occ_le_mask_u_runs {α : Type*} [DecidableEq α] (a : α) (n : ℕ) (hn : 0 < n)
(v w : List α) (M : List Bool) (hM : is_word_mask (List.replicate n a) v w M) :
word_gap_occ a v w ≤ mask_u_runs Mword_gap_occ_le_runs_exists_maskIn LeanAutomata & Formal Languages
For a unary source u = a^n with n > 0, if w has a mask at all then it has one whose U-run count is exactly word_gap_occ a v w, hence the minimum is word_gap_occ a v w.
theorem word_gap_occ_le_runs_exists_mask {α : Type*} [DecidableEq α] (a : α) (n : ℕ) (hn : 0 < n)
(v w : List α) (M₀ : List Bool) (hM₀ : is_word_mask (List.replicate n a) v w M₀) :
∃ M, is_word_mask (List.replicate n a) v w M ∧ mask_u_runs M = word_gap_occ a v wword_gap_occ_swap_leIn LeanAutomata & Formal Languages
For any v, X, B, Y and p, word_gap_occ a v of X ++ a^p ++ B ++ Y and of X ++ B ++ a^p ++ Y differ by at most 1 (in both directions).
theorem word_gap_occ_swap_le {α : Type*} [DecidableEq α] (a : α) (v X B Y : List α) (p : ℕ) :
word_gap_occ a v (X ++ List.replicate p a ++ B ++ Y) ≤
word_gap_occ a v (X ++ B ++ List.replicate p a ++ Y) + 1 ∧
word_gap_occ a v (X ++ B ++ List.replicate p a ++ Y) ≤
word_gap_occ a v (X ++ List.replicate p a ++ B ++ Y) + 1word_insertion_degree_eq_gap_occIn LeanAutomata & Formal Languages
For a unary source u = a^n with n > 0 and a word w that admits a mask, word_insertion_degree (a^n) v w = word_gap_occ a v w.
theorem word_insertion_degree_eq_gap_occ {α : Type*} [DecidableEq α] (a : α) (n : ℕ) (hn : 0 < n)
(v w : List α) (M : List Bool) (hM : is_word_mask (List.replicate n a) v w M) :
word_insertion_degree (List.replicate n a) v w = (word_gap_occ a v w : WithTop ℕ)word_insertion_degree_eq_min_c_bIn LeanAutomata & Formal Languages
For any source words u, v and block exchange E, the insertion degree of word_block_exchange_after E is min (word_block_exchange_c E u v) (word_block_exchange_b E u v).
theorem word_insertion_degree_eq_min_c_b {α : Type*}
(u v : List α) (E : WordBlockExchange α) :
word_insertion_degree u v (word_block_exchange_after E) =
min (word_block_exchange_c E u v) (word_block_exchange_b E u v)word_insertion_degree_le_mask_u_runsIn LeanAutomata & Formal Languages
For any valid mask M of w the insertion degree of w is at most mask_u_runs M.
theorem word_insertion_degree_le_mask_u_runs {α : Type*} (u v w : List α) (M : List Bool)
(hM : is_word_mask u v w M) :
word_insertion_degree u v w ≤ (mask_u_runs M : WithTop ℕ)word_le_word_insertion_degreeIn LeanAutomata & Formal Languages
If every valid mask of w has at least k U-runs, then k is a lower bound for the insertion degree of w.
theorem word_le_word_insertion_degree {α : Type*} (u v w : List α) (k : ℕ)
(h : ∀ M, is_word_mask u v w M → k ≤ mask_u_runs M) :
(k : WithTop ℕ) ≤ word_insertion_degree u v wword_occp_le_count_posIn LeanAutomata & Formal Languages
If a list of pairs L has first components gv and componentwise sums gw, then the number of indices where gw exceeds gv is at most the number of pairs in L with positive second component.
theorem word_occp_le_count_pos (gv gw : List ℕ) (L : List (ℕ × ℕ))
(h1 : L.map Prod.fst = gv) (h2 : L.map (fun q => q.1 + q.2) = gw) :
word_occp gw gv ≤ L.countP (fun q => decide (0 < q.2))word_occp_swap_leIn LeanAutomata & Formal Languages
For lists A M Z gv of naturals and naturals α β p, the over-full count of A ++ [α+p] ++ M ++ [β] ++ Z against gv exceeds that of A ++ [α] ++ M ++ [β+p] ++ Z against gv by at most 1, and conversely.
theorem word_occp_swap_le (A M Z gv : List ℕ) (α β p : ℕ) :
word_occp (A ++ [α + p] ++ M ++ [β] ++ Z) gv ≤
word_occp (A ++ [α] ++ M ++ [β + p] ++ Z) gv + 1 ∧
word_occp (A ++ [α] ++ M ++ [β + p] ++ Z) gv ≤
word_occp (A ++ [α + p] ++ M ++ [β] ++ Z) gv + 1word_unary_base_block_exchange_after_insertion_degree_geIn LeanAutomata & Formal Languages
For a nonempty word u, unary base word v, and pure block exchange E of a minimum mask M of run count r > 1, the insertion degree of the exchanged word is at least r - 1.
theorem word_unary_base_block_exchange_after_insertion_degree_ge {α : Type*}
(u v : List α) (hu : u ≠ [])
(hunary : word_is_unary v)
(E : WordBlockExchange α) (M : List Bool) (r : ℕ) (hr : 1 < r)
(hM_mask : is_word_mask u v (word_block_exchange_before E) M)
(hM_deg : mask_u_runs M = r)
(h_min : word_insertion_degree u v (word_block_exchange_before E) = (r : WithTop ℕ))
(h_pure : word_block_exchange_is_pure E M) :
word_insertion_degree u v (word_block_exchange_after E) ≥ ((r - 1 : ℕ) : WithTop ℕ)word_unary_base_block_exchange_exactIn LeanAutomata & Formal Languages
Let u and v be words over an alphabet α such that u is nonempty (hu : u ≠ []) and v is unary (word_is_unary v). For any block exchange E, if M is a minimum mask of the word w = word_block_exchange_before E with run count r > 1 (so is_word_mask u v w M, mask_u_runs M = r, and word_insertion_degree u v w = r) and word_block_exchange_is_pure E M, then the exchanged word z = word_block_exchange_after E has minimum insertion degree word_insertion_degree u v z = r - 1.
theorem word_unary_base_block_exchange_exact {α : Type*}
(u v : List α) (hu : u ≠ [])
(hunary : word_is_unary v)
(E : WordBlockExchange α) (M : List Bool) (r : ℕ) (hr : 1 < r)
(hM_mask : is_word_mask u v (word_block_exchange_before E) M)
(hM_deg : mask_u_runs M = r)
(h_min : word_insertion_degree u v (word_block_exchange_before E) = (r : WithTop ℕ))
(h_pure : word_block_exchange_is_pure E M) :
word_insertion_degree u v (word_block_exchange_after E) = ((r - 1 : ℕ) : WithTop ℕ)word_unary_block_exchange_exactIn LeanAutomata & Formal Languages
Let u and v be nonempty words over an alphabet α (hu : u ≠ [], hv : v ≠ []) such that either u or v is unary (word_is_unary u ∨ word_is_unary v). For any block exchange E, if M is a minimum mask of the word w = word_block_exchange_before E with run count r > 1 (so is_word_mask u v w M, mask_u_runs M = r, and word_insertion_degree u v w = r) and word_block_exchange_is_pure E M, then the exchanged word z = word_block_exchange_after E has minimum insertion degree word_insertion_degree u v z = r - 1.
theorem word_unary_block_exchange_exact {α : Type*}
(u v : List α) (hu : u ≠ []) (hv : v ≠ [])
(hunary : word_is_unary u ∨ word_is_unary v)
(E : WordBlockExchange α) (M : List Bool) (r : ℕ) (hr : 1 < r)
(hM_mask : is_word_mask u v (word_block_exchange_before E) M)
(hM_deg : mask_u_runs M = r)
(h_min : word_insertion_degree u v (word_block_exchange_before E) = (r : WithTop ℕ))
(h_pure : word_block_exchange_is_pure E M) :
word_insertion_degree u v (word_block_exchange_after E) = ((r - 1 : ℕ) : WithTop ℕ)word_unary_inserted_block_exchange_exactIn LeanAutomata & Formal Languages
Let u and v be words over an alphabet α such that u is unary (word_is_unary u) and v is nonempty (hv : v ≠ []). For any block exchange E, if M is a minimum mask of the word w = word_block_exchange_before E with run count r > 1 (so is_word_mask u v w M, mask_u_runs M = r, and word_insertion_degree u v w = r) and word_block_exchange_is_pure E M, then the exchanged word z = word_block_exchange_after E has minimum insertion degree word_insertion_degree u v z = r - 1.
theorem word_unary_inserted_block_exchange_exact {α : Type*}
(u v : List α) (hv : v ≠ [])
(hunary : word_is_unary u)
(E : WordBlockExchange α) (M : List Bool) (r : ℕ) (hr : 1 < r)
(hM_mask : is_word_mask u v (word_block_exchange_before E) M)
(hM_deg : mask_u_runs M = r)
(h_min : word_insertion_degree u v (word_block_exchange_before E) = (r : WithTop ℕ))
(h_pure : word_block_exchange_is_pure E M) :
word_insertion_degree u v (word_block_exchange_after E) = ((r - 1 : ℕ) : WithTop ℕ)acceptingCount_strictMajority_of_oddIn LeanCircuit Complexity & Lower Bounds
For any odd integer n, the number of accepting inputs of the strict Majority function on n Boolean variables is exactly 2^(n - 1).
theorem acceptingCount_strictMajority_of_odd (n : ℕ) (hn : Odd n) :
acceptingCount (strictMajority n) = 2 ^ (n - 1)acceptingCount_strictMajority_two_mulIn LeanCircuit Complexity & Lower Bounds
For m ≥ 1, the number of accepting inputs of the strict Majority function on 2m Boolean variables is 2^(2m-1) - C(2m-1,m).
theorem acceptingCount_strictMajority_two_mul (m : ℕ) (hm : 0 < m) :
acceptingCount (strictMajority (2 * m)) = 2 ^ (2 * m - 1) - (2 * m - 1).choose mbool_anf_coeff_false_of_card_gt_of_top_layers_zeroIn LeanCircuit Complexity & Lower Bounds
For n ≥ 2 and a Boolean function f on n variables, if the top ANF coefficient (at Finset.univ) is false and boolNextToTopAnfCount f = 0, then every subset S : Finset (Fin n) with card S > n - 2 has boolAnfCoefficient f S = false.
theorem bool_anf_coeff_false_of_card_gt_of_top_layers_zero (n : ℕ) (hn : 2 ≤ n)
(f : (Fin n → Bool) → Bool)
(hb : boolAnfCoefficient f Finset.univ = false)
(hk : boolNextToTopAnfCount f = 0)
{S : Finset (Fin n)} (hS : n - 2 < S.card) :
boolAnfCoefficient f S = falsebool_anf_sum_half_mem_degreeSpaceIn LeanCircuit Complexity & Lower Bounds
If every ANF coefficient of degree greater than d vanishes, then the function sending x to half of the integer ANF sum (the sum over S of the 0/1 coefficient times ∏_{i∈S} (if x i then 1 else 0), cast to ℝ and divided by 2) belongs to degreeSpace ℝ (Fin n) d.
theorem bool_anf_sum_half_mem_degreeSpace (n d : ℕ) (f : (Fin n → Bool) → Bool)
(h : ∀ S : Finset (Fin n), d < S.card → boolAnfCoefficient f S = false) :
(fun x : Fin n → Bool => ((∑ S : Finset (Fin n), (if boolAnfCoefficient f S then 1 else 0) *
∏ i ∈ S, (if x i = true then 1 else 0) : ℕ) : ℝ) / 2) ∈ degreeSpace (K := ℝ) (Fin n) dbool_anf_sum_half_rat_mem_degreeSpaceIn LeanCircuit Complexity & Lower Bounds
If every ANF coefficient of degree greater than d vanishes, then the function sending x to half of the integer ANF sum (cast to ℚ and divided by 2) belongs to degreeSpace ℚ (Fin n) d.
theorem bool_anf_sum_half_rat_mem_degreeSpace (n d : ℕ) (f : (Fin n → Bool) → Bool)
(h : ∀ S : Finset (Fin n), d < S.card → boolAnfCoefficient f S = false) :
(fun x : Fin n → Bool => ((∑ S : Finset (Fin n), (if boolAnfCoefficient f S then 1 else 0) *
∏ i ∈ S, (if x i = true then 1 else 0) : ℕ) : ℚ) / 2) ∈ degreeSpace (K := ℚ) (Fin n) dbool_anf_sum_int_parityIn LeanCircuit Complexity & Lower Bounds
For every Boolean function f on n variables and point x, the integer ANF sum (over ℕ, cast to ℤ) is congruent modulo 2 to the 0/1 bit of f x.
theorem bool_anf_sum_int_parity (n : ℕ) (f : (Fin n → Bool) → Bool) (x : Fin n → Bool) :
((∑ S : Finset (Fin n), (if boolAnfCoefficient f S then 1 else 0) *
∏ i ∈ S, (if x i = true then 1 else 0) : ℕ) : ℤ) ≡
((if f x then 1 else 0 : ℕ) : ℤ) [ZMOD 2]bool_anf_sum_zmod2In LeanCircuit Complexity & Lower Bounds
The ANF (algebraic normal form) expansion over GF(2): for every Boolean function f on n variables and every point x, the sum over all S : Finset (Fin n) of (boolAnfCoefficient f S as 0/1) times the monomial product ∏_{i∈S} (if x i then 1 else 0), reduced to ZMod 2, equals (if f x then 1 else 0).
theorem bool_anf_sum_zmod2 (n : ℕ) (f : (Fin n → Bool) → Bool) (x : Fin n → Bool) :
((∑ S : Finset (Fin n), (if boolAnfCoefficient f S then 1 else 0) *
∏ i ∈ S, (if x i = true then 1 else 0) : ℕ) : ZMod 2) =
(if f x = true then 1 else 0)explicit_optimal_torus_approximationIn LeanCircuit Complexity & Lower Bounds
For any Boolean function f : (Fin n → Bool) → Bool on n > 0 variables, explicitApproximant f belongs to degreeSpace (K := ℝ) (Fin n) (n - 1), satisfies torusDistance (explicitApproximant f x - bit (f x) / 2) = explicitError f at every x : Fin n → Bool, achieves the optimal degree-(n-1) torus approximation error optimalTorusError f (n - 1) = explicitError f, and satisfies explicitApproximant f (x ∘ e) = explicitApproximant f x for any permutation e : Equiv.Perm (Fin n) under which f is invariant.
theorem explicit_optimal_torus_approximation {n : ℕ} (hn : 0 < n) (f : (Fin n → Bool) → Bool) :
(explicitApproximant f ∈ degreeSpace (K := ℝ) (Fin n) (n - 1)) ∧
(∀ x : Fin n → Bool, torusDistance (explicitApproximant f x - bit (f x) / 2) = explicitError f) ∧
(optimalTorusError f (n - 1) = explicitError f) ∧
(∀ (e : Equiv.Perm (Fin n)), (∀ x, f (x ∘ e) = f x) → (∀ x, explicitApproximant f (x ∘ e) = explicitApproximant f x))fourier_entropy_bound_from_orthogonal_decompIn LeanCircuit Complexity & Lower Bounds
Let f : {-1,1}^n → ℂ decompose as a sum of pairwise orthogonal non-zero functions g_1, ..., g_m. Then the Fourier entropy ℍ(f_hat^2) is at most 2 * ∑_{i=1}^m p_i * log_2(L_i / p_i), where p_i = ||g_i||_2^2 and L_i = ||g_i_hat||_1.
theorem fourier_entropy_bound_from_orthogonal_decomp
{n m : ℕ} (f : (Fin n → Bool) → ℂ) (g : Fin m → (Fin n → Bool) → ℂ)
(h_sum : f = ∑ i : Fin m, g i)
(h_nz : ∀ i : Fin m, g i ≠ 0)
(h_ortho : ∀ i j : Fin m, i ≠ j → inner_product_c (g i) (g j) = 0) :
unnormalized_fourier_entropy f ≤
2 * ∑ i : Fin m, l2_norm_sq_c (g i) * Real.logb 2 (spectral_norm_c (g i) / l2_norm_sq_c (g i))fourier_entropy_from_moment_boundIn LeanCircuit Complexity & Lower Bounds
Entropy transfer (paper Theorem 4.2, the differentiation step). Assume f = Σ_i g_i with the non-zero g_i pairwise L2-orthogonal, and assume the sharp moment bound Σ_S |f̂(S)|^r ≤ Σ_i L_i^{2-r} p_i^{r-1} holds for every 1 ≤ r ≤ 2. Then the Fourier entropy satisfies ℍ(f̂²) ≤ 2 Σ_i p_i log₂(L_i / p_i).
theorem fourier_entropy_from_moment_bound
{n m : ℕ} (f : (Fin n → Bool) → ℂ) (g : Fin m → (Fin n → Bool) → ℂ)
(h_sum : f = ∑ i : Fin m, g i)
(h_nz : ∀ i : Fin m, g i ≠ 0)
(h_ortho : ∀ i j : Fin m, i ≠ j → inner_product_c (g i) (g j) = 0)
(h_moment : ∀ r : ℝ, 1 ≤ r → r ≤ 2 →
(∑ S : Finset (Fin n),
‖(1 / (2 : ℂ) ^ n) * ∑ x : Fin n → Bool, f x * (∏ i ∈ S, if x i then (-1 : ℂ) else 1)‖ ^ r)
≤ ∑ i : Fin m, (spectral_norm_c (g i)) ^ (2 - r) * (l2_norm_sq_c (g i)) ^ (r - 1)) :
unnormalized_fourier_entropy f ≤
2 * ∑ i : Fin m, l2_norm_sq_c (g i) * Real.logb 2 (spectral_norm_c (g i) / l2_norm_sq_c (g i))fourier_moment_interpolation_boundIn LeanCircuit Complexity & Lower Bounds
Moment interpolation for an orthogonal decomposition (paper Theorem 4.1). If f = Σ_i g_i with the non-zero g_i pairwise orthogonal in L2, then for every 1 ≤ r ≤ 2, Σ_S |f̂(S)|^r ≤ Σ_i L_i^{2-r} p_i^{r-1}, where p_i = ‖g_i‖₂² and L_i = ‖ĝ_i‖₁.
theorem fourier_moment_interpolation_bound
{n m : ℕ} (f : (Fin n → Bool) → ℂ) (g : Fin m → (Fin n → Bool) → ℂ)
(h_sum : f = ∑ i : Fin m, g i)
(h_nz : ∀ i : Fin m, g i ≠ 0)
(h_ortho : ∀ i j : Fin m, i ≠ j → inner_product_c (g i) (g j) = 0)
{r : ℝ} (hr1 : 1 ≤ r) (hr2 : r ≤ 2) :
(∑ S : Finset (Fin n),
‖(1 / (2 : ℂ) ^ n) * ∑ x : Fin n → Bool, f x * (∏ i ∈ S, if x i then (-1 : ℂ) else 1)‖ ^ r)
≤ ∑ i : Fin m, (spectral_norm_c (g i)) ^ (2 - r) * (l2_norm_sq_c (g i)) ^ (r - 1)fourier_parseval_orthogonal_decompIn LeanCircuit Complexity & Lower Bounds
If f = Σ_i g_i on the Boolean cube with the g_i pairwise orthogonal in the complex L2 inner product, then the sum over S of |f̂(S)|² equals Σ_i ‖g_i‖₂² (the r = 2 endpoint of the moment inequality).
theorem fourier_parseval_orthogonal_decomp
{n m : ℕ} (f : (Fin n → Bool) → ℂ) (g : Fin m → (Fin n → Bool) → ℂ)
(h_sum : f = ∑ i : Fin m, g i)
(h_ortho : ∀ i j : Fin m, i ≠ j → inner_product_c (g i) (g j) = 0) :
(∑ S : Finset (Fin n),
‖(1 / (2 : ℂ) ^ n) * ∑ x : Fin n → Bool, f x * (∏ i ∈ S, if x i then (-1 : ℂ) else 1)‖ ^ 2)
= ∑ i : Fin m, l2_norm_sq_c (g i)hasRationalTorusApproximation_of_anf_high_coeffs_zeroIn LeanCircuit Complexity & Lower Bounds
If every ANF coefficient of degree greater than d vanishes, then f has a degree-d rational torus approximation with error exactly 0 (HasRationalTorusApproximation f d 0).
theorem hasRationalTorusApproximation_of_anf_high_coeffs_zero (n d : ℕ) (f : (Fin n → Bool) → Bool)
(h : ∀ S : Finset (Fin n), d < S.card → boolAnfCoefficient f S = false) :
HasRationalTorusApproximation f d 0hasTorusApproximation_error_nonnegIn LeanCircuit Complexity & Lower Bounds
Any error ε admitting a degree-d torus approximation of f is nonnegative: 0 ≤ ε. No vanishing-coefficient hypothesis is needed.
theorem hasTorusApproximation_error_nonneg {n d : ℕ} (f : (Fin n → Bool) → Bool) {ε : ℝ}
(h : HasTorusApproximation f d ε) : 0 ≤ εhasTorusApproximation_explicitErrorIn LeanCircuit Complexity & Lower Bounds
For any Boolean function f : (Fin n → Bool) → Bool on n > 0 variables, HasTorusApproximation f (n - 1) (explicitError f) holds.
theorem hasTorusApproximation_explicitError {n : ℕ} (hn : 0 < n) (f : (Fin n → Bool) → Bool) :
HasTorusApproximation f (n - 1) (explicitError f)hasTorusApproximation_ge_explicitErrorIn LeanCircuit Complexity & Lower Bounds
For any Boolean function f : (Fin n → Bool) → Bool on n > 0 variables and any real ε, if HasTorusApproximation f (n - 1) ε holds, then explicitError f ≤ ε.
theorem hasTorusApproximation_ge_explicitError {n : ℕ} (hn : 0 < n) (f : (Fin n → Bool) → Bool)
(ε : ℝ) (h : HasTorusApproximation f (n - 1) ε) :
explicitError f ≤ εhasTorusApproximation_of_anf_high_coeffs_zeroIn LeanCircuit Complexity & Lower Bounds
If every ANF coefficient of degree greater than d vanishes, then f has a degree-d torus approximation with error exactly 0 (i.e. HasTorusApproximation f d 0).
theorem hasTorusApproximation_of_anf_high_coeffs_zero (n d : ℕ) (f : (Fin n → Bool) → Bool)
(h : ∀ S : Finset (Fin n), d < S.card → boolAnfCoefficient f S = false) :
HasTorusApproximation f d 0ndeg_const_falseIn LeanCircuit Complexity & Lower Bounds
For any natural number n, the constant false Boolean function on n variables has non-deterministic degree equal to 0.
theorem ndeg_const_false (n : ℕ) : ndeg (fun (_ : Fin n → Bool) => false) = 0
ndeg_const_trueIn LeanCircuit Complexity & Lower Bounds
For any natural number n, the constant true Boolean function on n variables has non-deterministic degree equal to 0.
theorem ndeg_const_true (n : ℕ) : ndeg (fun (_ : Fin n → Bool) => true) = 0
odd_acceptingCount_strictMajority_iffIn LeanCircuit Complexity & Lower Bounds
For any integer n ≥ 1, the number of accepting inputs of the strict Majority function on n Boolean variables is odd if and only if n is a power of 2.
theorem odd_acceptingCount_strictMajority_iff (n : ℕ) (hn : 0 < n) :
Odd (acceptingCount (strictMajority n)) ↔ ∃ k : ℕ, n = 2 ^ kodd_acceptingCount_strictMajority_two_mulIn LeanCircuit Complexity & Lower Bounds
For any m > 0, the parity of the number of accepting inputs of the strict Majority function on 2m Boolean variables equals the parity of the binomial coefficient (2m - 1 choose m).
theorem odd_acceptingCount_strictMajority_two_mul (m : ℕ) (hm : 0 < m) :
Odd (acceptingCount (strictMajority (2 * m))) ↔ Odd (Nat.choose (2 * m - 1) m)odd_choose_two_mul_sub_one_iffIn LeanCircuit Complexity & Lower Bounds
For any positive integer m, the binomial coefficient (2m - 1 choose m) is odd if and only if m is a power of 2.
theorem odd_choose_two_mul_sub_one_iff (m : ℕ) (hm : 0 < m) :
Odd (Nat.choose (2 * m - 1) m) ↔ ∃ k : ℕ, m = 2 ^ kop_729_case_n_three_achievableIn LeanCircuit Complexity & Lower Bounds
Every Boolean function on 3 variables has a degree-1 rational torus approximation of error exactly predictedTorusError 3 f.
theorem op_729_case_n_three_achievable (f : (Fin 3 → Bool) → Bool) :
HasRationalTorusApproximation f 1 (predictedTorusError 3 f)op_729_case_n_three_lower_boundIn LeanCircuit Complexity & Lower Bounds
For every Boolean function f on 3 variables and every real ε, a degree-1 torus approximation of f with error ε forces predictedTorusError 3 f ≤ ε.
theorem op_729_case_n_three_lower_bound (f : (Fin 3 → Bool) → Bool) (ε : ℝ)
(h : HasTorusApproximation f 1 ε) : predictedTorusError 3 f ≤ εop_729_case_n_three_lower_bound_k_one_threeIn LeanCircuit Complexity & Lower Bounds
If the top ANF coefficient of f on 3 variables is false and f has one or three true next-to-top ANF coefficients, then every degree-1 real polynomial P is at torus distance at least 1/8 from f/2 at some cube point.
theorem op_729_case_n_three_lower_bound_k_one_three (f : (Fin 3 → Bool) → Bool)
(hb : boolAnfCoefficient f Finset.univ = false)
(hk : boolNextToTopAnfCount f = 1 ∨ boolNextToTopAnfCount f = 3)
(P : (Fin 3 → Bool) → ℝ) (hP : P ∈ degreeSpace (K := ℝ) (Fin 3) 1) :
∃ x : Fin 3 → Bool, 1 / 8 ≤ torusDistance (P x - bit (f x) / 2)op_729_case_n_three_lower_bound_k_twoIn LeanCircuit Complexity & Lower Bounds
If the top ANF coefficient of f on 3 variables is false and f has exactly two true next-to-top ANF coefficients, then every degree-1 real polynomial P is at torus distance at least 1/4 from f/2 at some cube point.
theorem op_729_case_n_three_lower_bound_k_two (f : (Fin 3 → Bool) → Bool)
(hb : boolAnfCoefficient f Finset.univ = false)
(hk : boolNextToTopAnfCount f = 2)
(P : (Fin 3 → Bool) → ℝ) (hP : P ∈ degreeSpace (K := ℝ) (Fin 3) 1) :
∃ x : Fin 3 → Bool, 1 / 4 ≤ torusDistance (P x - bit (f x) / 2)op_729_case_n_three_lower_bound_topIn LeanCircuit Complexity & Lower Bounds
If the top ANF coefficient of f on 3 variables is true, then every degree-1 real polynomial P is at torus distance at least 1/6 from f/2 at some cube point.
theorem op_729_case_n_three_lower_bound_top (f : (Fin 3 → Bool) → Bool)
(hb : boolAnfCoefficient f Finset.univ = true)
(P : (Fin 3 → Bool) → ℝ) (hP : P ∈ degreeSpace (K := ℝ) (Fin 3) 1) :
∃ x : Fin 3 → Bool, 1 / 6 ≤ torusDistance (P x - bit (f x) / 2)op_729_dual_lower_boundIn LeanCircuit Complexity & Lower Bounds
For every natural number n ≥ 2, every Boolean function f on n variables, and every error ε, if f has a degree-(n-2) torus approximation with error ε, then predictedTorusError n f ≤ ε.
theorem op_729_dual_lower_bound (n : ℕ) (hn : 2 ≤ n)
(f : (Fin n → Bool) → Bool) (ε : ℝ)
(h : HasTorusApproximation f (n - 2) ε) :
predictedTorusError n f ≤ εop_729_predicted_torus_error_threeIn LeanCircuit Complexity & Lower Bounds
At n = 3 the predicted torus error reduces to five explicit cases: it is 1/6 when the top ANF coefficient is true, and otherwise 0, 1/8, 1/4, 1/8 according as the next-to-top ANF count is 0, 1, 2, 3.
theorem op_729_predicted_torus_error_three (f : (Fin 3 → Bool) → Bool) :
predictedTorusError 3 f =
if boolAnfCoefficient f Finset.univ then 1 / 6
else if boolNextToTopAnfCount f = 0 then 0
else if boolNextToTopAnfCount f = 1 then 1 / 8
else if boolNextToTopAnfCount f = 2 then 1 / 4
else 1 / 8optimalTorusError_predIn LeanCircuit Complexity & Lower Bounds
For any Boolean function f : (Fin n → Bool) → Bool on n > 0 variables, optimalTorusError f (n - 1) equals explicitError f.
theorem optimalTorusError_pred {n : ℕ} (hn : 0 < n) (f : (Fin n → Bool) → Bool) :
optimalTorusError f (n - 1) = explicitError foptimalTorusError_strictMajorityIn LeanCircuit Complexity & Lower Bounds
For any integer n ≥ 1, the optimal degree-(n-1) torus approximation error of the strict Majority function on n variables equals 2^{-n-1} if n is a power of two, and 0 otherwise.
open Classical in
theorem optimalTorusError_strictMajority (n : ℕ) (hn : 0 < n) :
optimalTorusError (strictMajority n) (n - 1) =
if ∃ k : ℕ, n = 2 ^ k then 1 / (2 : ℝ) ^ (n + 1) else 0parityCharacter_degreeSpace_orthogonalIn LeanCircuit Complexity & Lower Bounds
For any n > 0 and any polynomial P in degreeSpace ℝ (Fin n) (n - 1), the inner product of P with parityCharacter is zero: ∑ x, parityCharacter x * P x = 0.
theorem parityCharacter_degreeSpace_orthogonal {n : ℕ} (hn : 0 < n) (P : (Fin n → Bool) → ℝ)
(hP : P ∈ degreeSpace ℝ (Fin n) (n - 1)) :
(∑ x : Fin n → Bool, parityCharacter x * P x) = 0riesz_thorin_lp_interpolationIn LeanCircuit Complexity & Lower Bounds
Finite-dimensional Riesz–Thorin interpolation (paper Theorem 2.5). Let T : ℂ^I → ℂ^J be ℂ-linear and ν_i > 0 with ‖Tu‖₁ ≤ Σ_i ν_i|u_i| and ‖Tu‖₂² ≤ Σ_i ν_i|u_i|² for all u. Then for every 1 ≤ r ≤ 2, ‖Tu‖_r^r = Σ_j |(Tu)_j|^r ≤ Σ_i ν_i|u_i|^r for all u.
theorem riesz_thorin_lp_interpolation
{ι κ : Type*} [Fintype ι] [Fintype κ]
(T : (ι → ℂ) →ₗ[ℂ] (κ → ℂ)) (ν : ι → ℝ)
(hν : ∀ i, 0 < ν i)
(h1 : ∀ u : ι → ℂ, ∑ j, ‖T u j‖ ≤ ∑ i, ν i * ‖u i‖)
(h2 : ∀ u : ι → ℂ, ∑ j, ‖T u j‖ ^ (2:ℝ) ≤ ∑ i, ν i * ‖u i‖ ^ (2:ℝ))
{r : ℝ} (hr1 : 1 ≤ r) (hr2 : r ≤ 2) :
∀ u : ι → ℂ, ∑ j, ‖T u j‖ ^ r ≤ ∑ i, ν i * ‖u i‖ ^ rstrictMajority_accepting_count_eq_sum_chooseIn LeanCircuit Complexity & Lower Bounds
The accepting inputs of the strict Majority function on n Boolean variables are exactly those of Hamming weight k with 2k > n, i.e. with n/2 + 1 ≤ k, and there are C(n,k) inputs of weight k. Hence the accepting count is the sum of C(n,k) over n/2 + 1 ≤ k ≤ n.
theorem strictMajority_accepting_count_eq_sum_choose (n : ℕ) :
acceptingCount (strictMajority n) = ∑ k ∈ Finset.Ico (n / 2 + 1) (n + 1), Nat.choose n kstrictMajority_degree_ge_of_small_errorIn LeanCircuit Complexity & Lower Bounds
For any integer n ≥ 1 that is a power of two, every torus polynomial approximating the strict Majority function on n variables with error strictly below 2^{-n-1} has degree at least n.
theorem strictMajority_degree_ge_of_small_error (n : ℕ) (hn : 0 < n)
(hpow : ∃ k : ℕ, n = 2 ^ k) {d : ℕ} {ε : ℝ}
(hε : ε < 1 / (2 : ℝ) ^ (n + 1))
(h : HasTorusApproximation (strictMajority n) d ε) : n ≤ dsum_Ico_choose_two_mul_add_one_upper_halfIn LeanCircuit Complexity & Lower Bounds
The upper half of row 2m+1 of Pascal's triangle, namely the sum of C(2m+1,k) over m+1 ≤ k ≤ 2m+1, equals 4^m.
theorem sum_Ico_choose_two_mul_add_one_upper_half (m : ℕ) :
∑ k ∈ Finset.Ico (m + 1) (2 * m + 2), (2 * m + 1).choose k = 4 ^ mtwo_mul_sum_Ico_choose_two_mul_add_chooseIn LeanCircuit Complexity & Lower Bounds
Middle-layer symmetry for row 2m: twice the sum of C(2m,k) over m+1 ≤ k ≤ 2m, plus the central coefficient C(2m,m), equals the full row sum 2^(2m).
theorem two_mul_sum_Ico_choose_two_mul_add_choose (m : ℕ) :
2 * (∑ k ∈ Finset.Ico (m + 1) (2 * m + 1), (2 * m).choose k) + (2 * m).choose m = 2 ^ (2 * m)abs_exp_neg_sub_exp_neg_leIn LeanCombinatorics for TCS
For all nonnegative reals x and y, |exp(-x) - exp(-y)| ≤ |x - y|.
theorem abs_exp_neg_sub_exp_neg_le {x y : ℝ} (hx : 0 ≤ x) (hy : 0 ≤ y) :
|Real.exp (-x) - Real.exp (-y)| ≤ |x - y|add_self_injective_of_odd_cardIn LeanCombinatorics for TCS
In a finite abelian group of odd order the doubling map x ↦ x + x is injective; equivalently the group has no element of order two, so a linear equation 2x = c has at most one solution.
theorem add_self_injective_of_odd_card {G : Type*} [AddCommGroup G] [Fintype G] (hodd : Fintype.card G % 2 = 1) : Function.Injective (fun x : G => x + x)admissible_diagonal_selection_isometric_path_coverIn LeanCombinatorics for TCS
For every natural number k ≥ 1 and every admissible selection M of unit diagonals on the grid V_{2k-1} = {0, ..., 2k-1}^2 (represented as M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))) satisfying is_admissible_diagonal_selection k M), there exists a natural number p ≤ 2 * k^2 - M.card and an indexed family of walks w_i (for i : Fin p) between endpoints u_i, v_i in the k × k Cartesian grid graph Γ_k = SimpleGraph.pathGraph k □ SimpleGraph.pathGraph k (on vertices Fin k × Fin k) such that each walk w_i is a geodesic path (its length equals the graph distance between u_i and v_i and it has no duplicate vertices) and every vertex of Fin k × Fin k belongs to the support of at least one walk w_i.
theorem admissible_diagonal_selection_isometric_path_cover (k : ℕ) (hk : 1 ≤ k)
(M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))))
(hM : is_admissible_diagonal_selection k M) :
∃ (p : ℕ) (hp : p ≤ 2 * k ^ 2 - M.card) (u v : Fin p → Fin k × Fin k)
(w : (i : Fin p) → ((SimpleGraph.pathGraph k) □ (SimpleGraph.pathGraph k)).Walk (u i) (v i)),
(∀ i, (w i).IsPath ∧ (w i).length = ((SimpleGraph.pathGraph k) □ (SimpleGraph.pathGraph k)).dist (u i) (v i)) ∧
(∀ x : Fin k × Fin k, ∃ i, x ∈ (w i).support)affine_line_eq_translate_spanIn LeanCombinatorics for TCS
For a point Q and direction v, the affine line through Q in direction v equals the set of points x whose translate x − Q lies in the span of v.
theorem affine_line_eq_translate_span
(p : ℕ) (Q v : Fin 3 → ZMod p) :
affine_line Q v = {x : Fin 3 → ZMod p | x - Q ∈ Submodule.span (ZMod p) {v}}affine_line_p_minus_one_exists_full_lineIn LeanCombinatorics for TCS
Let p ≥ 3 be a prime, and let S ⊆ (ℤ/pℤ)³ be an admissible plane set. If S meets the affine line through P in nonzero direction v in p - 1 points, then S contains a full affine line: there exist a point Q and a nonzero direction w such that the affine line through Q in direction w is contained in S.
theorem affine_line_p_minus_one_exists_full_line
(p : ℕ) [Fact p.Prime] (hp : 3 ≤ p)
(S : Set (Fin 3 → ZMod p)) (hS : admissible_plane_set p S)
(P v : Fin 3 → ZMod p) (hv : v ≠ 0)
(hℓ : (S ∩ affine_line P v).ncard = p - 1) :
∃ (Q w : Fin 3 → ZMod p), w ≠ 0 ∧ affine_line Q w ⊆ Saffine_line_p_minus_one_forces_cylinderIn LeanCombinatorics for TCS
Let p ≥ 3 be a prime, and let S ⊆ (ℤ/pℤ)³ be an admissible plane set. If S meets the affine line through P in nonzero direction v in p - 1 points, then S contains a full affine line and is a cylinder in its direction: there exist a point Q and a nonzero direction w such that the affine line through Q in direction w is contained in S, and S is a cylinder in direction w.
theorem affine_line_p_minus_one_forces_cylinder
(p : ℕ) [Fact p.Prime] (hp : 3 ≤ p)
(S : Set (Fin 3 → ZMod p)) (hS : admissible_plane_set p S)
(P v : Fin 3 → ZMod p) (hv : v ≠ 0)
(hℓ : (S ∩ affine_line P v).ncard = p - 1) :
∃ (Q w : Fin 3 → ZMod p), w ≠ 0 ∧ affine_line Q w ⊆ S ∧ is_cylinder_in_direction p S waffine_line_p_minus_one_light_planes_existIn LeanCombinatorics for TCS
Let p ≥ 3 be a prime, and let S ⊆ (ℤ/pℤ)³ be an admissible plane set. If S meets the affine line through P in nonzero direction v in p - 1 points, then there exist two nonzero linear functionals f₁, f₂ defining distinct affine planes containing the line, each meeting S in exactly p points.
theorem affine_line_p_minus_one_light_planes_exist
(p : ℕ) [Fact p.Prime] (hp : 3 ≤ p)
(S : Set (Fin 3 → ZMod p)) (hS : admissible_plane_set p S)
(P v : Fin 3 → ZMod p) (hv : v ≠ 0)
(hℓ : (S ∩ affine_line P v).ncard = p - 1) :
∃ (f₁ f₂ : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p),
f₁ ≠ 0 ∧ f₂ ≠ 0 ∧
affine_line P v ⊆ affine_plane f₁ (f₁ P) ∧
affine_line P v ⊆ affine_plane f₂ (f₂ P) ∧
affine_plane f₁ (f₁ P) ≠ affine_plane f₂ (f₂ P) ∧
(S ∩ affine_plane f₁ (f₁ P)).ncard = p ∧
(S ∩ affine_plane f₂ (f₂ P)).ncard = paffine_line_sub_plane_iff_vanishingIn LeanCombinatorics for TCS
An affine line through P in nonzero direction v is contained in the affine plane defined by f(x) = f(P) if and only if f(v) = 0.
theorem affine_line_sub_plane_iff_vanishing
(p : ℕ) [Fact p.Prime] (P v : Fin 3 → ZMod p)
(f : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p) :
affine_line P v ⊆ affine_plane f (f P) ↔ f v = 0affine_plane_fiber_card_leIn LeanCombinatorics for TCS
For any nonzero linear functional f on (ZMod p)^3, at most p - 1 nonzero functionals g satisfy affine_plane g (g P) = affine_plane f (f P).
theorem affine_plane_fiber_card_le
(p : ℕ) [Fact p.Prime] (P : Fin 3 → ZMod p)
(f : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p) (hf : f ≠ 0) :
Nat.card {g : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p // g ≠ 0 ∧ affine_plane g (g P) = affine_plane f (f P)} ≤ p - 1affine_planes_containing_line_intersection_sumIn LeanCombinatorics for TCS
Let p be a prime with [Fact p.Prime], S : Set (Fin 3 → ZMod p) an admissible plane set (admissible_plane_set p S), P ∈ S, and v : Fin 3 → ZMod p a non-zero direction (v ≠ 0). The sum over all H ∈ affine_planes_containing_line p (affine_line P v) of ((S ∩ H).ncard : ℤ) equals (p : ℤ)^2 + (p : ℤ) * ((S ∩ affine_line P v).ncard : ℤ).
open Classical in
theorem affine_planes_containing_line_intersection_sum
(p : ℕ) [Fact p.Prime] (S : Set (Fin 3 → ZMod p)) (hS : admissible_plane_set p S)
(P v : Fin 3 → ZMod p) (hv : v ≠ 0) (hP : P ∈ S) :
(∑ H ∈ affine_planes_containing_line p (affine_line P v), ((S ∩ H).ncard : ℤ)) =
(p : ℤ) ^ 2 + (p : ℤ) * ((S ∩ affine_line P v).ncard : ℤ)affine_planes_through_point_intersection_sumIn LeanCombinatorics for TCS
Let p be a prime with [Fact p.Prime], S : Set (Fin 3 → ZMod p) an admissible plane set (admissible_plane_set p S), and P ∈ S. The sum over all H ∈ affine_planes_through p P of ((S ∩ H).ncard : ℤ) equals (p : ℤ)^3 + 2 * (p : ℤ)^2.
open Classical in
theorem affine_planes_through_point_intersection_sum
(p : ℕ) [Fact p.Prime] (S : Set (Fin 3 → ZMod p)) (hS : admissible_plane_set p S)
(P : Fin 3 → ZMod p) (hP : P ∈ S) :
(∑ H ∈ affine_planes_through p P, ((S ∩ H).ncard : ℤ)) = (p : ℤ) ^ 3 + 2 * (p : ℤ) ^ 2alpha_lexical_adjacent_nondivisible_elementary_stepIn LeanCombinatorics for TCS
For adjacent positive lexical sequences of the same degree n−1 whose meet has degree m−1 with m not dividing n, the later sequence is obtained from the earlier by one elementary operation at a negative cell.
theorem alpha_lexical_adjacent_nondivisible_elementary_step
(n : ℕ) (a b : List ℕ)
(ha : alpha_is_lexical a) (hb : alpha_is_lexical b)
(hsa : a.sum + 1 = n) (hsb : b.sum + 1 = n)
(hab : alpha_lexical_lt a b)
(hadj : ∀ c : List ℕ, alpha_is_lexical c → c.sum + 1 = n →
¬ (alpha_lexical_lt a c ∧ alpha_lexical_lt c b))
(hnondvd : ¬ ((alpha_lexical_meet a b).sum + 1) ∣ n) :
∃ i : ℕ, i % 2 = 1 ∧ alpha_elementary_cell_step a b ialpha_lexical_conjugate_of_upper_branchIn LeanCombinatorics for TCS
If two lexical sequences share an even-length prefix p and continue respectively with (x,1) and (y), where y exceeds x+1, then increasing x by one and deleting the following one from the first sequence leaves a lexical sequence. The remaining suffixes may differ and the sequences need not have equal degree.
theorem alpha_lexical_conjugate_of_upper_branch
(p s t : List ℕ) (x y : ℕ) (heven : p.length % 2 = 0)
(hxy : x + 1 < y)
(ha : alpha_is_lexical (p ++ [x, 1] ++ s))
(hb : alpha_is_lexical (p ++ [y] ++ t)) :
alpha_is_lexical (p ++ [x + 1] ++ s)alpha_lexical_failed_even_split_has_later_step_of_primeIn LeanCombinatorics for TCS
At prime degree parameter n, let a be lexical of degree n−1 and let i be a positive even zero-based index with cell value greater than one and a lexical preceding prefix. If splitting cell i does not yield a lexical sequence, then some later even-indexed elementary split or conjugation does yield a lexical sequence.
theorem alpha_lexical_failed_even_split_has_later_step_of_prime
(n : ℕ) (a : List ℕ) (i : ℕ) (hn : n.Prime)
(ha : alpha_is_lexical a) (hs : a.sum + 1 = n)
(hi : 0 < i ∧ i < a.length) (heven : i % 2 = 0)
(hc : 1 < a.getD i 0) (hp : alpha_is_lexical (a.take i))
(hfail : ¬ alpha_is_lexical
(a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1))) :
∃ j : ℕ, i < j ∧ j % 2 = 0 ∧
∃ b : List ℕ, alpha_elementary_cell_step a b j ∧ alpha_is_lexical balpha_lexical_negative_split_of_lexical_prefixIn LeanCombinatorics for TCS
Let a be a lexical positive sequence, and let i be an odd zero-based index in range with cell value greater than one. If the prefix of length i is lexical, then splitting cell i into its value minus one followed by one produces a lexical sequence.
theorem alpha_lexical_negative_split_of_lexical_prefix
(a : List ℕ) (i : ℕ) (ha : alpha_is_lexical a)
(hi : i < a.length) (hodd : i % 2 = 1)
(hc : 1 < a.getD i 0) (hp : alpha_is_lexical (a.take i)) :
alpha_is_lexical (a.take i ++ [a.getD i 0 - 1, 1] ++ a.drop (i + 1))anti_ramsey_numeric_coreIn LeanCombinatorics for TCS
For every integer n ≥ 22, 3^(n+1) · n^n · 2^(C(n,2)) < 3^(C(n,2)), where C(n,2)=n(n-1)/2.
theorem anti_ramsey_numeric_core (n : ℕ) (hn : 22 ≤ n) : 3 ^ (n + 1) * n ^ n * 2 ^ (n.choose 2) < 3 ^ (n.choose 2)
anti_ramsey_quadratic_grid_lower_bound_and_k3In LeanCombinatorics for TCS
For every integer n ≥ 3, the complete graph on (n - 1)^2 vertices admits a 3-edge-coloring in which every complete subgraph on n vertices contains at least one edge of each color, and the three-colored anti-Ramsey number of K_3 is equal to 4 (realized by K_4 admitting such a coloring and K_5 not admitting one).
theorem anti_ramsey_quadratic_grid_lower_bound_and_k3 :
(∀ n : ℕ, 3 ≤ n → has_three_colored_anti_ramsey ((n - 1) ^ 2) n) ∧
(has_three_colored_anti_ramsey 4 3 ∧ ¬ has_three_colored_anti_ramsey 5 3)
anti_ramsey_strict_improvement_fiveIn LeanCombinatorics for TCS
The n = 5 case: N = 19 > 16 admits a 3-colouring of K_19 whose every 5-subset sees all three colours.
theorem anti_ramsey_strict_improvement_five : ∃ N : ℕ, (5 - 1) ^ 2 < N ∧ has_three_colored_anti_ramsey N 5
anti_ramsey_strict_improvement_largeIn LeanCombinatorics for TCS
For every n ≥ 22 there is N > (n-1)^2 admitting a 3-edge-colouring of K_N whose every n-subset sees all three colours (witness N = (n-1)^2+1, via the probabilistic method).
theorem anti_ramsey_strict_improvement_large : ∀ n : ℕ, 22 ≤ n → ∃ N : ℕ, (n - 1) ^ 2 < N ∧ has_three_colored_anti_ramsey N n
anti_ramsey_strict_improvement_seven_to_twentyoneIn LeanCombinatorics for TCS
For each 7 ≤ n ≤ 21 there is N > (n-1)^2 admitting a 3-edge-colouring of K_N whose every n-subset sees all three colours.
theorem anti_ramsey_strict_improvement_seven_to_twentyone : ∀ n : ℕ, 7 ≤ n → n ≤ 21 → ∃ N : ℕ, (n - 1) ^ 2 < N ∧ has_three_colored_anti_ramsey N n
anti_ramsey_strict_improvement_sixIn LeanCombinatorics for TCS
The n = 6 case: N = 26 > 25 admits a 3-colouring of K_26 whose every 6-subset sees all three colours.
theorem anti_ramsey_strict_improvement_six : ∃ N : ℕ, (6 - 1) ^ 2 < N ∧ has_three_colored_anti_ramsey N 6
anti_ramsey_union_bound_numericIn LeanCombinatorics for TCS
For every n ≥ 22, 3 · C((n-1)^2+1, n) · 2^(C(n,2)) < 3^(C(n,2)) — the counting criterion at N = (n-1)^2+1.
theorem anti_ramsey_union_bound_numeric (n : ℕ) (hn : 22 ≤ n) : 3 * (((n - 1) ^ 2 + 1).choose n) * 2 ^ (n.choose 2) < 3 ^ (n.choose 2)
anti_ribbon_map_bij_onIn LeanCombinatorics for TCS
For any standard Young tableau T on a finite diagram D, anti_ribbon_map T is a bijection from standardization_block T onto the set of semi-standard fillings of anti_ribbon_diagram D.card (standard_young_tableau_descent_set T).
theorem anti_ribbon_map_bij_on
(D : Finset (ℕ × ℕ)) (T : StandardYoungTableau D) :
Set.BijOn (anti_ribbon_map T) (standardization_block T)
{ M' | is_semistandard (anti_ribbon_diagram D.card (standard_young_tableau_descent_set T)) M' }anti_ribbon_map_bounds_iffIn LeanCombinatorics for TCS
For any standard Young tableau T on a finite diagram D and any filling M : D → ℕ, all entries of anti_ribbon_map T M lie in {1, ..., m} if and only if all entries of M lie in {1, ..., m}.
theorem anti_ribbon_map_bounds_iff
{D : Finset (ℕ × ℕ)} (T : StandardYoungTableau D) (M : D → ℕ) (m : ℕ) :
(∀ p : anti_ribbon_diagram D.card (standard_young_tableau_descent_set T),
1 ≤ anti_ribbon_map T M p ∧ anti_ribbon_map T M p ≤ m) ↔
(∀ u : D, 1 ≤ M u ∧ M u ≤ m)anti_ribbon_map_ssyt_bounded_bij_onIn LeanCombinatorics for TCS
For any finite corner-crossed diagram D : Finset (ℕ × ℕ), any standard Young tableau T on D, and any bound m : ℕ, the anti-ribbon map anti_ribbon_map T is a bijection from the intersection of the bounded semi-standard fillings ssyt_bounded D m with the standardization block standardization_block T onto the bounded semi-standard fillings ssyt_bounded (anti_ribbon_diagram D.card (standard_young_tableau_descent_set T)) m of the anti-ribbon diagram.
theorem anti_ribbon_map_ssyt_bounded_bij_on
(D : Finset (ℕ × ℕ)) (hD : is_corner_crossed D)
(T : StandardYoungTableau D) (m : ℕ) :
Set.BijOn (anti_ribbon_map T)
{ M : D → ℕ | M ∈ ssyt_bounded D m ∧ M ∈ standardization_block T }
{ M' : (anti_ribbon_diagram D.card (standard_young_tableau_descent_set T)) → ℕ |
M' ∈ ssyt_bounded (anti_ribbon_diagram D.card (standard_young_tableau_descent_set T)) m }anti_ribbon_map_tableau_entriesIn LeanCombinatorics for TCS
For any standard Young tableau T on D and any filling M in standardization_block T, the anti-ribbon filling anti_ribbon_map T M has the same multiset of entries as M.
theorem anti_ribbon_map_tableau_entries
(D : Finset (ℕ × ℕ)) (T : StandardYoungTableau D)
(M : D → ℕ) (hM : M ∈ standardization_block T) :
tableau_entries (anti_ribbon_map T M) = tableau_entries Manti_ribbon_schur_expansionIn LeanCombinatorics for TCS
Let D be a finite corner-crossed diagram and let m ≥ 1. Then the Schur polynomial schur_polynomial D m expands as the sum over all standard Young tableaux T : StandardYoungTableau D of the anti-ribbon Schur polynomials anti_ribbon_schur_polynomial D.card (standard_young_tableau_descent_set T) m.
open scoped BigOperators in
theorem anti_ribbon_schur_expansion
(D : Finset (ℕ × ℕ)) (hD : is_corner_crossed D) (m : ℕ) (hm : 1 ≤ m) :
schur_polynomial D m =
∑ T : StandardYoungTableau D,
anti_ribbon_schur_polynomial D.card (standard_young_tableau_descent_set T) manti_ribbon_ssyt_decompositionIn LeanCombinatorics for TCS
For any corner-crossed finite diagram D : Finset (ℕ × ℕ), a filling M : D → ℕ is semi-standard (is_semistandard D M) if and only if there exists a unique standard Young tableau T on D such that M ∈ standardization_block T. Furthermore, for every standard Young tableau T on D, the map anti_ribbon_map T is a bijection from standardization_block T onto the set of semi-standard fillings of anti_ribbon_diagram D.card (standard_young_tableau_descent_set T), and preserves the multiset of entries (tableau_entries).
theorem anti_ribbon_ssyt_decomposition
(D : Finset (ℕ × ℕ)) (hD : is_corner_crossed D) :
(∀ M : D → ℕ, is_semistandard D M ↔ ∃! T : StandardYoungTableau D, M ∈ standardization_block T) ∧
(∀ (T : StandardYoungTableau D),
Set.BijOn (anti_ribbon_map T) (standardization_block T)
{ M' | is_semistandard (anti_ribbon_diagram D.card (standard_young_tableau_descent_set T)) M' } ∧
∀ M ∈ standardization_block T,
tableau_entries (anti_ribbon_map T M) = tableau_entries M)ap_tile_step_card_eqIn LeanCombinatorics for TCS
Given a natural number k with [NeZero k] and a finite subset A : Finset ℕ, if is_ap_tile_step k A holds, then the cardinality of A is k.
theorem ap_tile_step_card_eq (k : ℕ) [NeZero k] (A : Finset ℕ)
(h : is_ap_tile_step k A) : A.card = kap_tile_step_class_countsIn LeanCombinatorics for TCS
For positive integers k ≤ n, exactly n - k * (n / k) residue classes modulo k have n / k + 1 representatives in {1, ..., n}, and the remaining k - (n - k * (n / k)) classes have n / k representatives.
theorem ap_tile_step_class_counts (n k : ℕ) [NeZero k] (hk : k ≤ n) :
((Finset.univ : Finset (ZMod k)).filter (fun c =>
((Finset.Icc 1 n).filter (fun (a : ℕ) => (a : ZMod k) = c)).card = n / k + 1)).card = n - k * (n / k) ∧
((Finset.univ : Finset (ZMod k)).filter (fun c =>
((Finset.Icc 1 n).filter (fun (a : ℕ) => (a : ZMod k) = c)).card = n / k)).card = k - (n - k * (n / k))ap_tile_step_count_fixedIn LeanCombinatorics for TCS
For natural numbers n and k with [NeZero k] and k ≤ n, the number of subsets A of Finset.Icc 1 n satisfying is_ap_tile_step k A is (n / k)^(k - (n - k * (n / k))) * (n / k + 1)^(n - k * (n / k)).
theorem ap_tile_step_count_fixed (n k : ℕ) [NeZero k] (hk : k ≤ n) :
open scoped Classical in
(((Finset.Icc 1 n).powerset).filter (fun A => is_ap_tile_step k A)).card =
(n / k) ^ (k - (n - k * (n / k))) * (n / k + 1) ^ (n - k * (n / k))as_dt_chessboard_covering_lower_boundIn LeanCombinatorics for TCS
Let n ≥ 3 be a natural number. For any natural numbers p and q, any p ascending shallow paths and q descending steep paths whose traces together cover chessboard n satisfy p + q ≥ n - 1.
theorem as_dt_chessboard_covering_lower_bound (n : ℕ) (hn : 3 ≤ n)
(p q : ℕ) (as_paths : Fin p → (ℤ → ℤ)) (dt_paths : Fin q → (ℤ → ℤ))
(has : ∀ i, IsASPath (as_paths i)) (hdt : ∀ j, IsASPath (dt_paths j))
(hcover : chessboard n ⊆ (Finset.univ.biUnion fun i => asTrace n (as_paths i)) ∪
(Finset.univ.biUnion fun j => dtTrace n (dt_paths j))) :
n - 1 ≤ p + qavg_pairwise_hamming_dist_eq_half_n_sub_sum_biasIn LeanCombinatorics for TCS
For any finite $F \subseteq (\mathrm{Fin}\ n \to \mathrm{Bool})$ with $|F| \ne 0$, writing $p_i = \#\{x \in F : x(i) = \mathrm{true}\}$ and $M = |F|$, the average pairwise Hamming distance satisfies $\mathrm{avg}(F) = \frac{1}{2}\left(n - \sum_i \left(\frac{M - 2p_i}{M}\right)^2\right)$.
theorem avg_pairwise_hamming_dist_eq_half_n_sub_sum_bias
(n : ℕ) (F : Finset (Fin n → Bool)) (hF : F.card ≠ 0) :
avg_pairwise_hamming_dist F =
((n : ℝ) - ∑ i : Fin n,
(((F.card : ℝ) - 2 * ((F.filter (fun x => x i = true)).card : ℝ)) ^ 2 / (F.card : ℝ) ^ 2)) / 2avg_pairwise_hamming_dist_eq_sum_coordinate_marginalIn LeanCombinatorics for TCS
For any natural number n and any finite subset F ⊆ (Fin n → Bool), the average pairwise Hamming distance of F is equal to the sum over all coordinates i : Fin n of 2 * |{x ∈ F | x(i) = true}| * |{x ∈ F | x(i) = false}| / |F|^2.
theorem avg_pairwise_hamming_dist_eq_sum_coordinate_marginal
(n : ℕ) (F : Finset (Fin n → Bool)) :
avg_pairwise_hamming_dist F =
∑ i : Fin n, (2 : ℝ) * (F.filter (fun x => x i = true)).card * (F.filter (fun x => x i = false)).card / (F.card : ℝ)^2avg_pairwise_hamming_dist_ge_half_of_sum_bias_sq_leIn LeanCombinatorics for TCS
If $F \subseteq (\mathrm{Fin}\ n \to \mathrm{Bool})$ is nonempty with coordinate biases $b_i = 1 - 2p_i/|F|$ satisfying $\sum_i b_i^2 \le n - m$, then $\mathrm{avg}(F) \ge m/2$.
theorem avg_pairwise_hamming_dist_ge_half_of_sum_bias_sq_le
(n m : ℕ) (F : Finset (Fin n → Bool)) (hF : F.card ≠ 0)
(h : ∑ i : Fin n,
((1 : ℝ) - 2 * ((F.filter (fun x => x i = true)).card : ℝ) / (F.card : ℝ)) ^ 2 ≤ (n : ℝ) - m) :
(m : ℝ) / 2 ≤ avg_pairwise_hamming_dist Favg_pairwise_hamming_dist_of_card_twoIn LeanCombinatorics for TCS
Let $F \subseteq (\mathrm{Fin}\ n \to \mathrm{Bool})$ have exactly two points. Then $\mathrm{avg}(F) \ge 1/2$, with equality if and only if $F$ is a $1$-dimensional subcube, i.e. its two points differ in exactly one coordinate.
theorem avg_pairwise_hamming_dist_of_card_two
(n : ℕ) (F : Finset (Fin n → Bool)) (hF : F.card = 2) :
(1 : ℝ) / 2 ≤ avg_pairwise_hamming_dist F ∧
(avg_pairwise_hamming_dist F = 1 / 2 ↔ is_subcube 1 F)avg_pairwise_hamming_dist_of_is_subcubeIn LeanCombinatorics for TCS
If $F \subseteq (\mathrm{Fin}\ n \to \mathrm{Bool})$ is an $m$-dimensional subcube and $|F| = 2^m$, then $\mathrm{avg}(F) = m/2$. In particular this is the achievability direction of the target at every density $2^{m-n}$.
theorem avg_pairwise_hamming_dist_of_is_subcube
(n m : ℕ) (F : Finset (Fin n → Bool)) (hcube : is_subcube m F) (hcard : F.card = 2 ^ m) :
avg_pairwise_hamming_dist F = (m : ℝ) / 2b_zero_no_zero_sum_sixIn LeanCombinatorics for TCS
Let C_0 be the subset of (Fin 6 → Fin 2) consisting of 0, the all-ones vector, and the standard basis vectors, and let B_0 be the subset of (Fin 7 → Fin 2) formed by extending each element of C_0 with 0 and with 1. Every 6-element subset of B_0 has nonzero sum.
theorem b_zero_no_zero_sum_six
(c_zero : Finset (Fin 6 → Fin 2))
(hc0 : c_zero = insert 0 (insert (fun _ => 1) (Finset.image (fun i : Fin 6 => Pi.single i (1 : Fin 2)) Finset.univ)))
(b_zero : Finset (Fin 7 → Fin 2))
(hb0 : b_zero = Finset.biUnion c_zero (fun c => {Fin.snoc c 0, Fin.snoc c 1}))
(Y : Finset (Fin 7 → Fin 2)) (hY : Y ⊆ b_zero)
(hcard : Y.card = 6) :
∑ y ∈ Y, y ≠ 0bh_dense_set_counting_lowerIn LeanCombinatorics for TCS
Lower bound at the checkpoints (paper (3.4)): for h ≥ 2, the counting function of A = ⋃_k S_k at the checkpoint M_k + D_k is at least (1/h - ε) (M_k + D_k)^{1/h} for infinitely many n; this is the "frequently" lower bound with constant 1/h.
open scoped Classical in
theorem bh_dense_set_counting_lower (h : ℕ) (h2 : 2 ≤ h) :
∀ ε : ℝ, 0 < ε → ∃ᶠ n : ℕ in Filter.atTop,
(1 / (h : ℝ) - ε) * (n : ℝ) ^ ((1 : ℝ) / (h : ℝ))
≤ (((Finset.Icc 1 n).filter (· ∈ bh_dense_set h)).card : ℝ)bh_dense_set_counting_upperIn LeanCombinatorics for TCS
Upper bound on the counting function (paper (3.6)): for h ≥ 2 and every ε > 0, all sufficiently large n satisfy A(n) ≤ (1/h + ε) n^{1/h} for A = ⋃_k S_k.
open scoped Classical in
theorem bh_dense_set_counting_upper (h : ℕ) (h2 : 2 ≤ h) :
∀ ε : ℝ, 0 < ε → ∀ᶠ n : ℕ in Filter.atTop,
(((Finset.Icc 1 n).filter (· ∈ bh_dense_set h)).card : ℝ)
≤ (1 / (h : ℝ) + ε) * (n : ℝ) ^ ((1 : ℝ) / (h : ℝ))bh_dense_set_density_eqIn LeanCombinatorics for TCS
Glue: the two counting bounds imply bh_upper_density h (bh_dense_set h) = 1/h, and together with the structural facts this yields the target existence statement.
theorem bh_dense_set_density_eq (h : ℕ) (h2 : 2 ≤ h) :
bh_upper_density h (bh_dense_set h) = (1 : ℝ) / (h : ℝ)bh_dense_set_is_bhIn LeanCombinatorics for TCS
The constructed set A = ⋃_k S_k is infinite and is a B_h set, for every h ≥ 2.
theorem bh_dense_set_is_bh (h : ℕ) (h2 : 2 ≤ h) :
(bh_dense_set h).Infinite ∧ is_bh h (bh_dense_set h)bh_dense_stage_card_smallIn LeanCombinatorics for TCS
Negligibility of accumulated elements (paper (3.5)): for h ≥ 2 and every ε > 0, for all sufficiently large k, the number of elements in the stage S_k is at most ε q_k, where q_k is the prime chosen for the next block.
theorem bh_dense_stage_card_small (h : ℕ) (h2 : 2 ≤ h) :
∀ ε : ℝ, 0 < ε → ∀ᶠ k : ℕ in Filter.atTop,
((bh_dense_stage h k).card : ℝ)
≤ ε * ((bh_dense_prime h ((bh_dense_stage h k).sup id) : ℝ))bh_dense_stage_is_bhIn LeanCombinatorics for TCS
Correctness of the recursion: for h ≥ 2 every stage S_k is a finite B_h set, and the stages are nested with strictly increasing maxima.
theorem bh_dense_stage_is_bh (h : ℕ) (h2 : 2 ≤ h) (k : ℕ) :
is_bh h ((bh_dense_stage h k : Finset ℕ) : Set ℕ)bh_dense_stage_succ_geometryIn LeanCombinatorics for TCS
Stage geometry: for h ≥ 2 and any k, put n = max S_k, q = bh_dense_prime h n, D = h^(h-1) q^h, M = (h-1)D + q. Then every element of S_k is ≤ n, every element of the newly appended block M + B_q lies strictly between n and M + D, the stage grows by exactly q elements, and the new maximum exceeds n. Consequently the stages are nested with sup S_k strictly increasing.
theorem bh_dense_stage_succ_geometry (h k : ℕ) (h2 : 2 ≤ h) :
(∀ x ∈ bh_dense_stage h k, x ≤ (bh_dense_stage h k).sup id) ∧
(let q := bh_dense_prime h ((bh_dense_stage h k).sup id)
let D := h ^ (h - 1) * q ^ h
let M := (h - 1) * D + q
((bh_dense_stage h k).sup id < M ∧ M + D = M + D ∧
(∀ x ∈ (moment_block h q).image (fun y => M + y), (bh_dense_stage h k).sup id < x ∧ x ≤ M + D) ∧
(bh_dense_stage h (k + 1)).card = (bh_dense_stage h k).card + q ∧
(bh_dense_stage h k).sup id < (bh_dense_stage h (k + 1)).sup id))bh_set_extend_by_blockIn LeanCombinatorics for TCS
Extension lemma (paper Lemma 3.1): let h ≥ 2, let S ⊆ [1,n] and B ⊆ [0,D) be finite B_h sets, suppose q > h·n and suppose distinct r-element multisets from B with 1 ≤ r ≤ h-1 have sums differing by at least q in absolute value. Then S ∪ ((h-1)D + q + B) is again a B_h set.
theorem bh_set_extend_by_block (h n D q : ℕ) (h2 : 2 ≤ h) (S B : Finset ℕ)
(hSne : S.Nonempty) (hS1 : ∀ x ∈ S, 1 ≤ x) (hSn : ∀ x ∈ S, x ≤ n)
(hBne : B.Nonempty) (hB0 : ∀ x ∈ B, x < D)
(hSbh : is_bh h (S : Set ℕ)) (hBbh : is_bh h (B : Set ℕ))
(hsep : ∀ (r : ℕ), 1 ≤ r → r ≤ h - 1 → ∀ m m' : Multiset ℕ,
(∀ x ∈ m, x ∈ B) → (∀ x ∈ m', x ∈ B) → m.card = r → m'.card = r → m ≠ m' →
q ≤ ((m.sum : ℤ) - (m'.sum : ℤ)).natAbs)
(hqn : h * n < q) :
is_bh h (((S ∪ B.image (fun x => (h - 1) * D + q + x)) : Finset ℕ) : Set ℕ)bijection_reduced_latin_squares_perfect_setsIn LeanCombinatorics for TCS
For every natural number n with n ≥ 2, the map reduced_latin_square_to_perfect_set is a bijection (in the sense of Set.BijOn) from the set of reduced Latin squares of order n onto the set of perfect sets of order n.
theorem bijection_reduced_latin_squares_perfect_sets (n : ℕ) [NeZero n] (hn : 2 ≤ n) :
Set.BijOn (reduced_latin_square_to_perfect_set (n := n))
{R | is_reduced_latin_square R}
{S | is_perfect_set n S}binary_tree_height_le_card_labelsIn LeanCombinatorics for TCS
For any type α with decidable equality and any binary tree t : BinaryTree α, if binary_tree_no_ancestor_descendant_repeat t holds, then t.height ≤ (binary_tree_labels t).card.
theorem binary_tree_height_le_card_labels {α : Type*} [DecidableEq α] (t : BinaryTree α)
(h : binary_tree_no_ancestor_descendant_repeat t) :
t.height ≤ (binary_tree_labels t).cardbinary_tree_num_nodes_le_pow_heightIn LeanCombinatorics for TCS
For any type α and any binary tree t : BinaryTree α, the number of nodes t.numNodes is at most 2 ^ t.height - 1.
theorem binary_tree_num_nodes_le_pow_height {α : Type*} (t : BinaryTree α) :
t.numNodes ≤ 2 ^ t.height - 1bipartite_common_neighbors_sum_eqIn LeanCombinatorics for TCS
Let G be a bipartite simple graph on L ⊕ R with edges only between L and R. Then the sum over all pairs (u, v) of distinct vertices in L of the number of common neighbors of u and v in G equals the sum over w in R of deg(w) * (deg(w) - 1).
theorem bipartite_common_neighbors_sum_eq
{L R : Type*} [Fintype L] [Fintype R] [DecidableEq L] [DecidableEq R]
(G : SimpleGraph (L ⊕ R)) [DecidableRel G.Adj]
(hG : G ≤ completeBipartiteGraph L R) :
(∑ p ∈ (Finset.univ : Finset L).offDiag,
Fintype.card (G.commonNeighbors (Sum.inl p.1) (Sum.inl p.2))) =
∑ w : R, G.degree (Sum.inr w) * (G.degree (Sum.inr w) - 1)bipartite_four_cycle_tuples_card_eq_four_mul_copyCountIn LeanCombinatorics for TCS
The number of 4-tuples ((u, v), (x, y)) in (L × L) × (R × R) with u ≠ v, x ≠ y, and all 4 edges between {u, v} and {x, y} present in G equals 4 times the number of subgraphs of G isomorphic to cycleGraph 4.
theorem bipartite_four_cycle_tuples_card_eq_four_mul_copyCount
{L R : Type*} [Fintype L] [Fintype R] [DecidableEq L] [DecidableEq R]
(G : SimpleGraph (L ⊕ R)) [DecidableRel G.Adj]
(hG : G ≤ completeBipartiteGraph L R) :
(Finset.filter (fun p : (L × L) × (R × R) =>
p.1.1 ≠ p.1.2 ∧ p.2.1 ≠ p.2.2 ∧
G.Adj (Sum.inl p.1.1) (Sum.inr p.2.1) ∧
G.Adj (Sum.inl p.1.1) (Sum.inr p.2.2) ∧
G.Adj (Sum.inl p.1.2) (Sum.inr p.2.1) ∧
G.Adj (Sum.inl p.1.2) (Sum.inr p.2.2))
(Finset.univ : Finset ((L × L) × (R × R)))).card =
4 * G.copyCount (SimpleGraph.cycleGraph 4)bipartite_four_cycle_tuples_card_eq_sum_common_neighborsIn LeanCombinatorics for TCS
The number of 4-tuples ((u, v), (x, y)) in (L × L) × (R × R) with u ≠ v, x ≠ y, and all 4 edges between {u, v} and {x, y} present in G equals the sum over distinct pairs (u, v) in L of c(u, v) * (c(u, v) - 1), where c(u, v) is the number of common neighbors of u and v in G.
theorem bipartite_four_cycle_tuples_card_eq_sum_common_neighbors
{L R : Type*} [Fintype L] [Fintype R] [DecidableEq L] [DecidableEq R]
(G : SimpleGraph (L ⊕ R)) [DecidableRel G.Adj]
(hG : G ≤ completeBipartiteGraph L R) :
(Finset.filter (fun p : (L × L) × (R × R) =>
p.1.1 ≠ p.1.2 ∧ p.2.1 ≠ p.2.2 ∧
G.Adj (Sum.inl p.1.1) (Sum.inr p.2.1) ∧
G.Adj (Sum.inl p.1.1) (Sum.inr p.2.2) ∧
G.Adj (Sum.inl p.1.2) (Sum.inr p.2.1) ∧
G.Adj (Sum.inl p.1.2) (Sum.inr p.2.2))
(Finset.univ : Finset ((L × L) × (R × R)))).card =
∑ p ∈ (Finset.univ : Finset L).offDiag,
Fintype.card (G.commonNeighbors (Sum.inl p.1) (Sum.inl p.2)) *
(Fintype.card (G.commonNeighbors (Sum.inl p.1) (Sum.inl p.2)) - 1)bipartite_four_cycles_count_eq_sum_common_neighborsIn LeanCombinatorics for TCS
Let G be a bipartite simple graph on L ⊕ R with edges only between L and R. Then four times the number of subgraphs of G isomorphic to the 4-cycle cycleGraph 4 equals the sum over all pairs (u, v) of distinct vertices in L of the product c(u, v) * (c(u, v) - 1), where c(u, v) is the number of common neighbors of u and v in G.
theorem bipartite_four_cycles_count_eq_sum_common_neighbors
{L R : Type*} [Fintype L] [Fintype R] [DecidableEq L] [DecidableEq R]
(G : SimpleGraph (L ⊕ R)) [DecidableRel G.Adj]
(hG : G ≤ completeBipartiteGraph L R) :
4 * G.copyCount (SimpleGraph.cycleGraph 4) =
∑ p ∈ (Finset.univ : Finset L).offDiag,
Fintype.card (G.commonNeighbors (Sum.inl p.1) (Sum.inl p.2)) *
(Fintype.card (G.commonNeighbors (Sum.inl p.1) (Sum.inl p.2)) - 1)bipartite_four_cycles_lower_boundIn LeanCombinatorics for TCS
Let G be a bipartite simple graph on L ⊕ R with edges only between L and R, where |L| = a ≥ 2, |R| = b ≥ 2, and m is the number of edges in G. If m ≥ 2 * (a * Real.sqrt b + b * Real.sqrt a), then the number of subgraphs of G isomorphic to the 4-cycle cycleGraph 4 is at least m^4 / (32 * a^2 * b^2).
theorem bipartite_four_cycles_lower_bound
{L R : Type*} [Fintype L] [Fintype R] [DecidableEq L] [DecidableEq R]
(G : SimpleGraph (L ⊕ R)) [DecidableRel G.Adj]
(hG : G ≤ completeBipartiteGraph L R)
(ha : 2 ≤ Fintype.card L) (hb : 2 ≤ Fintype.card R)
(hm : 2 * ((Fintype.card L : ℝ) * Real.sqrt (Fintype.card R) +
(Fintype.card R : ℝ) * Real.sqrt (Fintype.card L)) ≤ (G.edgeFinset.card : ℝ)) :
((G.edgeFinset.card : ℝ) ^ 4) /
(32 * (Fintype.card L : ℝ) ^ 2 * (Fintype.card R : ℝ) ^ 2) ≤
(G.copyCount (SimpleGraph.cycleGraph 4) : ℝ)bipartite_regular_fibre_perfect_matchingIn LeanCombinatorics for TCS
A d-regular bipartite multigraph, in fibre form, has a perfect matching: if d ≥ 1 and every fibre of f and of g is either empty or of size exactly d, then there is a finite set S of edges which is injective on f-fibres and on g-fibres and which meets every occurring fibre of f, and every occurring fibre of g, exactly once.
theorem bipartite_regular_fibre_perfect_matching {α : Type*} [Fintype α] (f g : α → ℕ) (d : ℕ)
(hd : 1 ≤ d)
(hf : ∀ γ : ℕ, {e | f e = γ}.ncard = d ∨ {e | f e = γ}.ncard = 0)
(hg : ∀ γ : ℕ, {e | g e = γ}.ncard = d ∨ {e | g e = γ}.ncard = 0) :
∃ S : Finset α,
(∀ e₁ ∈ S, ∀ e₂ ∈ S, f e₁ = f e₂ → e₁ = e₂) ∧
(∀ e₁ ∈ S, ∀ e₂ ∈ S, g e₁ = g e₂ → e₁ = e₂) ∧
(∀ e : α, ∃ e' ∈ S, f e' = f e) ∧
(∀ e : α, ∃ e' ∈ S, g e' = g e)bipartite_sum_degrees_right_eq_card_edgesIn LeanCombinatorics for TCS
Let G be a bipartite simple graph on L ⊕ R with edges only between L and R. Then the sum over all w in R of the degree of w in G equals the number of edges in G.
theorem bipartite_sum_degrees_right_eq_card_edges
{L R : Type*} [Fintype L] [Fintype R] [DecidableEq L] [DecidableEq R]
(G : SimpleGraph (L ⊕ R)) [DecidableRel G.Adj]
(hG : G ≤ completeBipartiteGraph L R) :
(∑ w : R, G.degree (Sum.inr w)) = G.edgeFinset.cardbitword_rotate_fixed_imp_constantIn LeanCombinatorics for TCS
For prime n, if an n-bit word x is fixed by a nontrivial rotation (0<r<n) then x is constant (all zeros or all ones); equivalently every nonconstant n-bit word has exactly n distinct rotations.
theorem bitword_rotate_fixed_imp_constant (n x r : ℕ) (hn : n.Prime) (hx : x < 2 ^ n) (hr0 : 0 < r) (hrn : r < n) (hfix : (bitword_rotate n)^[r] x = x) : x = 0 ∨ x = 2 ^ n - 1
bitword_rotate_iterate_testBitIn LeanCombinatorics for TCS
Bit j of the r-fold rotation of an n-bit word x is bit (j+n−r mod n) of x, for r ≤ n and j < n.
theorem bitword_rotate_iterate_testBit (n x r j : ℕ) (hx : x < 2 ^ n) (hr : r ≤ n) (hj : j < n) : ((bitword_rotate n)^[r] x).testBit j = x.testBit ((j + n - r) % n)
bitword_rotate_ltIn LeanCombinatorics for TCS
Rotating an n-bit word (n ≥ 1) by one position keeps it an n-bit word.
theorem bitword_rotate_lt (n x : ℕ) (hn : 1 ≤ n) (hx : x < 2 ^ n) : bitword_rotate n x < 2 ^ n
bitword_rotate_right_one_xor_one_rotate_leftIn LeanCombinatorics for TCS
For an odd n-bit word x (n ≥ 2), rotating right once, flipping the lowest bit, and rotating left once yields x XOR 2.
theorem bitword_rotate_right_one_xor_one_rotate_left (n x : ℕ) (hn : 2 ≤ n)
(hx : x < 2 ^ n) (hxodd : x % 2 = 1) :
bitword_rotate n (((bitword_rotate n)^[n - 1] x) ^^^ 1) = x ^^^ 2bitword_rotate_testBitIn LeanCombinatorics for TCS
Bit j (j<n) of the rotation of an n-bit word x is bit (j+n−1 mod n) of x.
theorem bitword_rotate_testBit (n x j : ℕ) (hx : x < 2 ^ n) (hj : j < n) : (bitword_rotate n x).testBit j = x.testBit ((j + n - 1) % n)
bitword_rotate_two_powIn LeanCombinatorics for TCS
Rotating 2^k (k < n) yields 2^k' for some k' < n.
theorem bitword_rotate_two_pow (n k : ℕ) (hn : 1 ≤ n) (hk : k < n) : ∃ k' < n, bitword_rotate n (2 ^ k) = 2 ^ k'
bitword_rotate_xorIn LeanCombinatorics for TCS
For n-bit words x,y, rotation of (x xor y) equals (rotation of x) xor (rotation of y).
theorem bitword_rotate_xor (n x y : ℕ) (hx : x < 2 ^ n) (hy : y < 2 ^ n) : bitword_rotate n (x ^^^ y) = bitword_rotate n x ^^^ bitword_rotate n y
block_latin_filling_is_latinIn LeanCombinatorics for TCS
For a Young diagram $\mu$ with $w = \text{young\_diagram\_part\_gcd}(\mu) > 0$, if the maximum multiplicity of any part length in $\mu$ is at most $w$, then the block filling with width $w$ is a Latin tableau of shape $\mu$ and type $\mu'$, satisfying is_latin_tableau μ (block_latin_filling μ w).
theorem block_latin_filling_is_latin (μ : YoungDiagram) (w : ℕ)
(hw : w = young_diagram_part_gcd μ) (hw_pos : 0 < w)
(hm : young_diagram_max_multiplicity μ ≤ w) :
is_latin_tableau μ (block_latin_filling μ w)book_facets_cohen_macaulayIn LeanCombinatorics for TCS
Let a < b in a linearly ordered vertex set and let C be a nonempty set of vertices all above b. Then the book complex with spine {a,b} and pages {a,b,c} (c in C) is Cohen-Macaulay over every field: it is pure of dimension 2, its 1-skeleton is connected, the links of a and of b are stars, the link of every c is a single edge, and the complex is contractible so H_1 = 0.
theorem book_facets_cohen_macaulay {V : Type*} [DecidableEq V] [LinearOrder V] (a b : V)
(C : Finset V) (k : Type*) [Field k] (hab : a < b) (hC : ∀ c ∈ C, b < c)
(hne : C.Nonempty) :
is_cohen_macaulay_two_complex (C.image (fun c => ({a, b, c} : Finset V))) kbook_facets_partitionableIn LeanCombinatorics for TCS
The book complex with spine {a,b} and pages {a,b,c} for c in C (a != b and no c in C equal to a or b) is partitionable: the interval of one page is the whole boolean lattice on that page, and every other page contributes only the interval from its private vertex c up to itself.
theorem book_facets_partitionable {V : Type*} [DecidableEq V] (a b : V) (C : Finset V)
(hab : a ≠ b) (hC : ∀ c ∈ C, c ≠ a ∧ c ≠ b) :
is_partitionable_two_complex (C.image (fun c => ({a, b, c} : Finset V)))boolean_affine_restriction_degree_le_finrankIn LeanCombinatorics for TCS
For any natural number n, Boolean function p : (Fin n → ZMod 2) → ZMod 2, vector a : Fin n → ZMod 2, and subspace U : Submodule (ZMod 2) (Fin n → ZMod 2), the degree booleanDegree (booleanAffineRestriction p a U) of the affine restriction is at most Module.finrank (ZMod 2) U.
theorem boolean_affine_restriction_degree_le_finrank {n : ℕ}
(p : (Fin n → ZMod 2) → ZMod 2) (a : Fin n → ZMod 2)
(U : Submodule (ZMod 2) (Fin n → ZMod 2)) :
booleanDegree (booleanAffineRestriction p a U) ≤ Module.finrank (ZMod 2) Uboolean_cube_dist_two_isoperimetricIn LeanCombinatorics for TCS
Let m, d be natural numbers such that 1 ≤ m and m ≤ d / 2, and let X : Finset (Fin d → Fin 2) be a finite subset satisfying X.card ≤ Nat.choose d m. Then boolean_cube_dist_two_pairs X ≤ 4 * m * d * X.card.
theorem boolean_cube_dist_two_isoperimetric (d m : ℕ) (hm : 1 ≤ m) (hmd : m ≤ d / 2)
(X : Finset (Fin d → Fin 2)) (hX : X.card ≤ Nat.choose d m) :
boolean_cube_dist_two_pairs X ≤ 4 * m * d * X.cardboolean_cube_dist_two_pairs_le_trivialIn LeanCombinatorics for TCS
For any dimension d : ℕ and any finite subset X : Finset (Fin d → Fin 2), the number of ordered pairs boolean_cube_dist_two_pairs X is at most Nat.choose d 2 * X.card.
theorem boolean_cube_dist_two_pairs_le_trivial (d : ℕ) (X : Finset (Fin d → Fin 2)) :
boolean_cube_dist_two_pairs X ≤ Nat.choose d 2 * X.cardboolean_cube_factorial_choose_lt_powIn LeanCombinatorics for TCS
For all natural numbers m and d such that 1 ≤ m and m ≤ d / 2, the product of m!, Nat.choose (2 * m) m, and Nat.choose d m is strictly less than 4^m * d^m.
theorem boolean_cube_factorial_choose_lt_pow (d m : ℕ) (hm : 1 ≤ m) (hmd : m ≤ d / 2) :
m.factorial * Nat.choose (2 * m) m * Nat.choose d m < 4 ^ m * d ^ mboolean_degree_le_dimIn LeanCombinatorics for TCS
For any natural number n and Boolean function p : (Fin n → ZMod 2) → ZMod 2, the degree booleanDegree p is at most n.
theorem boolean_degree_le_dim {n : ℕ} (p : (Fin n → ZMod 2) → ZMod 2) :
booleanDegree p ≤ nboolean_relation_capturing_add_selection_degree_geIn LeanCombinatorics for TCS
Let R ⊆ {0, 1}^k be a Boolean relation and b ∉ R an unsatisfying tuple. Let d_R(b) be the minimum total degree of an integer polynomial p vanishing on R with p(b) ≠ 0, and s_R(b) the minimum total degree of an integer polynomial q with q(b) ≠ 0 and q(a) = 0 for all a ∉ R with a ≠ b. Then k ≤ d_R(b) + s_R(b).
theorem boolean_relation_capturing_add_selection_degree_ge
{k : ℕ} (R : Set (Fin k → Bool)) (b : Fin k → Bool) (hb : b ∉ R) :
let dR := sInf {d : ℕ | ∃ p : MvPolynomial (Fin k) ℤ,
(∀ a ∈ R, MvPolynomial.eval (fun i => if a i then (1 : ℤ) else 0) p = 0) ∧
MvPolynomial.eval (fun i => if b i then (1 : ℤ) else 0) p ≠ 0 ∧
p.totalDegree = d}
let sR := sInf {d : ℕ | ∃ q : MvPolynomial (Fin k) ℤ,
MvPolynomial.eval (fun i => if b i then (1 : ℤ) else 0) q ≠ 0 ∧
(∀ a, a ∉ R → a ≠ b → MvPolynomial.eval (fun i => if a i then (1 : ℤ) else 0) q = 0) ∧
q.totalDegree = d}
k ≤ dR + sRboolean_relation_capturing_selection_dualityIn LeanCombinatorics for TCS
Let R ⊊ {0, 1}^k be a nonempty proper Boolean relation of arity k. For any unsatisfying tuple b ∉ R, let d_R(b) be the minimum total degree of an integer polynomial p vanishing on R with p(b) ≠ 0, and let s_R(b) be the minimum total degree of an integer polynomial q with q(b) ≠ 0 and q(a) = 0 for every unsatisfying tuple a ∉ R with a ≠ b. Then d_R(b) + s_R(b) = k for every b ∉ R. Furthermore, if d is the minimum total degree of an integer polynomial capturing R (vanishing on R and nonvanishing outside R), then there exists an unsatisfying tuple b ∉ R and an integer multilinear polynomial q of total degree k - d that selects b with q(b) > 0.
theorem boolean_relation_capturing_selection_duality
{k : ℕ} (R : Set (Fin k → Bool)) (hR_nonempty : R.Nonempty) (hR_proper : R ≠ Set.univ) :
let dR := fun (b : Fin k → Bool) => sInf {d : ℕ | ∃ p : MvPolynomial (Fin k) ℤ,
(∀ a ∈ R, MvPolynomial.eval (fun i => if a i then (1 : ℤ) else 0) p = 0) ∧
MvPolynomial.eval (fun i => if b i then (1 : ℤ) else 0) p ≠ 0 ∧
p.totalDegree = d}
let sR := fun (b : Fin k → Bool) => sInf {d : ℕ | ∃ q : MvPolynomial (Fin k) ℤ,
MvPolynomial.eval (fun i => if b i then (1 : ℤ) else 0) q ≠ 0 ∧
(∀ a, a ∉ R → a ≠ b → MvPolynomial.eval (fun i => if a i then (1 : ℤ) else 0) q = 0) ∧
q.totalDegree = d}
let degZ := sInf {d : ℕ | ∃ p : MvPolynomial (Fin k) ℤ,
(∀ a, MvPolynomial.eval (fun i => if a i then (1 : ℤ) else 0) p = 0 ↔ a ∈ R) ∧
p.totalDegree = d}
(∀ b, b ∉ R → dR b + sR b = k) ∧
(∃ b, b ∉ R ∧ ∃ q : MvPolynomial (Fin k) ℤ,
(∀ i : Fin k, q.degreeOf i ≤ 1) ∧
MvPolynomial.eval (fun i => if b i then (1 : ℤ) else 0) q > 0 ∧
(∀ a, a ∉ R → a ≠ b → MvPolynomial.eval (fun i => if a i then (1 : ℤ) else 0) q = 0) ∧
q.totalDegree = k - degZ)boolean_relation_selection_degree_leIn LeanCombinatorics for TCS
Let R ⊆ {0, 1}^k be a Boolean relation and b ∉ R an unsatisfying tuple. Let d_R(b) be the minimum total degree of an integer polynomial p vanishing on R with p(b) ≠ 0, and s_R(b) the minimum total degree of an integer polynomial q with q(b) ≠ 0 and q(a) = 0 for all a ∉ R with a ≠ b. Then s_R(b) ≤ k - d_R(b).
theorem boolean_relation_selection_degree_le
{k : ℕ} (R : Set (Fin k → Bool)) (b : Fin k → Bool) (hb : b ∉ R) :
let dR := sInf {d : ℕ | ∃ p : MvPolynomial (Fin k) ℤ,
(∀ a ∈ R, MvPolynomial.eval (fun i => if a i then (1 : ℤ) else 0) p = 0) ∧
MvPolynomial.eval (fun i => if b i then (1 : ℤ) else 0) p ≠ 0 ∧
p.totalDegree = d}
let sR := sInf {d : ℕ | ∃ q : MvPolynomial (Fin k) ℤ,
MvPolynomial.eval (fun i => if b i then (1 : ℤ) else 0) q ≠ 0 ∧
(∀ a, a ∉ R → a ≠ b → MvPolynomial.eval (fun i => if a i then (1 : ℤ) else 0) q = 0) ∧
q.totalDegree = d}
sR ≤ k - dRbox_prod_dist_eqIn LeanCombinatorics for TCS
In the Cartesian product P_k □ P_k of two paths on Fin k, the graph distance between (i,j) and (i',j') is |i-i'| + |j-j'|.
theorem box_prod_dist_eq (k : ℕ) (x y : Fin k × Fin k) :
((SimpleGraph.pathGraph k) □ (SimpleGraph.pathGraph k)).dist x y
= Nat.dist x.1.val y.1.val + Nat.dist x.2.val y.2.valbrgc_first_rank_word_ne_two_pow_sub_threeIn LeanCombinatorics for TCS
For length at least 3, no first-occurrence Gray rank encodes 2^n - 3: rotating 2^n - 3 left by n-2 positions yields a word beginning with 0 whose inverse Gray rank is strictly less than 2^{n-1}, whereas the rank of 2^n - 3 is at least 2^{n-1}, contradicting minimality.
theorem brgc_first_rank_word_ne_two_pow_sub_three (n t : ℕ) (hn : 3 ≤ n) (ht : brgc_necklace_first_rank n t) :
brgc_word t ≠ 2 ^ n - 3brgc_inverse_rotation_max_uniqueIn LeanCombinatorics for TCS
Two rotations in the same necklace that both maximize inverse Gray rank are equal.
theorem brgc_inverse_rotation_max_unique (n x y : ℕ) (hn : 2 ≤ n)
(hx : x < 2 ^ n) (hy : y < 2 ^ n)
(hrot : bitword_is_rotation n x y) (hrot' : bitword_is_rotation n y x)
(hmax_x : ∀ r < n, brgc_inverse n ((bitword_rotate n)^[r] x) ≤ brgc_inverse n x)
(hmax_y : ∀ r < n, brgc_inverse n ((bitword_rotate n)^[r] y) ≤ brgc_inverse n y) :
x = ybrgc_necklace_first_rank_pair_of_primeIn LeanCombinatorics for TCS
For prime length at least three, first-occurrence ranks come in the consecutive pairs 4k+1 and 4k+2.
theorem brgc_necklace_first_rank_pair_of_prime (n t : ℕ) (hn : n.Prime) (hn3 : 3 ≤ n) (ht : brgc_necklace_first_rank n t) : brgc_necklace_first_rank n (t ^^^ 3)
c_two_pow_seven_prod_c_six_zero_sum_constant_ge_thirty_threeIn LeanCombinatorics for TCS
The minimal integer k such that every multiset of size k over (Fin 7 → Fin 2) × ZMod 6 contains a submultiset of cardinality 6 summing to 0 is at least 33.
theorem c_two_pow_seven_prod_c_six_zero_sum_constant_ge_thirty_three :
33 ≤ erdos_ginzburg_ziv_constant ((Fin 7 → Fin 2) × ZMod 6) 6c_zero_even_zero_sum_eq_eightIn LeanCombinatorics for TCS
Let C_0 be the subset of (Fin 6 → Fin 2) consisting of 0, the all-ones vector, and the standard basis vectors. Every nonempty subset X of C_0 of even cardinality that sums to 0 has cardinality 8.
theorem c_zero_even_zero_sum_eq_eight
(c_zero : Finset (Fin 6 → Fin 2))
(hc0 : c_zero = insert 0 (insert (fun _ => 1) (Finset.image (fun i : Fin 6 => Pi.single i (1 : Fin 2)) Finset.univ)))
(X : Finset (Fin 6 → Fin 2)) (hX : X ⊆ c_zero)
(hne : X.Nonempty) (heven : Even X.card)
(hsum : ∑ x ∈ X, x = 0) :
X.card = 8canonical_partition_star_56_cardIn LeanCombinatorics for TCS
The canonical t-star T_{t+56,t} (partitions of t+56 with at least t ones) has exactly p(56) = 526823 members: deleting t of the ones is a bijection with the partitions of 56.
theorem canonical_partition_star_56_card (t : ℕ) (ht : 1 ≤ t) :
(canonical_partition_star (t + 56) t).card = 526823card_affine_planes_containing_lineIn LeanCombinatorics for TCS
For any prime p with [Fact p.Prime], point P : Fin 3 → ZMod p, and non-zero direction v : Fin 3 → ZMod p (with v ≠ 0), the cardinality of the Finset affine_planes_containing_line p (affine_line P v) is p + 1.
open Classical in
theorem card_affine_planes_containing_line
(p : ℕ) [Fact p.Prime] (P v : Fin 3 → ZMod p) (hv : v ≠ 0) :
(affine_planes_containing_line p (affine_line P v)).card = p + 1card_affine_planes_throughIn LeanCombinatorics for TCS
For any prime p with [Fact p.Prime] and point P : Fin 3 → ZMod p, the cardinality of the Finset affine_planes_through p P is p^2 + p + 1.
open Classical in
theorem card_affine_planes_through
(p : ℕ) [Fact p.Prime] (P : Fin 3 → ZMod p) :
(affine_planes_through p P).card = p ^ 2 + p + 1card_affine_planes_through_two_pointsIn LeanCombinatorics for TCS
For any prime p with [Fact p.Prime] and distinct points P, Q : Fin 3 → ZMod p with P ≠ Q, the number of planes in affine_planes_through p P containing Q (i.e. the cardinality of (affine_planes_through p P).filter (fun H => Q ∈ H)) is p + 1.
open Classical in
theorem card_affine_planes_through_two_points
(p : ℕ) [Fact p.Prime] (P Q : Fin 3 → ZMod p) (hPQ : P ≠ Q) :
((affine_planes_through p P).filter (fun H => Q ∈ H)).card = p + 1card_edgeSet_completeGraphIn LeanCombinatorics for TCS
The edge set of $K_n$ is the set of unordered non-diagonal pairs, so $K_n$ has $\binom{n}{2}$ edges; in particular $K_5$ has 10.
theorem card_edgeSet_completeGraph (n : ℕ) :
(SimpleGraph.completeGraph (Fin n)).edgeSet.ncard = n.choose 2card_filter_add_mem_geIn LeanCombinatorics for TCS
Let G be a finite abelian group of odd order, A ⊆ G, g ∉ Σ₃(A), and d ∈ A - A. Then the number of u ∈ A with u + d ∈ A is at least 3|A| - |G| - 6.
open scoped Pointwise in
theorem card_filter_add_mem_ge {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G]
{A : Finset G} {g d : G} (hodd : Fintype.card G % 2 = 1) (hg : g ∉ restrictedSumset A 3)
(hd : d ∈ A - A) :
3 * A.card ≤ (A.filter (fun u => u + d ∈ A)).card + Fintype.card G + 6card_filter_range_eq_min_of_injIn LeanCombinatorics for TCS
Let f : ℕ → ℕ be injective on {0,…,R−1} with 1 ≤ f j ≤ R there. Then the values f j (j < R) are exactly {1,…,R}, so exactly min(R, t) of the indices j < R satisfy f j ≤ t.
theorem card_filter_range_eq_min_of_inj {R t : ℕ} {f : ℕ → ℕ}
(hinj : ∀ j₁, j₁ < R → ∀ j₂, j₂ < R → f j₁ = f j₂ → j₁ = j₂)
(hlo : ∀ j, j < R → 1 ≤ f j) (hhi : ∀ j, j < R → f j ≤ R) :
((Finset.range R).filter (fun j => f j ≤ t)).card = min R tcard_filter_range_le_min_of_injIn LeanCombinatorics for TCS
Let f : ℕ → ℕ be injective on {0,…,R−1} and satisfy f j ≥ 1 there. Then for every t at most min(R, t) of the indices j < R have f j ≤ t: those values are distinct members of {1,…,t}, and there are only R indices in all.
theorem card_filter_range_le_min_of_inj {R t : ℕ} {f : ℕ → ℕ}
(hinj : ∀ j₁, j₁ < R → ∀ j₂, j₂ < R → f j₁ = f j₂ → j₁ = j₂)
(hlo : ∀ j, j < R → 1 ≤ f j) :
((Finset.range R).filter (fun j => f j ≤ t)).card ≤ min R tcard_inter_translate_neg_le_threeIn LeanCombinatorics for TCS
Let G be a finite abelian group of odd order, A a finite subset, g ∉ Σ₃(A) and a ∈ A. Then the intersection of the translate a - g + A with -A has at most 3 elements.
theorem card_inter_translate_neg_le_three {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G] {A : Finset G} {g a : G} (hodd : Fintype.card G % 2 = 1) (ha : a ∈ A) (hg : g ∉ restrictedSumset A 3) : ((A.image (fun s => a - g + s)) ∩ (A.image (fun t => -t))).card ≤ 3card_of_is_subcubeIn LeanCombinatorics for TCS
An $d$-dimensional subcube of $(\mathrm{Fin}\ n \to \mathrm{Bool})$ has exactly $2^d$ points.
theorem card_of_is_subcube
(n d : ℕ) (F : Finset (Fin n → Bool)) (h : is_subcube d F) :
F.card = 2 ^ dcayley_table_graph_central_involution_cliqueIn LeanCombinatorics for TCS
Let G be a group, z a central element with z² = 1 and z ≠ 1. Then for all g h : G the four cells (g,h), (g,hz), (gz,h), (gz,hz) of the Cayley table are pairwise adjacent in the Latin square graph.
theorem cayley_table_graph_central_involution_clique (G : Type*) [Group G] (z : G)
(hcen : ∀ g : G, z * g = g * z) (hsq : z * z = 1) (hne : z ≠ 1) (g h : G) :
(cayley_table_graph G).IsClique ({(g, h), (g, h * z), (g * z, h), (g * z, h * z)} : Set (G × G))cayley_table_graph_quaternion_adj_iffIn LeanCombinatorics for TCS
Two distinct quadrant cells (ε, i, j) and (ε', i', j') of the Cayley table of QuaternionGroup N are adjacent in the Latin square graph if and only if they share a row (ε = ε' and i = i'), a column (η = η' and j = j'), or a product symbol (quaternion_table_symbol N ε η i j = quaternion_table_symbol N ε' η' i' j').
theorem cayley_table_graph_quaternion_adj_iff (N : ℕ) (ε η ε' η' : Bool)
(i j i' j' : ZMod (2 * N)) :
(cayley_table_graph (QuaternionGroup N)).Adj
(quaternion_table_cell N ε η i j) (quaternion_table_cell N ε' η' i' j') ↔
quaternion_table_cell N ε η i j ≠ quaternion_table_cell N ε' η' i' j' ∧
((ε = ε' ∧ i = i') ∨ (η = η' ∧ j = j') ∨
quaternion_table_symbol N ε η i j = quaternion_table_symbol N ε' η' i' j')cayley_table_graph_quaternion_chromatic_number_of_colorableIn LeanCombinatorics for TCS
If the Cayley table graph of QuaternionGroup (2n+1) is (8n+6)-colourable then its chromatic number is exactly 8n+6, by the already-proved lower bound.
theorem cayley_table_graph_quaternion_chromatic_number_of_colorable (n : ℕ) (hn : 1 ≤ n)
(h : (cayley_table_graph (QuaternionGroup (2 * n + 1))).Colorable (8 * n + 6)) :
(cayley_table_graph (QuaternionGroup (2 * n + 1))).chromaticNumber = 8 * n + 6cayley_table_graph_quaternion_colorableIn LeanCombinatorics for TCS
For every integer n ≥ 1, the Cayley table Latin square graph of the generalized quaternion group QuaternionGroup (2 * n + 1) is (8 * n + 6)-colorable.
theorem cayley_table_graph_quaternion_colorable (n : ℕ) (hn : 1 ≤ n) :
(cayley_table_graph (QuaternionGroup (2 * n + 1))).Colorable (8 * n + 6)cayley_table_graph_quaternion_three_chromatic_number_geIn LeanCombinatorics for TCS
The chromatic number of the Cayley table graph of the generalized quaternion group QuaternionGroup 3 is at least 14.
theorem cayley_table_graph_quaternion_three_chromatic_number_ge :
(14 : ℕ∞) ≤ (cayley_table_graph (QuaternionGroup 3)).chromaticNumbercayley_table_graph_quaternion_three_colorable_fourteenIn LeanCombinatorics for TCS
The Cayley table Latin square graph of QuaternionGroup 3 is 14-colorable.
theorem cayley_table_graph_quaternion_three_colorable_fourteen :
(cayley_table_graph (QuaternionGroup 3)).Colorable 14cayley_table_graph_zmod_even_colorableIn LeanCombinatorics for TCS
For m ≥ 1 the Cayley table Latin square graph of the cyclic group ZMod (2m) (written multiplicatively) admits a proper colouring with 2m+2 colours, namely (i,j) ↦ (i + 2j mod (2m+1), [i = 2m−1]) into ZMod (2m+1) × Bool.
theorem cayley_table_graph_zmod_even_colorable (m : ℕ) (hm : 1 ≤ m) :
(cayley_table_graph (Multiplicative (ZMod (2 * m)))).Colorable (4 * m + 2)chain_energy_boundIn LeanCombinatorics for TCS
For any starting point s, direction v, and length m, the quadratic energy along the chain {s + kv : k < m} in direction v is at least (1/2)(m-1)‖v‖^4.
theorem chain_energy_bound (d : ℕ) (s v : EuclideanSpace ℝ (Fin d)) (m : ℕ) :
(1 / 2 : ℝ) * ((m : ℝ) - 1) * ‖v‖ ^ 4 ≤
∑ k ∈ Finset.range m, (inner (𝕜 := ℝ) (s + (k : ℝ) • v) v) ^ 2choose_three_cubic_boundIn LeanCombinatorics for TCS
For every natural number $r$, $6 \binom{r+3}{3} \leq (r+3)^3$.
theorem choose_three_cubic_bound (r : ℕ) :
6 * Nat.choose (r + 3) 3 ≤ (r + 3) ^ 3circulant_zmod8_degree_three_not_bipartiteIn LeanCombinatorics for TCS
No circulant graph on ZMod 8 in which the vertex 0 has degree 3 is bipartite; equivalently every 3-regular circulant graph on ZMod 8 contains an odd cycle (a triangle or a 5-cycle).
theorem circulant_zmod8_degree_three_not_bipartite (s : Set (ZMod 8)) [DecidablePred (· ∈ s)]
(hdeg : (SimpleGraph.circulantGraph s).degree 0 = 3) :
¬ (SimpleGraph.circulantGraph s).IsBipartiteclean_handshake_seq_edges_card_le_of_all_doubleIn LeanCombinatorics for TCS
When all handshakes in a clean sequence are double-gloved, the total number of distinct edges covered is at most $k(k-1) = 2\binom{k}{2}$.
theorem clean_handshake_seq_edges_card_le_of_all_double {V Γ : Type*} [DecidableEq V] [DecidableEq Γ] [Fintype Γ]
(seq : List (Handshake V Γ)) (hc : CleanHandshakeSeq seq (fun _ => (∅ : Set V)))
(hall : ∀ h ∈ seq, ∃ x a b y, h = Handshake.double x a b y) :
(seq.map handshake_edge).toFinset.card ≤ Fintype.card Γ * (Fintype.card Γ - 1)clean_handshake_seq_edges_card_le_of_all_singleIn LeanCombinatorics for TCS
When all handshakes in a clean sequence are single-gloved, the total number of distinct edges covered is at most $k = |\Gamma|$, which is strictly less than $\binom{k+2}{2}$ for all $k \ge 0$.
theorem clean_handshake_seq_edges_card_le_of_all_single {V Γ : Type*} [DecidableEq V] [DecidableEq Γ] [Fintype Γ]
(seq : List (Handshake V Γ)) (hc : CleanHandshakeSeq seq (fun _ => (∅ : Set V)))
(hall : ∀ h ∈ seq, ∃ x a y, h = Handshake.single x a y) :
(seq.map handshake_edge).toFinset.card ≤ Fintype.card Γclean_handshake_seq_edges_card_lt_choose_twoIn LeanCombinatorics for TCS
A clean handshake sequence over $k$ gloves starting from the empty contamination map covers strictly fewer than $\binom{k+2}{2}$ distinct edges.
theorem clean_handshake_seq_edges_card_lt_choose_two {V : Type*} [DecidableEq V] {Γ : Type*}
[DecidableEq Γ] [Fintype Γ] (seq : List (Handshake V Γ)) (hc : CleanHandshakeSeq seq (fun _ => (∅ : Set V))) :
(seq.map handshake_edge).toFinset.card < (Fintype.card Γ + 2) * (Fintype.card Γ + 1) / 2clean_handshake_seq_edges_card_lt_choose_two_of_card_le_threeIn LeanCombinatorics for TCS
For at most 3 gloves, any clean handshake sequence covers strictly fewer than $\binom{k+2}{2}$ edges.
theorem clean_handshake_seq_edges_card_lt_choose_two_of_card_le_three {V : Type*} [DecidableEq V] {Γ : Type*}
[DecidableEq Γ] [Fintype Γ] (hk : Fintype.card Γ ≤ 3)
(seq : List (Handshake V Γ)) (hc : CleanHandshakeSeq seq (fun _ => (∅ : Set V))) :
(seq.map handshake_edge).toFinset.card < (Fintype.card Γ + 2) * (Fintype.card Γ + 1) / 2cohen_macaulay_two_complex_cycle_is_boundaryIn LeanCombinatorics for TCS
Every 1-cycle over k supported on ordered edges of a Cohen-Macaulay 2-complex is the boundary of a 2-chain over k supported on ordered triangles.
theorem cohen_macaulay_two_complex_cycle_is_boundary
{V : Type*} [DecidableEq V] [LinearOrder V] (facets : Finset (Finset V)) (k : Type*) [Field k]
(hCM : is_cohen_macaulay_two_complex facets k)
(c : V × V → k)
(hsupp : ∀ e, e ∉ (facets.biUnion id ×ˢ facets.biUnion id).filter
(fun ⟨u, v⟩ => u < v ∧ {u, v} ∈ facets.biUnion Finset.powerset) → c e = 0)
(hcycle : ∀ x ∈ facets.biUnion id,
((facets.biUnion id ×ˢ facets.biUnion id).filter
(fun ⟨u, v⟩ => u < v ∧ {u, v} ∈ facets.biUnion Finset.powerset)).sum
(fun ⟨u, v⟩ => (if u = x then c (u, v) else 0) - (if v = x then c (u, v) else 0)) = 0) :
∃ b : V × V × V → k,
∀ e ∈ (facets.biUnion id ×ˢ facets.biUnion id).filter
(fun ⟨u, v⟩ => u < v ∧ {u, v} ∈ facets.biUnion Finset.powerset),
c e = ((facets.biUnion id ×ˢ (facets.biUnion id ×ˢ facets.biUnion id)).filter
(fun ⟨u, v, w⟩ => u < v ∧ v < w ∧ {u, v, w} ∈ facets)).sum
(fun ⟨u, v, w⟩ =>
(if e = (v, w) then b (u, v, w) else 0) -
(if e = (u, w) then b (u, v, w) else 0) +
(if e = (u, v) then b (u, v, w) else 0))cohen_macaulay_two_complex_face_card_le_threeIn LeanCombinatorics for TCS
Every face of a 2-dimensional Cohen-Macaulay complex has cardinality at most 3.
theorem cohen_macaulay_two_complex_face_card_le_three
{V : Type*} [DecidableEq V] [LinearOrder V] (facets : Finset (Finset V)) (k : Type*) [Field k]
(hCM : is_cohen_macaulay_two_complex facets k)
(τ : Finset V) (hτ : τ ∈ facets.biUnion Finset.powerset) :
τ.card ≤ 3cohen_macaulay_two_complex_link_reachableIn LeanCombinatorics for TCS
For every vertex in a 2-dimensional Cohen-Macaulay complex, its link graph is connected on vertices that share an edge with it.
theorem cohen_macaulay_two_complex_link_reachable
{V : Type*} [DecidableEq V] [LinearOrder V] (facets : Finset (Finset V)) (k : Type*) [Field k]
(hCM : is_cohen_macaulay_two_complex facets k)
(v : V) (hv : v ∈ facets.biUnion id) (u w : V)
(hu : {u, v} ∈ facets.biUnion Finset.powerset)
(hw : {w, v} ∈ facets.biUnion Finset.powerset)
(huv : u ≠ v) (hwv : w ≠ v) :
(SimpleGraph.fromRel (fun a b => {a, b, v} ∈ facets)).Reachable u wcohen_macaulay_two_complex_skel_reachableIn LeanCombinatorics for TCS
The 1-skeleton graph of a 2-dimensional Cohen-Macaulay complex is connected on its vertices.
theorem cohen_macaulay_two_complex_skel_reachable
{V : Type*} [DecidableEq V] [LinearOrder V] (facets : Finset (Finset V)) (k : Type*) [Field k]
(hCM : is_cohen_macaulay_two_complex facets k)
(u w : V) (hu : u ∈ facets.biUnion id) (hw : w ∈ facets.biUnion id) :
(SimpleGraph.fromRel (fun a b => ∃ σ ∈ facets, a ∈ σ ∧ b ∈ σ)).Reachable u wcolor_avoiding_cycle_pred_of_succIn LeanCombinatorics for TCS
For all t ≥ 4 and ℓ ≥ 4, if a t-edge-colouring of K_n contains an (ℓ+1)-cycle avoiding some colour j, then it contains an ℓ-cycle avoiding some colour j'.
theorem color_avoiding_cycle_pred_of_succ (t ℓ n : ℕ) (ht : 4 ≤ t) (hℓ : 4 ≤ ℓ)
(c : (SimpleGraph.completeGraph (Fin n)).edgeSet → Fin t)
(h : ∃ j : Fin t, (SimpleGraph.cycleGraph (ℓ + 1)).IsContained (color_avoiding_subgraph (SimpleGraph.completeGraph (Fin n)) c j)) :
∃ j : Fin t, (SimpleGraph.cycleGraph ℓ).IsContained (color_avoiding_subgraph (SimpleGraph.completeGraph (Fin n)) c j)color_avoiding_cycle_pred_of_succ_three_colorsIn LeanCombinatorics for TCS
For all ℓ ≥ 4, if a 3-edge-colouring of K_n contains an (ℓ+1)-cycle avoiding some colour j, then it contains an ℓ-cycle avoiding some colour j'.
theorem color_avoiding_cycle_pred_of_succ_three_colors (ℓ n : ℕ) (hℓ : 4 ≤ ℓ)
(c : (SimpleGraph.completeGraph (Fin n)).edgeSet → Fin 3)
(h : ∃ j : Fin 3, (SimpleGraph.cycleGraph (ℓ + 1)).IsContained (color_avoiding_subgraph (SimpleGraph.completeGraph (Fin n)) c j)) :
∃ j : Fin 3, (SimpleGraph.cycleGraph ℓ).IsContained (color_avoiding_subgraph (SimpleGraph.completeGraph (Fin n)) c j)color_avoiding_subgraph_leIn LeanCombinatorics for TCS
For any edge colouring c of G and colour j, the j-avoiding subgraph color_avoiding_subgraph G c j is a subgraph of G.
theorem color_avoiding_subgraph_le {V C : Type*} (G : SimpleGraph V) (c : G.edgeSet → C) (j : C) :
color_avoiding_subgraph G c j ≤ Gcompatibility_lemma_for_return_words_to_palindromesIn LeanCombinatorics for TCS
Let w be a recurrent rich word over a finite alphabet and q a palindrome. If rq and r'q are two complete return words to q in w containing a palindrome s, then the longest common prefix of rq and r'q contains s as a factor.
theorem compatibility_lemma_for_return_words_to_palindromes
{α : Type*} [Fintype α] [DecidableEq α] (w : ℕ → α)
(hw_rec : is_recurrent_word w) (hw_rich : is_rich_word w)
(q : List α) (hq : q.Palindrome)
(r r' : List α)
(hr : is_complete_return_word (r ++ q) q ∧ ∃ i : ℕ, r ++ q = (List.range (r ++ q).length).map (fun j => w (i + j)))
(hr' : is_complete_return_word (r' ++ q) q ∧ ∃ i : ℕ, r' ++ q = (List.range (r' ++ q).length).map (fun j => w (i + j)))
(s : List α) (hs : s.Palindrome)
(hs_in_r : s <:+: r ++ q) (hs_in_r' : s <:+: r' ++ q) :
s <:+: longest_common_prefix (r ++ q) (r' ++ q)compatible_of_strong_eliminationIn LeanCombinatorics for TCS
If a finite collection C of finite sets has the strong elimination property, then C is a compatible collection.
theorem compatible_of_strong_elimination {V : Type*} [DecidableEq V] {C : Finset (Finset V)}
(h : has_strong_elimination C) : is_compatible_collection Ccomplete_bipartite_connected_spanning_subgraphs_strict_negative_correlationIn LeanCombinatorics for TCS
For integers m, n ≥ 2 and distinct edges e, f of the complete bipartite graph K_{m,n}, the number of connected spanning subgraphs j(K_{m,n}), the number containing e, j_e(K_{m,n}), and the number containing both e and f, j_{ef}(K_{m,n}), satisfy j_{ef}(K_{m,n}) * j(K_{m,n}) < j_e(K_{m,n}) * j_f(K_{m,n}).
theorem complete_bipartite_connected_spanning_subgraphs_strict_negative_correlation
(m n : ℕ) (hm : 2 ≤ m) (hn : 2 ≤ n)
(e f : Sym2 (Fin m ⊕ Fin n))
(he : e ∈ (completeBipartiteGraph (Fin m) (Fin n)).edgeSet)
(hf : f ∈ (completeBipartiteGraph (Fin m) (Fin n)).edgeSet)
(hne : e ≠ f) :
simple_graph_j_ef (completeBipartiteGraph (Fin m) (Fin n)) e f *
simple_graph_j (completeBipartiteGraph (Fin m) (Fin n)) <
simple_graph_j_e (completeBipartiteGraph (Fin m) (Fin n)) e *
simple_graph_j_e (completeBipartiteGraph (Fin m) (Fin n)) fcomplete_bipartite_two_connected_spanning_subgraphs_countIn LeanCombinatorics for TCS
For any integer n ≥ 2, the number of connected spanning subgraphs of the complete bipartite graph K_{2,n} is 3^n - 2^n.
theorem complete_bipartite_two_connected_spanning_subgraphs_count (n : ℕ) (hn : 2 ≤ n) :
simple_graph_j (completeBipartiteGraph (Fin 2) (Fin n)) = 3 ^ n - 2 ^ nconjecture_subsequence_sums_cover_all_nonzero_bridgeIn LeanCombinatorics for TCS
For an additive commutative monoid G with decidable equality, the finite set of sums of length-n submultisets obtained via powersetCard equals subsequence_sums n S.
theorem conjecture_subsequence_sums_cover_all_nonzero_bridge
{G : Type} [AddCommMonoid G] [DecidableEq G] (n : ℕ) (S : Multiset G) :
((S.powersetCard n).map Multiset.sum).toFinset = subsequence_sums n Scontrolled_nonface_overlap_dual_graph_diameterIn LeanCombinatorics for TCS
Let Δ be an abstract simplicial complex on an n-element vertex set V, pure of facet size d, with connected dual graph. Let g ∈ ℕ and suppose there is a subset X ⊆ V of size |X| = g such that M ∩ M' ⊆ X for every pair of distinct minimal nonfaces M, M' of Δ. Let traces be the set of distinct subsets F ∩ X as F ranges over all facets of Δ, and let κ = |traces|. Then the diameter of the dual graph of Δ satisfies diam(G(Δ)) ≤ κ(n - d + 1) - 1 ≤ 2^g(n - d + 1) - 1.
theorem controlled_nonface_overlap_dual_graph_diameter
{V : Type*} [DecidableEq V] [Fintype V]
(Δ : AbstractSimplicialComplex V) (n d g κ : ℕ)
(hn : Fintype.card V = n) (hpure : simplicial_is_pure Δ d)
(hconn : (simplicial_dual_graph Δ d).Connected)
(X : Finset V) (hg : X.card = g)
(hX : ∀ M M' : Finset V, simplicial_is_minimal_nonface Δ M →
simplicial_is_minimal_nonface Δ M' → M ≠ M' → M ∩ M' ⊆ X)
(traces : Finset (Finset V))
(htraces : ∀ Y, Y ∈ traces ↔ ∃ F, simplicial_is_facet Δ F ∧ F ∩ X = Y)
(hκ : traces.card = κ) :
(simplicial_dual_graph Δ d).diam ≤ κ * (n - d + 1) - 1 ∧
κ * (n - d + 1) - 1 ≤ 2 ^ g * (n - d + 1) - 1coord_shift_hypergraph_no_loose_triangleIn LeanCombinatorics for TCS
Let p > 3 be prime, d ≥ 2, and S ⊆ ZMod p a subset containing no nontrivial three-term arithmetic progression. Then the coordinate-shift hypergraph H(p, d, S) contains no loose triangle: no three edges e₁, e₂, e₃ in H(p, d, S) form a loose triangle.
theorem coord_shift_hypergraph_no_loose_triangle
(p d : ℕ) [Fact (Nat.Prime p)] (hp : 3 < p) (hd : 2 ≤ d)
(S : Set (ZMod p)) (hS : ThreeAPFree S)
(e₁ e₂ e₃ : Finset (Fin 3 × (Fin d → ZMod p)))
(h₁ : e₁ ∈ coord_shift_hypergraph p d S)
(h₂ : e₂ ∈ coord_shift_hypergraph p d S)
(h₃ : e₃ ∈ coord_shift_hypergraph p d S) :
¬ is_loose_triangle e₁ e₂ e₃coord_shift_hypergraph_no_three_by_three_gridIn LeanCombinatorics for TCS
Let p > 3 be a prime, d >= 2, and S a subset of ZMod p containing no nontrivial three-term arithmetic progression. Then the coordinate-shift hypergraph H(p, d, S) contains no 3x3 grid.
theorem coord_shift_hypergraph_no_three_by_three_grid (p d : ℕ) [Fact p.Prime] (hp : 3 < p)
(hd : 2 ≤ d) (S : Set (ZMod p)) (hS : ThreeAPFree S) :
¬ has_three_by_three_grid (coord_shift_hypergraph p d S)coord_shift_z_eq_at_least_diffIn LeanCombinatorics for TCS
For vectors x, x', y, y' over ZMod p and a coordinate t, if x and x' agree and y and y' agree on all coordinates j < t, and the coordinate-shift vectors z(x, y') and z(x', y) agree at t, then x_t + y'_t = x'_t + y_t.
theorem coord_shift_z_eq_at_least_diff {p d : ℕ} (x x' y y' : Fin d → ZMod p) (t : Fin d)
(hprev : ∀ (j : Fin d), j < t → x j = x' j ∧ y j = y' j)
(hz : coord_shift_z x y' t = coord_shift_z x' y t) :
x t + y' t = x' t + y tcorner_crossed_exists_consecutive_admissible_pairIn LeanCombinatorics for TCS
Every finite diagram $D \subset \mathbb{N}^2$ that is corner-crossed and has no implicit boxes, and contains at least one pair of crossing cells, contains a consecutive admissible pair $(b_1, b_2)$.
theorem corner_crossed_exists_consecutive_admissible_pair (D : Finset (ℕ × ℕ))
(hcc : is_corner_crossed D) (hnoimp : diagram_has_no_implicit_boxes D)
(hcross : ∃ u ∈ D, ∃ v ∈ D, diagram_crossing u v) :
∃ b₁ ∈ D, ∃ b₂ ∈ D, diagram_is_consecutive_admissible_pair D b₁ b₂corner_crossed_row_col_le_iffIn LeanCombinatorics for TCS
For a corner-crossed finite diagram D : Finset (ℕ × ℕ) and cells u, v ∈ D, row_col_le D u v holds if and only if u.1 ≤ v.1 and u.2 ≤ v.2.
theorem corner_crossed_row_col_le_iff
(D : Finset (ℕ × ℕ)) (hD : is_corner_crossed D) (u v : ℕ × ℕ) (hu : u ∈ D) (hv : v ∈ D) :
row_col_le D u v ↔ u.1 ≤ v.1 ∧ u.2 ≤ v.2corner_crossed_slide_preservesIn LeanCombinatorics for TCS
For any finite corner-crossed diagram $D$ without implicit boxes and any consecutive admissible pair $(b_1, b_2)$, both the vertical slide and horizontal slide diagrams are corner-crossed and have no implicit boxes.
theorem corner_crossed_slide_preserves (D : Finset (ℕ × ℕ)) (b₁ b₂ : ℕ × ℕ)
(hcc : is_corner_crossed D) (hnoimp : diagram_has_no_implicit_boxes D)
(hcap : diagram_is_consecutive_admissible_pair D b₁ b₂) :
(is_corner_crossed (diagram_vertical_slide D b₁ b₂) ∧
diagram_has_no_implicit_boxes (diagram_vertical_slide D b₁ b₂)) ∧
(is_corner_crossed (diagram_horizontal_slide D b₁ b₂) ∧
diagram_has_no_implicit_boxes (diagram_horizontal_slide D b₁ b₂))cp_cnp_theorem_three_five_bound_le_ceil_of_ge_fiveIn LeanCombinatorics for TCS
For p ≥ 5 prime and n ≥ 2 with (np).minFac = p and p ∤ n, the two-term threshold max{np + 2p² − p − 1, np(p+1)/(np).minFac − p + (np).minFac − 2} of Theorem 3.5 of arXiv:2610.13103 (at q = p) is at most ⌈(25np − 20)/6⌉.
theorem cp_cnp_theorem_three_five_bound_le_ceil_of_ge_five (p : ℕ) (hp : p.Prime) (hp5 : 5 ≤ p) (n : ℕ) (hn : 2 ≤ n) (hmin : (n * p).minFac = p) (hndvd : ¬ p ∣ n) : max (n * p + 2 * p ^ 2 - p - 1) (n * p * (p + 1) / (n * p).minFac - p + (n * p).minFac - 2) ≤ Nat.ceil ((25 * (n * p : ℝ) - 20) / 6)
critical_split_central_binomial_boundIn LeanCombinatorics for TCS
For every natural number n at least five, 2(n-1)(1+n²)+2(n+1) is strictly less than the central binomial coefficient (2n choose n).
theorem critical_split_central_binomial_bound (n : ℕ) (hn : 5 ≤ n) : 2*(n-1)*(1+n^2)+2*(n+1) < Nat.centralBinom n
cubic_poly_strict_mono_of_minors_lt_oneIn LeanCombinatorics for TCS
For any real numbers x, y, z satisfying x^2 < 1, y^2 < 1, and (x, y, z) ≠ (0, 0, 0), the cubic polynomial function mapping q to 1 + (x^2 + y^2) * q + 2 * x * y * z * q^2 + z^2 * q^3 is strictly increasing on ℝ.
theorem cubic_poly_strict_mono_of_minors_lt_one
(x y z : ℝ) (hx : x ^ 2 < 1) (hy : y ^ 2 < 1) (hne : (x, y, z) ≠ (0, 0, 0)) :
StrictMono (fun q : ℝ => 1 + (x ^ 2 + y ^ 2) * q + 2 * x * y * z * q ^ 2 + z ^ 2 * q ^ 3)cycle_power_dyadic_alternating_defective_halvesIn LeanCombinatorics for TCS
Parity reindexing of an alternating model with only its two possible middle defects yields the two defective half models, with phases zero and half the half-span.
theorem cycle_power_dyadic_alternating_defective_halves (t : ℕ) (ht : 2 ≤ t) (x : ℤ → ℕ → Bool)
(htight : ∀ p, cycle_power_dyadic_class_weight (t+1) (x p) =
(Finset.range (2^(t+1))).sum (fun a => (x p a).toNat))
(hexact : ∀ j < t+1, ∀ v : ℤ, (Finset.range (2^j)).sum (fun a =>
(x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(t+1)-2^j)).toNat) = 1)
(hcover : ∀ d : ℕ, 1 ≤ d → d < 2^(t+1) → ∀ v : ℤ,
∃ a : ℕ, a < 2^(t+1)-d ∧ x (v-(a : ℤ)) a = true ∧
x (v-(a : ℤ)) (a+d) = true)
(hcount : ∀ v : ℤ, (Finset.range (2^(t+1))).sum (fun a =>
(x (v-(a : ℤ)) a).toNat) = (t+1)+1)
(halt : ∀ p : ℤ, x (p+1) 1 = !x p 1)
(hpart : ∀ p : ℤ, x p 1 = false → ∀ j, 0 < j → j < 2^(t+1) - 1 → j ≠ 2^t - 1 → j ≠ 2^t → x p j = false) (s : ℤ) (hs : x s 1 = false) :
cycle_power_dyadic_defective_half_model t (fun q a => x (s + 2*q + 1) (2*a))
(fun v => x (s + 2*v + 2 - ((2^t : ℕ) : ℤ)) (2^t - 1)) 0 ∧
cycle_power_dyadic_defective_half_model t (fun q a => x (s + 2*q + 1) (2*a+1))
(fun v => x (s + 2*v + 2 - ((2^t : ℕ) : ℤ)) (2^t)) ((2 : ℤ)^(t-1))cycle_power_dyadic_endpoint_overlapIn LeanCombinatorics for TCS
Conjectured uniform endpoint-overlap core: every class other than the ending class that is active at its last vertex intersects the class starting immediately afterward, in a periodic tight dyadic model with constant optimal count and full coverage.
theorem cycle_power_dyadic_endpoint_overlap
(m n : ℕ) (hm : 1 ≤ m) (hn : 0 < n) (x : ℤ → ℕ → Bool)
(hperiod : ∀ p a, x (p + (n : ℤ)) a = x p a)
(htight : ∀ p, cycle_power_dyadic_class_weight m (x p) =
(Finset.range (2 ^ m)).sum (fun a => (x p a).toNat))
(hcount : ∀ v : ℤ, (Finset.range (2 ^ m)).sum
(fun a => (x (v - (a : ℤ)) a).toNat) = m + 1)
(hexact : ∀ j < m, ∀ v : ℤ, (Finset.range (2 ^ j)).sum (fun a =>
(x (v - (a : ℤ)) a && x (v - (a : ℤ)) (a + 2 ^ m - 2 ^ j)).toNat) = 1)
(hcover : ∀ d : ℕ, 1 ≤ d → d < 2 ^ m → ∀ v : ℤ,
∃ a : ℕ, a < 2 ^ m - d ∧ x (v - (a : ℤ)) a = true ∧
x (v - (a : ℤ)) (a + d) = true) :
∀ (p : ℤ) (q : ℕ), 1 ≤ q → q < 2 ^ m →
x (p + (q : ℤ)) (2 ^ m - 1 - q) = true →
∃ a : ℕ, a < q ∧ x (p + (q : ℤ)) (2 ^ m - q + a) = true ∧
x (p + ((2 ^ m : ℕ) : ℤ)) a = truecycle_power_dyadic_middle_bits_from_defective_halvesIn LeanCombinatorics for TCS
If both phase variants of the defective half model are defect-free, the middle bits in the alternating model vanish.
theorem cycle_power_dyadic_middle_bits_from_defective_halves (t : ℕ) (ht : 2 ≤ t) (x : ℤ → ℕ → Bool)
(htight : ∀ p, cycle_power_dyadic_class_weight (t+1) (x p) =
(Finset.range (2^(t+1))).sum (fun a => (x p a).toNat))
(hexact : ∀ j < t+1, ∀ v : ℤ, (Finset.range (2^j)).sum (fun a =>
(x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(t+1)-2^j)).toNat) = 1)
(hcover : ∀ d : ℕ, 1 ≤ d → d < 2^(t+1) → ∀ v : ℤ,
∃ a : ℕ, a < 2^(t+1)-d ∧ x (v-(a : ℤ)) a = true ∧
x (v-(a : ℤ)) (a+d) = true)
(hcount : ∀ v : ℤ, (Finset.range (2^(t+1))).sum (fun a =>
(x (v-(a : ℤ)) a).toNat) = (t+1)+1)
(halt : ∀ p : ℤ, x (p+1) 1 = !x p 1)
(hpart : ∀ p : ℤ, x p 1 = false → ∀ j, 0 < j → j < 2^(t+1) - 1 → j ≠ 2^t - 1 → j ≠ 2^t → x p j = false)
(hnodefect : ∀ (y : ℤ → ℕ → Bool) (e : ℤ → Bool) (shift : ℤ),
(shift = 0 ∨ shift = (2 : ℤ)^(t-1)) → cycle_power_dyadic_defective_half_model t y e shift → ∀ v, e v = false) :
∀ p : ℤ, x p 1 = false → x p (2^t - 1) = false ∧ x p (2^t) = falsecycle_power_dyadic_middle_bits_of_alternatingIn LeanCombinatorics for TCS
Conjecture: in a tight, exactly dyadically covered, fully covered integer Boolean class model at exponent t+1 (t ≥ 2) with t+2 active classes per vertex, with alternating bit 1 and with all inner bits other than 2^t-1 and 2^t vanishing in the classes without bit 1, those two middle bits vanish there as well.
theorem cycle_power_dyadic_middle_bits_of_alternating (t : ℕ) (ht : 2 ≤ t) (x : ℤ → ℕ → Bool)
(htight : ∀ p, cycle_power_dyadic_class_weight (t+1) (x p) =
(Finset.range (2^(t+1))).sum (fun a => (x p a).toNat))
(hexact : ∀ j < t+1, ∀ v : ℤ, (Finset.range (2^j)).sum (fun a =>
(x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^(t+1)-2^j)).toNat) = 1)
(hcover : ∀ d : ℕ, 1 ≤ d → d < 2^(t+1) → ∀ v : ℤ,
∃ a : ℕ, a < 2^(t+1)-d ∧ x (v-(a : ℤ)) a = true ∧
x (v-(a : ℤ)) (a+d) = true)
(hcount : ∀ v : ℤ, (Finset.range (2^(t+1))).sum (fun a =>
(x (v-(a : ℤ)) a).toNat) = (t+1)+1)
(halt : ∀ p : ℤ, x (p+1) 1 = !x p 1)
(hpart : ∀ p : ℤ, x p 1 = false → ∀ j, 0 < j → j < 2^(t+1) - 1 → j ≠ 2^t - 1 → j ≠ 2^t →
x p j = false) :
∀ p : ℤ, x p 1 = false → x p (2^t - 1) = false ∧ x p (2^t) = falsecycle_power_dyadic_optimal_count_class_no_islandIn LeanCombinatorics for TCS
Conjectured local classification under optimal scalar counts: every class is the union of an initial and terminal interval. This version assumes exact pointwise optimal active counts and removes periodicity; it differs from the existing count-free periodic shape conjecture.
theorem cycle_power_dyadic_optimal_count_class_no_island
(m : ℕ) (hm : 1 ≤ m) (x : ℤ → ℕ → Bool)
(htight : ∀ p, cycle_power_dyadic_class_weight m (x p) =
(Finset.range (2^m)).sum (fun a => (x p a).toNat))
(hexact : ∀ j < m, ∀ v : ℤ, (Finset.range (2^j)).sum (fun a =>
(x (v-(a : ℤ)) a && x (v-(a : ℤ)) (a+2^m-2^j)).toNat) = 1)
(hcover : ∀ d : ℕ, 1 ≤ d → d < 2^m → ∀ v : ℤ,
∃ a : ℕ, a < 2^m-d ∧ x (v-(a : ℤ)) a = true ∧
x (v-(a : ℤ)) (a+d) = true)
(hcount : ∀ v : ℤ, (Finset.range (2^m)).sum (fun a =>
(x (v-(a : ℤ)) a).toNat) = m+1) :
∀ (p : ℤ) (a b c : ℕ), a < b → b < c → c < 2^m →
x p a = false → x p b = true → x p c = truecycle_power_dyadic_periodic_class_no_islandIn LeanCombinatorics for TCS
Conjectured count-free periodic shape classification: every tight rooted dyadic class in a periodic full-cover model is the union of an initial and terminal interval, with possibly unequal widths. Equivalently a selected bit cannot lie between two missing bits.
theorem cycle_power_dyadic_periodic_class_no_island
(m : ℕ) (hm : 1 ≤ m) (x : ℤ → ℕ → Bool)
(htight : ∀ p, cycle_power_dyadic_class_weight m (x p) =
(Finset.range (2 ^ m)).sum (fun a => (x p a).toNat))
(hexact : ∀ j < m, ∀ v : ℤ, (Finset.range (2 ^ j)).sum (fun a =>
(x (v - (a : ℤ)) a && x (v - (a : ℤ)) (a + 2 ^ m - 2 ^ j)).toNat) = 1)
(hcover : ∀ d : ℕ, 1 ≤ d → d < 2 ^ m → ∀ v : ℤ,
∃ a : ℕ, a < 2 ^ m - d ∧ x (v - (a : ℤ)) a = true ∧
x (v - (a : ℤ)) (a + d) = true)
(n : ℕ) (hn : 0 < n)
(hperiod : ∀ p a, x (p + (n : ℤ)) a = x p a) :
∀ (p : ℤ) (a b c : ℕ), a < b → b < c → c < 2 ^ m →
x p a = false → x p b = true → x p c = truecycle_power_dyadic_zero_phase_half_no_defectsIn LeanCombinatorics for TCS
Conjecture: a tight zero-phase dyadic defective half model at exponent at least two has no defects.
theorem cycle_power_dyadic_zero_phase_half_no_defects (t : ℕ) (ht : 2 ≤ t) (y : ℤ → ℕ → Bool) (e : ℤ → Bool) (hmodel : cycle_power_dyadic_defective_half_model t y e 0) : ∀ v : ℤ, e v = false
cycle_rook_matrix_detIn LeanCombinatorics for TCS
The Fibonacci matrix M = !![1, X; 1, 0] has determinant -X, so det(M^n) = (-X)^n.
theorem cycle_rook_matrix_det : cycle_rook_matrix.det = -Polynomial.X
cycle_rook_matrix_sqIn LeanCombinatorics for TCS
The Fibonacci matrix M = !![1, X; 1, 0] satisfies M^2 = M + X·1, the matrix form of t^2 = t + x.
theorem cycle_rook_matrix_sq : cycle_rook_matrix ^ 2 = cycle_rook_matrix + (Polynomial.X : Polynomial ℚ) • (1 : Matrix (Fin 2) (Fin 2) (Polynomial ℚ))
cycle_rook_matrix_trace_recurrenceIn LeanCombinatorics for TCS
For M = !![1, X; 1, 0] and every n, tr(M^(n+2)) = tr(M^(n+1)) + X · tr(M^n).
theorem cycle_rook_matrix_trace_recurrence (n : ℕ) :
Matrix.trace (cycle_rook_matrix ^ (n + 2)) =
Matrix.trace (cycle_rook_matrix ^ (n + 1)) + Polynomial.X * Matrix.trace (cycle_rook_matrix ^ n)cycle_rook_matrix_trace_sqIn LeanCombinatorics for TCS
For M = !![1, X; 1, 0] and every n, (tr(M^n))^2 = tr(M^(2n)) + 2(-X)^n.
theorem cycle_rook_matrix_trace_sq (n : ℕ) :
Matrix.trace (cycle_rook_matrix ^ n) ^ 2 =
Matrix.trace (cycle_rook_matrix ^ (2 * n)) + Polynomial.C 2 * (-Polynomial.X) ^ ncycle_rook_poly_add_twoIn LeanCombinatorics for TCS
The cycle rook polynomial satisfies the second-order linear recurrence Q_{n+2}(X) = Q_{n+1}(X) + X * Q_n(X) for all n ≥ 1.
theorem cycle_rook_poly_add_two (n : ℕ) (hn : 1 ≤ n) :
cycle_rook_poly (n + 2) = cycle_rook_poly (n + 1) + Polynomial.X * cycle_rook_poly ncycle_rook_poly_eq_matrix_traceIn LeanCombinatorics for TCS
For every m ≥ 1, the rook polynomial of an m-cycle equals tr(M^m), where M = !![1, X; 1, 0].
theorem cycle_rook_poly_eq_matrix_trace (n : ℕ) (hn : 1 ≤ n) :
cycle_rook_poly n = Matrix.trace (cycle_rook_matrix ^ n)cycle_rook_poly_sq_subIn LeanCombinatorics for TCS
For every positive integer n, the square of the rook polynomial of an n-cycle satisfies Q_n(x)^2 = Q_{2n}(x) + 2(-x)^n in ℚ[x].
theorem cycle_rook_poly_sq_sub (n : ℕ) (hn : 1 ≤ n) :
cycle_rook_poly n ^ 2 = cycle_rook_poly (2 * n) + Polynomial.C 2 * (-Polynomial.X : Polynomial ℚ) ^ ncycle_rook_poly_sq_sub_of_evenIn LeanCombinatorics for TCS
For every even positive integer n, the difference between the squared rook polynomial Q_n(x)^2 of an n-cycle and the rook polynomial Q_{2n}(x) of a 2n-cycle equals 2 x^n in ℚ[x].
theorem cycle_rook_poly_sq_sub_of_even (n : ℕ) (hn : 1 ≤ n) (he : Even n) :
cycle_rook_poly n ^ 2 - cycle_rook_poly (2 * n) = Polynomial.C 2 * (Polynomial.X : Polynomial ℚ) ^ ncycle_rook_poly_twoIn LeanCombinatorics for TCS
The rook polynomial of a 2-cycle is equal to 1 + 2X in ℚ[x].
theorem cycle_rook_poly_two : cycle_rook_poly 2 = 1 + Polynomial.C 2 * Polynomial.X
cyclic_exp_char_sumIn LeanCombinatorics for TCS
Orthogonality of the standard exponential additive character on ZMod N: the sum over m of exp(2πi * (m * d) / N) equals N if d = 0 and 0 otherwise.
theorem cyclic_exp_char_sum (N : ℕ) [NeZero N] (d : ZMod N) :
∑ m : ZMod N, Complex.exp (2 * Real.pi * Complex.I * ((m * d).val / (N : ℂ))) =
if d = 0 then (N : ℂ) else 0cyclic_matrix_fourier_antidiagonal_iff_circulantIn LeanCombinatorics for TCS
A complex matrix M indexed by ZMod N has its two-dimensional cyclic Fourier transform supported on the anti-diagonal m + n = 0 if and only if M is a circulant matrix.
theorem cyclic_matrix_fourier_antidiagonal_iff_circulant (N : ℕ) [NeZero N]
(M : Matrix (ZMod N) (ZMod N) ℂ) :
(∀ m n : ZMod N, m + n ≠ 0 → cyclic_matrix_fourier N M m n = 0) ↔
∃ v : ZMod N → ℂ, M = Matrix.circulant vcyclic_matrix_fourier_inversionIn LeanCombinatorics for TCS
The two-dimensional cyclic Fourier inversion formula: reconstructing a complex matrix M on ZMod N from its cyclic matrix Fourier transform.
theorem cyclic_matrix_fourier_inversion (N : ℕ) [NeZero N]
(M : Matrix (ZMod N) (ZMod N) ℂ) (x y : ZMod N) :
(1 / (N : ℂ)) * ∑ m : ZMod N, ∑ n : ZMod N,
cyclic_matrix_fourier N M m n *
Complex.exp (2 * Real.pi * Complex.I * ((m * x + n * y).val / (N : ℂ))) = M x yd2_tilde_is_oasIn LeanCombinatorics for TCS
For every function W : ℝ → ℝ → ℝ satisfying is_digraphon W, the density satisfies d2_tilde_density W ≤ d2_tilde_density (digraphon_symmetrization W).
theorem d2_tilde_is_oas (W : ℝ → ℝ → ℝ) (hW : is_digraphon W) :
d2_tilde_density W ≤ d2_tilde_density (digraphon_symmetrization W)davenport_card_threshold_leIn LeanCombinatorics for TCS
For p ≥ 3 and n ≥ 5, the Davenport length p + (np) − 1 is at most ⌈(4np − 2)/3⌉, so the target's cardinality bound meets the Davenport-constant hypothesis when applied to C_p × C_np.
theorem davenport_card_threshold_le (p n : ℕ) (hp3 : 3 ≤ p) (hn : 5 ≤ n) : p + n * p - 1 ≤ Nat.ceil ((4 * (n * p : ℝ) - 2) / 3)
decay_ramsey_product_colouring_baseIn LeanCombinatorics for TCS
Base case ℓ = 1: if K_m has an r-colouring c₀ with no monochromatic K_k, then K_{m^1} has an a-bounded colouring with no monochromatic K_k, where a(i) = m^(1 - i/r).
theorem decay_ramsey_product_colouring_base (m r k : ℕ) (hm : 2 ≤ m) (hr : 2 ≤ r) (hk : 2 ≤ k)
(c₀ : (SimpleGraph.completeGraph (Fin m)).edgeSet → ℕ+)
(hc₀_range : ∀ e, (c₀ e : ℕ) ≤ r)
(hc₀_free : ¬ op_258_has_mono_clique m c₀ k) :
∃ c : (SimpleGraph.completeGraph (Fin (m ^ 1))).edgeSet → ℕ+,
op_258_bounded (fun (i : ℕ+) => (m : ℝ) ^ (1 - (i : ℝ) / (r : ℝ))) (m ^ 1) c ∧
¬ op_258_has_mono_clique (m ^ 1) c kdecay_ramsey_product_colouring_boundIn LeanCombinatorics for TCS
Let m, r, k ≥ 2 be integers. If there exists an edge-colouring c₀ : E(K_m) → {1, ..., r} containing no monochromatic clique K_k, then the sequence a defined by a i = m^(1 - i/r) satisfies a ↛ K_k (that is, ¬ (a → K_k)).
theorem decay_ramsey_product_colouring_bound (m r k : ℕ) (hm : 2 ≤ m) (hr : 2 ≤ r) (hk : 2 ≤ k)
(c₀ : (SimpleGraph.completeGraph (Fin m)).edgeSet → ℕ+)
(hc₀_range : ∀ e, (c₀ e : ℕ) ≤ r)
(hc₀_free : ¬ op_258_has_mono_clique m c₀ k) :
¬ decay_ramsey_arrow (fun (i : ℕ+) => (m : ℝ) ^ (1 - (i : ℝ) / (r : ℝ))) kdecay_ramsey_product_colouring_existsIn LeanCombinatorics for TCS
Let m, r, k ≥ 2 and ℓ ≥ 1 be integers. If the complete graph K_m admits an edge-colouring using colours at most r with no monochromatic K_k, then the complete graph K_{m^ℓ} admits an a-bounded edge-colouring with no monochromatic K_k, where the sequence a is defined by a i = m^(1 - i/r).
theorem decay_ramsey_product_colouring_exists (m r k : ℕ) (hm : 2 ≤ m) (hr : 2 ≤ r) (hk : 2 ≤ k)
(c₀ : (SimpleGraph.completeGraph (Fin m)).edgeSet → ℕ+)
(hc₀_range : ∀ e, (c₀ e : ℕ) ≤ r)
(hc₀_free : ¬ op_258_has_mono_clique m c₀ k)
(ℓ : ℕ) (hℓ : 1 ≤ ℓ) :
∃ c : (SimpleGraph.completeGraph (Fin (m ^ ℓ))).edgeSet → ℕ+,
op_258_bounded (fun (i : ℕ+) => (m : ℝ) ^ (1 - (i : ℝ) / (r : ℝ))) (m ^ ℓ) c ∧
¬ op_258_has_mono_clique (m ^ ℓ) c kdecay_ramsey_product_colouring_stepIn LeanCombinatorics for TCS
Inductive step: if K_{m^ℓ} admits an a-bounded colouring with no monochromatic K_k, then the product graph K_{m^{ℓ+1}} also admits an a-bounded colouring with no monochromatic K_k, where a(i) = m^(1 - i/r).
theorem decay_ramsey_product_colouring_step (m r k ℓ : ℕ) (hm : 2 ≤ m) (hr : 2 ≤ r) (hk : 2 ≤ k)
(c₀ : (SimpleGraph.completeGraph (Fin m)).edgeSet → ℕ+)
(hc₀_range : ∀ e, (c₀ e : ℕ) ≤ r)
(hc₀_free : ¬ op_258_has_mono_clique m c₀ k)
(hℓ : 1 ≤ ℓ)
(ih : ∃ c : (SimpleGraph.completeGraph (Fin (m ^ ℓ))).edgeSet → ℕ+,
op_258_bounded (fun (i : ℕ+) => (m : ℝ) ^ (1 - (i : ℝ) / (r : ℝ))) (m ^ ℓ) c ∧
¬ op_258_has_mono_clique (m ^ ℓ) c k) :
∃ c' : (SimpleGraph.completeGraph (Fin (m ^ (ℓ + 1)))).edgeSet → ℕ+,
op_258_bounded (fun (i : ℕ+) => (m : ℝ) ^ (1 - (i : ℝ) / (r : ℝ))) (m ^ (ℓ + 1)) c' ∧
¬ op_258_has_mono_clique (m ^ (ℓ + 1)) c' kdedekind_card_order_hom_three_mul_mod_threeIn LeanCombinatorics for TCS
For all non-negative integers n and k, the number of monotone functions from the 3k-dimensional Boolean lattice to the poset of monotone Boolean functions on n variables is congruent modulo 3 to the number of monotone functions from the k-th Cartesian power of the 4-element chain to that poset.
lemma dedekind_card_order_hom_three_mul_mod_three (n k : ℕ) : Fintype.card ((Fin (3 * k) → Bool) →o ((Fin n → Bool) →o Bool)) ≡ Fintype.card ((Fin k → Fin 4) →o ((Fin n → Bool) →o Bool)) [MOD 3]
dedekind_number_add_eq_card_order_homIn LeanCombinatorics for TCS
For all non-negative integers n and m, the (n + m)-th Dedekind number equals the cardinality of the poset of monotone functions from the m-dimensional Boolean lattice to the poset of monotone Boolean functions on n variables.
lemma dedekind_number_add_eq_card_order_hom (n m : ℕ) : dedekind_number (n + m) = Fintype.card ((Fin m → Bool) →o ((Fin n → Bool) →o Bool))
dedekind_number_add_three_mul_mod_threeIn LeanCombinatorics for TCS
For all non-negative integers n and k, the (n + 3k)-th Dedekind number is congruent modulo 3 to the cardinality of the poset of monotone functions from the k-th Cartesian power of the 4-element chain to the poset of monotone Boolean functions on n variables.
theorem dedekind_number_add_three_mul_mod_three (n k : ℕ) : dedekind_number (n + 3 * k) ≡ Fintype.card ((Fin k → Fin 4) →o ((Fin n → Bool) →o Bool)) [MOD 3]
dedekind_poset_add_order_isoIn LeanCombinatorics for TCS
For all non-negative integers n and m, the poset of monotone Boolean functions on n + m variables is isomorphic to the poset of monotone functions from the m-dimensional Boolean lattice to the poset of monotone Boolean functions on n variables.
theorem dedekind_poset_add_order_iso (n m : ℕ) : Nonempty (((Fin (n + m) → Bool) →o Bool) ≃o ((Fin m → Bool) →o ((Fin n → Bool) →o Bool)))
diagram_slide_preserves_vertical_syt_and_descentsIn LeanCombinatorics for TCS
Vertical slide along a consecutive admissible pair $(b_1, b_2)$ maps any standard Young tableau list on $D$ in which $b_2$ precedes $b_1$ to a standard Young tableau list on the vertical slide diagram, preserving all row descents.
theorem diagram_slide_preserves_vertical_syt_and_descents
(D : Finset (ℕ × ℕ)) (b₁ b₂ : ℕ × ℕ)
(hcap : diagram_is_consecutive_admissible_pair D b₁ b₂)
(l : List (ℕ × ℕ)) (hl : is_standard_young_tableau_list D l)
(hsplit : List.idxOf b₂ l < List.idxOf b₁ l) :
is_standard_young_tableau_list (diagram_vertical_slide D b₁ b₂) (List.map (diagram_vertical_slide_box D b₁ b₂) l) ∧
(∀ k, list_descent_at (List.map (diagram_vertical_slide_box D b₁ b₂) l) k ↔ list_descent_at l k)diagram_slide_tree_node_agreesIn LeanCombinatorics for TCS
If a consecutive admissible pair $(b_1, b_2)$ in a diagram $D$ has child sliding trees $t_v$ and $t_h$ satisfying descent agreement, and if vertical and horizontal slides preserve standard Young tableaux and row descent locations, then the node tree constructed from $(b_1, b_2)$, $t_v$, and $t_h$ also satisfies descent agreement.
theorem diagram_slide_tree_node_agrees
(D : Finset (ℕ × ℕ)) (b₁ b₂ : ℕ × ℕ)
(hcap : diagram_is_consecutive_admissible_pair D b₁ b₂)
(left : DiagramSlidingTree (diagram_vertical_slide D b₁ b₂))
(right : DiagramSlidingTree (diagram_horizontal_slide D b₁ b₂))
(hleft : diagram_slide_expansion_agrees_with_descents (diagram_vertical_slide D b₁ b₂) left)
(hright : diagram_slide_expansion_agrees_with_descents (diagram_horizontal_slide D b₁ b₂) right)
(hpres_v : ∀ l, is_standard_young_tableau_list D l → List.idxOf b₂ l < List.idxOf b₁ l →
is_standard_young_tableau_list (diagram_vertical_slide D b₁ b₂) (l.map (diagram_vertical_slide_box D b₁ b₂)) ∧
(∀ k, list_descent_at (l.map (diagram_vertical_slide_box D b₁ b₂)) k ↔ list_descent_at l k))
(hpres_h : ∀ l, is_standard_young_tableau_list D l → ¬ (List.idxOf b₂ l < List.idxOf b₁ l) →
is_standard_young_tableau_list (diagram_horizontal_slide D b₁ b₂) (l.map (diagram_horizontal_slide_box D b₁ b₂)) ∧
(∀ k, list_descent_at (l.map (diagram_horizontal_slide_box D b₁ b₂)) k ↔ list_descent_at l k)) :
diagram_slide_expansion_agrees_with_descents D (DiagramSlidingTree.node D b₁ b₂ hcap left right)diff_card_le_high_rep_card_of_large_countIn LeanCombinatorics for TCS
Let G be a finite abelian group of odd order, A ⊆ G, g ∉ Σ₃(A), and σ ∈ G with ν_A(σ) > N - 2|A| + 9. Then σ + (A - A) is contained in the high-representation set P(A), hence |A - A| ≤ |P(A)|.
open scoped Pointwise in
theorem diff_card_le_high_rep_card_of_large_count {G : Type*} [AddCommGroup G] [Fintype G]
[DecidableEq G] {A : Finset G} {g σ : G} (hodd : Fintype.card G % 2 = 1)
(hg : g ∉ restrictedSumset A 3)
(hσ : (Fintype.card G : ℤ) - 2 * (A.card : ℤ) + 9 < (orderedPairSumCount A σ : ℤ)) :
(A - A).card ≤ (highRepSet A).carddigraph_d2_tilde_graph_has_triangleIn LeanCombinatorics for TCS
There exists a 3-element subset of vertices of the underlying simple graph of D̃₂ that forms a 3-clique: ∃ s : Finset DigraphD2TildeVertex, digraph_d2_tilde_graph.IsNClique 3 s.
theorem digraph_d2_tilde_graph_has_triangle :
∃ s : Finset DigraphD2TildeVertex, digraph_d2_tilde_graph.IsNClique 3 sdigraph_d2_tilde_graph_not_isBipartiteIn LeanCombinatorics for TCS
The underlying simple graph digraph_d2_tilde_graph is not bipartite: ¬ digraph_d2_tilde_graph.IsBipartite.
theorem digraph_d2_tilde_graph_not_isBipartite :
¬ digraph_d2_tilde_graph.IsBipartitedirected_cycle_entropy_boundIn LeanCombinatorics for TCS
Let n ≥ 1 be an integer, and let P be a probability distribution on the cyclic group ZMod n. For each r in ZMod n, let d_r be the expected clockwise distance ∑_s P(s) c(s, r), and let H(P) = -∑_s P(s) log_2 P(s) be the Shannon entropy of P in bits. Then 2^(H(P)) * ∑_r 2^(-d_r) ≤ 6 + 4 * sqrt(2).
theorem directed_cycle_entropy_bound
(n : ℕ) [NeZero n]
(P : ZMod n → ℝ) (hP_nonneg : ∀ s, 0 ≤ P s) (hP_sum : ∑ s, P s = 1) :
let d : ZMod n → ℝ := fun r ↦ ∑ s, P s * zmod_clockwise_dist s r
let HP : ℝ := - ∑ s, P s * Real.logb 2 (P s)
(2 : ℝ) ^ HP * ∑ r, (2 : ℝ) ^ (- d r) ≤ 6 + 4 * Real.sqrt 2disjoint_of_strongly_incomparableIn LeanCombinatorics for TCS
If an indexed family of finset families 𝒜 : ι → Finset (Finset α) is strongly incomparable, then for any distinct indices i ≠ j, the finsets 𝒜 i and 𝒜 j are disjoint.
lemma disjoint_of_strongly_incomparable {ι α : Type*} (𝒜 : ι → Finset (Finset α)) (h : strongly_incomparable 𝒜) {i j : ι} (hij : i ≠ j) : Disjoint (𝒜 i) (𝒜 j)distinct_subset_sums_certificate_det_boundIn LeanCombinatorics for TCS
For a positive definite real k × k matrix A with k ≥ 1, (k+1)·det A ≤ (W/k)^k where W = ∑ᵢ ∑ⱼ (if i = j then 2 else 1)·A i j.
theorem distinct_subset_sums_certificate_det_bound (k : ℕ) (hk : 1 ≤ k)
(A : Matrix (Fin k) (Fin k) ℝ) (hA : Matrix.PosDef A) :
((k : ℝ) + 1) * A.det ≤
((∑ i, ∑ j, (if i = j then (2 : ℝ) else 1) * A i j) / (k : ℝ)) ^ kdistinct_subset_sums_certificate_weightsIn LeanCombinatorics for TCS
There is a probability distribution w on the 2^k cube vertices (encoded as subsets of Fin k) whose uncentred second moment matrix E[V Vᵀ] is c·(I + 11ᵀ) with c = floor((k+1)^2/4) / (k(k+1)): that is, E[V_i V_j] = c·(2 if i = j else 1).
theorem distinct_subset_sums_certificate_weights (k : ℕ) (hk : 1 ≤ k) :
∃ w : Finset (Fin k) → ℝ,
(∀ T, 0 ≤ w T) ∧
(∑ T : Finset (Fin k), w T = 1) ∧
(∀ i j : Fin k, ∑ T : Finset (Fin k),
w T * (if i ∈ T then (1 : ℝ) else 0) * (if j ∈ T then (1 : ℝ) else 0) =
(Nat.floor (((k : ℝ) + 1) ^ 2 / 4) : ℝ) / ((k : ℝ) * ((k : ℝ) + 1)) *
(if i = j then 2 else 1))distinct_subset_sums_indicator_quad_formIn LeanCombinatorics for TCS
For any real k × k matrix A and any subset S of the index set, the quadratic form of A at the indicator vector of S equals ∑_{i ∈ S} ∑_{j ∈ S} A i j.
theorem distinct_subset_sums_indicator_quad_form (k : ℕ) (A : Matrix (Fin k) (Fin k) ℝ)
(S : Finset (Fin k)) :
(fun i => if i ∈ S then (1 : ℝ) else 0) ⬝ᵥ A.mulVec (fun i => if i ∈ S then (1 : ℝ) else 0)
= ∑ i ∈ S, ∑ j ∈ S, A i jdistinct_subset_sums_matrix_constant_leIn LeanCombinatorics for TCS
For any natural number k ≥ 1 and any real symmetric positive definite k × k matrix A (satisfying Matrix.PosDef A), distinct_subset_sums_matrix_constant k A ≤ distinct_subset_sums_constant k.
theorem distinct_subset_sums_matrix_constant_le (k : ℕ) (hk : 1 ≤ k)
(A : Matrix (Fin k) (Fin k) ℝ) (hA : Matrix.PosDef A) :
distinct_subset_sums_matrix_constant k A ≤ distinct_subset_sums_constant k
distinct_subset_sums_matrix_constant_le_of_quad_max_boundIn LeanCombinatorics for TCS
If distinct_subset_sums_quad_max k A is at least floor((k+1)^2/4)·(det A)^(1/k)/(k+1)^((k-1)/k), then distinct_subset_sums_matrix_constant k A ≤ distinct_subset_sums_constant k.
theorem distinct_subset_sums_matrix_constant_le_of_quad_max_bound (k : ℕ) (hk : 1 ≤ k)
(A : Matrix (Fin k) (Fin k) ℝ) (hA : Matrix.PosDef A)
(h : ((Nat.floor (((k : ℝ) + 1) ^ 2 / 4) : ℝ) * A.det ^ ((1 : ℝ) / (k : ℝ))) /
((k : ℝ) + 1) ^ (((k : ℝ) - 1) / (k : ℝ)) ≤ distinct_subset_sums_quad_max k A) :
distinct_subset_sums_matrix_constant k A ≤ distinct_subset_sums_constant kdistinct_subset_sums_quad_max_det_rpow_lower_boundIn LeanCombinatorics for TCS
For positive definite A, distinct_subset_sums_quad_max k A is at least floor((k+1)^2/4)·(det A)^(1/k)/(k+1)^((k-1)/k). Equality holds at the root lattice matrix.
theorem distinct_subset_sums_quad_max_det_rpow_lower_bound (k : ℕ) (hk : 1 ≤ k)
(A : Matrix (Fin k) (Fin k) ℝ) (hA : Matrix.PosDef A) :
((Nat.floor (((k : ℝ) + 1) ^ 2 / 4) : ℝ) * A.det ^ ((1 : ℝ) / (k : ℝ))) /
((k : ℝ) + 1) ^ (((k : ℝ) - 1) / (k : ℝ)) ≤ distinct_subset_sums_quad_max k Adistinct_subset_sums_quad_max_ge_certificate_traceIn LeanCombinatorics for TCS
For any real k × k matrix A with k ≥ 1, the sum of the entries of A weighted by (2 on the diagonal, 1 off it) is at most (k(k+1)/floor((k+1)^2/4)) times distinct_subset_sums_quad_max k A.
theorem distinct_subset_sums_quad_max_ge_certificate_trace (k : ℕ) (hk : 1 ≤ k)
(A : Matrix (Fin k) (Fin k) ℝ) :
∑ i, ∑ j, (if i = j then (2 : ℝ) else 1) * A i j ≤
((k : ℝ) * ((k : ℝ) + 1) / (Nat.floor (((k : ℝ) + 1) ^ 2 / 4) : ℝ)) *
distinct_subset_sums_quad_max k Adistinct_subset_sums_quad_max_ge_cube_quad_formIn LeanCombinatorics for TCS
Every value of the quadratic form q_A(u) = uᵀAu at a point u of the unit cube [0,1]^k is at most distinct_subset_sums_quad_max k A.
theorem distinct_subset_sums_quad_max_ge_cube_quad_form (k : ℕ) (A : Matrix (Fin k) (Fin k) ℝ)
(u : Fin k → ℝ) (hu : u ∈ Set.Icc (0 : Fin k → ℝ) 1) :
u ⬝ᵥ A.mulVec u ≤ distinct_subset_sums_quad_max k A
distinct_subset_sums_root_matrix_constant_eqIn LeanCombinatorics for TCS
For any natural number k ≥ 1, the constant distinct_subset_sums_matrix_constant k applied to the root lattice matrix distinct_subset_sums_root_matrix k equals distinct_subset_sums_constant k.
theorem distinct_subset_sums_root_matrix_constant_eq (k : ℕ) (hk : 1 ≤ k) :
distinct_subset_sums_matrix_constant k (distinct_subset_sums_root_matrix k) =
distinct_subset_sums_constant kdistinct_subset_sums_root_matrix_detIn LeanCombinatorics for TCS
For any natural number k ≥ 1, the determinant of distinct_subset_sums_root_matrix k is 1 / (k + 1).
theorem distinct_subset_sums_root_matrix_det (k : ℕ) (hk : 1 ≤ k) :
Matrix.det (distinct_subset_sums_root_matrix k) = 1 / ((k : ℝ) + 1)
distinct_subset_sums_root_matrix_optimalIn LeanCombinatorics for TCS
For any natural number k ≥ 1, the constant distinct_subset_sums_matrix_constant k evaluated at the root lattice matrix distinct_subset_sums_root_matrix k equals distinct_subset_sums_constant k, and distinct_subset_sums_constant k is the greatest element of the set of all real numbers c for which there exists a positive definite matrix A with c = distinct_subset_sums_matrix_constant k A.
theorem distinct_subset_sums_root_matrix_optimal (k : ℕ) (hk : 1 ≤ k) :
distinct_subset_sums_matrix_constant k (distinct_subset_sums_root_matrix k) =
distinct_subset_sums_constant k ∧
IsGreatest {c | ∃ (A : Matrix (Fin k) (Fin k) ℝ), Matrix.PosDef A ∧
c = distinct_subset_sums_matrix_constant k A} (distinct_subset_sums_constant k)distinct_subset_sums_root_matrix_quad_formIn LeanCombinatorics for TCS
For any natural number k and any real vector x : Fin k → ℝ, the quadratic form dotProduct x (distinct_subset_sums_root_matrix k *ᵥ x) equals ∑ i, (x i)^2 - (1 / (k + 1)) * (∑ i, x i)^2.
theorem distinct_subset_sums_root_matrix_quad_form (k : ℕ) (x : Fin k → ℝ) :
dotProduct x (Matrix.mulVec (distinct_subset_sums_root_matrix k) x) =
∑ i, (x i) ^ 2 - (1 / ((k : ℝ) + 1)) * (∑ i, x i) ^ 2distinct_subset_sums_root_matrix_quad_maxIn LeanCombinatorics for TCS
For any natural number k ≥ 1, the maximum of the quadratic form of distinct_subset_sums_root_matrix k over the unit cube [0, 1]^k is Nat.floor ((k + 1)^2 / 4) / (k + 1).
theorem distinct_subset_sums_root_matrix_quad_max (k : ℕ) (hk : 1 ≤ k) :
distinct_subset_sums_quad_max k (distinct_subset_sums_root_matrix k) =
(Nat.floor (((k : ℝ) + 1) ^ 2 / 4) : ℝ) / ((k : ℝ) + 1)doubled_triangle_fold_count_lower_bound_and_minimum_isoperimetric_ratioIn LeanCombinatorics for TCS
Let n >= 1 be an integer. Every good coloring C of the doubled equilateral triangle triangulation T(n) satisfies f(C) >= 3 * n and eta(C) >= 9 / 2 in Q. Moreover, the two-sided coloring B_n is a good coloring with f(B_n) = 3 * n and eta(B_n) = 9 / 2 in Q.
theorem doubled_triangle_fold_count_lower_bound_and_minimum_isoperimetric_ratio
{n : ℕ} (hn : 0 < n) :
(∀ C : DoubledTriangleFace n → Bool, doubled_triangle_is_good_coloring C →
doubled_triangle_fold_count C ≥ 3 * n ∧
doubled_triangle_isoperimetric_ratio n C ≥ 9 / 2) ∧
doubled_triangle_is_good_coloring (doubled_triangle_two_sided_coloring n) ∧
doubled_triangle_fold_count (doubled_triangle_two_sided_coloring n) = 3 * n ∧
doubled_triangle_isoperimetric_ratio n (doubled_triangle_two_sided_coloring n) = 9 / 2doubled_triangle_good_coloring_majority_sixIn LeanCombinatorics for TCS
At any vertex v of degree 6 in T(n) under a good coloring C, if at least 4 incident faces have color c, then all incident faces of v have color c.
theorem doubled_triangle_good_coloring_majority_six
{n : ℕ} (C : DoubledTriangleFace n → Bool)
(hC : doubled_triangle_is_good_coloring C)
(v : DoubledTriangleVertex n)
(h_card : (doubled_triangle_vertex_faces v).card = 6)
(c : Bool)
(h_ge : 4 ≤ ((doubled_triangle_vertex_faces v).filter (fun f => C f = c)).card) :
∀ f ∈ doubled_triangle_vertex_faces v, C f = cdoubled_triangle_good_coloring_no_ring_monochromaticIn LeanCombinatorics for TCS
Let n ≥ 1 and let C be a good coloring of the doubled equilateral triangle triangulation T(n). Then no ring R : DoubledTriangleRing n of T(n) is monochromatic under C, meaning that doubled_triangle_ring_is_monochromatic C R is false.
theorem doubled_triangle_good_coloring_no_ring_monochromatic
{n : ℕ} (hn : 1 ≤ n) (C : DoubledTriangleFace n → Bool)
(hC : doubled_triangle_is_good_coloring C)
(R : DoubledTriangleRing n) :
¬ doubled_triangle_ring_is_monochromatic C Rdoubled_triangle_interior_vertex_faces_cardIn LeanCombinatorics for TCS
In the doubled equilateral triangle triangulation T(n), every interior vertex is incident to exactly 6 faces.
theorem doubled_triangle_interior_vertex_faces_card {n : ℕ} (front : Bool) (i j : Fin (n + 1))
(hi : 0 < (i : ℕ)) (hj : 0 < (j : ℕ)) (h_lt : (i : ℕ) + j < n) :
(doubled_triangle_vertex_faces (DoubledTriangleVertex.interior front i j hi hj h_lt)).card = 6doubled_triangle_point_to_vertex_eq_interior_iffIn LeanCombinatorics for TCS
doubled_triangle_point_to_vertex maps (f_front, a, b) to an interior vertex (front, i, j) if and only if f_front = front, a = i, and b = j.
theorem doubled_triangle_point_to_vertex_eq_interior_iff {n : ℕ} {front f_front : Bool}
{i j : Fin (n + 1)} {hi : 0 < (i : ℕ)} {hj : 0 < (j : ℕ)} {h_lt : (i : ℕ) + j < n}
{a b : Fin (n + 1)} (hab : (a : ℕ) + b ≤ n) :
doubled_triangle_point_to_vertex f_front a b hab = DoubledTriangleVertex.interior front i j hi hj h_lt ↔
f_front = front ∧ (a : ℕ) = i ∧ (b : ℕ) = jdoubled_triangle_two_sided_coloring_boundary_card_eqIn LeanCombinatorics for TCS
For any boundary vertex of the doubled triangle T(n), the reflection across front and back is an involution preserving incidence to the vertex and toggling face color, so the number of black incident faces equals the number of white incident faces.
theorem doubled_triangle_two_sided_coloring_boundary_card_eq {n : ℕ}
(i j : Fin (n + 1)) (h : (i : ℕ) + j ≤ n) (h_bd : (i : ℕ) = 0 ∨ (j : ℕ) = 0 ∨ (i : ℕ) + j = n) :
{f ∈ doubled_triangle_vertex_faces (DoubledTriangleVertex.boundary i j h h_bd) |
doubled_triangle_two_sided_coloring n f = true}.card =
{f ∈ doubled_triangle_vertex_faces (DoubledTriangleVertex.boundary i j h h_bd) |
doubled_triangle_two_sided_coloring n f = false}.carddoubled_triangle_two_sided_coloring_is_goodIn LeanCombinatorics for TCS
For any integer n >= 1, the two-sided coloring B_n of T(n) is a good coloring.
theorem doubled_triangle_two_sided_coloring_is_good {n : ℕ} (hn : 0 < n) :
doubled_triangle_is_good_coloring (doubled_triangle_two_sided_coloring n)doubled_triangle_x_ring_monochromatic_propagationIn LeanCombinatorics for TCS
For 0 ≤ k and k + 1 < n, if all faces of the x-ring DoubledTriangleRing.x (n := n) ⟨k, by omega⟩ have color c under a good coloring C of T(n), then all faces of the adjacent x-ring DoubledTriangleRing.x (n := n) ⟨k + 1, hk⟩ also have color c under C.
theorem doubled_triangle_x_ring_monochromatic_propagation
{n : ℕ} (k : ℕ) (hk : k + 1 < n) (C : DoubledTriangleFace n → Bool)
(hC : doubled_triangle_is_good_coloring C) (c : Bool)
(h_mono : ∀ f ∈ doubled_triangle_ring_faces (DoubledTriangleRing.x (n := n) ⟨k, by omega⟩), C f = c) :
∀ f ∈ doubled_triangle_ring_faces (DoubledTriangleRing.x (n := n) ⟨k + 1, hk⟩), C f = cdoubled_triangle_x_ring_step_inductiveIn LeanCombinatorics for TCS
If all faces of ring k have color c under a good coloring C, and the up-face at (k+1, j) has color c, then the down-face at (k+1, j) and the up-face at (k+1, j+1) both have color c.
theorem doubled_triangle_x_ring_step_inductive
{n : ℕ} (k : ℕ) (hk : k + 1 < n) (C : DoubledTriangleFace n → Bool)
(hC : doubled_triangle_is_good_coloring C) (c : Bool)
(h_mono : ∀ f ∈ doubled_triangle_ring_faces (DoubledTriangleRing.x (n := n) ⟨k, by omega⟩), C f = c)
(front : Bool) (j : ℕ) (hj : (k + 1 : ℕ) + j + 1 < n)
(h_prev : C (DoubledTriangleFace.up front ⟨k + 1, hk⟩ ⟨j, by omega⟩ (by show (k + 1 : ℕ) + j < n; omega)) = c) :
C (DoubledTriangleFace.down front ⟨k + 1, hk⟩ ⟨j, by omega⟩ (by show (k + 1 : ℕ) + j + 1 < n; omega)) = c ∧
C (DoubledTriangleFace.up front ⟨k + 1, hk⟩ ⟨j + 1, by omega⟩ (by show (k + 1 : ℕ) + (j + 1) < n; omega)) = cdoubled_triangle_x_ring_step_up_zeroIn LeanCombinatorics for TCS
If all faces of the x-ring k have color c under a good coloring C of T(n), then the up-face at lattice position (k+1, 0) has color c for both front and back.
theorem doubled_triangle_x_ring_step_up_zero
{n : ℕ} (k : ℕ) (hk : k + 1 < n) (C : DoubledTriangleFace n → Bool)
(hC : doubled_triangle_is_good_coloring C) (c : Bool)
(h_mono : ∀ f ∈ doubled_triangle_ring_faces (DoubledTriangleRing.x (n := n) ⟨k, by omega⟩), C f = c)
(front : Bool) (h : (k + 1 : ℕ) + 0 < n) :
C (DoubledTriangleFace.up front ⟨k + 1, hk⟩ ⟨0, by omega⟩ (by show (k + 1 : ℕ) + 0 < n; omega)) = cdual_notvanishing_ncardIn LeanCombinatorics for TCS
Let p be a prime and v ≠ 0 in (ZMod p)^3. Then the number of linear functionals f on (ZMod p)^3 with f(v) ≠ 0 is p^3 − p^2.
theorem dual_notvanishing_ncard
(p : ℕ) [Fact p.Prime] (v : Fin 3 → ZMod p) (hv : v ≠ 0) :
Nat.card {f : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p // f v ≠ 0} = p ^ 3 - p ^ 2dual_vanishing_at_vector_cardIn LeanCombinatorics for TCS
For any nonzero vector v in (ZMod p)^3, the space of linear functionals f with f(v) = 0 has cardinality p^2.
theorem dual_vanishing_at_vector_card
(p : ℕ) [Fact p.Prime] (v : Fin 3 → ZMod p) (hv : v ≠ 0) :
Nat.card {f : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p // f v = 0} = p ^ 2dual_vanishing_off_span_ncardIn LeanCombinatorics for TCS
Let p be a prime, v ≠ 0, and u not in the span of v (so u, v are linearly independent). Then exactly p(p−1) functionals f satisfy f(u) = 0 and f(v) ≠ 0.
theorem dual_vanishing_off_span_ncard
(p : ℕ) [Fact p.Prime] (v u : Fin 3 → ZMod p) (hv : v ≠ 0)
(hu : u ∉ Submodule.span (ZMod p) {v}) :
Nat.card {f : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p // f v ≠ 0 ∧ f u = 0} = p * (p - 1)dual_vanishing_on_span_ncardIn LeanCombinatorics for TCS
Let p be a prime, v ≠ 0, and u ≠ 0 with u in the span of v. Then no functional is simultaneously nonzero at v and zero at u, so the count of such functionals is 0.
theorem dual_vanishing_on_span_ncard
(p : ℕ) [Fact p.Prime] (v u : Fin 3 → ZMod p) (hv : v ≠ 0)
(hu : u ∈ Submodule.span (ZMod p) {v}) (hu0 : u ≠ 0) :
Nat.card {f : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p // f v ≠ 0 ∧ f u = 0} = 0elem_symm_on_alternating_partial_posIn LeanCombinatorics for TCS
For a finite set s of indices, a natural number K with K < |s|, and u : ι → ℝ with u i ≥ 1 for all i in s, the alternating sum ∑_{m=0}^{K} (-1)^m e_m(u over s) has the strict sign (-1)^K: that is, (-1)^K times it is strictly positive.
theorem elem_symm_on_alternating_partial_pos {ι : Type*} [DecidableEq ι] (s : Finset ι) (K : ℕ)
(hK : K < s.card) (u : ι → ℝ) (hu : ∀ k ∈ s, 1 ≤ u k) :
0 < (-1 : ℝ)^K * ∑ m ∈ Finset.range (K + 1), (-1 : ℝ)^m * elem_symm_on s m uelem_symm_on_insertIn LeanCombinatorics for TCS
For a finite set s of indices, an index i not in s, a natural number k and v : ι → ℝ, the (k+1)-st elementary symmetric sum of v over insert i s equals the (k+1)-st elementary symmetric sum over s plus v i times the k-th elementary symmetric sum over s.
theorem elem_symm_on_insert {ι : Type*} [DecidableEq ι] (s : Finset ι) (i : ι) (hi : i ∉ s) (k : ℕ) (v : ι → ℝ) :
elem_symm_on (insert i s) (k + 1) v = elem_symm_on s (k + 1) v + v i * elem_symm_on s k velem_symm_on_posIn LeanCombinatorics for TCS
For a finite set s of indices, a natural number k with k ≤ |s|, and v : ι → ℝ with v i > 0 for all i in s, the k-th elementary symmetric sum of v over s is strictly positive.
theorem elem_symm_on_pos {ι : Type*} [DecidableEq ι] (s : Finset ι) (k : ℕ) (v : ι → ℝ)
(hv : ∀ i ∈ s, 0 < v i) (hk : k ≤ s.card) : 0 < elem_symm_on s k velem_symm_on_two_coordIn LeanCombinatorics for TCS
For natural numbers n and r with 2 ≤ r, distinct i j : Fin n and w : Fin n → ℝ, writing R = (univ \ {i}) \ {j} for the remaining indices, the r-th elementary symmetric sum of w over univ equals e_r(w over R) + (w i + w j) * e_{r-1}(w over R) + (w i * w j) * e_{r-2}(w over R).
theorem elem_symm_on_two_coord {n : ℕ} (r : ℕ) (hr : 2 ≤ r) (i j : Fin n) (hij : i ≠ j) (w : Fin n → ℝ) :
elem_symm_on (Finset.univ : Finset (Fin n)) r w =
elem_symm_on ((Finset.univ.erase i).erase j) r w +
(w i + w j) * elem_symm_on ((Finset.univ.erase i).erase j) (r - 1) w +
w i * w j * elem_symm_on ((Finset.univ.erase i).erase j) (r - 2) welem_symm_on_univIn LeanCombinatorics for TCS
For natural numbers n and k and v : Fin n → ℝ, the k-th elementary symmetric sum of v over the whole index set univ equals elem_symm k v.
theorem elem_symm_on_univ {n : ℕ} (k : ℕ) (v : Fin n → ℝ) :
elem_symm_on (Finset.univ : Finset (Fin n)) k v = elem_symm k vequal_weight_family_item_countIn LeanCombinatorics for TCS
If every chore visits every agent once across n rounds, then for any agent and set of chores the sum over rounds of the number of those chores assigned to that agent equals the set’s cardinality.
theorem equal_weight_family_item_count (n m : ℕ) (F : Fin n → Fin m → Fin n) (hbij : ∀ g, Function.Bijective (fun t => F t g)) (i : Fin n) (H : Finset (Fin m)) : (∑ t : Fin n, ((bundle_of (F t) i) ∩ H).card) = H.card
equidistant_sets_direction_orthogonalIn LeanCombinatorics for TCS
Let $X$ and $Y$ be finite nonempty subsets of a real inner product space $V$ such that every point $y \in Y$ is equidistant from all points of $X$. Then for all $x, x' \in X$ and $y, y' \in Y$, the inner product $\langle y - y', x - x'\rangle = 0$.
theorem equidistant_sets_direction_orthogonal {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
(X Y : Finset V) (hX : X.Nonempty) (hY : Y.Nonempty)
(h_dist : ∀ y ∈ Y, ∃ r : ℝ, ∀ x ∈ X, ‖y - x‖ = r)
(x : V) (hx : x ∈ X) (x' : V) (hx' : x' ∈ X)
(y : V) (hy : y ∈ Y) (y' : V) (hy' : y' ∈ Y) :
@inner ℝ V _ (y - y') (x - x') = 0euclidean_avoids_ap_of_radialIn LeanCombinatorics for TCS
Radial transfer lemma. Let α > 0 and S ⊆ ℝ. Suppose (hA) that for all r ≥ 0 and all t with t² ≤ r² at least one of r², r² + 2t + 1, r² + 4t + 4 lies in S, and (hB) that for all r ≥ 0 and all t with t² ≤ r² some member r² + 2kαt + k²α² with 0 ≤ k ≤ 20 lies outside S. Then the radial colouring x ↦ (‖x‖² ∈ S) has no all-false unit-spaced 3-term arithmetic progression and no all-true α-spaced 21-term arithmetic progression in any dimension n, i.e. euclidean_avoids_ap n 3 1 21 α.
theorem euclidean_avoids_ap_of_radial (α : ℝ) (hα : 0 < α) (S : Set ℝ)
(hA : ∀ r t : ℝ, 0 ≤ r → t ^ 2 ≤ r ^ 2 →
r ^ 2 ∈ S ∨ r ^ 2 + 2 * t + 1 ∈ S ∨ r ^ 2 + 4 * t + 4 ∈ S)
(hB : ∀ r t : ℝ, 0 ≤ r → t ^ 2 ≤ r ^ 2 →
∃ k : Fin 21, r ^ 2 + 2 * (k : ℝ) * α * t + (k : ℝ) ^ 2 * α ^ 2 ∉ S)
(n : ℕ) : euclidean_avoids_ap n 3 1 21 αeuclidean_avoids_ap_of_radial_acIn LeanCombinatorics for TCS
Second form of the radial transfer lemma, in the coordinates used by the periodic-certificate search: writing a = ‖x₀‖² − c² (≥ 0) and c = ⟨x₀, v⟩, the conclusion euclidean_avoids_ap n 3 1 21 α follows from (hA) for all a ≥ 0 and all c one of a + c², a + (c+1)², a + (c+2)² lies in S, and (hB) for all a ≥ 0 and all c some a + (c + kα)² with 0 ≤ k ≤ 20 lies outside S.
theorem euclidean_avoids_ap_of_radial_ac (α : ℝ) (hα : 0 < α) (S : Set ℝ)
(hA : ∀ a c : ℝ, 0 ≤ a → a + c ^ 2 ∈ S ∨ a + (c + 1) ^ 2 ∈ S ∨ a + (c + 2) ^ 2 ∈ S)
(hB : ∀ a c : ℝ, 0 ≤ a → ∃ k : Fin 21, a + (c + (k : ℝ) * α) ^ 2 ∉ S)
(n : ℕ) : euclidean_avoids_ap n 3 1 21 αeven_component_satisfies_recurrence_2_1In LeanCombinatorics for TCS
Let N ≥ 2, and let a, c : Fin (2 * N + 1) → ℝ satisfy condition (2.1) of size 2N with b = fun _ => 0. Then (even_component_a N a, even_component_b N a c, even_component_c N a c) satisfies condition (2.1) of size N.
theorem even_component_satisfies_recurrence_2_1
(N : ℕ) (hN : 2 ≤ N) (a c : Fin (2 * N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 (2 * N) a (fun _ => 0) c) :
satisfies_recurrence_2_1 N (even_component_a N a) (even_component_b N a c) (even_component_c N a c)even_le_seven_implies_le_sixIn LeanCombinatorics for TCS
If n is an even natural number and n ≤ 7, then n ≤ 6.
theorem even_le_seven_implies_le_six (n : ℕ) (heven : Even n) (hle : n ≤ 7) : n ≤ 6
exact_hirsch_diameter_of_disjoint_minimal_nonfacesIn LeanCombinatorics for TCS
Let Δ be an abstract simplicial complex on an n-element vertex set V, pure of facet size d, with connected dual graph. If the minimal nonfaces of Δ are pairwise disjoint and there are s such minimal nonfaces, then d = n - s, Δ is normal, and the diameter of the dual graph of Δ is exactly s = n - d.
theorem exact_hirsch_diameter_of_disjoint_minimal_nonfaces {V : Type*} [DecidableEq V] [Fintype V] (Δ : AbstractSimplicialComplex V) (n d s : ℕ) (hn : Fintype.card V = n) (hpure : simplicial_is_pure Δ d) (hconn : (simplicial_dual_graph Δ d).Connected) (M_set : Finset (Finset V)) (hs : M_set.card = s) (hM_all : ∀ M, simplicial_is_minimal_nonface Δ M ↔ M ∈ M_set) (hM_disj : ∀ M₁ ∈ M_set, ∀ M₂ ∈ M_set, M₁ ≠ M₂ → Disjoint M₁ M₂) : d = n - s ∧ simplicial_is_normal Δ d ∧ (simplicial_dual_graph Δ d).diam = s ∧ s = n - dexists_disjoint_finset_card_eqIn LeanCombinatorics for TCS
In an infinite type with decidable equality, for every finite set s and every natural number k, there exists a finite subset A of cardinality k disjoint from s.
theorem exists_disjoint_finset_card_eq {α : Type*} [DecidableEq α] [Infinite α]
(s : Finset α) (k : ℕ) :
∃ A : Finset α, A.card = k ∧ Disjoint A sexists_edge_and_unique_vertex_of_not_min_degree_twoIn LeanCombinatorics for TCS
If in a finite hypergraph some vertex of the union of the edges is contained in at most one edge, then there is an edge e and a vertex v ∈ e such that v belongs to no edge other than e.
theorem exists_edge_and_unique_vertex_of_not_min_degree_two {V : Type*} [DecidableEq V]
(F : Finset (Finset V))
(hfails : ¬ ∀ v ∈ F.biUnion id, 2 ≤ (F.filter (fun e => v ∈ e)).card) :
∃ e ∈ F, ∃ v ∈ e, ∀ f ∈ F, v ∈ f → f = eexists_high_rep_count_gt_of_not_memIn LeanCombinatorics for TCS
Let G be a finite abelian group of odd order N ≥ 21, A ⊆ G with |A| > N/2, and suppose g ∉ Σ₃(A). Then there is σ ∈ G with more than two ordered restricted pair representations from A, and indeed ν_A(σ) > N - 2|A| + 9.
theorem exists_high_rep_count_gt_of_not_mem {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G] {A : Finset G} {g : G} (hN : 21 ≤ Fintype.card G) (hodd : Fintype.card G % 2 = 1) (hA : Fintype.card G / 2 < A.card) (hg : g ∉ restrictedSumset A 3) : ∃ σ : G, 2 < orderedPairSumCount A σ ∧ (Fintype.card G : ℤ) - 2 * (A.card : ℤ) + 9 < (orderedPairSumCount A σ : ℤ)exists_nonbipartite_oas_digraphIn LeanCombinatorics for TCS
The directed graph D̃₂ is an oriented anti-Sidorenko directed graph whose underlying simple graph contains a 3-clique and is not bipartite: for every digraphon W satisfying is_digraphon W, d2_tilde_density W ≤ d2_tilde_density (digraphon_symmetrization W), there exists a 3-clique in digraph_d2_tilde_graph, and digraph_d2_tilde_graph is not bipartite.
theorem exists_nonbipartite_oas_digraph :
(∀ W, is_digraphon W → d2_tilde_density W ≤ d2_tilde_density (digraphon_symmetrization W)) ∧
(∃ s : Finset DigraphD2TildeVertex, digraph_d2_tilde_graph.IsNClique 3 s) ∧
¬ digraph_d2_tilde_graph.IsBipartiteexists_nonempty_zero_sum_zmod_prodIn LeanCombinatorics for TCS
Olson's theorem on the Davenport constant: when m divides n, every multiset of m + n − 1 elements of ZMod m × ZMod n contains a nonempty submultiset with sum zero; i.e. the Davenport constant of C_m × C_n is m + n − 1.
theorem exists_nonempty_zero_sum_zmod_prod (m n : ℕ) (hm : 1 ≤ m) (hn : 1 ≤ n) (hmn : m ∣ n) (S : Multiset (ZMod m × ZMod n)) (hcard : m + n - 1 ≤ S.card) : ∃ T : Multiset (ZMod m × ZMod n), T ≤ S ∧ T ≠ 0 ∧ T.sum = 0
exists_palette_record_indicesIn LeanCombinatorics for TCS
Given T ≥ 1 and D : ℕ → ℝ on [1, T] with sum at most kn, there exists a sequence of record minima indices r_0 = 1 < r_1 < ... < r_m ≤ T with D(r_l) non-increasing, step sum at most kn, and D(r_m) ≤ kn/T.
theorem exists_palette_record_indices (T k : ℕ) (n : ℝ) (hT : 0 < T) (D : ℕ → ℝ)
(hD_range : ∀ t ∈ Finset.Icc 1 T, 0 ≤ D t ∧ D t ≤ n)
(hD_sum : ∑ t ∈ Finset.Icc 1 T, D t ≤ k * n) :
∃ (m : ℕ) (r : ℕ → ℕ),
r 0 = 1 ∧
(∀ l ≤ m, 1 ≤ r l ∧ r l ≤ T) ∧
(∀ l < m, r l < r (l + 1)) ∧
(∀ l < m, D (r (l + 1)) ≤ D (r l)) ∧
(∀ l < m, (r (l + 1) - r l : ℝ) * D (r l) ≤ ∑ t ∈ Finset.Ico (r l) (r (l + 1)), D t) ∧
(∑ l ∈ Finset.range m, ((r (l + 1) : ℝ) - (r l : ℝ)) * D (r l) ≤ k * n) ∧
D (r m) ≤ k * n / Texists_perm_two_inflection_sign_patternNeeds helpCombinatorics for TCS
For any natural numbers k₁, m₁, k₂, m₂ satisfying 2 ≤ k₁ < m₁ < k₂ < m₂, there exists n : ℕ and a permutation σ : Equiv.Perm (Fin n) satisfying the two-inflection sign pattern.
theorem exists_perm_two_inflection_sign_pattern
(k₁ m₁ k₂ m₂ : ℕ) (hk1 : 2 ≤ k₁) (h1 : k₁ < m₁) (h12 : m₁ < k₂) (h2 : k₂ < m₂) :
∃ (n : ℕ) (σ : Equiv.Perm (Fin n)),
m₂ ≤ n - 1 ∧
0 < perm_second_derivative σ k₁ ∧
(∀ ℓ ∈ Finset.Ioo k₁ m₁, perm_second_derivative σ ℓ = 0) ∧
perm_second_derivative σ m₁ < 0 ∧
(∀ ℓ ∈ Finset.Ioo m₁ k₂, perm_second_derivative σ ℓ ≤ 0) ∧
perm_second_derivative σ k₂ < 0 ∧
(∀ ℓ ∈ Finset.Ioo k₂ m₂, perm_second_derivative σ ℓ = 0) ∧
0 < perm_second_derivative σ m₂ ∧
(∀ ℓ ∈ Finset.Ico 2 k₁, 0 ≤ perm_second_derivative σ ℓ) ∧
(∀ ℓ ∈ Finset.Ioc m₂ (n - 1), 0 ≤ perm_second_derivative σ ℓ)exists_sequence_length_thirty_two_no_zero_sum_sixIn LeanCombinatorics for TCS
There exists a multiset of 32 elements over (Fin 7 → Fin 2) × ZMod 6 that contains no submultiset of cardinality 6 with sum 0.
theorem exists_sequence_length_thirty_two_no_zero_sum_six :
∃ S : Multiset ((Fin 7 → Fin 2) × ZMod 6),
Multiset.card S = 32 ∧ ¬ ∃ T ≤ S, Multiset.card T = 6 ∧ Multiset.sum T = 0exists_two_pow_between_of_two_mul_leIn LeanCombinatorics for TCS
For real numbers 1 ≤ a and b with 2a ≤ b, there is a natural number r with a ≤ 2^r ≤ b.
theorem exists_two_pow_between_of_two_mul_le (a b : ℝ) (ha : 1 ≤ a) (h : 2 * a ≤ b) :
∃ r : ℕ, a ≤ (2 : ℝ) ^ r ∧ (2 : ℝ) ^ r ≤ bexists_two_roots_second_deriv_of_four_rootsIn LeanCombinatorics for TCS
If f, g, h are functions on ℝ with f' = g and g' = h everywhere, and f has four ordered roots t₁ < t₂ < t₃ < t₄ in (a, b), then h has two ordered roots v₁ < v₂ in (a, b).
theorem exists_two_roots_second_deriv_of_four_roots (f g h : ℝ → ℝ)
(hfg : ∀ t, HasDerivAt f (g t) t) (hgh : ∀ t, HasDerivAt g (h t) t)
(a b : ℝ) (t₁ t₂ t₃ t₄ : ℝ)
(ha₁ : a < t₁) (h₁₂ : t₁ < t₂) (h₂₃ : t₂ < t₃) (h₃₄ : t₃ < t₄) (h₄b : t₄ < b)
(hf₁ : f t₁ = 0) (hf₂ : f t₂ = 0) (hf₃ : f t₃ = 0) (hf₄ : f t₄ = 0) :
∃ v₁ v₂ : ℝ, v₁ ∈ Set.Ioo a b ∧ v₂ ∈ Set.Ioo a b ∧ v₁ < v₂ ∧ h v₁ = 0 ∧ h v₂ = 0extension_depth_bound_of_pattern_containmentIn LeanCombinatorics for TCS
Let B be a set of lists of natural numbers. If π and σ are standard permutations of natural numbers from 1 to their length that avoid all patterns in B, and σ pattern-contains π, and all standard B-avoiding extensions of π have depth at most D (every standard B-avoiding permutation π' with π'.filter (· ≤ π.length) = π satisfies π'.length - π.length ≤ D), then every standard B-avoiding extension σ' of σ with σ'.filter (· ≤ σ.length) = σ satisfies σ'.length - σ.length ≤ D.
theorem extension_depth_bound_of_pattern_containment
(B : Set (List ℕ)) (π σ : List ℕ)
(hπ_perm : π.Perm (List.range' 1 π.length))
(hπ_av : ∀ β ∈ B, ¬ pattern_contains π β)
(hσ_perm : σ.Perm (List.range' 1 σ.length))
(hσ_av : ∀ β ∈ B, ¬ pattern_contains σ β)
(hle : pattern_contains σ π) (D : ℕ)
(hD : ∀ π' : List ℕ, π'.Perm (List.range' 1 π'.length) →
(∀ β ∈ B, ¬ pattern_contains π' β) →
π'.filter (· ≤ π.length) = π →
π'.length - π.length ≤ D) :
∀ σ' : List ℕ, σ'.Perm (List.range' 1 σ'.length) →
(∀ β ∈ B, ¬ pattern_contains σ' β) →
σ'.filter (· ≤ σ.length) = σ →
σ'.length - σ.length ≤ Dextension_depth_mono_of_pattern_containmentIn LeanCombinatorics for TCS
Let B be a set of lists of natural numbers. If π and σ are standard permutations of natural numbers from 1 to their length (π.Perm (List.range' 1 π.length) and σ.Perm (List.range' 1 σ.length)) that avoid all patterns in B (∀ β ∈ B, ¬ pattern_contains · β), and σ pattern-contains π (pattern_contains σ π), then for every natural number k, if σ has a standard B-avoiding extension of depth k (a standard B-avoiding permutation σ' with σ'.filter (· ≤ σ.length) = σ and σ'.length = σ.length + k), then π also has a standard B-avoiding extension of depth k (a standard B-avoiding permutation π' with π'.filter (· ≤ π.length) = π and π'.length = π.length + k).
theorem extension_depth_mono_of_pattern_containment
(B : Set (List ℕ)) (π σ : List ℕ)
(hπ_perm : π.Perm (List.range' 1 π.length))
(hπ_av : ∀ β ∈ B, ¬ pattern_contains π β)
(hσ_perm : σ.Perm (List.range' 1 σ.length))
(hσ_av : ∀ β ∈ B, ¬ pattern_contains σ β)
(hle : pattern_contains σ π) (k : ℕ)
(h_ext : ∃ σ' : List ℕ, σ'.Perm (List.range' 1 σ'.length) ∧
(∀ β ∈ B, ¬ pattern_contains σ' β) ∧
σ'.filter (· ≤ σ.length) = σ ∧ σ'.length = σ.length + k) :
∃ π' : List ℕ, π'.Perm (List.range' 1 π'.length) ∧
(∀ β ∈ B, ¬ pattern_contains π' β) ∧
π'.filter (· ≤ π.length) = π ∧ π'.length = π.length + kextremal_exchange_nterm_zero_sumIn LeanCombinatorics for TCS
Let S be a sequence over (Z/nZ)^r of length s(G)-1 with no n-term zero sum. If a occurs in S and y + z = a, then the sequence obtained by replacing one occurrence of a by the two terms y, z has length s(G) and hence contains a submultiset T of cardinality n with sum 0; moreover every such T uses the copy of y or the copy of z, because a zero-sum T avoiding both would already be an n-term zero sum of S.
theorem extremal_exchange_nterm_zero_sum
(n r : ℕ) [NeZero n] (S : Multiset (Fin r → ZMod n))
(hS_card : S.card = sInf { k : ℕ | ∀ S' : Multiset (Fin r → ZMod n), S'.card = k → ∃ T ≤ S', T.card = n ∧ T.sum = 0 } - 1)
(hS_zs : 0 ∉ ((S.powersetCard n).map Multiset.sum).toFinset)
{a y z : Fin r → ZMod n} (ha : a ∈ S) (hyz : y + z = a) :
∃ T ≤ S - {a} + {y, z}, T.card = n ∧ T.sum = 0 ∧ (y ∈ T ∨ z ∈ T)extremal_is_maximal_zero_sum_freeIn LeanCombinatorics for TCS
An extremal sequence S of length s(G) - 1 with no n-term zero-sum subsequence is maximal zero-sum free.
theorem extremal_is_maximal_zero_sum_free
(n r : ℕ) [NeZero n] (S : Multiset (Fin r → ZMod n))
(hS_card : S.card = sInf { k : ℕ | ∀ S' : Multiset (Fin r → ZMod n), S'.card = k → ∃ T ≤ S', T.card = n ∧ T.sum = 0 } - 1)
(hS_zs : 0 ∉ ((S.powersetCard n).map Multiset.sum).toFinset) :
is_maximal_zero_sum_free n Sextremal_number_eq_choose_three_of_lt_two_mulIn LeanCombinatorics for TCS
If n < 2ℓ then no 3-uniform hypergraph on Fin n contains the zycle Z_ℓ (which has 2ℓ vertices), so the extremal number equals the number of all triples: extremal_number n (zycle ℓ) = n.choose 3.
theorem extremal_number_eq_choose_three_of_lt_two_mul (ℓ n : ℕ) [NeZero ℓ] (h : n < 2 * ℓ) : extremal_number n (zycle ℓ) = n.choose 3
extremal_number_four_zycle_four_ne_turan_cardIn LeanCombinatorics for TCS
For ℓ = 4 the equality extremal_number n (zycle 4) = (turan_hypergraph n).card fails at n = 4: Z_4 has 8 vertices, so every 3-uniform hypergraph on 4 vertices is Z_4-free and extremal_number 4 (zycle 4) = C(4,3) = 4, whereas (turan_hypergraph 4).card = 3. Hence the 'eventually in n' quantifier in the target is essential and cannot be dropped.
theorem extremal_number_four_zycle_four_ne_turan_card : extremal_number 4 (zycle 4) ≠ (turan_hypergraph 4).card
extremal_number_ge_of_freeIn LeanCombinatorics for TCS
Every F-free 3-uniform hypergraph H on Fin n has at most extremal_number n F edges, because the extremal number is a supremum over exactly these hypergraphs.
theorem extremal_number_ge_of_free {n : ℕ} {W : Type*} (F : Finset (Finset W)) (H : Finset (Finset (Fin n))) (h_uniform : is_three_uniform H) (h_free : is_hypergraph_free H F) : H.card ≤ extremal_number n Fextremal_number_le_choose_threeIn LeanCombinatorics for TCS
A 3-uniform hypergraph on Fin n has at most C(n,3) edges, so the extremal number extremal_number n F is at most n.choose 3 for any forbidden family F.
theorem extremal_number_le_choose_three (n : ℕ) {W : Type*} (F : Finset (Finset W)) : extremal_number n F ≤ n.choose 3extremal_sequence_has_term_multiplicity_predIn LeanCombinatorics for TCS
Weak Property D: Every extremal zero-sum-free sequence S of length s(G) - 1 over (Z/nZ)^r contains at least one term of multiplicity n - 1.
theorem extremal_sequence_has_term_multiplicity_pred
(n r : ℕ) [NeZero n] (hr : 1 ≤ r) (S : Multiset (Fin r → ZMod n))
(hS_card : S.card = sInf { k : ℕ | ∀ S' : Multiset (Fin r → ZMod n), S'.card = k → ∃ T ≤ S', T.card = n ∧ T.sum = 0 } - 1)
(hS_zs : 0 ∉ ((S.powersetCard n).map Multiset.sum).toFinset) :
∃ t : Fin r → ZMod n, S.count t = n - 1extremal_subsequence_sums_cover_of_term_mul_predIn LeanCombinatorics for TCS
Let S be a sequence over (Z/nZ)^r of length s(G)-1 (in the sInf form) with no n-term zero sum, and suppose in addition that some element occurs exactly n-1 times in S. Then the set of sums of all length-n subsequences of S equals (Z/nZ)^r \ {0}.
theorem extremal_subsequence_sums_cover_of_term_mul_pred
(n r : ℕ) [NeZero n] (hr : 1 ≤ r) (S : Multiset (Fin r → ZMod n))
(hS_card : S.card = sInf { k : ℕ | ∀ S' : Multiset (Fin r → ZMod n), S'.card = k → ∃ T ≤ S', T.card = n ∧ T.sum = 0 } - 1)
(hS_zs : 0 ∉ ((S.powersetCard n).map Multiset.sum).toFinset)
(hcount : ∃ t : Fin r → ZMod n, S.count t = n - 1) :
((S.powersetCard n).map Multiset.sum).toFinset = Finset.univ \ {0}extremal_vertex_bound_bounded_child_subtree_label_overlapIn LeanCombinatorics for TCS
Fix natural numbers C and q. For any type α with decidable equality and any binary tree t : BinaryTree α, if (binary_tree_labels t).card ≤ q, binary_tree_no_ancestor_descendant_repeat t, and binary_tree_bounded_child_overlap C t, then t.numNodes ≤ extremal_tree_vertex_bound C q.
theorem extremal_vertex_bound_bounded_child_subtree_label_overlap
(C q : ℕ) {α : Type*} [DecidableEq α] (t : BinaryTree α)
(hq : (binary_tree_labels t).card ≤ q)
(h_anc : binary_tree_no_ancestor_descendant_repeat t)
(h_overlap : binary_tree_bounded_child_overlap C t) :
t.numNodes ≤ extremal_tree_vertex_bound C qf2_character_sum_seven_plus_one_eq_zero_iffIn LeanCombinatorics for TCS
For any vector v in Fin 7 → ZMod 2, the character sum 1 + ∑ i, (-1)^(v i) vanishes if and only if v has Hamming weight 4.
open scoped BigOperators in
theorem f2_character_sum_seven_plus_one_eq_zero_iff (v : Fin 7 → ZMod 2) :
(1 : ℤ) + ∑ i : Fin 7, (-1 : ℤ) ^ (v i).val = 0 ↔
(Finset.univ.filter (fun i : Fin 7 => v i = 1)).card = 4f2_character_sum_split_pointIn LeanCombinatorics for TCS
For any subset T of Fin d → ZMod 2, element t0 ∈ T, and x in Fin d → ZMod 2, the character sum factors into (-1)^(x · t0) times (1 + ∑ t in T \ {t0}, (-1)^(x · (t - t0))).
open scoped Matrix BigOperators in
theorem f2_character_sum_split_point (d : ℕ) (T : Finset (Fin d → ZMod 2))
(t0 : Fin d → ZMod 2) (ht0 : t0 ∈ T) (x : Fin d → ZMod 2) :
∑ t ∈ T, (-1 : ℤ) ^ (dotProduct x t).val =
(-1 : ℤ) ^ (dotProduct x t0).val *
(1 + ∑ t ∈ T.erase t0, (-1 : ℤ) ^ (dotProduct x (t - t0)).val)f2_eval_map_finrank_ge_threeIn LeanCombinatorics for TCS
For any 7 distinct nonzero vectors in Fin d → ZMod 2, the evaluation linear map from Fin d → ZMod 2 to Fin 7 → ZMod 2 has rank at least 3.
open scoped Matrix in
theorem f2_eval_map_finrank_ge_three (d : ℕ) (v : Matrix (Fin 7) (Fin d) (ZMod 2))
(hinj : Function.Injective v) (hzero : ∀ i, v i ≠ 0) :
3 ≤ Module.finrank (ZMod 2) (LinearMap.range v.mulVecLin)f2_linear_map_fiber_liftIn LeanCombinatorics for TCS
Given a linear map f from Fin d → ZMod 2 to Fin 7 → ZMod 2 with image dimension r and a subset S of the image of cardinality 2^(r - 3), S can be lifted to a subset B in Fin d → ZMod 2 of cardinality 2^(d - 3) such that differences in B map either to distinct elements of S or to 0.
open scoped Classical in
theorem f2_linear_map_fiber_lift (d : ℕ)
(f : (Fin d → ZMod 2) →ₗ[ZMod 2] (Fin 7 → ZMod 2))
(S : Finset (Fin 7 → ZMod 2)) (hS : ↑S ⊆ (LinearMap.range f : Set (Fin 7 → ZMod 2)))
(r : ℕ) (hr : Module.finrank (ZMod 2) (LinearMap.range f) = r)
(hScard : S.card = 2 ^ (r - 3)) (hrd : 3 ≤ r) (hdr : r ≤ d) :
∃ B : Finset (Fin d → ZMod 2), B.card = 2 ^ (d - 3) ∧
(∀ b ∈ B, f b ∈ S) ∧
∀ b ∈ B, ∀ b' ∈ B, b ≠ b' →
(f b ≠ f b' ∧ f (b + b') = f b + f b') ∨ (f b = f b' ∧ f (b + b') = 0)f2_simplex_antipodal_diff_weight_ne_fourIn LeanCombinatorics for TCS
There exists a subset B of Fin 7 → ZMod 2 of cardinality 16 such that any two distinct elements differ by a vector of Hamming weight not equal to 4.
theorem f2_simplex_antipodal_diff_weight_ne_four :
∃ B : Finset (Fin 7 → ZMod 2), B.card = 16 ∧
∀ x ∈ B, ∀ y ∈ B, x ≠ y →
(Finset.univ.filter (fun i : Fin 7 => (x + y) i = 1)).card ≠ 4f2_submodule_coset_pigeonholeIn LeanCombinatorics for TCS
For any subspace U in Fin 7 → ZMod 2 of dimension r ≥ 3 and any 16-element subset S, there exists a coset of U containing at least 2^(r - 3) elements of S.
open scoped Classical in
theorem f2_submodule_coset_pigeonhole
(U : Submodule (ZMod 2) (Fin 7 → ZMod 2)) (hU : 3 ≤ Module.finrank (ZMod 2) U)
(S : Finset (Fin 7 → ZMod 2)) (hS : S.card = 16) :
∃ c : Fin 7 → ZMod 2, 2 ^ (Module.finrank (ZMod 2) U - 3) ≤
(S.filter (fun x => x - c ∈ U)).cardf2_subset_eight_universal_spectrumIn LeanCombinatorics for TCS
Let d ≥ 3. For every subset T of Fin d → ZMod 2 with cardinality 8, there exists a subset B of Fin d → ZMod 2 of cardinality 2^(d - 3) such that for all distinct b, b' ∈ B, the character sum ∑ t ∈ T, (-1 : ℤ) ^ (dotProduct (b + b') t).val is nonzero.
open scoped Matrix in
theorem f2_subset_eight_universal_spectrum (d : ℕ) (hd : 3 ≤ d)
(T : Finset (Fin d → ZMod 2)) (hT : T.card = 8) :
∃ B : Finset (Fin d → ZMod 2), B.card = 2 ^ (d - 3) ∧
∀ b ∈ B, ∀ b' ∈ B, b ≠ b' → ∑ t ∈ T, (-1 : ℤ) ^ (dotProduct (b + b') t).val ≠ 0factorial_mul_pow_le_pow_two_mulIn LeanCombinatorics for TCS
For natural numbers k ≤ n, k! * n^k ≤ n^(2n).
theorem factorial_mul_pow_le_pow_two_mul (k n : ℕ) (h : k ≤ n) :
Nat.factorial k * n ^ k ≤ n ^ (2 * n)fano_cube_sum_eq_double_countIn LeanCombinatorics for TCS
Double counting: for a 3-uniform H, ∑ x A(x)^3 = 2 · ∑_{e ∈ H} ∑_{x ∈ e} A(x)^2, since A(x) is twice the number of edges containing x.
theorem fano_cube_sum_eq_double_count {V : Type*} [Fintype V] [DecidableEq V]
(H : Finset (Finset V)) (hunif : is_three_uniform H) :
(∑ x : V, (∑ y : V, ∑ z : V, fano_triple_indicator H x y z) ^ 3)
= 2 * (∑ e ∈ H, ∑ x ∈ e, (∑ y : V, ∑ z : V, fano_triple_indicator H x y z) ^ 2)fano_degree_cube_sum_leIn LeanCombinatorics for TCS
For a 3-uniform Fano-free hypergraph H on n vertices, if A(x) = ∑ y ∑ z [insert x {y,z} ∈ H] (= twice the degree of x) then ∑ x A(x)^3 ≤ 4 n^4 |H|.
theorem fano_degree_cube_sum_le {V : Type*} [Fintype V] [DecidableEq V]
(H : Finset (Finset V)) (hunif : is_three_uniform H) (hfree : is_fano_free H) :
(∑ x : V, (∑ y : V, ∑ z : V, fano_triple_indicator H x y z) ^ 3)
≤ 4 * (Fintype.card V : ℝ) ^ 4 * (H.card : ℝ)fano_degree_eq_two_mul_card_filterIn LeanCombinatorics for TCS
In a 3-uniform hypergraph H, the number A(x) = ∑ y ∑ z [insert x {y,z} ∈ H] of ordered pairs (y,z) with {x,y,z} ∈ H equals twice the degree of x, i.e. twice the number of hyperedges of H containing x.
theorem fano_degree_eq_two_mul_card_filter {V : Type*} [Fintype V] [DecidableEq V]
(H : Finset (Finset V)) (hunif : is_three_uniform H) (x : V) :
(∑ y : V, ∑ z : V, fano_triple_indicator H x y z)
= 2 * ((H.filter (fun e => x ∈ e)).card : ℝ)fano_edge_quad_boundIn LeanCombinatorics for TCS
Local Fano bound: for a 3-uniform Fano-free H, an edge {x,y,z} ∈ H and vertices a,b,c,d, the sum [x,a,b][x,c,d] + [y,a,c][y,b,d] + [z,a,d][z,b,c] of three products of edge indicators is at most 2 — the value 3 would exhibit a Fano plane.
theorem fano_edge_quad_bound {V : Type*} [DecidableEq V]
(H : Finset (Finset V)) (hunif : is_three_uniform H) (hfree : is_fano_free H)
(x y z a b c d : V) (hxyz : {x, y, z} ∈ H) :
fano_triple_indicator H x a b * fano_triple_indicator H x c d
+ fano_triple_indicator H y a c * fano_triple_indicator H y b d
+ fano_triple_indicator H z a d * fano_triple_indicator H z b c ≤ 2fano_edge_sq_sum_boundIn LeanCombinatorics for TCS
For a 3-uniform Fano-free H and an edge {x,y,z} ∈ H: A(x)^2 + A(y)^2 + A(z)^2 ≤ 2·|V|^4, where A(u) = ∑ p ∑ q [insert u {p,q} ∈ H]. Obtained by summing the local 6-term bound over all (a,b,c,d) ∈ V^4.
theorem fano_edge_sq_sum_bound {V : Type*} [Fintype V] [DecidableEq V]
(H : Finset (Finset V)) (hunif : is_three_uniform H) (hfree : is_fano_free H)
(x y z : V) (hxyz : {x, y, z} ∈ H) :
(∑ p : V, ∑ q : V, fano_triple_indicator H x p q) ^ 2
+ (∑ p : V, ∑ q : V, fano_triple_indicator H y p q) ^ 2
+ (∑ p : V, ∑ q : V, fano_triple_indicator H z p q) ^ 2
≤ 2 * (Fintype.card V : ℝ) ^ 4fano_erase_fiber_twoIn LeanCombinatorics for TCS
In a 3-uniform hypergraph H, for a hyperedge e ∈ H and a vertex x ∈ e, the number of ordered pairs (y,z) with {x,y,z} = e is exactly 2: the fibre of (y,z) ↦ insert x {y,z} over e has two elements.
theorem fano_erase_fiber_two {V : Type*} [Fintype V] [DecidableEq V]
(H : Finset (Finset V)) (hunif : is_three_uniform H) (x : V) (e : Finset V)
(he : e ∈ H) (hxe : x ∈ e) :
(∑ y : V, ∑ z : V, (if insert x ({y, z} : Finset V) = e then (1:ℝ) else 0)) = 2fano_free_three_uniform_hypergraph_edge_boundIn LeanCombinatorics for TCS
Every 3-uniform hypergraph H : Finset (Finset V) on a finite vertex type V with decidable equality that is Fano-free (is_fano_free H) has cardinality at most Real.sqrt (2 / 3) * (Fintype.card V : ℝ) ^ 3 / 6.
theorem fano_free_three_uniform_hypergraph_edge_bound
{V : Type*} [Fintype V] [DecidableEq V]
(H : Finset (Finset V)) (hunif : is_three_uniform H) (hfree : is_fano_free H) :
(H.card : ℝ) ≤ Real.sqrt (2 / 3) * (Fintype.card V : ℝ) ^ 3 / 6fano_holder_assemblyIn LeanCombinatorics for TCS
Real-arithmetic assembly: if A : V → ℝ is nonnegative with ∑ x A(x) = 6|H| and ∑ x A(x)^3 ≤ 4|V|^4|H|, then |H| ≤ sqrt(2/3) * |V|^3 / 6.
theorem fano_holder_assembly {V : Type*} [Fintype V]
(H : Finset (Finset V)) (A : V → ℝ)
(hnn : ∀ x, 0 ≤ A x)
(h1 : (∑ x : V, A x) = 6 * (H.card : ℝ))
(h2 : (∑ x : V, (A x) ^ 3) ≤ 4 * (Fintype.card V : ℝ) ^ 4 * (H.card : ℝ)) :
(H.card : ℝ) ≤ Real.sqrt (2 / 3) * (Fintype.card V : ℝ) ^ 3 / 6fano_triple_sum_eq_six_mul_cardIn LeanCombinatorics for TCS
In a 3-uniform hypergraph H, the number of ordered triples (x,y,z) of vertices with {x,y,z} ∈ H, counted as ∑ x ∑ y ∑ z [insert x {y,z} ∈ H], equals 6|H|, because every hyperedge has exactly three elements and hence exactly six orderings.
theorem fano_triple_sum_eq_six_mul_card {V : Type*} [Fintype V] [DecidableEq V]
(H : Finset (Finset V)) (hunif : is_three_uniform H) :
(∑ x : V, ∑ y : V, ∑ z : V, fano_triple_indicator H x y z) = 6 * (H.card : ℝ)fibonacci_attractor_basis_coverage_antichainIn LeanCombinatorics for TCS
For every integer n ≥ 7, the occurrence coverages of the basis words in fibonacci_attractor_basis n form an antichain under inclusion: if Cov(u) ⊆ Cov(v) for u, v ∈ B_n, then u = v.
theorem fibonacci_attractor_basis_coverage_antichain (n : ℕ) (hn : 7 ≤ n) :
∀ u ∈ fibonacci_attractor_basis n, ∀ v ∈ fibonacci_attractor_basis n,
word_occurrence_coverage (fibonacci_word n) u ⊆ word_occurrence_coverage (fibonacci_word n) v → u = vfibonacci_attractor_basis_coverage_antichain_boundaryIn LeanCombinatorics for TCS
For n ≥ 7 and indices a, b in [3, n − 4] of the same parity as n, if the coverage of the boundary word E_a in F_n is contained in the coverage of E_b, then a = b.
theorem fibonacci_attractor_basis_coverage_antichain_boundary (n a b : ℕ) (hn : 7 ≤ n)
(ha : a ∈ Finset.Icc 3 (n - 4)) (hpa : a % 2 = n % 2)
(hb : b ∈ Finset.Icc 3 (n - 4)) (hpb : b % 2 = n % 2)
(hsub : word_occurrence_coverage (fibonacci_word n) (fibonacci_boundary_word a) ⊆
word_occurrence_coverage (fibonacci_word n) (fibonacci_boundary_word b)) : a = bfibonacci_attractor_basis_coverage_antichain_singularIn LeanCombinatorics for TCS
For n ≥ 7 and indices a, b < n − 1, if the coverage of the singular word S_a in F_n is contained in the coverage of S_b, then a = b.
theorem fibonacci_attractor_basis_coverage_antichain_singular (n a b : ℕ) (hn : 7 ≤ n)
(ha : a < n - 1) (hb : b < n - 1)
(hsub : word_occurrence_coverage (fibonacci_word n) (fibonacci_singular_word a) ⊆
word_occurrence_coverage (fibonacci_word n) (fibonacci_singular_word b)) : a = bfibonacci_attractor_basis_coverage_incomparable_crossIn LeanCombinatorics for TCS
For n ≥ 7, an index a < n − 1 and an index b in [3, n − 4] with b ≡ n (mod 2), neither the coverage of the singular word S_a contains nor is contained in the coverage of the boundary word E_b.
theorem fibonacci_attractor_basis_coverage_incomparable_cross (n a b : ℕ) (hn : 7 ≤ n)
(ha : a < n - 1) (hb : b ∈ Finset.Icc 3 (n - 4)) (hpb : b % 2 = n % 2) :
¬ (word_occurrence_coverage (fibonacci_word n) (fibonacci_singular_word a) ⊆
word_occurrence_coverage (fibonacci_word n) (fibonacci_boundary_word b)) ∧
¬ (word_occurrence_coverage (fibonacci_word n) (fibonacci_boundary_word b) ⊆
word_occurrence_coverage (fibonacci_word n) (fibonacci_singular_word a))fibonacci_attractor_basis_ne_nilIn LeanCombinatorics for TCS
For any natural number n, every word in fibonacci_attractor_basis n is nonempty.
theorem fibonacci_attractor_basis_ne_nil (n : ℕ) (u : List Bool) (hu : u ∈ fibonacci_attractor_basis n) : u ≠ []
fibonacci_attractor_basis_subset_factorsIn LeanCombinatorics for TCS
For every integer n ≥ 7, every word u in fibonacci_attractor_basis n is nonempty and occurs as a factor (infix) of the n-th Fibonacci word fibonacci_word n.
theorem fibonacci_attractor_basis_subset_factors (n : ℕ) (hn : 7 ≤ n) :
∀ u ∈ fibonacci_attractor_basis n, u ≠ [] ∧ u <:+: fibonacci_word nfibonacci_boundary_word_factorIn LeanCombinatorics for TCS
If j + 3 ≤ n then the j-th boundary word E_j occurs as a factor of the n-th Fibonacci word F_n.
theorem fibonacci_boundary_word_factor (j n : ℕ) (h : j + 3 ≤ n) :
fibonacci_boundary_word j <:+: fibonacci_word nfibonacci_factor_coverage_contains_basis_coverageIn LeanCombinatorics for TCS
For every integer n ≥ 7 and every nonempty factor x of the n-th Fibonacci word F_n, there exists a word u in the attractor basis B_n whose occurrence coverage in F_n is contained in that of x.
theorem fibonacci_factor_coverage_contains_basis_coverage (n : ℕ) (hn : 7 ≤ n) :
∀ x : List Bool, x ≠ [] → x <:+: fibonacci_word n →
∃ u ∈ fibonacci_attractor_basis n,
word_occurrence_coverage (fibonacci_word n) u ⊆ word_occurrence_coverage (fibonacci_word n) xfibonacci_long_factor_coverage_contains_basis_coverageIn LeanCombinatorics for TCS
For n ≥ 7, every factor x of F_n with |x| ≥ 4 has an occurrence that contains an occurrence of some word of the attractor basis B_n, with the basis occurrence starting at least one position before x's end; equivalently, x's coverage contains the coverage of some basis word. (The hypothesis |x| ≥ 4 is the crux case; shorter factors are covered separately.)
theorem fibonacci_long_factor_coverage_contains_basis_coverage (n : ℕ) (hn : 7 ≤ n)
(x : List Bool) (hx : 4 ≤ x.length) (hxw : x <:+: fibonacci_word n) :
∃ u ∈ fibonacci_attractor_basis n,
word_occurrence_coverage (fibonacci_word n) u ⊆ word_occurrence_coverage (fibonacci_word n) xfibonacci_short_factor_coverage_contains_basis_coverageIn LeanCombinatorics for TCS
For n ≥ 7, every nonempty factor x of F_n with |x| ≤ 3 contains the coverage of a word of the attractor basis B_n.
theorem fibonacci_short_factor_coverage_contains_basis_coverage (n : ℕ) (hn : 7 ≤ n)
(x : List Bool) (hx : x ≠ []) (hxl : x.length ≤ 3) (hxw : x <:+: fibonacci_word n) :
∃ u ∈ fibonacci_attractor_basis n,
word_occurrence_coverage (fibonacci_word n) u ⊆ word_occurrence_coverage (fibonacci_word n) xfibonacci_singular_word_factorIn LeanCombinatorics for TCS
If j + 2 ≤ n then the j-th singular word S_j occurs as a factor of the n-th Fibonacci word F_n.
theorem fibonacci_singular_word_factor (j n : ℕ) (h : j + 2 ≤ n) :
fibonacci_singular_word j <:+: fibonacci_word nfibonacci_word_lengthIn LeanCombinatorics for TCS
The n-th Fibonacci word has length the (n+2)-nd Fibonacci number: |F_n| = fib (n+2).
theorem fibonacci_word_length (n : ℕ) : (fibonacci_word n).length = Nat.fib (n + 2)
fibonacci_word_ne_nilIn LeanCombinatorics for TCS
Every Fibonacci word is nonempty.
theorem fibonacci_word_ne_nil (n : ℕ) : fibonacci_word n ≠ []
fibonacci_word_prefixIn LeanCombinatorics for TCS
If j ≤ n then the j-th Fibonacci word F_j is a prefix of the n-th Fibonacci word F_n.
theorem fibonacci_word_prefix (j n : ℕ) (h : j ≤ n) : fibonacci_word j <+: fibonacci_word n
fibre_k_regular_extensionIn LeanCombinatorics for TCS
Regularisation of a bipartite multigraph in fibre form: if every fibre of f and of g has at most k elements, then the multigraph embeds into a k-regular bipartite multigraph, i.e. there are a finite type β, an injection ι : α → β and fibre maps f', g' on β with f' ∘ ι = f, g' ∘ ι = g, and every fibre of f' and of g' either empty or of size exactly k.
theorem fibre_k_regular_extension {α : Type*} [Fintype α] (f g : α → ℕ) (k : ℕ)
(hf : ∀ γ : ℕ, {e | f e = γ}.ncard ≤ k) (hg : ∀ γ : ℕ, {e | g e = γ}.ncard ≤ k) :
∃ (β : Type) (_ : Fintype β) (f' g' : β → ℕ) (ι : α → β),
Function.Injective ι ∧ (∀ e, f' (ι e) = f e) ∧ (∀ e, g' (ι e) = g e) ∧
(∀ γ : ℕ, {b : β | f' b = γ}.ncard = k ∨ {b : β | f' b = γ}.ncard = 0) ∧
(∀ γ : ℕ, {b : β | g' b = γ}.ncard = k ∨ {b : β | g' b = γ}.ncard = 0)fin_r_zmod_exponentIn LeanCombinatorics for TCS
For r ≥ 1 and n ≥ 1, the exponent of the additive abelian group (Z/nZ)^r is n.
theorem fin_r_zmod_exponent (n r : ℕ) [NeZero n] (hr : 1 ≤ r) :
AddMonoid.exponent (Fin r → ZMod n) = nfinite_bh_counting_boundIn LeanCombinatorics for TCS
The standard finite counting bound for B_h sets (paper (1.1)): if h ≥ 1 and S ⊆ [1,n] is a finite B_h set, then |S|^h ≤ h! · h · n. Equivalently C(|S|+h-1, h) ≤ h n, since the h-term sums of S are all distinct and lie in [h, hn].
open scoped Classical in
theorem finite_bh_counting_bound (h n : ℕ) (h1 : 1 ≤ h) (S : Finset ℕ) (hS1 : ∀ x ∈ S, 1 ≤ x)
(hSn : ∀ x ∈ S, x ≤ n) (hSbh : is_bh h (S : Set ℕ)) :
(S.card) ^ h ≤ h.factorial * (h * n)finite_bipartite_surplus_crownIn LeanCombinatorics for TCS
Given finite sets I and E with |I|>|E| and a nonempty subset N(x) of E for each x in I, there are nonempty C⊆I and H=N(C)⊆E with |H|<|C| and an injective choice of a neighboring member of C for every element of H.
theorem finite_bipartite_surplus_crown {α β : Type*} [DecidableEq α] [DecidableEq β] (I : Finset α) (E : Finset β) (N : α → Finset β) (hN : ∀ x ∈ I, N x ⊆ E ∧ (N x).Nonempty) (hsurplus : E.card < I.card) : ∃ (C : Finset α) (H : Finset β), C ⊆ I ∧ H ⊆ E ∧ H = C.biUnion N ∧ H.Nonempty ∧ H.card < C.card ∧ ∃ f : {e : β // e ∈ H} → {x : α // x ∈ C}, Function.Injective f ∧ ∀ e, e.val ∈ N (f e).valfinite_cycle_edge_three_coloring_from_tip_setIn LeanCombinatorics for TCS
A cyclic sequence of at least three edges can be properly colored from any finite set of at least three tips: adjacent positions, including the last and first, receive different tips.
theorem finite_cycle_edge_three_coloring_from_tip_set {α : Type*} [DecidableEq α] (k : ℕ) (hk : 3 ≤ k) (C : Finset α) (hC : 3 ≤ C.card) : ∃ f : Fin k → α, (∀ i, f i ∈ C) ∧ ∀ i : Fin k, f i ≠ f ⟨(i.val + 1) % k, Nat.mod_lt _ (by omega)⟩finite_edge_family_coloring_from_two_disjoint_pairsIn LeanCombinatorics for TCS
A finite family of unordered pairs with two vertex-disjoint pairs of distinct members can be properly colored from any set containing at least two fewer colors than members.
theorem finite_edge_family_coloring_from_two_disjoint_pairs {V α : Type*} [DecidableEq V] [DecidableEq α] (E : Finset (Sym2 V)) (C : Finset α) (hC : E.card ≤ C.card + 2) (hpair : ∃ e₁ ∈ E, ∃ e₂ ∈ E, ∃ e₃ ∈ E, ∃ e₄ ∈ E, ({e₁,e₂,e₃,e₄} : Finset (Sym2 V)).card = 4 ∧ Disjoint e₁.toFinset e₂.toFinset ∧ Disjoint e₃.toFinset e₄.toFinset) : ∃ f : Sym2 V → α, (∀ e ∈ E, f e ∈ C) ∧ ∀ e ∈ E, ∀ g ∈ E, e ≠ g → ¬ Disjoint e.toFinset g.toFinset → f e ≠ f gfinite_functional_star_graph_half_independenceIn LeanCombinatorics for TCS
There are two vertices for every index i. Each index makes at most one directed choice of a different index and one of its vertices. Edges may join both vertices of i to the chosen vertex, and a mutually choosing pair may additionally be completely joined. Every such graph has an independent set of size at least the number of indices.
theorem finite_functional_star_graph_half_independence (n : ℕ) (H : SimpleGraph (Fin n × Bool)) (target : Fin n → Option (Fin n × Bool)) (hself : ∀ i j b, target i = some (j,b) → i ≠ j) (hwithin : ∀ i, ¬ H.Adj (i,false) (i,true)) (hcross : ∀ i j b c, i ≠ j → H.Adj (i,b) (j,c) → target i = some (j,c) ∨ target j = some (i,b) ∨ ((∃ x, target i = some (j,x)) ∧ (∃ y, target j = some (i,y)))) : ∃ I : Finset (Fin n × Bool), n ≤ I.card ∧ ∀ x ∈ I, ∀ y ∈ I, ¬ H.Adj x y
finite_linear_intersecting_triples_eight_common_vertexIn LeanCombinatorics for TCS
Any family of at least eight distinct three-element sets whose distinct members intersect in exactly one element has a vertex common to every member.
theorem finite_linear_intersecting_triples_eight_common_vertex {V : Type*} [DecidableEq V] (P : Finset (Finset V)) (hcard : ∀ t ∈ P, t.card = 3) (hpair : (P : Set (Finset V)).Pairwise (fun s t => (s ∩ t).card = 1)) (hlarge : 8 ≤ P.card) : ∃ r, ∀ t ∈ P, r ∈ tfinite_two_choice_no_near_constantIn LeanCombinatorics for TCS
For n at least four, if every index i has at least two available symbols from Fin n, one can choose an available symbol for every i so that no symbol is chosen more than n-2 times.
theorem finite_two_choice_no_near_constant (n : ℕ) (hn : 4 ≤ n) (A : Fin n → Finset (Fin n)) (hA : ∀ i, 2 ≤ (A i).card) : ∃ f : Fin n → Fin n, (∀ i, f i ∈ A i) ∧ ∀ v, (Finset.univ.filter fun i => f i = v).card ≤ n-2
finset_card_union_fourIn LeanCombinatorics for TCS
Inclusion-exclusion for four finite sets, in a form that needs no truncated subtraction: the cardinality of the union plus the six pairwise intersections plus the fourfold intersection equals the sum of the four cardinalities plus the four threefold intersections.
theorem finset_card_union_four {α : Type*} [DecidableEq α] (A B C D : Finset α) :
(A ∪ B ∪ C ∪ D).card + (A ∩ B).card + (A ∩ C).card + (A ∩ D).card + (B ∩ C).card
+ (B ∩ D).card + (C ∩ D).card + (A ∩ B ∩ C ∩ D).card
= A.card + B.card + C.card + D.card + (A ∩ B ∩ C).card + (A ∩ B ∩ D).card
+ (A ∩ C ∩ D).card + (B ∩ C ∩ D).cardfinset_esymm_newton_degree_threeIn LeanCombinatorics for TCS
The first three elementary symmetric sums of nonnegative weights satisfy binomial-normalized log-concavity.
theorem finset_esymm_newton_degree_three {V : Type*} [DecidableEq V] (s : Finset V) (w : V → ℕ) (hn : 3 ≤ s.card) : let e := fun k : ℕ => ∑ A ∈ s.powersetCard k, ∏ i ∈ A, w i; e 1 * e 3 * Nat.choose s.card 2 ^ 2 ≤ (e 2) ^ 2 * s.card * Nat.choose s.card 3finset_exists_four_le_of_card_ge_fourIn LeanCombinatorics for TCS
If s is a finite subset of ℝ with card s ≥ 4, then there exist four elements t₁ < t₂ < t₃ < t₄ in s.
theorem finset_exists_four_le_of_card_ge_four (s : Finset ℝ) (hs : 4 ≤ s.card) :
∃ (t₁ t₂ t₃ t₄ : ℝ), t₁ ∈ s ∧ t₂ ∈ s ∧ t₃ ∈ s ∧ t₄ ∈ s ∧ t₁ < t₂ ∧ t₂ < t₃ ∧ t₃ < t₄finset_intersection_bound_along_directionIn LeanCombinatorics for TCS
For any finite set A ⊂ ℝ^d and any direction v, the directional quadratic energy ∑_{a ∈ A} (a · v)^2 is at least (1/2) |A ∩ (v + A)| ‖v‖^4.
open scoped Pointwise in
theorem finset_intersection_bound_along_direction (d : ℕ) (A : Finset (EuclideanSpace ℝ (Fin d)))
(v : EuclideanSpace ℝ (Fin d)) :
(1 / 2 : ℝ) * ((A ∩ (v +ᵥ A)).card : ℝ) * ‖v‖ ^ 4 ≤
∑ a ∈ A, (inner (𝕜 := ℝ) a v) ^ 2five_diamond_ramsey_property_at_four_mulIn LeanCombinatorics for TCS
For k ≥ 2, every k-colouring of the subsets of Fin (4k) contains a monochromatic induced copy of the 5-diamond.
theorem five_diamond_ramsey_property_at_four_mul (k : ℕ) (hk : 2 ≤ k) :
poset_ramsey_property (DiamondPoset 5) k (4 * k)five_diamond_ramsey_property_stepIn LeanCombinatorics for TCS
If every k-colouring of the subsets of Fin (4k) contains a monochromatic induced copy of the 5-diamond, then every (k+1)-colouring of the subsets of Fin (4(k+1)) also contains one.
theorem five_diamond_ramsey_property_step (k : ℕ) (hk : 2 ≤ k)
(ih : poset_ramsey_property (DiamondPoset 5) k (4 * k)) :
poset_ramsey_property (DiamondPoset 5) (k + 1) (4 * (k + 1))five_diamond_ramsey_property_two_eightIn LeanCombinatorics for TCS
Every 2-colouring of the subsets of Fin 8 contains a monochromatic induced copy of the 5-diamond.
theorem five_diamond_ramsey_property_two_eight :
poset_ramsey_property (DiamondPoset 5) 2 8five_diamond_step_colour_free_copyIn LeanCombinatorics for TCS
Colour-free copy (crux): for k ≥ 2, any (k+1)-colouring of the subsets of Fin(4(k+1)) with no monochromatic order-embedded 5-diamond contains an order embedding of Finset(Fin(4k)) into Finset(Fin(4(k+1))) on whose image one colour never appears.
theorem five_diamond_step_colour_free_copy (k : ℕ) (hk : 2 ≤ k)
(c : Finset (Fin (4 * (k + 1))) → Fin (k + 1))
(hno : ∀ (f : DiamondPoset 5 ↪o Finset (Fin (4 * (k + 1)))) (col : Fin (k + 1)),
∃ x : DiamondPoset 5, c (f x) ≠ col) :
∃ (e : Finset (Fin (4 * k)) ↪o Finset (Fin (4 * (k + 1)))) (a : Fin (k + 1)),
∀ A : Finset (Fin (4 * k)), c (e A) ≠ afive_vertex_cover_edges_witnessIn LeanCombinatorics for TCS
Each of the six representative graphs (index 0..5) carries a cover witness family J, given explicitly by the tables in the plan.
theorem five_vertex_cover_edges_witness (i : Fin 6) :
∃ J : Fin 5 → Finset (Fin 5),
GraphCoverWitness (SimpleGraph.fromEdgeSet (↑(five_vertex_cover_edges i) : Set (Sym2 (Fin 5)))) Jfive_vertex_cover_relabelIn LeanCombinatorics for TCS
Every triangle-free five-vertex graph with no isolated vertex that is not 2-regular is isomorphic, by a permutation of the vertices, to one of the six representatives (index 0..5).
theorem five_vertex_cover_relabel (T : SimpleGraph (Fin 5)) [DecidableRel T.Adj]
(htri : T.CliqueFree 3) (hnoisolates : ∀ t, ∃ u, T.Adj t u) (hnoncycle : ¬ ∀ t, T.degree t = 2) :
∃ (σ : Equiv.Perm (Fin 5)) (i : Fin 6),
∀ x y : Fin 5, T.Adj x y ↔
(SimpleGraph.fromEdgeSet (↑(five_vertex_cover_edges i) : Set (Sym2 (Fin 5)))).Adj (σ x) (σ y)five_vertex_cover_relabel_deg_fourIn LeanCombinatorics for TCS
A triangle-free five-vertex graph with a vertex of degree 4 is the 4-star K_{1,4}; it is a relabelling of representative 1.
theorem five_vertex_cover_relabel_deg_four (T : SimpleGraph (Fin 5)) [DecidableRel T.Adj]
(htri : T.CliqueFree 3) (h4 : ∃ v, T.degree v = 4) :
∃ (σ : Equiv.Perm (Fin 5)) (i : Fin 6),
∀ x y : Fin 5, T.Adj x y ↔
(SimpleGraph.fromEdgeSet (↑(five_vertex_cover_edges i) : Set (Sym2 (Fin 5)))).Adj (σ x) (σ y)five_vertex_cover_relabel_deg_threeIn LeanCombinatorics for TCS
A triangle-free five-vertex graph with no isolated vertex and maximum degree 3 is, up to relabelling, one of: K_{2,3}, the 5-edge type, or the 3-star with a pendant (representatives 5, 4, 2 respectively), according to the degree of the leftover vertex.
theorem five_vertex_cover_relabel_deg_three (T : SimpleGraph (Fin 5)) [DecidableRel T.Adj]
(htri : T.CliqueFree 3) (hnoisolates : ∀ t, ∃ u, T.Adj t u)
(hmax : ∀ v, T.degree v ≤ 3) (h3 : ∃ v, T.degree v = 3) :
∃ (σ : Equiv.Perm (Fin 5)) (i : Fin 6),
∀ x y : Fin 5, T.Adj x y ↔
(SimpleGraph.fromEdgeSet (↑(five_vertex_cover_edges i) : Set (Sym2 (Fin 5)))).Adj (σ x) (σ y)five_vertex_cover_relabel_deg_twoIn LeanCombinatorics for TCS
A triangle-free five-vertex graph with no isolated vertex, maximum degree ≤ 2, and not 2-regular is a disjoint union of paths P5 or P3 ∪ P2, i.e. up to relabelling representative 3 or 0.
theorem five_vertex_cover_relabel_deg_two (T : SimpleGraph (Fin 5)) [DecidableRel T.Adj]
(htri : T.CliqueFree 3) (hnoisolates : ∀ t, ∃ u, T.Adj t u)
(hnoncycle : ¬ ∀ t, T.degree t = 2) (hmax : ∀ v, T.degree v ≤ 2) :
∃ (σ : Equiv.Perm (Fin 5)) (i : Fin 6),
∀ x y : Fin 5, T.Adj x y ↔
(SimpleGraph.fromEdgeSet (↑(five_vertex_cover_edges i) : Set (Sym2 (Fin 5)))).Adj (σ x) (σ y)foldl_range_add_eq_finset_sumIn LeanCombinatorics for TCS
Running the left fold of addition over the list 0, 1, …, k−1 starting from 0 gives the sum of f over those indices.
theorem foldl_range_add_eq_finset_sum (f : ℕ → ℕ) (k : ℕ) :
(List.range k).foldl (fun s r => s + f r) 0 = ∑ i ∈ Finset.range k, f ifour_cycle_bound_algebraIn LeanCombinatorics for TCS
Let a, b, m, S, and C4 be real numbers with 2 ≤ a, 2 ≤ b, 2 * (a * Real.sqrt b + b * Real.sqrt a) ≤ m, m^2 / (2 * b) - m / 2 ≤ S, and (1 / 2) * (2 * S^2 / a^2 - S) ≤ C4. Then m^4 / (32 * a^2 * b^2) ≤ C4.
theorem four_cycle_bound_algebra (a b m S C4 : ℝ)
(ha : 2 ≤ a) (hb : 2 ≤ b)
(hm : 2 * (a * Real.sqrt b + b * Real.sqrt a) ≤ m)
(hS : m ^ 2 / (2 * b) - m / 2 ≤ S)
(hC : (1 / 2) * (2 * S ^ 2 / a ^ 2 - S) ≤ C4) :
m ^ 4 / (32 * a ^ 2 * b ^ 2) ≤ C4four_cycle_graph_code_asymptotic_density_eventually_geIn LeanCombinatorics for TCS
For every real number ε > 0, for eventually all natural numbers n in Filter.atTop, 1 - ε ≤ (n : ℝ) * kst_code_max_density 2 2 n.
theorem four_cycle_graph_code_asymptotic_density_eventually_ge (ε : ℝ) (hε : 0 < ε) :
∀ᶠ (n : ℕ) in Filter.atTop, 1 - ε ≤ (n : ℝ) * kst_code_max_density 2 2 nfour_point_chain_lemmaIn LeanCombinatorics for TCS
Chain construction of the two-point recurrence. Let a = 2n-1, b = 2n+1 (n ≥ 4) and let gamma be any integer with (a*gamma) % (2b) = 1 % (2b). Then there is a {0,1}-valued u : ℤ → ℤ with u(t) + u(t-a) = [(gamma t) mod 2b < b] for all t in [0, ab).
theorem four_point_chain_lemma (n gamma : ℤ) (hn : 4 ≤ n)
(hinv : (2 * n - 1) * gamma % (2 * (2 * n + 1)) = 1 % (2 * (2 * n + 1))) :
∃ u : ℤ → ℤ,
(∀ t : ℤ, u t = 0 ∨ u t = 1) ∧
(∀ t : ℤ, 0 ≤ t → t < (2 * n - 1) * (2 * n + 1) →
u t + u (t - (2 * n - 1))
= (if (gamma * t) % (2 * (2 * n + 1)) < 2 * n + 1 then (1:ℤ) else 0))four_point_chain_square_waveIn LeanCombinatorics for TCS
Square-wave chain seed existence. Let b = 2n+1 (n ≥ 4) and let C be an integer with 0 ≤ C < 2b. Then there is a {0,1}-valued function g : ℤ → ℤ with g(k) + g(k-1) = [(C+k) mod 2b < b] for every k in [0, b). In words: the alternating recursion driven by a square wave whose "on" block is a cyclic half [C, C+b) admits a seed g(-1) ∈ {0,1} keeping every value in {0,1}.
theorem four_point_chain_square_wave (n : ℤ) (hn : 4 ≤ n) (C : ℤ)
(hC0 : 0 ≤ C) (hC2 : C < 2 * (2 * n + 1)) :
∃ g : ℤ → ℤ,
(∀ k : ℤ, g k = 0 ∨ g k = 1) ∧
(∀ k : ℤ, 0 ≤ k → k < 2 * n + 1 →
g k + g (k - 1) = (if (C + k) % (2 * (2 * n + 1)) < 2 * n + 1 then (1:ℤ) else 0))four_point_chain_weight_shiftIn LeanCombinatorics for TCS
Modular reduction of the weight along a residue class mod a: if a = 2n-1, b = 2n+1 and (a*gamma) % (2b) = 1 % (2b), then for all r, k one has (gamma*(r + k*a)) % (2b) = (gamma*r + k) % (2b). Equivalently v(r+ka) = [(gamma r + k) mod (2b) < b] for the weight v(t) = [(gamma t) mod 2b < b], so v restricted to any residue class is a square wave in k.
theorem four_point_chain_weight_shift (n gamma : ℤ) (hn : 4 ≤ n)
(hinv : (2 * n - 1) * gamma % (2 * (2 * n + 1)) = 1 % (2 * (2 * n + 1)))
(r k : ℤ) :
gamma * (r + k * (2 * n - 1)) % (2 * (2 * n + 1))
= (gamma * r + k) % (2 * (2 * n + 1))four_point_set_alternating_weight_existsIn LeanCombinatorics for TCS
For any integer n ≥ 4, with a = 2n - 1 and b = 2n + 1, there exists a {0, 1}-valued function u : ℤ → ℤ such that for all t in [b, ab - 1], the four-point sum u(t) + u(t - a) + u(t - b) + u(t - a - b) equals 1.
theorem four_point_set_alternating_weight_exists (n : ℤ) (hn : 4 ≤ n) :
let a : ℤ := 2 * n - 1
let b : ℤ := 2 * n + 1
∃ u : ℤ → ℤ,
(∀ t, u t = 0 ∨ u t = 1) ∧
(∀ t, b ≤ t → t ≤ a * b - 1 → u t + u (t - a) + u (t - b) + u (t - a - b) = 1)four_point_set_quadratic_packing_intervalIn LeanCombinatorics for TCS
Let n ≥ 4 be an integer, and let a = 2n - 1 and b = 2n + 1. Then there exists a finite subset C ⊆ ℤ such that the translates of F = {0, a, b, a + b} by elements of C are pairwise disjoint, and their union covers the integer interval [a + 2b, ab - 1 - a - b].
open Pointwise in
theorem four_point_set_quadratic_packing_interval (n : ℤ) (hn : 4 ≤ n) :
let a : ℤ := 2 * n - 1
let b : ℤ := 2 * n + 1
let F : Finset ℤ := {0, a, b, a + b}
∃ C : Finset ℤ,
(∀ c₁ ∈ C, ∀ c₂ ∈ C, c₁ ≠ c₂ → Disjoint (c₁ +ᵥ F) (c₂ +ᵥ F)) ∧
Finset.Icc (a + 2 * b) (a * b - 1 - a - b) ⊆ C.biUnion (fun c => c +ᵥ F)four_point_weight_antiperiodicIn LeanCombinatorics for TCS
Anti-periodicity of the weight. Let b = 2n+1 (n ≥ 4) and let gamma be odd. Then for every t, v(t) + v(t-b) = 1 where v(t) = [(gamma*t) mod 2b < b]. I.e. the two complementary half-turns of the weight shift by b sum to 1.
theorem four_point_weight_antiperiodic (n gamma : ℤ) (hn : 4 ≤ n)
(hodd : Odd gamma) (t : ℤ) :
(if (gamma * t) % (2 * (2 * n + 1)) < 2 * n + 1 then (1:ℤ) else 0)
+ (if (gamma * (t - (2 * n + 1))) % (2 * (2 * n + 1)) < 2 * n + 1 then (1:ℤ) else 0)
= 1fourier_card_supp_le_cardIn LeanCombinatorics for TCS
For any complex-valued function $f : H \to \mathbb{C}$ on a finite abelian group $H$, the cardinality of the support of its Fourier transform is at most the order of $H$, $|\operatorname{card}(H)|$.
theorem fourier_card_supp_le_card {H : Type*} [AddCommGroup H] [Fintype H]
(f : H → ℂ) :
((Finset.univ.filter (fun γ : AddChar H ℂ => fourier_transform f γ ≠ 0)).card : ℝ) ≤ (Fintype.card H : ℝ)fourier_collision_dim_eq_ratio_sq_iffIn LeanCombinatorics for TCS
For every nonzero complex-valued function $f : H \to \mathbb{C}$ on a finite abelian group $H$, the equality $D_4(f) = \operatorname{FR}(f)^2$ holds if and only if for all additive characters $\gamma_1, \gamma_2$, if $\widehat{f}(\gamma_1) \ne 0$ and $\widehat{f}(\gamma_2) \ne 0$, then $\|\widehat{f}(\gamma_1)\| = \|\widehat{f}(\gamma_2)\|$.
theorem fourier_collision_dim_eq_ratio_sq_iff {H : Type*} [AddCommGroup H] [Fintype H]
(f : H → ℂ) (hf : f ≠ 0) :
fourier_collision_dim f = fourier_ratio f ^ 2 ↔
∀ γ₁ γ₂ : AddChar H ℂ, fourier_transform f γ₁ ≠ 0 → fourier_transform f γ₂ ≠ 0 →
‖fourier_transform f γ₁‖ = ‖fourier_transform f γ₂‖fourier_collision_dim_ge_oneIn LeanCombinatorics for TCS
For every nonzero complex-valued function $f : H \to \mathbb{C}$ on a finite abelian group $H$, its Fourier collision dimension satisfies $1 \le D_4(f)$.
theorem fourier_collision_dim_ge_one {H : Type*} [AddCommGroup H] [Fintype H]
(f : H → ℂ) (hf : f ≠ 0) :
1 ≤ fourier_collision_dim ffourier_collision_dim_le_ratio_sqIn LeanCombinatorics for TCS
For every nonzero complex-valued function $f : H \to \mathbb{C}$ on a finite abelian group $H$, its Fourier collision dimension satisfies $D_4(f) \le \operatorname{FR}(f)^2$.
theorem fourier_collision_dim_le_ratio_sq {H : Type*} [AddCommGroup H] [Fintype H]
(f : H → ℂ) (hf : f ≠ 0) :
fourier_collision_dim f ≤ fourier_ratio f ^ 2fourier_collision_hierarchyIn LeanCombinatorics for TCS
For every nonzero complex-valued function $f : H \to \mathbb{C}$ on a finite abelian group $H$, we have $1 \le D_4(f) \le \operatorname{FR}(f)^2 \le |\{\gamma \in \widehat{H} : \widehat{f}(\gamma) \ne 0\}| \le |H|$, and equality $D_4(f) = \operatorname{FR}(f)^2$ holds if and only if all nonzero Fourier coefficients have the same modulus.
theorem fourier_collision_hierarchy {H : Type*} [AddCommGroup H] [Fintype H]
(f : H → ℂ) (hf : f ≠ 0) :
(1 ≤ fourier_collision_dim f ∧
fourier_collision_dim f ≤ fourier_ratio f ^ 2 ∧
fourier_ratio f ^ 2 ≤ ((Finset.univ.filter (fun γ : AddChar H ℂ => fourier_transform f γ ≠ 0)).card : ℝ) ∧
((Finset.univ.filter (fun γ : AddChar H ℂ => fourier_transform f γ ≠ 0)).card : ℝ) ≤ (Fintype.card H : ℝ)) ∧
(fourier_collision_dim f = fourier_ratio f ^ 2 ↔
∀ γ₁ γ₂ : AddChar H ℂ, fourier_transform f γ₁ ≠ 0 → fourier_transform f γ₂ ≠ 0 →
‖fourier_transform f γ₁‖ = ‖fourier_transform f γ₂‖)fourier_ratio_sq_le_card_suppIn LeanCombinatorics for TCS
For every nonzero complex-valued function $f : H \to \mathbb{C}$ on a finite abelian group $H$, the square of its Fourier ratio is at most the cardinality of the support of its Fourier transform: $\operatorname{FR}(f)^2 \le |\{\gamma \in \widehat{H} : \widehat{f}(\gamma) \ne 0\}|$.
theorem fourier_ratio_sq_le_card_supp {H : Type*} [AddCommGroup H] [Fintype H]
(f : H → ℂ) (hf : f ≠ 0) :
fourier_ratio f ^ 2 ≤ ((Finset.univ.filter (fun γ : AddChar H ℂ => fourier_transform f γ ≠ 0)).card : ℝ)fractional_scd_bounded_denominator_of_independentIn LeanCombinatorics for TCS
Let (𝒞, τ) be a fractional SCD with τ > 0 on 𝒞 whose incidence vectors are ℚ-linearly independent. Then there is D with 0 < D, D ≤ |α|^(2|α|), and the poset admits a fractional SCD with denominator D.
open scoped Classical BigOperators in
theorem fractional_scd_bounded_denominator_of_independent
{α : Type*} [Fintype α] [PartialOrder α] (rank : α → ℤ)
(𝒞 : Finset (Set α)) (τ : Set α → ℚ)
(hchain : ∀ C ∈ 𝒞, is_symmetric_saturated_chain rank C)
(hpos : ∀ C ∈ 𝒞, 0 < τ C)
(hind : LinearIndependent ℚ (fun C : {D // D ∈ 𝒞} => fun x : α => if x ∈ (C : Set α) then (1:ℚ) else 0))
(hsum : ∀ x : α, ∑ C ∈ 𝒞 with x ∈ C, τ C = 1) :
∃ D : ℕ, 0 < D ∧ D ≤ (Fintype.card α) ^ (2 * Fintype.card α) ∧
has_fractional_scd_with_denominator rank Dfractional_scd_dependent_support_perturbIn LeanCombinatorics for TCS
If (𝒞, τ) is a fractional symmetric chain decomposition with τ > 0 on 𝒞 and the incidence vectors of 𝒞 are ℚ-linearly dependent, then there is another fractional symmetric chain decomposition with strictly positive weights whose underlying chain collection has strictly smaller cardinality.
open scoped Classical BigOperators in
theorem fractional_scd_dependent_support_perturb
{α : Type*} [PartialOrder α] (rank : α → ℤ) (𝒞 : Finset (Set α)) (τ : Set α → ℚ)
(hchain : ∀ C ∈ 𝒞, is_symmetric_saturated_chain rank C)
(hpos : ∀ C ∈ 𝒞, 0 < τ C)
(hsum : ∀ x : α, ∑ C ∈ 𝒞 with x ∈ C, τ C = 1)
(hdep : ¬ LinearIndependent ℚ (fun C : {D // D ∈ 𝒞} => fun x : α => if x ∈ (C : Set α) then (1:ℚ) else 0)) :
∃ (𝒞' : Finset (Set α)) (τ' : Set α → ℚ), 𝒞'.card < 𝒞.card ∧
(∀ C ∈ 𝒞', is_symmetric_saturated_chain rank C) ∧
(∀ C ∈ 𝒞', 0 < τ' C) ∧
∀ x : α, ∑ C ∈ 𝒞' with x ∈ C, τ' C = 1fractional_scd_independent_supportIn LeanCombinatorics for TCS
If a finite poset admits a fractional symmetric chain decomposition, then it admits one whose weights are strictly positive on the support and whose chain incidence vectors are linearly independent over ℚ.
open scoped Classical BigOperators in
theorem fractional_scd_independent_support
{α : Type*} [PartialOrder α] (rank : α → ℤ)
(h : has_fractional_symmetric_chain_decomposition rank) :
∃ (𝒞 : Finset (Set α)) (τ : Set α → ℚ),
(∀ C ∈ 𝒞, is_symmetric_saturated_chain rank C) ∧
(∀ C ∈ 𝒞, 0 < τ C) ∧
LinearIndependent ℚ (fun C : {D // D ∈ 𝒞} => fun x : α => if x ∈ (C : Set α) then (1:ℚ) else 0) ∧
∀ x : α, ∑ C ∈ 𝒞 with x ∈ C, τ C = 1fractional_scd_positive_supportIn LeanCombinatorics for TCS
If a finite poset admits a fractional symmetric chain decomposition, then it admits one in which every chain in the collection carries strictly positive weight.
open scoped Classical BigOperators in
theorem fractional_scd_positive_support
{α : Type*} [PartialOrder α] (rank : α → ℤ)
(h : has_fractional_symmetric_chain_decomposition rank) :
∃ (𝒞 : Finset (Set α)) (τ : Set α → ℚ),
(∀ C ∈ 𝒞, is_symmetric_saturated_chain rank C) ∧
(∀ C ∈ 𝒞, 0 < τ C) ∧
∀ x : α, ∑ C ∈ 𝒞 with x ∈ C, τ C = 1full_affine_line_forces_cylinderIn LeanCombinatorics for TCS
Let p be a prime and S an admissible plane set in (ZMod p)^3. If S contains an affine line through P in direction v ≠ 0, then S is a cylinder in direction v.
theorem full_affine_line_forces_cylinder
(p : ℕ) [Fact p.Prime] (S : Set (Fin 3 → ZMod p)) (hS : admissible_plane_set p S)
(P v : Fin 3 → ZMod p) (hv : v ≠ 0) (hline : affine_line P v ⊆ S) :
is_cylinder_in_direction p S vgallai_color_card_le_two_of_card_le_threeIn LeanCombinatorics for TCS
On a finite vertex set V with |V| ≤ 3, any edge colouring of the complete graph on V such that no triangle receives three distinct colours uses at most 2 distinct colours on the edges of the complete graph.
theorem gallai_color_card_le_two_of_card_le_three
{V α : Type*} [Fintype V] [DecidableEq V] [DecidableEq α]
(hV : Fintype.card V ≤ 3)
(c : Sym2 V → α)
(h_gallai : ∀ u v w : V, c s(u, v) = c s(v, w) ∨ c s(v, w) = c s(w, u) ∨ c s(u, v) = c s(w, u)) :
((⊤ : SimpleGraph V).edgeFinset.image c).card ≤ 2gallai_coloring_disconnected_monochromatic_subgraphIn LeanCombinatorics for TCS
Let V be a finite vertex set with |V| ≥ 2, and let the edges of the complete graph on V be coloured such that no triangle receives three distinct colours. If at least three colours are used on the edges of the complete graph, then there exists a colour k used on an edge such that the spanning subgraph formed by the edges of colour k is disconnected.
theorem gallai_coloring_disconnected_monochromatic_subgraph
{V α : Type*} [Fintype V] [DecidableEq V] [DecidableEq α]
(hV : 2 ≤ Fintype.card V)
(c : Sym2 V → α)
(h_gallai : ∀ u v w : V, c s(u, v) = c s(v, w) ∨ c s(v, w) = c s(w, u) ∨ c s(u, v) = c s(w, u))
(h_colors : 3 ≤ ((⊤ : SimpleGraph V).edgeFinset.image c).card) :
∃ k ∈ (⊤ : SimpleGraph V).edgeFinset.image c,
¬ (SimpleGraph.fromRel (fun u v => c s(u, v) = k)).Connectedgallai_triangle_same_colorIn LeanCombinatorics for TCS
In any edge colouring of the complete graph where no triangle receives three distinct colours, if an edge between vertices x and x' has colour c0, and a vertex u forms edges with x and x' of colours different from c0, then the edge between u and x has the same colour as the edge between u and x'.
theorem gallai_triangle_same_color
{V α : Type*} (c : Sym2 V → α) (c0 : α) (u x x' : V)
(h_gallai : ∀ u v w : V, c s(u, v) = c s(v, w) ∨ c s(v, w) = c s(w, u) ∨ c s(u, v) = c s(w, u))
(hxx' : c s(x, x') = c0)
(hux : c s(u, x) ≠ c0)
(hux' : c s(u, x') ≠ c0) :
c s(u, x) = c s(u, x')galvin_bipartite_multigraph_list_edge_colouringIn LeanCombinatorics for TCS
Galvin's theorem in matroid-free form (list edge colouring of bipartite multigraphs): view the finite set α as the edge set of the bipartite multigraph whose left and right endpoints of e are the labels f e and g e. If every fibre of f and every fibre of g has at most k elements (so the maximum degree is at most k), then for every list assignment L with |L e| ≥ k there is a choice c e ∈ L e such that each colour class meets every fibre of f and every fibre of g in at most one element, i.e. is a matching. This is Galvin's theorem χ'_ℓ = Δ for bipartite multigraphs (1995); it is a strictly weaker statement than the target (two unit-capacity partition matroids are strongly base orderable), k = 1 is trivial and k = 2 is proved here.
theorem galvin_bipartite_multigraph_list_edge_colouring {α : Type*} [Finite α] (f g : α → ℕ) (k : ℕ)
(hf : ∀ γ : ℕ, {e | f e = γ}.ncard ≤ k) (hg : ∀ γ : ℕ, {e | g e = γ}.ncard ≤ k)
(L : α → Finset ℕ) (hL : ∀ e : α, k ≤ (L e).card) :
∃ c : α → ℕ, (∀ e : α, c e ∈ L e) ∧
∀ γ : ℕ, (∀ e₁ e₂ : α, c e₁ = γ → c e₂ = γ → f e₁ = f e₂ → e₁ = e₂) ∧
∀ e₁ e₂ : α, c e₁ = γ → c e₂ = γ → g e₁ = g e₂ → e₁ = e₂galvin_bipartite_multigraph_list_edge_colouring_three_setIn LeanCombinatorics for TCS
Given fibers of size at most 3 for f and g on a subset E, and lists L(e) of size at least 3 for all e ∈ E, there exists an L-coloring c on E whose color classes meet each f-fiber and each g-fiber at most once.
theorem galvin_bipartite_multigraph_list_edge_colouring_three_set {α : Type*} [Finite α] (E : Set α)
(f g : α → ℕ)
(hf : ∀ γ : ℕ, {e | e ∈ E ∧ f e = γ}.ncard ≤ 3)
(hg : ∀ γ : ℕ, {e | e ∈ E ∧ g e = γ}.ncard ≤ 3)
(L : α → Finset ℕ) (hL : ∀ e ∈ E, 3 ≤ (L e).card) :
∃ c : α → ℕ, (∀ e ∈ E, c e ∈ L e) ∧
∀ γ : ℕ, (∀ e₁ ∈ E, ∀ e₂ ∈ E, c e₁ = γ → c e₂ = γ → f e₁ = f e₂ → e₁ = e₂) ∧
∀ e₁ ∈ E, ∀ e₂ ∈ E, c e₁ = γ → c e₂ = γ → g e₁ = g e₂ → e₁ = e₂galvin_bipartite_orientation_kernel_perfectIn LeanCombinatorics for TCS
Galvin's orientation step (1995): given a proper k-edge-colouring m of the bipartite multigraph with endpoints f, g (all colours < k, injective on fibres of f and of g), there is an orientation arc of the conflict graph (distinct edges sharing a left or a right endpoint) which contains no loops, stays inside the conflict graph, gives every edge fewer than k out-neighbours, and is kernel-perfect: every finite induced subgraph has an independent, arc-absorbing set.
theorem galvin_bipartite_orientation_kernel_perfect {α : Type*} [Fintype α] (f g : α → ℕ) (k : ℕ)
(m : α → ℕ) (hm : ∀ e : α, m e < k)
(hf : ∀ e₁ e₂ : α, m e₁ = m e₂ → f e₁ = f e₂ → e₁ = e₂)
(hg : ∀ e₁ e₂ : α, m e₁ = m e₂ → g e₁ = g e₂ → e₁ = e₂) :
∃ (arc : α → α → Prop) (_ : DecidableRel arc),
(∀ e₁ e₂ : α, arc e₁ e₂ → e₁ ≠ e₂ ∧ (f e₁ = f e₂ ∨ g e₁ = g e₂)) ∧
(∀ e : α, {e' | arc e e'}.ncard < k) ∧
∀ F : Finset α, ∃ K : Finset α,
K ⊆ F ∧ (∀ u ∈ K, ∀ v ∈ K, u ≠ v → ¬ (f u = f v ∨ g u = g v)) ∧
∀ u ∈ F, u ∉ K → ∃ v ∈ K, arc u vgalvin_conflict_arc_kernel_perfectIn LeanCombinatorics for TCS
Kernel-perfectness of Galvin's orientation: for a proper edge-colouring m of the bipartite multigraph (injective on f-fibres and on g-fibres), every finite induced subgraph of the conflict graph has a kernel — an independent set of edges K (no two sharing a left or a right endpoint) such that every edge of F outside K has an arc of galvin_conflict_arc into K.
theorem galvin_conflict_arc_kernel_perfect {α : Type*} [Fintype α] (f g m : α → ℕ)
(hf : ∀ e₁ e₂ : α, m e₁ = m e₂ → f e₁ = f e₂ → e₁ = e₂)
(hg : ∀ e₁ e₂ : α, m e₁ = m e₂ → g e₁ = g e₂ → e₁ = e₂) :
∀ F : Finset α, ∃ K : Finset α, K ⊆ F ∧
(∀ u ∈ K, ∀ v ∈ K, u ≠ v → ¬ (f u = f v ∨ g u = g v)) ∧
∀ u ∈ F, u ∉ K → ∃ v ∈ K, galvin_conflict_arc f g m u vgalvin_conflict_arc_outdeg_ltIn LeanCombinatorics for TCS
In Galvin's orientation of the conflict graph, every edge has fewer than k out-neighbours, where k bounds the colour values: if m is a proper k-edge-colouring (values < k, injective on f-fibres and on g-fibres) then each edge has at most k − 1 arc-successors.
theorem galvin_conflict_arc_outdeg_lt {α : Type*} [Fintype α] (f g m : α → ℕ) (k : ℕ)
(hm : ∀ e, m e < k)
(hf : ∀ e₁ e₂ : α, m e₁ = m e₂ → f e₁ = f e₂ → e₁ = e₂)
(hg : ∀ e₁ e₂ : α, m e₁ = m e₂ → g e₁ = g e₂ → e₁ = e₂) :
∀ e : α, {e' | galvin_conflict_arc f g m e e'}.ncard < kgalvin_kernel_lemmaIn LeanCombinatorics for TCS
Galvin's kernel lemma (Borodin–Kostochka–Woodall form). Let adj be a loopless symmetric-free adjacency on a finite set V, let arc be an orientation of a subgraph of adj, and suppose the digraph (adj, arc) is kernel-perfect: every finite induced subgraph has a kernel, i.e. an independent set meeting every vertex outside it by an outgoing arc. If every vertex v carries a list L v of at least (number of arc-out-neighbours of v) + 1 colours, then there is a choice c v ∈ L v which is proper for adj: adj u v implies c u ≠ c v.
theorem galvin_kernel_lemma {V : Type*} [Fintype V] [DecidableEq V]
(adj arc : V → V → Prop) [DecidableRel adj] [DecidableRel arc]
(hloop : ∀ v, ¬ adj v v)
(hsub : ∀ u v, arc u v → adj u v)
(hker : ∀ F : Finset V, ∃ K : Finset V, K ⊆ F ∧
(∀ u ∈ K, ∀ v ∈ K, u ≠ v → ¬ adj u v) ∧
(∀ u ∈ F, u ∉ K → ∃ v ∈ K, arc u v))
(L : V → Finset ℕ) (hL : ∀ v, {u | arc v u}.ncard + 1 ≤ (L v).card) :
∃ c : V → ℕ, (∀ v, c v ∈ L v) ∧ ∀ u v, adj u v → c u ≠ c vgeometric_entropy_constant_eqIn LeanCombinatorics for TCS
The identity (1 - 2^(-1/2))^(-2) = 6 + 4 * sqrt(2) holds for real numbers.
theorem geometric_entropy_constant_eq :
(1 - (2 : ℝ) ^ (-(1 : ℝ) / 2)) ^ (-2 : ℝ) = 6 + 4 * Real.sqrt 2glove_number_complete_graph_choose_two_le_sqIn LeanCombinatorics for TCS
For $n \ge 2$, the number of edges $\binom{n}{2}$ of $K_n$ is at most the square of its glove number: $\mathrm{gl}(K_n) \ge \sqrt{n(n-1)/2}$.
theorem glove_number_complete_graph_choose_two_le_sq (n : ℕ) (hn : 2 ≤ n) :
n.choose 2 ≤ glove_number (SimpleGraph.completeGraph (Fin n)) ^ 2glove_number_k4_no_one_gloveIn LeanCombinatorics for TCS
There is no clean handshake sequence with exactly one glove that covers all six edges of $K_4$: with one glove all covered edges coincide, and $K_4$ has two distinct edges.
theorem glove_number_k4_no_one_glove :
¬ has_clean_handshake_seq (SimpleGraph.completeGraph (Fin 4)) 1glove_number_k4_no_two_glovesIn LeanCombinatorics for TCS
There is no clean handshake sequence with exactly two gloves covering all six edges of $K_4$, i.e. two gloves are not enough for $K_4$.
theorem glove_number_k4_no_two_gloves :
¬ has_clean_handshake_seq (SimpleGraph.completeGraph (Fin 4)) 2glove_number_k4_no_zero_glovesIn LeanCombinatorics for TCS
There is no clean handshake sequence with zero gloves covering all edges of $K_4$: the glove type Fin 0 is empty, so there is no handshake at all, hence the sequence is empty and covers no edge, while $K_4$ has the edge $\{0,1\}$.
theorem glove_number_k4_no_zero_gloves :
¬ has_clean_handshake_seq (SimpleGraph.completeGraph (Fin 4)) 0glove_number_k4_two_gloves_all_sides_touchedIn LeanCombinatorics for TCS
If a clean two-glove sequence covers all six edges of $K_4$, then each of the four glove sides is directly touched by some vertex. Reason: a pair of sides has fixed touchers and hence can serve for at most one edge, while the six edges of $K_4$ need six distinct pairs of touched sides, and there are exactly $\binom{4}{2} = 6$ pairs of sides.
theorem glove_number_k4_two_gloves_all_sides_touched
(seq : List (Handshake (Fin 4) (Fin 2)))
(hclean : CleanHandshakeSeq seq (fun _ => (∅ : Set (Fin 4))))
(hcover : ∀ e ∈ (SimpleGraph.completeGraph (Fin 4)).edgeSet, ∃ h ∈ seq, handshake_edge h = e) :
∀ s : Fin 2 × Bool, (seq_touchers seq s).Nonemptyglove_number_k4_two_gloves_touchers_eq_singletonIn LeanCombinatorics for TCS
If a clean two-glove sequence covers all edges of $K_4$, there is a bijection $u$ from the four glove sides to the four vertices with the property that the set of vertices directly touching a side $s$ anywhere in the sequence is exactly $\{u(s)\}$.
theorem glove_number_k4_two_gloves_touchers_eq_singleton
(seq : List (Handshake (Fin 4) (Fin 2)))
(hclean : CleanHandshakeSeq seq (fun _ => (∅ : Set (Fin 4))))
(hcover : ∀ e ∈ (SimpleGraph.completeGraph (Fin 4)).edgeSet, ∃ h ∈ seq, handshake_edge h = e) :
∃ u : (Fin 2 × Bool) → Fin 4, Function.Injective u ∧ ∀ s, seq_touchers seq s = {u s}glove_number_k5_no_small_glovesIn LeanCombinatorics for TCS
For every $k \le 3$ there is no clean handshake sequence with $k$ gloves covering every edge of $K_5$: $k$ gloves cover at most $k^2 \le 9$ edges, while $K_5$ has 10.
theorem glove_number_k5_no_small_gloves :
∀ k : ℕ, k ≤ 3 → ¬ has_clean_handshake_seq (SimpleGraph.completeGraph (Fin 5)) kglove_number_k5_no_three_glovesIn LeanCombinatorics for TCS
There is no clean handshake sequence with at most three gloves covering every edge of $K_5$: with $k$ gloves at most $k^2$ edges are covered, but $K_5$ has 10 edges and $3^2 = 9 < 10$.
theorem glove_number_k5_no_three_gloves :
¬ has_clean_handshake_seq (SimpleGraph.completeGraph (Fin 5)) 3good_slopes_colored_product_rows_conditionalIn LeanCombinatorics for TCS
For fields of cardinalities p<q and r colors with r<p and (p+1)r<2q, assume the two finite-field direction classification bounds. If at least max(2,(p+1)/2) nonzero p-coordinate rows each have at least (q+1)/2 good nonzero q-coordinate slopes, then every unit-coordinate direction is good.
theorem good_slopes_colored_product_rows_conditional
(K L : Type*) [Field K] [Field L] [Fintype K] [Fintype L] [DecidableEq K] [DecidableEq L]
(p q r : ℕ) (hp : Fintype.card K = p) (hq : Fintype.card L = q)
(hrp : r < p) (hpq : p < q) (hsize : (p+1)*r < 2*q)
(hdirK : ∀ T : Finset (K × K), T.card = p →
(∃ G : Finset K, (p+1)/2 ≤ G.card ∧ ∀ a ∈ G, Set.InjOn (fun z : K × K => z.2 + a*z.1) T) →
(∃ x : K, ∀ z ∈ T, z.1 = x) ∨ (∃ a t : K, ∀ z ∈ T, z.2 + a*z.1 = t))
(hdirL : ∀ T : Finset (L × L), T.card = q →
(∃ G : Finset L, (q+1)/2 ≤ G.card ∧ ∀ b ∈ G, Set.InjOn (fun z : L × L => z.2 + b*z.1) T) →
(∃ x : L, ∀ z ∈ T, z.1 = x) ∨ (∃ b t : L, ∀ z ∈ T, z.2 + b*z.1 = t))
(S : Finset ((K × L) × (K × L))) (color : ((K × L) × (K × L)) → Fin r)
(hcard : S.card = p*q)
(hx : ∀ u ∈ S, ∀ v ∈ S, color u = color v → u.1 = v.1 → u = v)
(hc : ∀ a : K, a ≠ 0 → ∀ b : L, b ≠ 0 → ∀ u ∈ S, ∀ v ∈ S, color u = color v →
(u.2.1 + a*u.1.1, u.2.2 + b*u.1.2) = (v.2.1 + a*v.1.1, v.2.2 + b*v.1.2) → u = v)
(hrows : max 2 ((p+1)/2) ≤ ((Finset.univ : Finset K).filter fun a => a ≠ 0 ∧
(q+1)/2 ≤ ((Finset.univ : Finset L).filter fun b => b ≠ 0 ∧
Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S).card).card) :
∀ a : K, a ≠ 0 → ∀ b : L, b ≠ 0 →
Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) Sgood_slopes_product_strong_rows_bad_column_conditionalIn LeanCombinatorics for TCS
For finite fields of sizes p<q, assume the q-point direction classification. If every nonzero p-coordinate row has at least (q+1)/2 good nonzero q-coordinate directions, then any bad direction forces its entire q-coordinate column of unit directions to be bad.
theorem good_slopes_product_strong_rows_bad_column_conditional
(K L : Type*) [Field K] [Field L] [Fintype K] [Fintype L] [DecidableEq K] [DecidableEq L]
(p q : ℕ) (hp : Fintype.card K = p) (hq : Fintype.card L = q) (hpq : p < q)
(hdirL : ∀ T : Finset (L × L), T.card = q →
(∃ G : Finset L, (q+1)/2 ≤ G.card ∧ ∀ b ∈ G, Set.InjOn (fun z : L × L => z.2 + b*z.1) T) →
(∃ x : L, ∀ z ∈ T, z.1 = x) ∨ (∃ b t : L, ∀ z ∈ T, z.2 + b*z.1 = t))
(S : Finset ((K × L) × (K × L))) (hcard : S.card = p*q)
(hrows : ∀ a : K, a ≠ 0 → (q+1)/2 ≤ ((Finset.univ : Finset L).filter fun b => b ≠ 0 ∧
Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S).card)
(a : K) (ha : a ≠ 0) (b : L) (hb : b ≠ 0)
(hbad : ¬ Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S) :
∀ a' : K, a' ≠ 0 → ¬ Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a'*z.1.1, z.2.2 + b*z.1.2)) Sgood_slopes_product_three_color_gap_conditionalIn LeanCombinatorics for TCS
For finite fields of odd sizes 5≤p and q≥2p−1 with 3(p+1)<2q, assume both finite-field direction classifications. A three-colored pq-point set with a bad unit-coordinate direction has at most (p−1)(q−3) good unit-coordinate directions.
theorem good_slopes_product_three_color_gap_conditional (K L : Type*) [Field K] [Field L] [Fintype K] [Fintype L] [DecidableEq K] [DecidableEq L]
(p q : ℕ) (hp : Fintype.card K = p) (hq : Fintype.card L = q)
(hp5 : 5 ≤ p) (hpodd : p % 2 = 1) (hqodd : q % 2 = 1) (hsep : 2*p-1 ≤ q) (hsize : (p+1)*3 < 2*q)
(hdirK : (∀ T : Finset (K × K), T.card = p →
(∃ G : Finset K, (p+1)/2 ≤ G.card ∧ ∀ b ∈ G, Set.InjOn (fun z : K × K => z.2 + b*z.1) T) →
(∃ x : K, ∀ z ∈ T, z.1 = x) ∨ (∃ b t : K, ∀ z ∈ T, z.2 + b*z.1 = t))) (hdirL : (∀ T : Finset (L × L), T.card = q →
(∃ G : Finset L, (q+1)/2 ≤ G.card ∧ ∀ b ∈ G, Set.InjOn (fun z : L × L => z.2 + b*z.1) T) →
(∃ x : L, ∀ z ∈ T, z.1 = x) ∨ (∃ b t : L, ∀ z ∈ T, z.2 + b*z.1 = t))) (S : Finset ((K × L) × (K × L))) (color : ((K × L) × (K × L)) → Fin 3) (hcard : S.card = p*q)
(hx : ∀ u ∈ S, ∀ v ∈ S, color u = color v → u.1 = v.1 → u = v)
(hc : ∀ a : K, a ≠ 0 → ∀ b : L, b ≠ 0 → ∀ u ∈ S, ∀ v ∈ S, color u = color v →
(u.2.1 + a*u.1.1, u.2.2 + b*u.1.2) = (v.2.1 + a*v.1.1, v.2.2 + b*v.1.2) → u = v)
(hbad : ∃ a : K, a ≠ 0 ∧ ∃ b : L, b ≠ 0 ∧ ¬ Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S) :
((Finset.univ : Finset (K × L)).filter fun ab => ab.1 ≠ 0 ∧ ab.2 ≠ 0 ∧ Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + ab.1*z.1.1, z.2.2 + ab.2*z.1.2)) S).card ≤ (p-1)*(q-1)-2*(p-1)good_slopes_product_uncolored_gap_conditionalIn LeanCombinatorics for TCS
For finite fields of odd sizes 5≤p and q≥2p−1, assuming the q-point finite-field direction theorem, a pq-point set with a bad unit-coordinate direction has at most (p−1)(q−2) good unit-coordinate directions.
theorem good_slopes_product_uncolored_gap_conditional (K L : Type*) [Field K] [Field L] [Fintype K] [Fintype L] [DecidableEq K] [DecidableEq L]
(p q : ℕ) (hp : Fintype.card K = p) (hq : Fintype.card L = q)
(hp5 : 5 ≤ p) (hpodd : p % 2 = 1) (hqodd : q % 2 = 1) (hsep : 2*p-1 ≤ q)
(hdirL : (∀ T : Finset (L × L), T.card = q →
(∃ G : Finset L, (q+1)/2 ≤ G.card ∧ ∀ b ∈ G, Set.InjOn (fun z : L × L => z.2 + b*z.1) T) →
(∃ x : L, ∀ z ∈ T, z.1 = x) ∨ (∃ b t : L, ∀ z ∈ T, z.2 + b*z.1 = t))) (S : Finset ((K × L) × (K × L))) (hcard : S.card = p*q)
(hbad : ∃ a : K, a ≠ 0 ∧ ∃ b : L, b ≠ 0 ∧ ¬ Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + a*z.1.1, z.2.2 + b*z.1.2)) S) :
((Finset.univ : Finset (K × L)).filter fun ab => ab.1 ≠ 0 ∧ ab.2 ≠ 0 ∧ Set.InjOn (fun z : ((K × L) × (K × L)) => (z.2.1 + ab.1*z.1.1, z.2.2 + ab.2*z.1.2)) S).card ≤ (p-1)*(q-1)-(p-1)graph_cover_witness_relabelIn LeanCombinatorics for TCS
The cover-witness property is invariant under relabelling of the vertices: if σ is a permutation with T.Adj x y ↔ G.Adj (σ x) (σ y) for all x y, and G has a cover witness J, then T has one, namely J'(t) = {x | σ x ∈ J (σ t)}.
theorem graph_cover_witness_relabel (T G : SimpleGraph (Fin 5)) (σ : Equiv.Perm (Fin 5))
(h : ∀ x y : Fin 5, T.Adj x y ↔ G.Adj (σ x) (σ y))
(hG : ∃ J : Fin 5 → Finset (Fin 5), GraphCoverWitness G J) :
∃ J : Fin 5 → Finset (Fin 5), GraphCoverWitness T Jgrid_antitone_sequence_geodesicIn LeanCombinatorics for TCS
If c_0, ..., c_{n-1} is a sequence of blocks in Fin k × Fin k such that consecutive terms are distinct, the column never decreases and the row never increases, with each coordinate changing by at most one per step, then there is a simple path in P_k □ P_k from c_0 to c_{n-1} of length equal to their Manhattan distance whose vertex set contains all the c_i.
theorem grid_antitone_sequence_geodesic (k : ℕ) {n : ℕ} (hn : 1 ≤ n) (c : Fin n → Fin k × Fin k)
(hcol : ∀ (i : ℕ) (h : i + 1 < n),
(c ⟨i, by omega⟩).2.val ≤ (c ⟨i + 1, h⟩).2.val ∧
(c ⟨i + 1, h⟩).2.val ≤ (c ⟨i, by omega⟩).2.val + 1)
(hrow : ∀ (i : ℕ) (h : i + 1 < n),
(c ⟨i + 1, h⟩).1.val ≤ (c ⟨i, by omega⟩).1.val ∧
(c ⟨i, by omega⟩).1.val ≤ (c ⟨i + 1, h⟩).1.val + 1)
(hne : ∀ (i : ℕ) (h : i + 1 < n), c ⟨i, by omega⟩ ≠ c ⟨i + 1, h⟩) :
∃ w : ((SimpleGraph.pathGraph k) □ (SimpleGraph.pathGraph k)).Walk
(c ⟨0, by omega⟩) (c ⟨n - 1, by omega⟩),
w.IsPath ∧
w.length = ((SimpleGraph.pathGraph k) □ (SimpleGraph.pathGraph k)).dist
(c ⟨0, by omega⟩) (c ⟨n - 1, by omega⟩) ∧
(∀ i : Fin n, c i ∈ w.support)grid_monotone_sequence_geodesicIn LeanCombinatorics for TCS
If c_0, ..., c_{n-1} is a sequence of blocks in Fin k × Fin k such that consecutive terms are distinct, both coordinates never decrease, and each coordinate increases by at most one per step, then there is a simple path in P_k □ P_k from c_0 to c_{n-1} whose length is their Manhattan distance and whose vertex set contains all the c_i.
theorem grid_monotone_sequence_geodesic (k : ℕ) {n : ℕ} (hn : 1 ≤ n) (c : Fin n → Fin k × Fin k)
(hmono : ∀ (i : ℕ) (h : i + 1 < n),
(c ⟨i, by omega⟩).1.val ≤ (c ⟨i + 1, h⟩).1.val ∧
(c ⟨i, by omega⟩).2.val ≤ (c ⟨i + 1, h⟩).2.val)
(hne : ∀ (i : ℕ) (h : i + 1 < n), c ⟨i, by omega⟩ ≠ c ⟨i + 1, h⟩)
(hstep : ∀ (i : ℕ) (h : i + 1 < n),
(c ⟨i + 1, h⟩).1.val ≤ (c ⟨i, by omega⟩).1.val + 1 ∧
(c ⟨i + 1, h⟩).2.val ≤ (c ⟨i, by omega⟩).2.val + 1) :
∃ w : ((SimpleGraph.pathGraph k) □ (SimpleGraph.pathGraph k)).Walk
(c ⟨0, by omega⟩) (c ⟨n - 1, by omega⟩),
w.IsPath ∧
w.length = ((SimpleGraph.pathGraph k) □ (SimpleGraph.pathGraph k)).dist
(c ⟨0, by omega⟩) (c ⟨n - 1, by omega⟩) ∧
(∀ i : Fin n, c i ∈ w.support)grid_vandermonde_shift_detIn LeanCombinatorics for TCS
For any commutative ring R and vectors a, b with b_i = a_i + D, the determinant of the 3x3 matrix with rows 1, a, and b^2 equals (a_1 - a_0) * (a_2 - a_0) * (a_2 - a_1).
theorem grid_vandermonde_shift_det {R : Type*} [CommRing R] (a b : Fin 3 → R) (D : R)
(hb : ∀ i, b i = a i + D) :
Matrix.det (![fun _ => 1, fun j => a j, fun j => (b j) ^ 2] : Matrix (Fin 3) (Fin 3) R) =
(a 1 - a 0) * (a 2 - a 0) * (a 2 - a 1)hamming_inertia_boundIn LeanCombinatorics for TCS
Let n be a natural number, and let F be a finite subset of (Fin n → ℝ) such that (x i)^2 = 1 for all x ∈ F and all i : Fin n. Let k : Finset (Fin n) → ℝ be a family of coefficients, and let lambda > 0. If for all x, y ∈ F the kernel ∑ T, k T * (∏ i ∈ T, x i) * (∏ i ∈ T, y i) equals lambda when x = y and 0 when x ≠ y, then F.card ≤ (Finset.univ.filter (fun T => 0 < k T)).card.
theorem hamming_inertia_bound {n : ℕ} (F : Finset (Fin n → ℝ))
(hF : ∀ x ∈ F, ∀ i : Fin n, (x i) ^ 2 = 1)
(k : Finset (Fin n) → ℝ) (lambda : ℝ) (hlambda : 0 < lambda)
(hK : ∀ x ∈ F, ∀ y ∈ F, (∑ T : Finset (Fin n), k T * (∏ i ∈ T, x i) * (∏ i ∈ T, y i)) = if x = y then lambda else 0) :
F.card ≤ (Finset.univ.filter (fun T : Finset (Fin n) => 0 < k T)).cardhandshake_seq_double_edges_card_leIn LeanCombinatorics for TCS
In a clean handshake sequence over $k$ gloves, double handshakes collectively cover at most $k(k-1)$ distinct edges, since each of the $\binom{k}{2}$ glove pairs supports at most 2 distinct double handshake edges.
theorem handshake_seq_double_edges_card_le {V Γ : Type*} [DecidableEq V] [DecidableEq Γ] [Fintype Γ]
(seq : List (Handshake V Γ)) (hc : CleanHandshakeSeq seq (fun _ => (∅ : Set V))) :
(seq.filterMap (fun h => match h with
| .double _ _ _ _ => some (handshake_edge h)
| .single _ _ _ => none)).toFinset.card ≤ Fintype.card Γ * (Fintype.card Γ - 1)handshake_seq_edge_eq_of_sides_eqIn LeanCombinatorics for TCS
Two handshakes of the same clean sequence that directly touch the same pair of glove sides cover the same edge, because each glove side is directly touched by at most one vertex.
theorem handshake_seq_edge_eq_of_sides_eq {V Γ : Type*} [DecidableEq Γ]
(seq : List (Handshake V Γ)) (t : Γ × Bool → Set V) (hc : CleanHandshakeSeq seq t)
{h₁ h₂ : Handshake V Γ} (hm₁ : h₁ ∈ seq) (hm₂ : h₂ ∈ seq)
(hl : handshake_left_side h₁ = handshake_left_side h₂)
(hr : handshake_right_side h₁ = handshake_right_side h₂) :
handshake_edge h₁ = handshake_edge h₂handshake_seq_edge_eq_of_sym2_sides_eqIn LeanCombinatorics for TCS
Two handshakes of the same clean sequence that touch the same unordered pair of sides in $\mathrm{Sym}^2(\Gamma \times \mathrm{Bool})$ cover the same edge, since each side has at most one toucher along the sequence.
theorem handshake_seq_edge_eq_of_sym2_sides_eq {V Γ : Type*} [DecidableEq Γ]
(seq : List (Handshake V Γ)) (t : Γ × Bool → Set V) (hc : CleanHandshakeSeq seq t)
{h₁ h₂ : Handshake V Γ} (hm₁ : h₁ ∈ seq) (hm₂ : h₂ ∈ seq)
(hsides : (s(handshake_left_side h₁, handshake_right_side h₁) : Sym2 (Γ × Bool)) =
s(handshake_left_side h₂, handshake_right_side h₂)) :
handshake_edge h₁ = handshake_edge h₂handshake_seq_edges_card_le_sqIn LeanCombinatorics for TCS
A clean handshake sequence using $k$ gloves covers at most $k^2$ distinct edges: at most $k$ edges come from single-gloved handshakes, and for each of the $\binom{k}{2}$ pairs of gloves at most $2$ further edges come from double-gloved handshakes between them (besides the two edges already counted for those gloves), giving $k + 2\binom{k}{2} = k^2$.
theorem handshake_seq_edges_card_le_sq {V Γ : Type*} [DecidableEq V] [DecidableEq Γ] [Fintype Γ]
(seq : List (Handshake V Γ)) (hc : CleanHandshakeSeq seq (fun _ => (∅ : Set V))) :
(seq.map handshake_edge).toFinset.card ≤ Fintype.card Γ ^ 2handshake_seq_one_glove_edges_eqIn LeanCombinatorics for TCS
If seq is a clean handshake sequence over the one-element glove type Fin 1 starting from the empty contamination map, then all handshakes in seq cover one and the same edge of V; in particular such a sequence covers at most one edge, whatever V is.
theorem handshake_seq_one_glove_edges_eq {V : Type*} (seq : List (Handshake V (Fin 1)))
(h : CleanHandshakeSeq seq (fun _ => (∅ : Set V))) :
∃ e : Sym2 V, ∀ g ∈ seq, handshake_edge g = ehandshake_seq_single_edges_card_leIn LeanCombinatorics for TCS
In a clean sequence over $k$ gloves starting from the empty contamination map, all single-gloved handshakes together cover at most $k$ distinct edges: a single handshake on glove $g$ touches both sides of $g$, and each side is touched by at most one vertex, so every single handshake on $g$ covers the same edge.
theorem handshake_seq_single_edges_card_le {V Γ : Type*} [DecidableEq V] [DecidableEq Γ] [Fintype Γ]
(seq : List (Handshake V Γ)) (hc : CleanHandshakeSeq seq (fun _ => (∅ : Set V))) :
(seq.filterMap (fun h => match h with
| .single _ _ _ => some (handshake_edge h)
| .double _ _ _ _ => none)).toFinset.card ≤ Fintype.card Γhandshake_sides_ne_of_cleanIn LeanCombinatorics for TCS
In any clean handshake sequence, the left and right glove sides of each handshake are distinct (single handshakes use opposite sides of the same glove; double handshakes use sides of distinct gloves).
theorem handshake_sides_ne_of_clean {V Γ : Type*} [DecidableEq Γ]
(seq : List (Handshake V Γ)) (t : Γ × Bool → Set V) (hc : CleanHandshakeSeq seq t)
{h : Handshake V Γ} (hm : h ∈ seq) :
handshake_left_side h ≠ handshake_right_side hhandshake_touchers_subset_seq_touchersIn LeanCombinatorics for TCS
If a handshake $h$ is in the sequence seq, the vertices directly touching side $s$ during $h$ are contained in the sequence touchers of $s$.
theorem handshake_touchers_subset_seq_touchers {V Γ : Type*} [DecidableEq Γ]
(seq : List (Handshake V Γ)) (h : Handshake V Γ) (s : Γ × Bool)
(hm : h ∈ seq) : handshake_touchers h s ⊆ seq_touchers seq shankel_fourier_eq_zeroIn LeanCombinatorics for TCS
The two-dimensional cyclic Fourier transform of a Hankel matrix (x, y) ↦ φ(x + y) is diagonal: every entry with m ≠ n vanishes.
theorem hankel_fourier_eq_zero {N : ℕ} [NeZero N] (φ : ZMod N → ℂ) {m n : ZMod N} (hmn : m ≠ n) :
cyclic_matrix_fourier N (Matrix.of fun x y => φ (x + y)) m n = 0harborth_bound_rank_three_mul_twoIn LeanCombinatorics for TCS
If Harborth's bound holds for (ZMod k)^3, it holds for (ZMod (2k))^3 by 2-adic fiber pairing.
theorem harborth_bound_rank_three_mul_two (k : ℕ) (hk : 1 ≤ k) (h : ∀ (S : Multiset (Fin 3 → ZMod k)), S.card = 8 * k - 7 → ∃ T : Multiset (Fin 3 → ZMod k), T ≤ S ∧ T.card = k ∧ T.sum = 0) (S : Multiset (Fin 3 → ZMod (2 * k))) (hS : S.card = 8 * (2 * k) - 7) : ∃ T : Multiset (Fin 3 → ZMod (2 * k)), T ≤ S ∧ T.card = 2 * k ∧ T.sum = 0
harborth_bound_rank_three_two_mul_oddIn LeanCombinatorics for TCS
For every odd integer m ≥ 3, every multiset of 8(2m) - 7 elements in (ZMod (2m))^3 contains a submultiset of size 2m whose sum is 0.
theorem harborth_bound_rank_three_two_mul_odd (m : ℕ) (hm : 3 ≤ m) (hodd : Odd m) (S : Multiset (Fin 3 → ZMod (2 * m))) (hS : S.card = 8 * (2 * m) - 7) : ∃ T : Multiset (Fin 3 → ZMod (2 * m)), T ≤ S ∧ T.card = 2 * m ∧ T.sum = 0
harborth_double_hom_halfIn LeanCombinatorics for TCS
The halving map is a right inverse of the doubling map on even residues: if w is 0 mod 2 then doubling ⌊w.val/2⌋ gives back w.
theorem harborth_double_hom_half (k : ℕ) (hk : 1 ≤ k) (w : ZMod (2 * k)) (h : ZMod.cast w = (0 : ZMod 2)) : harborth_double_hom k (harborth_half k w) = w
harborth_double_hom_nat_castIn LeanCombinatorics for TCS
The doubling map sends the class of a natural number n to the class of 2n.
theorem harborth_double_hom_nat_cast (k n : ℕ) : harborth_double_hom k (n : ZMod k) = (2 * n : ℕ)
harborth_pair_key_specIn LeanCombinatorics for TCS
If the two members of a pair have the same parity, doubling the pair's key gives the sum of the two members.
theorem harborth_pair_key_spec (k : ℕ) (hk : 1 ≤ k) (p : (Fin 3 → ZMod (2 * k)) × (Fin 3 → ZMod (2 * k))) (h : harborth_parity k p.1 = harborth_parity k p.2) : harborth_double_pi k (harborth_pair_key k p) = p.1 + p.2
has_three_colored_anti_ramsey_monoIn LeanCombinatorics for TCS
Induced-subgraph monotonicity: if K_N admits a 3-edge-colouring whose every n-subset sees all three colours, then so does every induced subgraph K_M with n ≤ M ≤ N.
theorem has_three_colored_anti_ramsey_mono (N M n : ℕ) (h : has_three_colored_anti_ramsey N n) (hn : n ≤ M) (hMN : M ≤ N) : has_three_colored_anti_ramsey M n
has_three_colored_anti_ramsey_of_countingIn LeanCombinatorics for TCS
First-moment (union-bound) reduction: if 3 · C(N,n) · 2^(C(n,2)) < 3^(C(n,2)), then there is a 3-edge-colouring of K_N in which every n-subset sees all three colours.
theorem has_three_colored_anti_ramsey_of_counting (N n : ℕ) (h : 3 * N.choose n * 2 ^ (n.choose 2) < 3 ^ (n.choose 2)) : has_three_colored_anti_ramsey N n
heap_block_base_last_injectiveIn LeanCombinatorics for TCS
For every natural number k and block indices q₁, q₂ : Fin (k + 2), if the block base permutations heapBlockBase (k + 1) q₁.val and heapBlockBase (k + 1) q₂.val map Fin.last (k + 1) to the same element, then q₁ = q₂.
theorem heap_block_base_last_injective (k : ℕ) (q₁ q₂ : Fin (k + 2))
(h : heapBlockBase (k + 1) q₁.val (Fin.last (k + 1)) = heapBlockBase (k + 1) q₂.val (Fin.last (k + 1))) :
q₁ = q₂heap_final_perm_cycle_dichotomyIn LeanCombinatorics for TCS
Let m ≥ 2. The permutation induced by the final arrangement of the order-m Heap algorithm satisfies a strict dichotomy: if m is even and 4 ≤ m, it is a single m-cycle whose order is m; if m is odd and 3 ≤ m, it is the transposition swapping 0 and m - 1.
theorem heap_final_perm_cycle_dichotomy (m : ℕ) (hm : 2 ≤ m) :
(Even m ∧ 4 ≤ m → (heap_final_perm m).IsCycle ∧ orderOf (heap_final_perm m) = m) ∧
(Odd m ∧ 3 ≤ m → heap_final_perm m = Equiv.swap (⟨0, by omega⟩ : Fin m) ⟨m - 1, by omega⟩)heap_final_perm_even_cycleIn LeanCombinatorics for TCS
For any even m ≥ 4, the final permutation of the order-m Heap algorithm is a single m-cycle whose m-th power is the identity.
theorem heap_final_perm_even_cycle (m : ℕ) (hm_even : Even m) (hm4 : 4 ≤ m) :
(heap_final_perm m).IsCycle ∧ (heap_final_perm m) ^ m = 1heap_final_perm_oddIn LeanCombinatorics for TCS
For any odd m ≥ 3, the final permutation of the order-m Heap algorithm is the transposition swapping 0 and m - 1.
theorem heap_final_perm_odd (m : ℕ) (hm_odd : Odd m) (hm3 : 3 ≤ m) :
heap_final_perm m = Equiv.swap (⟨0, by omega⟩ : Fin m) ⟨m - 1, by omega⟩heap_unrank_bijectiveIn LeanCombinatorics for TCS
For every integer n ≥ 2, the Heap unranking map heapUnrank n from HeapCode n to Equiv.Perm (Fin n) is bijective.
theorem heap_unrank_bijective (n : ℕ) (hn : 2 ≤ n) :
Function.Bijective (heapUnrank n)heap_unrank_bijective_and_index_consistentIn LeanCombinatorics for TCS
For every integer n ≥ 2, the Heap permutation unranking map heapUnrank n is a bijection from the factorial-base code space HeapCode n to the permutation space Equiv.Perm (Fin n), and for every code vector d : HeapCode n, heapUnrank n d equals the permutation heapPermSeq n (heapCodeIndex d) in the Heap output sequence.
theorem heap_unrank_bijective_and_index_consistent (n : ℕ) (hn : 2 ≤ n) :
Function.Bijective (heapUnrank n) ∧
∀ d : HeapCode n, heapUnrank n d = heapPermSeq n (heapCodeIndex d)heap_unrank_eq_heapPermSeqIn LeanCombinatorics for TCS
For every natural number n and every code vector d : HeapCode n, heapUnrank n d equals heapPermSeq n (heapCodeIndex d).
theorem heap_unrank_eq_heapPermSeq (n : ℕ) :
∀ d : HeapCode n, heapUnrank n d = heapPermSeq n (heapCodeIndex d)helical_affine_independent_fourIn LeanCombinatorics for TCS
For every natural number n, every 4-element subset s of helical_config n in EuclideanSpace ℝ (Fin 3) is affine independent.
theorem helical_affine_independent_four (n : ℕ) (s : Finset (EuclideanSpace ℝ (Fin 3)))
(hs : s ⊆ helical_config n) (hcard : s.card = 4) :
AffineIndependent ℝ ((↑) : s → EuclideanSpace ℝ (Fin 3))helical_arc_general_positionIn LeanCombinatorics for TCS
Let h ≠ 0, and let (a, b) be an open interval of length less than π. Among the points (cos t, sin t, ht) for t ∈ (a, b), no four are coplanar and no five are cospherical.
theorem helical_arc_general_position (h : ℝ) (hh : h ≠ 0) (a b : ℝ) (hab : b - a < Real.pi)
(s : Finset (EuclideanSpace ℝ (Fin 3))) (hs : (s : Set (EuclideanSpace ℝ (Fin 3))) ⊆ helical_curve h '' Set.Ioo a b) :
(s.card = 4 → ¬ Coplanar ℝ (s : Set (EuclideanSpace ℝ (Fin 3)))) ∧
(s.card = 5 → ¬ EuclideanGeometry.Cospherical (s : Set (EuclideanSpace ℝ (Fin 3))))helical_arc_not_coplanar_fourIn LeanCombinatorics for TCS
For any nonzero h ∈ ℝ and open interval (a, b) of length less than π, no four points on the helical arc (cos t, sin t, ht) for t ∈ (a, b) are coplanar.
theorem helical_arc_not_coplanar_four (h : ℝ) (hh : h ≠ 0) (a b : ℝ) (hab : b - a < Real.pi)
(s : Finset (EuclideanSpace ℝ (Fin 3))) (hs : (s : Set (EuclideanSpace ℝ (Fin 3))) ⊆ helical_curve h '' Set.Ioo a b)
(hcard : s.card = 4) : ¬ Coplanar ℝ (s : Set (EuclideanSpace ℝ (Fin 3)))helical_arc_not_cospherical_fiveIn LeanCombinatorics for TCS
For any nonzero h ∈ ℝ and open interval (a, b) of length less than π, no five points on the helical arc (cos t, sin t, ht) for t ∈ (a, b) are cospherical.
theorem helical_arc_not_cospherical_five (h : ℝ) (hh : h ≠ 0) (a b : ℝ) (hab : b - a < Real.pi)
(s : Finset (EuclideanSpace ℝ (Fin 3))) (hs : (s : Set (EuclideanSpace ℝ (Fin 3))) ⊆ helical_curve h '' Set.Ioo a b)
(hcard : s.card = 5) : ¬ EuclideanGeometry.Cospherical (s : Set (EuclideanSpace ℝ (Fin 3)))helical_crescent_configurationIn LeanCombinatorics for TCS
For every natural number n with 3 ≤ n, the helical configuration helical_config n satisfies is_crescent_configuration (helical_config n), and the minimum crescent dimension crescent_min_dimension n is at most 3.
theorem helical_crescent_configuration (n : ℕ) (hn : 3 ≤ n) :
is_crescent_configuration (helical_config n) ∧ crescent_min_dimension n ≤ 3helical_in_general_positionIn LeanCombinatorics for TCS
For every natural number n with 3 ≤ n, the configuration helical_config n in EuclideanSpace ℝ (Fin 3) satisfies in_general_position 3.
theorem helical_in_general_position (n : ℕ) (hn : 3 ≤ n) :
in_general_position 3 (helical_config n)helical_not_cospherical_fiveIn LeanCombinatorics for TCS
For every natural number n, no 5-element subset s of helical_config n in EuclideanSpace ℝ (Fin 3) lies on a metric sphere in EuclideanSpace ℝ (Fin 3).
theorem helical_not_cospherical_five (n : ℕ) (s : Finset (EuclideanSpace ℝ (Fin 3)))
(hs : s ⊆ helical_config n) (hcard : s.card = 5) :
¬∃ (c : EuclideanSpace ℝ (Fin 3)) (r : ℝ), ∀ x ∈ s, dist x c = rhigh_rep_set_nonemptyIn LeanCombinatorics for TCS
If |A|(|A| - 1) > 2|G| then some group element has more than two ordered restricted pair representations from A, i.e. the high-representation set P(A) is nonempty.
theorem high_rep_set_nonempty {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G] {A : Finset G} (h : 2 * Fintype.card G < A.card * (A.card - 1)) : (highRepSet A).Nonemptyhypercube_coil_c4_identityIn LeanCombinatorics for TCS
For any maximum coil S in the hypercube Q_n with 13 ≤ n, the following equality holds in the integers ℤ: (n^2 - 3*n + 3 : ℤ) * S.card - ∑ m ∈ Finset.range n, (m.choose 2 : ℤ) * hypercube_degree_count n S m = (n.choose 2 : ℤ) * (2 : ℤ)^(n - 1) - 2 * (hypercube_disjoint_squares_count n S : ℤ).
open scoped Classical BigOperators in
theorem hypercube_coil_c4_identity (n : ℕ) (hn : 13 ≤ n) (S : Finset (Fin n → Bool))
(hS : is_max_hypercube_coil n S) :
((n ^ 2 - 3 * n + 3 : ℤ) * S.card -
∑ m ∈ Finset.range n, (m.choose 2 : ℤ) * (hypercube_degree_count n S m : ℤ)) =
(n.choose 2 : ℤ) * (2 : ℤ) ^ (n - 1) - 2 * (hypercube_disjoint_squares_count n S : ℤ)hypercube_degree_count_sum_rangeIn LeanCombinatorics for TCS
For any maximum coil S in Q_n with 13 ≤ n, the sum of degree counts y_m over m ∈ {0, ..., n-1} is 2^n - |S|, because the total number of non-coil vertices is 2^n - |S| and y_n = 0.
open scoped Classical BigOperators in
theorem hypercube_degree_count_sum_range (n : ℕ) (hn : 13 ≤ n)
(S : Finset (Fin n → Bool)) (hS : is_max_hypercube_coil n S) :
∑ m ∈ Finset.range n, (hypercube_degree_count n S m : ℤ) = (2 : ℤ) ^ n - (S.card : ℤ)hypercube_degree_count_weighted_sum_rangeIn LeanCombinatorics for TCS
For any maximum coil S in Q_n with 13 ≤ n, the weighted sum of degree counts m * y_m over m ∈ {0, ..., n-1} is (n - 2)|S|, counting edges between the coil and its complement.
open scoped Classical BigOperators in
theorem hypercube_degree_count_weighted_sum_range (n : ℕ) (hn : 13 ≤ n)
(S : Finset (Fin n → Bool)) (hS : is_max_hypercube_coil n S) :
∑ m ∈ Finset.range n, (m : ℤ) * (hypercube_degree_count n S m : ℤ) = (n - 2 : ℤ) * (S.card : ℤ)hypercube_disjoint_squares_eliminated_identityIn LeanCombinatorics for TCS
For a maximum coil S in Q_n (n ≥ 13), combining the C4 square counts across families F1 through F5 yields 4 * F5 = ∑_{m=0}^{n-1} binom(n-m, 2) y_m - binom(n-2, 2) |S| + ∑_{m=0}^{n-1} binom(m, 2) y_m - |S|.
open scoped Classical BigOperators in
theorem hypercube_disjoint_squares_eliminated_identity (n : ℕ) (hn : 13 ≤ n)
(S : Finset (Fin n → Bool)) (hS : is_max_hypercube_coil n S) :
4 * (hypercube_disjoint_squares_count n S : ℤ) =
∑ m ∈ Finset.range n, ((n - m).choose 2 : ℤ) * (hypercube_degree_count n S m : ℤ) -
((n - 2).choose 2 : ℤ) * (S.card : ℤ) +
∑ m ∈ Finset.range n, (m.choose 2 : ℤ) * (hypercube_degree_count n S m : ℤ) -
(S.card : ℤ)hypercube_max_coil_c4_strictIn LeanCombinatorics for TCS
Let n ≥ 13 and let S be a maximum-length coil in the hypercube Q_n with degree counts y_m. If y_0 > 0, then in ℤ, (n^2 - 3*n + 3 : ℤ) * S.card - ∑ m ∈ Finset.range n, (m.choose 2 : ℤ) * y_m < (n.choose 2 : ℤ) * (2 : ℤ)^(n - 1).
open scoped Classical BigOperators in
theorem hypercube_max_coil_c4_strict (n : ℕ) (hn : 13 ≤ n) (S : Finset (Fin n → Bool))
(hS : is_max_hypercube_coil n S) (hy0 : 0 < hypercube_degree_count n S 0) :
((n ^ 2 - 3 * n + 3 : ℤ) * S.card -
∑ m ∈ Finset.range n, (m.choose 2 : ℤ) * (hypercube_degree_count n S m : ℤ)) <
(n.choose 2 : ℤ) * (2 : ℤ) ^ (n - 1)hypergraph_card_le_quill_edges_add_base_edgesIn LeanCombinatorics for TCS
In any finite hypergraph S, the number of edges is at most the number of quill-bearing edges plus the number of base edges (edges containing only vertices of degree at least 2).
theorem hypergraph_card_le_quill_edges_add_base_edges
{α : Type*} [DecidableEq α] (S : Finset (Finset α)) :
S.card ≤
(S.filter (fun s => ∃ x ∈ s, (S.filter (x ∈ ·)).card = 1)).card +
(S.filter (fun s => ∀ x ∈ s, 2 ≤ (S.filter (x ∈ ·)).card)).cardhypergraph_free_of_vertex_card_ltIn LeanCombinatorics for TCS
If the forbidden hypergraph F has more vertices than the n-element ground set Fin n, then every hypergraph H on Fin n is F-free, since there is no embedding of F's vertex set into Fin n.
theorem hypergraph_free_of_vertex_card_lt {W : Type*} [Fintype W] {n : ℕ} (H : Finset (Finset (Fin n))) (F : Finset (Finset W)) (h : n < Fintype.card W) : is_hypergraph_free H Fhypergraph_quill_edges_le_quillsIn LeanCombinatorics for TCS
In any finite hypergraph S, the number of edges containing at least one vertex of degree 1 (quill) is at most the total number of vertices of degree 1 in the hypergraph.
theorem hypergraph_quill_edges_le_quills {α : Type*} [DecidableEq α] (S : Finset (Finset α)) :
(S.filter (fun s => ∃ x ∈ s, (S.filter (x ∈ ·)).card = 1)).card ≤
((S.biUnion id).filter (fun x => (S.filter (x ∈ ·)).card = 1)).cardinfinite_depth_criterionIn LeanCombinatorics for TCS
Let B be a finite nonempty set of nonempty standard permutations of 1, ..., |β| (so B : Set (List ℕ) satisfies B.Finite, B.Nonempty, and each β ∈ B satisfies β.Perm (List.range' 1 β.length) with β ≠ []), and let ρ be a standard permutation of 1, ..., n (so ρ.Perm (List.range' 1 n) with n = ρ.length) that avoids every pattern in B. Then the following conditions are equivalent (asserted as (i) ↔ (ii) and (ii) ↔ (iii)): (i) for every k : ℕ, there exists a standard permutation σ of 1, ..., n + k (with σ.Perm (List.range' 1 σ.length) and σ.length = n + k) avoiding every pattern in B such that σ.filter (· ≤ n) = ρ; (ii) there exists a gap g ≤ n such that inserting the increasing block of new maxima [n + 1, ..., n + m] or the decreasing block [n + m, ..., n + 1] into gap g of ρ yields a standard permutation of 1, ..., n + m avoiding every pattern in B, where m = ||B|| = sSup (List.length '' B); (iii) there exists a standard permutation σ of 1, ..., σ.length (with σ.Perm (List.range' 1 σ.length)) avoiding every pattern in B such that σ.filter (· ≤ n) = ρ and σ.length ≥ n + (m - 1)^2 * (n + 1) + 1.
theorem infinite_depth_criterion
(B : Set (List ℕ)) (hB_fin : B.Finite) (hB_ne : B.Nonempty)
(hB_perm : ∀ β ∈ B, β.Perm (List.range' 1 β.length) ∧ β ≠ [])
(ρ : List ℕ) (hρ : ρ.Perm (List.range' 1 ρ.length))
(hρ_av : ∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist ρ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) :
let m := sSup (List.length '' B)
let n := ρ.length
((∀ k : ℕ, ∃ σ : List ℕ,
σ.Perm (List.range' 1 σ.length) ∧
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist σ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∧
σ.filter (· ≤ n) = ρ ∧ σ.length = n + k) ↔
(∃ g ≤ n,
((ρ.take g ++ List.range' (n + 1) m ++ ρ.drop g).Perm (List.range' 1 (n + m)) ∧
∀ β ∈ B, ¬ ∃ s : List ℕ,
s.Sublist (ρ.take g ++ List.range' (n + 1) m ++ ρ.drop g) ∧
∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∨
((ρ.take g ++ (List.range' (n + 1) m).reverse ++ ρ.drop g).Perm (List.range' 1 (n + m)) ∧
∀ β ∈ B, ¬ ∃ s : List ℕ,
s.Sublist (ρ.take g ++ (List.range' (n + 1) m).reverse ++ ρ.drop g) ∧
∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]))) ∧
((∃ g ≤ n,
((ρ.take g ++ List.range' (n + 1) m ++ ρ.drop g).Perm (List.range' 1 (n + m)) ∧
∀ β ∈ B, ¬ ∃ s : List ℕ,
s.Sublist (ρ.take g ++ List.range' (n + 1) m ++ ρ.drop g) ∧
∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∨
((ρ.take g ++ (List.range' (n + 1) m).reverse ++ ρ.drop g).Perm (List.range' 1 (n + m)) ∧
∀ β ∈ B, ¬ ∃ s : List ℕ,
s.Sublist (ρ.take g ++ (List.range' (n + 1) m).reverse ++ ρ.drop g) ∧
∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h])) ↔
(∃ σ : List ℕ,
σ.Perm (List.range' 1 σ.length) ∧
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist σ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∧
σ.filter (· ≤ n) = ρ ∧
σ.length ≥ n + (m - 1) ^ 2 * (n + 1) + 1))inner_product_norm_sq_add_smulIn LeanCombinatorics for TCS
In any real inner product space V, for any vectors x₀ and v, and any real scalar k, the squared norm of x₀ + k • v is ||x₀ + k • v||^2 = ||v||^2 * k^2 + 2 * ⟪x₀, v⟫ * k + ||x₀||^2.
theorem inner_product_norm_sq_add_smul {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
(x₀ v : V) (k : ℝ) :
‖x₀ + k • v‖ ^ 2 = ‖v‖ ^ 2 * k ^ 2 + 2 * inner ℝ x₀ v * k + ‖x₀‖ ^ 2inner_product_norm_sq_apIn LeanCombinatorics for TCS
Let V be a real inner product space, let M ≥ 2, and let x : Fin M → V form an arithmetic progression with consecutive points at distance √U (that is, there exists v ∈ V with ||v||^2 = U such that x k = x 0 + k • v for all k ∈ Fin M). Then there exist real numbers β and γ such that ||x k||^2 = U * k^2 + β * k + γ for all k ∈ Fin M.
theorem inner_product_norm_sq_ap {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
{M : ℕ} (hM : 2 ≤ M) (x : Fin M → V) (U : ℝ)
(h_ap : ∃ v : V, ‖v‖ ^ 2 = U ∧ ∀ k : Fin M, x k = x ⟨0, by omega⟩ + (k : ℝ) • v) :
∃ β γ : ℝ, ∀ k : Fin M, ‖x k‖ ^ 2 = U * (k : ℝ) ^ 2 + β * (k : ℝ) + γinner_product_norm_sq_three_apIn LeanCombinatorics for TCS
In any real inner product space V, three consecutive points x, y, z in an arithmetic progression with common difference vector v satisfying ||v||^2 = R (so y = x + v and z = x + 2 • v) satisfy ||x||^2 - 2 * ||y||^2 + ||z||^2 = 2 * R.
theorem inner_product_norm_sq_three_ap {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
(x y z v : V) (R : ℝ) (hv : ‖v‖ ^ 2 = R)
(hy : y = x + v) (hz : z = x + (2 : ℝ) • v) :
‖x‖ ^ 2 - 2 * ‖y‖ ^ 2 + ‖z‖ ^ 2 = 2 * Rinner_sub_of_norm_sub_eqIn LeanCombinatorics for TCS
In a real inner product space, if a vector $y$ satisfies $\|y - x\| = \|y - x'\|$, then $2\langle y, x' - x\rangle = \|x'\|^2 - \|x\|^2$.
theorem inner_sub_of_norm_sub_eq {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
(y x x' : V) (h : ‖y - x‖ = ‖y - x'‖) :
2 * @inner ℝ V _ y (x' - x) = ‖x'‖ ^ 2 - ‖x‖ ^ 2inner_sub_sub_eq_zero_of_equidistantIn LeanCombinatorics for TCS
In a real inner product space, if two vectors $y$ and $y'$ each satisfy $\|y - x\| = \|y - x'\|$ and $\|y' - x\| = \|y' - x'\|$, then $\langle y - y', x - x'\rangle = 0$.
theorem inner_sub_sub_eq_zero_of_equidistant {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
(y y' x x' : V) (hy : ‖y - x‖ = ‖y - x'‖) (hy' : ‖y' - x‖ = ‖y' - x'‖) :
@inner ℝ V _ (y - y') (x - x') = 0int_crescent_config_is_crescentIn LeanCombinatorics for TCS
For every integer n ≥ 3, the embedded configuration of int_crescent_config n in EuclideanSpace ℝ (Fin 3) under int_to_euclidean 3 is a crescent configuration.
theorem int_crescent_config_is_crescent (n : ℕ) (hn : 3 ≤ n) :
is_crescent_configuration ((int_crescent_config n).image (int_to_euclidean 3))int_crescent_distancesIn LeanCombinatorics for TCS
For every integer n ≥ 3, the embedded configuration of int_crescent_config n in EuclideanSpace ℝ (Fin 3) under int_to_euclidean 3 has n - 1 distinct pairwise distances with multiplicities 1, ..., n - 1.
theorem int_crescent_distances (n : ℕ) (hn : 3 ≤ n) :
∃ D : Finset ℝ,
D.card = ((int_crescent_config n).image (int_to_euclidean 3)).card - 1 ∧
(∀ u ∈ ((int_crescent_config n).image (int_to_euclidean 3)).powersetCard 2,
∃ r ∈ D, ∃ x ∈ u, ∃ y ∈ u, x ≠ y ∧ dist x y = r) ∧
D.image (distance_multiplicity ((int_crescent_config n).image (int_to_euclidean 3))) =
Finset.Icc 1 (((int_crescent_config n).image (int_to_euclidean 3)).card - 1)int_crescent_in_general_positionIn LeanCombinatorics for TCS
For every integer n ≥ 3, the embedded configuration of int_crescent_config n in EuclideanSpace ℝ (Fin 3) under int_to_euclidean 3 is in general position.
theorem int_crescent_in_general_position (n : ℕ) (hn : 3 ≤ n) :
in_general_position 3 ((int_crescent_config n).image (int_to_euclidean 3))int_sign_sub_pm_one_of_abs_ge_twoIn LeanCombinatorics for TCS
If u is an integer with |u| ≥ 2 and s ∈ {-1, 1}, then the sign of u - s equals the sign of u.
theorem int_sign_sub_pm_one_of_abs_ge_two (u : ℤ) (s : ℤ) (hu : 2 ≤ |u|) (hs : s = 1 ∨ s = -1) :
Int.sign (u - s) = Int.sign uinteger_crescent_configurationIn LeanCombinatorics for TCS
For every integer n ≥ 3, there exists a finite subset S of Fin 3 → ℤ of cardinality n such that the embedded image of S in EuclideanSpace ℝ (Fin 3) under int_to_euclidean 3 is a crescent configuration and every coordinate of every point in S has absolute value at most 2 * (n - 1) * (4 * n^2 + 1)^(n - 1).
theorem integer_crescent_configuration (n : ℕ) (hn : 3 ≤ n) :
∃ S : Finset (Fin 3 → ℤ),
S.card = n ∧
is_crescent_configuration (S.image (int_to_euclidean 3)) ∧
∀ p ∈ S, ∀ i : Fin 3, |p i| ≤ 2 * ((n : ℤ) - 1) * (4 * (n : ℤ)^2 + 1) ^ (n - 1)isSunflower_kernel_empty_of_disjoint_membersIn LeanCombinatorics for TCS
If a finite family F of finite sets is a sunflower with kernel C and contains two distinct disjoint members, then C is empty.
theorem isSunflower_kernel_empty_of_disjoint_members {α : Type*} [DecidableEq α]
{F : Finset (Finset α)} {C : Finset α} (hF : IsSunflower F C)
{A B : Finset α} (hA : A ∈ F) (hB : B ∈ F) (hne : A ≠ B) (hdisj : Disjoint A B) :
C = ∅is_additive_basis_iff_subset_sums_eq_univIn LeanCombinatorics for TCS
A multiset S over a finite additive commutative group is an additive basis if and only if the finset of all nonempty submultiset sums equals the universal finset.
theorem is_additive_basis_iff_subset_sums_eq_univ {G : Type*} [AddCommGroup G] [DecidableEq G] [Fintype G] (S : Multiset G) : IsAdditiveBasis S ↔ ((S.powerset.filter (· ≠ 0)).map Multiset.sum).toFinset = Finset.univis_additive_basis_of_coverage_and_zero_sumIn LeanCombinatorics for TCS
If every element of a finite additive commutative group is the sum of some submultiset of S (allowing the empty sum), and S also has a nonempty zero-sum submultiset, then S is an additive basis: every group element is the sum of a nonempty submultiset of S.
theorem is_additive_basis_of_coverage_and_zero_sum {G : Type*} [AddCommGroup G] [DecidableEq G] [Fintype G] (S : Multiset G) (hcover : multiset_sum_finset S = Finset.univ) (hzero : ∃ T : Multiset G, T ≤ S ∧ T ≠ 0 ∧ T.sum = 0) : IsAdditiveBasis Sis_iterated_tripartite_insert_of_new_vertexIn LeanCombinatorics for TCS
If a hypergraph F is iterated tripartite and e is a 3-element set of vertices at least one of which is not incident to any edge of F, then F together with e is again iterated tripartite.
theorem is_iterated_tripartite_insert_of_new_vertex {V : Type*} [DecidableEq V]
(F : Finset (Finset V)) {e : Finset V} (hF : is_iterated_tripartite F)
(hcard : e.card = 3) (hnew : ∃ v ∈ e, v ∉ F.biUnion id) :
is_iterated_tripartite (insert e F)is_perfect_set_punctured_zpowersIn LeanCombinatorics for TCS
Let p be a prime and σ be a permutation of Fin p of order p. The punctured cyclic subgroup generated by σ (removing the identity) is a perfect set of order p.
open Equiv Perm Subgroup Classical in
theorem is_perfect_set_punctured_zpowers {p : ℕ} (hp : p.Prime) {σ : Perm (Fin p)}
(hσ : orderOf σ = p) :
is_perfect_set p ((zpowers σ : Set (Perm (Fin p))).toFinset \ {1})is_regular_sequence_not_mem_zeroIn LeanCombinatorics for TCS
A regular sequence in a nontrivial additive commutative group cannot contain the zero element.
theorem is_regular_sequence_not_mem_zero {G : Type*} [AddCommGroup G] [Nontrivial G] {S : Multiset G} (h : IsRegularSequence S) : 0 ∉ Sis_spiny_of_forall_not_subset_erase_biUnionIn LeanCombinatorics for TCS
Let α have decidable equality. If S is a finite collection of finite subsets of α such that for every A ∈ S, A is not a subset of (S.erase A).biUnion id, then S is spiny (IsSpiny S).
theorem is_spiny_of_forall_not_subset_erase_biUnion {α : Type*} [DecidableEq α]
(S : Finset (Finset α))
(h : ∀ A ∈ S, ¬ A ⊆ (S.erase A).biUnion id) :
IsSpiny Sis_subcube_of_avg_pairwise_hamming_dist_eq_density_one_sixteenthIn LeanCombinatorics for TCS
Let n ≥ 4. For any subset F ⊆ (Fin n → Bool) of cardinality 2^(n-4), if avg_pairwise_hamming_dist F = (n - 4) / 2, then F is an (n - 4)-dimensional subcube.
theorem is_subcube_of_avg_pairwise_hamming_dist_eq_density_one_sixteenth
(n : ℕ) (hn : 4 ≤ n) (F : Finset (Fin n → Bool)) (hF : F.card = 2 ^ (n - 4))
(heq : avg_pairwise_hamming_dist F = (n - 4 : ℝ) / 2) :
is_subcube (n - 4) Fis_subcube_of_avg_pairwise_hamming_dist_eq_dyadic_shortIn LeanCombinatorics for TCS
Let $F \subseteq (\mathrm{Fin}\ n \to \mathrm{Bool})$ with $|F| = 2^m$, $m \le n$, $n - m \le 4$. If $\mathrm{avg}(F) = m/2$ then $F$ is an $m$-dimensional subcube.
theorem is_subcube_of_avg_pairwise_hamming_dist_eq_dyadic_short
(n m : ℕ) (hm : m ≤ n) (hclose : n - m ≤ 4) (F : Finset (Fin n → Bool))
(hcard : F.card = 2 ^ m) (havg : avg_pairwise_hamming_dist F = (m : ℝ) / 2) :
is_subcube m Fis_weighted_partial_permutation_of_off_diagonal_zeroIn LeanCombinatorics for TCS
A square complex matrix all of whose off-diagonal entries vanish is a weighted partial permutation matrix.
theorem is_weighted_partial_permutation_of_off_diagonal_zero {n : Type*} (M : Matrix n n ℂ)
(h : ∀ i j, i ≠ j → M i j = 0) : is_weighted_partial_permutation Misosceles_set_partition_of_three_distancesIn LeanCombinatorics for TCS
Let S be a finite isosceles set in a metric space in which at least three distinct nonzero distances occur. Then there is a partition S = X ∪ Y with X and Y disjoint, |X| ≥ 2, and |Y| ≥ 1 such that every y ∈ Y is equidistant from all points of X.
theorem isosceles_set_partition_of_three_distances {M : Type*} [MetricSpace M] [DecidableEq M] (S : Finset M) (h_iso : ∀ x ∈ S, ∀ y ∈ S, ∀ z ∈ S, dist x y = dist y z ∨ dist y z = dist x z ∨ dist x z = dist x y) (h_dist : 3 ≤ (S.offDiag.image (fun p => dist p.1 p.2)).card) : ∃ X Y : Finset M, S = X ∪ Y ∧ Disjoint X Y ∧ 2 ≤ X.card ∧ 1 ≤ Y.card ∧ ∀ y ∈ Y, ∃ r : ℝ, ∀ x ∈ X, dist y x = rk22_code_dense_anchor_of_bounded_multiple_anchorIn LeanCombinatorics for TCS
Reduction step. Fix a multiplier bound c₀ ≥ 1 and ε in (0,1) with 2(1-ε) ≤ c₀·ε. If for every c in [1, c₀] and all sufficiently large r the order c·2^r admits a K_{2,2}-code of density at least 1/(c·2^r), then the anchor statement holds for this ε: every large enough n has an anchor order N ≥ n with N ≤ n/(1-ε) and a K_{2,2}-code of density at least 1/N.
theorem k22_code_dense_anchor_of_bounded_multiple_anchor
(c₀ : ℕ) (hc₀ : 1 ≤ c₀) (ε : ℝ) (hε : 0 < ε) (hε1 : ε < 1)
(hratio : 2 * (1 - ε) ≤ (c₀ : ℝ) * ε)
(H : ∀ c : ℕ, 1 ≤ c → c ≤ c₀ → ∀ᶠ r : ℕ in Filter.atTop,
∃ C : Set (SimpleGraph (Fin (c * 2 ^ r))),
is_kst_code 2 2 (c * 2 ^ r) C ∧
1 / ((c * 2 ^ r : ℕ) : ℝ) ≤
(C.ncard : ℝ) / (2 ^ ((c * 2 ^ r).choose 2) : ℝ)) :
∃ n₀ : ℕ, ∀ n ≥ n₀, ∃ N ≥ n,
(N : ℝ) ≤ (n : ℝ) / (1 - ε) ∧
∃ C : Set (SimpleGraph (Fin N)),
is_kst_code 2 2 N C ∧
1 / (N : ℝ) ≤ (C.ncard : ℝ) / (2 ^ (N.choose 2) : ℝ)k22_code_dense_anchor_of_fixed_multiple_anchorIn LeanCombinatorics for TCS
If for every positive integer c and all sufficiently large r the order c·2^r admits a K_{2,2}-code of density at least 1/(c·2^r), then the anchor statement holds: for every ε in (0,1) and all large enough n there is an anchor order N ≥ n with N ≤ n/(1-ε) and a K_{2,2}-code of density at least 1/N.
theorem k22_code_dense_anchor_of_fixed_multiple_anchor
(H : ∀ c : ℕ, 1 ≤ c → ∀ᶠ r : ℕ in Filter.atTop,
∃ C : Set (SimpleGraph (Fin (c * 2 ^ r))),
is_kst_code 2 2 (c * 2 ^ r) C ∧
1 / ((c * 2 ^ r : ℕ) : ℝ) ≤
(C.ncard : ℝ) / (2 ^ ((c * 2 ^ r).choose 2) : ℝ))
(ε : ℝ) (hε : 0 < ε) (hε1 : ε < 1) :
∃ n₀ : ℕ, ∀ n ≥ n₀, ∃ N ≥ n,
(N : ℝ) ≤ (n : ℝ) / (1 - ε) ∧
∃ C : Set (SimpleGraph (Fin N)),
is_kst_code 2 2 N C ∧
1 / (N : ℝ) ≤ (C.ncard : ℝ) / (2 ^ (N.choose 2) : ℝ)k22_code_dense_anchor_of_half_le_epsIn LeanCombinatorics for TCS
The anchor statement holds in the easy regime ε ≥ 1/2: for every ε in (0,1) with 1/2 ≤ ε there is n₀ such that every n ≥ n₀ has an anchor order N ≥ n with N ≤ n/(1-ε) carrying a K_{2,2}-code of density at least 1/N.
theorem k22_code_dense_anchor_of_half_le_eps (ε : ℝ) (hε : 0 < ε) (hε1 : ε < 1) (hε2 : 1 / 2 ≤ ε) :
∃ n₀ : ℕ, ∀ n ≥ n₀, ∃ N ≥ n,
(N : ℝ) ≤ (n : ℝ) / (1 - ε) ∧
∃ C : Set (SimpleGraph (Fin N)),
is_kst_code 2 2 N C ∧
1 / (N : ℝ) ≤ (C.ncard : ℝ) / (2 ^ (N.choose 2) : ℝ)k22_code_exists_dense_anchorIn LeanCombinatorics for TCS
For every ε in (0, 1) and all sufficiently large n, there exists an anchor order N ≥ n with N ≤ n / (1 - ε) admitting a K_{2,2}-code of density at least 1 / N.
theorem k22_code_exists_dense_anchor (ε : ℝ) (hε : 0 < ε) (hε1 : ε < 1) :
∃ n₀ : ℕ, ∀ n ≥ n₀, ∃ N ≥ n,
(N : ℝ) ≤ (n : ℝ) / (1 - ε) ∧
∃ C : Set (SimpleGraph (Fin N)),
is_kst_code 2 2 N C ∧
1 / (N : ℝ) ≤ (C.ncard : ℝ) / (2 ^ (N.choose 2) : ℝ)k22_code_exists_dense_familyIn LeanCombinatorics for TCS
For every real ε > 0, for all sufficiently large n, there exists a K_{2,2}-code on Fin n with density at least (1 - ε) / n.
theorem k22_code_exists_dense_family (ε : ℝ) (hε : 0 < ε) :
∃ n₀ : ℕ, ∀ n ≥ n₀, ∃ C : Set (SimpleGraph (Fin n)),
is_kst_code 2 2 n C ∧ (1 - ε) / (n : ℝ) ≤ (C.ncard : ℝ) / (2 ^ (n.choose 2) : ℝ)k22_code_exists_dense_family_of_dense_anchorIn LeanCombinatorics for TCS
An anchor statement of the form 'for every ε in (0,1) every large n has an anchor order N ≥ n with N ≤ n/(1-ε) carrying a K_{2,2}-code of density at least 1/N' implies the density statement: for every ε > 0 and all large n there is a K_{2,2}-code on Fin n of density at least (1-ε)/n.
theorem k22_code_exists_dense_family_of_dense_anchor
(H : ∀ ε : ℝ, 0 < ε → ε < 1 → ∃ n₀ : ℕ, ∀ n ≥ n₀, ∃ N ≥ n,
(N : ℝ) ≤ (n : ℝ) / (1 - ε) ∧
∃ C : Set (SimpleGraph (Fin N)),
is_kst_code 2 2 N C ∧
1 / (N : ℝ) ≤ (C.ncard : ℝ) / (2 ^ (N.choose 2) : ℝ))
(ε : ℝ) (hε : 0 < ε) :
∃ n₀ : ℕ, ∀ n ≥ n₀, ∃ C : Set (SimpleGraph (Fin n)),
is_kst_code 2 2 n C ∧
(1 - ε) / (n : ℝ) ≤ (C.ncard : ℝ) / (2 ^ (n.choose 2) : ℝ)k22_code_exists_fixed_multiple_anchorIn LeanCombinatorics for TCS
For every fixed positive integer c and all sufficiently large r, the order c * 2^r admits a K_{2,2}-code of density at least 1/(c * 2^r).
theorem k22_code_exists_fixed_multiple_anchor (c : ℕ) (hc : 1 ≤ c) :
∃ r₀ : ℕ, ∀ r ≥ r₀,
∃ C : Set (SimpleGraph (Fin (c * 2 ^ r))),
is_kst_code 2 2 (c * 2 ^ r) C ∧
1 / ((c * 2 ^ r : ℕ) : ℝ) ≤
(C.ncard : ℝ) / (2 ^ ((c * 2 ^ r).choose 2) : ℝ)k22_code_exists_fixed_multiple_anchor_pow_twoIn LeanCombinatorics for TCS
For every k and all sufficiently large r, the order 2^k * 2^r admits a K_{2,2}-code of density at least 1/(2^k * 2^r).
theorem k22_code_exists_fixed_multiple_anchor_pow_two (k : ℕ) :
∃ r₀ : ℕ, ∀ r ≥ r₀,
∃ C : Set (SimpleGraph (Fin (2 ^ k * 2 ^ r))),
is_kst_code 2 2 (2 ^ k * 2 ^ r) C ∧
1 / ((2 ^ k * 2 ^ r : ℕ) : ℝ) ≤
(C.ncard : ℝ) / (2 ^ ((2 ^ k * 2 ^ r).choose 2) : ℝ)kneser_subset_sum_multisetIn LeanCombinatorics for TCS
Kneser's addition theorem, sequence form: for a multiset S over a finite abelian group G, letting H be the stabilizer (period subgroup) of the set of all submultiset sums, it holds that |H| times (1 + the number of terms of S outside H) is at most the number of distinct submultiset sums.
open scoped Classical in
theorem kneser_subset_sum_multiset {G : Type*} [AddCommGroup G] [DecidableEq G] [Fintype G] (S : Multiset G) : Nat.card (multiset_sum_stabilizer S) * (1 + (S.filter (fun x => x ∉ multiset_sum_stabilizer S)).card) ≤ (multiset_sum_finset S).cardkonig_bipartite_multigraph_edge_colouringIn LeanCombinatorics for TCS
König's line-colouring theorem in fibre form: if every fibre of f and every fibre of g has at most k elements, then the edges admit a proper colouring with k colours, i.e. there is m : α → ℕ with m e < k that is injective on every fibre of f and on every fibre of g.
theorem konig_bipartite_multigraph_edge_colouring {α : Type*} [Fintype α] (f g : α → ℕ) (k : ℕ)
(hf : ∀ γ : ℕ, {e | f e = γ}.ncard ≤ k) (hg : ∀ γ : ℕ, {e | g e = γ}.ncard ≤ k) :
∃ m : α → ℕ, (∀ e : α, m e < k) ∧
(∀ e₁ e₂ : α, m e₁ = m e₂ → f e₁ = f e₂ → e₁ = e₂) ∧
∀ e₁ e₂ : α, m e₁ = m e₂ → g e₁ = g e₂ → e₁ = e₂konig_regular_bipartite_multigraph_edge_colouringIn LeanCombinatorics for TCS
König's edge-colouring theorem, regular case: if every fibre of f and of g is either empty or of size exactly d, then the edges can be properly coloured with d colours, i.e. there is m : α → ℕ with m e < d for all e, injective on every fibre of f and on every fibre of g.
theorem konig_regular_bipartite_multigraph_edge_colouring {α : Type*} [Fintype α]
(f g : α → ℕ) (d : ℕ)
(hf : ∀ γ : ℕ, {e | f e = γ}.ncard = d ∨ {e | f e = γ}.ncard = 0)
(hg : ∀ γ : ℕ, {e | g e = γ}.ncard = d ∨ {e | g e = γ}.ncard = 0) :
∃ m : α → ℕ, (∀ e : α, m e < d) ∧
(∀ e₁ e₂ : α, m e₁ = m e₂ → f e₁ = f e₂ → e₁ = e₂) ∧
∀ e₁ e₂ : α, m e₁ = m e₂ → g e₁ = g e₂ → e₁ = e₂large_depth_implies_monotone_gap_insertIn LeanCombinatorics for TCS
Let B be a nonempty finite set of nonempty permutations and ρ a B-avoiding permutation of length n. If ρ has a B-avoiding extension of depth at least (||B|| - 1)^2 * (n + 1) + 1 (where ||B|| = max_{β ∈ B} |β|), then inserting ||B|| new maxima in monotone order (increasing or decreasing) into some gap g ≤ n of ρ produces a permutation in Av(B).
theorem large_depth_implies_monotone_gap_insert
(B : Set (List ℕ)) (hB_fin : B.Finite) (hB_ne : B.Nonempty)
(hB_perm : ∀ β ∈ B, β.Perm (List.range' 1 β.length) ∧ β ≠ [])
(ρ : List ℕ) (hρ : ρ.Perm (List.range' 1 ρ.length))
(hρ_av : ∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist ρ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) :
let m := sSup (List.length '' B)
let n := ρ.length
(∃ σ : List ℕ,
σ.Perm (List.range' 1 σ.length) ∧
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist σ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∧
σ.filter (· ≤ n) = ρ ∧
σ.length ≥ n + (m - 1) ^ 2 * (n + 1) + 1) →
∃ g ≤ n,
((ρ.take g ++ List.range' (n + 1) m ++ ρ.drop g).Perm (List.range' 1 (n + m)) ∧
∀ β ∈ B, ¬ ∃ s : List ℕ,
s.Sublist (ρ.take g ++ List.range' (n + 1) m ++ ρ.drop g) ∧
∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∨
((ρ.take g ++ (List.range' (n + 1) m).reverse ++ ρ.drop g).Perm (List.range' 1 (n + m)) ∧
∀ β ∈ B, ¬ ∃ s : List ℕ,
s.Sublist (ρ.take g ++ (List.range' (n + 1) m).reverse ++ ρ.drop g) ∧
∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h])latin_square_prescribed_diagonal_no_near_constantIn LeanCombinatorics for TCS
For n at least two, if a sequence of n symbols from Fin n contains no symbol exactly n-1 times, there is an n by n Latin square on Fin n whose diagonal is exactly that sequence. A Latin square is a function for which every row and every column is a bijection.
theorem latin_square_prescribed_diagonal_no_near_constant (n : ℕ) (hn : 2 ≤ n) (d : Fin n → Fin n) (hd : ∀ v, (Finset.univ.filter fun i => d i = v).card ≠ n-1) : ∃ L : Fin n → Fin n → Fin n, (∀ i, Function.Bijective (L i)) ∧ (∀ j, Function.Bijective (fun i => L i j)) ∧ ∀ i, L i i = d i
latin_tableau_subpartition_col_boundIn LeanCombinatorics for TCS
Let T be a Latin tableau of shape μ and ν a subpartition whose row k is read in row φ k of μ, with φ injective (μ.rowLen (φ k) = ν.rowLen k). Then for every t the number of cells of ν with entry ≤ t is at most ∑_{j < rowLen 0 of ν} min(ν.colLen j, t): in each column of ν the entries are distinct positive integers, so at most min(colLen j, t) of them are ≤ t.
theorem latin_tableau_subpartition_col_bound (μ ν : YoungDiagram) (T : ℕ → ℕ → ℕ) (φ : ℕ → ℕ)
(hT : is_latin_tableau μ T) (hφ : Function.Injective φ)
(hrow : ∀ k, k < ν.colLen 0 → μ.rowLen (φ k) = ν.rowLen k) (t : ℕ) :
(ν.cells.filter (fun c => T (φ c.1) c.2 ≤ t)).card
≤ ∑ j ∈ Finset.range (ν.rowLen 0), min (ν.colLen j) tlatin_tableau_subpartition_row_countIn LeanCombinatorics for TCS
Let T be a Latin tableau of shape μ, let ν be a subpartition of μ whose row k is read in row φ k of μ (μ.rowLen (φ k) = ν.rowLen k). Restricted to the rows of ν, the number of cells with entry ≤ t, counted row by row, is exactly ∑_{i < colLen 0 of ν} min(ν.rowLen i, t): row i of ν holds ν.rowLen i distinct entries, all of them in 1, …, ν.rowLen i.
theorem latin_tableau_subpartition_row_count (μ ν : YoungDiagram) (T : ℕ → ℕ → ℕ) (φ : ℕ → ℕ)
(hT : is_latin_tableau μ T)
(hrow : ∀ k, k < ν.colLen 0 → μ.rowLen (φ k) = ν.rowLen k) (t : ℕ) :
(ν.cells.filter (fun c => T (φ c.1) c.2 ≤ t)).card
= ∑ i ∈ Finset.range (ν.colLen 0), min (ν.rowLen i) tlatin_wide_of_part_gcd_ge_max_multiplicityIn LeanCombinatorics for TCS
Let $\mu$ be a Young diagram. If the maximum multiplicity of any part length of $\mu$ (young_diagram_max_multiplicity μ) is at most the greatest common divisor of all part lengths of $\mu$ (young_diagram_part_gcd μ), then $\mu$ is Latin (is_latin_partition μ) and wide (is_wide_partition μ).
theorem latin_wide_of_part_gcd_ge_max_multiplicity (μ : YoungDiagram)
(h : young_diagram_max_multiplicity μ ≤ young_diagram_part_gcd μ) :
is_latin_partition μ ∧ is_wide_partition μlevel_one_to_three_witness_card_indicatorIn LeanCombinatorics for TCS
For any subset T of {0,1,2}: the sum of the indicators of "T is {0}", "T is {1}", "T is {2}" equals the indicator of "T has exactly one element"; and the indicator of "T is the full set" equals the indicator of "T has exactly three elements".
lemma level_one_to_three_witness_card_indicator :
(∀ T : Finset (Fin 3), ((if ({0} : Finset (Fin 3)) = T then (1:ℝ) else 0)
+ (if ({1} : Finset (Fin 3)) = T then 1 else 0) + (if ({2} : Finset (Fin 3)) = T then 1 else 0))
= (if T.card = 1 then 1 else 0)) ∧
(∀ T : Finset (Fin 3), (if Finset.univ = T then (1:ℝ) else 0) = (if T.card = 3 then 1 else 0))level_one_to_three_witness_cross_levelIn LeanCombinatorics for TCS
For the witness pair f = -chi_0 - chi_1 - chi_2 - chi_{012} and g = -chi_0 - chi_1 - chi_2 + chi_{012} on {0,1}^3, the first cross Fourier level is W_1[f,g] = 3 and the third is W_3[f,g] = -1 (these are 3 and -lambda^2 at lambda = 1 in arXiv:2611.08289 equation (53)).
lemma level_one_to_three_witness_cross_level :
fourier_cross_level 1 level_one_to_three_witness_f level_one_to_three_witness_g = 3 ∧
fourier_cross_level 3 level_one_to_three_witness_f level_one_to_three_witness_g = -1level_one_to_three_witness_fourier_coeff_cardIn LeanCombinatorics for TCS
For every subset T of {0,1,2}, the Fourier coefficient of f at T is -(1 if T has one element) - (1 if T has three elements), and the Fourier coefficient of g at T is -(1 if T has one element) + (1 if T has three elements).
lemma level_one_to_three_witness_fourier_coeff_card :
(∀ T : Finset (Fin 3), BooleanAnalysis.fourierCoeff level_one_to_three_witness_f T
= -(if T.card = 1 then (1:ℝ) else 0) - (if T.card = 3 then 1 else 0)) ∧
(∀ T : Finset (Fin 3), BooleanAnalysis.fourierCoeff level_one_to_three_witness_g T
= -(if T.card = 1 then (1:ℝ) else 0) + (if T.card = 3 then 1 else 0))level_one_to_three_witness_fourier_coeff_indicatorIn LeanCombinatorics for TCS
The Fourier-Walsh coefficients of the two witnesses are: f-hat(T) = -(1 if T = {0}) - (1 if T = {1}) - (1 if T = {2}) - (1 if T = univ), and g-hat(T) = -(1 if T = {0}) - (1 if T = {1}) - (1 if T = {2}) + (1 if T = univ).
lemma level_one_to_three_witness_fourier_coeff_indicator :
(∀ T : Finset (Fin 3), BooleanAnalysis.fourierCoeff level_one_to_three_witness_f T
= -((if ({0} : Finset (Fin 3)) = T then (1:ℝ) else 0) + (if ({1} : Finset (Fin 3)) = T then 1 else 0)
+ (if ({2} : Finset (Fin 3)) = T then 1 else 0)) - (if Finset.univ = T then 1 else 0)) ∧
(∀ T : Finset (Fin 3), BooleanAnalysis.fourierCoeff level_one_to_three_witness_g T
= -((if ({0} : Finset (Fin 3)) = T then (1:ℝ) else 0) + (if ({1} : Finset (Fin 3)) = T then 1 else 0)
+ (if ({2} : Finset (Fin 3)) = T then 1 else 0)) + (if Finset.univ = T then 1 else 0))level_one_to_three_witness_monotoneIn LeanCombinatorics for TCS
Both witness functions f = -chi_0 - chi_1 - chi_2 - chi_{012} and g = -chi_0 - chi_1 - chi_2 + chi_{012} on {0,1}^3 are coordinatewise increasing: x <= y (bitwise) implies f x <= f y and g x <= g y.
lemma level_one_to_three_witness_monotone :
Monotone level_one_to_three_witness_f ∧ Monotone level_one_to_three_witness_glevel_one_to_three_witness_varianceIn LeanCombinatorics for TCS
For the witness pair on {0,1}^3, Var(f) = Var(g) = 4, i.e. the sum of squared non-empty Fourier coefficients is 4 for each.
lemma level_one_to_three_witness_variance :
fourier_variance level_one_to_three_witness_f = 4 ∧
fourier_variance level_one_to_three_witness_g = 4lifted_partition_family_57_cardIn LeanCombinatorics for TCS
For t ≥ 1, the lifted family of partitions of t + 56 obtained by adding t - 1 ones to each member of A_57 has exactly as many members as A_57, namely 527254.
theorem lifted_partition_family_57_card (t : ℕ) (ht : 1 ≤ t) :
(lifted_partition_family_57 t ht).card = 527254line_incidence_valuationIn LeanCombinatorics for TCS
For a finite set S in (ZMod p)^3, a nonzero direction v, and a point Q, the sum over x in S of the number of functionals f with f(v) ≠ 0 and f(x) = f(Q) equals (#{x in S : x = Q})·(p^3 − p^2) + (#{x in S : x − Q not in span{v}}) · p(p−1).
theorem line_incidence_valuation
(p : ℕ) [Fact p.Prime] (S : Set (Fin 3 → ZMod p)) [Fintype ↥S]
(v : Fin 3 → ZMod p) (hv : v ≠ 0) (Q : Fin 3 → ZMod p) :
(∑ x ∈ S.toFinset, Nat.card {f : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p // f v ≠ 0 ∧ f x = f Q})
= Nat.card {x : ↥S // (x : Fin 3 → ZMod p) = Q} * (p ^ 3 - p ^ 2)
+ Nat.card {x : ↥S // (x : Fin 3 → ZMod p) - Q ∉ Submodule.span (ZMod p) {v}} * (p * (p - 1))line_pencil_light_functionals_geIn LeanCombinatorics for TCS
Let S be an admissible plane set meeting an affine line ℓ in p - 1 points. Then there are at least 3(p - 1) nonzero linear functionals f with f(v) = 0 such that (S ∩ affine_plane f (f P)).ncard = p.
theorem line_pencil_light_functionals_ge
(p : ℕ) [Fact p.Prime] (hp : 3 ≤ p)
(S : Set (Fin 3 → ZMod p)) (hS : admissible_plane_set p S)
(P v : Fin 3 → ZMod p) (hv : v ≠ 0)
(hℓ : (S ∩ affine_line P v).ncard = p - 1) :
3 * (p - 1) ≤ Nat.card {f : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p // f ≠ 0 ∧ f v = 0 ∧ (S ∩ affine_plane f (f P)).ncard = p}linear_independent_of_eval_diagonalIn LeanCombinatorics for TCS
Let $K$ be a field, $\iota$ a type with decidable equality, and $X$ a type. If a family of functions $f : \iota \to X \to K$ and points $v : \iota \to X$ satisfy $f_i(v_i) \neq 0$ for all $i$ and $f_i(v_j) = 0$ for all $i \neq j$, then the family $f$ is linearly independent over $K$.
theorem linear_independent_of_eval_diagonal {K : Type*} [Field K] {ι : Type*} [DecidableEq ι]
{X : Type*} (f : ι → X → K) (v : ι → X)
(h_diag : ∀ i, f i (v i) ≠ 0)
(h_off : ∀ i j, i ≠ j → f i (v j) = 0) :
LinearIndependent K flinear_three_graph_le_five_edges_is_iterated_tripartiteIn LeanCombinatorics for TCS
Every linear 3-uniform hypergraph F with at most 5 hyperedges is iterated tripartite.
theorem linear_three_graph_le_five_edges_is_iterated_tripartite
{V : Type*} [DecidableEq V] (F : Finset (Finset V))
(hunif : is_three_uniform F) (hlin : is_linear_hypergraph F) (hcard : F.card ≤ 5) :
is_iterated_tripartite Flinear_three_uniform_five_edges_min_degree_two_is_iterated_tripartiteIn LeanCombinatorics for TCS
A 3-uniform linear hypergraph with exactly 5 hyperedges, 7 vertices, one vertex of degree 3 and all other vertices of degree 2 is iterated tripartite.
theorem linear_three_uniform_five_edges_min_degree_two_is_iterated_tripartite {V : Type*}
[DecidableEq V] (F : Finset (Finset V)) (hunif : is_three_uniform F)
(hlin : is_linear_hypergraph F) (hcard : F.card = 5) (hverts : (F.biUnion id).card = 7)
(hstruct : ∃ v ∈ F.biUnion id, (F.filter (fun e => v ∈ e)).card = 3 ∧
∀ u ∈ F.biUnion id, u ≠ v → (F.filter (fun e => u ∈ e)).card = 2) :
is_iterated_tripartite Flinear_three_uniform_four_edges_min_degree_two_is_iterated_tripartiteIn LeanCombinatorics for TCS
A 3-uniform linear hypergraph with exactly 4 hyperedges, 6 vertices and every vertex of degree 2 is iterated tripartite.
theorem linear_three_uniform_four_edges_min_degree_two_is_iterated_tripartite {V : Type*}
[DecidableEq V] (F : Finset (Finset V)) (hunif : is_three_uniform F)
(hlin : is_linear_hypergraph F) (hcard : F.card = 4) (hverts : (F.biUnion id).card = 6)
(hdeg : ∀ v ∈ F.biUnion id, (F.filter (fun e => v ∈ e)).card = 2) :
is_iterated_tripartite Flinear_three_uniform_min_degree_two_card_and_vertex_boundIn LeanCombinatorics for TCS
If a linear 3-uniform hypergraph with at most 5 edges has every vertex of degree at least 2, then either (4 edges, 6 vertices, all degrees 2) or (5 edges, 7 vertices, exactly one vertex of degree 3 and all others of degree 2).
theorem linear_three_uniform_min_degree_two_card_and_vertex_bound {V : Type*} [DecidableEq V]
(F : Finset (Finset V)) (hunif : is_three_uniform F) (hlin : is_linear_hypergraph F)
(hpos : 1 ≤ F.card) (hcard : F.card ≤ 5)
(hmindeg : ∀ v ∈ F.biUnion id, 2 ≤ (F.filter (fun e => v ∈ e)).card) :
(F.card = 4 ∧ (F.biUnion id).card = 6 ∧
∀ v ∈ F.biUnion id, (F.filter (fun e => v ∈ e)).card = 2) ∨
(F.card = 5 ∧ (F.biUnion id).card = 7 ∧
∃ v ∈ F.biUnion id, (F.filter (fun e => v ∈ e)).card = 3 ∧
∀ u ∈ F.biUnion id, u ≠ v → (F.filter (fun e => u ∈ e)).card = 2)linear_three_uniform_min_degree_two_is_iterated_tripartiteIn LeanCombinatorics for TCS
A nonempty linear 3-uniform hypergraph with at most 5 hyperedges all of whose vertices have degree at least 2 is iterated tripartite.
theorem linear_three_uniform_min_degree_two_is_iterated_tripartite {V : Type*} [DecidableEq V]
(F : Finset (Finset V)) (hunif : is_three_uniform F) (hlin : is_linear_hypergraph F)
(hcard : F.card ≤ 5) (hpos : 1 ≤ F.card)
(hmindeg : ∀ v ∈ F.biUnion id, 2 ≤ (F.filter (fun e => v ∈ e)).card) :
is_iterated_tripartite Flinear_three_uniform_two_edges_is_iterated_tripartiteIn LeanCombinatorics for TCS
Every linear 3-uniform hypergraph with at most 2 hyperedges is iterated tripartite.
theorem linear_three_uniform_two_edges_is_iterated_tripartite {V : Type*} [DecidableEq V]
(F : Finset (Finset V)) (hunif : is_three_uniform F) (hlin : is_linear_hypergraph F)
(hcard : F.card ≤ 2) :
is_iterated_tripartite Flinear_three_uniform_vertex_boundIn LeanCombinatorics for TCS
A linear 3-uniform hypergraph with at most 5 hyperedges and at least one hyperedge has at least |F| + 2 vertices in the union of its edges.
theorem linear_three_uniform_vertex_bound {V : Type*} [DecidableEq V]
(F : Finset (Finset V)) (hunif : is_three_uniform F) (hlin : is_linear_hypergraph F)
(h1 : 1 ≤ F.card) (h5 : F.card ≤ 5) :
F.card + 2 ≤ (F.biUnion id).cardlinearization_coeff_band_boundIn LeanCombinatorics for TCS
If the (n,k) entry of R_m(J) (equivalently the linearization coefficient g(m,n;k)) is nonzero, then |n - k| ≤ m: the entries of R_m(J) vanish outside the band of width m around the diagonal.
theorem linearization_coeff_band_bound (N : ℕ) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) (m n k : Fin (N + 1))
(hcoeff : linearization_coeff N a b c m n k ≠ 0) :
|(n.val : ℤ) - (k.val : ℤ)| ≤ (m.val : ℤ)linearization_coeff_reflection_boundIn LeanCombinatorics for TCS
If the (n,k) entry of R_m(J) (equivalently the linearization coefficient g(m,n;k)) is nonzero, then m ≤ n + k.
theorem linearization_coeff_reflection_bound (N : ℕ) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) (m n k : Fin (N + 1))
(hcoeff : linearization_coeff N a b c m n k ≠ 0) :
(m.val : ℤ) ≤ (n.val : ℤ) + (k.val : ℤ)linearization_coeff_supportIn LeanCombinatorics for TCS
For any recurrence satisfying (2.1), the linearization coefficient g(m, n; k) = [R_m(J)]_{n, k} vanishes unless |m - n| ≤ k ≤ min(m + n, N).
theorem linearization_coeff_support (N : ℕ) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) (m n k : Fin (N + 1))
(hcoeff : linearization_coeff N a b c m n k ≠ 0) :
|(m.val : ℤ) - (n.val : ℤ)| ≤ (k.val : ℤ) ∧ k.val ≤ min (m.val + n.val) Nlist_drop_last_consIn LeanCombinatorics for TCS
For a nonempty list l, the drop-last of a :: l is a :: l.dropLast.
theorem list_drop_last_cons {α : Type*} (a : α) (l : List α) (h : l ≠ []) :
(a :: l).dropLast = a :: l.dropLastlist_filter_not_mem_cons_eraseIn LeanCombinatorics for TCS
For a duplicate-free list l', filtering l' by the predicate "not in a :: l" equals filtering l'.erase a by the predicate "not in l".
theorem list_filter_not_mem_cons_erase {α : Type*} [DecidableEq α] (l' : List α) (a : α)
(l : List α) (h : l'.Nodup) :
l'.filter (fun y => decide (y ∉ a :: l)) = (l'.erase a).filter (fun y => decide (y ∉ l))local_plane_weight_identitiesIn LeanCombinatorics for TCS
Let p be a prime with [Fact p.Prime], S : Set (Fin 3 → ZMod p) an admissible plane set (admissible_plane_set p S), and P ∈ S. Then: (1) for every H ∈ affine_planes_through p P, 0 ≤ local_plane_weight p S H; (2) the sum of local_plane_weight p S H over H ∈ affine_planes_through p P equals (p : ℤ) - 1; (3) for every non-zero v : Fin 3 → ZMod p (v ≠ 0), the sum of local_plane_weight p S H over H ∈ affine_planes_containing_line p (affine_line P v) equals ((S ∩ affine_line P v).ncard : ℤ) - 1; and (4) S is contained in the union of all planes H in (affine_planes_through p P).filter (fun H => 1 ≤ local_plane_weight p S H).
open Classical in
theorem local_plane_weight_identities
(p : ℕ) [Fact p.Prime] (S : Set (Fin 3 → ZMod p)) (hS : admissible_plane_set p S)
(P : Fin 3 → ZMod p) (hP : P ∈ S) :
(∀ H ∈ affine_planes_through p P, 0 ≤ local_plane_weight p S H) ∧
(∑ H ∈ affine_planes_through p P, local_plane_weight p S H = (p : ℤ) - 1) ∧
(∀ (v : Fin 3 → ZMod p) (_ : v ≠ 0),
∑ H ∈ affine_planes_containing_line p (affine_line P v), local_plane_weight p S H =
((S ∩ affine_line P v).ncard : ℤ) - 1) ∧
S ⊆ ⋃ H ∈ (affine_planes_through p P).filter (fun H => 1 ≤ local_plane_weight p S H), Hmatrix_det_mul_det_le_trace_mul_div_powIn LeanCombinatorics for TCS
For positive semidefinite real k × k matrices A and S with k ≥ 1, det A · det S is at most (tr(A S) / k)^k.
theorem matrix_det_mul_det_le_trace_mul_div_pow (k : ℕ) (hk : 1 ≤ k)
(A S : Matrix (Fin k) (Fin k) ℝ) (hA : Matrix.PosSemidef A) (hS : Matrix.PosSemidef S) :
A.det * S.det ≤ (Matrix.trace (A * S) / (k : ℝ)) ^ k
matrix_mulVec_indicator_eqIn LeanCombinatorics for TCS
For an m × n matrix A with entries in {-1, 1} and x the indicator vector of a subset Y ⊆ [n], the i-th entry of A x equals 2 * |Y ∩ B_i| - |Y|, where B_i = {j ∈ [n] : A_{i, j} = 1}.
theorem matrix_mulVec_indicator_eq {m n : ℕ} (A : Matrix (Fin m) (Fin n) ℤ)
(hA : ∀ i j, A i j = 1 ∨ A i j = -1) (i : Fin m) (Y : Finset (Fin n)) :
Matrix.mulVec A (fun j => if j ∈ Y then (1 : ℤ) else 0) i =
2 * ((Y ∩ Finset.filter (fun j => A i j = 1) Finset.univ).card : ℤ) - (Y.card : ℤ)matrix_possemidef_det_le_trace_div_powIn LeanCombinatorics for TCS
For a positive semidefinite real k × k matrix M with k ≥ 1, the determinant of M is at most (tr M / k)^k.
theorem matrix_possemidef_det_le_trace_div_pow (k : ℕ) (hk : 1 ≤ k)
(M : Matrix (Fin k) (Fin k) ℝ) (hM : Matrix.PosSemidef M) :
M.det ≤ (Matrix.trace M / (k : ℝ)) ^ k
matrix_q_permanent_strict_mono_of_order_le_threeIn LeanCombinatorics for TCS
If A is a non-diagonal real positive definite matrix of order n ≤ 3, then the function mapping q to the q-permanent of A is strictly increasing on all of ℝ.
theorem matrix_q_permanent_strict_mono_of_order_le_three
(n : ℕ) (hn : n ≤ 3) (A : Matrix (Fin n) (Fin n) ℝ)
(hpos : A.PosDef) (hnondiag : ¬ A.IsDiag) :
StrictMono (fun q : ℝ => matrix_q_permanent q A)matrix_q_permanent_three_of_diag_oneIn LeanCombinatorics for TCS
For any real symmetric 3-by-3 matrix A with all diagonal entries equal to 1, writing x = A 0 1, y = A 1 2, and z = A 0 2, the q-permanent of A at q equals 1 + (x^2 + y^2) * q + 2 * x * y * z * q^2 + z^2 * q^3.
theorem matrix_q_permanent_three_of_diag_one (A : Matrix (Fin 3) (Fin 3) ℝ)
(hsymm : A.IsSymm) (hdiag : ∀ i, A i i = 1) (q : ℝ) :
let x := A 0 1
let y := A 1 2
let z := A 0 2
matrix_q_permanent q A = 1 + (x ^ 2 + y ^ 2) * q + 2 * x * y * z * q ^ 2 + z ^ 2 * q ^ 3matrix_trace_sq_fin_twoIn LeanCombinatorics for TCS
For every 2x2 matrix A over a commutative ring, (tr A)^2 = tr(A^2) + 2 det A.
theorem matrix_trace_sq_fin_two (R : Type*) [CommRing R] (A : Matrix (Fin 2) (Fin 2) R) :
Matrix.trace A ^ 2 = Matrix.trace (A ^ 2) + 2 * A.detmatroid_all_pairs_not_two_codim_oneIn LeanCombinatorics for TCS
On at least four elements, a matroid in which all pairs are independent cannot have exactly two independent sets of size one less than the ground set.
theorem matroid_all_pairs_not_two_codim_one {V : Type*} [Fintype V] [DecidableEq V] (M : Matroid V) (hn : 4 ≤ Fintype.card V) (h2 : {W : Finset V | W.card = 2 ∧ M.Indep (W : Set V)}.ncard = Nat.choose (Fintype.card V) 2) : {W : Finset V | W.card = Fintype.card V - 1 ∧ M.Indep (W : Set V)}.ncard ≠ 2matroid_common_colorable_self_of_common_colorableIn LeanCombinatorics for TCS
If two matroids M₁ and M₂ on a common ground set have a common k-coloring, then each matroid has a k-coloring individually (matroid_common_colorable M M k).
theorem matroid_common_colorable_self_of_common_colorable {α : Type*} (M₁ M₂ : Matroid α)
(hE : M₁.E = M₂.E) (k : ℕ) (h : matroid_common_colorable M₁ M₂ k) :
matroid_common_colorable M₁ M₁ k ∧ matroid_common_colorable M₂ M₂ kmatroid_common_list_colorable_succ_of_common_colorableIn LeanCombinatorics for TCS
One-step list-lifting (the C = 1 case): if two loopless matroids on a common finite ground set have a common coloring with k colors, then they are (k+1)-list-colorable. This is a matroid analogue of Galvin's theorem for the general (non-strongly-base-orderable) pair case, and is exactly the C = 1 form of Question 3.1 (arXiv:2610.07318), strictly stronger than the parent's existence-of-some-C statement.
theorem matroid_common_list_colorable_succ_of_common_colorable {α : Type*} (M₁ M₂ : Matroid α) [Finite α] (h₁ : M₁.Loopless) (h₂ : M₂.Loopless) (hE : M₁.E = M₂.E) (k : ℕ) (h : matroid_common_colorable M₁ M₂ k) :
matroid_common_list_colorable M₁ M₂ (k + 1)matroid_common_list_colorable_three_of_colorable_twoIn LeanCombinatorics for TCS
The k = 2 case of Question 3.1 (arXiv:2610.07318): any pair of loopless matroids on a common finite ground set with a common 2-coloring is 3-list-colorable. This is the first nontrivial open case beyond k ≤ 1.
theorem matroid_common_list_colorable_three_of_colorable_two {α : Type*} (M₁ M₂ : Matroid α) [Finite α]
(h₁ : M₁.Loopless) (h₂ : M₂.Loopless) (hE : M₁.E = M₂.E)
(h : matroid_common_colorable M₁ M₂ 2) :
matroid_common_list_colorable M₁ M₂ 3matroid_reduction_partition_classes_three_of_colorable_twoIn LeanCombinatorics for TCS
Every finite loopless matroid with chromatic number at most 2 admits a reduction to a unit-capacity partition matroid whose classes have cardinality at most 3. This generalizes the graphic case (Bérczi, Schwarcz, Yamaguchi 2021) to general loopless matroids.
theorem matroid_reduction_partition_classes_three_of_colorable_two {α : Type*} (M : Matroid α) [Finite α]
(hM : M.Loopless) (hc : matroid_common_colorable M M 2) :
∃ f : α → ℕ, (∀ γ : ℕ, {e | e ∈ M.E ∧ f e = γ}.ncard ≤ 3) ∧
∀ T ⊆ M.E, (∀ e₁ ∈ T, ∀ e₂ ∈ T, f e₁ = f e₂ → e₁ = e₂) → M.Indep Tmatroid_sbo_reduction_partition_classes_of_colourableIn LeanCombinatorics for TCS
Generalised partition-matroid reduction for strongly base-orderable matroids (Proposition 2.2 of arXiv:2610.07318 with 2 replaced by k): let M be a finite strongly base-orderable matroid whose ground set is the union of k independent sets (equivalently M is k-colourable). Then M has a reduction to a unit-capacity partition matroid with classes of size at most k: there is a class map f : α → ℕ whose fibres meet E in at most k elements and such that every T ⊆ E containing no two distinct elements with the same f-value is independent in M. The case k = 2 is proved here (matroid_sbo_reduction_pairs_of_two_indep, involution form, used for matroid_sbo_common_list_chromatic_eq_of_le_two); the case k ≥ 3 is a conjecture and is the crux of Question 3.2.
theorem matroid_sbo_reduction_partition_classes_of_colourable {α : Type*} (M : Matroid α) [M.Finite]
(hM : matroid_strongly_base_orderable M) (k : ℕ) (hc : matroid_common_colorable M M k) :
∃ f : α → ℕ, (∀ γ : ℕ, {e | e ∈ M.E ∧ f e = γ}.ncard ≤ k) ∧
∀ T ⊆ M.E, (∀ e₁ ∈ T, ∀ e₂ ∈ T, f e₁ = f e₂ → e₁ = e₂) → M.Indep Tmatroid_sbo_reduction_partition_classes_of_colourable_le_twoIn LeanCombinatorics for TCS
Let M be a finite strongly base-orderable matroid that is k-colourable with k ≤ 2. Then M has a reduction to a unit-capacity partition matroid with classes of size at most k.
theorem matroid_sbo_reduction_partition_classes_of_colourable_le_two {α : Type*} (M : Matroid α) [M.Finite]
(hM : matroid_strongly_base_orderable M) (k : ℕ) (hk : k ≤ 2) (hc : matroid_common_colorable M M k) :
∃ f : α → ℕ, (∀ γ : ℕ, {e | e ∈ M.E ∧ f e = γ}.ncard ≤ k) ∧
∀ T ⊆ M.E, (∀ e₁ ∈ T, ∀ e₂ ∈ T, f e₁ = f e₂ → e₁ = e₂) → M.Indep Tmatroid_sbo_reduction_partition_classes_of_colourable_oneIn LeanCombinatorics for TCS
For k = 1, any 1-colourable finite matroid has its entire ground set independent. An injection of the finite ground set into ℕ yields fibres of size at most 1 on M.E, and all transversals are independent.
theorem matroid_sbo_reduction_partition_classes_of_colourable_one {α : Type*} (M : Matroid α) [M.Finite]
(hM : matroid_strongly_base_orderable M) (hc : matroid_common_colorable M M 1) :
∃ f : α → ℕ, (∀ γ : ℕ, {e | e ∈ M.E ∧ f e = γ}.ncard ≤ 1) ∧
∀ T ⊆ M.E, (∀ e₁ ∈ T, ∀ e₂ ∈ T, f e₁ = f e₂ → e₁ = e₂) → M.Indep Tmatroid_sbo_reduction_partition_classes_of_colourable_twoIn LeanCombinatorics for TCS
Proposition 2.2 of arXiv:2610.07318: let M be a finite strongly base-orderable matroid whose ground set is the union of two independent sets. Then M has a reduction to a unit-capacity partition matroid with classes of size at most 2.
theorem matroid_sbo_reduction_partition_classes_of_colourable_two {α : Type*} (M : Matroid α) [M.Finite]
(hM : matroid_strongly_base_orderable M) (hc : matroid_common_colorable M M 2) :
∃ f : α → ℕ, (∀ γ : ℕ, {e | e ∈ M.E ∧ f e = γ}.ncard ≤ 2) ∧
∀ T ⊆ M.E, (∀ e₁ ∈ T, ∀ e₂ ∈ T, f e₁ = f e₂ → e₁ = e₂) → M.Indep Tmatroid_sbo_reduction_partition_classes_of_colourable_zeroIn LeanCombinatorics for TCS
For k = 0, any strongly base-orderable finite matroid whose ground set is 0-colourable has an empty ground set, hence vacuously admits a reduction to partition classes of size 0.
theorem matroid_sbo_reduction_partition_classes_of_colourable_zero {α : Type*} (M : Matroid α) [M.Finite]
(hM : matroid_strongly_base_orderable M) (hc : matroid_common_colorable M M 0) :
∃ f : α → ℕ, (∀ γ : ℕ, {e | e ∈ M.E ∧ f e = γ}.ncard ≤ 0) ∧
∀ T ⊆ M.E, (∀ e₁ ∈ T, ∀ e₂ ∈ T, f e₁ = f e₂ → e₁ = e₂) → M.Indep Tmax_partial_transversal_complement_filledIn LeanCombinatorics for TCS
Let δ and t be natural numbers with t ≤ δ, and let Δ be a finset of filled cells in Fin δ × Fin δ. Suppose the prefix of the diagonal {(k, k) : k < t} is a maximum partial transversal of empty cells univ \ Δ. Then for all i, j : Fin δ with t ≤ i.val and t ≤ j.val, the cell (i, j) is in Δ.
theorem max_partial_transversal_complement_filled (δ t : ℕ) (ht : t ≤ δ) (Δ : Finset (Fin δ × Fin δ)) (hT : is_max_partial_transversal (Finset.univ \ Δ) (Finset.univ.filter (fun (p : Fin δ × Fin δ) => p.1 = p.2 ∧ p.1.val < t))) (i j : Fin δ) (hi : t ≤ i.val) (hj : t ≤ j.val) : (i, j) ∈ Δ
max_partial_transversal_replacement_orIn LeanCombinatorics for TCS
Let δ and t be natural numbers with t ≤ δ, and let Δ be a finset of filled cells in Fin δ × Fin δ. Suppose the prefix of the diagonal {(k, k) : k < t} is a maximum partial transversal of empty cells univ \ Δ. Then for all i, j : Fin δ with t ≤ i.val and t ≤ j.val, and every k : Fin δ with k.val < t, at least one of (i, k) or (k, j) belongs to Δ.
theorem max_partial_transversal_replacement_or (δ t : ℕ) (ht : t ≤ δ) (Δ : Finset (Fin δ × Fin δ)) (hT : is_max_partial_transversal (Finset.univ \ Δ) (Finset.univ.filter (fun (p : Fin δ × Fin δ) => p.1 = p.2 ∧ p.1.val < t))) (i j k : Fin δ) (hi : t ≤ i.val) (hj : t ≤ j.val) (hk : k.val < t) : (i, k) ∈ Δ ∨ (k, j) ∈ Δ
maximal_flower_free_system_contains_empty_kernel_flowerIn LeanCombinatorics for TCS
Let α be an infinite type with decidable equality. Let k ≥ 1 and r ≥ 2 be natural numbers. Let S be a finite k-uniform family of finite subsets of α containing no r-flower. Suppose S is maximal in the sense that for every finite subset A of α of cardinality k with A ∉ S, the family insert A S contains an r-flower. Then S contains an (r - 1)-flower with empty kernel (that is, r - 1 pairwise disjoint sets in S).
theorem maximal_flower_free_system_contains_empty_kernel_flower
{α : Type*} [DecidableEq α] [Infinite α]
(k r : ℕ) (hk : 1 ≤ k) (hr : 2 ≤ r)
(S : Finset (Finset α))
(h_unif : ∀ A ∈ S, A.card = k)
(h_free : ¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C)
(h_max : ∀ A : Finset α, A.card = k → A ∉ S →
∃ F ⊆ insert A S, F.card = r ∧ ∃ C, IsSunflower F C) :
∃ F ⊆ S, F.card = r - 1 ∧ IsSunflower F ∅mem_multiset_sum_finsetIn LeanCombinatorics for TCS
For a multiset S over an additive commutative group with decidable equality, an element g lies in the finset of submultiset sums of S if and only if there is a submultiset T ≤ S with T.sum = g.
theorem mem_multiset_sum_finset {G : Type*} [AddCommGroup G] [DecidableEq G] (S : Multiset G) (g : G) : g ∈ multiset_sum_finset S ↔ ∃ T : Multiset G, T ≤ S ∧ T.sum = gmem_ssyt_bounded_iffIn LeanCombinatorics for TCS
For any finite diagram D : Finset (ℕ × ℕ), any bound m : ℕ, and any filling M : D → ℕ, M belongs to ssyt_bounded D m if and only if M is semi-standard on D and for all u ∈ D, 1 ≤ M(u) ≤ m.
open Classical in
theorem mem_ssyt_bounded_iff (D : Finset (ℕ × ℕ)) (m : ℕ) (M : D → ℕ) :
M ∈ ssyt_bounded D m ↔ is_semistandard D M ∧ ∀ u : D, 1 ≤ M u ∧ M u ≤ mmin_avg_pairwise_hamming_dist_density_one_sixteenth_leIn LeanCombinatorics for TCS
Let n ≥ 4. For any subset F ⊆ (Fin n → Bool) of cardinality 2^(n-4), the average pairwise Hamming distance avg_pairwise_hamming_dist F is at least (n - 4) / 2.
theorem min_avg_pairwise_hamming_dist_density_one_sixteenth_le
(n : ℕ) (hn : 4 ≤ n) (F : Finset (Fin n → Bool)) (hF : F.card = 2 ^ (n - 4)) :
(n - 4 : ℝ) / 2 ≤ avg_pairwise_hamming_dist Fmissing_nterm_sum_count_shift_eqIn LeanCombinatorics for TCS
Let S be a multiset over an additive commutative group and suppose g is not the sum of any submultiset of S of cardinality n. Then for every U ⊆ S with U.card = n-1, every occurrence of g - U.sum in S already belongs to U: S.count (g - U.sum) = U.count (g - U.sum).
theorem missing_nterm_sum_count_shift_eq {G : Type*} [AddCommGroup G] [DecidableEq G] {n : ℕ} [NeZero n]
(S U : Multiset G) (g : G)
(hg : g ∉ ((S.powersetCard n).map Multiset.sum).toFinset)
(hU : U ≤ S) (hUc : U.card = n - 1) :
S.count (g - U.sum) = U.count (g - U.sum)missing_sum_arith_inequalityIn LeanCombinatorics for TCS
The arithmetic inequality behind the paper's step (5)-(6): if N is odd, N ≥ 21 and N/2 < m ≤ N, then (N - 2m + 7)(N - m) + 2N < m(m - 1).
theorem missing_sum_arith_inequality (N m : ℕ) (hN : 21 ≤ N) (hodd : N % 2 = 1) (hm : N / 2 < m) (hmN : m ≤ N) : ((N : ℤ) - 2 * (m : ℤ) + 7) * ((N : ℤ) - (m : ℤ)) + 2 * (N : ℤ) < (m : ℤ) * ((m : ℤ) - 1)
moment_block_card_and_ltIn LeanCombinatorics for TCS
Paper Proposition 2.3(1): for 1 ≤ h and q ≥ 2 the block B_q has exactly q elements and all of them lie in [0, h^(h-1) q^h).
theorem moment_block_card_and_lt (h q : ℕ) (hh : 1 ≤ h) (hq : 2 ≤ q) :
(moment_block h q).card = q ∧ ∀ x ∈ moment_block h q, x < h ^ (h - 1) * q ^ hmoment_block_shorter_sums_separatedIn LeanCombinatorics for TCS
Paper Proposition 2.3(3), the key separation property: let q > h ≥ 2 be prime. Any two distinct r-element multisets of elements of the block B_q, with 1 ≤ r ≤ h-1, have sums differing by at least q in absolute value.
theorem moment_block_shorter_sums_separated (h q r : ℕ) (hh : 2 ≤ h) (hq : h < q) (hprime : q.Prime)
(m m' : Multiset ℕ) (hm : ∀ x ∈ m, x ∈ moment_block h q) (hm' : ∀ x ∈ m', x ∈ moment_block h q)
(hc : m.card = r) (hc' : m'.card = r) (hr1 : 1 ≤ r) (hr : r ≤ h - 1) (hne : m ≠ m') :
q ≤ ((m.sum : ℤ) - (m'.sum : ℤ)).natAbsmoment_elem_strictMonoOnIn LeanCombinatorics for TCS
For 1 ≤ h, 0 < q and 1 ≤ ℓ, the ℓ-digit moment-curve encoding a ↦ moment_elem h q ℓ a is strictly increasing on the residues {0, …, q-1}; in particular it is injective there.
theorem moment_elem_strictMonoOn (h q ℓ : ℕ) (hh : 1 ≤ h) (hq : 0 < q) (hℓ : 1 ≤ ℓ) :
StrictMonoOn (moment_elem h q ℓ) (Set.Iio q)moment_elem_sum_digitsIn LeanCombinatorics for TCS
No-carry lemma for digit sums: if two multisets A, A' of residues < q, each of cardinality r ≤ ℓ ≤ h, give the same ℓ-digit encoded sum, then for every digit position j < ℓ the j-th digits a^(j+1) mod q have the same sum over A and over A'. (Each of these digit sums is at most r(q-1) < h*q, so no carries occur.)
theorem moment_elem_sum_digits (h q ℓ r : ℕ) (hh : 1 ≤ h) (hq : 0 < q) (hℓ : ℓ ≤ h)
(A A' : Multiset ℕ) (hA : ∀ a ∈ A, a < q) (hA' : ∀ a ∈ A', a < q)
(hc : A.card = r) (hc' : A'.card = r) (hr : r ≤ ℓ)
(hs : (A.map (moment_elem h q ℓ)).sum = (A'.map (moment_elem h q ℓ)).sum)
(j : ℕ) (hj : j < ℓ) :
(A.map (fun a => a ^ (j + 1) % q)).sum = (A'.map (fun a => a ^ (j + 1) % q)).summoment_trunc_is_bhIn LeanCombinatorics for TCS
Paper Lemma 2.2: for a prime q > h and 1 ≤ ℓ ≤ h, the truncated block {moment_elem h q ℓ a | 0 ≤ a < q} is a B_ℓ set, i.e. ℓ-term sums of its elements determine the multiset of summands.
theorem moment_trunc_is_bh (h q ℓ : ℕ) (hh : 1 ≤ h) (hq : h < q) (hprime : q.Prime)
(hℓ1 : 1 ≤ ℓ) (hℓ : ℓ ≤ h) :
is_bh ℓ (((Finset.range q).image (moment_elem h q ℓ) : Finset ℕ) : Set ℕ)monotone_gap_insert_implies_infinite_depthIn LeanCombinatorics for TCS
Let B be a nonempty finite set of nonempty permutations and ρ a B-avoiding permutation of length n. If inserting ||B|| new maxima in monotone order (increasing or decreasing) into some gap g ≤ n of ρ produces a permutation in Av(B) (where ||B|| = max_{β ∈ B} |β|), then ρ has B-avoiding extensions of arbitrarily large depth (for every k, an extension σ with σ.filter (· ≤ n) = ρ of length n + k).
theorem monotone_gap_insert_implies_infinite_depth
(B : Set (List ℕ)) (hB_fin : B.Finite) (hB_ne : B.Nonempty)
(hB_perm : ∀ β ∈ B, β.Perm (List.range' 1 β.length) ∧ β ≠ [])
(ρ : List ℕ) (hρ : ρ.Perm (List.range' 1 ρ.length))
(hρ_av : ∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist ρ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) :
let m := sSup (List.length '' B)
let n := ρ.length
(∃ g ≤ n,
((ρ.take g ++ List.range' (n + 1) m ++ ρ.drop g).Perm (List.range' 1 (n + m)) ∧
∀ β ∈ B, ¬ ∃ s : List ℕ,
s.Sublist (ρ.take g ++ List.range' (n + 1) m ++ ρ.drop g) ∧
∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∨
((ρ.take g ++ (List.range' (n + 1) m).reverse ++ ρ.drop g).Perm (List.range' 1 (n + m)) ∧
∀ β ∈ B, ¬ ∃ s : List ℕ,
s.Sublist (ρ.take g ++ (List.range' (n + 1) m).reverse ++ ρ.drop g) ∧
∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h])) →
∀ k : ℕ, ∃ σ : List ℕ,
σ.Perm (List.range' 1 σ.length) ∧
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist σ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∧
σ.filter (· ≤ n) = ρ ∧ σ.length = n + kmopls2_filled_cells_lower_boundIn LeanCombinatorics for TCS
Let M be a 2-MOPLS(n) with F filled cells. Then F ≥ n²/3, with equality if and only if every frequency (the number of filled cells in each row and each column, and the number of occurrences of each first entry and each second entry) is equal to n/3.
theorem mopls2_filled_cells_lower_bound {n : ℕ}
(M : Fin n → Fin n → Option (Fin n × Fin n)) (hM : is_mopls2 M) :
(opl2_filled_count M : ℚ) ≥ (n : ℚ)^2 / 3 ∧
((opl2_filled_count M : ℚ) = (n : ℚ)^2 / 3 ↔
(∀ r : Fin n, (opl2_row_freq M r : ℚ) = (n : ℚ) / 3) ∧
(∀ c : Fin n, (opl2_col_freq M c : ℚ) = (n : ℚ) / 3) ∧
(∀ x : Fin n, (opl2_first_freq M x : ℚ) = (n : ℚ) / 3) ∧
(∀ y : Fin n, (opl2_second_freq M y : ℚ) = (n : ℚ) / 3))mopls2_sum_identityIn LeanCombinatorics for TCS
For any rational numbers n, m, and t, the polynomial identity 2m² + t(n - m) + (n - m - t)(2(n - m) - t) = (n - m - t)² + (n - 3m)²/3 + 2n²/3 holds.
theorem mopls2_sum_identity (n m t : ℚ) :
2 * m^2 + t * (n - m) + (n - m - t) * (2 * (n - m) - t) =
(n - m - t)^2 + (n - 3 * m)^2 / 3 + 2 * n^2 / 3mopls_partial_transversal_frequency_sum_boundIn LeanCombinatorics for TCS
Let δ and t be natural numbers with t ≤ δ, and let Δ be a finset of filled cells in Fin δ × Fin δ. Suppose the prefix of the diagonal {(k, k) : k < t} is a maximum partial transversal of empty cells univ \ Δ. Then for all i, j : Fin δ with t ≤ i.val and t ≤ j.val, the cell (i, j) belongs to Δ, and 2 * δ - t ≤ array_row_frequency Δ i + array_col_frequency Δ j.
theorem mopls_partial_transversal_frequency_sum_bound (δ t : ℕ) (ht : t ≤ δ) (Δ : Finset (Fin δ × Fin δ)) (hT : is_max_partial_transversal (Finset.univ \ Δ) (Finset.univ.filter (fun (p : Fin δ × Fin δ) => p.1 = p.2 ∧ p.1.val < t))) (i j : Fin δ) (hi : t ≤ i.val) (hj : t ≤ j.val) : (i, j) ∈ Δ ∧ 2 * δ - t ≤ array_row_frequency Δ i + array_col_frequency Δ j
mopls_partial_transversal_frequency_sum_bound_diagonalIn LeanCombinatorics for TCS
Let δ and t be natural numbers with t ≤ δ, and let Δ be a finset of filled cells in Fin δ × Fin δ. Suppose the prefix of the diagonal {(k, k) : k < t} is a maximum partial transversal of empty cells univ \ Δ. Then for every diagonal index i : Fin δ with t ≤ i.val, the diagonal cell (i, i) belongs to Δ, and 2 * δ - t ≤ array_row_frequency Δ i + array_col_frequency Δ i.
theorem mopls_partial_transversal_frequency_sum_bound_diagonal (δ t : ℕ) (ht : t ≤ δ) (Δ : Finset (Fin δ × Fin δ)) (hT : is_max_partial_transversal (Finset.univ \ Δ) (Finset.univ.filter (fun (p : Fin δ × Fin δ) => p.1 = p.2 ∧ p.1.val < t))) (i : Fin δ) (hi : t ≤ i.val) : (i, i) ∈ Δ ∧ 2 * δ - t ≤ array_row_frequency Δ i + array_col_frequency Δ i
multiset_bind_card_finsetIn LeanCombinatorics for TCS
The cardinality of the multiset union of a Finset-indexed family of multisets is the sum of the cardinalities.
theorem multiset_bind_card_finset {α β : Type*} (s : Finset β) (Q : β → Multiset α) : (s.val.bind Q).card = ∑ c ∈ s, (Q c).cardmultiset_bind_le_bindIn LeanCombinatorics for TCS
Binding a fixed map is monotone for the multiset submultiset order: if A ≤ B then A.bind g ≤ B.bind g.
theorem multiset_bind_le_bind {α β : Type*} {g : α → Multiset β} {A B : Multiset α} (h : A ≤ B) : A.bind g ≤ B.bind gmultiset_eight_class_pairingIn LeanCombinatorics for TCS
Pairing reduction: a multiset of 16k-7 elements over a type with at most 8 elements yields 8k-7 disjoint same-class pairs, where the 8 possible classes are the fibers of a map p from the type.
theorem multiset_eight_class_pairing {α β : Type*} [Fintype β] [DecidableEq β] [DecidableEq α] (p : α → β) (hp : Fintype.card β ≤ 8) (k : ℕ) (hk : 1 ≤ k) (S : Multiset α) (hS : S.card = 16 * k - 7) : ∃ P : Multiset (α × α), P.card = 8 * k - 7 ∧ (∀ q ∈ P, p q.1 = p q.2) ∧ P.bind (fun q => ({q.1, q.2} : Multiset α)) ≤ Smultiset_exists_le_of_le_mapIn LeanCombinatorics for TCS
A submultiset of the image of s under f lifts to a submultiset of s with exactly that image.
theorem multiset_exists_le_of_le_map {α β : Type*} [DecidableEq β] (f : α → β) (s : Multiset α) (t : Multiset β) (h : t ≤ s.map f) : ∃ s' : Multiset α, s' ≤ s ∧ s'.map f = tmultiset_fiber_partitionIn LeanCombinatorics for TCS
A multiset is the multiset union of its fibers of a map f into a finite type.
theorem multiset_fiber_partition {α β : Type*} [Fintype β] [DecidableEq β] (f : α → β) (s : Multiset α) : (Finset.univ.val.bind (fun c => s.filter (fun a => f a = c))) = smultiset_newton_identityIn LeanCombinatorics for TCS
Newton's identity for a multiset over a commutative ring: for 1 ≤ k ≤ card m, k · e_k(m) = Σ_{j=1}^{k} (-1)^{j-1} e_{k-j}(m) · p_j(m), where e_j(m) is the j-th elementary symmetric function of the multiset m and p_j(m) = Σ_{a ∈ m} a^j is the j-th power sum.
theorem multiset_newton_identity (R : Type*) [CommRing R] (m : Multiset R) (k : ℕ) (hk : 1 ≤ k)
(hkm : k ≤ m.card) :
(k : R) * m.esymm k =
∑ j ∈ Finset.Icc 1 k, (-1 : R) ^ (j - 1) * m.esymm (k - j) * (m.map (fun a => a ^ j)).summultiset_pair_bind_cardIn LeanCombinatorics for TCS
Expanding |P| pairs into their two members gives 2|P| elements.
theorem multiset_pair_bind_card {α : Type*} (P : Multiset (α × α)) : (P.bind (fun p => ({p.1, p.2} : Multiset α))).card = 2 * P.cardmultiset_pair_bind_sumIn LeanCombinatorics for TCS
The sum of the 2|P| elements obtained by expanding the pairs of P equals the sum of the pair sums.
theorem multiset_pair_bind_sum {α : Type*} [AddCommMonoid α] (P : Multiset (α × α)) : (P.bind (fun p => ({p.1, p.2} : Multiset α))).sum = (P.map (fun p => p.1 + p.2)).summultiset_pairing_fiber_cardIn LeanCombinatorics for TCS
Every multiset G can be partitioned into ⌊|G|/2⌋ disjoint pairs of its elements: there is P with |P| = |G|/2 and the expansion of P is a submultiset of G.
theorem multiset_pairing_fiber_card {α : Type*} (G : Multiset α) : ∃ Q : Multiset (α × α), Q.card = G.card / 2 ∧ Q.bind (fun p => ({p.1, p.2} : Multiset α)) ≤ Gmultiset_subset_sum_separationIn LeanCombinatorics for TCS
Let A and B be two multisets of positive integers such that the sum of elements of A equals the sum of elements of B, denoted by s = sum(A) = sum(B), and such that their sets of positive subset sums intersect only at s: multiset_positive_subset_sums A ∩ multiset_positive_subset_sums B = {A.sum}. Then |A| ≤ max(B) and |B| ≤ max(A). Moreover, for every integer w ≥ 2 such that max(A) ≤ w and max(B) ≤ w, we have s ≤ w(w - 1).
theorem multiset_subset_sum_separation
(A B : Multiset ℕ)
(hA_pos : ∀ x ∈ A, 0 < x)
(hB_pos : ∀ x ∈ B, 0 < x)
(h_sum : A.sum = B.sum)
(h_sep : multiset_positive_subset_sums A ∩ multiset_positive_subset_sums B = {A.sum}) :
A.card ≤ multiset_max B ∧ B.card ≤ multiset_max A ∧
(∀ w : ℕ, 2 ≤ w → multiset_max A ≤ w → multiset_max B ≤ w → A.sum ≤ w * (w - 1))multiset_subset_sum_separation_card_leIn LeanCombinatorics for TCS
Let A and B be multisets of positive integers with the same sum s = sum(A) = sum(B) whose positive subset sums intersect only at s: multiset_positive_subset_sums A ∩ multiset_positive_subset_sums B = {A.sum}. Then the cardinality of A is at most the maximum element of B.
theorem multiset_subset_sum_separation_card_le
(A B : Multiset ℕ)
(hA_pos : ∀ x ∈ A, 0 < x)
(hB_pos : ∀ x ∈ B, 0 < x)
(h_sum : A.sum = B.sum)
(h_sep : multiset_positive_subset_sums A ∩ multiset_positive_subset_sums B = {A.sum}) :
A.card ≤ multiset_max Bmultiset_sum_stabilizer_zero_memIn LeanCombinatorics for TCS
The zero element lies in the stabilizer of the submultiset-sum set of any multiset S, so multiset_sum_stabilizer S is a genuine (nonempty) additive subgroup.
theorem multiset_sum_stabilizer_zero_mem {G : Type*} [AddCommGroup G] [DecidableEq G] (S : Multiset G) : (0 : G) ∈ multiset_sum_stabilizer Snat_partition_bounded_count_redundantIn LeanCombinatorics for TCS
If m ≤ k then bounding the parts by k is no restriction for a partition of m: a partition of m has no part larger than m. So the number of partitions of m with parts at most k equals the number with parts at most m.
theorem nat_partition_bounded_count_redundant (k m : ℕ) (h : m ≤ k) :
nat_partition_bounded_count k m = nat_partition_bounded_count m mnat_partition_bounded_count_succ_addIn LeanCombinatorics for TCS
One-copy recurrence for the bounded partition count: for k+1 ≤ m, a partition of m with all parts at most k+1 either has no part equal to k+1 (then all its parts are at most k) or has at least one; in the second case deleting one copy of the part k+1 is a bijection with the partitions of m-(k+1) with all parts at most k+1. Hence N(k+1,m) = N(k,m) + N(k+1,m-(k+1)).
theorem nat_partition_bounded_count_succ_add (k m : ℕ) (hk : k + 1 ≤ m) :
nat_partition_bounded_count (k + 1) m
= nat_partition_bounded_count k m + nat_partition_bounded_count (k + 1) (m - (k + 1))nat_partition_bounded_count_succ_sumIn LeanCombinatorics for TCS
Fibre recurrence for the bounded partition count: the number of partitions of m with all parts at most k+1 equals the sum, over j from 0 to m/(k+1), of the number of partitions of m - j*(k+1) with all parts at most k (j is the number of copies of the part k+1 that are removed).
theorem nat_partition_bounded_count_succ_sum (k m : ℕ) :
nat_partition_bounded_count (k + 1) m
= ∑ j ∈ Finset.range (m / (k + 1) + 1), nat_partition_bounded_count k (m - j * (k + 1))nat_partition_bounded_table_entryIn LeanCombinatorics for TCS
The dynamic-programme table really computes the bounded partition counts: for m ≤ N, the m-th entry of the k-th row equals the number of partitions of m with all parts at most k.
theorem nat_partition_bounded_table_entry (N k m : ℕ) (hN : m ≤ N) :
(nat_partition_bounded_table N k).getD m 0 = nat_partition_bounded_count k mnat_partition_bounded_table_fifty_sixIn LeanCombinatorics for TCS
The dynamic-programme table at k = N = 56, written out: its m-th entry is the partition number p(m) for m = 0, 1, ..., 56, so the table is 1, 1, 2, 3, 5, 7, ..., 451276, 526823.
theorem nat_partition_bounded_table_fifty_six :
nat_partition_bounded_table 56 56 =
[1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56, 77, 101, 135, 176, 231, 297, 385, 490, 627, 792,
1002, 1255, 1575, 1958, 2436, 3010, 3718, 4565, 5604, 6842, 8349, 10143, 12310, 14883,
17977, 21637, 26015, 31185, 37338, 44583, 53174, 63261, 75175, 89134, 105558, 124754,
147273, 173525, 204226, 239943, 281589, 329931, 386155, 451276, 526823]nat_partition_card_contains_finsetIn LeanCombinatorics for TCS
Number of partitions containing a prescribed finite set of parts: if R is a finite set of positive integers with sum at most n, then the partitions of n in which every element of R occurs at least once are in bijection with the partitions of n - sum(R), by deleting one copy of each element of R.
theorem nat_partition_card_contains_finset (n : ℕ) (R : Finset ℕ) (hR : ∀ r ∈ R, 0 < r)
(hsum : ∑ r ∈ R, r ≤ n) :
(Finset.univ.filter (fun p : Nat.Partition n => ∀ r ∈ R, r ∈ p.parts)).card
= Fintype.card (Nat.Partition (n - ∑ r ∈ R, r))nat_partition_card_contains_multisetIn LeanCombinatorics for TCS
Deleting a prescribed multiset of parts is a bijection. Let mu be a finite multiset of positive integers with mu.sum ≤ n, all of whose members are ≤ c. Then the partitions of n that contain mu has a sub-multiset of parts (and whose parts are all ≤ c) are in bijection with the partitions of n - mu.sum with all parts ≤ c, by deleting one copy of each part of mu. Hence the two finite cardinalities agree.
theorem nat_partition_card_contains_multiset (n c : ℕ) (μ : Multiset ℕ)
(hpos : ∀ x ∈ μ, 0 < x) (hbound : ∀ x ∈ μ, x ≤ c) (hsum : μ.sum ≤ n) :
Fintype.card {p : Nat.Partition n // μ ≤ p.parts ∧ ∀ x ∈ p.parts, x ≤ c} =
Fintype.card {q : Nat.Partition (n - μ.sum) // ∀ x ∈ q.parts, x ≤ c}nat_partition_card_le_fifty_sixIn LeanCombinatorics for TCS
For every m ≤ 56, the number of partitions of m is the m-th entry of the dynamic-programme table: p(m) = nat_partition_bounded_table 56 56 at index m. In particular p(56) = 526823.
theorem nat_partition_card_le_fifty_six (m : ℕ) (hm : m ≤ 56) :
Fintype.card (Nat.Partition m) = (nat_partition_bounded_table 56 56).getD m 0nat_sInf_le_sInf_of_subsetIn LeanCombinatorics for TCS
For any two predicates P and Q on ℕ, if Q implies P point-wise and there exists n satisfying Q, then the infimum of {n | P n} is at most the infimum of {n | Q n}.
theorem nat_sInf_le_sInf_of_subset (P Q : ℕ → Prop) (h_imp : ∀ n, Q n → P n) (h_nonempty : ∃ n, Q n) :
sInf {n | P n} ≤ sInf {n | Q n}necklace_cycle_lift_closingIn LeanCombinatorics for TCS
From a Hamilton cycle of the nonconstant-necklace graph Q_n (n prime ≥ 3) one can choose, in the cycle order, one nonconstant representative per necklace so that consecutive representatives differ in exactly one bit, the representatives lie in pairwise distinct necklaces, and there is a closing shift σ with 0<σ<n such that rotating u_0 by σ gives a word one flip from u_{m-1}.
theorem necklace_cycle_lift_closing (n : ℕ) (hn : n.Prime) (hge : 3 ≤ n)
(hcycle : necklace_graph_has_hamilton_cycle n) :
∃ (u : ℕ → ℕ) (σ : ℕ),
(∀ i < (2 ^ n - 2) / n, u i < 2 ^ n ∧ u i ≠ 0 ∧ u i ≠ 2 ^ n - 1) ∧
(∀ i < (2 ^ n - 2) / n, ∀ j < (2 ^ n - 2) / n,
i ≠ j → ¬ bitword_is_rotation n (u i) (u j)) ∧
(∀ i < (2 ^ n - 2) / n - 1, ∃ k < n, u i ^^^ u (i + 1) = 2 ^ k) ∧
(0 < σ ∧ σ < n) ∧
(∃ k < n, (bitword_rotate n)^[σ] (u 0) ^^^ u ((2 ^ n - 2) / n - 1) = 2 ^ k)no_strict_domination_injective_sum_eqIn LeanCombinatorics for TCS
Let $V$ be a finite nonempty type, $f : V \to V$ an injective map, and $g, h : V \to \mathbb{N}$ functions whose sums over $V$ are equal. Then it is not the case that $g(f(v)) < h(v)$ for all $v \in V$.
open Classical in
theorem no_strict_domination_injective_sum_eq {V : Type*} [Fintype V] [Nonempty V]
(f : V → V) (hf : Function.Injective f) (g h : V → ℕ)
(hsum : ∑ v : V, g v = ∑ v : V, h v) :
¬ (∀ v : V, g (f v) < h v)nonnegative_quadratic_splitIn LeanCombinatorics for TCS
For nonnegative b and 0≤t≤1, there are nonnegative real x and y with x+y=b+1 and xy=tb.
theorem nonnegative_quadratic_split (b t : ℝ) (hb : 0 ≤ b) (ht0 : 0 ≤ t) (ht1 : t ≤ 1) :
∃ x y : ℝ, 0 ≤ x ∧ 0 ≤ y ∧ x + y = b + 1 ∧ x * y = t * bnot_has_clean_handshake_seq_complete_graphIn LeanCombinatorics for TCS
For every natural number $n$, there is no clean handshake sequence using $n$ gloves that covers all edges of the complete graph $K_{n+2}$.
theorem not_has_clean_handshake_seq_complete_graph (n : ℕ) :
¬ has_clean_handshake_seq (SimpleGraph.completeGraph (Fin (n + 2))) nnot_has_three_colored_anti_ramsey_five_threeIn LeanCombinatorics for TCS
The complete graph on 5 vertices does not admit a 3-edge-coloring such that every 3-vertex complete subgraph contains edges of all three colors.
theorem not_has_three_colored_anti_ramsey_five_three :
¬ has_three_colored_anti_ramsey 5 3
not_is_splitting_system_emptyIn LeanCombinatorics for TCS
The empty family of blocks is not an (n, t)-splitting system on [n] whenever t ≤ n.
theorem not_is_splitting_system_empty (n t : ℕ) (ht : t ≤ n) :
¬ is_splitting_system n t ∅not_near_minimum_cycle_counting_bound_real_exponentIn LeanCombinatorics for TCS
The statement near_minimum_cycle_counting_bound_real_exponent is false: The statement is FALSE as formalized. The hypothesis hgirth : ∀ C ∈ D, gw ≤ ∑ e ∈ C, ω e constrains only the cycles that happen to lie in D. The paper's Lemma B.1 requires that EVERY cycle (circuit) of the graph has weight ≥ gw (gw is a lower bound on all cycle weights — essentially the weighted girth). Because D is an arbitrary family, one can simply exclude the short cycles and keep only the long ones, so the count exceeds (2m)^{2α}.
Explicit counterexample:
• V = Fin 9, G = ⊤ : SimpleGraph (Fin 9) (complete graph K_9). Then |E(G)| = C(9,2) = 36, so take m = 36 (hm : 1 ≤ 36, hm_edges : edgeFinset.card = 36 ≤ 36 both hold; Lean: (⊤ : SimpleGraph (Fin 9)).edgeFinset.card = 36 by decide).
• ω : Sym2 V → ℝ, ω ≡ 1, so hω (0 ≤ ω e) holds.
• gw = 9 > 0 (hgw), α = 1 (hα : 1 ≤ 1).
• D = the Finset of edge sets of all Hamiltonian cycles of K_9. Each is p.toSubgraph.edgeSet for a Hamiltonian cycle walk p (closed walk through all 9 vertices), which is a cycle, i.e. p.IsCycle holds — so hD holds.
• Each C ∈ D is a 9-cycle with all edges of weight 1, so ∑_{e∈C} ω e = 9 = gw ≥ gw: hgirth holds (all cycles IN D have weight exactly 9).
• For α = 1 the filter keeps every C ∈ D, since 9 ≤ 1·9. Hence the filtered family is all of D, whose cardinality is the number of (undirected) Hamiltonian cycles of K_9 = (9−1)!/2 = 8!/2 = 20160.
• But the claimed bound is (2m)^{2α} = (2·36)^{2·1} = 72² = 5184.
• 20160 ≤ 5184 is FALSE, so the conclusion fails.
Machine evidence (Lean, this session): experiment 26081 evaluates (with Lean's own evaluator) exactly 20160 distinct Hamiltonian-cycle edge sets from the 8! = 40320 cyclic orderings, and 20160 > (2*36)^2 = 5184 returns true; the arithmetic (2*(36:ℝ))^(2*(1:ℝ)) = 5184 and (20160:ℝ) > 5184 are proved by norm_num; and (⊤ : SimpleGraph (Fin 9)).edgeFinset.card = 36 is proved by decide. A SymPy search (experiment 26054) shows K_9 is the smallest complete graph where some fixed cycle length exceeds (2m)²: K_8's largest fixed-length cycle count is 2880 < 3136, so m = 36 is minimal.
Root cause: with the D-only hypothesis, the 84 triangles of K_9 (weight 3 < 9) are simply not in D, so the unique-short-path lemma simple_graph_unique_path_of_weight_lt_half_girth (whose hypothesis is that ALL cycles have weight ≥ gw) does not apply to this graph at gw = 9. The paper's bound presupposes exactly that no shorter cycles exist to "beat" the chosen ones; removing them from D invalidates it.
open scoped BigOperators in
open Classical in
theorem not_near_minimum_cycle_counting_bound_real_exponent : ¬ (∀ {V : Type*} (G : SimpleGraph V)
[Fintype G.edgeSet] (m : ℕ) (hm : 1 ≤ m) (hm_edges : G.edgeFinset.card ≤ m)
(ω : Sym2 V → ℝ) (hω : ∀ e ∈ G.edgeSet, 0 ≤ ω e)
(gw : ℝ) (hgw : 0 < gw)
(D : Finset (Finset (Sym2 V)))
(hD : ∀ C ∈ D, ∃ (u : V) (p : G.Walk u u), p.IsCycle ∧ (C : Set (Sym2 V)) = p.toSubgraph.edgeSet)
(hgirth : ∀ C ∈ D, gw ≤ ∑ e ∈ C, ω e)
(α : ℝ) (hα : 1 ≤ α), ((D.filter (fun C => ∑ e ∈ C, ω e ≤ α * gw)).card : ℝ) ≤
(2 * (m : ℝ)) ^ (2 * α))nterm_zero_sum_free_count_le_predIn LeanCombinatorics for TCS
Let G be an additive commutative monoid of exponent n ≥ 1 and let S be a multiset over G containing no submultiset of cardinality n whose sum is 0. Then no element occurs n times in S: every multiplicity is at most n-1.
theorem nterm_zero_sum_free_count_le_pred {G : Type*} [AddCommMonoid G] [DecidableEq G] {n : ℕ} [NeZero n]
(hexp : AddMonoid.exponent G = n) (S : Multiset G)
(hS_zs : 0 ∉ ((S.powersetCard n).map Multiset.sum).toFinset) (x : G) :
S.count x ≤ n - 1nterm_zero_sum_threshold_sInf_specIn LeanCombinatorics for TCS
Let K = {k : ℕ | every multiset of k elements of (Z/nZ)^r has a submultiset of cardinality n whose sum is 0}, i.e. K is the set of lengths that force an n-term zero-sum (sInf K = s(G), the Erdős–Ginzburg–Ziv constant of (Z/nZ)^r). Then K is nonempty, its infimum belongs to K, and sInf K ≥ 1.
theorem nterm_zero_sum_threshold_sInf_spec (n r : ℕ) [NeZero n] :
(sInf { k : ℕ | ∀ S' : Multiset (Fin r → ZMod n), S'.card = k → ∃ T ≤ S', T.card = n ∧ T.sum = 0 }
∈ { k : ℕ | ∀ S' : Multiset (Fin r → ZMod n), S'.card = k → ∃ T ≤ S', T.card = n ∧ T.sum = 0 })
∧ 1 ≤ sInf { k : ℕ | ∀ S' : Multiset (Fin r → ZMod n), S'.card = k → ∃ T ≤ S', T.card = n ∧ T.sum = 0 }numerical_semigroup_eq_of_subset_genus_eqIn LeanCombinatorics for TCS
If S1 and S2 are numerical semigroups with S1 ⊆ S2 and both have the same genus, then S1 = S2.
theorem numerical_semigroup_eq_of_subset_genus_eq
(S1 S2 : NumericalSemigroup)
(hsub : (S1.toAddSubmonoid : Set ℕ) ⊆ (S2.toAddSubmonoid : Set ℕ))
(hgen : numerical_semigroup_genus S1 = numerical_semigroup_genus S2) :
S1 = S2numerical_semigroup_exists_iff_frobenius_multiplicity_genusIn LeanCombinatorics for TCS
Let F, m, g be positive integers. There exists a numerical semigroup S with Frobenius number F, multiplicity m, and genus g if and only if either: (1) g = F and m = F + 1; or (2) F + 1 ≤ 2 * g, g ≤ F - 1, 2 ≤ m ≤ F - 1, m ≤ g ≤ F - F / m, and m does not divide F.
theorem numerical_semigroup_exists_iff_frobenius_multiplicity_genus
(F m g : ℕ) (hF : 0 < F) (hm : 0 < m) (hg : 0 < g) :
(∃ S : NumericalSemigroup,
numerical_semigroup_frobenius_number S = F ∧
numerical_semigroup_multiplicity S = m ∧
numerical_semigroup_genus S = g) ↔
(g = F ∧ m = F + 1) ∨
(F + 1 ≤ 2 * g ∧ g ≤ F - 1 ∧ 2 ≤ m ∧ m ≤ F - 1 ∧ m ≤ g ∧ g ≤ F - F / m ∧ ¬ m ∣ F)numerical_semigroup_high_mult_candidate_invariantsIn LeanCombinatorics for TCS
If a numerical semigroup S has carrier {0} ∪ Set.Ico m F ∪ Set.Ici (F + 1) with 2 ≤ m ≤ F - 1, then its Frobenius number is F, its multiplicity is m, and its genus is m.
theorem numerical_semigroup_high_mult_candidate_invariants
(F m : ℕ) (hm : 2 ≤ m) (hmF : m ≤ F - 1)
(S : NumericalSemigroup)
(hS : (S.toAddSubmonoid : Set ℕ) = {0} ∪ Set.Ico m F ∪ Set.Ici (F + 1)) :
numerical_semigroup_frobenius_number S = F ∧
numerical_semigroup_multiplicity S = m ∧
numerical_semigroup_genus S = mnumerical_semigroup_high_mult_candidate_is_semigroup_iffIn LeanCombinatorics for TCS
Let F and m be natural numbers with 2 ≤ m ≤ F - 1, and let S = {0} ∪ Set.Ico m F ∪ Set.Ici (F + 1). Then S is a numerical semigroup (i.e. the carrier of some NumericalSemigroup) if and only if F + 1 ≤ 2 * m.
theorem numerical_semigroup_high_mult_candidate_is_semigroup_iff
(F m : ℕ) (hm : 2 ≤ m) (hmF : m ≤ F - 1) :
let S : Set ℕ := {0} ∪ Set.Ico m F ∪ Set.Ici (F + 1)
(∃ S_ns : NumericalSemigroup, (S_ns.toAddSubmonoid : Set ℕ) = S) ↔ F + 1 ≤ 2 * mnumerical_semigroup_high_multiplicity_minimal_genus_uniqueIn LeanCombinatorics for TCS
Let F and m be natural numbers with 2 ≤ m ≤ F - 1, and consider the set S = {0} ∪ Set.Ico m F ∪ Set.Ici (F + 1). Then: (1) S is a numerical semigroup if and only if F + 1 ≤ 2 * m; (2) If F + 1 ≤ 2 * m, then there exists a numerical semigroup with carrier S having Frobenius number F, multiplicity m, and genus m, and any numerical semigroup with Frobenius number F, multiplicity m, and genus m has carrier S.
theorem numerical_semigroup_high_multiplicity_minimal_genus_unique
(F m : ℕ) (hm : 2 ≤ m) (hmF : m ≤ F - 1) :
let S : Set ℕ := {0} ∪ Set.Ico m F ∪ Set.Ici (F + 1)
((∃ S_ns : NumericalSemigroup, (S_ns.toAddSubmonoid : Set ℕ) = S) ↔ F + 1 ≤ 2 * m) ∧
(F + 1 ≤ 2 * m →
(∃ S_ns : NumericalSemigroup,
(S_ns.toAddSubmonoid : Set ℕ) = S ∧
numerical_semigroup_frobenius_number S_ns = F ∧
numerical_semigroup_multiplicity S_ns = m ∧
numerical_semigroup_genus S_ns = m) ∧
∀ S' : NumericalSemigroup,
numerical_semigroup_frobenius_number S' = F →
numerical_semigroup_multiplicity S' = m →
numerical_semigroup_genus S' = m →
(S'.toAddSubmonoid : Set ℕ) = S)numerical_semigroup_subset_high_mult_candidateIn LeanCombinatorics for TCS
Every numerical semigroup S with Frobenius number F and multiplicity m satisfying 2 ≤ m ≤ F - 1 is contained in {0} ∪ Set.Ico m F ∪ Set.Ici (F + 1).
theorem numerical_semigroup_subset_high_mult_candidate
(S : NumericalSemigroup) (F m : ℕ) (hm : 2 ≤ m) (hmF : m ≤ F - 1)
(hfrob : numerical_semigroup_frobenius_number S = F)
(hmult : numerical_semigroup_multiplicity S = m) :
(S.toAddSubmonoid : Set ℕ) ⊆ {0} ∪ Set.Ico m F ∪ Set.Ici (F + 1)nus_min_card_ge_near_quadraticIn LeanCombinatorics for TCS
There is an absolute constant C > 0 (explicitly C = 2⁻⁸⁰) with m(p) ≥ C (log p / log log p)² for every prime p ≥ 64. Published theorem of Hou–Yang; not yet formalized anywhere.
theorem nus_min_card_ge_near_quadratic :
∃ C : ℝ, 0 < C ∧ ∃ p₀ : ℕ, ∀ p : ℕ, p₀ ≤ p → p.Prime →
C * (Real.log p / Real.log (Real.log p)) ^ 2 ≤ (nus_min_card p : ℝ)nus_min_card_rank_hadamard_boundIn LeanCombinatorics for TCS
There is an absolute constant K ≥ 1 such that for every prime p and every A ⊆ Z/pZ with no unique sums, log p ≤ K(√|A| + |A|/log p)·log|A|.
theorem nus_min_card_rank_hadamard_bound :
∃ K : ℝ, 1 ≤ K ∧ ∀ (p : ℕ), p.Prime → ∀ A : Finset (ZMod p), finset_has_no_unique_sums A →
Real.log p ≤ K * (Real.sqrt (A.card : ℝ) + (A.card : ℝ) / Real.log p) * Real.log (A.card : ℝ)odd_component_satisfies_recurrence_2_1In LeanCombinatorics for TCS
Let N ≥ 2, and let a, c : Fin (2 * N + 1) → ℝ satisfy condition (2.1) of size 2N with b = fun _ => 0. Then (odd_component_a N a, odd_component_b N a c, odd_component_c N a c) satisfies condition (2.1) of size N - 1.
theorem odd_component_satisfies_recurrence_2_1
(N : ℕ) (hN : 2 ≤ N) (a c : Fin (2 * N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 (2 * N) a (fun _ => 0) c) :
satisfies_recurrence_2_1 (N - 1) (odd_component_a N a) (odd_component_b N a c) (odd_component_c N a c)one_dim_ap_tile_enumerationIn LeanCombinatorics for TCS
For every positive natural number n, one_dim_ap_tile_count n equals the sum over k ∈ Finset.Icc 1 n of (n / k)^(k - (n - k * (n / k))) * (n / k + 1)^(n - k * (n / k)).
open scoped BigOperators in
theorem one_dim_ap_tile_enumeration (n : ℕ) (hn : 0 < n) :
one_dim_ap_tile_count n =
∑ k ∈ Finset.Icc 1 n,
(n / k) ^ (k - (n - k * (n / k))) * (n / k + 1) ^ (n - k * (n / k))one_uniform_flower_free_card_leIn LeanCombinatorics for TCS
Let S be a 1-uniform family of finite sets (every member of S has cardinality 1) that contains no r-flower (no subfamily F of S of cardinality r is a sunflower with some kernel C). Then S.card ≤ r - 1.
theorem one_uniform_flower_free_card_le {α : Type*} [DecidableEq α] {r : ℕ} (S : Finset (Finset α))
(h1 : ∀ A ∈ S, A.card = 1)
(hfree : ¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) :
S.card ≤ r - 1one_uniform_ground_set_cardIn LeanCombinatorics for TCS
Let S be a finite family of singletons (that is, every A in S has cardinality 1). Then the ground set (S.biUnion id) has cardinality equal to S.card.
theorem one_uniform_ground_set_card {α : Type*} [DecidableEq α] (S : Finset (Finset α))
(h1 : ∀ A ∈ S, A.card = 1) :
(S.biUnion id).card = S.cardop1370_lifting_config_baseIn LeanCombinatorics for TCS
There exists an inductive lifting configuration in dimension 6 satisfying all 19 invariants of op1370_lifting_config.
theorem op1370_lifting_config_base : op1370_lifting_config 6
op1370_lifting_config_stepIn LeanCombinatorics for TCS
If an inductive lifting configuration exists in dimension n (with n ≥ 6), then one exists in dimension n+1.
theorem op1370_lifting_config_step (n : ℕ) (hn : 6 ≤ n) (h : op1370_lifting_config n) : op1370_lifting_config (n + 1)
op1525_lower_incidence_descendsIn LeanCombinatorics for TCS
If an integer function on finite subsets is supported on k-element sets and its sum over supersets is zero at every (k−1)-element set, then the same sum vanishes at every set of cardinality less than k.
theorem op1525_lower_incidence_descends {V : Type} [DecidableEq V] [Fintype V]
(f : Finset V → ℤ) (k : ℕ)
(hsupport : ∀ T, f T ≠ 0 → T.card = k)
(htop : ∀ R : Finset V, R.card + 1 = k →
(∑ T ∈ (Finset.univ : Finset V).powerset, if R ⊆ T then f T else 0) = 0) :
∀ R : Finset V, R.card < k →
(∑ T ∈ (Finset.univ : Finset V).powerset, if R ⊆ T then f T else 0) = 0op1525_odd_subset_complement_countsIn LeanCombinatorics for TCS
For two equally indexed families of k-element subsets of a finite set, with k odd, equality of the number of family members containing each (k−1)-element subset implies that, for every subset S, the number of members contained in S or in its complement, counted with multiplicity, agrees between the families.
theorem op1525_odd_subset_complement_counts
{V I : Type} [DecidableEq V] [Fintype V] [Fintype I]
(A B : I → Finset V) (k : ℕ)
(hodd : Odd k)
(hcardA : ∀ i, (A i).card = k) (hcardB : ∀ i, (B i).card = k)
(hlow : ∀ R : Finset V, R.card + 1 = k →
(∑ i, if R ⊆ A i then (1 : ℤ) else 0) =
∑ i, if R ⊆ B i then (1 : ℤ) else 0) :
∀ S : Finset V,
(∑ i, ((if A i ⊆ S then (1 : ℤ) else 0) +
(if A i ⊆ (Finset.univ \ S) then 1 else 0))) =
∑ i, ((if B i ⊆ S then (1 : ℤ) else 0) +
(if B i ⊆ (Finset.univ \ S) then 1 else 0))op314_end_antichain_caseIn LeanCombinatorics for TCS
If α is an antichain (a ≤ b implies b ≤ a) and the endomorphism posets of the finite nonempty partial orders α and β are order-isomorphic, then α and β are order-isomorphic.
theorem op314_end_antichain_case {α β : Type*} [PartialOrder α] [Fintype α] [Nonempty α] [PartialOrder β] [Fintype β] [Nonempty β] (hanti : ∀ a b : α, a ≤ b → b ≤ a) (h : Nonempty ((α →o α) ≃o (β →o β))) : Nonempty (α ≃o β)op314_end_height_size_invariantIn LeanCombinatorics for TCS
If α and β are finite nonempty partial orders with order-isomorphic endomorphism posets and 1 ≤ height(α), then 1 ≤ height(β) and |α| · height(α) = |β| · height(β).
theorem op314_end_height_size_invariant {α β : Type*} [PartialOrder α] [Fintype α] [Nonempty α] [PartialOrder β] [Fintype β] [Nonempty β] (h : Nonempty ((α →o α) ≃o (β →o β))) (hh : 1 ≤ poset_height α) : 1 ≤ poset_height β ∧ Nat.card α * poset_height α = Nat.card β * poset_height βop314_poset_tower_two_iso_endIn LeanCombinatorics for TCS
For partial orders α and β, there is an order-isomorphism poset_tower α 2 ≃o poset_tower β 2 if and only if there is an order-isomorphism (α →o α) ≃o (β →o β) between the endomorphism posets.
theorem op314_poset_tower_two_iso_end {α β : Type*} [PartialOrder α] [PartialOrder β] : Nonempty (poset_tower α 2 ≃o poset_tower β 2) ↔ Nonempty ((α →o α) ≃o (β →o β))op462_exists_gale_counterexample_lt_sixty_fiveIn LeanCombinatorics for TCS
There exists a finite counterexample to Gale's conjecture in dimension 3 with cardinality strictly less than 65.
theorem op462_exists_gale_counterexample_lt_sixty_five : ∃ V : Finset (EuclideanSpace ℝ (Fin 3)), V.card < 65 ∧ is_gale_counterexample_three V
op462_lt65_of_integer_witnessIn LeanCombinatorics for TCS
An integer coordinate certificate on fewer than 65 indexed points, with unit diameter bound, a strict threshold gap, and a non-four-colorable edge graph, implies min_gale_counterexample_card_three < 65.
theorem op462_lt65_of_integer_witness (n : ℕ) (hn : n < 65) (S Q : ℤ) (hS : 0 < S) (P : Fin n → Fin 3 → ℤ) (E : List (Fin n × Fin n)) (hunit : ∀ i j, (∑ k : Fin 3, (P i k - P j k)^2) ≤ S^2) (hedge : E.all (fun e => decide (Q ≤ ∑ k : Fin 3, (P e.1 k - P e.2 k)^2)) = true) (hgap : gale_sigma_three^2 < (Q : ℝ) / (S : ℝ)^2) (hnotcolor : ∀ c : Fin n → Fin 4, (∀ e ∈ E, c e.1 ≠ c e.2) → False) (a b : Fin n) (hab : (a,b) ∈ E) : min_gale_counterexample_card_three < 65
op462_lt_sixty_five_of_exists_counterexampleIn LeanCombinatorics for TCS
If there exists a finite counterexample to Gale's conjecture in dimension 3 with cardinality strictly less than 65, then min_gale_counterexample_card_three < 65.
theorem op462_lt_sixty_five_of_exists_counterexample (h : ∃ V : Finset (EuclideanSpace ℝ (Fin 3)), V.card < 65 ∧ is_gale_counterexample_three V) : min_gale_counterexample_card_three < 65
op_1370_global_uncomplemented_boundIn LeanCombinatorics for TCS
For at least two nonempty mutually strongly incomparable families of subsets of an n-element set, if their entire union is uncomplemented, then their total size is at most 2^(n-1)-1.
theorem op_1370_global_uncomplemented_bound (n t : ℕ) (ht : 2 ≤ t) (𝒜 : Fin t → Finset (Finset (Fin n))) (hne : ∀ i, (𝒜 i).Nonempty) (hinc : strongly_incomparable 𝒜) (hunc : is_uncomplemented (Finset.univ.biUnion 𝒜)) : ∑ i, (𝒜 i).card ≤ 2 ^ (n - 1) - 1
op_1370_no_private_fiber_countIn LeanCombinatorics for TCS
Let at least two nonempty families of subsets of Fin n be mutually strongly incomparable, and suppose the element x occurs in sets in at least two different families and is absent from sets in at least two different families. Count one double fiber for each set containing x whose deletion of x is also in the union of the families. Then the total number of members plus two is at most 2^(n-1) plus the number of double fibers. No uncomplementedness assumption is required.
theorem op_1370_no_private_fiber_count (n t : ℕ) (ht : 2 ≤ t) (𝒜 : Fin t → Finset (Finset (Fin n))) (hne : ∀ i, (𝒜 i).Nonempty) (hinc : strongly_incomparable 𝒜) (x : Fin n) (hpos : ∃ i j : Fin t, i ≠ j ∧ (∃ S ∈ 𝒜 i, x ∈ S) ∧ (∃ T ∈ 𝒜 j, x ∈ T)) (hneg : ∃ i j : Fin t, i ≠ j ∧ (∃ S ∈ 𝒜 i, x ∉ S) ∧ (∃ T ∈ 𝒜 j, x ∉ T)) : let U := Finset.univ.biUnion 𝒜; (∑ i, (𝒜 i).card) + 2 ≤ 2 ^ (n - 1) + (U.filter fun S => x ∈ S ∧ S.erase x ∈ U).card
op_1370_no_private_stabilityIn LeanCombinatorics for TCS
For nonempty uncomplemented mutually strongly incomparable families in the range of OP-1370, suppose every ground element appears in sets of at least two families and is absent from sets of at least two families. Then their total size is at most 2^(n-1)-2.
theorem op_1370_no_private_stability (n t : ℕ) (hn : 3 ≤ n) (ht : 3 ≤ t) (htn : t ≤ n) (𝒜 : Fin t → Finset (Finset (Fin n))) (hne : ∀ i, (𝒜 i).Nonempty) (hunc : ∀ i, is_uncomplemented (𝒜 i)) (hinc : strongly_incomparable 𝒜) (hpos : ∀ x, ∃ i j : Fin t, i ≠ j ∧ (∃ S ∈ 𝒜 i, x ∈ S) ∧ (∃ T ∈ 𝒜 j, x ∈ T)) (hneg : ∀ x, ∃ i j : Fin t, i ≠ j ∧ (∃ S ∈ 𝒜 i, x ∉ S) ∧ (∃ T ∈ 𝒜 j, x ∉ T)) : ∑ i, (𝒜 i).card ≤ 2 ^ (n - 1) - 2
op_1370_shatterer_complement_closure_cardIn LeanCombinatorics for TCS
For every finite set family on Fin n, the number of sets in the family or its set-complement image is at most the number of sets in the family of shattered sets or its set-complement image.
theorem op_1370_shatterer_complement_closure_card (n : ℕ) (F : Finset (Finset (Fin n))) : (F ∪ F.image compl).card ≤ (F.shatterer ∪ F.shatterer.image compl).card
op_1370_uncomplemented_group_private_boundIn LeanCombinatorics for TCS
For nonempty mutually strongly incomparable families, suppose a nonempty group of families has uncomplemented union, at least two families lie outside the group, and a ground element occurs only within the group. Then the total size is at most 2^(n-1)-1.
theorem op_1370_uncomplemented_group_private_bound (n t : ℕ) (𝒜 : Fin t → Finset (Finset (Fin n))) (hne : ∀ i, (𝒜 i).Nonempty) (hinc : strongly_incomparable 𝒜) (s : Finset (Fin t)) (hs : s.Nonempty) (hout : 2 ≤ (Finset.univ \ s).card) (x : Fin n) (hunc : is_uncomplemented (s.biUnion 𝒜)) (hx : ∀ j, j ∉ s → ∀ S ∈ 𝒜 j, x ∉ S) : ∑ j, (𝒜 j).card ≤ 2 ^ (n - 1) - 1
op_1423_admissible_triple_closureIn LeanCombinatorics for TCS
The union A ∪ B ∪ C of an admissible triple consists of elements of [1,F), is nonempty (it contains m), and is closed under sums at most F.
theorem op_1423_admissible_triple_closure (F m g : ℕ) (hm : 1 ≤ m) (hlow : 3*m ≤ F) (hhigh : F < 4*m)
(t : (Finset ℕ × Finset ℕ) × Finset ℕ) (ht : t ∈ op_1423_admissible_triples F m g) :
(∀ x ∈ t.1.1 ∪ t.1.2 ∪ t.2, 1 ≤ x ∧ x < F) ∧
(t.1.1 ∪ t.1.2 ∪ t.2).Nonempty ∧
(∀ x ∈ t.1.1 ∪ t.1.2 ∪ t.2, ∀ y ∈ t.1.1 ∪ t.1.2 ∪ t.2,
x + y ≤ F → x + y ∈ t.1.1 ∪ t.1.2 ∪ t.2)op_1423_admissible_triple_exists_semigroupIn LeanCombinatorics for TCS
Every admissible triple is the band trace triple of some numerical semigroup with Frobenius number F, multiplicity m and genus g.
theorem op_1423_admissible_triple_exists_semigroup (F m g : ℕ) (hm : 1 ≤ m) (hlow : 3*m ≤ F) (hhigh : F < 4*m)
(t : (Finset ℕ × Finset ℕ) × Finset ℕ) (ht : t ∈ op_1423_admissible_triples F m g) :
∃ S : NumericalSemigroup, numerical_semigroup_frobenius_number S = F ∧
numerical_semigroup_multiplicity S = m ∧ numerical_semigroup_genus S = g ∧
op_1423_trace_triple F m S = top_1423_card_fiber_eq_chooseIn LeanCombinatorics for TCS
For fixed A (a subset of [m,2m) containing m) and B ⊆ [2m,3m), the number of admissible triples with those two components equals the target summand: zero when the guard fails, and otherwise C(F − 3m − |P|, F − g − |A| − |B| − |P|) where P is the set of forced third-band sums.
theorem op_1423_card_fiber_eq_choose (F m g : ℕ) (hm : 1 ≤ m) (hlow : 3*m ≤ F)
(A B : Finset ℕ) (hA : A ⊆ Finset.Ico m (2*m)) (hmA : m ∈ A) (hB : B ⊆ Finset.Ico (2*m) (3*m)) :
((op_1423_admissible_triples F m g).filter (fun t => t.1 = (A, B))).card =
(let AA := Finset.image₂ (fun a b : ℕ => a+b) A A
let AB := Finset.image₂ (fun a b : ℕ => a+b) A B
let P := (AA ∪ AB).filter (fun x => 3*m ≤ x ∧ x < F)
if F ∉ AA ∧ F ∉ AB ∧ AA ∩ Finset.Ico (2*m) (3*m) ⊆ B ∧
g + A.card + B.card + P.card ≤ F then
Nat.choose (F - 3*m - P.card) (F - (g + A.card + B.card + P.card))
else 0)op_1423_card_powerset_card_subsetIn LeanCombinatorics for TCS
For P ⊆ s and |P| ≤ k, the number of k-element subsets of s containing P is C(|s| − |P|, k − |P|).
theorem op_1423_card_powerset_card_subset (s P : Finset ℕ) (k : ℕ) (hP : P ⊆ s) (hk : P.card ≤ k) :
(s.powerset.filter (fun C => P ⊆ C ∧ C.card = k)).card = Nat.choose (s.card - P.card) (k - P.card)op_1423_eq_of_trace_eqIn LeanCombinatorics for TCS
Two numerical semigroups with the same Frobenius number F > 0 and the same members below F are equal.
theorem op_1423_eq_of_trace_eq (S T : NumericalSemigroup) (F : ℕ) (hF : 0 < F)
(hS : numerical_semigroup_frobenius_number S = F)
(hT : numerical_semigroup_frobenius_number T = F)
(h : ∀ n, n < F → (n ∈ (S.toAddSubmonoid : Set ℕ) ↔ n ∈ (T.toAddSubmonoid : Set ℕ))) :
S = Top_1423_exists_closure_semigroupIn LeanCombinatorics for TCS
If T ⊆ [1,F) is closed under sums at most F, then there is a numerical semigroup whose carrier is exactly {0} ∪ T ∪ (F,∞).
theorem op_1423_exists_closure_semigroup (F : ℕ) (T : Finset ℕ)
(hlo : ∀ x ∈ T, 1 ≤ x) (hhi : ∀ x ∈ T, x < F)
(hcl : ∀ x ∈ T, ∀ y ∈ T, x + y ≤ F → x + y ∈ T) :
∃ S : NumericalSemigroup, (S.toAddSubmonoid : Set ℕ) = {n : ℕ | n = 0 ∨ n ∈ T ∨ F < n}op_1423_gaps_eqIn LeanCombinatorics for TCS
For a numerical semigroup S with positive Frobenius number F: the gap set (complement of S) is exactly Ico 1 (F+1) minus S, every gap is ≤ F, F itself is a gap, and every n > F lies in S.
theorem op_1423_gaps_eq (S : NumericalSemigroup) (F : ℕ) (hF : 0 < F)
(hfrob : numerical_semigroup_frobenius_number S = F) :
((S.toAddSubmonoid : Set ℕ)ᶜ) = (((Finset.Ico 1 (F+1) : Finset ℕ) : Set ℕ) \ (S.toAddSubmonoid : Set ℕ)) ∧
(∀ n, n ∉ (S.toAddSubmonoid : Set ℕ) → n ≤ F) ∧
F ∉ (S.toAddSubmonoid : Set ℕ) ∧
(∀ n, F < n → n ∈ (S.toAddSubmonoid : Set ℕ))op_1423_genus_eqIn LeanCombinatorics for TCS
For a numerical semigroup S with Frobenius number F > 0, the genus equals F minus the number of nongaps in Ico 1 F.
theorem op_1423_genus_eq (S : NumericalSemigroup) (F : ℕ) (hF : 0 < F)
(hfrob : numerical_semigroup_frobenius_number S = F) :
numerical_semigroup_genus S = F - ((((Finset.Ico 1 F : Finset ℕ) : Set ℕ)) ∩ (S.toAddSubmonoid : Set ℕ)).ncardop_1423_mult_propsIn LeanCombinatorics for TCS
If m > 0 is the multiplicity of a numerical semigroup S, then m ∈ S and m is the least positive element of S.
theorem op_1423_mult_props (S : NumericalSemigroup) (m : ℕ) (hm : 0 < m)
(hmult : numerical_semigroup_multiplicity S = m) :
m ∈ (S.toAddSubmonoid : Set ℕ) ∧ ∀ x ∈ (S.toAddSubmonoid : Set ℕ), 0 < x → m ≤ xop_1423_ncard_eq_card_triplesIn LeanCombinatorics for TCS
Numerical semigroups with Frobenius number F, multiplicity m and genus g are in bijection with the admissible band triples, so the two cardinalities agree.
theorem op_1423_ncard_eq_card_triples (F m g : ℕ) (hm : 1 ≤ m) (hlow : 3*m ≤ F) (hhigh : F < 4*m) :
{S : NumericalSemigroup | numerical_semigroup_frobenius_number S = F ∧
numerical_semigroup_multiplicity S = m ∧ numerical_semigroup_genus S = g}.ncard
= (op_1423_admissible_triples F m g).cardop_1423_sum_eq_card_triplesIn LeanCombinatorics for TCS
The cardinality of the admissible triple set equals the displayed double sum of binomial coefficients over A and B.
theorem op_1423_sum_eq_card_triples (F m g : ℕ) (hm : 1 ≤ m) (hlow : 3*m ≤ F) :
(op_1423_admissible_triples F m g).card =
∑ A ∈ (Finset.Ico m (2*m)).powerset.filter (fun A => m ∈ A),
∑ B ∈ (Finset.Ico (2*m) (3*m)).powerset,
(let AA := Finset.image₂ (fun a b : ℕ => a+b) A A
let AB := Finset.image₂ (fun a b : ℕ => a+b) A B
let P := (AA ∪ AB).filter (fun x => 3*m ≤ x ∧ x < F)
if F ∉ AA ∧ F ∉ AB ∧ AA ∩ Finset.Ico (2*m) (3*m) ⊆ B ∧
g + A.card + B.card + P.card ≤ F then
Nat.choose (F - 3*m - P.card) (F - (g + A.card + B.card + P.card))
else 0)op_1423_trace_card_sumIn LeanCombinatorics for TCS
Under 1 ≤ m and 3m ≤ F, the three band cards of the trace triple of a numerical semigroup of multiplicity m add up to the number of nongaps in [1,F).
theorem op_1423_trace_card_sum (F m : ℕ) (hm : 1 ≤ m) (hlow : 3*m ≤ F)
(S : NumericalSemigroup) (hmult : numerical_semigroup_multiplicity S = m) :
(op_1423_trace_triple F m S).1.1.card + (op_1423_trace_triple F m S).1.2.card
+ (op_1423_trace_triple F m S).2.card
= (((Finset.Ico 1 F : Finset ℕ) : Set ℕ) ∩ (S.toAddSubmonoid : Set ℕ)).ncardop_1423_trace_propsIn LeanCombinatorics for TCS
If a numerical semigroup S has carrier exactly {0} ∪ T ∪ (F,∞) with ∅ ≠ T ⊆ [1,F) and F ≥ 1, then its Frobenius number is F, its genus is F − |T|, and its multiplicity is min T.
theorem op_1423_trace_props (F : ℕ) (hF : 1 ≤ F) (S : NumericalSemigroup) (T : Finset ℕ)
(hT : T ⊆ Finset.Ico 1 F) (hne : T.Nonempty)
(hS : (S.toAddSubmonoid : Set ℕ) = {n : ℕ | n = 0 ∨ n ∈ T ∨ F < n}) :
numerical_semigroup_frobenius_number S = F ∧
numerical_semigroup_genus S = F - T.card ∧
numerical_semigroup_multiplicity S = T.min' hneop_1423_trace_triple_mem_admissibleIn LeanCombinatorics for TCS
The band trace triple of a numerical semigroup with Frobenius number F, multiplicity m and genus g (where 1 ≤ m and 3m ≤ F < 4m) is an admissible triple.
theorem op_1423_trace_triple_mem_admissible (F m g : ℕ) (hm : 1 ≤ m) (hlow : 3*m ≤ F) (hhigh : F < 4*m)
(S : NumericalSemigroup) (hfrob : numerical_semigroup_frobenius_number S = F)
(hmult : numerical_semigroup_multiplicity S = m) (hgen : numerical_semigroup_genus S = g) :
op_1423_trace_triple F m S ∈ op_1423_admissible_triples F m gop_1423_trace_triple_specIn LeanCombinatorics for TCS
For m ≤ n < F, n lies in one of the three bands of the trace triple of S iff n lies in S.
theorem op_1423_trace_triple_spec (F m : ℕ) (S : NumericalSemigroup) (n : ℕ) (h1 : m ≤ n) (h2 : n < F) :
(n ∈ (op_1423_trace_triple F m S).1.1 ∨ n ∈ (op_1423_trace_triple F m S).1.2 ∨
n ∈ (op_1423_trace_triple F m S).2) ↔ n ∈ (S.toAddSubmonoid : Set ℕ)op_1430_leafy_tree_cardIn LeanCombinatorics for TCS
For m ≥ 1 and n ≥ 1, the number of m-leafy trees with n internal vertices and mn + 1 leaves is ((m + 1) * Nat.choose ((m + 1)^2 * n + m) (n - 1)) / (n * (m * n + 1)).
theorem op_1430_leafy_tree_card (m n : ℕ) (hm : 1 ≤ m) (hn : 1 ≤ n) [Fintype (MLeafyTree m n)] :
Fintype.card (MLeafyTree m n) = ((m + 1) * Nat.choose ((m + 1)^2 * n + m) (n - 1)) / (n * (m * n + 1))op_1453_zycle_four_codegree_density_geIn LeanCombinatorics for TCS
For any ε > 0, for all sufficiently large n, the normalized codegree extremal number of the 4-zycle Z₄ is at least 1/3 - ε. This lower bound comes from the cyclic 3-part construction of Piga and Schülke (2026).
theorem op_1453_zycle_four_codegree_density_ge :
∀ ε > 0, ∀ᶠ (n : ℕ) in Filter.atTop, (1 / 3 : ℝ) - ε ≤ codegree_extremal_number n (zycle 4) / (n : ℝ)op_1453_zycle_four_codegree_density_leIn LeanCombinatorics for TCS
For any ε > 0, for all sufficiently large n, the normalized codegree extremal number of the 4-zycle Z₄ is at most 1/3 + ε. This is an open problem (Problem 5.1 in arXiv:2611.12582).
theorem op_1453_zycle_four_codegree_density_le :
∀ ε > 0, ∀ᶠ (n : ℕ) in Filter.atTop, codegree_extremal_number n (zycle 4) / (n : ℝ) ≤ (1 / 3 : ℝ) + εop_1453_zycle_six_codegree_density_existsIn LeanCombinatorics for TCS
There exists a real number γ such that the sequence codegree_extremal_number n (zycle 6) / n converges to γ along Filter.atTop. The existence of this limit for any fixed 3-graph is guaranteed by the Mubayi–Zhao limit theorem (2007).
theorem op_1453_zycle_six_codegree_density_exists :
∃ γ : ℝ, Filter.Tendsto (fun n : ℕ => codegree_extremal_number n (zycle 6) / (n : ℝ)) Filter.atTop (nhds γ)op_1453_zycle_six_codegree_density_leIn LeanCombinatorics for TCS
For any ε > 0, for all sufficiently large n, the normalized codegree extremal number of the 6-zycle Z₆ is at most 1/3 + ε. This is an open problem (Problem 5.1 in arXiv:2611.12582).
theorem op_1453_zycle_six_codegree_density_le :
∀ ε > 0, ∀ᶠ (n : ℕ) in Filter.atTop, codegree_extremal_number n (zycle 6) / (n : ℝ) ≤ (1 / 3 : ℝ) + εop_1459_binary_critical_exponent_eq_zero_or_ge_twoIn LeanCombinatorics for TCS
Every binary critical exponent is either 0 or at least 2: every infinite binary word contains a square (either two equal adjacent letters, or, if the word never has two equal adjacent letters, it alternates and contains (ab)²), and a square contributes the ratio 2 to the ratio set. This refines the d = 2 instance of the pigeonhole bound from 3/2 to 2.
theorem op_1459_binary_critical_exponent_eq_zero_or_ge_two (w : ℕ → Fin 2) : word_critical_exponent w = 0 ∨ 2 ≤ word_critical_exponent w
op_1459_critical_exponent_eq_zero_or_pigeonhole_boundIn LeanCombinatorics for TCS
Every critical exponent of a d-ary infinite word is either 0 (the ratio set is unbounded) or at least (d+1)/d: among the d+1 letters w 0, …, w d two coincide, and the corresponding length-(p+1) block is a prefix of the square of the length-p block, giving the ratio (p+1)/p ≥ (d+1)/d. This is the Lean shadow of "the repetition threshold is isolated in S_d" and is the best bound available without the rich-word structure theory.
theorem op_1459_critical_exponent_eq_zero_or_pigeonhole_bound (d : ℕ) (w : ℕ → Fin d) : word_critical_exponent w = 0 ∨ ((d : ℝ) + 1) / d ≤ word_critical_exponent w
op_1459_rich_threshold_eq_zeroIn LeanCombinatorics for TCS
For every positive d, the rich-word repetition threshold RT(C_d) = sInf S_d is 0.
theorem op_1459_rich_threshold_eq_zero (d : ℕ) (hd : 0 < d) : rich_repetition_threshold d = 0
op_1459_second_smallest_attained_fourIn LeanCombinatorics for TCS
The positive critical exponents of uniformly recurrent 4-ary rich words have a least element: there is v in S_4 with 0 < v and v ≤ x for every x in S_4 with 0 < x. (The value is RT(C_4) = E*(u_7) ≈ 2.1197196907, attained by one of the seven projections π_i(u_7).)
theorem op_1459_second_smallest_attained_four :
∃ v ∈ rich_word_critical_exponents 4, 0 < v ∧ ∀ x ∈ rich_word_critical_exponents 4, 0 < x → v ≤ xop_1459_second_smallest_attained_threeIn LeanCombinatorics for TCS
The positive critical exponents of uniformly recurrent ternary rich words have a least element: there is v in S_3 with 0 < v and v ≤ x for every x in S_3 with 0 < x. (The value is RT(C_3) = E*(u_5) = 1 + 1/(3 - Λ_5) ≈ 2.25876, where Λ_5 is the spectral radius of the incidence matrix of φ_5, attained by π(u_5).)
theorem op_1459_second_smallest_attained_three :
∃ v ∈ rich_word_critical_exponents 3, 0 < v ∧ ∀ x ∈ rich_word_critical_exponents 3, 0 < x → v ≤ xop_1459_second_smallest_attained_twoIn LeanCombinatorics for TCS
The positive critical exponents of uniformly recurrent binary rich words have a least element: there is v in S_2 with 0 < v and v ≤ x for every x in S_2 with 0 < x. (The value is RT(C_2) = E*(u_3) = 2 + √2/2 ≈ 2.70711, attained by the image π_1(u_3).)
theorem op_1459_second_smallest_attained_two :
∃ v ∈ rich_word_critical_exponents 2, 0 < v ∧ ∀ x ∈ rich_word_critical_exponents 2, 0 < x → v ≤ xop_1459_word_critical_exponent_nonnegIn LeanCombinatorics for TCS
Every critical exponent is nonnegative, for words over an arbitrary alphabet.
theorem op_1459_word_critical_exponent_nonneg {α : Type*} (w : ℕ → α) : 0 ≤ word_critical_exponent wop_1459_zero_is_least_rich_critical_exponentIn LeanCombinatorics for TCS
For 0 < d, 0 is the least element of S_d: the constant d-ary word 000… is uniformly recurrent and rich and its ratio set contains every natural number (x = [0], y = 0^n, m = n), hence is unbounded, so its critical exponent is 0 by Lean's sSup convention; and every critical exponent is nonnegative.
theorem op_1459_zero_is_least_rich_critical_exponent (d : ℕ) (hd : 0 < d) : IsLeast (rich_word_critical_exponents d) 0
op_1481_avoidance_three_twenty_one_sqrt_three_fourthsIn LeanCombinatorics for TCS
For every positive integer n, euclidean_avoids_ap n 3 1 21 (Real.sqrt (3 / 4)) holds: there exists a two-coloring of n-dimensional Euclidean space containing neither a monochromatic 3-term arithmetic progression with unit spacing of color false nor a monochromatic 21-term arithmetic progression with spacing √(3/4) of color true.
theorem op_1481_avoidance_three_twenty_one_sqrt_three_fourths (n : ℕ) (hn : 0 < n) :
euclidean_avoids_ap n 3 1 21 (Real.sqrt (3 / 4))op_1481_avoidance_three_twenty_one_sqrt_two_fifteenthsIn LeanCombinatorics for TCS
For every positive integer n, euclidean_avoids_ap n 3 1 21 (Real.sqrt (2 / 15)) holds: there exists a two-coloring of n-dimensional Euclidean space containing neither a monochromatic 3-term arithmetic progression with unit spacing of color false nor a monochromatic 21-term arithmetic progression with spacing √(2/15) of color true.
theorem op_1481_avoidance_three_twenty_one_sqrt_two_fifteenths (n : ℕ) (hn : 0 < n) :
euclidean_avoids_ap n 3 1 21 (Real.sqrt (2 / 15))op_1481_radial_certificate_one_halfIn LeanCombinatorics for TCS
There is a set S ⊆ ℝ such that (hA) for every a ≥ 0 and every c, one of a + c², a + (c+1)², a + (c+2)² lies in S, and (hB) for every a ≥ 0 and every c, some a + (c + k/2)² with 0 ≤ k ≤ 20 lies outside S. (This is the 1-D radial certificate for spacing α = 1/2: sufficient for the α = 1/2 case of the target via euclidean_avoids_ap_of_radial_ac, but not necessary.)
theorem op_1481_radial_certificate_one_half :
∃ S : Set ℝ,
(∀ a c : ℝ, 0 ≤ a → a + c ^ 2 ∈ S ∨ a + (c + 1) ^ 2 ∈ S ∨ a + (c + 2) ^ 2 ∈ S) ∧
(∀ a c : ℝ, 0 ≤ a → ∃ k : Fin 21, a + (c + (k : ℝ) * (1 / 2)) ^ 2 ∉ S)op_1481_radial_certificate_one_thirdIn LeanCombinatorics for TCS
There is a set S ⊆ ℝ such that (hA) for every a ≥ 0 and every c, one of a + c², a + (c+1)², a + (c+2)² lies in S, and (hB) for every a ≥ 0 and every c, some a + (c + k/3)² with 0 ≤ k ≤ 20 lies outside S. (This is the 1-D radial certificate for spacing α = 1/3: sufficient for the α = 1/3 case of the target via euclidean_avoids_ap_of_radial_ac, but not necessary.)
theorem op_1481_radial_certificate_one_third :
∃ S : Set ℝ,
(∀ a c : ℝ, 0 ≤ a → a + c ^ 2 ∈ S ∨ a + (c + 1) ^ 2 ∈ S ∨ a + (c + 2) ^ 2 ∈ S) ∧
(∀ a c : ℝ, 0 ≤ a → ∃ k : Fin 21, a + (c + (k : ℝ) * (1 / 3)) ^ 2 ∉ S)op_1481_sq_mem_exceptional_casesIn LeanCombinatorics for TCS
If α > 0 and α^2 ∈ {1/4, 1/9, 2/15, 3/4}, then α is 1/2, 1/3, √(2/15), or √(3/4).
theorem op_1481_sq_mem_exceptional_cases (α : ℝ) (hα : 0 < α)
(h_sq : α ^ 2 ∈ ({1 / 4, 1 / 9, 2 / 15, 3 / 4} : Set ℝ)) :
α = 1 / 2 ∨ α = 1 / 3 ∨ α = Real.sqrt (2 / 15) ∨ α = Real.sqrt (3 / 4)op_1592_complete_homogeneous_roots_vanishIn LeanCombinatorics for TCS
For r distinct nth roots of unity, where 2≤r≤n, the complete homogeneous symmetric polynomial of degree n−r+1 evaluates to zero.
theorem op_1592_complete_homogeneous_roots_vanish (n r : ℕ) (hr : 2 ≤ r) (hrn : r ≤ n) (z : Fin r → ℂ) (hinj : Function.Injective z) (hz : ∀ i, z i ^ n = 1) : MvPolynomial.eval z (MvPolynomial.hsymm (Fin r) ℂ (n-r+1)) = 0
op_1592_exists_test_functionIn LeanCombinatorics for TCS
There exists an integer-valued test function g on (Z/nZ)^d with total sum choose(n, p) whose Fourier transform vanishes on all non-zero characters that do not evaluate to 1 on any non-zero queen direction.
theorem op_1592_exists_test_function {d n p : ℕ} [NeZero n] (hd : 2 ≤ d) (hn : 2 ≤ n) (hp : Nat.Prime p) (hpn : p ∣ n) (hpd : p < 2^d) : ∃ g : (Fin d → ZMod n) → ℤ, (∑ x, g x = Nat.choose n p) ∧ (∀ chi : AddChar (Fin d → ZMod n) ℂ, chi ≠ 0 → (∀ v : Fin d → SignType, v ≠ 0 → chi (fun i => (SignType.cast (v i) : ZMod n)) ≠ 1) → ∑ x, (g x : ℂ) * chi x = 0)op_1592_fourier_support_zero_implies_constantIn LeanCombinatorics for TCS
If a complex-valued function on a finite abelian group has zero Fourier transform at all non-zero characters, then it is constant.
theorem op_1592_fourier_support_zero_implies_constant {G : Type*} [AddCommGroup G] [Fintype G] (f : G → ℂ) (hf : ∀ ψ : AddChar G ℂ, ψ ≠ 0 → ∑ x, f x * ψ x = 0) : ∃ C : ℂ, ∀ x, f x = Cop_1592_maximal_configuration_meets_each_line_onceIn LeanCombinatorics for TCS
A non-attacking configuration of n^(d−1) points meets each line in each nonzero queen direction in exactly one point.
theorem op_1592_maximal_configuration_meets_each_line_once {d n : ℕ} [NeZero n] (hd : 2 ≤ d) (hn : 2 ≤ n) (s : Finset (Fin d → ZMod n)) (hs : is_non_attacking_queens s) (hcard : s.card = n^(d-1)) (v : Fin d → SignType) (hv : v ≠ 0) (x : Fin d → ZMod n) : ∃! t : ZMod n, (fun i => x i + t * (SignType.cast (v i) : ZMod n)) ∈ sop_1592_prime_does_not_divide_predecessor_chooseIn LeanCombinatorics for TCS
If p is prime and divides a positive integer n, then p does not divide the binomial coefficient choosing p−1 elements from n−1.
theorem op_1592_prime_does_not_divide_predecessor_choose (n p : ℕ) (hn : 0 < n) (hp : Nat.Prime p) (hpn : p ∣ n) : ¬ p ∣ Nat.choose (n-1) (p-1)
op_1657_turan_hypergraph_zycle_four_freeIn LeanCombinatorics for TCS
The balanced cyclic 3-partite Turán hypergraph T_n contains no copy of the 4-zycle Z_4 for every n (Lemma 3.3 of arXiv:2611.16654 specialized to ℓ = 4).
theorem op_1657_turan_hypergraph_zycle_four_free (n : ℕ) :
is_hypergraph_free (turan_hypergraph n) (zycle 4)op_1657_turan_hypergraph_zycle_freeIn LeanCombinatorics for TCS
For every even ℓ ≥ 4 with 3 ∤ ℓ and every n, the balanced 3-partite Turán hypergraph T_n is Z_ℓ-free: there is no injective map of the 2ℓ zycle vertices into Fin n sending every zycle edge to an edge of T_n. This is Lemma 3.3 of arXiv:2611.16654 (the construction is valid precisely when 3 ∤ ℓ).
theorem op_1657_turan_hypergraph_zycle_free (ℓ n : ℕ) [NeZero ℓ] (hℓ_even : Even ℓ) (hℓ_ge : 4 ≤ ℓ) (hℓ_not_dvd : ¬ 3 ∣ ℓ) : is_hypergraph_free (turan_hypergraph n) (zycle ℓ)
op_1657_upper_bound_extremal_le_turan_cardIn LeanCombinatorics for TCS
For every even ℓ ≥ 4 with 3 ∤ ℓ, every 3-uniform Z_ℓ-free hypergraph on Fin n has at most |T_n| edges for all sufficiently large n, i.e. extremal_number n (zycle ℓ) ≤ (turan_hypergraph n).card eventually along Filter.atTop.
theorem op_1657_upper_bound_extremal_le_turan_card (ℓ : ℕ) [NeZero ℓ] (hℓ_even : Even ℓ) (hℓ_ge : 4 ≤ ℓ) (hℓ_not_dvd : ¬ 3 ∣ ℓ) : ∀ᶠ (n : ℕ) in Filter.atTop, extremal_number n (zycle ℓ) ≤ (turan_hypergraph n).card
op_1657_upper_bound_extremal_zycle_four_le_turan_cardIn LeanCombinatorics for TCS
For all sufficiently large n, every 3-uniform Z_4-free hypergraph on n vertices has at most (turan_hypergraph n).card edges, i.e., extremal_number n (zycle 4) ≤ (turan_hypergraph n).card eventually along Filter.atTop (Problem 4.2 of arXiv:2611.16654 for ℓ = 4).
theorem op_1657_upper_bound_extremal_zycle_four_le_turan_card :
∀ᶠ (n : ℕ) in Filter.atTop, extremal_number n (zycle 4) ≤ (turan_hypergraph n).cardop_1721_ratio_eventually_eqIn LeanCombinatorics for TCS
For any p in (0,1), eventually as d tends to infinity, the rare-tail ratio algebraically factors into the binomial coefficient ratio B(d) and the perturbation factor (1 + S1(d))^2 / ((1 + S0(d)) * (1 + S2(d))).
theorem op_1721_ratio_eventually_eq (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) :
let q := 1 - p
let r (d : ℕ) := Nat.ceil ((d : ℝ) / q ^ d)
let u (d : ℕ) := q ^ (2 * d)
let b (d : ℕ) (j : ℕ) :=
(r d).choose j * u d ^ j * (1 - u d) ^ (r d - j) * q ^ j +
(r d).choose (j + 1) * u d ^ (j + 1) * (1 - u d) ^ (r d - (j + 1)) * (1 - q ^ (j + 1))
let ratio (d : ℕ) := (b d d) ^ 2 / (b d (d - 1) * b d (d + 1))
let B (d : ℕ) := ((r d).choose d : ℝ) ^ 2 / (((r d).choose (d - 1) : ℝ) * ((r d).choose (d + 1) : ℝ))
let S0 (d : ℕ) := ((r d - (d - 1) : ℝ) / (d : ℝ)) * (q ^ (d + 1) / (1 - q ^ (2 * d))) * (1 - q ^ d)
let S1 (d : ℕ) := ((r d - d : ℝ) / ((d : ℝ) + 1)) * (q ^ d / (1 - q ^ (2 * d))) * (1 - q ^ (d + 1))
let S2 (d : ℕ) := ((r d - (d + 1) : ℝ) / ((d : ℝ) + 2)) * (q ^ (d - 1) / (1 - q ^ (2 * d))) * (1 - q ^ (d + 2))
ratio =ᶠ[Filter.atTop] fun d => B d * ((1 + S1 d) ^ 2 / ((1 + S0 d) * (1 + S2 d)))op_1721_tendsto_BIn LeanCombinatorics for TCS
For any p in (0,1), the squared binomial ratio B(d) = choose(r(d), d)^2 / (choose(r(d), d-1) * choose(r(d), d+1)) tends to 1 as d tends to infinity.
theorem op_1721_tendsto_B (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) :
let q := 1 - p
let r (d : ℕ) := Nat.ceil ((d : ℝ) / q ^ d)
let B (d : ℕ) := ((r d).choose d : ℝ) ^ 2 / (((r d).choose (d - 1) : ℝ) * ((r d).choose (d + 1) : ℝ))
Filter.Tendsto B Filter.atTop (nhds 1)op_1721_tendsto_SIn LeanCombinatorics for TCS
For any p in (0,1), the correction factors S0(d), S1(d), S2(d) converge to q, 1, and 1/q respectively as d tends to infinity.
theorem op_1721_tendsto_S (p : ℝ) (hp0 : 0 < p) (hp1 : p < 1) :
let q := 1 - p
let r (d : ℕ) := Nat.ceil ((d : ℝ) / q ^ d)
let S0 (d : ℕ) := ((r d - (d - 1) : ℝ) / (d : ℝ)) * (q ^ (d + 1) / (1 - q ^ (2 * d))) * (1 - q ^ d)
let S1 (d : ℕ) := ((r d - d : ℝ) / ((d : ℝ) + 1)) * (q ^ d / (1 - q ^ (2 * d))) * (1 - q ^ (d + 1))
let S2 (d : ℕ) := ((r d - (d + 1) : ℝ) / ((d : ℝ) + 2)) * (q ^ (d - 1) / (1 - q ^ (2 * d))) * (1 - q ^ (d + 2))
Filter.Tendsto S0 Filter.atTop (nhds q) ∧
Filter.Tendsto S1 Filter.atTop (nhds 1) ∧
Filter.Tendsto S2 Filter.atTop (nhds (1 / q))op_1721_tendsto_ratio_of_partsIn LeanCombinatorics for TCS
If B(d) -> 1, S0(d) -> q, S1(d) -> 1, and S2(d) -> 1/q as d -> infinity with q > 0, then B(d) * (1 + S1(d))^2 / ((1 + S0(d)) * (1 + S2(d))) tends to 4q / (1 + q)^2.
theorem op_1721_tendsto_ratio_of_parts (q : ℝ) (hq : 0 < q)
{B S0 S1 S2 : ℕ → ℝ}
(hB : Filter.Tendsto B Filter.atTop (nhds 1))
(hS0 : Filter.Tendsto S0 Filter.atTop (nhds q))
(hS1 : Filter.Tendsto S1 Filter.atTop (nhds 1))
(hS2 : Filter.Tendsto S2 Filter.atTop (nhds (1 / q))) :
Filter.Tendsto (fun d => B d * ((1 + S1 d) ^ 2 / ((1 + S0 d) * (1 + S2 d))))
Filter.atTop (nhds (4 * q / (1 + q) ^ 2))op_258_forces_stepIn LeanCombinatorics for TCS
Let a : ℕ+ → ℝ be positive, antitone, with Σ a i > 1, and let k ≥ 3. If a forces a monochromatic K_k, then a forces a monochromatic K_{k+1}.
theorem op_258_forces_step (a : ℕ+ → ℝ) (hpos : ∀ i, 0 < a i) (hanti : Antitone a)
(hsum : 1 < ∑' i : ℕ+, ENNReal.ofReal (a i)) :
∀ k : ℕ, 3 ≤ k → op_258_forces a k → op_258_forces a (k + 1)op_518_bruhat_order_three_graph_connectedIn LeanCombinatorics for TCS
For every m, the higher Bruhat order B(Fin m, 2) is connected: any two rank-3 signotopes on Fin m are joined by a sequence of single-triple flips. Equivalently, the constant +1 signotope is reachable from every signotope by flipping its negative triples one at a time.
theorem op_518_bruhat_order_three_graph_connected (m : ℕ) : (bruhat_order_three_graph (Fin m)).Connected
op_518_chirotope_dist_ge_supportIn LeanCombinatorics for TCS
Hamming lower bound for mutation walks of rank-3 uniform chirotopes: if two chirotopes on a linearly ordered Ω are connected in chirotope_three_graph Ω, the number of ordered triples on which they differ is at most their graph distance. (Any walk of length L changes at most L coordinates.)
theorem op_518_chirotope_dist_ge_support {Ω : Type*} [LinearOrder Ω] (c₁ c₂ : { chi : OrderedTriple Ω → ℤˣ // is_rank_three_uniform_chirotope chi }) (h : (chirotope_three_graph Ω).Reachable c₁ c₂) : {t : OrderedTriple Ω | c₁.val t ≠ c₂.val t}.ncard ≤ (chirotope_three_graph Ω).dist c₁ c₂op_518_constant_signotope_positive_fibre_chirotopeIn LeanCombinatorics for TCS
The constant signotope (+1 on every ordered triple of a linearly ordered type) is a rank-3 signotope, and its positive fibre on WithTop α is a uniform rank-3 chirotope. This supplies a witness that both vertex types are inhabited, so the target statement is not vacuous.
theorem op_518_constant_signotope_positive_fibre_chirotope {α : Type*} [LinearOrder α] : is_rank_three_signotope (fun _ : OrderedTriple α => (1 : ℤˣ)) ∧ is_rank_three_uniform_chirotope (positive_fibre_three (fun _ : OrderedTriple α => (1 : ℤˣ)))op_518_dist_le_of_adj_or_eq_mapIn LeanCombinatorics for TCS
A map of simple graphs that sends every edge to an edge or to a loop (equal images) does not increase the graph distance: if f : V → W with G.Adj a b → H.Adj (f a) (f b) ∨ f a = f b for all a, b, then for any G-walk from u to v, H.dist (f u) (f v) ≤ G.dist u v.
theorem op_518_dist_le_of_adj_or_eq_map {V W : Type*} {G : SimpleGraph V} {H : SimpleGraph W} (f : V → W) (hf : ∀ v w, G.Adj v w → H.Adj (f v) (f w) ∨ f v = f w) {u v : V} (h : G.Reachable u v) : H.dist (f u) (f v) ≤ G.dist u vop_518_minimal_walk_flips_only_in_supportIn LeanCombinatorics for TCS
Let seq be a sequence of sign vectors with seq k and seq (k+1) differing at exactly one index, starting at f and ending at g, of length equal to the number of indices where f and g differ. Then every coordinate flipped at any step is a coordinate where f and g differ; equivalently, coordinates where f and g agree are constant along the whole sequence. (Forgetful, graph-free form of the no-excess argument.)
theorem op_518_minimal_walk_flips_only_in_support {ι : Type*} (seq : ℕ → ι → ℤˣ) (L : ℕ) (hstep : ∀ k, k < L → differs_at_one (seq k) (seq (k + 1))) (hlen : L = {i : ι | seq 0 i ≠ seq L i}.ncard) : ∀ k, k < L → ∀ i : ι, seq 0 i = seq L i → seq k i = seq (k + 1) iop_518_positive_fibre_dist_geIn LeanCombinatorics for TCS
For every m > 0 and any rank-3 signotopes u, v on Fin m, the distance between u and v in the higher Bruhat order bruhat_order_three_graph (Fin m) is at most the mutation walk distance between their positive fibres in chirotope_three_graph (WithTop (Fin m)).
theorem op_518_positive_fibre_dist_ge (m : ℕ) (hm : 0 < m) (u v : OrderedTriple (Fin m) → ℤˣ) (hu : is_rank_three_signotope u) (hv : is_rank_three_signotope v) (hu_chi : is_rank_three_uniform_chirotope (positive_fibre_three u)) (hv_chi : is_rank_three_uniform_chirotope (positive_fibre_three v)) : (bruhat_order_three_graph (Fin m)).dist ⟨u, hu⟩ ⟨v, hv⟩ ≤ (chirotope_three_graph (WithTop (Fin m))).dist ⟨positive_fibre_three u, hu_chi⟩ ⟨positive_fibre_three v, hv_chi⟩
op_518_positive_fibre_dist_le_of_reachableIn LeanCombinatorics for TCS
If two rank-3 signotopes u, v on a linearly ordered α are connected in the higher Bruhat order, then the mutation walk distance between their positive fibres in chirotope_three_graph (WithTop α) is at most their distance in bruhat_order_three_graph α.
theorem op_518_positive_fibre_dist_le_of_reachable {α : Type*} [LinearOrder α] (u v : OrderedTriple α → ℤˣ) (hu : is_rank_three_signotope u) (hv : is_rank_three_signotope v) (hu_chi : is_rank_three_uniform_chirotope (positive_fibre_three u)) (hv_chi : is_rank_three_uniform_chirotope (positive_fibre_three v)) (h : (bruhat_order_three_graph α).Reachable ⟨u, hu⟩ ⟨v, hv⟩) : (chirotope_three_graph (WithTop α)).dist ⟨positive_fibre_three u, hu_chi⟩ ⟨positive_fibre_three v, hv_chi⟩ ≤ (bruhat_order_three_graph α).dist ⟨u, hu⟩ ⟨v, hv⟩op_518_positive_fibre_no_excessIn LeanCombinatorics for TCS
Suppose the chirotope mutation distance between the positive fibres of two signotopes u, v equals the Hamming distance (number of differing triples) between u and v. Then the reverse inequality holds: the higher Bruhat distance from u to v is at most the chirotope distance (in fact equal to it).
theorem op_518_positive_fibre_no_excess {α : Type*} [LinearOrder α] (u v : OrderedTriple α → ℤˣ) (hu : is_rank_three_signotope u) (hv : is_rank_three_signotope v) (hu_chi : is_rank_three_uniform_chirotope (positive_fibre_three u)) (hv_chi : is_rank_three_uniform_chirotope (positive_fibre_three v)) (hreach : (chirotope_three_graph (WithTop α)).Reachable ⟨positive_fibre_three u, hu_chi⟩ ⟨positive_fibre_three v, hv_chi⟩) (hnoex : (chirotope_three_graph (WithTop α)).dist ⟨positive_fibre_three u, hu_chi⟩ ⟨positive_fibre_three v, hv_chi⟩ = {t : OrderedTriple α | u t ≠ v t}.ncard) : (bruhat_order_three_graph α).dist ⟨u, hu⟩ ⟨v, hv⟩ ≤ (chirotope_three_graph (WithTop α)).dist ⟨positive_fibre_three u, hu_chi⟩ ⟨positive_fibre_three v, hv_chi⟩op_518_positive_fibre_of_positive_chirotopeIn LeanCombinatorics for TCS
Let chi be a uniform rank-3 chirotope on WithTop α that is positive at the point at infinity, i.e. chi takes the value +1 on every ordered triple whose largest element is ⊤. Then chi is the positive fibre of a rank-3 signotope u on α.
theorem op_518_positive_fibre_of_positive_chirotope {α : Type*} [LinearOrder α] (chi : OrderedTriple (WithTop α) → ℤˣ) (hchi : is_rank_three_uniform_chirotope chi) (hpos : ∀ t : OrderedTriple (WithTop α), t.c = ⊤ → chi t = 1) : ∃ u : OrderedTriple α → ℤˣ, is_rank_three_signotope u ∧ chi = positive_fibre_three uop_518_positive_fibre_three_injectiveIn LeanCombinatorics for TCS
The positive-fibre map u ↦ positive_fibre_three u from functions on ordered triples of α to functions on ordered triples of WithTop α is injective: evaluate at a triple of coerced elements.
theorem op_518_positive_fibre_three_injective {α : Type*} [LinearOrder α] : Function.Injective (positive_fibre_three (α := α))op_518_positive_fibre_three_signotopeIn LeanCombinatorics for TCS
If u : OrderedTriple α → ℤˣ is a rank-3 signotope on a linearly ordered α, then its positive fibre positive_fibre_three u (a function on OrderedTriple (WithTop α)) is also a rank-3 signotope: its packets either are packets of u, or are (u(Q), +1, +1).
theorem op_518_positive_fibre_three_signotope {α : Type*} [LinearOrder α] {u : OrderedTriple α → ℤˣ} (h : is_rank_three_signotope u) : is_rank_three_signotope (positive_fibre_three u)op_518_positive_fibre_three_support_ncardIn LeanCombinatorics for TCS
The positive fibre preserves Hamming distance: the set of ordered triples of WithTop α on which positive_fibre_three u and positive_fibre_three v differ has the same cardinality as the set of triples of α on which u and v differ (all triples through ⊤ agree, both being +1).
theorem op_518_positive_fibre_three_support_ncard {α : Type*} [LinearOrder α] (u v : OrderedTriple α → ℤˣ) : {t : OrderedTriple (WithTop α) | positive_fibre_three u t ≠ positive_fibre_three v t}.ncard = {t : OrderedTriple α | u t ≠ v t}.ncardop_518_positive_fibre_walk_mapIn LeanCombinatorics for TCS
Mapping a flip-path of rank-3 signotopes on α through the positive fibre gives a mutation walk of rank-3 uniform chirotopes on WithTop α of the same length: each signotope flip becomes a chirotope flip (all triples through ⊤ agree), so the image walk has exactly the original length.
theorem op_518_positive_fibre_walk_map {α : Type*} [LinearOrder α] {u v : OrderedTriple α → ℤˣ} {hu : is_rank_three_signotope u} {hv : is_rank_three_signotope v} {hu_chi : is_rank_three_uniform_chirotope (positive_fibre_three u)} {hv_chi : is_rank_three_uniform_chirotope (positive_fibre_three v)} (p : (bruhat_order_three_graph α).Walk ⟨u, hu⟩ ⟨v, hv⟩) : ∃ q : (chirotope_three_graph (WithTop α)).Walk ⟨positive_fibre_three u, hu_chi⟩ ⟨positive_fibre_three v, hv_chi⟩, q.length ≤ p.lengthop_518_signotope_positive_fibre_chirotopeIn LeanCombinatorics for TCS
If u : OrderedTriple α → ℤˣ is a rank-3 signotope on a linearly ordered α, then its positive fibre is a uniform rank-3 chirotope on WithTop α. In particular the hypotheses hu_chi, hv_chi of the target are implied by hu, hv.
theorem op_518_signotope_positive_fibre_chirotope {α : Type*} [LinearOrder α] {u : OrderedTriple α → ℤˣ} (h : is_rank_three_signotope u) : is_rank_three_uniform_chirotope (positive_fibre_three u)op_639_complementary_doubleton_fibers_cross_interIn LeanCombinatorics for TCS
In an intersecting hypergraph F, if e1, e2 in F have traces S and T \ S on T respectively, then their differences e1 \ T and e2 \ T are not disjoint.
theorem op_639_complementary_doubleton_fibers_cross_inter
{V : Type*} [DecidableEq V] (F : Finset (Finset V))
(hinter : (F : Set (Finset V)).Intersecting)
(T : Finset V) (S : Finset V)
(e1 e2 : Finset V) (he1 : e1 ∈ F) (he2 : e2 ∈ F)
(he1S : e1 ∩ T = S) (he2S : e2 ∩ T = T \ S) :
¬Disjoint (e1 \ T) (e2 \ T)op_639_doubleton_and_disjoint_singleton_fiber_cross_interIn LeanCombinatorics for TCS
In an intersecting hypergraph F, if e1 in F has trace S on T and e2 in F has trace {x} on T with x ∈ T \ S, then e1 \ T and e2 \ T are not disjoint.
theorem op_639_doubleton_and_disjoint_singleton_fiber_cross_inter
{V : Type*} [DecidableEq V] (F : Finset (Finset V))
(hinter : (F : Set (Finset V)).Intersecting)
(T : Finset V) (S : Finset V) (x : V) (hx : x ∈ T \ S)
(e1 e2 : Finset V) (he1 : e1 ∈ F) (he2 : e2 ∈ F)
(he1S : e1 ∩ T = S) (he2x : e2 ∩ T = {x}) :
¬Disjoint (e1 \ T) (e2 \ T)op_639_fiber_sdiff_injectiveIn LeanCombinatorics for TCS
Let T and S be finite sets in V. If e1 and e2 both have intersection S with T and identical difference outside T, e1 \ T = e2 \ T, then e1 = e2.
theorem op_639_fiber_sdiff_injective
{V : Type*} [DecidableEq V]
(T : Finset V) (S : Finset V)
(e1 e2 : Finset V)
(he1 : e1 ∩ T = S) (he2 : e2 ∩ T = S)
(h_sdiff : e1 \ T = e2 \ T) :
e1 = e2op_639_fiber_trace_sdiff_cardIn LeanCombinatorics for TCS
In a 4-uniform hypergraph F, if an edge e in F satisfies e ∩ T = S, then the cardinality of e \ T is 4 - |S|.
theorem op_639_fiber_trace_sdiff_card
{V : Type*} [DecidableEq V] (F : Finset (Finset V))
(hunif : ∀ e ∈ F, e.card = 4)
(T : Finset V) (S : Finset V)
(e : Finset V) (he : e ∈ F) (heS : e ∩ T = S) :
(e \ T).card = 4 - S.cardop_639_singleton_fibers_cross_interIn LeanCombinatorics for TCS
In an intersecting hypergraph F, if e1, e2 in F have traces {x} and {y} on T with x ≠ y, then e1 \ T and e2 \ T are not disjoint.
theorem op_639_singleton_fibers_cross_inter
{V : Type*} [DecidableEq V] (F : Finset (Finset V))
(hinter : (F : Set (Finset V)).Intersecting)
(T : Finset V) (x y : V) (hxy : x ≠ y)
(e1 e2 : Finset V) (he1 : e1 ∈ F) (he2 : e2 ∈ F)
(he1x : e1 ∩ T = {x}) (he2y : e2 ∩ T = {y}) :
¬Disjoint (e1 \ T) (e2 \ T)op_686_single_inflection_characterizationIn LeanCombinatorics for TCS
For a permutation σ of Fin n and naturals 2 ≤ k < m ≤ n-1, the inflection set of σ equals the singleton {(k,m)} if and only if, writing D = perm_second_derivative σ: D(k)·D(m) < 0, D vanishes on the open interval (k,m), every nonzero value D(l) with 2 ≤ l < k has the same sign as D(k) (i.e. D(l)·D(k) ≥ 0), and every nonzero value D(l) with m < l ≤ n-1 has the same sign as D(m) (i.e. D(l)·D(m) ≥ 0).
theorem op_686_single_inflection_characterization (k m n : ℕ) (σ : Equiv.Perm (Fin n))
(hk : 2 ≤ k) (hkm : k < m) (hmn : m ≤ n - 1) :
perm_inflection_set σ = {(k, m)} ↔
perm_second_derivative σ k * perm_second_derivative σ m < 0 ∧
(∀ l, k < l → l < m → perm_second_derivative σ l = 0) ∧
(∀ l, 2 ≤ l → l < k → perm_second_derivative σ l * perm_second_derivative σ k ≥ 0) ∧
(∀ l, m < l → l ≤ n - 1 → perm_second_derivative σ l * perm_second_derivative σ m ≥ 0)op_686_single_inflection_nonvanishing_infiniteIn LeanCombinatorics for TCS
If m ≤ 2*k (with 2 ≤ k < m), then there are infinitely many n for which some permutation σ : Equiv.Perm (Fin n) has perm_inflection_set σ = {(k,m)}. This is the non-vanishing half of the vanishing statement.
theorem op_686_single_inflection_nonvanishing_infinite (k m : ℕ) (hk : 2 ≤ k) (hkm : k < m)
(hm : m ≤ 2 * k) :
Set.Infinite {n : ℕ | ∃ σ : Equiv.Perm (Fin n), perm_inflection_set σ = {(k, m)}}op_686_single_inflection_vanishing_bddAboveIn LeanCombinatorics for TCS
If 2*k+1 ≤ m (with 2 ≤ k < m), then the sizes n of permutations whose inflection set is exactly {(k,m)} are bounded above: there is N (in fact the sharp bound is n ≤ 2m-k+2, so N = 2m suffices) such that every σ : Equiv.Perm (Fin n) with perm_inflection_set σ = {(k,m)} satisfies n ≤ N. This is the finiteness half of the vanishing statement.
theorem op_686_single_inflection_vanishing_bddAbove (k m : ℕ) (hk : 2 ≤ k) (hkm : k < m)
(h2k : 2 * k + 1 ≤ m) :
∃ N : ℕ, ∀ (n : ℕ) (σ : Equiv.Perm (Fin n)),
perm_inflection_set σ = {(k, m)} → n ≤ Noptimal_one_uniform_flower_free_systemIn LeanCombinatorics for TCS
Let r ≥ 2 be an integer, and let S be a 1-uniform r-flower-free set system on ground set G = ⋃ S (every set in S has cardinality 1 and no subfamily of size r is a sunflower). Then |S| ≤ r - 1, |G| ≤ r - 1, the aura |G| + (r - 1) * |S| satisfies |G| + (r - 1) * |S| ≤ r * (r - 1), and equality |G| + (r - 1) * |S| = r * (r - 1) holds if and only if |S| = r - 1.
theorem optimal_one_uniform_flower_free_system {α : Type*} [DecidableEq α] (r : ℕ) (hr : 2 ≤ r)
(S : Finset (Finset α))
(h1 : ∀ A ∈ S, A.card = 1)
(hfree : ¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) :
S.card ≤ r - 1 ∧
(S.biUnion id).card ≤ r - 1 ∧
(S.biUnion id).card + (r - 1) * S.card ≤ r * (r - 1) ∧
((S.biUnion id).card + (r - 1) * S.card = r * (r - 1) ↔ S.card = r - 1)optimal_one_uniform_system_existsIn LeanCombinatorics for TCS
For any integer r ≥ 2, there exists a 1-uniform r-flower-free set system S on Fin (r - 1) with |S| = r - 1, ground set cardinality r - 1, and aura |⋃ S| + (r - 1) * |S| = r * (r - 1).
theorem optimal_one_uniform_system_exists (r : ℕ) (hr : 2 ≤ r) :
∃ S : Finset (Finset (Fin (r - 1))),
(∀ A ∈ S, A.card = 1) ∧
(¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) ∧
S.card = r - 1 ∧
(S.biUnion id).card = r - 1 ∧
(S.biUnion id).card + (r - 1) * S.card = r * (r - 1)optimal_single_track_gray_code_equally_spaced_of_necklace_hamilton_cycleIn LeanCombinatorics for TCS
For any prime n ≥ 3, if the non-constant binary necklace graph Q_n has a Hamilton cycle, then there exists an optimal single-track Gray code of length n and period 2^n - 2 with equally spaced heads, where the head positions are multiples of (2^n - 2) / n and pairwise distinct modulo 2^n - 2.
theorem optimal_single_track_gray_code_equally_spaced_of_necklace_hamilton_cycle
(n : ℕ) (hn : n.Prime) (hge : 3 ≤ n)
(hcycle : necklace_graph_has_hamilton_cycle n) :
∃ w : ℕ → ℕ,
is_single_track_gray_code n (2 ^ n - 2) w ∧
∃ h : ℕ → ℕ, h 0 = 0 ∧
(∀ t, ∀ j < n, Nat.testBit (w t) j = Nat.testBit (w (t + h j)) 0) ∧
(∀ j < n, ((2 ^ n - 2) / n) ∣ h j) ∧
∀ j₁ < n, ∀ j₂ < n, h j₁ % (2 ^ n - 2) = h j₂ % (2 ^ n - 2) → j₁ = j₂optimal_single_track_gray_code_of_gray_necklace_pathIn LeanCombinatorics for TCS
Let n >= 7 be prime. If the list of non-constant binary necklaces of length n, ordered by the rank of their first occurrences in the binary reflected Gray code, forms a Gray path in the necklace graph, then the necklace graph has a Hamilton cycle, and an optimal single-track Gray code of length n and period 2^n - 2 exists.
theorem optimal_single_track_gray_code_of_gray_necklace_path
(n : ℕ) (hn : n.Prime) (hge : 7 ≤ n)
(hpath : gray_ordered_necklaces_is_gray_path n) :
necklace_graph_has_hamilton_cycle n ∧
∃ w : ℕ → ℕ, is_single_track_gray_code n (2 ^ n - 2) woptimal_single_track_gray_code_of_necklace_hamilton_cycleIn LeanCombinatorics for TCS
For any prime n at least 3, if the necklace graph has a Hamilton cycle of length (2^n - 2) / n visiting every non-constant necklace, then there exists an optimal single-track Gray code of length n and period 2^n - 2.
theorem optimal_single_track_gray_code_of_necklace_hamilton_cycle
(n : ℕ) (hn : n.Prime) (hge : 3 ≤ n)
(hcycle : necklace_graph_has_hamilton_cycle n) :
∃ w : ℕ → ℕ, is_single_track_gray_code n (2 ^ n - 2) worder_five_q_permanent_monotonicity_counterexampleIn LeanCombinatorics for TCS
The 5-by-5 integer matrix A with diagonal (5, 5, 1, 5, 5) and nonzero off-diagonal entries a_{14} = a_{41} = 4, a_{15} = a_{51} = 1, a_{24} = a_{42} = -1, a_{25} = a_{52} = 4 is symmetric and positive definite over the reals, its q-permanent equals 625 + 25q^3 + 800q^5 + 25q^7 + 256q^8 - 32q^9 + q^10 for every real q, its q-permanent at q = 14 is 8968822249, its q-permanent at q = 15 is 7441960000, and its q-permanent at q = 14 is strictly greater than its q-permanent at q = 15, disproving the monotonicity conjecture for the q-permanent.
theorem order_five_q_permanent_monotonicity_counterexample :
let A := q_perm_counterexample_matrix.map (algebraMap ℤ ℝ)
A.IsSymm ∧ A.PosDef ∧
(∀ q : ℝ, matrix_q_permanent q A =
625 + 25 * q ^ 3 + 800 * q ^ 5 + 25 * q ^ 7 + 256 * q ^ 8 - 32 * q ^ 9 + q ^ 10) ∧
matrix_q_permanent (14 : ℝ) A = 8968822249 ∧
matrix_q_permanent (15 : ℝ) A = 7441960000 ∧
matrix_q_permanent (14 : ℝ) A > matrix_q_permanent (15 : ℝ) Aorder_foldl_move_to_front_elemsIn LeanCombinatorics for TCS
Successively moving the labels of a duplicate-free list l to the front of an order ν, in the order they appear in l, yields the element list l.reverse ++ (ν.elems filtered away from l).
theorem order_foldl_move_to_front_elems {d : ℕ} (ν : Order d) (l : List (Fin d)) (hl : l.Nodup) :
(l.foldl (fun ν a => order_move_to_front a ν) ν).elems =
l.reverse ++ ν.elems.filter (fun y => decide (y ∉ l))order_graph_card_edges_lower_boundIn LeanCombinatorics for TCS
For any complete order graph G = (V, E) of dimension d ≥ 1 in the bidirectional model, the total number of edges satisfies |E| ≥ (d choose m) ⌈m/2⌉ for every m ∈ {1, ..., d}.
theorem order_graph_card_edges_lower_bound {d : ℕ} (hd : 1 ≤ d) (G : OrderGraph d)
(hG : order_graph_is_complete G) (m : ℕ) (hm1 : 1 ≤ m) (hmd : m ≤ d) :
Nat.choose d m * ((m + 1) / 2) ≤ G.E.cardorder_graph_card_edges_lower_bound_uniIn LeanCombinatorics for TCS
Let d ≥ 1 be an integer. If G is an order graph of dimension d that is complete in the unidirectional model, then the total number of edges satisfies |E| ≥ d * Nat.choose (d - 1) ((d - 1) / 2).
theorem order_graph_card_edges_lower_bound_uni {d : ℕ} (hd : 1 ≤ d) (G : OrderGraph d)
(hG : order_graph_is_complete_uni G) :
d * Nat.choose (d - 1) ((d - 1) / 2) ≤ G.E.cardorder_graph_chain_getLast_posIn LeanCombinatorics for TCS
For a nonempty chain p with duplicate-free labels, the number of edges is at most pos of the last edge's label in the last edge's source order.
theorem order_graph_chain_getLast_pos {d : ℕ} (p : List (Order d × Fin d)) (h : p ≠ [])
(hc : List.IsChain (fun e1 e2 : Order d × Fin d => e2.1 = order_move_to_front e1.2 e1.1) p)
(hn : (p.map Prod.snd).Nodup) :
p.length ≤ order_pos (p.getLast h).1 (p.getLast h).2order_graph_chain_head_labelIn LeanCombinatorics for TCS
For a chain p with duplicate-free labels and at least two edges, the source order of the last edge has the first edge's label at index p.length - 2.
theorem order_graph_chain_head_label {d : ℕ} (p : List (Order d × Fin d)) (h : p ≠ [])
(hc : List.IsChain (fun e1 e2 : Order d × Fin d => e2.1 = order_move_to_front e1.2 e1.1) p)
(hn : (p.map Prod.snd).Nodup) (h2 : 2 ≤ p.length) :
(p.getLast h).1.elems[p.length - 2]? = some (p.head h).2order_graph_chain_last_elemsIn LeanCombinatorics for TCS
For a nonempty chain p of edges (with e2.1 = order_move_to_front e1.2 e1.1) whose labels are duplicate-free, the element list of the last edge's source equals the reverse of the chain's labels with the last one dropped, followed by the first edge's source order filtered to remove all those labels.
theorem order_graph_chain_last_elems {d : ℕ} (p : List (Order d × Fin d)) (h : p ≠ [])
(hc : List.IsChain (fun e1 e2 : Order d × Fin d => e2.1 = order_move_to_front e1.2 e1.1) p)
(hn : (p.map Prod.snd).Nodup) :
(p.getLast h).1.elems = (p.map Prod.snd).dropLast.reverse ++
(p.head h).1.elems.filter (fun y => decide (y ∉ (p.map Prod.snd).dropLast))order_graph_chain_top_setIn LeanCombinatorics for TCS
For a nonempty chain p with duplicate-free labels, the top set U_{|p|}(last edge) equals the set of labels of p.
theorem order_graph_chain_top_set {d : ℕ} (p : List (Order d × Fin d)) (h : p ≠ [])
(hc : List.IsChain (fun e1 e2 : Order d × Fin d => e2.1 = order_move_to_front e1.2 e1.1) p)
(hn : (p.map Prod.snd).Nodup) :
order_graph_top_set p.length (p.getLast h) = (p.map Prod.snd).toFinsetorder_graph_edges_ge_lower_boundIn LeanCombinatorics for TCS
Let d ≥ 1 be an integer. Let G = (V, E) be a complete order graph of dimension d in the bidirectional model, and for each m ∈ {1, ..., d}, let E_{≥m} = {(ν, a) ∈ E : pos_ν(a) ≥ m}. Then for every m ∈ {1, ..., d}, |E_{≥m}| ≥ (d choose m) ⌈m/2⌉.
theorem order_graph_edges_ge_lower_bound {d : ℕ} (hd : 1 ≤ d) (G : OrderGraph d)
(hG : order_graph_is_complete G) (m : ℕ) (hm1 : 1 ≤ m) (hmd : m ≤ d) :
Nat.choose d m * ((m + 1) / 2) ≤ (order_graph_edges_ge G m).cardorder_graph_edges_ge_lower_bound_uniIn LeanCombinatorics for TCS
Let d ≥ 1 be an integer. If G is an order graph of dimension d that is complete in the unidirectional model, then for every m ∈ {1, ..., d}, the number of edges with pos_ν(a) ≥ m satisfies m * Nat.choose d m ≤ |E_{≥m}|.
theorem order_graph_edges_ge_lower_bound_uni {d : ℕ} (hd : 1 ≤ d) (G : OrderGraph d)
(hG : order_graph_is_complete_uni G) (m : ℕ) (hm1 : 1 ≤ m) (hmd : m ≤ d) :
m * Nat.choose d m ≤ (order_graph_edges_ge G m).cardorder_graph_fiber_boundIn LeanCombinatorics for TCS
For every m-subset U of Fin d with m ≥ 1, at least ceil(m/2) edges e of E_{>=m} satisfy U_m(e) = U.
theorem order_graph_fiber_bound {d : ℕ} (hd : 1 ≤ d) (G : OrderGraph d)
(hG : order_graph_is_complete G) (m : ℕ) (hm1 : 1 ≤ m) (hmd : m ≤ d)
(U : Finset (Fin d)) (hU : U.card = m) :
(m + 1) / 2 ≤ ((order_graph_edges_ge G m).filter
(fun e => order_graph_top_set m e = U)).cardorder_graph_fiber_bound_uniIn LeanCombinatorics for TCS
Let d ≥ 1 be an integer, and let G be an order graph of dimension d that is complete in the unidirectional model. For every m ∈ {1, ..., d} and every subset U ⊆ Fin d with |U| = m, the number of edges e in E_{≥m} with top set U_m(e) = U is at least m.
theorem order_graph_fiber_bound_uni {d : ℕ} (hd : 1 ≤ d) (G : OrderGraph d)
(hG : order_graph_is_complete_uni G) (m : ℕ) (hm1 : 1 ≤ m) (hmd : m ≤ d)
(U : Finset (Fin d)) (hU : U.card = m) :
m ≤ ((order_graph_edges_ge G m).filter (fun e => order_graph_top_set m e = U)).cardorder_graph_fiber_sumIn LeanCombinatorics for TCS
For m ≥ 1, the sum over all m-subsets U of Fin d of the number of edges of E_{>=m} with top set U equals the total number of edges of E_{>=m}.
theorem order_graph_fiber_sum {d : ℕ} (G : OrderGraph d) (m : ℕ) (hm1 : 1 ≤ m) :
(∑ U ∈ Finset.univ.powersetCard m,
((order_graph_edges_ge G m).filter
(fun e => order_graph_top_set m e = U)).card) = (order_graph_edges_ge G m).cardorder_graph_serves_chain_dataIn LeanCombinatorics for TCS
If G serves requirement (S, x) and x ∉ S, then there is a nonempty chain of edges of G.E of length |S|+1 whose labels are duplicate-free and whose label set is S ∪ {x}.
theorem order_graph_serves_chain_data {d : ℕ} (G : OrderGraph d) (S : Finset (Fin d))
(x : Fin d) (hx : x ∉ S) (hserv : order_graph_serves G S x) :
∃ p : List (Order d × Fin d), p ≠ [] ∧ (∀ e ∈ p, e ∈ G.E) ∧
List.IsChain (fun e1 e2 : Order d × Fin d => e2.1 = order_move_to_front e1.2 e1.1) p ∧
p.length = S.card + 1 ∧ (p.map Prod.snd).Nodup ∧
(p.map Prod.snd).toFinset = insert x Sorder_graph_top_set_cardIn LeanCombinatorics for TCS
If m ≥ 1 and m ≤ pos_ν(a) for an edge e = (ν, a), then U_m(e) has exactly m elements.
theorem order_graph_top_set_card {d : ℕ} (m : ℕ) (e : Order d × Fin d) (hm : 1 ≤ m)
(h : m ≤ order_pos e.1 e.2) : (order_graph_top_set m e).card = morder_graph_uni_serves_edgeIn LeanCombinatorics for TCS
In an order graph G of dimension d that is complete in the unidirectional model, for every m ∈ {1, ..., d}, every m-element subset U ⊆ Fin d, and every x ∈ U, there exists an edge e ∈ E_{≥m} such that U_m(e) = U and e.2 = x.
theorem order_graph_uni_serves_edge {d : ℕ} (G : OrderGraph d)
(hG : order_graph_is_complete_uni G) (m : ℕ) (hm1 : 1 ≤ m) (hmd : m ≤ d)
(U : Finset (Fin d)) (hU : U.card = m) (x : Fin d) (hx : x ∈ U) :
∃ e ∈ order_graph_edges_ge G m, order_graph_top_set m e = U ∧ e.2 = xorder_graph_unidirectional_lower_boundIn LeanCombinatorics for TCS
Let d ≥ 1 be an integer. If G is an order graph of dimension d that is complete in the unidirectional model, then for every m ∈ {1, ..., d}, the number of edges with pos_ν(a) ≥ m satisfies |E_{≥m}| ≥ m * Nat.choose d m, and consequently the total number of edges satisfies |E| ≥ d * Nat.choose (d - 1) ((d - 1) / 2).
theorem order_graph_unidirectional_lower_bound {d : ℕ} (hd : 1 ≤ d) (G : OrderGraph d)
(hG : order_graph_is_complete_uni G) :
(∀ m : ℕ, 1 ≤ m → m ≤ d → m * Nat.choose d m ≤ (order_graph_edges_ge G m).card) ∧
d * Nat.choose (d - 1) ((d - 1) / 2) ≤ G.E.cardorder_iso_of_down_setsIn LeanCombinatorics for TCS
If P and Q are finite partially ordered sets and α, β : P ≃ Q satisfy y ≤ x ↔ α y ≤ β x for all x, y, then P and Q are order isomorphic.
theorem order_iso_of_down_sets {P Q : Type*} [PartialOrder P] [PartialOrder Q]
[Fintype P] [Fintype Q] [DecidableRel ((· ≤ ·) : Q → Q → Prop)]
(α β : P ≃ Q) (h : ∀ y x, y ≤ x ↔ α y ≤ β x) :
Nonempty (P ≃o Q)order_mem_elemsIn LeanCombinatorics for TCS
Every element of Fin d occurs in the element list of an order of dimension d.
theorem order_mem_elems {d : ℕ} (π : Order d) (a : Fin d) : a ∈ π.elemsorder_move_to_front_elemsIn LeanCombinatorics for TCS
Moving a label a to the front of an order π gives the element list a :: π.elems.erase a.
theorem order_move_to_front_elems {d : ℕ} (a : Fin d) (π : Order d) :
(order_move_to_front a π).elems = a :: π.elems.erase aorder_of_mem_zpowers_of_primeIn LeanCombinatorics for TCS
Let p be a prime and σ be a permutation of Fin p of order p. Every non-identity element in the cyclic subgroup generated by σ has order p.
open Equiv Perm Subgroup in
theorem order_of_mem_zpowers_of_prime {p : ℕ} (hp : p.Prime) {σ : Perm (Fin p)}
(hσ : orderOf σ = p) {τ : Perm (Fin p)} (hτ : τ ∈ zpowers σ) (hτ1 : τ ≠ 1) :
orderOf τ = porder_reflecting_of_injective_down_set_preservingIn LeanCombinatorics for TCS
If a map α : P → Q between preordered types is injective and preserves principal down-sets (that is, the image of Set.Iic x under α is Set.Iic (α x) for all x in P), then α preserves and reflects the order: α x ≤ α y ↔ x ≤ y for all x, y in P.
theorem order_reflecting_of_injective_down_set_preserving
{P Q : Type*} [Preorder P] [Preorder Q] (α : P → Q) (hα : Function.Injective α)
(h_down : ∀ x : P, α '' Set.Iic x = Set.Iic (α x)) (x y : P) :
α x ≤ α y ↔ x ≤ yordered_pair_sum_count_pairIn LeanCombinatorics for TCS
For distinct a and b, the element a + b has exactly two ordered restricted representations from the two-element set {a, b}, namely (a, b) and (b, a).
theorem ordered_pair_sum_count_pair {G : Type*} [AddCommGroup G] [DecidableEq G] {a b : G} (h : a ≠ b) : orderedPairSumCount ({a, b} : Finset G) (a + b) = 2oriented_star_both_degrees_not_osIn LeanCombinatorics for TCS
An oriented star whose centre has positive in-degree and positive out-degree is not OS.
theorem oriented_star_both_degrees_not_os {V : Type*} [Fintype V] (D : Digraph V)
[DecidableRel D.Adj] (c : V)
(hstar : is_oriented_star D c)
(hin : 1 ≤ digraph_in_degree D c) (hout : 1 ≤ digraph_out_degree D c) :
¬ is_os_oriented_star D coriented_star_degree_sumIn LeanCombinatorics for TCS
In an oriented star, the in-degree plus the out-degree of the centre equals |V| - 1.
theorem oriented_star_degree_sum {V : Type*} [Fintype V] (D : Digraph V)
[DecidableRel D.Adj] (c : V)
(hloop : ∀ v, ¬ D.Adj v v) (hasym : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hconn : ∀ u, u ≠ c → D.Adj c u ∨ D.Adj u c) :
digraph_in_degree D c + digraph_out_degree D c = Fintype.card V - 1oriented_star_ge_two_edges_not_osIn LeanCombinatorics for TCS
If an oriented star D has at least two edges (at least three vertices), then D is not OS.
theorem oriented_star_ge_two_edges_not_os
{V : Type*} [Fintype V] (D : Digraph V) [DecidableRel D.Adj] (c : V)
(hstar : is_oriented_star D c) (hcard : 3 ≤ Fintype.card V) :
¬ is_os_oriented_star D coriented_star_oas_of_equal_degreesIn LeanCombinatorics for TCS
An oriented star whose center has equal in-degree and out-degree is oriented anti-Sidorenko (OAS).
theorem oriented_star_oas_of_equal_degrees
{V : Type*} [Fintype V] (D : Digraph V) [DecidableRel D.Adj] (c : V)
(heq : digraph_in_degree D c = digraph_out_degree D c) :
is_oas_oriented_star D coriented_star_zero_in_degree_not_osIn LeanCombinatorics for TCS
An oriented star with at least three vertices whose centre has in-degree 0 is not OS.
theorem oriented_star_zero_in_degree_not_os {V : Type*} [Fintype V] (D : Digraph V)
[DecidableRel D.Adj] (c : V)
(hstar : is_oriented_star D c) (hcard : 3 ≤ Fintype.card V)
(hin : digraph_in_degree D c = 0) :
¬ is_os_oriented_star D coriented_star_zero_out_degree_not_osIn LeanCombinatorics for TCS
An oriented star with at least three vertices whose centre has out-degree 0 is not OS.
theorem oriented_star_zero_out_degree_not_os {V : Type*} [Fintype V] (D : Digraph V)
[DecidableRel D.Adj] (c : V)
(hstar : is_oriented_star D c) (hcard : 3 ≤ Fintype.card V)
(hout : digraph_out_degree D c = 0) :
¬ is_os_oriented_star D cos_witness_digraphonsIn LeanCombinatorics for TCS
The rectangle digraphon W(x,y) = g(y), its transpose, and the split product digraphon 1_A x 1_B are all digraphons.
theorem os_witness_digraphons :
is_digraphon os_witness_rect ∧ is_digraphon (Function.swap os_witness_rect) ∧
is_digraphon os_witness_splitos_witness_rect_integralsIn LeanCombinatorics for TCS
For the rectangle digraphon and its transpose: the d-th power integral of the relevant (out-, resp. in-) marginal is (1/4)^d, while the d-th power integral of either symmetrized marginal equals (5/8)^d/4 + 3*(1/8)^d/4, written as (1/8)^d + ((5/8)^d - (1/8)^d)*(1/4).
theorem os_witness_rect_integrals :
(∀ d : ℕ, ∫ x in Set.Icc (0:ℝ) 1, (1 / 4 : ℝ) ^ d = (1 / 4) ^ d) ∧
(∀ d : ℕ, ∫ x in Set.Icc (0:ℝ) 1,
(digraphon_out_marginal os_witness_rect x) ^ d = (1 / 4) ^ d) ∧
(∀ d : ℕ, ∫ x in Set.Icc (0:ℝ) 1,
(digraphon_in_marginal (Function.swap os_witness_rect) x) ^ d = (1 / 4) ^ d) ∧
(∀ d : ℕ, ∫ x in Set.Icc (0:ℝ) 1,
(digraphon_out_marginal (digraphon_symmetrization os_witness_rect) x) ^ d =
(1 / 8) ^ d + ((5 / 8) ^ d - (1 / 8) ^ d) * (1 / 4)) ∧
(∀ d : ℕ, ∫ x in Set.Icc (0:ℝ) 1,
(digraphon_in_marginal (digraphon_symmetrization (Function.swap os_witness_rect)) x) ^ d =
(1 / 8) ^ d + ((5 / 8) ^ d - (1 / 8) ^ d) * (1 / 4))os_witness_rect_marginalsIn LeanCombinatorics for TCS
For the rectangle digraphon W = g(y): W^+ is the constant 1/4 and W^- = g, hence both marginals of the symmetrization (W + W^T)/2 equal (g + 1/4)/2; the transposed rectangle digraphon has the in- and out-marginals exchanged, with the same symmetrized marginals.
theorem os_witness_rect_marginals :
digraphon_out_marginal os_witness_rect = (fun _ => (1 / 4 : ℝ)) ∧
digraphon_in_marginal os_witness_rect = os_witness_rect_g ∧
digraphon_out_marginal (digraphon_symmetrization os_witness_rect) =
(fun x => (os_witness_rect_g x + 1 / 4) / 2) ∧
digraphon_in_marginal (digraphon_symmetrization os_witness_rect) =
(fun x => (os_witness_rect_g x + 1 / 4) / 2) ∧
digraphon_out_marginal (Function.swap os_witness_rect) = os_witness_rect_g ∧
digraphon_in_marginal (Function.swap os_witness_rect) = (fun _ => (1 / 4 : ℝ)) ∧
digraphon_out_marginal (digraphon_symmetrization (Function.swap os_witness_rect)) =
(fun x => (os_witness_rect_g x + 1 / 4) / 2) ∧
digraphon_in_marginal (digraphon_symmetrization (Function.swap os_witness_rect)) =
(fun x => (os_witness_rect_g x + 1 / 4) / 2)os_witness_rect_num_ineqIn LeanCombinatorics for TCS
For every d ≥ 2, (1/4)^d < (1/8)^d + ((5/8)^d - (1/8)^d)*(1/4), i.e. (1/4)^d < (5/8)^d/4 + 3*(1/8)^d/4.
theorem os_witness_rect_num_ineq (d : ℕ) (hd : 2 ≤ d) :
(1 / 4 : ℝ) ^ d < (1 / 8) ^ d + ((5 / 8) ^ d - (1 / 8) ^ d) * (1 / 4)os_witness_split_integralsIn LeanCombinatorics for TCS
For the split digraphon W = 1_A x 1_B: if a, b ≥ 1 then the integral of (W^-)^a (W^+)^b is 0, and for d ≥ 1 the integral of the d-th power of the symmetrized marginal equals (1/4)^d.
theorem os_witness_split_integrals :
(∀ d : ℕ, 1 ≤ d → ∫ x in Set.Icc (0:ℝ) 1,
(digraphon_out_marginal (digraphon_symmetrization os_witness_split) x) ^ d =
(1 / 4) ^ d) ∧
(∀ a b : ℕ, 1 ≤ a → 1 ≤ b → ∫ x in Set.Icc (0:ℝ) 1,
(digraphon_in_marginal os_witness_split x) ^ a *
(digraphon_out_marginal os_witness_split x) ^ b = 0)os_witness_split_marginalsIn LeanCombinatorics for TCS
For the split digraphon W = 1_A x 1_B with A = (0,1/2), B = (1/2,1): W^+ = (1/2)*1_A and W^- = (1/2)*1_B, and the two marginals of (W + W^T)/2 coincide.
theorem os_witness_split_marginals :
digraphon_out_marginal os_witness_split =
(fun x => Set.indicator (Set.Ioo (0:ℝ) (1/2)) (fun _ => (1:ℝ)) x / 2) ∧
digraphon_in_marginal os_witness_split =
(fun x => Set.indicator (Set.Ioo (1/2:ℝ) 1) (fun _ => (1:ℝ)) x / 2) ∧
digraphon_in_marginal (digraphon_symmetrization os_witness_split) =
digraphon_out_marginal (digraphon_symmetrization os_witness_split)palette_coloring_monochromatic_edges_leIn LeanCombinatorics for TCS
Given a graph G, nested palettes P, and a strictly increasing sequence of indices r_0 = 1 < ... < r_m ≤ T with degree bounds D(r_l), there exists a coloring c with at most (n - A_0)n + ∑ (A_l - A_{l+1}) D(r_l) + A_m D(r_m) monochromatic edges.
theorem palette_coloring_monochromatic_edges_le {V : Type*} [Fintype V] (G : SimpleGraph V) (k T : ℕ) (hk : 0 < k)
(P : ℕ → V → Finset (Fin k)) (hP_nested : ∀ t < T, ∀ v, P (t + 1) v ⊆ P t v)
(D : ℕ → ℝ) (m : ℕ) (r : ℕ → ℕ)
(hr0 : r 0 = 1)
(hr_mono : ∀ l < m, r l < r (l + 1))
(hr_bound : ∀ l ≤ m, 1 ≤ r l ∧ r l ≤ T)
(h_deg : ∀ l ≤ m, ∀ v ∈ palette_active_vertices (P (r l)),
∃ i ∈ P (r l) v, (palette_degree G (P (r l)) v i : ℝ) ≤ D (r l)) :
∃ c : V → Fin k, ((monochromatic_edges G c).card : ℝ) ≤
((Fintype.card V : ℝ) - ((palette_active_vertices (P 1)).card : ℝ)) * (Fintype.card V : ℝ) +
(∑ l ∈ Finset.range m, (((palette_active_vertices (P (r l))).card : ℝ) -
((palette_active_vertices (P (r (l + 1)))).card : ℝ)) * D (r l)) +
((palette_active_vertices (P (r m))).card : ℝ) * D (r m)palette_reconstruction_lemmaIn LeanCombinatorics for TCS
Let G be a simple graph on a finite vertex set V. Let P be a sequence of palette systems P 0 ⊇ P 1 ⊇ ... ⊇ P T with P 0 v = Finset.univ for all v : V, where 0 < k and 0 < T. Suppose that for every 1 ≤ t ≤ T and every v in palette_active_vertices (P t), there is a color i ∈ P t v with palette degree palette_degree G (P t) v i ≤ D t, where D t ∈ [0, Fintype.card V] and ∑_{t=1}^T D t ≤ k * Fintype.card V. If Fintype.card V - (palette_active_vertices (P t)).card ≤ α * t * Fintype.card V for all 1 ≤ t ≤ T, then there exists a coloring c : V → Fin k with at most (α * (k + 1) + k / T) * (Fintype.card V)^2 monochromatic edges in monochromatic_edges G c.
theorem palette_reconstruction_lemma {V : Type*} [Fintype V] (G : SimpleGraph V) (k T : ℕ) (hk : 0 < k) (hT : 0 < T) (P : ℕ → V → Finset (Fin k)) (hP0 : ∀ v, P 0 v = Finset.univ) (hP_nested : ∀ t < T, ∀ v, P (t + 1) v ⊆ P t v) (D : ℕ → ℝ) (hD_range : ∀ t ∈ Finset.Icc 1 T, 0 ≤ D t ∧ D t ≤ Fintype.card V) (hD_sum : ∑ t ∈ Finset.Icc 1 T, D t ≤ (k * Fintype.card V : ℝ)) (h_deg : ∀ t ∈ Finset.Icc 1 T, ∀ v ∈ palette_active_vertices (P t), ∃ i ∈ P t v, (palette_degree G (P t) v i : ℝ) ≤ D t) (α : ℝ) (hB : ∀ t ∈ Finset.Icc 1 T, ((Fintype.card V - (palette_active_vertices (P t)).card : ℕ) : ℝ) ≤ α * (t : ℝ) * (Fintype.card V : ℝ)) : ∃ c : V → Fin k, ((monochromatic_edges G c).card : ℝ) ≤ (α * (k + 1) + (k : ℝ) / T) * (Fintype.card V : ℝ)^2palette_summation_by_partsIn LeanCombinatorics for TCS
Summation by parts bound for real sequences: given non-increasing D, non-decreasing r with r_0 = 1, and bounds on n - A_l and the step sum of (r_{l+1} - r_l) D_l, the layered sum (n - A_0) n + ∑_{l=0}^{m-1} (A_l - A_{l+1}) D_l + A_m D_m is bounded by (α(k+1) + k/T) n^2.
theorem palette_summation_by_parts (m : ℕ) (A D r : ℕ → ℝ) (n α k T : ℝ)
(hr0 : r 0 = 1)
(hD_dec : ∀ l < m, D (l + 1) ≤ D l)
(hrm_nonneg : 0 ≤ r m)
(hD_nonneg : 0 ≤ D m)
(hn_D0 : 0 ≤ n - D 0)
(hA0 : n - A 0 ≤ α * n)
(hA : ∀ l < m, n - A (l + 1) ≤ α * r (l + 1) * n)
(h_sum_r : ∑ l ∈ Finset.range m, (r (l + 1) - r l) * D l ≤ k * n)
(hDm : D m ≤ k * n / T)
(hn : 0 ≤ n)
(hα : 0 ≤ α) :
(n - A 0) * n + (∑ l ∈ Finset.range m, (A l - A (l + 1)) * D l) + A m * D m ≤
(α * (k + 1) + k / T) * n^2parallel_line_intersection_dichotomyIn LeanCombinatorics for TCS
Let p be a prime, S an admissible plane set in (ZMod p)^3 containing the affine line through P in direction v ≠ 0. Then for every point Q, the affine line through Q in direction v meets S in either 0 or p points.
theorem parallel_line_intersection_dichotomy
(p : ℕ) [Fact p.Prime] (S : Set (Fin 3 → ZMod p)) (hS : admissible_plane_set p S)
(P v : Fin 3 → ZMod p) (hv : v ≠ 0) (hline : affine_line P v ⊆ S)
(Q : Fin 3 → ZMod p) :
(S ∩ affine_line Q v).ncard = 0 ∨ (S ∩ affine_line Q v).ncard = pparallel_mw_alpha_posIn LeanCombinatorics for TCS
For natural numbers n and r with 1 ≤ r, parallel_mw_alpha n r is strictly positive.
theorem parallel_mw_alpha_pos (n r : ℕ) (hr : 1 ≤ r) : 0 < parallel_mw_alpha n r
parallel_mw_ratio_lt_iff_coreIn LeanCombinatorics for TCS
For natural numbers n and r, profiles q q' : Fin n → ℕ, if parallel_mw_alpha n r > 0 and parallel_mw_tau r q > 0 and parallel_mw_tau r q' > 0, then parallel_mw_ratio r q' < parallel_mw_ratio r q holds if and only if parallel_mw_star r q' * (parallel_mw_tau r q)^2 < parallel_mw_star r q * (parallel_mw_tau r q')^2.
theorem parallel_mw_ratio_lt_iff_core {n : ℕ} (r : ℕ) (q q' : Fin n → ℕ)
(ha : 0 < parallel_mw_alpha n r) (hq : 0 < parallel_mw_tau r q) (hq' : 0 < parallel_mw_tau r q') :
(parallel_mw_ratio r q' < parallel_mw_ratio r q ↔
parallel_mw_star r q' * (parallel_mw_tau r q) ^ 2 <
parallel_mw_star r q * (parallel_mw_tau r q') ^ 2)parallel_mw_star_transfer_formulaIn LeanCombinatorics for TCS
For natural numbers n and r, a profile q : Fin n → ℕ, distinct i j : Fin n with q j ≥ 1: parallel_mw_star r (parallel_mw_transfer q i j) = parallel_mw_star r q + 2 * (2^(q j - 1) - 2^(q i)) * (sum from m = 0 to r-2 of (-1)^(r-m) * elem_symm_on (univ \ {i,j}) m (fun k => 2^(q k) - 1)).
theorem parallel_mw_star_transfer_formula {n : ℕ} (r : ℕ) (q : Fin n → ℕ) (i j : Fin n)
(hij : i ≠ j) (hj : 1 ≤ q j) :
parallel_mw_star r (parallel_mw_transfer q i j) =
parallel_mw_star r q + 2 * ((2 : ℝ) ^ (q j - 1) - (2 : ℝ) ^ (q i)) *
(∑ m ∈ Finset.range (r - 1), (-1 : ℝ) ^ (r - m) *
elem_symm_on ((Finset.univ.erase i).erase j) m (fun k => (2 : ℝ) ^ (q k) - 1))parallel_mw_star_transfer_gtIn LeanCombinatorics for TCS
For natural numbers n ≥ 3 and r with 2 ≤ r < n, a profile q : Fin n → ℕ with q k > 0 for all k, and indices i j with q i + 2 ≤ q j, the star value of the transferred profile is strictly larger than that of q.
theorem parallel_mw_star_transfer_gt {n r : ℕ} (hn : 3 ≤ n) (hr : 2 ≤ r) (hrn : r < n)
(q : Fin n → ℕ) (hq : ∀ i, 0 < q i) (i j : Fin n) (hij : q i + 2 ≤ q j) :
parallel_mw_star r q < parallel_mw_star r (parallel_mw_transfer q i j)parallel_mw_tau_posIn LeanCombinatorics for TCS
For natural numbers n and r with r ≤ n, and q : Fin n → ℕ with q i > 0 for all i, parallel_mw_tau r q is strictly positive.
theorem parallel_mw_tau_pos {n : ℕ} (r : ℕ) (q : Fin n → ℕ) (hq : ∀ i, 0 < q i) (hrn : r ≤ n) :
0 < parallel_mw_tau r qparallel_mw_tau_transfer_formulaIn LeanCombinatorics for TCS
For natural numbers n and r with 2 ≤ r, a profile q : Fin n → ℕ, distinct i j : Fin n with q j ≥ 1: parallel_mw_tau r (parallel_mw_transfer q i j) = parallel_mw_tau r q + (q j - q i - 1) * elem_symm_on (univ \ {i, j}) (r-2) q, where the subtraction in the coefficient is in ℝ.
theorem parallel_mw_tau_transfer_formula {n : ℕ} (r : ℕ) (hr : 2 ≤ r) (q : Fin n → ℕ) (i j : Fin n)
(hij : i ≠ j) (hj : 1 ≤ q j) :
parallel_mw_tau r (parallel_mw_transfer q i j) =
parallel_mw_tau r q + ((q j : ℝ) - (q i : ℝ) - 1) *
elem_symm_on ((Finset.univ.erase i).erase j) (r - 2) (fun k => (q k : ℝ))parallel_mw_tau_transfer_gtIn LeanCombinatorics for TCS
For natural numbers n and r with 2 ≤ r < n, a profile q : Fin n → ℕ with q k > 0 for all k, and indices i j with q i + 2 ≤ q j, the r-th elementary symmetric sum of the transferred profile is strictly larger than that of q.
theorem parallel_mw_tau_transfer_gt {n r : ℕ} (hr : 2 ≤ r) (hrn : r < n)
(q : Fin n → ℕ) (hq : ∀ k, 0 < q k) (i j : Fin n) (hij : q i + 2 ≤ q j) :
parallel_mw_tau r q < parallel_mw_tau r (parallel_mw_transfer q i j)parallel_mw_transfer_coreIn LeanCombinatorics for TCS
For natural numbers n ≥ 3 and r with 2 ≤ r < n, a profile q : Fin n → ℕ with q k > 0 for all k, and indices i j with q i + 2 ≤ q j: parallel_mw_star r (parallel_mw_transfer q i j) * (parallel_mw_tau r q)^2 < parallel_mw_star r q * (parallel_mw_tau r (parallel_mw_transfer q i j))^2.
theorem parallel_mw_transfer_core {n r : ℕ} (hn : 3 ≤ n) (hr : 2 ≤ r) (hrn : r < n)
(q : Fin n → ℕ) (hq : ∀ i, 0 < q i) (i j : Fin n) (hij : q i + 2 ≤ q j) :
parallel_mw_star r (parallel_mw_transfer q i j) * (parallel_mw_tau r q) ^ 2 <
parallel_mw_star r q * (parallel_mw_tau r (parallel_mw_transfer q i j)) ^ 2partition_A_57_cardIn LeanCombinatorics for TCS
The family A_57 of partitions of 57 whose multiset of parts contains {1,2} or {1,3} or {1,4} or {2,3,4} has exactly 527254 members.
theorem partition_A_57_card : (partition_A 57).card = 527254
partition_merge_mixture_ulc_counterexampleIn LeanCombinatorics for TCS
A positive mixture of the coefficient sequences of the partition matroid polynomial (1+2X)(1+X) and the free matroid polynomial (1+X)^4 violates binomial-normalized log-concavity at rank two.
theorem partition_merge_mixture_ulc_counterexample : let a : ℕ → ℚ := fun k => if k = 0 then 1 else if k = 1 then 3 else if k = 2 then 2 else 0; let u : ℕ → ℚ := fun k => (Nat.choose 4 k : ℚ); let v : ℕ → ℚ := fun k => a k + 3 * u k; v 1 * v 3 * (Nat.choose 4 2 : ℚ)^2 > v 2^2 * 4 * (Nat.choose 4 3 : ℚ)
partitionable_faces_card_eq_sumIn LeanCombinatorics for TCS
If a selection map phi partitions the face set of a finite simplicial complex into boolean intervals, each face lying in a unique interval [phi sigma, sigma] whose top is a facet sigma, then the number of faces equals the sum over facets sigma of 2^(|sigma| - |phi sigma|).
theorem partitionable_faces_card_eq_sum {V : Type*} [DecidableEq V] {facets : Finset (Finset V)}
{phi : Finset V → Finset V}
(hsub : ∀ σ ∈ facets, phi σ ⊆ σ)
(huniq : ∀ τ ∈ facets.biUnion Finset.powerset,
∃! σ, σ ∈ facets ∧ phi σ ⊆ τ ∧ τ ⊆ σ) :
(facets.biUnion Finset.powerset).card
= facets.sum (fun σ => 2 ^ (σ.card - (phi σ).card))partitionable_of_intervals_cover_and_disjointIn LeanCombinatorics for TCS
A finite simplicial complex is partitionable if there exists a selection map phi whose Boolean intervals are pairwise disjoint and cover all faces.
theorem partitionable_of_intervals_cover_and_disjoint
{V : Type*} [DecidableEq V] (facets : Finset (Finset V))
(phi : Finset V → Finset V)
(hsub : ∀ σ ∈ facets, phi σ ⊆ σ)
(hdisj : ∀ σ₁ ∈ facets, ∀ σ₂ ∈ facets, σ₁ ≠ σ₂ →
∀ τ, (phi σ₁ ⊆ τ ∧ τ ⊆ σ₁) → ¬ (phi σ₂ ⊆ τ ∧ τ ⊆ σ₂))
(hcov : ∀ τ ∈ facets.biUnion Finset.powerset, ∃ σ ∈ facets, phi σ ⊆ τ ∧ τ ⊆ σ) :
is_partitionable_two_complex facetspattern_contains_of_standardizeIn LeanCombinatorics for TCS
If l is duplicate-free and the standardization of l pattern-contains τ, then l itself pattern-contains τ.
theorem pattern_contains_of_standardize {l τ : List ℕ} (h : l.Nodup) (h1 : pattern_contains (pattern_standardize l) τ) : pattern_contains l τpattern_contains_of_sublistIn LeanCombinatorics for TCS
A sublist l₁ of l₂ is a pattern contained in l₂.
theorem pattern_contains_of_sublist {l₁ l₂ : List ℕ} (h : l₁.Sublist l₂) : pattern_contains l₂ l₁pattern_contains_standardize_selfIn LeanCombinatorics for TCS
A duplicate-free list l pattern-contains its own standardization (using the whole list as the witnessing sublist).
theorem pattern_contains_standardize_self (l : List ℕ) (h : l.Nodup) : pattern_contains l (pattern_standardize l)
pattern_contains_transIn LeanCombinatorics for TCS
Pattern containment is transitive: if π contains σ and σ contains τ then π contains τ.
theorem pattern_contains_trans (π σ τ : List ℕ) (h1 : pattern_contains π σ) (h2 : pattern_contains σ τ) : pattern_contains π τ
pattern_standardize_eq_of_order_isoIn LeanCombinatorics for TCS
If s is duplicate-free, π is a standard permutation, |s| = |π|, and s is order-isomorphic to π entrywise, then the standardization of s is exactly π.
theorem pattern_standardize_eq_of_order_iso {s π : List ℕ} (hs : s.Nodup) (hπ : π.Perm (List.range' 1 π.length)) (hlen : s.length = π.length) (hord : ∀ (i j : Fin s.length), s[i] < s[j] ↔ π[Fin.cast hlen i] < π[Fin.cast hlen j]) : pattern_standardize s = πpattern_standardize_filter_lengthIn LeanCombinatorics for TCS
If σ' is duplicate-free, its entries ≤ |σ| form exactly σ (a standard permutation), s is a sublist of σ, and |σ'| = |σ| + k, then the entries of σ' that are either above |σ| or lie in s number |s| + k.
theorem pattern_standardize_filter_length {σ' σ s : List ℕ} {k : ℕ} (hσ' : σ'.Nodup) (hkeep : σ'.filter (fun x => decide (x ≤ σ.length)) = σ) (hperm : σ.Perm (List.range' 1 σ.length)) (hsub : s.Sublist σ) (hlen' : σ'.length = σ.length + k) : (σ'.filter (fun x => decide (x ≤ σ.length → x ∈ s))).length = s.length + kpattern_standardize_filter_of_sublistIn LeanCombinatorics for TCS
If s is a sublist of σ', every entry of σ' outside s exceeds every entry of s, and the standardization of s is π, then filtering the standardization of σ' to the values ≤ |π| yields π.
theorem pattern_standardize_filter_of_sublist {σ' s π : List ℕ} (hsub : s.Sublist σ') (hbig : ∀ x ∈ σ', x ∉ s → ∀ y ∈ s, y < x) (hπ : pattern_standardize s = π) : (pattern_standardize σ').filter (fun z => decide (z ≤ π.length)) = πpattern_standardize_permIn LeanCombinatorics for TCS
The standardization of a duplicate-free list is a permutation of 1, …, |l|.
theorem pattern_standardize_perm (l : List ℕ) (h : l.Nodup) : (pattern_standardize l).Perm (List.range' 1 l.length)
pattern_standardize_rank_lt_iffIn LeanCombinatorics for TCS
For a duplicate-free list l and elements x, y of l, the rank of x is strictly smaller than the rank of y (rank z = number of entries ≤ z) if and only if x < y.
theorem pattern_standardize_rank_lt_iff (l : List ℕ) (h : l.Nodup) {x y : ℕ} (hx : x ∈ l) (hy : y ∈ l) : (l.filter (fun z => z ≤ x)).length < (l.filter (fun z => z ≤ y)).length ↔ x < yperfect_set_to_reduced_latin_square_memIn LeanCombinatorics for TCS
For every natural number n with n ≥ 2 and every finite set S of permutations of Fin n satisfying is_perfect_set n S, the array perfect_set_to_reduced_latin_square S is a reduced Latin square.
theorem perfect_set_to_reduced_latin_square_mem (n : ℕ) [NeZero n] (hn : 2 ≤ n)
(S : Finset (Equiv.Perm (Fin n))) (hS : is_perfect_set n S) :
is_reduced_latin_square (perfect_set_to_reduced_latin_square S)perm_eq_of_get_lt_iffIn LeanCombinatorics for TCS
If two lists are both permutations of {1, …, n} (with the same length n) and have the same pairwise < pattern, then they are equal.
theorem perm_eq_of_get_lt_iff {p q : List ℕ} (hp : p.Perm (List.range' 1 p.length)) (hq : q.Perm (List.range' 1 q.length)) (hlen : p.length = q.length) (hpat : ∀ i j : Fin p.length, p[i] < p[j] ↔ q[Fin.cast hlen i] < q[Fin.cast hlen j]) : p = qperm_offset_rook_number_neg_one_one_eq_menage_of_ltIn LeanCombinatorics for TCS
For every natural number n ≥ 4 such that n is even, and every natural number k < n, the rook numbers for {-1, 1} and {-1, 0} are equal: perm_offset_rook_number n {-1, 1} k = perm_offset_rook_number n {-1, 0} k.
theorem perm_offset_rook_number_neg_one_one_eq_menage_of_lt (n : ℕ) (hn : 4 ≤ n) (he : Even n)
(k : ℕ) (hk : k < n) :
perm_offset_rook_number n {-1, 1} k = perm_offset_rook_number n {-1, 0} kperm_offset_rook_number_neg_one_one_top_eq_menage_add_twoIn LeanCombinatorics for TCS
For every natural number n ≥ 4 such that n is even, the n-th rook number for {-1, 1} is equal to the n-th rook number for {-1, 0} plus 2: perm_offset_rook_number n {-1, 1} n = perm_offset_rook_number n {-1, 0} n + 2.
theorem perm_offset_rook_number_neg_one_one_top_eq_menage_add_two (n : ℕ) (hn : 4 ≤ n) (he : Even n) :
perm_offset_rook_number n {-1, 1} n = perm_offset_rook_number n {-1, 0} n + 2petrial_log_concave_of_petrial_nullity_poly_pointwiseIn LeanCombinatorics for TCS
If for every k the nullity generating polynomial of G satisfies a_k * a_{k+2} ≤ a_{k+1}^2, then G has a log-concave partial Petrial polynomial.
theorem petrial_log_concave_of_petrial_nullity_poly_pointwise {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(h : ∀ k : ℕ, (petrial_nullity_poly G).coeff k * (petrial_nullity_poly G).coeff (k + 2)
≤ (petrial_nullity_poly G).coeff (k + 1) * (petrial_nullity_poly G).coeff (k + 1)) :
petrial_log_concave Gpetrial_nullity_poly_coeff_eq_petrial_coeffIn LeanCombinatorics for TCS
For every finite graph G on V and every k ≤ |V|, the coefficient of w^(|V| - k) in the nullity generating polynomial equals petrial_coeff G k (the number of vertex subsets F whose partial Petrial matrix has rank k).
theorem petrial_nullity_poly_coeff_eq_petrial_coeff {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (hk : k ≤ Fintype.card V) :
(petrial_nullity_poly G).coeff (Fintype.card V - k) = petrial_coeff G kpetrial_nullity_poly_eval_oneIn LeanCombinatorics for TCS
For every finite graph G on V, the nullity generating polynomial evaluated at w = 1 equals 2^|V| (the number of vertex subsets).
theorem petrial_nullity_poly_eval_one {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
(petrial_nullity_poly G).eval 1 = 2 ^ Fintype.card Vpetrial_nullity_poly_leaf_recIn LeanCombinatorics for TCS
For a finite graph G with a degree-one vertex v whose neighbour is u, the nullity generating polynomial of G equals the nullity generating polynomial of G with v deleted, plus twice the nullity generating polynomial of G with u and v deleted.
theorem petrial_nullity_poly_leaf_rec {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] {v u : V}
(hv : T.degree v = 1) (hu : T.Adj v u) :
petrial_nullity_poly T
= petrial_nullity_poly (T.induce ({v}ᶜ : Set V))
+ 2 * petrial_nullity_poly (T.induce (({u} ∪ {v})ᶜ : Set V))petrial_nullity_poly_log_concave_of_acyclic_maxDegree_threeIn LeanCombinatorics for TCS
For every acyclic graph G on a finite type V with maximum degree at most 3, the coefficient sequence of the nullity generating polynomial of G is log-concave (a_k * a_{k+2} ≤ a_{k+1}^2 for all k) and has interval support.
theorem petrial_nullity_poly_log_concave_of_acyclic_maxDegree_three
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hacyc : G.IsAcyclic) (hdeg : G.maxDegree ≤ 3) :
poly_log_concave_with_interval_support (petrial_nullity_poly G)petrial_nullity_poly_mul_of_cutIn LeanCombinatorics for TCS
If no edge of G joins a vertex of s to a vertex outside s, then the nullity generating polynomial of G is the product of the nullity generating polynomials of the induced subgraphs on s and on its complement.
theorem petrial_nullity_poly_mul_of_cut {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (s : Set V) [DecidablePred (· ∈ s)]
(hcut : ∀ a b : V, a ∈ s → b ∉ s → ¬ G.Adj a b) :
petrial_nullity_poly G
= petrial_nullity_poly (G.induce s) * petrial_nullity_poly (G.induce sᶜ)planar_admissible_height_eq_of_generating_subsetIn LeanCombinatorics for TCS
If two admissible heights agree on a subset S ⊆ A containing, for every point x outside S, an outgoing segment x − y parallel to a segment between two points of S, then they agree everywhere.
theorem planar_admissible_height_eq_of_generating_subset (A : Finset (EuclideanSpace ℝ (Fin 2))) (S : Finset (EuclideanSpace ℝ (Fin 2))) (hS : S ⊆ A) (z z' : ↥A → ℝ) (hz : planar_admissible_height A z) (hz' : planar_admissible_height A z') (hagree : ∀ x : ↥A, (↑x : EuclideanSpace ℝ (Fin 2)) ∈ S → z x = z' x) (hgen : ∀ x : ↥A, (↑x : EuclideanSpace ℝ (Fin 2)) ∉ S → ∃ y : ↥A, ∃ a b : ↥A, ∃ c : ℝ, c ≠ 0 ∧ (↑x - ↑y : EuclideanSpace ℝ (Fin 2)) = c • ((↑b - ↑a : EuclideanSpace ℝ (Fin 2))) ∧ (↑y : EuclideanSpace ℝ (Fin 2)) ∈ S ∧ (↑a : EuclideanSpace ℝ (Fin 2)) ∈ S ∧ (↑b : EuclideanSpace ℝ (Fin 2)) ∈ S) : ∀ x : ↥A, z x = z' x
planar_all_even_affine_imageIn LeanCombinatorics for TCS
Being all-even is invariant under affine bijections of the plane.
theorem planar_all_even_affine_image (A : Finset (EuclideanSpace ℝ (Fin 2))) (f : EuclideanSpace ℝ (Fin 2) ≃ᵃ[ℝ] EuclideanSpace ℝ (Fin 2)) : planar_all_even (A.image f.toEquiv.toEmbedding) ↔ planar_all_even A
planar_all_even_exists_occupied_lines_le_sixIn LeanCombinatorics for TCS
Every finite planar all-even set A with A.card ≤ 8 has a non-zero direction u in which at most six lines meet A.
theorem planar_all_even_exists_occupied_lines_le_six
(A : Finset (EuclideanSpace ℝ (Fin 2)))
(hA : planar_all_even A) (hcard : A.card ≤ 8) :
∃ u : EuclideanSpace ℝ (Fin 2), u ≠ 0 ∧ planar_occupied_lines A u ≤ 6planar_all_even_height_rigid_of_occupied_lines_eq_eightIn LeanCombinatorics for TCS
Every all-even planar set meeting exactly eight lines perpendicular to some non-zero direction is height-rigid.
theorem planar_all_even_height_rigid_of_occupied_lines_eq_eight (A : Finset (EuclideanSpace ℝ (Fin 2))) (hA : planar_all_even A) (u : EuclideanSpace ℝ (Fin 2)) (hu : u ≠ 0) (h8 : planar_occupied_lines A u = 8) : planar_height_rigid A
planar_all_even_height_rigid_of_occupied_lines_eq_fourIn LeanCombinatorics for TCS
Every finite planar all-even set A for which there exists a non-zero vector u with planar_occupied_lines A u = 4 is height-rigid (planar_height_rigid A).
theorem planar_all_even_height_rigid_of_occupied_lines_eq_four
(A : Finset (EuclideanSpace ℝ (Fin 2)))
(hA : planar_all_even A)
(u : EuclideanSpace ℝ (Fin 2)) (hu : u ≠ 0)
(h4 : planar_occupied_lines A u = 4) :
planar_height_rigid Aplanar_all_even_height_rigid_of_occupied_lines_eq_sixIn LeanCombinatorics for TCS
Every finite planar all-even set A for which there exists a non-zero vector u with planar_occupied_lines A u = 6 is height-rigid (planar_height_rigid A).
theorem planar_all_even_height_rigid_of_occupied_lines_eq_six
(A : Finset (EuclideanSpace ℝ (Fin 2)))
(hA : planar_all_even A)
(u : EuclideanSpace ℝ (Fin 2)) (hu : u ≠ 0)
(h6 : planar_occupied_lines A u = 6) :
planar_height_rigid Aplanar_all_even_occupied_lines_le_eight_casesIn LeanCombinatorics for TCS
For an all-even set A and a non-zero direction u, if at most 8 lines perpendicular to u meet A then exactly 4, 6 or 8 do.
theorem planar_all_even_occupied_lines_le_eight_cases (A : Finset (EuclideanSpace ℝ (Fin 2))) (hA : planar_all_even A) (u : EuclideanSpace ℝ (Fin 2)) (hu : u ≠ 0) (h8 : planar_occupied_lines A u ≤ 8) : planar_occupied_lines A u = 4 ∨ planar_occupied_lines A u = 6 ∨ planar_occupied_lines A u = 8
planar_all_even_occupied_lines_le_six_casesIn LeanCombinatorics for TCS
For an all-even set A and a non-zero direction u, if at most 6 lines perpendicular to u meet A then exactly 4 or 6 do.
theorem planar_all_even_occupied_lines_le_six_cases
(A : Finset (EuclideanSpace ℝ (Fin 2)))
(hA : planar_all_even A)
(u : EuclideanSpace ℝ (Fin 2)) (hu : u ≠ 0)
(h6 : planar_occupied_lines A u ≤ 6) :
planar_occupied_lines A u = 4 ∨ planar_occupied_lines A u = 6planar_height_rigid_affine_imageIn LeanCombinatorics for TCS
Height-rigidity is invariant under affine bijections of the plane.
theorem planar_height_rigid_affine_image (A : Finset (EuclideanSpace ℝ (Fin 2))) (f : EuclideanSpace ℝ (Fin 2) ≃ᵃ[ℝ] EuclideanSpace ℝ (Fin 2)) : planar_height_rigid (A.image f.toEquiv.toEmbedding) ↔ planar_height_rigid A
planar_height_rigid_of_card_le_threeIn LeanCombinatorics for TCS
Every finite planar set with at most three points is height-rigid.
theorem planar_height_rigid_of_card_le_three (A : Finset (EuclideanSpace ℝ (Fin 2))) (h : A.card ≤ 3) : planar_height_rigid A
planar_height_rigid_of_gridIn LeanCombinatorics for TCS
A complete parallelogram grid {p + i·v + j·w : i < n, j < m} of points is height-rigid.
theorem planar_height_rigid_of_grid (A : Finset (EuclideanSpace ℝ (Fin 2))) (p v w : EuclideanSpace ℝ (Fin 2)) (n m : ℕ) (hn : 0 < n) (hm : 0 < m) (hind : ∀ a b : ℝ, a • v + b • w = 0 → a = 0 ∧ b = 0) (hA : ∀ x, x ∈ A ↔ ∃ i : ℕ, ∃ j : ℕ, i < n ∧ j < m ∧ x = p + i • v + j • w) : planar_height_rigid A
planar_occupied_lines_affine_imageIn LeanCombinatorics for TCS
Under an affine bijection f, the number of lines perpendicular to u meeting the image set equals the number of lines perpendicular to the adjoint of the linear part of f meeting the original set.
theorem planar_occupied_lines_affine_image (A : Finset (EuclideanSpace ℝ (Fin 2))) (f : EuclideanSpace ℝ (Fin 2) ≃ᵃ[ℝ] EuclideanSpace ℝ (Fin 2)) (u : EuclideanSpace ℝ (Fin 2)) : planar_occupied_lines (A.image f.toEquiv.toEmbedding) u = planar_occupied_lines A (f.linear.adjoint u)
planar_occupied_lines_le_cardIn LeanCombinatorics for TCS
The number of lines perpendicular to any direction u that meet a finite planar set A is at most the cardinality of A.
theorem planar_occupied_lines_le_card (A : Finset (EuclideanSpace ℝ (Fin 2))) (u : EuclideanSpace ℝ (Fin 2)) :
planar_occupied_lines A u ≤ A.cardplanar_occupied_lines_le_card_sub_one_of_inner_eqIn LeanCombinatorics for TCS
If two distinct points p, q of A have the same inner product with u, then the lines perpendicular to u meeting A number at most |A| - 1.
theorem planar_occupied_lines_le_card_sub_one_of_inner_eq
(A : Finset (EuclideanSpace ℝ (Fin 2))) (u : EuclideanSpace ℝ (Fin 2))
{p q : EuclideanSpace ℝ (Fin 2)} (hp : p ∈ A) (hq : q ∈ A) (hpq : p ≠ q)
(hin : inner ℝ p u = inner ℝ q u) :
planar_occupied_lines A u ≤ A.card - 1planar_occupied_lines_smulIn LeanCombinatorics for TCS
Scaling the direction by a non-zero real does not change the number of occupied lines.
theorem planar_occupied_lines_smul (A : Finset (EuclideanSpace ℝ (Fin 2))) (u : EuclideanSpace ℝ (Fin 2)) (c : ℝ) (hc : c ≠ 0) : planar_occupied_lines A (c • u) = planar_occupied_lines A u
plane_exists_ne_zero_orthogonalIn LeanCombinatorics for TCS
Every non-zero vector v in the plane admits a non-zero vector u orthogonal to it.
theorem plane_exists_ne_zero_orthogonal {v : EuclideanSpace ℝ (Fin 2)} (hv : v ≠ 0) :
∃ u : EuclideanSpace ℝ (Fin 2), u ≠ 0 ∧ inner ℝ v u = 0plane_tree_inductionIn LeanCombinatorics for TCS
Structural induction on plane trees: if P holds of the leaf and holds of node cs whenever it holds of every child c ∈ cs, then P holds of every plane tree.
theorem plane_tree_induction {P : PlaneTree → Prop} (hleaf : P PlaneTree.leaf)
(hnode : ∀ cs : List PlaneTree, (∀ c ∈ cs, P c) → P (PlaneTree.node cs)) :
∀ t : PlaneTree, P tpocket_append_max_rangeIn LeanCombinatorics for TCS
For a standard permutation ρ of 1..|ρ| and any k, the list ρ followed by (|ρ|+1, …, |ρ|+k) is again a standard permutation, filtering it by (· ≤ |ρ|) recovers ρ, and it has length |ρ| + k.
theorem pocket_append_max_range (ρ : List ℕ) (hρ : ρ.Perm (List.range' 1 ρ.length)) (k : ℕ) :
(ρ ++ List.range' (ρ.length + 1) k).Perm (List.range' 1 (ρ.length + k)) ∧
(ρ ++ List.range' (ρ.length + 1) k).filter (· ≤ ρ.length) = ρ ∧
(ρ ++ List.range' (ρ.length + 1) k).length = ρ.length + kpocket_depth_bound_from_omitted_max_typesIn LeanCombinatorics for TCS
Let B be a finite set of nonempty permutations of natural numbers from 1 to their length. If B contains no pattern whose maximum entry is at the leftmost position, or contains no pattern whose maximum entry is at the rightmost position, then every B-avoiding permutation has extensions by new maxima of arbitrary depth (so Av(B) has no pockets in its insert-maximum tree). If B is nonempty and contains no pattern whose maximum entry is in an interior position, then for every mortal B-avoiding permutation ρ (which cannot be extended by arbitrarily many new maxima), every B-avoiding extension σ of ρ has depth |σ| - |ρ| at most (||B||-1)^2, where ||B|| = max_{β ∈ B} |β|.
theorem pocket_depth_bound_from_omitted_max_types
(B : Set (List ℕ)) (hB_fin : B.Finite)
(hB_perm : ∀ β ∈ B, β.Perm (List.range' 1 β.length) ∧ β ≠ []) :
((¬ ∃ β ∈ B, ∃ h : β ≠ [], ∀ x ∈ β, x ≤ β.head h) ∨
(¬ ∃ β ∈ B, ∃ h : β ≠ [], ∀ x ∈ β, x ≤ β.getLast h) →
∀ ρ : List ℕ, ρ.Perm (List.range' 1 ρ.length) →
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist ρ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) →
∀ k : ℕ, ∃ σ : List ℕ,
σ.Perm (List.range' 1 σ.length) ∧
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist σ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∧
σ.filter (· ≤ ρ.length) = ρ ∧ σ.length = ρ.length + k) ∧
(B.Nonempty ∧ (¬ ∃ β ∈ B, ∃ h : β ≠ [], (∃ x ∈ β, β.head h < x) ∧ (∃ x ∈ β, β.getLast h < x)) →
∀ ρ : List ℕ, ρ.Perm (List.range' 1 ρ.length) →
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist ρ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) →
(¬ ∀ k : ℕ, ∃ σ : List ℕ,
σ.Perm (List.range' 1 σ.length) ∧
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist σ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∧
σ.filter (· ≤ ρ.length) = ρ ∧ σ.length = ρ.length + k) →
∀ σ : List ℕ, σ.Perm (List.range' 1 σ.length) →
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist σ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) →
σ.filter (· ≤ ρ.length) = ρ →
σ.length - ρ.length ≤ (sSup (List.length '' B) - 1) ^ 2)pocket_depth_bound_of_omitted_interior_max_typeIn LeanCombinatorics for TCS
Let B be a finite nonempty set of nonempty permutations of 1..|β| containing no pattern whose maximum is in an interior position, and m = ||B|| = max_{β ∈ B} |β|. If ρ is a B-avoiding standard permutation that is mortal (its B-avoiding extensions obtained by inserting new maxima have bounded length), then every B-avoiding standard extension σ of ρ with σ.filter (· ≤ |ρ|) = ρ satisfies |σ| - |ρ| ≤ (m-1)^2.
theorem pocket_depth_bound_of_omitted_interior_max_type
(B : Set (List ℕ)) (hB_fin : B.Finite)
(hB_perm : ∀ β ∈ B, β.Perm (List.range' 1 β.length) ∧ β ≠ [])
(hB_ne : B.Nonempty)
(hnoM : ¬ ∃ β ∈ B, ∃ h : β ≠ [], (∃ x ∈ β, β.head h < x) ∧ (∃ x ∈ β, β.getLast h < x)) :
∀ ρ : List ℕ, ρ.Perm (List.range' 1 ρ.length) →
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist ρ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) →
(¬ ∀ k : ℕ, ∃ σ : List ℕ,
σ.Perm (List.range' 1 σ.length) ∧
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist σ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∧
σ.filter (· ≤ ρ.length) = ρ ∧ σ.length = ρ.length + k) →
∀ σ : List ℕ, σ.Perm (List.range' 1 σ.length) →
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist σ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) →
σ.filter (· ≤ ρ.length) = ρ →
σ.length - ρ.length ≤ (sSup (List.length '' B) - 1) ^ 2pocket_depth_uniform_bound_of_wqoIn LeanCombinatorics for TCS
Let B be a finite set of nonempty standard permutations of natural numbers from 1 to their length. If the class of standard B-avoiding permutations is partially well-ordered under the pattern containment relation (where σ contains π), then there exists a constant D : ℕ such that for every mortal standard B-avoiding permutation ρ (which does not have standard B-avoiding extensions of arbitrary depth), every standard B-avoiding extension σ of ρ (satisfying σ.filter (· ≤ ρ.length) = ρ) has depth σ.length - ρ.length ≤ D.
theorem pocket_depth_uniform_bound_of_wqo
(B : Set (List ℕ)) (hB_fin : B.Finite)
(hB_perm : ∀ β ∈ B, β.Perm (List.range' 1 β.length) ∧ β ≠ [])
(hwqo : Set.PartiallyWellOrderedOn
{π : List ℕ | π.Perm (List.range' 1 π.length) ∧ ∀ β ∈ B, ¬ pattern_contains π β}
(fun π σ => pattern_contains σ π)) :
∃ D : ℕ, ∀ ρ : List ℕ, ρ.Perm (List.range' 1 ρ.length) →
(∀ β ∈ B, ¬ pattern_contains ρ β) →
(¬ ∀ k : ℕ, ∃ σ : List ℕ,
σ.Perm (List.range' 1 σ.length) ∧
(∀ β ∈ B, ¬ pattern_contains σ β) ∧
σ.filter (· ≤ ρ.length) = ρ ∧ σ.length = ρ.length + k) →
∀ σ : List ℕ, σ.Perm (List.range' 1 σ.length) →
(∀ β ∈ B, ¬ pattern_contains σ β) →
σ.filter (· ≤ ρ.length) = ρ →
σ.length - ρ.length ≤ Dpocket_list_erdos_szekeresIn LeanCombinatorics for TCS
Erdős–Szekeres for a list of distinct natural numbers: if a list with no repeated entries has no strictly increasing sublist of length p and no strictly decreasing sublist of length q, then its length is at most (p-1)(q-1).
theorem pocket_list_erdos_szekeres (x : List ℕ) (p q : ℕ) (hnd : x.Nodup)
(hinc : ¬ ∃ s : List ℕ, s.Sublist x ∧ s.length = p ∧ s.Pairwise (· < ·))
(hdec : ¬ ∃ s : List ℕ, s.Sublist x ∧ s.length = q ∧ s.Pairwise (· > ·)) :
x.length ≤ (p - 1) * (q - 1)pocket_none_of_omitted_endpoint_max_typeIn LeanCombinatorics for TCS
Let B be a finite set of nonempty permutations of 1..|β|. If B contains no pattern whose maximum is leftmost, or contains no pattern whose maximum is rightmost, then every B-avoiding standard permutation ρ has B-avoiding standard extensions of every larger length obtained by inserting new maxima, whose small entries (those ≤ |ρ|) are exactly ρ.
theorem pocket_none_of_omitted_endpoint_max_type
(B : Set (List ℕ)) (hB_fin : B.Finite)
(hB_perm : ∀ β ∈ B, β.Perm (List.range' 1 β.length) ∧ β ≠ [])
(hL_or_R : (¬ ∃ β ∈ B, ∃ h : β ≠ [], ∀ x ∈ β, x ≤ β.head h) ∨
(¬ ∃ β ∈ B, ∃ h : β ≠ [], ∀ x ∈ β, x ≤ β.getLast h)) :
∀ ρ : List ℕ, ρ.Perm (List.range' 1 ρ.length) →
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist ρ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) →
∀ k : ℕ, ∃ σ : List ℕ,
σ.Perm (List.range' 1 σ.length) ∧
(∀ β ∈ B, ¬ ∃ s : List ℕ, s.Sublist σ ∧ ∃ h : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast h] < β[j.cast h]) ∧
σ.filter (· ≤ ρ.length) = ρ ∧ σ.length = ρ.length + kpocket_pattern_occurs_append_of_last_maxIn LeanCombinatorics for TCS
Let a be larger than every entry of τ. If the list τ ++ [a] contains an occurrence of β, then either τ already contains an occurrence of β, or β is nonempty and its maximum is its last entry.
theorem pocket_pattern_occurs_append_of_last_max {a : ℕ} {τ β : List ℕ} (ha : ∀ x ∈ τ, x < a)
(hocc : ∃ s : List ℕ, s.Sublist (τ ++ [a]) ∧ ∃ hlen : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast hlen] < β[j.cast hlen]) :
(∃ s : List ℕ, s.Sublist τ ∧ ∃ hlen : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast hlen] < β[j.cast hlen]) ∨
(∃ hβ : β ≠ [], ∀ x ∈ β, x ≤ β.getLast hβ)pocket_pattern_occurs_cons_of_head_maxIn LeanCombinatorics for TCS
Let a be larger than every entry of τ. If the list a :: τ contains an occurrence of β, then either τ already contains an occurrence of β, or β is nonempty and its maximum is its first entry.
theorem pocket_pattern_occurs_cons_of_head_max {a : ℕ} {τ β : List ℕ} (ha : ∀ x ∈ τ, x < a)
(hocc : ∃ s : List ℕ, s.Sublist (a :: τ) ∧ ∃ hlen : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast hlen] < β[j.cast hlen]) :
(∃ s : List ℕ, s.Sublist τ ∧ ∃ hlen : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast hlen] < β[j.cast hlen]) ∨
(∃ hβ : β ≠ [], ∀ x ∈ β, x ≤ β.head hβ)pocket_pattern_occurs_sublistIn LeanCombinatorics for TCS
If a list σ contains an occurrence of a pattern β (a sublist of σ that is order-isomorphic to β), and σ is a sublist of τ, then τ contains an occurrence of β.
theorem pocket_pattern_occurs_sublist {σ τ β : List ℕ} (hsub : σ.Sublist τ)
(hocc : ∃ s : List ℕ, s.Sublist σ ∧ ∃ hlen : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast hlen] < β[j.cast hlen]) :
∃ s : List ℕ, s.Sublist τ ∧ ∃ hlen : s.length = β.length,
∀ (i j : Fin s.length), s[i] < s[j] ↔ β[i.cast hlen] < β[j.cast hlen]pocket_prepend_max_rangeIn LeanCombinatorics for TCS
For a standard permutation ρ of 1..|ρ| and any k, the list (|ρ|+k, |ρ|+k-1, …, |ρ|+1) followed by ρ is again a standard permutation, filtering it by (· ≤ |ρ|) recovers ρ, and it has length |ρ| + k.
theorem pocket_prepend_max_range (ρ : List ℕ) (hρ : ρ.Perm (List.range' 1 ρ.length)) (k : ℕ) :
((List.range' (ρ.length + 1) k).reverse ++ ρ).Perm (List.range' 1 (ρ.length + k)) ∧
((List.range' (ρ.length + 1) k).reverse ++ ρ).filter (· ≤ ρ.length) = ρ ∧
((List.range' (ρ.length + 1) k).reverse ++ ρ).length = ρ.length + kpoly_interval_support_add_two_mulIn LeanCombinatorics for TCS
If p and q have interval coefficient support and their constant coefficients are positive, then p + 2*q has interval coefficient support.
theorem poly_interval_support_add_two_mul {p q : Polynomial ℕ}
(hp0 : 0 < p.coeff 0) (hq0 : 0 < q.coeff 0)
(hp : poly_interval_support p) (hq : poly_interval_support q) :
poly_interval_support (p + 2 * q)poly_log_concave_with_interval_support_mulIn LeanCombinatorics for TCS
If p and q have nonnegative integer coefficients with interval support and satisfy a_k * a_{k+2} ≤ a_{k+1}^2 at every index, then p * q does too.
theorem poly_log_concave_with_interval_support_mul {p q : Polynomial ℕ}
(hp : poly_log_concave_with_interval_support p)
(hq : poly_log_concave_with_interval_support q) :
poly_log_concave_with_interval_support (p * q)poly_log_concave_with_interval_support_witnessIn LeanCombinatorics for TCS
The polynomial 1 + X + X^2 is log-concave with interval support; 1 + X + 2X^2 is not log-concave with interval support; and 1 + X^2 does not have interval support.
theorem poly_log_concave_with_interval_support_witness :
poly_log_concave_with_interval_support ((1 : Polynomial ℕ) + Polynomial.X + Polynomial.X ^ 2) ∧
¬ poly_log_concave_with_interval_support
((1 : Polynomial ℕ) + Polynomial.X + 2 * Polynomial.X ^ 2) ∧
¬ poly_interval_support ((1 : Polynomial ℕ) + Polynomial.X ^ 2)polynomial_method_rank_cubic_bound_three_off_diagonalIn LeanCombinatorics for TCS
Let $K$ be a field and let $a, b, c \in K \setminus \{0\}$ be pairwise distinct. Every $n \times n$ $L$-matrix $M$ over $K$ with $L = \{a, b, c\}$ satisfies $6n \leq (\mathrm{rank}_K(M) + 3)^3$.
theorem polynomial_method_rank_cubic_bound_three_off_diagonal
{n : ℕ} {K : Type*} [Field K]
(a b c : K) (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0)
(hab : a ≠ b) (hbc : b ≠ c) (hca : a ≠ c)
(M : Matrix (Fin n) (Fin n) K)
(hM : is_l_matrix M {a, b, c}) :
6 * n ≤ (M.rank + 3) ^ 3polynomial_method_rank_lower_bound_three_off_diagonalIn LeanCombinatorics for TCS
Let $K$ be a field and let $a, b, c \in K \setminus \{0\}$ be pairwise distinct. Every $n \times n$ $L$-matrix $M$ over $K$ with $L = \{a, b, c\}$ satisfies $n \leq \binom{\mathrm{rank}_K(M) + 3}{3}$.
theorem polynomial_method_rank_lower_bound_three_off_diagonal
{n : ℕ} {K : Type*} [Field K]
(a b c : K) (ha : a ≠ 0) (hb : b ≠ 0) (hc : c ≠ 0)
(hab : a ≠ b) (hbc : b ≠ c) (hca : a ≠ c)
(M : Matrix (Fin n) (Fin n) K)
(hM : is_l_matrix M {a, b, c}) :
n ≤ Nat.choose (M.rank + 3) 3poset_braid_iso_induces_down_set_equivIn LeanCombinatorics for TCS
Let P and Q be finite non-empty posets with decidable orders. Any braid isomorphism e between their poset braid maps induces bijections α, β : P ≃ Q such that y ≤ x ↔ α y ≤ β x for all x, y.
theorem poset_braid_iso_induces_down_set_equiv {P Q : Type*} [PartialOrder P] [PartialOrder Q]
[Fintype P] [Fintype Q] [Nonempty P] [Nonempty Q]
[DecidableRel ((· ≤ ·) : P → P → Prop)] [DecidableRel ((· ≤ ·) : Q → Q → Prop)]
(e : (P ⊕ (P × ZMod 2)) ≃ (Q ⊕ (Q × ZMod 2)))
(h_iso : Prod.map e e ∘ poset_braid_map = poset_braid_map ∘ Prod.map e e) :
∃ (α β : P ≃ Q), ∀ y x, y ≤ x ↔ α y ≤ β xposet_braid_iso_preserves_tagsIn LeanCombinatorics for TCS
Let P and Q be finite non-empty posets with decidable orders. Any braid isomorphism e between their poset braid maps preserves the Sum.inl and Sum.inr components: e (.inl x) is left for all x in P, and e (.inr z) is right for all z in P × ZMod 2.
theorem poset_braid_iso_preserves_tags {P Q : Type*} [PartialOrder P] [PartialOrder Q]
[Fintype P] [Fintype Q] [Nonempty P] [Nonempty Q]
[DecidableRel ((· ≤ ·) : P → P → Prop)] [DecidableRel ((· ≤ ·) : Q → Q → Prop)]
(e : (P ⊕ (P × ZMod 2)) ≃ (Q ⊕ (Q × ZMod 2)))
(h_iso : Prod.map e e ∘ poset_braid_map = poset_braid_map ∘ Prod.map e e) :
(∀ x : P, (e (.inl x)).isLeft) ∧ (∀ z : P × ZMod 2, (e (.inr z)).isRight)poset_braid_map_fixed_iffIn LeanCombinatorics for TCS
For any poset P with decidable order, poset_braid_map fixes a pair (u, v) in (P ⊕ (P × ZMod 2))² if and only if u and v are either both in the left component or both in the right component.
theorem poset_braid_map_fixed_iff {P : Type*} [PartialOrder P]
[DecidableRel ((· ≤ ·) : P → P → Prop)]
(u v : P ⊕ (P × ZMod 2)) :
poset_braid_map (u, v) = (u, v) ↔ (u.isLeft ∧ v.isLeft) ∨ (u.isRight ∧ v.isRight)poset_comparable_count_delete_addIn LeanCombinatorics for TCS
For y ≠ x, the comparability count of y in P equals its comparability count in the card P − x plus one if x is comparable with y (and nothing otherwise): the neighbours of y other than x are exactly the points comparable with y inside P − x.
theorem poset_comparable_count_delete_add (P : Type) [Fintype P] [PartialOrder P] (x y : P) (hy : y ≠ x) : poset_comparable_count P y = poset_comparable_count {z : P // z ≠ x} ⟨y, hy⟩ + Nat.card {z : P // z = x ∧ (z < y ∨ y < z)}poset_comparable_count_eq_of_order_isoIn LeanCombinatorics for TCS
Comparability counts are preserved by order isomorphisms: if e : P ≃o Q then x has as many comparable partners in P as e x has in Q.
theorem poset_comparable_count_eq_of_order_iso (P Q : Type) [PartialOrder P] [PartialOrder Q] (e : P ≃o Q) (x : P) : poset_comparable_count P x = poset_comparable_count Q (e x)
poset_comparable_fibre_cardIn LeanCombinatorics for TCS
Write N_k for the number of points of P with k comparable partners, M_k for the same number inside the card P − x, E_k for the number of points comparable with x having k comparable partners in P, and δ_k for 1 if x itself has k partners. Then M_k + E_k + δ_k = N_k + E_{k+1}: deleting x lowers the count of each of its neighbours by exactly one, which is the whole content.
theorem poset_comparable_fibre_card (P : Type) [Fintype P] [PartialOrder P] (x : P) (k : ℕ) : Nat.card {y : {y : P // y ≠ x} // poset_comparable_count {y : P // y ≠ x} y = k} + Nat.card {y : P // (y < x ∨ x < y) ∧ poset_comparable_count P y = k} + Nat.card {y : P // y = x ∧ poset_comparable_count P y = k} = Nat.card {y : P // poset_comparable_count P y = k} + Nat.card {y : P // (y < x ∨ x < y) ∧ poset_comparable_count P y = k + 1}poset_height_eq_zero_iffIn LeanCombinatorics for TCS
A finite partial order α has height 0 if and only if it is an antichain: whenever a ≤ b, also b ≤ a.
theorem poset_height_eq_zero_iff {α : Type*} [PartialOrder α] [Fintype α] : poset_height α = 0 ↔ ∀ a b : α, a ≤ b → b ≤ aposet_height_one_exists_unique_min_ltIn LeanCombinatorics for TCS
If a height-one poset has exactly one minimal element u, then u < y for every y ≠ u: any other point y is non-minimal, so some z < y, and z is minimal by height one, so z = u.
theorem poset_height_one_exists_unique_min_lt (P : Type) [Fintype P] [PartialOrder P] (hP : poset_height_one P) (hmin : Nat.card {y : P // IsMin y} = 1) : ∃ u : P, IsMin u ∧ ∀ y : P, y ≠ u → u < yposet_height_one_min_max_dichotomyIn LeanCombinatorics for TCS
In a height-one poset in which nothing is isolated, every point is minimal-but-not-maximal or maximal-but-not-minimal; these two classes are the bipartition of the associated bipartite graph.
theorem poset_height_one_min_max_dichotomy (P : Type) [PartialOrder P] (hP : poset_height_one P) (hnil : ∀ x : P, ∃ y : P, x < y ∨ y < x) (x : P) : (IsMin x ∧ ¬ IsMax x) ∨ (IsMax x ∧ ¬ IsMin x)
poset_height_one_reconstructible_of_has_isolatedIn LeanCombinatorics for TCS
If finite ordered sets P, Q are hypomorphic, P has height one, |P| ≥ 4, and P has at least one isolated point, then P ≅ Q.
theorem poset_height_one_reconstructible_of_has_isolated (P Q : Type) [Fintype P] [Fintype Q] [PartialOrder P] [PartialOrder Q] (hn : 4 ≤ Fintype.card P) (hP : poset_height_one P) (hQ : poset_height_one Q) (h : poset_hypomorphic P Q) (hPiso : ∃ x : P, ∀ y : P, ¬ (x < y ∨ y < x)) : Nonempty (P ≃o Q)
poset_height_one_reconstructible_of_inj_comparable_count_of_sideIn LeanCombinatorics for TCS
If P, Q are hypomorphic height-one posets with |P| ≥ 4 and no isolated points, the comparability counts of P are pairwise distinct, and the deck correspondence σ maps minimal elements to minimal elements, then P ≅ Q.
theorem poset_height_one_reconstructible_of_inj_comparable_count_of_side (P Q : Type) [Fintype P] [Fintype Q] [PartialOrder P] [PartialOrder Q] (hn : 4 ≤ Fintype.card P) (hP : poset_height_one P) (hQ : poset_height_one Q) (σ : P ≃ Q) (hσ : ∀ x : P, Nonempty ({y : P // y ≠ x} ≃o {y : Q // y ≠ σ x})) (hPnil : ∀ x : P, ∃ y : P, x < y ∨ y < x) (hQnil : ∀ x : Q, ∃ y : Q, x < y ∨ y < x) (hinj : Function.Injective (poset_comparable_count P)) (hside : ∀ x : P, IsMin x ↔ IsMin (σ x)) : Nonempty (P ≃o Q)poset_height_one_reconstructible_of_min_card_oneIn LeanCombinatorics for TCS
If P, Q are hypomorphic height-one posets with |P| ≥ 4, no isolated points, and P has exactly one minimal element (so P is a star), then P ≅ Q.
theorem poset_height_one_reconstructible_of_min_card_one (P Q : Type) [Fintype P] [Fintype Q] [PartialOrder P] [PartialOrder Q] (hn : 4 ≤ Fintype.card P) (hP : poset_height_one P) (hQ : poset_height_one Q) (h : poset_hypomorphic P Q) (hPnil : ∀ x : P, ∃ y : P, x < y ∨ y < x) (hQnil : ∀ x : Q, ∃ y : Q, x < y ∨ y < x) (hmin : Nat.card {y : P // IsMin y} = 1) : Nonempty (P ≃o Q)poset_height_one_reconstructible_of_no_isolatedIn LeanCombinatorics for TCS
If finite ordered sets P, Q of height one, |P| ≥ 4, with every element of P and of Q comparable to something, have the same deck, then P ≅ Q. Equivalently: a bipartite graph with no isolated vertex is determined by the deck of vertex-deleted induced subgraphs.
theorem poset_height_one_reconstructible_of_no_isolated (P Q : Type) [Fintype P] [Fintype Q] [PartialOrder P] [PartialOrder Q] (hn : 4 ≤ Fintype.card P) (hP : poset_height_one P) (hQ : poset_height_one Q) (h : poset_hypomorphic P Q) (hPnil : ∀ x : P, ∃ y : P, x < y ∨ y < x) (hQnil : ∀ x : Q, ∃ y : Q, x < y ∨ y < x) : Nonempty (P ≃o Q)
poset_height_orderHomIn LeanCombinatorics for TCS
For finite partial orders X and Y, the height of the poset (Y →o X) of order-preserving maps with the pointwise order is |Y| · height(X).
theorem poset_height_orderHom {α β : Type*} [PartialOrder α] [Fintype α] [PartialOrder β] [Fintype β] : poset_height (β →o α) = Nat.card β * poset_height αposet_height_prod_of_nonemptyIn LeanCombinatorics for TCS
For finite nonempty partial orders X and Y, the height of the product order X × Y is height(X) + height(Y).
theorem poset_height_prod_of_nonempty {α β : Type*} [PartialOrder α] [Fintype α] [Nonempty α] [PartialOrder β] [Fintype β] [Nonempty β] : poset_height (α × β) = poset_height α + poset_height βposet_hypomorphic_comparable_count_eqIn LeanCombinatorics for TCS
If σ is a bijection matching the cards of P and Q (P − x ≅ Q − σ x for every x) and |P| ≥ 3, then x has as many comparable partners in P as σ x has in Q.
theorem poset_hypomorphic_comparable_count_eq (P Q : Type) [Fintype P] [Fintype Q] [PartialOrder P] [PartialOrder Q] (hn : 3 ≤ Fintype.card P) (σ : P ≃ Q) (hσ : ∀ x : P, Nonempty ({y : P // y ≠ x} ≃o {y : Q // y ≠ σ x})) (x : P) : poset_comparable_count P x = poset_comparable_count Q (σ x)poset_hypomorphic_comparable_fibre_eqIn LeanCombinatorics for TCS
If P, Q are hypomorphic (σ matching cards), |P| ≥ 3, and no point of P or Q is isolated, then for every k the same number of points of P and of Q have exactly k comparable partners: the deck determines the degree multiset.
theorem poset_hypomorphic_comparable_fibre_eq (P Q : Type) [Fintype P] [Fintype Q] [PartialOrder P] [PartialOrder Q] (hn : 3 ≤ Fintype.card P) (σ : P ≃ Q) (hσ : ∀ x : P, Nonempty ({y : P // y ≠ x} ≃o {y : Q // y ≠ σ x})) (hPnil : ∀ x : P, ∃ y : P, x < y ∨ y < x) (hQnil : ∀ x : Q, ∃ y : Q, x < y ∨ y < x) : ∀ k : ℕ, Nat.card {y : P // poset_comparable_count P y = k} = Nat.card {z : Q // poset_comparable_count Q z = k}poset_hypomorphic_comparable_iff_of_inj_comparable_countIn LeanCombinatorics for TCS
If no two points of P have the same comparability count and σ matches the cards, then x and y are comparable in P exactly when σ x and σ y are comparable in Q.
theorem poset_hypomorphic_comparable_iff_of_inj_comparable_count (P Q : Type) [Fintype P] [Fintype Q] [PartialOrder P] [PartialOrder Q] (hn : 3 ≤ Fintype.card P) (σ : P ≃ Q) (hσ : ∀ x : P, Nonempty ({y : P // y ≠ x} ≃o {y : Q // y ≠ σ x})) (hPnil : ∀ x : P, ∃ y : P, x < y ∨ y < x) (hQnil : ∀ x : Q, ∃ y : Q, x < y ∨ y < x) (hinj : Function.Injective (poset_comparable_count P)) (x y : P) : (x < y ∨ y < x) ↔ (σ x < σ y ∨ σ y < σ x)poset_hypomorphic_neighbour_profile_eqIn LeanCombinatorics for TCS
If P, Q are hypomorphic height-one posets with |P| ≥ 3 and no isolated points, then for every x and k the number of neighbours of x in P having exactly k comparable partners equals the corresponding number for σ x in Q.
theorem poset_hypomorphic_neighbour_profile_eq (P Q : Type) [Fintype P] [Fintype Q] [PartialOrder P] [PartialOrder Q] (hn : 3 ≤ Fintype.card P) (σ : P ≃ Q) (hσ : ∀ x : P, Nonempty ({y : P // y ≠ x} ≃o {y : Q // y ≠ σ x})) (hPnil : ∀ x : P, ∃ y : P, x < y ∨ y < x) (hQnil : ∀ x : Q, ∃ y : Q, x < y ∨ y < x) (x : P) (k : ℕ) : Nat.card {y : P // (y < x ∨ x < y) ∧ poset_comparable_count P y = k} = Nat.card {z : Q // (z < σ x ∨ σ x < z) ∧ poset_comparable_count Q z = k}poset_j_card_finIn LeanCombinatorics for TCS
The chain Fin (n+1) has exactly n elements with a unique lower cover (namely 1, …, n, whose unique lower cover is k−1).
theorem poset_j_card_fin (n : ℕ) : Nat.card (poset_j (Fin (n+1))) = n
poset_j_orderHom_isoIn LeanCombinatorics for TCS
Let B be a finite bounded partial order (bottom ⊥, top ⊤) and Y a finite partial order. The elements of the pointwise-ordered poset (Y →o B) of order-preserving maps that have exactly one lower cover are exactly the maps f_{j,y} which take the value j on the up-set ↑y and ⊥ elsewhere, for j ∈ J(B) and y ∈ Y. Consequently J(B^Y) is order-isomorphic to J(B) × Y^∂, where Y^∂ is the order dual of Y.
theorem poset_j_orderHom_iso {α β : Type*} [PartialOrder α] [Fintype α] [OrderBot α] [OrderTop α] [PartialOrder β] [Fintype β] : Nonempty (poset_j (β →o α) ≃o (poset_j α × βᵒᵈ))poset_lt_pair_count_deleteIn LeanCombinatorics for TCS
The number of comparable pairs of P equals the number of comparable pairs of the card P − x plus the comparability count of x: the pairs through x are indexed by the points comparable with x, one pair each.
theorem poset_lt_pair_count_delete (P : Type) [Fintype P] [PartialOrder P] (x : P) : poset_lt_pair_count P = poset_lt_pair_count {y : P // y ≠ x} + poset_comparable_count P xposet_min_max_card_eq_of_order_isoIn LeanCombinatorics for TCS
An order isomorphism maps minimal elements to minimal elements and maximal elements to maximal elements, so it preserves both counts.
theorem poset_min_max_card_eq_of_order_iso (P Q : Type) [PartialOrder P] [PartialOrder Q] (e : P ≃o Q) : Nat.card {y : P // IsMin y} = Nat.card {z : Q // IsMin z} ∧ Nat.card {y : P // IsMax y} = Nat.card {z : Q // IsMax z}poset_order_iso_of_side_and_comparableIn LeanCombinatorics for TCS
Let P, Q be height-one posets and σ : P ≃ Q a bijection that preserves the side of every point and preserves comparability. Then σ is an order isomorphism; consequently P ≅ Q. This isolates the two hypotheses that a reconstruction proof must supply.
theorem poset_order_iso_of_side_and_comparable (P Q : Type) [PartialOrder P] [PartialOrder Q] (hP : poset_height_one P) (hQ : poset_height_one Q) (σ : P ≃ Q) (hside : ∀ x : P, IsMin x ↔ IsMin (σ x)) (hcmp : ∀ x y : P, (x < y ∨ y < x) ↔ (σ x < σ y ∨ σ y < σ x)) : Nonempty (P ≃o Q)
poset_sum_neighbour_fibre_cardIn LeanCombinatorics for TCS
Σ_x #{y comparable with x : comp(y) = k} = k · #{y : comp(y) = k}: both sides count the pairs (x, y) with x comparable with y and comp(y) = k, using the symmetry of comparability and the definition of comp.
theorem poset_sum_neighbour_fibre_card (P : Type) [Fintype P] [PartialOrder P] (k : ℕ) : (∑ x : P, Nat.card {y : P // (y < x ∨ x < y) ∧ poset_comparable_count P y = k}) = k * Nat.card {y : P // poset_comparable_count P y = k}prime_order_cycles_partition_into_perfect_setsIn LeanCombinatorics for TCS
Let p be a prime number. The set of all permutations of Fin p of order p can be partitioned into (p - 2)! pairwise disjoint sets of size p - 1, each of which is a perfect set of order p, satisfies the regular action property that for any distinct elements i and j there is a unique permutation in the set mapping i to j, and whose union is the set of all permutations of order p.
open Equiv Perm Subgroup in
theorem prime_order_cycles_partition_into_perfect_sets (p : ℕ) (hp : p.Prime) :
∃ P : Finset (Finset (Perm (Fin p))),
P.card = Nat.factorial (p - 2) ∧
(∀ S ∈ P, S.card = p - 1) ∧
(∀ S ∈ P, is_perfect_set p S) ∧
(∀ S ∈ P, ∀ i j : Fin p, i ≠ j → ∃! τ ∈ S, τ i = j) ∧
(∀ S ∈ P, ∀ T ∈ P, S ≠ T → Disjoint S T) ∧
P.biUnion id = Finset.univ.filter (fun σ => orderOf σ = p)prime_two_pow_sub_two_div_mulIn LeanCombinatorics for TCS
For any prime n ≥ 3, n divides 2^n - 2 by Fermat's Little Theorem, so ((2^n - 2) / n) * n = 2^n - 2.
theorem prime_two_pow_sub_two_div_mul (n : ℕ) (hn : n.Prime) (hge : 3 ≤ n) :
((2 ^ n - 2) / n) * n = 2 ^ n - 2pyramid_polytope_apices_subsetIn LeanCombinatorics for TCS
Given natural numbers n and m, a subset B of Fin n → ℝ, and a family of vertices v : Fin (m + 1) → (Fin m → ℝ), the apices {(0, v_1), ..., (0, v_m)} form a subset of the pyramid polytope pyramid_polytope B v in Fin (n + m) → ℝ.
theorem pyramid_polytope_apices_subset {n m : ℕ} (B : Set (Fin n → ℝ))
(v : Fin (m + 1) → (Fin m → ℝ)) :
Set.range (fun j : Fin m => Fin.append 0 (v j.succ)) ⊆ pyramid_polytope B vq_perm_counterexample_matrix_eval_14_gt_15In LeanCombinatorics for TCS
The q-permanent of the 5-by-5 integer counterexample matrix evaluates to 8968822249 at q = 14, evaluates to 7441960000 at q = 15, and its value at q = 14 is strictly greater than its value at q = 15.
theorem q_perm_counterexample_matrix_eval_14_gt_15 :
matrix_q_permanent 14 q_perm_counterexample_matrix = 8968822249 ∧
matrix_q_permanent 15 q_perm_counterexample_matrix = 7441960000 ∧
matrix_q_permanent 14 q_perm_counterexample_matrix >
matrix_q_permanent 15 q_perm_counterexample_matrixq_perm_counterexample_matrix_is_symmIn LeanCombinatorics for TCS
The 5-by-5 counterexample matrix is symmetric.
theorem q_perm_counterexample_matrix_is_symm :
q_perm_counterexample_matrix.IsSymmq_perm_counterexample_matrix_pos_defIn LeanCombinatorics for TCS
The 5-by-5 counterexample matrix is positive definite as a real matrix.
theorem q_perm_counterexample_matrix_pos_def :
(q_perm_counterexample_matrix.map (algebraMap ℤ ℝ)).PosDefquadratic_decomposition_nonnegative_linearizationIn LeanCombinatorics for TCS
Let N ≥ 2, and let a, c : Fin (2 * N + 1) → ℝ satisfy condition (2.1) of size 2N with b = fun _ => 0. Then (even_component_a N a, even_component_b N a c, even_component_c N a c) satisfies condition (2.1) of size N, (odd_component_a N a, odd_component_b N a c, odd_component_c N a c) satisfies condition (2.1) of size N - 1, and if both components have nonnegative linearization (property P), then the symmetric array (a, fun _ => 0, c) has nonnegative linearization (property P) of size 2N.
theorem quadratic_decomposition_nonnegative_linearization
(N : ℕ) (hN : 2 ≤ N) (a c : Fin (2 * N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 (2 * N) a (fun _ => 0) c) :
satisfies_recurrence_2_1 N (even_component_a N a) (even_component_b N a c) (even_component_c N a c) ∧
satisfies_recurrence_2_1 (N - 1) (odd_component_a N a) (odd_component_b N a c) (odd_component_c N a c) ∧
(has_property_p N (even_component_a N a) (even_component_b N a c) (even_component_c N a c) →
has_property_p (N - 1) (odd_component_a N a) (odd_component_b N a c) (odd_component_c N a c) →
has_property_p (2 * N) a (fun _ => 0) c)quaternion_group_central_involutionIn LeanCombinatorics for TCS
For N ≥ 1, the element a^N of QuaternionGroup N is central, has square 1, and is not the identity, so it is the (unique) central involution; consequently every cell of the quaternion table has a scale-4 clique {(g,h),(g,hz),(gz,h),(gz,hz)} around it and the chromatic number of the table is at least |G|... (the quantitative form is the existing lower bound node).
theorem quaternion_group_central_involution (N : ℕ) (hN : 1 ≤ N) :
(∀ g : QuaternionGroup N,
QuaternionGroup.a ((N : ℕ) : ZMod (2 * N)) * g =
g * QuaternionGroup.a ((N : ℕ) : ZMod (2 * N))) ∧
QuaternionGroup.a ((N : ℕ) : ZMod (2 * N)) *
QuaternionGroup.a ((N : ℕ) : ZMod (2 * N)) = 1 ∧
QuaternionGroup.a ((N : ℕ) : ZMod (2 * N)) ≠ 1r_ext_c4_is_config_in_all_productsIn LeanCombinatorics for TCS
For any r >= 4, the boolean incidence matrix of the r-extension of C4 embeds as a configuration in every r-fold product of matrices from {I_m, I_m^c, T_m} for all sufficiently large m.
theorem r_ext_c4_is_config_in_all_products (r : ℕ) (hr : 4 ≤ r) :
is_config_in_all_products (r_ext_c4_matrix r) rr_ext_c4_matrix_col0_trueIn LeanCombinatorics for TCS
For any r >= 4 and any row index k < r, the entry at row k and column 0 of the incidence matrix of the r-extension of C4 is true.
theorem r_ext_c4_matrix_col0_true (r : ℕ) (hr : 4 ≤ r) (k : ℕ) (hk : k < r) :
r_ext_c4_matrix r ⟨k, by omega⟩ ⟨0, by omega⟩ = truer_ext_c4_product_invariantIn LeanCombinatorics for TCS
For any natural number r at least 4, the product invariant matrix_product_invariant of the boolean incidence matrix r_ext_c4_matrix r of the r-extension of the 4-cycle graph equals r.
theorem r_ext_c4_product_invariant (r : ℕ) (hr : 4 ≤ r) :
matrix_product_invariant (r_ext_c4_matrix r) = rr_ext_c4_product_invariant_geIn LeanCombinatorics for TCS
If the incidence matrix of the r-extension of C4 embeds as a configuration in all p-fold products of matrices from {I_m, I_m^c, T_m}, then r <= p.
theorem r_ext_c4_product_invariant_ge (r : ℕ) (hr : 4 ≤ r) (p : ℕ) (hp : 1 ≤ p)
(h : is_config_in_all_products (r_ext_c4_matrix r) p) : r ≤ pradial_certificate_hypotheses_not_vacuousIn LeanCombinatorics for TCS
The hA hypothesis of the radial transfer lemma is satisfiable (take S = Set.univ: every point lies in S), but the hB hypothesis is not implied by hA, since for S = Set.univ no point is outside S and hence the hB condition fails for any α. So hA and hB together are a genuine two-sided constraint and the existence statements for α = 1/2, 1/3 are not vacuous.
theorem radial_certificate_hypotheses_not_vacuous (α : ℝ) :
(∀ a c : ℝ, 0 ≤ a →
a + c ^ 2 ∈ (Set.univ : Set ℝ) ∨ a + (c + 1) ^ 2 ∈ Set.univ ∨ a + (c + 2) ^ 2 ∈ Set.univ) ∧
¬ (∀ a c : ℝ, 0 ≤ a → ∃ k : Fin 21, a + (c + (k : ℝ) * α) ^ 2 ∉ (Set.univ : Set ℝ))radial_hA_forces_no_complement_gap_one_or_twoIn LeanCombinatorics for TCS
Necessary conditions on a radial certificate. If S satisfies the hA condition (for every a ≥ 0 and every c, one of a + c², a + (c+1)², a + (c+2)² lies in S), then (i) for every v ≥ 0 one of v, v+1, v+4 lies in S — so the complement of S contains no two points at distance 1 in [0,∞) — and (ii) for every v ≥ 1/4 one of v, v+2 lies in S — so the complement of S contains no two points at distance 2 in [1/4,∞).
theorem radial_hA_forces_no_complement_gap_one_or_two (S : Set ℝ)
(hA : ∀ a c : ℝ, 0 ≤ a → a + c ^ 2 ∈ S ∨ a + (c + 1) ^ 2 ∈ S ∨ a + (c + 2) ^ 2 ∈ S) :
(∀ v : ℝ, 0 ≤ v → v ∈ S ∨ v + 1 ∈ S ∨ v + 4 ∈ S) ∧
(∀ v : ℝ, 1 / 4 ≤ v → v ∈ S ∨ v + 2 ∈ S)ramsey_254_seidel_iff_codegreeIn LeanCombinatorics for TCS
For any simple graph G on 254 vertices with decidable adjacency, the two Seidel conditions (all row sums of the Seidel matrix equal 1, and (S^2)_{ij} ≤ 0 for all i ≠ j) hold if and only if G is 126-regular, every adjacent pair has at most 62 common neighbours, and every pair of distinct non-adjacent vertices has at most 63 common neighbours in the complement graph.
theorem ramsey_254_seidel_iff_codegree
(G : SimpleGraph (Fin 254)) [DecidableRel G.Adj] :
((∀ i : Fin 254, ∑ j : Fin 254, seidel_matrix G i j = 1) ∧
(∀ i j : Fin 254, i ≠ j → (seidel_matrix G * seidel_matrix G) i j ≤ 0)) ↔
((∀ i : Fin 254, Fintype.card (G.neighborSet i) = 126) ∧
(∀ u v : Fin 254, G.Adj u v → Fintype.card (G.commonNeighbors u v) ≤ 62) ∧
(∀ u v : Fin 254, u ≠ v → ¬ G.Adj u v → Fintype.card (Gᶜ.commonNeighbors u v) ≤ 63))ramsey_254_seidel_row_sum_iff_regularIn LeanCombinatorics for TCS
For a simple graph G on 254 vertices with decidable adjacency, all row sums of the Seidel matrix are equal to 1 if and only if every vertex of G has exactly 126 neighbours. In particular the Seidel condition of the target already forces 126-regularity, so no hypothesis is lost when passing to the 126-regular case.
theorem ramsey_254_seidel_row_sum_iff_regular
(G : SimpleGraph (Fin 254)) [DecidableRel G.Adj] :
(∀ i : Fin 254, ∑ j : Fin 254, seidel_matrix G i j = 1) ↔
(∀ i : Fin 254, Fintype.card (G.neighborSet i) = 126)ramsey_b63_b64_regular_codegree_graph_existsIn LeanCombinatorics for TCS
There exists a simple graph G on 254 vertices with decidable adjacency that is 126-regular, in which every adjacent pair has at most 62 common neighbours and every pair of distinct non-adjacent vertices has at most 63 common neighbours in the complement graph. Together with ramsey_254_seidel_iff_codegree this is exactly the parent statement (existence of a Seidel-conditioned graph on 254 vertices), written as a construction of an explicit 126-regular (B_63, B_64)-free graph; it is strictly stronger than op_605_ramsey_b63_b64_graph_exists (which does not require regularity) and it is the literature's open case n = 64, OP-605 of arXiv:2610.36522.
theorem ramsey_b63_b64_regular_codegree_graph_exists :
∃ (G : SimpleGraph (Fin 254)) (_ : DecidableRel G.Adj),
(∀ i : Fin 254, Fintype.card (G.neighborSet i) = 126) ∧
(∀ u v : Fin 254, G.Adj u v → Fintype.card (G.commonNeighbors u v) ≤ 62) ∧
(∀ u v : Fin 254, u ≠ v → ¬ G.Adj u v → Fintype.card (Gᶜ.commonNeighbors u v) ≤ 63)ramsey_b63_b64_seidel_graph_existsIn LeanCombinatorics for TCS
There exists a simple graph G on 254 vertices with decidable adjacency whose Seidel matrix S has all row sums equal to 1 and (S^2)_{ij} ≤ 0 for all distinct vertices i ≠ j.
theorem ramsey_b63_b64_seidel_graph_exists :
∃ (G : SimpleGraph (Fin 254)) (_ : DecidableRel G.Adj),
(∀ i : Fin 254, ∑ j : Fin 254, seidel_matrix G i j = 1) ∧
(∀ i j : Fin 254, i ≠ j → (seidel_matrix G * seidel_matrix G) i j ≤ 0)recurrence_matrix_distinct_real_eigenvaluesIn LeanCombinatorics for TCS
For any recurrence satisfying (2.1), the tridiagonal recurrence matrix J has N + 1 distinct real eigenvalues.
theorem recurrence_matrix_distinct_real_eigenvalues (N : ℕ) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) :
∃ S : Finset ℝ, S.card = N + 1 ∧
∀ x ∈ S, Module.End.HasEigenvalue (Matrix.toLin' (recurrence_matrix N a b c)) xrecurrence_matrix_eigenvectors_proportionalIn LeanCombinatorics for TCS
If v and v' are both eigenvectors of the recurrence matrix J for the same eigenvalue x (J v = x • v, J v' = x • v') and v is nonzero, then v' is a scalar multiple of v, namely v' = (v' 0 / v 0) • v. Hence every eigenspace of J is at most one dimensional.
theorem recurrence_matrix_eigenvectors_proportional (N : ℕ) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) (x : ℝ) (v v' : Fin (N + 1) → ℝ)
(hv : Matrix.mulVec (recurrence_matrix N a b c) v = x • v)
(hv' : Matrix.mulVec (recurrence_matrix N a b c) v' = x • v')
(hne : v ≠ 0) :
v' = (v' 0 / v 0) • vrecurrence_matrix_frame_weight_normalizationIn LeanCombinatorics for TCS
If the vectors u y are orthonormal (∑_y u y i * u y j = δ_ij) and π > 0, then the rescaled vectors i ↦ u y i / sqrt(π i) are orthonormal for the weight π: ∑_y π i * (u y i / sqrt(π i)) * (u y j / sqrt(π j)) = δ_ij.
theorem recurrence_matrix_frame_weight_normalization (N : ℕ) (π : Fin (N + 1) → ℝ)
(hπ : ∀ i, 0 < π i) (u : Fin (N + 1) → Fin (N + 1) → ℝ)
(horth : ∀ i j : Fin (N + 1), ∑ y, u y i * u y j = if i = j then 1 else 0)
(i j : Fin (N + 1)) :
∑ y, π i * (u y i / Real.sqrt (π i)) * (u y j / Real.sqrt (π j))
= if i = j then 1 else 0recurrence_matrix_hermitian_eigenframeIn LeanCombinatorics for TCS
Let π be a positive function with π_i * J_ij = π_j * J_ji. Then there are N+1 real numbers eig y, pairwise distinct, and a real matrix u with orthonormal rows (∑_y u y i * u y j = δ_ij and ∑_i u y i^2 = 1) such that for each y the vector v_i = u y i / sqrt(π i) is an eigenvector of J with eigenvalue eig y: J v = eig y • v.
theorem recurrence_matrix_hermitian_eigenframe (N : ℕ) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) (π : Fin (N + 1) → ℝ) (hπ : ∀ i, 0 < π i)
(hsym : ∀ i j : Fin (N + 1), π i * recurrence_matrix N a b c i j
= π j * recurrence_matrix N a b c j i) :
∃ (eig : Fin (N + 1) → ℝ) (u : Fin (N + 1) → Fin (N + 1) → ℝ),
(∀ y, Matrix.mulVec (recurrence_matrix N a b c) (fun i => u y i / Real.sqrt (π i))
= eig y • (fun i => u y i / Real.sqrt (π i))) ∧
(∀ i j : Fin (N + 1), ∑ y, u y i * u y j = if i = j then 1 else 0) ∧
(∀ y, ∑ i, u y i * u y i = 1)recurrence_matrix_spectral_frameIn LeanCombinatorics for TCS
If π is positive with π_i * J_ij = π_j * J_ji, then there are N+1 pairwise distinct real numbers x (forming a Finset S of cardinality N+1) and a nonzero eigenvector v x of J for each x, such that the frame is π-orthonormal: ∑_{x∈S} π_i * (v x)_i * (v x)_j = δ_ij for all i, j.
theorem recurrence_matrix_spectral_frame (N : ℕ) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) (π : Fin (N + 1) → ℝ) (hπ : ∀ i, 0 < π i)
(hsym : ∀ i j : Fin (N + 1), π i * recurrence_matrix N a b c i j
= π j * recurrence_matrix N a b c j i) :
∃ (S : Finset ℝ) (v : ℝ → Fin (N + 1) → ℝ), S.card = N + 1 ∧
(∀ x ∈ S, Matrix.mulVec (recurrence_matrix N a b c) (v x) = x • v x) ∧
(∀ x ∈ S, v x ≠ 0) ∧
(∀ i j : Fin (N + 1), ∑ x ∈ S, π i * v x i * v x j = if i = j then 1 else 0)recurrence_poly_aeval_mulVec_single_eq_smul_singleIn LeanCombinatorics for TCS
For m ≤ N, the recurrence polynomial R_m applied to J sends the 0-th basis vector e_0 to a nonzero scalar multiple of the m-th basis vector: R_m(J) e_0 = λ e_m with λ ≠ 0. In particular the 0-th column of R_m(J) is supported exactly at row m.
theorem recurrence_poly_aeval_mulVec_single_eq_smul_single (N : ℕ) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) (m : Fin (N + 1)) :
∃ lam : ℝ, lam ≠ 0 ∧
Matrix.mulVec ((Polynomial.aeval (recurrence_matrix N a b c))
(recurrence_poly N a b c m.val)) (Pi.single (0 : Fin (N + 1)) 1)
= lam • Pi.single m 1recurrence_poly_eigenvector_componentsIn LeanCombinatorics for TCS
If v is an eigenvector of the recurrence matrix J with eigenvalue x (i.e. J v = x • v), then every component of v is the 0-th component times a recurrence polynomial: v i = v 0 * R_i(x), where R_n = recurrence_poly N a b c n.
theorem recurrence_poly_eigenvector_components (N : ℕ) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) (x : ℝ) (v : Fin (N + 1) → ℝ)
(hv : Matrix.mulVec (recurrence_matrix N a b c) v = x • v) (i : Fin (N + 1)) :
v i = v 0 * Polynomial.eval x (recurrence_poly N a b c i.val)recurrence_potential_weights_symmetryIn LeanCombinatorics for TCS
Let a, b, c satisfy (2.1) and let π_i = ∏_{j<i} a_j / c_{j+1} be the potential weights. Then the tridiagonal recurrence matrix J is self-adjoint for π: π_i * J_ij = π_j * J_ji for all i, j : Fin (N+1).
theorem recurrence_potential_weights_symmetry (N : ℕ) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) (i j : Fin (N + 1)) :
recurrence_potential_weights N a c i * recurrence_matrix N a b c i j
= recurrence_potential_weights N a c j * recurrence_matrix N a b c j ireduced_latin_square_to_perfect_set_memIn LeanCombinatorics for TCS
For every natural number n with n ≥ 2 and every array R : Fin n → Fin n → Fin n that is a reduced Latin square, the finite set reduced_latin_square_to_perfect_set R is a perfect set of order n.
theorem reduced_latin_square_to_perfect_set_mem (n : ℕ) [NeZero n] (hn : 2 ≤ n)
(R : Fin n → Fin n → Fin n) (hR : is_reduced_latin_square R) :
is_perfect_set n (reduced_latin_square_to_perfect_set R)regular_action_punctured_zpowersIn LeanCombinatorics for TCS
Let p be a prime and σ be a permutation of Fin p of order p. For any distinct elements i and j in Fin p, there is a unique non-identity element in the cyclic subgroup generated by σ mapping i to j.
open Equiv Perm Subgroup in
theorem regular_action_punctured_zpowers {p : ℕ} (hp : p.Prime) {σ : Perm (Fin p)}
(hσ : orderOf σ = p) {i j : Fin p} (hij : i ≠ j) :
∃! τ : Perm (Fin p), τ ∈ zpowers σ ∧ τ ≠ 1 ∧ τ i = jregular_four_degree_le_threeIn LeanCombinatorics for TCS
A simple graph on ZMod 4 that is regular of degree d satisfies d ≤ 3.
theorem regular_four_degree_le_three (G : SimpleGraph (ZMod 4)) [DecidableRel G.Adj]
(d : ℕ) (h : G.IsRegularOfDegree d) : d ≤ 3regular_four_degree_one_circulantIn LeanCombinatorics for TCS
A simple graph on ZMod 4 that is 1-regular (a perfect matching) is a circulant graph on ZMod 4: it is isomorphic to the circulant graph with jump set {2}.
theorem regular_four_degree_one_circulant (G : SimpleGraph (ZMod 4)) [DecidableRel G.Adj]
(h : G.IsRegularOfDegree 1) : is_circulant_graph 4 Gregular_four_degree_three_circulantIn LeanCombinatorics for TCS
A simple graph on ZMod 4 that is 3-regular is the complete graph K4, which is the circulant graph on ZMod 4 with jump set {1,2,3}, hence a circulant graph.
theorem regular_four_degree_three_circulant (G : SimpleGraph (ZMod 4)) [DecidableRel G.Adj]
(h : G.IsRegularOfDegree 3) : is_circulant_graph 4 Gregular_four_degree_two_circulantIn LeanCombinatorics for TCS
A simple graph on ZMod 4 that is 2-regular (a 4-cycle together with possibly its complement, i.e. C4) is a circulant graph on ZMod 4: it is isomorphic to the circulant graph with jump set {1}.
theorem regular_four_degree_two_circulant (G : SimpleGraph (ZMod 4)) [DecidableRel G.Adj]
(h : G.IsRegularOfDegree 2) : is_circulant_graph 4 Gregular_graph_four_vertex_circulantIn LeanCombinatorics for TCS
Every regular simple graph on ZMod 4 of positive degree is a circulant graph on ZMod 4.
theorem regular_graph_four_vertex_circulant (G : SimpleGraph (ZMod 4)) [DecidableRel G.Adj]
(d : ℕ) (hd : 1 ≤ d) (h : G.IsRegularOfDegree d) : is_circulant_graph 4 Gregular_sequence_additive_basis_c3_cn3_of_card_geIn LeanCombinatorics for TCS
For n ≥ 5 with (3n).minFac = 3 and ¬ 3 ∣ n, every regular sequence of cardinality at least ⌈(16 * 3n - 12)/5⌉ over C_3 × C_{3n} is an additive basis.
theorem regular_sequence_additive_basis_c3_cn3_of_card_ge (n : ℕ) (hn : 5 ≤ n) (hmin : (3 * n).minFac = 3) (hndvd : ¬ 3 ∣ n) (S : Multiset (ZMod 3 × ZMod (n * 3))) (hreg : IsRegularSequence S) (hcard : Nat.ceil ((16 * (n * 3 : ℝ) - 12) / 5) ≤ S.card) : IsAdditiveBasis S
regular_sequence_additive_basis_c3_cn3_of_not_dvdIn LeanCombinatorics for TCS
For n ≥ 2 with (3 * n).minFac = 3 and ¬ 3 ∣ n, every regular sequence of cardinality ⌈(16 * 3n - 12)/5⌉ over (ZMod 3) × (ZMod (n * 3)) is an additive basis.
theorem regular_sequence_additive_basis_c3_cn3_of_not_dvd (n : ℕ) (hn : 2 ≤ n) (hmin : (3 * n).minFac = 3) (hndvd : ¬ 3 ∣ n) (S : Multiset (ZMod 3 × ZMod (n * 3))) (hreg : IsRegularSequence S) (hcard : S.card = Nat.ceil ((16 * (n * 3 : ℝ) - 12) / 5)) : IsAdditiveBasis S
regular_sequence_additive_basis_cp_cnpIn LeanCombinatorics for TCS
For p ≥ 3 prime and n ≥ 2 with (np).minFac = p and p ∤ n, every regular sequence of cardinality ⌈(4np-2)/3⌉ over (ZMod p) × (ZMod (np)) is an additive basis.
theorem regular_sequence_additive_basis_cp_cnp (p : ℕ) (hp : p.Prime) (hp3 : 3 ≤ p) (n : ℕ) (hn : 2 ≤ n) (hmin : (n * p).minFac = p) (hndvd : ¬ p ∣ n) (S : Multiset (ZMod p × ZMod (n * p))) (hreg : IsRegularSequence S) (hcard : S.card = Nat.ceil ((4 * (n * p : ℝ) - 2) / 3)) : IsAdditiveBasis S
regular_sequence_additive_basis_cp_cnp_of_card_geIn LeanCombinatorics for TCS
For p ≥ 3 prime and n ≥ 5 with (np).minFac = p and p ∤ n, every regular sequence of cardinality at least ⌈(4np-2)/3⌉ over (ZMod p) × (ZMod (np)) is an additive basis.
theorem regular_sequence_additive_basis_cp_cnp_of_card_ge (p : ℕ) (hp : p.Prime) (hp3 : 3 ≤ p) (n : ℕ) (hn : 5 ≤ n) (hmin : (n * p).minFac = p) (hndvd : ¬ p ∣ n) (S : Multiset (ZMod p × ZMod (n * p))) (hreg : IsRegularSequence S) (hcard : Nat.ceil ((4 * (n * p : ℝ) - 2) / 3) ≤ S.card) : IsAdditiveBasis S
regular_sequence_additive_basis_cp_cnp_of_dvdIn LeanCombinatorics for TCS
For p ≥ 3 prime and n ≥ 2 with (np).minFac = p and p ∣ n, every regular sequence of cardinality ⌈(4np-2)/3⌉ over (ZMod p) × (ZMod (np)) is an additive basis.
theorem regular_sequence_additive_basis_cp_cnp_of_dvd (p : ℕ) (hp : p.Prime) (hp3 : 3 ≤ p) (n : ℕ) (hn : 2 ≤ n) (hmin : (n * p).minFac = p) (hdvd : p ∣ n) (S : Multiset (ZMod p × ZMod (n * p))) (hreg : IsRegularSequence S) (hcard : S.card = Nat.ceil ((4 * (n * p : ℝ) - 2) / 3)) : IsAdditiveBasis S
regular_sequence_additive_basis_cp_cnp_of_dvd_of_card_geIn LeanCombinatorics for TCS
For p ≥ 3 prime and p ≤ n with (np).minFac = p and p ∣ n, every regular sequence of cardinality at least ⌈(4np-2)/3⌉ over (ZMod p) × (ZMod (np)) is an additive basis.
theorem regular_sequence_additive_basis_cp_cnp_of_dvd_of_card_ge (p : ℕ) (hp : p.Prime) (hp3 : 3 ≤ p) (n : ℕ) (hn : p ≤ n) (hmin : (n * p).minFac = p) (hdvd : p ∣ n) (S : Multiset (ZMod p × ZMod (n * p))) (hreg : IsRegularSequence S) (hcard : Nat.ceil ((4 * (n * p : ℝ) - 2) / 3) ≤ S.card) : IsAdditiveBasis S
regular_sequence_additive_basis_cp_cnp_of_ge_fiveIn LeanCombinatorics for TCS
For p ≥ 5 prime and n ≥ 2 with (np).minFac = p and p ∤ n, every regular sequence of cardinality ⌈(25np - 20)/6⌉ over (ZMod p) × (ZMod (np)) is an additive basis.
theorem regular_sequence_additive_basis_cp_cnp_of_ge_five (p : ℕ) (hp : p.Prime) (hp5 : 5 ≤ p) (n : ℕ) (hn : 2 ≤ n) (hmin : (n * p).minFac = p) (hndvd : ¬ p ∣ n) (S : Multiset (ZMod p × ZMod (n * p))) (hreg : IsRegularSequence S) (hcard : S.card = Nat.ceil ((25 * (n * p : ℝ) - 20) / 6)) : IsAdditiveBasis S
regular_sequence_additive_basis_cq_cnq_of_card_geIn LeanCombinatorics for TCS
Theorem 3.5 of arXiv:2610.13103: let q be prime, n ≥ 2, and p = (nq).minFac ≥ 3. Then every regular sequence S over (ZMod q) × (ZMod (nq)) with S.card ≥ max{nq + 2q² − q − 1, nq(q+1)/p − q + p − 2} is an additive basis of the group.
theorem regular_sequence_additive_basis_cq_cnq_of_card_ge (q : ℕ) (hq : q.Prime) (n : ℕ) (hn : 2 ≤ n) (hp3 : 3 ≤ (n * q).minFac) (S : Multiset (ZMod q × ZMod (n * q))) (hreg : IsRegularSequence S) (hcard : max (n * q + 2 * q ^ 2 - q - 1) (n * q * (q + 1) / (n * q).minFac - q + (n * q).minFac - 2) ≤ S.card) : IsAdditiveBasis S
regular_sequence_c3_cn3_countingIn LeanCombinatorics for TCS
Every regular sequence of cardinality at least ⌈(16 * 3n - 12)/5⌉ over C_3 × C_{3n} has at least 2 elements outside every proper subgroup H.
open scoped Classical in
theorem regular_sequence_c3_cn3_counting (n : ℕ) (hn : 2 ≤ n) (hmin : (3 * n).minFac = 3) (hndvd : ¬ 3 ∣ n) (S : Multiset (ZMod 3 × ZMod (n * 3))) (hreg : IsRegularSequence S) (hcard : Nat.ceil ((16 * (n * 3 : ℝ) - 12) / 5) ≤ S.card) (H : AddSubgroup (ZMod 3 × ZMod (n * 3))) (hH : H < ⊤) : 2 ≤ (S.filter (fun x => x ∉ H)).card
regular_sequence_c3_cn3_davenport_leIn LeanCombinatorics for TCS
The Olson Davenport constant D(C_3 × C_{3n}) = 3 + 3n - 1 is at most the threshold ⌈(16 * 3n - 12)/5⌉ for all n ≥ 5.
theorem regular_sequence_c3_cn3_davenport_le (n : ℕ) (hn : 5 ≤ n) : 3 + n * 3 - 1 ≤ Nat.ceil ((16 * (n * 3 : ℝ) - 12) / 5)
regular_sequence_c3_cn3_n_ge_fiveIn LeanCombinatorics for TCS
For n ≥ 2 with (3 * n).minFac = 3 and ¬ 3 ∣ n, we have 5 ≤ n.
theorem regular_sequence_c3_cn3_n_ge_five (n : ℕ) (hn : 2 ≤ n) (hmin : (3 * n).minFac = 3) (hndvd : ¬ 3 ∣ n) : 5 ≤ n
regular_sequence_cp_cnp_countingIn LeanCombinatorics for TCS
For p ≥ 3 prime and n ≥ 2 with (np).minFac = p and p does not divide n, every regular sequence S over ZMod p × ZMod (np) of cardinality at least ⌈(4np−2)/3⌉ has at least p − 1 terms outside every proper additive subgroup H (strictly smaller than the whole group).
open scoped Classical in
theorem regular_sequence_cp_cnp_counting (p : ℕ) (hp : p.Prime) (hp3 : 3 ≤ p) (n : ℕ) (hn : 2 ≤ n) (hmin : (n * p).minFac = p) (hndvd : ¬ p ∣ n) (S : Multiset (ZMod p × ZMod (n * p))) (hreg : IsRegularSequence S) (hcard : Nat.ceil ((4 * (n * p : ℝ) - 2) / 3) ≤ S.card) (H : AddSubgroup (ZMod p × ZMod (n * p))) (hH : H < ⊤) : p - 1 ≤ (S.filter (fun x => x ∉ H)).card
regular_sequence_cp_cnp_n_ge_fiveIn LeanCombinatorics for TCS
For p ≥ 3 prime and n ≥ 2 with (np).minFac = p and p ∤ n, we have 5 ≤ n.
theorem regular_sequence_cp_cnp_n_ge_five (p : ℕ) (hp : p.Prime) (hp3 : 3 ≤ p) (n : ℕ) (hn : 2 ≤ n) (hmin : (n * p).minFac = p) (hndvd : ¬ p ∣ n) : 5 ≤ n
regular_sequence_cp_cnp_p_le_nIn LeanCombinatorics for TCS
For p ≥ 3 and n ≥ 2 with p ∣ n, we have p ≤ n.
theorem regular_sequence_cp_cnp_p_le_n (p : ℕ) (hp3 : 3 ≤ p) (n : ℕ) (hn : 2 ≤ n) (hdvd : p ∣ n) : p ≤ n
restricted_diff_card_le_of_missingIn LeanCombinatorics for TCS
Let G be a finite abelian group of odd order at least 21, and let A be a finite subset of G with |A| > |G| / 2. If the 3-fold restricted sumset of A (the set of sums of 3 distinct elements of A) does not equal all of G, then the difference set A - A has cardinality at most |G| - |A|.
open scoped Pointwise in
theorem restricted_diff_card_le_of_missing {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G]
(hN_odd : Fintype.card G % 2 = 1) (hN : 21 ≤ Fintype.card G)
{A : Finset G} (hA : Fintype.card G / 2 < A.card)
(h_not_all : (A.powersetCard 3).image (fun s => ∑ x ∈ s, x) ≠ Finset.univ) :
(A - A).card ≤ Fintype.card G - A.cardrestricted_sumset_eq_empty_of_card_ltIn LeanCombinatorics for TCS
If A has fewer than k elements then the k-fold restricted sumset of A is empty, since there is no k-element subset to sum over.
theorem restricted_sumset_eq_empty_of_card_lt {G : Type*} [AddCommGroup G] [DecidableEq G] {A : Finset G} {k : ℕ} (h : A.card < k) : restrictedSumset A k = ∅restricted_sumset_oneIn LeanCombinatorics for TCS
The one-fold restricted sumset of A is A itself: Σ₁(A) = A.
theorem restricted_sumset_one {G : Type*} [AddCommGroup G] [DecidableEq G] (A : Finset G) : restrictedSumset A 1 = Arigid_sequence_product_zero_sum_free_of_exact_lightIn LeanCombinatorics for TCS
Let n = 2^a * m with a >= 1 and odd m >= 3. Let t >= 1 and let r : Fin t -> ℕ. If for each i in Fin t, S(i) is a rigid sequence in Multiset (Fin (r i) -> ZMod n) with parameters n and m such that every term in S(i) has multiplicity n - 1 or m - 1, then the rigid sequence tensor product of S with parameters n and m has no zero-sum subsequence of length n.
theorem rigid_sequence_product_zero_sum_free_of_exact_light {a : ℕ} (ha : 1 ≤ a) {m : ℕ} (hm : Odd m) (hm3 : 3 ≤ m) {n : ℕ} (hn : n = 2 ^ a * m)
{t : ℕ} (ht : 1 ≤ t) (r : Fin t → ℕ)
(S : (i : Fin t) → Multiset (Fin (r i) → ZMod n))
(hS : ∀ i, is_rigid_sequence n m (S i))
(h_exact : ∀ (i : Fin t) (x : Fin (r i) → ZMod n), x ∈ S i → (S i).count x = n - 1 ∨ (S i).count x = m - 1) :
¬ ∃ W : Multiset ((i : Fin t) → Fin (r i) → ZMod n),
W ≤ rigid_sequence_tensor_product n m S ∧ W.card = n ∧ W.sum = 0rigid_sequence_tensor_product_count_leIn LeanCombinatorics for TCS
Let n and m be natural numbers with m <= n, and let S be a family of sequences in Multiset (G i) for i in Fin t. For any tuple x, the count of x in rigid_sequence_tensor_product n m S is at most n - 1.
lemma rigid_sequence_tensor_product_count_le {n m t : ℕ} {G : Fin t → Type*} [∀ i, DecidableEq (G i)]
(S : (i : Fin t) → Multiset (G i)) (x : (i : Fin t) → G i) (hmn : m ≤ n) :
Multiset.count x (rigid_sequence_tensor_product n m S) ≤ n - 1rigid_sequence_tensor_product_count_of_light_leIn LeanCombinatorics for TCS
Let n and m be natural numbers, and let S be a family of sequences in Multiset (G i) for i in Fin t. If x is a tuple having at least one light coordinate j in S(j), then the count of x in rigid_sequence_tensor_product n m S is at most m - 1.
lemma rigid_sequence_tensor_product_count_of_light_le {n m t : ℕ} {G : Fin t → Type*} [∀ i, DecidableEq (G i)]
(S : (i : Fin t) → Multiset (G i)) (x : (i : Fin t) → G i) (j : Fin t)
(hl : 0 < (S j).count (x j) ∧ (S j).count (x j) ≤ m - 1 ∧ ¬(S j).count (x j) = n - 1) :
Multiset.count x (rigid_sequence_tensor_product n m S) ≤ m - 1rigid_sequence_tensor_product_heavy_of_ne_lightIn LeanCombinatorics for TCS
Let x be an element of rigid_sequence_tensor_product n m S. If coordinate j is light in S(j), then for any coordinate i ≠ j, x(i) is heavy in S(i) (i.e. count in S(i) equals n - 1).
lemma rigid_sequence_tensor_product_heavy_of_ne_light {n m t : ℕ} {G : Fin t → Type*} [∀ i, DecidableEq (G i)]
(S : (i : Fin t) → Multiset (G i)) (x : (i : Fin t) → G i)
(hx : x ∈ rigid_sequence_tensor_product n m S)
(j : Fin t) (hl : 0 < (S j).count (x j) ∧ (S j).count (x j) ≤ m - 1 ∧ ¬(S j).count (x j) = n - 1)
(i : Fin t) (hij : i ≠ j) :
(S i).count (x i) = n - 1ring_diamond_block_routeIn LeanCombinatorics for TCS
In the ring of 20 diamonds, for every block i and every choice set S, the ring vertex (i,0) is adjacent to the midpoint (i,2) if i ∈ S and to (i,1) otherwise, and that midpoint is adjacent to the next ring vertex (i+1,0). Hence each block carries a 2-edge route between consecutive ring vertices.
theorem ring_diamond_block_route (S : Finset (Fin 20)) (i : Fin 20) :
ring_diamond_graph.Adj (i, (0 : Fin 3)) (if i ∈ S then (i, (2 : Fin 3)) else (i, (1 : Fin 3))) ∧
ring_diamond_graph.Adj (if i ∈ S then (i, (2 : Fin 3)) else (i, (1 : Fin 3))) (i + 1, (0 : Fin 3))ring_diamond_cycle_edges_cardIn LeanCombinatorics for TCS
Each of the 20 blocks contributes exactly two edges to the ring cycle determined by S (one edge from the ring vertex (i,0) to the chosen midpoint, one from that midpoint to (i+1,0)), and the 20 blocks share no edges, so the cycle has 20·2 = 40 edges.
theorem ring_diamond_cycle_edges_card (S : Finset (Fin 20)) :
(ring_diamond_cycle_edges S).card = 40ring_diamond_cycle_edges_injectiveIn LeanCombinatorics for TCS
The map sending a 10-element set S of blocks to the edge set of its ring cycle is injective: the edge joining (i,0) to (i,2) lies in that edge set exactly when i ∈ S.
theorem ring_diamond_cycle_edges_injective (S T : Finset (Fin 20)) (hS : S.card = 10) (hT : T.card = 10)
(h : ring_diamond_cycle_edges S = ring_diamond_cycle_edges T) : S = Tring_diamond_cycle_family_cardIn LeanCombinatorics for TCS
The image of the 10-element subsets of the 20 blocks under the ring-cycle edge-set map has cardinality C(20,10) = 184756, because there are C(20,10) such subsets and the map is injective on them.
theorem ring_diamond_cycle_family_card :
((Finset.univ.filter (fun S : Finset (Fin 20) => S.card = 10)).image ring_diamond_cycle_edges).card = 184756ring_diamond_cycle_walkIn LeanCombinatorics for TCS
For every set S of blocks there is a vertex u and a cycle walk in the ring of 20 diamonds whose edge set is exactly the 40 edges of the ring cycle determined by S (walk once around the ring, taking the route through (i,2) when i ∈ S and through (i,1) otherwise).
theorem ring_diamond_cycle_walk (S : Finset (Fin 20)) :
∃ (u : Fin 20 × Fin 3) (p : ring_diamond_graph.Walk u u), p.IsCycle ∧
(↑(ring_diamond_cycle_edges S) : Set (Sym2 (Fin 20 × Fin 3))) = p.toSubgraph.edgeSetring_diamond_graph_edge_finset_card_leIn LeanCombinatorics for TCS
The ring of 20 diamonds has at most m = 80 edges (in fact exactly 80), so it satisfies the edge bound of the counting statement with m = 80.
theorem ring_diamond_graph_edge_finset_card_le : ring_diamond_graph.edgeFinset.card ≤ 80
root_lattice_form_boolean_leIn LeanCombinatorics for TCS
For any boolean vector v ∈ {0,1}^k with k ≥ 1, the quadratic form ∑ v_i² − (∑ v_i)²/(k+1) is at most ⌊(k+1)²/4⌋/(k+1).
theorem root_lattice_form_boolean_le (k : ℕ) (hk : 1 ≤ k) (v : Fin k → ℝ)
(hv : ∀ i, v i = 0 ∨ v i = 1) :
(∑ i, (v i)^2) - (1 / ((k : ℝ) + 1)) * (∑ i, v i)^2 ≤
((((k + 1) ^ 2 / 4 : ℕ) : ℝ) / ((k : ℝ) + 1))root_lattice_form_coord_leIn LeanCombinatorics for TCS
For any u : Fin k → ℝ and coordinate j with u_j ∈ [0, 1], q(u) ≤ max (q(u[j ↦ 0])) (q(u[j ↦ 1])).
theorem root_lattice_form_coord_le (k : ℕ) (hk : 1 ≤ k) (u : Fin k → ℝ) (j : Fin k)
(hj : u j ∈ Set.Icc (0 : ℝ) 1) :
(∑ i, (u i)^2) - (1 / ((k : ℝ) + 1)) * (∑ i, u i)^2 ≤
max ((∑ i, ((Function.update u j 0) i)^2) - (1 / ((k : ℝ) + 1)) * (∑ i, (Function.update u j 0) i)^2)
((∑ i, ((Function.update u j 1) i)^2) - (1 / ((k : ℝ) + 1)) * (∑ i, (Function.update u j 1) i)^2)root_lattice_form_cube_leIn LeanCombinatorics for TCS
For any u in the cube [0, 1]^k with k ≥ 1, the quadratic form ∑ u_i² − (∑ u_i)²/(k+1) is at most ⌊(k+1)²/4⌋/(k+1).
theorem root_lattice_form_cube_le (k : ℕ) (hk : 1 ≤ k) (u : Fin k → ℝ)
(hu : ∀ i, u i ∈ Set.Icc (0 : ℝ) 1) :
(∑ i, (u i)^2) - (1 / ((k : ℝ) + 1)) * (∑ i, u i)^2 ≤
((((k + 1) ^ 2 / 4 : ℕ) : ℝ) / ((k : ℝ) + 1))root_lattice_form_cube_maxIn LeanCombinatorics for TCS
The maximum of uᵀHu over the cube [0,1]^k, H = I_k − 11ᵀ/(k+1), is ⌊(k+1)²/4⌋/(k+1), attained at a 0/1 vector with ⌊(k+1)/2⌋ ones.
theorem root_lattice_form_cube_max (k : ℕ) (hk : 1 ≤ k) :
IsGreatest ((fun u : Fin k → ℝ =>
dotProduct u (Matrix.mulVec (1 - (1 / ((k : ℝ) + 1)) • Matrix.of (fun _ _ : Fin k => (1 : ℝ))) u)) ''
{u | ∀ i, u i ∈ Set.Icc (0 : ℝ) 1})
((((k + 1) ^ 2 / 4 : ℕ) : ℝ) / ((k : ℝ) + 1))root_lattice_form_exists_boolean_geIn LeanCombinatorics for TCS
For any u in the cube [0, 1]^k, there exists a boolean vector v ∈ {0, 1}^k with q(u) ≤ q(v).
theorem root_lattice_form_exists_boolean_ge (k : ℕ) (hk : 1 ≤ k) (u : Fin k → ℝ)
(hu : ∀ i, u i ∈ Set.Icc (0 : ℝ) 1) :
∃ v : Fin k → ℝ, (∀ i, v i = 0 ∨ v i = 1) ∧
(∑ i, (u i)^2) - (1 / ((k : ℝ) + 1)) * (∑ i, u i)^2 ≤
(∑ i, (v i)^2) - (1 / ((k : ℝ) + 1)) * (∑ i, v i)^2root_lattice_form_pos_def_det_cube_maxIn LeanCombinatorics for TCS
For k ≥ 1 and H = I_k − 11ᵀ/(k+1): H is positive definite, det H = 1/(k+1), and b_H = max_{u ∈ [0,1]^k} uᵀHu = ⌊(k+1)²/4⌋/(k+1).
theorem root_lattice_form_pos_def_det_cube_max (k : ℕ) (hk : 1 ≤ k) :
(1 - (1 / ((k : ℝ) + 1)) • Matrix.of (fun _ _ : Fin k => (1 : ℝ))).PosDef ∧
(1 - (1 / ((k : ℝ) + 1)) • Matrix.of (fun _ _ : Fin k => (1 : ℝ))).det = 1 / ((k : ℝ) + 1) ∧
IsGreatest ((fun u : Fin k → ℝ =>
dotProduct u (Matrix.mulVec (1 - (1 / ((k : ℝ) + 1)) • Matrix.of (fun _ _ : Fin k => (1 : ℝ))) u)) ''
{u | ∀ i, u i ∈ Set.Icc (0 : ℝ) 1})
((((k + 1) ^ 2 / 4 : ℕ) : ℝ) / ((k : ℝ) + 1))seidel_graph_exists_six_verticesIn LeanCombinatorics for TCS
There is a graph on 6 vertices whose Seidel matrix has all row sums equal to 1 and non-positive off-diagonal entries in its square: the 6-cycle. This is the n = 2 case (4n - 2 = 6) of the family the target belongs to and shows the Seidel condition class is non-empty.
theorem seidel_graph_exists_six_vertices :
∃ (G : SimpleGraph (Fin 6)) (_ : DecidableRel G.Adj),
(∀ i : Fin 6, ∑ j : Fin 6, seidel_matrix G i j = 1) ∧
(∀ i j : Fin 6, i ≠ j → (seidel_matrix G * seidel_matrix G) i j ≤ 0)seidel_matrix_book_ramsey_lower_boundIn LeanCombinatorics for TCS
Let n ≥ 2 be an integer, and let G be a simple graph on a finite vertex set V of cardinality 4n - 2 with Seidel matrix S. If every row sum of S is 1 and (S^2)_{ij} ≤ 0 for all distinct vertices i ≠ j, then every pair of adjacent vertices in G has at most n - 2 common neighbors, every pair of adjacent vertices in the complement Gᶜ has at most n - 1 common neighbors, G contains no subgraph isomorphic to the book graph B_{n-1}, Gᶜ contains no subgraph isomorphic to the book graph B_n, and the two-color Ramsey property for (B_{n-1}, B_n) fails on 4n - 2 vertices.
theorem seidel_matrix_book_ramsey_lower_bound {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (n : ℕ) (hn : 2 ≤ n)
(hV : Fintype.card V = 4 * n - 2)
(h_row : ∀ i : V, ∑ j : V, seidel_matrix G i j = 1)
(h_sq : ∀ i j : V, i ≠ j → (seidel_matrix G * seidel_matrix G) i j ≤ 0) :
(∀ u v : V, G.Adj u v → Fintype.card (G.commonNeighbors u v) ≤ n - 2) ∧
(∀ u v : V, Gᶜ.Adj u v → Fintype.card (Gᶜ.commonNeighbors u v) ≤ n - 1) ∧
¬ (book_graph (n - 1)).IsContained G ∧
¬ (book_graph n).IsContained Gᶜ ∧
¬ simple_graph_ramsey_property (book_graph (n - 1)) (book_graph n) (4 * n - 2)seq_contam_mono_appendIn LeanCombinatorics for TCS
Contamination is monotone along a clean sequence: if a vertex's germs are on a glove side after the prefix $l_1$, they are still there after the prefix $l_1$ followed by $l_2$.
theorem seq_contam_mono_append {V Γ : Type*} [DecidableEq Γ]
(l₁ l₂ : List (Handshake V Γ)) (t : Γ × Bool → Set V) (s : Γ × Bool) :
seq_contam l₁ t s ⊆ seq_contam (l₁ ++ l₂) t sset_family_ulc_at_two_of_parallel_pairsIn LeanCombinatorics for TCS
A hereditary family whose excluded pairs of permitted vertices form equivalence classes satisfies binomial-normalized log-concavity at rank two.
theorem set_family_ulc_at_two_of_parallel_pairs {V : Type*} [Fintype V] [DecidableEq V] (family : Set (Finset V)) (hdown : ∀ A ∈ family, ∀ B : Finset V, B ⊆ A → B ∈ family) (hpar : ∀ a b c : V, a ≠ b → b ≠ c → a ≠ c → ({a} : Finset V) ∈ family → ({b} : Finset V) ∈ family → ({c} : Finset V) ∈ family → ({a,b} : Finset V) ∉ family → ({b,c} : Finset V) ∉ family → ({a,c} : Finset V) ∉ family) : let f := fun k : ℕ => {A : Finset V | A ∈ family ∧ A.card = k}.ncard; f 1 * f 3 * Nat.choose (Fintype.card V) 2 ^ 2 ≤ f 2 ^ 2 * Fintype.card V * Nat.choose (Fintype.card V) 3set_family_weighted_ulc_at_two_parallel_pairsIn LeanCombinatorics for TCS
A hereditary family with parallel-class excluded pairs satisfies the rank-two normalized log-concavity inequality for any nonnegative vertex product weights.
theorem set_family_weighted_ulc_at_two_parallel_pairs {V : Type*} [Fintype V] [DecidableEq V] (family : Set (Finset V)) [DecidablePred (fun A : Finset V => A ∈ family)] (w : V → ℕ) (hdown : ∀ A ∈ family, ∀ B : Finset V, B ⊆ A → B ∈ family) (hpar : ∀ a b c : V, a ≠ b → b ≠ c → a ≠ c → ({a} : Finset V) ∈ family → ({b} : Finset V) ∈ family → ({c} : Finset V) ∈ family → ({a,b} : Finset V) ∉ family → ({b,c} : Finset V) ∉ family → ({a,c} : Finset V) ∉ family) : let f := fun k : ℕ => ∑ A ∈ Finset.univ.filter (fun A : Finset V => A ∈ family ∧ A.card = k), ∏ v ∈ A, w v; f 1 * f 3 * Nat.choose (Fintype.card V) 2 ^ 2 ≤ f 2 ^ 2 * Fintype.card V * Nat.choose (Fintype.card V) 3sharp_cyclic_and_compl_iff_circulantIn LeanCombinatorics for TCS
Let G be a simple graph on ZMod N, and let G^c be its complement graph. Suppose that both G and G^c have at least one edge. The standard cyclic labeling is sharp for both G and G^c if and only if the adjacency matrix of G is circulant.
theorem sharp_cyclic_and_compl_iff_circulant (N : ℕ) [NeZero N]
(G : SimpleGraph (ZMod N)) [DecidableRel G.Adj]
(he : ∃ u v, G.Adj u v) (hec : ∃ u v, Gᶜ.Adj u v) :
(is_sharp_cyclic_labeling N G (Equiv.refl (ZMod N)) ∧
is_sharp_cyclic_labeling N Gᶜ (Equiv.refl (ZMod N))) ↔
∃ v : ZMod N → ℂ, G.adjMatrix ℂ = Matrix.circulant vsharp_cyclic_four_fourier_row_vanishIn LeanCombinatorics for TCS
If a simple graph on ZMod 4 admits a sharp cyclic labeling π, then all but at most one of the discrete Fourier coefficients of the degree vector (y ↦ deg (π y)) vanish: the exponential sums ∑_y deg(π y) · exp(−2πi·(n·y)/4) are zero for every n except possibly one distinguished n₀.
theorem sharp_cyclic_four_fourier_row_vanish (G : SimpleGraph (ZMod 4)) [DecidableRel G.Adj]
(π : ZMod 4 ≃ ZMod 4) (hπ : is_sharp_cyclic_labeling 4 G π) :
∃ n₀ : ZMod 4, ∀ n : ZMod 4, n ≠ n₀ →
∑ y : ZMod 4, (G.degree (π y) : ℂ) *
Complex.exp (-2 * ↑Real.pi * Complex.I * (↑((n * y).val) / ↑(4 : ℕ))) = 0sharp_cyclic_four_regularIn LeanCombinatorics for TCS
Every simple graph G on ZMod 4 with at least one edge that admits a sharp cyclic labeling is regular of some positive degree d.
theorem sharp_cyclic_four_regular (G : SimpleGraph (ZMod 4)) [DecidableRel G.Adj]
(he : ∃ u v, G.Adj u v) (hs : admits_sharp_cyclic_labeling 4 G) :
∃ d : ℕ, 1 ≤ d ∧ G.IsRegularOfDegree dshift_mul_bijective_zmodIn LeanCombinatorics for TCS
For prime n and σ not divisible by n, multiplication by σ is a bijection of ZMod n.
theorem shift_mul_bijective_zmod (n : ℕ) (hn : n.Prime) (σ : ℕ) (hσ : σ % n ≠ 0) : Function.Bijective (fun k : ZMod n => k * (σ : ZMod n))
sign_invertible_implies_splitting_systemIn LeanCombinatorics for TCS
Let m, n, t be positive natural numbers with t even. Let A be an m × n matrix with entries in {-1, 1} (for all i and j, A_{i, j} = 1 ∨ A_{i, j} = -1). For each i, let B_i = {j ∈ Fin n : A_{i, j} = 1}, and let 𝔹 = {B_i : i ∈ Fin m}. Let V_{≤ t} = {x : Fin n → ℤ | (∀ j, x j = 0 ∨ x j = 1) ∧ |{j : x j ≠ 0}| ≤ t} be the set of t-sparse binary vectors. If the map x ↦ Int.sign ∘ (Matrix.mulVec A x) is injective on V_{≤ t}, then 𝔹 is an (n, t)-splitting system on Fin n.
theorem sign_invertible_implies_splitting_system
{m n t : ℕ} (hm : 0 < m) (hn : 0 < n) (ht : 0 < t) (ht_even : Even t)
(A : Matrix (Fin m) (Fin n) ℤ) (hA : ∀ i j, A i j = 1 ∨ A i j = -1)
(h_inj : Set.InjOn (fun x => Int.sign ∘ (Matrix.mulVec A x))
{x : Fin n → ℤ | (∀ j, x j = 0 ∨ x j = 1) ∧ (Finset.filter (fun j => x j ≠ 0) Finset.univ).card ≤ t}) :
is_splitting_system n t
(Finset.image (fun i => Finset.filter (fun j => A i j = 1) Finset.univ) Finset.univ)signed_graph_balance_partition_transportsIn LeanCombinatorics for TCS
A signed graph isomorphic to a balanced signed graph has a balance partition.
theorem signed_graph_balance_partition_transports {V W : Type*}
[DecidableEq V] [Fintype V] [DecidableEq W] [Fintype W]
(G : SignedGraph V) (H : SignedGraph W) (A B : Finset V)
(hbal : G.IsBalancedPartition A B) (hiso : G.IsIsomorphic H) :
∃ C D : Finset W, H.IsBalancedPartition C Dsigned_graph_netDegree_switchIn LeanCombinatorics for TCS
Switching G at v negates the net-degree of v and subtracts twice the extended edge sign s(u,v) from the net-degree of every other vertex u.
theorem signed_graph_netDegree_switch {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (u v : V) : (G.switch v).netDegree u = if u = v then -G.netDegree v else G.netDegree u - 2 * G.edgeSign u vsigned_graph_nonreconstructible_has_switch_partnerIn LeanCombinatorics for TCS
If G is not reconstructible from its switching deck, then every vertex v of G has a switch partner w: a vertex w ≠ v such that the double switch of G at v and w is not isomorphic to G but has the same switching deck as G.
theorem signed_graph_nonreconstructible_has_switch_partner {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (h : ¬ G.IsReconstructible) : ∀ v : V, ∃ w : V, G.IsSwitchPartner v wsigned_graph_reconstructible_of_all_neg_net_degreesIn LeanCombinatorics for TCS
Let G be a signed graph on a finite vertex set V with cardinality not equal to 4. If every vertex v of G has strictly negative net-degree, then G is reconstructible from its switching deck.
theorem signed_graph_reconstructible_of_all_neg_net_degrees {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (h_card : Fintype.card V ≠ 4) (h_neg : ∀ v : V, G.netDegree v < 0) : G.IsReconstructiblesigned_graph_reconstructible_of_all_pos_net_degreesIn LeanCombinatorics for TCS
Let G be a signed graph on a finite vertex set V with cardinality not equal to 4. If every vertex v of G has strictly positive net-degree, then G is reconstructible from its switching deck.
theorem signed_graph_reconstructible_of_all_pos_net_degrees {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (h_card : Fintype.card V ≠ 4) (h_pos : ∀ v : V, 0 < G.netDegree v) : G.IsReconstructiblesigned_graph_reconstructible_of_disjoint_netDegreeIn LeanCombinatorics for TCS
Let G be a signed graph on a finite vertex set V with cardinality not equal to 4. If there exists a vertex v such that no vertex w of G has net-degree equal to -G.netDegree v - 2, -G.netDegree v, or -G.netDegree v + 2, then G is reconstructible from its switching deck.
theorem signed_graph_reconstructible_of_disjoint_netDegree {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (h_card : Fintype.card V ≠ 4) (v : V) (h_disj : ∀ w : V, G.netDegree w ≠ -G.netDegree v - 2 ∧ G.netDegree w ≠ -G.netDegree v ∧ G.netDegree w ≠ -G.netDegree v + 2) : G.IsReconstructiblesigned_graph_reconstructible_of_netDegree_ge_threeIn LeanCombinatorics for TCS
Let G be a signed graph on a vertex set of cardinality different from 4 in which every net-degree is non-negative and some vertex has net-degree at least 3. Then G is reconstructible from its switching deck.
theorem signed_graph_reconstructible_of_netDegree_ge_three {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (h_card : Fintype.card V ≠ 4) (h_nonneg : ∀ v : V, G.netDegree v ≥ 0) (h_big : ∃ v : V, G.netDegree v ≥ 3) : G.IsReconstructiblesigned_graph_reconstructible_of_netDegree_le_twoIn LeanCombinatorics for TCS
Let G be a connected balanced signed graph on a finite vertex set of cardinality different from 4, all of whose net-degrees are non-negative and at most 2. Then G is reconstructible from its switching deck.
theorem signed_graph_reconstructible_of_netDegree_le_two {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (h_conn : G.graph.Connected) (h_card : Fintype.card V ≠ 4) (A B : Finset V) (h_bal : G.IsBalancedPartition A B) (h_nonneg : ∀ v : V, G.netDegree v ≥ 0) (h_le : ∀ v : V, G.netDegree v ≤ 2) : G.IsReconstructiblesigned_graph_reconstructible_of_netDegree_zero_or_twoIn LeanCombinatorics for TCS
Let G be a connected balanced signed graph on a finite vertex set of cardinality different from 4, and suppose every vertex has net-degree 0 or 2. Then G is reconstructible from its switching deck.
theorem signed_graph_reconstructible_of_netDegree_zero_or_two {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (h_conn : G.graph.Connected) (h_card : Fintype.card V ≠ 4) (A B : Finset V) (h_bal : G.IsBalancedPartition A B) (h_vals : ∀ v : V, G.netDegree v = 0 ∨ G.netDegree v = 2) : G.IsReconstructiblesigned_graph_reconstructible_of_net_regularIn LeanCombinatorics for TCS
Every net-regular signed graph G on a finite vertex set V with cardinality not equal to 4 is reconstructible from its switching deck.
theorem signed_graph_reconstructible_of_net_regular {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (h_card : Fintype.card V ≠ 4) (h_reg : G.IsNetRegular) : G.IsReconstructiblesigned_graph_reconstructible_of_strict_sign_net_degreesIn LeanCombinatorics for TCS
Let G be a signed graph on a finite vertex set V with cardinality not equal to 4. If all net-degrees of G are strictly positive, or all are strictly negative, then G is reconstructible from its switching deck.
theorem signed_graph_reconstructible_of_strict_sign_net_degrees {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (h_card : Fintype.card V ≠ 4) (h_sign : (∀ v : V, 0 < G.netDegree v) ∨ (∀ v : V, G.netDegree v < 0)) : G.IsReconstructiblesigned_graph_sameDeck_netDegreeIn LeanCombinatorics for TCS
If G and G' have the same switching deck (via π : V ≃ V') and |V| ≠ 4, then every vertex's net-degree is recovered from the deck: G'.netDegree (π v) = G.netDegree v for all v. In particular the net-degree multisets agree, so if all net-degrees of G are non-negative so are all of G'.
theorem signed_graph_sameDeck_netDegree {V V' : Type*} [DecidableEq V] [DecidableEq V'] [Fintype V] [Fintype V'] (G : SignedGraph V) (G' : SignedGraph V') (h_deck : G.SameDeck G') (h_card : Fintype.card V ≠ 4) : ∃ π : V ≃ V', ∀ v : V, G'.netDegree (π v) = G.netDegree vsigned_graph_switch_balance_partitionIn LeanCombinatorics for TCS
Switching a balanced signed graph at v gives the balance partition obtained by moving v to the other part.
theorem signed_graph_switch_balance_partition {V : Type*} [DecidableEq V] [Fintype V]
(G : SignedGraph V) (A B : Finset V) (hbal : G.IsBalancedPartition A B) (v : V) :
(G.switch v).IsBalancedPartition ((A \ {v}) ∪ ({v} \ A)) ((B \ {v}) ∪ ({v} \ B))signed_graph_switch_netDegree_sumIn LeanCombinatorics for TCS
The net-degrees of the card G.switch v sum to (sum over all vertices of G.netDegree) minus 4 * G.netDegree v.
theorem signed_graph_switch_netDegree_sum {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (v : V) : (∑ u, (G.switch v).netDegree u) = (∑ u, G.netDegree u) - 4 * G.netDegree vsigned_graph_switch_partner_netDegreeIn LeanCombinatorics for TCS
If w is a switch partner of v in a signed graph G on a vertex set of cardinality different from 4, then G.netDegree v + G.netDegree w = 2 * G.edgeSign v w.
theorem signed_graph_switch_partner_netDegree {V : Type*} [DecidableEq V] [Fintype V] (G : SignedGraph V) (h_card : Fintype.card V ≠ 4) {v w : V} (h : G.IsSwitchPartner v w) : G.netDegree v + G.netDegree w = 2 * G.edgeSign v wsigned_graph_vertex_switch_involutionIn LeanCombinatorics for TCS
Switching a signed graph twice at the same vertex returns the original signed graph.
theorem signed_graph_vertex_switch_involution {V : Type*} [DecidableEq V]
(G : SignedGraph V) (v : V) : (G.switch v).switch v = Gsimple_graph_cycle_power_dyadic_cover_class_tightIn LeanCombinatorics for TCS
In an optimal (m+1)-layer dyadic cover, each colour class of each layer has layer weight exactly equal to its cardinality.
theorem simple_graph_cycle_power_dyadic_cover_class_tight
(m n : ℕ) [NeZero n] (hm : 1 ≤ m)
(hn : 3 * (2 ^ m - 1) + 1 ≤ n)
(c : Fin (m + 1) → ZMod n → ZMod n)
(hc : ∀ s u v, u ≠ v → c s u = c s v →
(simple_graph_cycle_power n (2 ^ m - 1)).Adj u v)
(hcov : ∀ u v, (simple_graph_cycle_power n (2 ^ m - 1)).Adj u v →
∃ s, c s u = c s v)
(s : Fin (m + 1)) (i : ZMod n) :
(∑ j ∈ Finset.univ.filter (fun j => c s j = c s i),
(2 * (if c s j = c s (j + ((2 ^ m - 1 : ℕ) : ZMod n)) then 1 else 0) +
(Finset.range m).sum (fun k => if k = 0 then 0 else
if c s j = c s (j + ((2 ^ m - 2 ^ k : ℕ) : ZMod n)) then 1 else 0)))
= (Finset.univ.filter (fun j => c s j = c s i)).cardsimple_graph_cycle_power_dyadic_cover_total_layer_weightIn LeanCombinatorics for TCS
The total dyadic layer weight of an optimal (m+1)-layer cover of C_n^{2^m-1} is exactly n(m+1): twice n for the endpoint-distance pairs plus once n for each of the m-1 other dyadic distances.
theorem simple_graph_cycle_power_dyadic_cover_total_layer_weight
(m n : ℕ) [NeZero n] (hm : 1 ≤ m)
(hn : 3 * (2 ^ m - 1) + 1 ≤ n)
(c : Fin (m + 1) → ZMod n → ZMod n)
(hc : ∀ s u v, u ≠ v → c s u = c s v →
(simple_graph_cycle_power n (2 ^ m - 1)).Adj u v)
(hcov : ∀ u v, (simple_graph_cycle_power n (2 ^ m - 1)).Adj u v →
∃ s, c s u = c s v) :
(∑ s : Fin (m + 1), ∑ i : ZMod n,
(2 * (if c s i = c s (i + ((2 ^ m - 1 : ℕ) : ZMod n)) then 1 else 0) +
(Finset.range m).sum (fun j => if j = 0 then 0 else
if c s i = c s (i + ((2 ^ m - 2 ^ j : ℕ) : ZMod n)) then 1 else 0)))
= n * (m + 1)simple_graph_cycle_power_dyadic_layer_weight_fiber_leIn LeanCombinatorics for TCS
In a clique labelling of the cycle power with dyadic bandwidth 2^m-1, the total layer weight of a single colour fibre is at most the size of that fibre.
theorem simple_graph_cycle_power_dyadic_layer_weight_fiber_le
(m n : ℕ) [NeZero n] (hm : 1 ≤ m)
(hn : 3 * (2 ^ m - 1) + 1 ≤ n)
(c : ZMod n → ZMod n)
(hc : ∀ u v, u ≠ v → c u = c v →
(simple_graph_cycle_power n (2 ^ m - 1)).Adj u v)
(q : ZMod n) :
(∑ i ∈ Finset.univ.filter (fun i => c i = q),
(2 * (if c i = c (i + ((2 ^ m - 1 : ℕ) : ZMod n)) then 1 else 0) +
(Finset.range m).sum (fun j => if j = 0 then 0 else
if c i = c (i + ((2 ^ m - 2 ^ j : ℕ) : ZMod n)) then 1 else 0)))
≤ (Finset.univ.filter (fun i => c i = q)).cardsimple_graph_cycle_power_fifteen_cover_five_local_periodsIn LeanCombinatorics for TCS
In a tight five-layer equivalence cover of C_n^15, n at least 46, the class-type bits repeat after 8 positions and the layer chosen for the distance-15 class at each start repeats after 16 positions.
theorem simple_graph_cycle_power_fifteen_cover_five_local_periods (n : ℕ) [NeZero n] (hn : 46 ≤ n)
(c : Fin 5 → ZMod n → ZMod n)
(hc : ∀ s u v, u ≠ v → c s u = c s v → (simple_graph_cycle_power n 15).Adj u v)
(hcov : ∀ u v, (simple_graph_cycle_power n 15).Adj u v → ∃ s, c s u = c s v)
(h15 : ∀ i, ∃! s, c s i = c s (i + 15))
(h14 : ∀ i, ∃! s, c s i = c s (i + 14))
(h12 : ∀ i, ∃! s, c s i = c s (i + 12))
(h8 : ∀ i, ∃! s, c s i = c s (i + 8))
(hspan : ∀ s i, ∃ d : ℕ, d ≤ 15 ∧ c s (i - d) = c s (i - d + 15) ∧ c s (i - d) = c s i)
(σ : ZMod n → Fin 5) (hσ : ∀ p, c (σ p) p = c (σ p) (p + 15)) :
(∀ (p : ZMod n) (j : Fin 16),
(c (σ (p + 8)) (p + 8) = c (σ (p + 8)) (p + 8 + ((j : ℕ) : ZMod n))) ↔
(c (σ p) p = c (σ p) (p + ((j : ℕ) : ZMod n)))) ∧
∀ p, σ (p + 16) = σ psimple_graph_cycle_power_fifteen_cover_five_tightIn LeanCombinatorics for TCS
Every five-layer equivalence cover of C_n^15, n at least 46, covers every distance-15,14,12,8 pair exactly once, and every class is spanned by a distance-15 pair.
theorem simple_graph_cycle_power_fifteen_cover_five_tight (n : ℕ) [NeZero n] (hn : 46 ≤ n)
(c : Fin 5 → ZMod n → ZMod n)
(hc : ∀ s u v, u ≠ v → c s u = c s v → (simple_graph_cycle_power n 15).Adj u v)
(hcov : ∀ u v, (simple_graph_cycle_power n 15).Adj u v → ∃ s, c s u = c s v) :
(∀ i, ∃! s, c s i = c s (i + 15)) ∧ (∀ i, ∃! s, c s i = c s (i + 14)) ∧
(∀ i, ∃! s, c s i = c s (i + 12)) ∧ (∀ i, ∃! s, c s i = c s (i + 8)) ∧
∀ s i, ∃ d : ℕ, d ≤ 15 ∧ c s (i - d) = c s (i - d + 15) ∧ c s (i - d) = c s isimple_graph_cycle_power_fifteen_cover_five_tight_dvdIn LeanCombinatorics for TCS
A tight five-layer equivalence cover of C_n^15, n at least 46, forces 16 to divide n.
theorem simple_graph_cycle_power_fifteen_cover_five_tight_dvd (n : ℕ) [NeZero n] (hn : 46 ≤ n)
(c : Fin 5 → ZMod n → ZMod n)
(hc : ∀ s u v, u ≠ v → c s u = c s v → (simple_graph_cycle_power n 15).Adj u v)
(hcov : ∀ u v, (simple_graph_cycle_power n 15).Adj u v → ∃ s, c s u = c s v)
(h15 : ∀ i, ∃! s, c s i = c s (i + 15))
(h14 : ∀ i, ∃! s, c s i = c s (i + 14))
(h12 : ∀ i, ∃! s, c s i = c s (i + 12))
(h8 : ∀ i, ∃! s, c s i = c s (i + 8))
(hspan : ∀ s i, ∃ d : ℕ, d ≤ 15 ∧ c s (i - d) = c s (i - d + 15) ∧ c s (i - d) = c s i) :
16 ∣ nsimple_graph_cycle_power_fifteen_int_weight_le_cardIn LeanCombinatorics for TCS
For any finite set of integers S with diameter at most 15, the weighted count of forward pairs at distances 15, 14, 12, 8 with weights 2, 1, 1, 1 is at most the cardinality of S.
theorem simple_graph_cycle_power_fifteen_int_weight_le_card (S : Finset ℤ)
(hdiam : ∀ a ∈ S, ∀ b ∈ S, |a - b| ≤ 15) :
∑ e ∈ S, (2 * (if e + 15 ∈ S then 1 else 0) + (if e + 14 ∈ S then 1 else 0)
+ (if e + 12 ∈ S then 1 else 0) + (if e + 8 ∈ S then 1 else 0)) ≤
Finset.card Ssimple_graph_cycle_power_fifteen_int_weight_le_card_of_subset_IccIn LeanCombinatorics for TCS
For a subset S of Icc 0 15 in the integers, the weighted count of forward pairs at distances 15, 14, 12, 8 with weights 2, 1, 1, 1 is at most the cardinality of S.
theorem simple_graph_cycle_power_fifteen_int_weight_le_card_of_subset_Icc (S : Finset ℤ)
(hS : S ⊆ Finset.Icc 0 15) :
∑ e ∈ S, (2 * (if e + 15 ∈ S then 1 else 0) + (if e + 14 ∈ S then 1 else 0)
+ (if e + 12 ∈ S then 1 else 0) + (if e + 8 ∈ S then 1 else 0)) ≤
Finset.card Ssimple_graph_cycle_power_fifteen_layer_weight_fiber_leIn LeanCombinatorics for TCS
For any label class in C_n^15 with n ≥ 46, the fiber sum of the layer weights is at most the cardinality of the fiber.
theorem simple_graph_cycle_power_fifteen_layer_weight_fiber_le (n : ℕ) [NeZero n] (hn : 46 ≤ n)
(c : ZMod n → ZMod n)
(hc : ∀ u v, u ≠ v → c u = c v → (simple_graph_cycle_power n 15).Adj u v)
(ℓ : ZMod n) :
∑ i ∈ Finset.univ.filter (fun x => c x = ℓ),
(2 * (if c i = c (i + 15) then 1 else 0) + (if c i = c (i + 14) then 1 else 0)
+ (if c i = c (i + 12) then 1 else 0) + (if c i = c (i + 8) then 1 else 0)) ≤
Finset.card (Finset.univ.filter (fun x => c x = ℓ))simple_graph_cycle_power_fifteen_layer_weight_leIn LeanCombinatorics for TCS
For a clique partition of C_n^15 with n at least 46, the total weighted count of same-class forward pairs at distances 15, 14, 12, 8, weighted 2, 1, 1, 1, is at most n.
theorem simple_graph_cycle_power_fifteen_layer_weight_le (n : ℕ) [NeZero n] (hn : 46 ≤ n)
(c : ZMod n → ZMod n)
(hc : ∀ u v, u ≠ v → c u = c v → (simple_graph_cycle_power n 15).Adj u v) :
∑ i : ZMod n, (2 * (if c i = c (i + 15) then 1 else 0) + (if c i = c (i + 14) then 1 else 0)
+ (if c i = c (i + 12) then 1 else 0) + (if c i = c (i + 8) then 1 else 0)) ≤ nsimple_graph_not_has_equivalence_cover_cycle_power_fifteen_of_not_dvdIn LeanCombinatorics for TCS
For n at least 46 not divisible by 16, C_n^15 has no equivalence cover by five layers; this is the lower-bound half of the k = 15 case of OP-205.
theorem simple_graph_not_has_equivalence_cover_cycle_power_fifteen_of_not_dvd (n : ℕ) (hn : 46 ≤ n)
(h16 : ¬ 16 ∣ n) : ¬ simple_graph_has_equivalence_cover (simple_graph_cycle_power n 15) 5simple_graph_ramsey_three_ten_forty_of_degree_lt_nineNeeds helpCombinatorics for TCS
A triangle-free simple graph on 40 vertices with maximum degree at most 9, having a vertex of degree less than 9 whose closed non-neighbourhood satisfies 2·e(outer) + 18·deg v ≤ 360, has an independent set of 10 vertices (its complement is not 10-clique-free). This is the non-regular branch; it is open.
theorem simple_graph_ramsey_three_ten_forty_of_degree_lt_nine (g : SimpleGraph (Fin 40))
[DecidableRel g.Adj] (htri : g.CliqueFree 3) (hmax : ∀ v, g.degree v ≤ 9)
(hlow : ∃ v, g.degree v < 9 ∧
2 * (g.induce {u | u ≠ v ∧ ¬ g.Adj v u}).edgeFinset.card + 18 * g.degree v ≤ 360) :
¬ gᶜ.CliqueFree 10simple_graph_ramsey_three_ten_forty_of_max_degree_le_nineIn LeanCombinatorics for TCS
Every simple graph on 40 vertices with maximum degree at most 9 contains a triangle or an independent set of 10 vertices.
theorem simple_graph_ramsey_three_ten_forty_of_max_degree_le_nine (g : SimpleGraph (Fin 40))
[DecidableRel g.Adj] (h : ∀ v, g.degree v ≤ 9) :
¬ g.CliqueFree 3 ∨ ¬ gᶜ.CliqueFree 10simple_graph_ramsey_three_ten_forty_of_nine_regularNeeds helpCombinatorics for TCS
A triangle-free simple graph on 40 vertices all of whose vertex degrees equal 9 has an independent set of 10 vertices (its complement is not 10-clique-free). This is the 9-regular core case of R(3,10) ≤ 40; it is open, since R(3,10) is only known to lie in [40,41].
theorem simple_graph_ramsey_three_ten_forty_of_nine_regular (g : SimpleGraph (Fin 40))
[DecidableRel g.Adj] (htri : g.CliqueFree 3) (hreg : ∀ v, g.degree v = 9) :
¬ gᶜ.CliqueFree 10simplicial_dual_graph_diam_of_disjoint_minimal_nonfacesIn LeanCombinatorics for TCS
In an abstract simplicial complex Δ with pure facet size d and connected dual graph, if the minimal nonfaces are pairwise disjoint and number s, then the diameter of the dual graph is s.
theorem simplicial_dual_graph_diam_of_disjoint_minimal_nonfaces {V : Type*} [DecidableEq V] [Fintype V] (Δ : AbstractSimplicialComplex V) (n d s : ℕ) (hn : Fintype.card V = n) (hpure : simplicial_is_pure Δ d) (hconn : (simplicial_dual_graph Δ d).Connected) (M_set : Finset (Finset V)) (hs : M_set.card = s) (hM_all : ∀ M, simplicial_is_minimal_nonface Δ M ↔ M ∈ M_set) (hM_disj : ∀ M₁ ∈ M_set, ∀ M₂ ∈ M_set, M₁ ≠ M₂ → Disjoint M₁ M₂) : (simplicial_dual_graph Δ d).diam = ssimplicial_dual_graph_dist_of_same_traceIn LeanCombinatorics for TCS
Let Δ be an abstract simplicial complex on an n-element vertex set V, pure of facet size d, with connected dual graph. Suppose there is a subset X ⊆ V such that every pair of distinct minimal nonfaces M, M' of Δ satisfies M ∩ M' ⊆ X. Then any two facets F₁, F₂ of Δ having the same trace on X (that is, F₁ ∩ X = F₂ ∩ X) are at distance at most n - d in the dual graph of Δ.
theorem simplicial_dual_graph_dist_of_same_trace
{V : Type*} [DecidableEq V] [Fintype V]
(Δ : AbstractSimplicialComplex V) (n d : ℕ)
(hn : Fintype.card V = n) (hpure : simplicial_is_pure Δ d)
(hconn : (simplicial_dual_graph Δ d).Connected)
(X : Finset V)
(hX : ∀ M M' : Finset V, simplicial_is_minimal_nonface Δ M →
simplicial_is_minimal_nonface Δ M' → M ≠ M' → M ∩ M' ⊆ X)
(F₁ F₂ : {F : Finset V // simplicial_is_facet Δ F})
(htrace : F₁.1 ∩ X = F₂.1 ∩ X) :
(simplicial_dual_graph Δ d).dist F₁ F₂ ≤ n - dsimplicial_normal_of_disjoint_minimal_nonfacesIn LeanCombinatorics for TCS
In an abstract simplicial complex Δ with pure facet size d and connected dual graph, if the minimal nonfaces are pairwise disjoint, then Δ is normal.
theorem simplicial_normal_of_disjoint_minimal_nonfaces {V : Type*} [DecidableEq V] [Fintype V] (Δ : AbstractSimplicialComplex V) (n d s : ℕ) (hn : Fintype.card V = n) (hpure : simplicial_is_pure Δ d) (hconn : (simplicial_dual_graph Δ d).Connected) (M_set : Finset (Finset V)) (hs : M_set.card = s) (hM_all : ∀ M, simplicial_is_minimal_nonface Δ M ↔ M ∈ M_set) (hM_disj : ∀ M₁ ∈ M_set, ∀ M₂ ∈ M_set, M₁ ≠ M₂ → Disjoint M₁ M₂) : simplicial_is_normal Δ dsingle_facet_is_cohen_macaulayIn LeanCombinatorics for TCS
The simplicial complex consisting of the single triangle {0,1,2} on Fin 3 is Cohen-Macaulay over every field: it is pure of dimension 2, its 1-skeleton is complete, all its vertex links are complete graphs, and being a single disk it has H_1 = 0.
theorem single_facet_is_cohen_macaulay (k : Type*) [Field k] :
is_cohen_macaulay_two_complex ({Finset.univ} : Finset (Finset (Fin 3))) ksingle_interval_gap_certificateIn LeanCombinatorics for TCS
For every t in [0, 1/2], the nineteen points −t·k²−β·k leave a circular gap of length greater than min(t, 1/2−t) for some real β.
theorem single_interval_gap_certificate (t : ℝ) (h0 : (0 : ℝ) ≤ t) (h1 : t ≤ ((1 : ℝ) / 2)) : ∃ β a b : ℝ, min t (((1 : ℝ) / 2) - t) < b - a ∧ ∀ k : Fin 19, ∃ z : ℤ, b ≤ -(k.val : ℝ)^2 * t - β * (k.val : ℝ) + z ∧ -(k.val : ℝ)^2 * t - β * (k.val : ℝ) + z ≤ a + 1
single_interval_gap_five_sixteenths_to_three_eighthsIn LeanCombinatorics for TCS
On t ∈ [5/16, 3/8), the nineteen points −t·k²−β·k leave a circular gap of length greater than 1/2 − t for some real β.
theorem single_interval_gap_five_sixteenths_to_three_eighths (t : ℝ) (hl : ((5 : ℝ) / 16) ≤ t) (hu : t < ((3 : ℝ) / 8)) : ∃ β a b : ℝ, ((1 : ℝ) / 2) - t < b - a ∧ ∀ k : Fin 19, ∃ z : ℤ, b ≤ -(k.val : ℝ)^2 * t - β * (k.val : ℝ) + z ∧ -(k.val : ℝ)^2 * t - β * (k.val : ℝ) + z ≤ a + 1
single_interval_gap_quarter_to_five_sixteenthsIn LeanCombinatorics for TCS
On t ∈ [1/4, 5/16), the nineteen points −t·k²−β·k leave a circular gap of length greater than 1/2 − t for some real β.
theorem single_interval_gap_quarter_to_five_sixteenths (t : ℝ) (hl : ((1 : ℝ) / 4) ≤ t) (hu : t < ((5 : ℝ) / 16)) : ∃ β a b : ℝ, ((1 : ℝ) / 2) - t < b - a ∧ ∀ k : Fin 19, ∃ z : ℤ, b ≤ -(k.val : ℝ)^2 * t - β * (k.val : ℝ) + z ∧ -(k.val : ℝ)^2 * t - β * (k.val : ℝ) + z ≤ a + 1
single_interval_gap_scale_reductionIn LeanCombinatorics for TCS
If the nineteen points at the reduced scale t = frac(2d)/2 leave a circular gap of length > s (in the arc form b ≤ −k²t−βk+z ≤ a+1), then the nineteen points at the original scale d leave a circular gap of length > s in the same arc form.
theorem single_interval_gap_scale_reduction (d s : ℝ) (hd : 0 < d) (h : ∃ β a b : ℝ, s < b - a ∧ ∀ k : Fin 19, ∃ z : ℤ, b ≤ -(k.val : ℝ)^2 * (Int.fract (2 * d) / 2) - β * (k.val : ℝ) + z ∧ -(k.val : ℝ)^2 * (Int.fract (2 * d) / 2) - β * (k.val : ℝ) + z ≤ a + 1) : ∃ β a b : ℝ, s < b - a ∧ ∀ k : Fin 19, ∃ z : ℤ, b ≤ -(k.val : ℝ)^2 * d - β * (k.val : ℝ) + z ∧ -(k.val : ℝ)^2 * d - β * (k.val : ℝ) + z ≤ a + 1
single_interval_gap_three_eighths_to_halfIn LeanCombinatorics for TCS
On t ∈ [3/8, 1/2], the nineteen points −t·k²−β·k leave a circular gap of length greater than 1/2 − t for some real β.
theorem single_interval_gap_three_eighths_to_half (t : ℝ) (hl : ((3 : ℝ) / 8) ≤ t) (hu : t ≤ ((1 : ℝ) / 2)) : ∃ β a b : ℝ, ((1 : ℝ) / 2) - t < b - a ∧ ∀ k : Fin 19, ∃ z : ℤ, b ≤ -(k.val : ℝ)^2 * t - β * (k.val : ℝ) + z ∧ -(k.val : ℝ)^2 * t - β * (k.val : ℝ) + z ≤ a + 1
single_interval_gap_two_elevenths_to_quarterIn LeanCombinatorics for TCS
On t ∈ [2/11, 1/4), the nineteen points −t·k²−β·k leave a circular gap of length greater than t for some real β.
theorem single_interval_gap_two_elevenths_to_quarter (t : ℝ) (hl : ((2 : ℝ) / 11) ≤ t) (hu : t < ((1 : ℝ) / 4)) : ∃ β a b : ℝ, t < b - a ∧ ∀ k : Fin 19, ∃ z : ℤ, b ≤ -(k.val : ℝ)^2 * t - β * (k.val : ℝ) + z ∧ -(k.val : ℝ)^2 * t - β * (k.val : ℝ) + z ≤ a + 1
single_track_gray_code_of_necklace_liftIn LeanCombinatorics for TCS
Given n prime ≥ 3, m = (2^n−2)/n with m*n = 2^n−2, a unit-distance chain u of nonconstant words in pairwise distinct necklaces, and a closing shift σ (0<σ<n) taking u_0 to a word one flip from u_{m−1}, the interleaved sequence w defined by w(k·m+i) = ρ^{kσ}(u_i) is a single-track Gray code of length n and period 2^n−2, with equally spaced head positions h_j = c_j·m (c_j ≡ −j·σ^{-1} mod n) that are multiples of m and pairwise distinct mod 2^n−2.
theorem single_track_gray_code_of_necklace_lift (n : ℕ) (hn : n.Prime) (hge : 3 ≤ n)
(hmul : ((2 ^ n - 2) / n) * n = 2 ^ n - 2)
(u : ℕ → ℕ) (σ : ℕ)
(hu : ∀ i < (2 ^ n - 2) / n, u i < 2 ^ n ∧ u i ≠ 0 ∧ u i ≠ 2 ^ n - 1)
(hne : ∀ i < (2 ^ n - 2) / n, ∀ j < (2 ^ n - 2) / n, i ≠ j → ¬ bitword_is_rotation n (u i) (u j))
(hstep : ∀ i < (2 ^ n - 2) / n - 1, ∃ k < n, u i ^^^ u (i + 1) = 2 ^ k)
(hσ : 0 < σ ∧ σ < n)
(hclose : ∃ k < n, (bitword_rotate n)^[σ] (u 0) ^^^ u ((2 ^ n - 2) / n - 1) = 2 ^ k) :
∃ w : ℕ → ℕ,
is_single_track_gray_code n (2 ^ n - 2) w ∧
∃ h : ℕ → ℕ, h 0 = 0 ∧
(∀ t, ∀ j < n, Nat.testBit (w t) j = Nat.testBit (w (t + h j)) 0) ∧
(∀ j < n, ((2 ^ n - 2) / n) ∣ h j) ∧
∀ j₁ < n, ∀ j₂ < n, h j₁ % (2 ^ n - 2) = h j₂ % (2 ^ n - 2) → j₁ = j₂song_aux_matching_cardIn LeanCombinatorics for TCS
The auxiliary matching consists of exactly two edges in each of the k^2 blocks, and different blocks give disjoint sets of corners, hence |N| = 2k^2.
theorem song_aux_matching_card (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k)))) :
(song_aux_matching k M).card = 2 * k ^ 2song_aux_matching_coversIn LeanCombinatorics for TCS
Every vertex of the (2k)x(2k) grid is an endpoint of (exactly) one edge of the auxiliary matching N: in each block the two chosen N-edges cover the four corners.
theorem song_aux_matching_covers (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k)))) :
∀ x : Fin (2 * k) × Fin (2 * k), ∃ e ∈ song_aux_matching k M, x ∈ esong_aux_matching_disjointIn LeanCombinatorics for TCS
For an admissible selection M no edge of the auxiliary matching belongs to M: an N-edge of a block is either horizontal (ab or cd), which is never a unit diagonal because a unit diagonal changes both coordinates, or it is one of the two diagonals of the block, and the branch condition guarantees that the diagonal used is not in M.
theorem song_aux_matching_disjoint (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))))
(hM : is_admissible_diagonal_selection k M) : Disjoint M (song_aux_matching k M)song_aux_matching_perfectIn LeanCombinatorics for TCS
The auxiliary matching pairs up all four corners of every block, so the edges of N form a perfect matching of the grid V_{2k-1}: every vertex is incident with exactly one N-edge.
theorem song_aux_matching_perfect (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k)))) :
∀ x : Fin (2 * k) × Fin (2 * k),
∃! e : Sym2 (Fin (2 * k) × Fin (2 * k)), e ∈ song_aux_matching k M ∧ x ∈ esong_block_infrastructureIn LeanCombinatorics for TCS
The block projection and the corner label are inverse to the block parametrisation: pi(2i+u, 2j+v) = (i,j), the label of (2i+u, 2j+v) is (u,v), and every grid vertex x is the corner of its own block indexed by its label.
theorem song_block_infrastructure (k : ℕ) :
(∀ (i j : Fin k) (u v : Fin 2), song_block_proj k (song_block_vertex k i j u v) = (i, j)) ∧
(∀ (i j : Fin k) (u v : Fin 2), song_corner_label k (song_block_vertex k i j u v) = (u, v)) ∧
(∀ x : Fin (2 * k) × Fin (2 * k),
song_block_vertex k (song_block_proj k x).1 (song_block_proj k x).2
(song_corner_label k x).1 (song_corner_label k x).2 = x)song_component_block_chainIn LeanCombinatorics for TCS
For every connected component C of H there is a nonempty sequence of blocks c_0, ..., c_{n-1} listing the blocks of all vertices of C, such that consecutive entries are distinct, the column never decreases and grows by at most one per step, and the row is monotone (either never decreases, or never increases) with steps of size at most one.
theorem song_component_block_chain (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))))
(hM : is_admissible_diagonal_selection k M) (C : (song_edge_graph k M).ConnectedComponent) :
∃ (n : ℕ) (hn : 1 ≤ n) (c : Fin n → Fin k × Fin k),
(∀ x : Fin (2 * k) × Fin (2 * k), x ∈ C.supp → ∃ i, song_block_proj k x = c i) ∧
(∀ (i : ℕ) (h : i + 1 < n), c ⟨i, by omega⟩ ≠ c ⟨i + 1, h⟩) ∧
(∀ (i : ℕ) (h : i + 1 < n),
(c ⟨i, by omega⟩).2.val ≤ (c ⟨i + 1, h⟩).2.val ∧
(c ⟨i + 1, h⟩).2.val ≤ (c ⟨i, by omega⟩).2.val + 1) ∧
((∀ (i : ℕ) (h : i + 1 < n),
(c ⟨i, by omega⟩).1.val ≤ (c ⟨i + 1, h⟩).1.val ∧
(c ⟨i + 1, h⟩).1.val ≤ (c ⟨i, by omega⟩).1.val + 1) ∨
(∀ (i : ℕ) (h : i + 1 < n),
(c ⟨i + 1, h⟩).1.val ≤ (c ⟨i, by omega⟩).1.val ∧
(c ⟨i, by omega⟩).1.val ≤ (c ⟨i + 1, h⟩).1.val + 1))song_component_projected_walkIn LeanCombinatorics for TCS
For every connected component C of H there are blocks a, b in Fin k × Fin k and a simple path w in P_k □ P_k from a to b whose length is the graph distance between a and b and whose vertex set contains the block of every original vertex of C.
theorem song_component_projected_walk (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))))
(hM : is_admissible_diagonal_selection k M) (C : (song_edge_graph k M).ConnectedComponent) :
∃ (a b : Fin k × Fin k)
(w : ((SimpleGraph.pathGraph k) □ (SimpleGraph.pathGraph k)).Walk a b),
w.IsPath ∧
w.length = ((SimpleGraph.pathGraph k) □ (SimpleGraph.pathGraph k)).dist a b ∧
(∀ x : Fin (2 * k) × Fin (2 * k), x ∈ C.supp → song_block_proj k x ∈ w.support)song_degree_one_countIn LeanCombinatorics for TCS
In the alternating graph H the vertices of degree one are exactly those not covered by the selection M; since M is a matching on the 4k^2 grid vertices this gives exactly 4k^2 - 2|M| vertices of degree one.
theorem song_degree_one_count (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))))
(hM : is_admissible_diagonal_selection k M) :
Set.ncard {v : Fin (2 * k) × Fin (2 * k) |
1 = Set.ncard ((song_edge_graph k M).neighborSet v)} = 4 * k ^ 2 - 2 * M.cardsong_edge_graph_acyclicIn LeanCombinatorics for TCS
The alternating graph H = (V_{2k-1}, M ∪ N) has no cycle; along a cycle the block potential of a type A component (i+j) resp. a type B component (j-i) would be nondecreasing and would strictly increase on the external edges.
theorem song_edge_graph_acyclic (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))))
(hM : is_admissible_diagonal_selection k M) : (song_edge_graph k M).IsAcyclicsong_edge_graph_component_cardIn LeanCombinatorics for TCS
The alternating graph H = (V_{2k-1}, M ∪ N) has exactly 2k^2 - |M| connected components, and each component is a path with at least one edge, hence has exactly two vertices of degree one.
theorem song_edge_graph_component_card (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))))
(hM : is_admissible_diagonal_selection k M) :
Fintype.card (song_edge_graph k M).ConnectedComponent = 2 * k ^ 2 - M.cardsong_edge_graph_degree_le_twoIn LeanCombinatorics for TCS
In the alternating graph H every vertex has at most two neighbours: M is a matching and N is a perfect matching, so a vertex is an endpoint of at most one M-edge and exactly one N-edge, and the two matchings are edge-disjoint.
theorem song_edge_graph_degree_le_two (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))))
(hM : is_admissible_diagonal_selection k M) (v : Fin (2 * k) × Fin (2 * k)) :
Set.ncard ((song_edge_graph k M).neighborSet v) ≤ 2song_edge_graph_min_degree_oneIn LeanCombinatorics for TCS
Every vertex of H = (V_{2k-1}, M ∪ N) has at least one neighbour, since it is covered by the auxiliary matching N.
theorem song_edge_graph_min_degree_one (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))))
(v : Fin (2 * k) × Fin (2 * k)) : 1 ≤ Set.ncard ((song_edge_graph k M).neighborSet v)song_edge_route_type_uniformIn LeanCombinatorics for TCS
For every edge of the alternating graph H the two endpoints have the same route type (both type A or both type B), which is the vertex-level content of Lemma 3.1 of arXiv:2610.33042.
theorem song_edge_route_type_uniform (k : ℕ) (M : Finset (Sym2 (Fin (2 * k) × Fin (2 * k))))
(hM : is_admissible_diagonal_selection k M) {x y : Fin (2 * k) × Fin (2 * k)}
(h : (song_edge_graph k M).Adj x y) : song_route_type k M x = song_route_type k M yspan_erase_of_subset_biUnionIn LeanCombinatorics for TCS
If A ∈ S and A is a subset of the union of S.erase A, then the union of S.erase A equals the union of S.
theorem span_erase_of_subset_biUnion {α : Type*} [DecidableEq α]
{S : Finset (Finset α)} {A : Finset α} (hA : A ∈ S)
(hcov : A ⊆ (S.erase A).biUnion id) :
(S.erase A).biUnion id = S.biUnion idspectral_realization_and_support_of_finite_orthogonal_linearization_coefficientsIn LeanCombinatorics for TCS
Let N ≥ 1 and let a, b, c : Fin (N + 1) → ℝ satisfy condition (2.1): a 0 = 1, b 0 = 0, c 0 = 0, a N = 0, a i + b i + c i = 1 for all i, a i > 0 for i.val < N, and c i > 0 for 0 < i.val. Then the tridiagonal recurrence matrix J has N + 1 distinct real eigenvalues, and there exists a positive orthogonality measure on these N + 1 points with respect to which R_0, ..., R_N are orthogonal (satisfying is_positive_orthogonality_measure). Furthermore, the linearization coefficients g(m, n; k) = [R_m(J)]_{n, k} vanish unless |m - n| ≤ k ≤ min(m + n, N).
theorem spectral_realization_and_support_of_finite_orthogonal_linearization_coefficients
(N : ℕ) (hN : 1 ≤ N) (a b c : Fin (N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 N a b c) :
(∃ (S : Finset ℝ) (w : ℝ → ℝ),
S.card = N + 1 ∧
(∀ x ∈ S, Module.End.HasEigenvalue (Matrix.toLin' (recurrence_matrix N a b c)) x) ∧
is_positive_orthogonality_measure N (recurrence_poly N a b c) S w) ∧
(∀ (m n k : Fin (N + 1)),
linearization_coeff N a b c m n k ≠ 0 →
|(m.val : ℤ) - (n.val : ℤ)| ≤ (k.val : ℤ) ∧ k.val ≤ min (m.val + n.val) N)spherical_mod29_card_le_sevenIn LeanCombinatorics for TCS
The maximum independent set in the Cayley graph on ZMod 29 avoiding connection set {7, 8, 13, 14, 15, 16, 21, 22} has size at most 7.
theorem spherical_mod29_card_le_seven (S : Finset (ZMod 29))
(hdiff : ∀ x ∈ S, ∀ y ∈ S, x ≠ y →
x - y ≠ 7 ∧ x - y ≠ 8 ∧ x - y ≠ 13 ∧ x - y ≠ 14 ∧
x - y ≠ 15 ∧ x - y ≠ 16 ∧ x - y ≠ 21 ∧ x - y ≠ 22) :
S.card ≤ 7spherical_mod29_forbidden_diff_of_hrIn LeanCombinatorics for TCS
Setting z = x and y = x in hr forces x - y to avoid the 8 differences 7, 8, 13, 14, 15, 16, 21, 22 mod 29.
theorem spherical_mod29_forbidden_diff_of_hr (S : Finset (ZMod 29))
(hr : ∀ x y z : ZMod 29, x ∈ S → y ∈ S → z ∈ S → x - 2*y + z ≠ 13 ∧ x - 2*y + z ≠ 14 ∧ x - 2*y + z ≠ 15)
(x y : ZMod 29) (hx : x ∈ S) (hy : y ∈ S) :
x - y ≠ 7 ∧ x - y ≠ 8 ∧ x - y ≠ 13 ∧ x - y ≠ 14 ∧ x - y ≠ 15 ∧ x - y ≠ 16 ∧ x - y ≠ 21 ∧ x - y ≠ 22spherical_mod29_small_subset_disjoint_quadIn LeanCombinatorics for TCS
Any subset of ZMod 29 of size at most 7 satisfying hr is disjoint from some quadratic sequence 7k² + ak + b for k in 0..16.
theorem spherical_mod29_small_subset_disjoint_quad (S : Finset (ZMod 29))
(hcard : S.card ≤ 7)
(hr : ∀ x y z : ZMod 29, x ∈ S → y ∈ S → z ∈ S → x - 2*y + z ≠ 13 ∧ x - 2*y + z ≠ 14 ∧ x - 2*y + z ≠ 15) :
∃ a b : ZMod 29, ∀ k : Fin 17, 7 * (k.val : ZMod 29)^2 + a * k.val + b ∉ Sssyt_exists_standardizationIn LeanCombinatorics for TCS
For any corner-crossed finite diagram D and any semi-standard filling M on D, there exists a standard Young tableau T on D such that M belongs to the standardization block of T.
theorem ssyt_exists_standardization
(D : Finset (ℕ × ℕ)) (hD : is_corner_crossed D)
(M : D → ℕ) (hM : is_semistandard D M) :
∃ T : StandardYoungTableau D, M ∈ standardization_block Tstandardization_block_subset_ssytIn LeanCombinatorics for TCS
For a corner-crossed finite diagram D : Finset (ℕ × ℕ) and any standard Young tableau T on D, every filling M : D → ℕ in standardization_block T satisfies is_semistandard D M.
theorem standardization_block_subset_ssyt
(D : Finset (ℕ × ℕ)) (hD : is_corner_crossed D)
(T : StandardYoungTableau D) (M : D → ℕ) (hM : M ∈ standardization_block T) :
is_semistandard D Mstandardization_blocks_pairwise_disjointIn LeanCombinatorics for TCS
For a corner-crossed finite diagram D : Finset (ℕ × ℕ), if two standard Young tableaux T₁, T₂ on D have a common filling M in their standardization blocks, then T₁ = T₂.
theorem standardization_blocks_pairwise_disjoint
(D : Finset (ℕ × ℕ)) (hD : is_corner_crossed D)
(T₁ T₂ : StandardYoungTableau D) (M : D → ℕ)
(h₁ : M ∈ standardization_block T₁) (h₂ : M ∈ standardization_block T₂) :
T₁ = T₂strict_counterexample_family_canonical_star_boundIn LeanCombinatorics for TCS
For every integer t ≥ 1, the family of partitions of t + 56 obtained by adding t - 1 ones to each partition in A_57 is t-intersecting and has 527254 members, strictly exceeding the size 526823 of the canonical t-star T_{t+56, t}.
theorem strict_counterexample_family_canonical_star_bound (t : ℕ) (ht : 1 ≤ t) :
is_t_intersecting_partition_family t (lifted_partition_family_57 t ht) ∧
(lifted_partition_family_57 t ht).card = 527254 ∧
(canonical_partition_star (t + 56) t).card = 526823 ∧
(canonical_partition_star (t + 56) t).card < (lifted_partition_family_57 t ht).cardstrong_elimination_iff_compatible_and_union_min_of_not_mem_emptyIn LeanCombinatorics for TCS
Let C be a collection of subsets of a finite set V such that the empty set is not in C. Then C satisfies the strong elimination property if and only if C is compatible and every nonempty set in C can be written as a union of sets in collection_min_nonempty C (the minimal nonempty sets in C).
theorem strong_elimination_iff_compatible_and_union_min_of_not_mem_empty {V : Type*} [DecidableEq V]
(C : Finset (Finset V)) (h_empty : ∅ ∉ C) :
has_strong_elimination C ↔
is_compatible_collection C ∧
∀ F ∈ C, F.Nonempty → ∃ U ⊆ collection_min_nonempty C, F = U.biUnion idstrong_elimination_of_compatible_and_union_minIn LeanCombinatorics for TCS
If a finite collection C of finite sets does not contain the empty set, is compatible, and each of its nonempty sets is a union of sets in collection_min_nonempty C, then C has the strong elimination property.
theorem strong_elimination_of_compatible_and_union_min {V : Type*} [DecidableEq V]
{C : Finset (Finset V)} (h_empty : ∅ ∉ C) (h_compat : is_compatible_collection C)
(h_union : ∀ F ∈ C, F.Nonempty → ∃ U ⊆ collection_min_nonempty C, F = U.biUnion id) :
has_strong_elimination Csum_bias_sq_le_of_card_eq_two_pow_density_shortIn LeanCombinatorics for TCS
Let $F \subseteq (\mathrm{Fin}\ n \to \mathrm{Bool})$ with $|F| = 2^m$, where $m \le n$ and $n - m \le 4$ (so the density of $F$ is at least $2^{-4}$). Then the coordinate biases $b_i = 1 - 2p_i/|F|$ satisfy $\sum_i b_i^2 \le n - m$; equivalently the level-1 Fourier weight of the indicator of $F$ is at most $(n-m)/4 \cdot \mu^2$-scale, i.e. $W_1(1_F) \le \frac{n-m}{4}$, and for $n - m = 4$ exactly $W_1(1_F) \le 1/64$.
theorem sum_bias_sq_le_of_card_eq_two_pow_density_short
(n m : ℕ) (hm : m ≤ n) (hclose : n - m ≤ 4) (F : Finset (Fin n → Bool))
(hcard : F.card = 2 ^ m) :
∑ i : Fin n,
((1 : ℝ) - 2 * ((F.filter (fun x => x i = true)).card : ℝ) / (F.card : ℝ)) ^ 2 ≤ (n : ℝ) - msum_diagonal_kernel_mul_mulIn LeanCombinatorics for TCS
For any finite set F with decidable equality, scalar lambda : ℝ, kernel K : α → α → ℝ satisfying K x y = (if x = y then lambda else 0) for all x, y ∈ F, and function z : α → ℝ, the double sum ∑ x ∈ F, ∑ y ∈ F, K x y * z x * z y equals lambda * ∑ x ∈ F, (z x)^2.
theorem sum_diagonal_kernel_mul_mul {α : Type*} [DecidableEq α] (F : Finset α)
(K : α → α → ℝ) (lambda : ℝ)
(hK : ∀ x ∈ F, ∀ y ∈ F, K x y = if x = y then lambda else 0)
(z : α → ℝ) :
(∑ x ∈ F, ∑ y ∈ F, K x y * z x * z y) = lambda * ∑ x ∈ F, (z x) ^ 2sum_hamming_kernel_mul_mulIn LeanCombinatorics for TCS
For any natural number n, finite subset F ⊆ ℝ^n, coefficient family k : Finset (Fin n) → ℝ, and function z : (Fin n → ℝ) → ℝ, the double sum ∑ x ∈ F, ∑ y ∈ F, (∑ T, k T * (∏ i ∈ T, x i) * (∏ i ∈ T, y i)) * z x * z y equals ∑ T, k T * (∑ x ∈ F, z x * (∏ i ∈ T, x i))^2.
theorem sum_hamming_kernel_mul_mul {n : ℕ} (F : Finset (Fin n → ℝ))
(k : Finset (Fin n) → ℝ) (z : (Fin n → ℝ) → ℝ) :
(∑ x ∈ F, ∑ y ∈ F, (∑ T : Finset (Fin n), k T * (∏ i ∈ T, x i) * (∏ i ∈ T, y i)) * z x * z y) =
∑ T : Finset (Fin n), k T * (∑ x ∈ F, z x * (∏ i ∈ T, x i)) ^ 2sum_ordered_pair_sum_countIn LeanCombinatorics for TCS
Double counting: the restricted representation counts ν_A(x), summed over all x in G, equal |A|(|A| - 1), the number of ordered pairs of distinct elements of A.
theorem sum_ordered_pair_sum_count {G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G] (A : Finset G) : ∑ x : G, orderedPairSumCount A x = A.card * (A.card - 1)sumset_collision_iff_null_vectorIn LeanCombinatorics for TCS
Let k ≥ 3 and h ≥ 2, and let A : Fin k → ℤ. There exist distinct x, y ∈ sumset_sum_vectors h k such that dotProduct x A = dotProduct y A if and only if there exists d ∈ sumset_null_vectors h k such that dotProduct d A = 0.
theorem sumset_collision_iff_null_vector
(k h : ℕ) (hk : 3 ≤ k) (hh : 2 ≤ h) (A : Fin k → ℤ) :
(∃ x ∈ sumset_sum_vectors h k, ∃ y ∈ sumset_sum_vectors h k, x ≠ y ∧ dotProduct x A = dotProduct y A) ↔
∃ d ∈ sumset_null_vectors h k, dotProduct d A = 0sumset_collision_of_null_vectorIn LeanCombinatorics for TCS
Let k ≥ 3, h ≥ 2, and A : Fin k → ℤ. If there exists d ∈ sumset_null_vectors h k such that dotProduct d A = 0, then there exist distinct x, y ∈ sumset_sum_vectors h k such that dotProduct x A = dotProduct y A.
theorem sumset_collision_of_null_vector
(k h : ℕ) (hk : 3 ≤ k) (hh : 2 ≤ h) (A : Fin k → ℤ)
(h_null : ∃ d ∈ sumset_null_vectors h k, dotProduct d A = 0) :
∃ x ∈ sumset_sum_vectors h k, ∃ y ∈ sumset_sum_vectors h k, x ≠ y ∧ dotProduct x A = dotProduct y Asumset_null_vector_of_collisionIn LeanCombinatorics for TCS
Let k ≥ 3, h ≥ 2, and A : Fin k → ℤ. If there exist distinct x, y ∈ sumset_sum_vectors h k such that dotProduct x A = dotProduct y A, then there exists d ∈ sumset_null_vectors h k such that dotProduct d A = 0.
theorem sumset_null_vector_of_collision
(k h : ℕ) (hk : 3 ≤ k) (hh : 2 ≤ h) (A : Fin k → ℤ)
(h_coll : ∃ x ∈ sumset_sum_vectors h k, ∃ y ∈ sumset_sum_vectors h k, x ≠ y ∧ dotProduct x A = dotProduct y A) :
∃ d ∈ sumset_null_vectors h k, dotProduct d A = 0sumset_rep_count_k3_h2_mul3_add1_upper_boundIn LeanCombinatorics for TCS
For sufficiently large m, the normalized representation count along q = 3m + 1 is at most 7/10.
theorem sumset_rep_count_k3_h2_mul3_add1_upper_bound :
∃ M : ℕ, ∀ m : ℕ, M ≤ m →
(sumset_rep_count 2 3 (3 * m + 1) (3 * m + 1 : ℤ) : ℝ) / ((3 * (m : ℝ) + 1) ^ 2) ≤ (7 : ℝ) / 10sumset_rep_count_k3_h2_mul3_lower_boundIn LeanCombinatorics for TCS
For sufficiently large m, the normalized representation count along q = 3m is at least 9/10.
theorem sumset_rep_count_k3_h2_mul3_lower_bound :
∃ M : ℕ, ∀ m : ℕ, M ≤ m →
(9 : ℝ) / 10 ≤ (sumset_rep_count 2 3 (3 * m) (3 * m : ℤ) : ℝ) / ((3 * (m : ℝ)) ^ 2)sunflower_free_reduce_to_spinyIn LeanCombinatorics for TCS
Let r ≥ 2 be a natural number and let α have decidable equality. Let S be a finite collection of finite subsets of α containing no r-flower (i.e. no subfamily F ⊆ S with F.card = r is a sunflower with any kernel C). Then there exists a subfamily S' ⊆ S such that S'.biUnion id = S.biUnion id, S' contains no r-flower, and S' is spiny (IsSpiny S').
theorem sunflower_free_reduce_to_spiny {α : Type*} [DecidableEq α]
(r : ℕ) (hr : 2 ≤ r) (S : Finset (Finset α))
(hfree : ¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) :
∃ S' ⊆ S, S'.biUnion id = S.biUnion id ∧
(¬ ∃ F ⊆ S', F.card = r ∧ ∃ C, IsSunflower F C) ∧
IsSpiny S'sunflower_free_subfamilyIn LeanCombinatorics for TCS
Any subfamily S' of an r-flower-free finite family of finite sets S is also r-flower-free: if S contains no r-element subfamily that is a sunflower with some kernel C, then neither does S'.
theorem sunflower_free_subfamily {α : Type*} [DecidableEq α] {r : ℕ}
{S S' : Finset (Finset α)} (hsub : S' ⊆ S)
(hfree : ¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) :
¬ ∃ F ⊆ S', F.card = r ∧ ∃ C, IsSunflower F Csup_poisson_of_small_meanIn LeanCombinatorics for TCS
If for every fixed C₀ > 0 the two region bounds hold eventually in n for all k with μ_n(k) ≤ C₀, and P is nondecreasing in k, μ nonincreasing and halving, μ → 0 in k for fixed n, and 0 ≤ P ≤ 1, 0 ≤ μ, then sup_k |P_n(k) − exp(−μ_n(k))| → 0.
theorem sup_poisson_of_small_mean (μ P : ℕ → ℕ → ℝ)
(hPmono : ∀ n k, P n k ≤ P n (k+1))
(hμmono : ∀ n k, μ n (k+1) ≤ μ n k)
(hμhalf : ∀ n k, μ n k / 2 ≤ μ n (k+1))
(hμtendsto : ∀ n, Filter.Tendsto (fun k => μ n k) Filter.atTop (nhds 0))
(hP01 : ∀ n k, P n k ∈ Set.Icc (0:ℝ) 1)
(hμ0 : ∀ n k, 0 ≤ μ n k)
(hupper : ∀ C₀ : ℝ, 0 < C₀ → ∀ᶠ n in Filter.atTop, ∀ k, μ n k ≤ C₀ →
P n k ≤ Real.exp (-(μ n k)) + 1/C₀)
(hlower : ∀ C₀ : ℝ, 0 < C₀ → ∀ᶠ n in Filter.atTop, ∀ k, μ n k ≤ C₀ →
Real.exp (-(μ n k)) ≤ P n k + 1/C₀) :
Filter.Tendsto (fun n : ℕ => ⨆ k : ℕ, |P n k - Real.exp (-(μ n k))|)
Filter.atTop (nhds 0)support_graph_density_bound_ramseyIn LeanCombinatorics for TCS
Given a finite simple graph G on a type V, and natural numbers r, s, t with 1 ≤ t, t ≤ s, and s ≤ r, let α : ℝ = (r.choose t : ℝ) / (s.choose t : ℝ). If a natural number N satisfies (SimpleGraph.extremalNumber N G : ℝ) < (N.choose 2 : ℝ) / α, then set_coloring_ramsey_number G r s t ≤ N. Consequently, if for a real number c, (SimpleGraph.extremalNumber N G : ℝ) ≤ c * (N : ℝ) / 2 holds for all natural numbers N, then set_coloring_ramsey_number G r s t ≤ ⌊α * c⌋₊ + 2.
open scoped Classical in
theorem support_graph_density_bound_ramsey
{V : Type*} [Fintype V] (G : SimpleGraph V)
(r s t : ℕ) (hr : 1 ≤ t) (hs : t ≤ s) (hrs : s ≤ r) :
let α : ℝ := (r.choose t : ℝ) / (s.choose t : ℝ)
(∀ N : ℕ, (SimpleGraph.extremalNumber N G : ℝ) < (N.choose 2 : ℝ) / α →
set_coloring_ramsey_number G r s t ≤ N) ∧
(∀ c : ℝ, (∀ N : ℕ, (SimpleGraph.extremalNumber N G : ℝ) ≤ c * (N : ℝ) / 2) →
set_coloring_ramsey_number G r s t ≤ ⌊α * c⌋₊ + 2)support_graph_edge_sumIn LeanCombinatorics for TCS
Given natural numbers N, r, s, t, and an edge-labeling ϕ : (⊤ : SimpleGraph (Fin N)).edgeSet → Finset (Fin r) such that each edge receives a finite subset of cardinality s, the sum over all finite subsets T ∈ (Finset.univ : Finset (Fin r)).powersetCard t of the number of edges in support_graph ϕ T equals s.choose t * N.choose 2.
open scoped Classical in
lemma support_graph_edge_sum {N r s t : ℕ}
(ϕ : (⊤ : SimpleGraph (Fin N)).edgeSet → Finset (Fin r))
(hϕ : ∀ e, (ϕ e).card = s) :
∑ T ∈ (Finset.univ : Finset (Fin r)).powersetCard t,
(support_graph ϕ T).edgeFinset.card = s.choose t * N.choose 2surjection_number_log_supermodularIn LeanCombinatorics for TCS
For any natural numbers a ≤ b and s ≤ t, the surjection numbers satisfy U_a(t) U_b(s) ≤ U_a(s) U_b(t), expressing the log-supermodularity of surjection numbers.
theorem surjection_number_log_supermodular {a b s t : ℕ} (hab : a ≤ b) (hst : s ≤ t) :
surjection_number a t * surjection_number b s ≤
surjection_number a s * surjection_number b tsurjection_number_mul_le_mul_of_zero_sIn LeanCombinatorics for TCS
For any natural numbers a ≤ b and any t, surjection numbers satisfy U_a(t) U_b(0) ≤ U_a(0) U_b(t).
theorem surjection_number_mul_le_mul_of_zero_s {a b t : ℕ} (hab : a ≤ b) :
surjection_number a t * surjection_number b 0 ≤
surjection_number a 0 * surjection_number b tsurjection_number_succIn LeanCombinatorics for TCS
For any natural numbers l and t, surjection numbers satisfy the recurrence U_{l+1}(t+1) = (l+1) (U_{l+1}(t) + U_l(t)).
theorem surjection_number_succ (l t : ℕ) :
surjection_number (l + 1) (t + 1) =
(l + 1) * (surjection_number (l + 1) t + surjection_number l t)symmetric_counterexample_eight_min_three_bentIn LeanCombinatorics for TCS
The minimum number of bent functions on (Fin 8 → ZMod 2) whose sum is the eight-variable symmetric Boolean function symmetric_counterexample_func_eight is exactly three: there exist three bent functions b₁, b₂, b₃ on (Fin 8 → ZMod 2) whose sum b₁ + b₂ + b₃ equals symmetric_counterexample_func_eight, no two bent functions on (Fin 8 → ZMod 2) sum to symmetric_counterexample_func_eight, and symmetric_counterexample_func_eight is not bent.
theorem symmetric_counterexample_eight_min_three_bent :
(∃ b₁ b₂ b₃ : (Fin 8 → ZMod 2) → ZMod 2,
is_bent b₁ ∧ is_bent b₂ ∧ is_bent b₃ ∧ b₁ + b₂ + b₃ = symmetric_counterexample_func_eight) ∧
(¬ ∃ b₁ b₂ : (Fin 8 → ZMod 2) → ZMod 2,
is_bent b₁ ∧ is_bent b₂ ∧ b₁ + b₂ = symmetric_counterexample_func_eight) ∧
¬ is_bent symmetric_counterexample_func_eightsymmetric_counterexample_eight_not_sum_of_two_bentIn LeanCombinatorics for TCS
The eight-variable symmetric Boolean function F_8 cannot be decomposed into a sum of two bent functions.
theorem symmetric_counterexample_eight_not_sum_of_two_bent :
¬ ∃ b₁ b₂ : (Fin 8 → ZMod 2) → ZMod 2,
is_bent b₁ ∧ is_bent b₂ ∧ b₁ + b₂ = symmetric_counterexample_func_eightsymmetric_counterexample_eight_sum_three_bentIn LeanCombinatorics for TCS
The eight-variable symmetric Boolean function symmetric_counterexample_func_eight can be written as the sum of three bent functions on (Fin 8 → ZMod 2): there exist bent functions b₁, b₂, b₃ on (Fin 8 → ZMod 2) such that b₁ + b₂ + b₃ = symmetric_counterexample_func_eight.
theorem symmetric_counterexample_eight_sum_three_bent :
∃ b₁ b₂ b₃ : (Fin 8 → ZMod 2) → ZMod 2,
is_bent b₁ ∧ is_bent b₂ ∧ is_bent b₃ ∧ b₁ + b₂ + b₃ = symmetric_counterexample_func_eightsymmetric_counterexample_has_degree_leIn LeanCombinatorics for TCS
For any integer n = 2^k ≥ 8, the symmetric Boolean function symmetric_counterexample_func n has algebraic degree at most n / 2.
theorem symmetric_counterexample_has_degree_le (n : ℕ) (k : ℕ) (hn : n = 2 ^ k) (hn8 : 8 ≤ n) : has_degree_le (symmetric_counterexample_func n) (n / 2)
symmetric_counterexample_infinite_familyIn LeanCombinatorics for TCS
For every integer n = 2^k ≥ 8, the symmetric Boolean function F_n = 1 + σ₂ + σ₄ + ⋯ + σ_{n/2} on (Fin n → ZMod 2) has algebraic degree n / 2 and cannot be written as the sum of at most two bent functions in n variables: it has algebraic degree at most n / 2, does not have algebraic degree strictly less than n / 2, cannot be written as the sum of two bent functions, is not bent, and is not zero.
theorem symmetric_counterexample_infinite_family (n : ℕ) (k : ℕ) (hn : n = 2 ^ k) (hn8 : 8 ≤ n) : has_degree_le (symmetric_counterexample_func n) (n / 2) ∧ (∀ d < n / 2, ¬ has_degree_le (symmetric_counterexample_func n) d) ∧ (¬ ∃ b₁ b₂ : (Fin n → ZMod 2) → ZMod 2, is_bent b₁ ∧ is_bent b₂ ∧ b₁ + b₂ = symmetric_counterexample_func n) ∧ ¬ is_bent (symmetric_counterexample_func n) ∧ symmetric_counterexample_func n ≠ 0
symmetric_counterexample_not_bentIn LeanCombinatorics for TCS
For any integer n = 2^k ≥ 8, the symmetric Boolean function symmetric_counterexample_func n on (Fin n → ZMod 2) is not bent.
theorem symmetric_counterexample_not_bent (n : ℕ) (k : ℕ) (hn : n = 2 ^ k) (hn8 : 8 ≤ n) : ¬ is_bent (symmetric_counterexample_func n)
symmetric_counterexample_not_has_degree_ltIn LeanCombinatorics for TCS
For any integer n = 2^k ≥ 8 and any d < n / 2, the symmetric Boolean function symmetric_counterexample_func n does not have algebraic degree at most d.
theorem symmetric_counterexample_not_has_degree_lt (n : ℕ) (k : ℕ) (hn : n = 2 ^ k) (hn8 : 8 ≤ n) : ∀ d < n / 2, ¬ has_degree_le (symmetric_counterexample_func n) d
symmetric_counterexample_not_sum_of_two_bentIn LeanCombinatorics for TCS
For any integer n = 2^k ≥ 8, the symmetric Boolean function symmetric_counterexample_func n on (Fin n → ZMod 2) cannot be written as the sum of two bent functions.
theorem symmetric_counterexample_not_sum_of_two_bent (n : ℕ) (k : ℕ) (hn : n = 2 ^ k) (hn8 : 8 ≤ n) : ¬ ∃ b₁ b₂ : (Fin n → ZMod 2) → ZMod 2, is_bent b₁ ∧ is_bent b₂ ∧ b₁ + b₂ = symmetric_counterexample_func n
symmetric_linearization_coeff_evenIn LeanCombinatorics for TCS
Let N ≥ 2, and let a, c : Fin (2 * N + 1) → ℝ satisfy condition (2.1) of size 2N with b = fun _ => 0. Then for all ma, na, ka : Fin (N + 1), the linearization coefficient linearization_coeff (2 * N) a (fun _ => 0) c at indices ⟨2 * ma.val, _⟩, ⟨2 * na.val, _⟩, ⟨2 * ka.val, _⟩ equals linearization_coeff N (even_component_a N a) (even_component_b N a c) (even_component_c N a c) ma na ka.
theorem symmetric_linearization_coeff_even
(N : ℕ) (hN : 2 ≤ N) (a c : Fin (2 * N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 (2 * N) a (fun _ => 0) c)
(ma na ka : Fin (N + 1)) :
linearization_coeff (2 * N) a (fun _ => 0) c
⟨2 * ma.val, by omega⟩ ⟨2 * na.val, by omega⟩ ⟨2 * ka.val, by omega⟩ =
linearization_coeff N (even_component_a N a) (even_component_b N a c) (even_component_c N a c)
ma na kasymmetric_linearization_coeff_odd_sum_zeroIn LeanCombinatorics for TCS
Let N ≥ 2, and let a, c : Fin (2 * N + 1) → ℝ satisfy condition (2.1) of size 2N with b = fun _ => 0. Then for all m, n, k : Fin (2 * N + 1) with (m.val + n.val + k.val) % 2 = 1, the linearization coefficient linearization_coeff (2 * N) a (fun _ => 0) c m n k = 0.
theorem symmetric_linearization_coeff_odd_sum_zero
(N : ℕ) (hN : 2 ≤ N) (a c : Fin (2 * N + 1) → ℝ)
(hrec : satisfies_recurrence_2_1 (2 * N) a (fun _ => 0) c)
(m n k : Fin (2 * N + 1))
(hodd : (m.val + n.val + k.val) % 2 = 1) :
linearization_coeff (2 * N) a (fun _ => 0) c m n k = 0ternary_affine_hyperplane_line_unique_hitIn LeanCombinatorics for TCS
If the normal vector a has all coordinates nonzero, then every axis-parallel line of direction i meets the affine hyperplane {x | ∑ a j * x j = b} in exactly one point.
theorem ternary_affine_hyperplane_line_unique_hit (m : ℕ) (a : Fin m → ZMod 3) (ha : ∀ i, a i ≠ 0) (b : ZMod 3) (p : Fin m → ZMod 3) (i : Fin m) : ∃! t : ZMod 3, Function.update p i t ∈ ternary_affine_hyperplane m a b
ternary_affine_hyperplanes_meet_card_ge_twoIn LeanCombinatorics for TCS
Two affine hyperplanes of (Fin m → ZMod 3), m ≥ 3, one of them with all coordinates of its normal nonzero, that have a common point have at least two common points: the intersection of two affine hyperplanes is never a single point.
theorem ternary_affine_hyperplanes_meet_card_ge_two (m : ℕ) (hm : 3 ≤ m) (a1 a2 : Fin m → ZMod 3) (ha1 : ∀ i, a1 i ≠ 0) (b1 b2 : ZMod 3) (h : (ternary_affine_hyperplane m a1 b1 ∩ ternary_affine_hyperplane m a2 b2).Nonempty) : 2 ≤ (ternary_affine_hyperplane m a1 b1 ∩ ternary_affine_hyperplane m a2 b2).card
ternary_axis_line_cardIn LeanCombinatorics for TCS
Every axis-parallel ternary line has exactly three points: (ternary_axis_line n i c).card = 3.
theorem ternary_axis_line_card (n : ℕ) (i : Fin n) (c : Fin n → ZMod 3) : (ternary_axis_line n i c).card = 3
ternary_cover_excess_one_missed_lines_concurrentIn LeanCombinatorics for TCS
Let B be a ternary line cover and Γ ⊆ B a sub-finset with exactly one point more in B than in Γ. Then B \ Γ is a single point q, and every axis-parallel line that is disjoint from Γ contains q — i.e. all lines missed by the sub-cover Γ are concurrent at q.
theorem ternary_cover_excess_one_missed_lines_concurrent (n : ℕ) (B Γ : Finset (Fin n → ZMod 3)) (hB : is_ternary_line_cover n B) (hΓsub : Γ ⊆ B) (hcard : B.card = Γ.card + 1) : ∃ q : Fin n → ZMod 3, B \ Γ = {q} ∧ ∀ (j : Fin n) (p : Fin n → ZMod 3), Disjoint (ternary_axis_line n j p) Γ → q ∈ ternary_axis_line n j pternary_hyperplanes_third_cover_contradictionIn LeanCombinatorics for TCS
Let m ≥ 3 and let H1, H2 be affine hyperplanes of (Fin m → ZMod 3) with all normal coordinates nonzero. Let Q be a set of 3^(m-1) + 1 points such that every point lies in H1, or in H2, or in Q, and such that every point of Q that lies on H1 or H2 has a private axis-parallel line inside Q. Then contradiction.
theorem ternary_hyperplanes_third_cover_contradiction (m : ℕ) (hm : 3 ≤ m) (a1 a2 : Fin m → ZMod 3) (ha1 : ∀ i, a1 i ≠ 0) (ha2 : ∀ i, a2 i ≠ 0) (b1 b2 : ZMod 3) (Q : Finset (Fin m → ZMod 3)) (hQcard : Q.card = 3 ^ (m - 1) + 1) (hunion : ∀ y : Fin m → ZMod 3, y ∈ ternary_affine_hyperplane m a1 b1 ∨ y ∈ ternary_affine_hyperplane m a2 b2 ∨ y ∈ Q) (hess : ∀ z : Fin m → ZMod 3, (z ∈ ternary_affine_hyperplane m a1 b1 ∨ z ∈ ternary_affine_hyperplane m a2 b2) → z ∈ Q → ∃ i : Fin m, ternary_axis_line m i z ∩ Q = {z}) : Falseternary_line_cover_fiber_excessIn LeanCombinatorics for TCS
For a ternary line cover B and any direction i, summing |B ∩ L| - 1 over the 3^(n-1) lines L of direction i gives |B| - 3^(n-1): the excess of B is the same number in every direction.
theorem ternary_line_cover_fiber_excess (n : ℕ) (i : Fin n) (B : Finset (Fin n → ZMod 3)) (hB : is_ternary_line_cover n B) : ∑ c ∈ (Finset.univ.filter (fun c : Fin n → ZMod 3 => c i = 0)), ((ternary_axis_line n i c ∩ B).card - 1) = B.card - 3 ^ (n - 1)
ternary_line_cover_min_card_is_hyperplaneIn LeanCombinatorics for TCS
Every ternary line cover of minimum size 3^(n-1) is an affine hyperplane with all coordinates of the normal nonzero (minimality is not assumed).
theorem ternary_line_cover_min_card_is_hyperplane (n : ℕ) (hn : 1 ≤ n) (B : Finset (Fin n → ZMod 3)) (hB : is_ternary_line_cover n B) (hcard : B.card = 3 ^ (n - 1)) : ∃ (a : Fin n → ZMod 3) (ha : ∀ i, a i ≠ 0) (b : ZMod 3), B = ternary_affine_hyperplane n a b
ternary_minimal_line_cover_erase_characterizationIn LeanCombinatorics for TCS
A finite set B is an inclusion-minimal ternary line cover if and only if B is a ternary line cover and deleting any one of its points destroys the covering property.
theorem ternary_minimal_line_cover_erase_characterization (n : ℕ) (B : Finset (Fin n → ZMod 3)) : is_minimal_ternary_line_cover n B ↔ is_ternary_line_cover n B ∧ ∀ p ∈ B, ¬ is_ternary_line_cover n (B.erase p)
ternary_minimal_line_cover_first_excess_eq_repairIn LeanCombinatorics for TCS
For every integer n ≥ 6, every inclusion-minimal ternary line cover B in (Fin n → ZMod 3) of cardinality 3^(n - 1) + n - 1 is a single-point repair ternary_single_point_repair n (ternary_affine_hyperplane n a b) p ε for some affine hyperplane and offset vector ε with all coordinates nonzero.
theorem ternary_minimal_line_cover_first_excess_eq_repair (n : ℕ) (hn : 6 ≤ n) (B : Finset (Fin n → ZMod 3)) (hB : is_minimal_ternary_line_cover n B) (hcard : B.card = 3 ^ (n - 1) + n - 1) : ∃ (a : Fin n → ZMod 3) (ha : ∀ i, a i ≠ 0) (b : ZMod 3), let H := ternary_affine_hyperplane n a b; ∃ (p : Fin n → ZMod 3) (hp : p ∈ H) (ε : Fin n → ZMod 3) (hε : ∀ i, ε i ≠ 0), B = ternary_single_point_repair n H p ε
ternary_minimal_line_cover_first_gap_emptyIn LeanCombinatorics for TCS
For every integer n ≥ 6, there does not exist an inclusion-minimal ternary line cover B in (Fin n → ZMod 3) with cardinality strictly between 3^(n - 1) and 3^(n - 1) + n - 1.
theorem ternary_minimal_line_cover_first_gap_empty (n : ℕ) (hn : 6 ≤ n) (B : Finset (Fin n → ZMod 3)) (hB : is_minimal_ternary_line_cover n B) (hlo : 3 ^ (n - 1) < B.card) (hhi : B.card < 3 ^ (n - 1) + n - 1) : False
ternary_minimal_line_cover_private_lineIn LeanCombinatorics for TCS
A finite set B is an inclusion-minimal ternary line cover if and only if B is a cover and every point p of B has a private axis-parallel line: a direction i in which the line of direction i through p meets B exactly in p.
theorem ternary_minimal_line_cover_private_line (n : ℕ) (B : Finset (Fin n → ZMod 3)) : is_minimal_ternary_line_cover n B ↔ is_ternary_line_cover n B ∧ ∀ p ∈ B, ∃ i : Fin n, ternary_axis_line n i p ∩ B = {p}ternary_minimal_line_cover_slice_reductionIn LeanCombinatorics for TCS
For n ≥ 6, an inclusion-minimal ternary line cover B with 3^(n-1) < |B| < 3^(n-1) + n - 1 slices into three covers S_0, S_1, S_2 of (Fin (n-1) → ZMod 3) — the tails of the points with first coordinate 0, 1, 2 — such that the union is everything, the total cardinality is |B| (hence still in the window), and every point occurring in at least two slices has a private line inside each slice containing it.
theorem ternary_minimal_line_cover_slice_reduction (n : ℕ) (hn : 6 ≤ n) (B : Finset (Fin n → ZMod 3)) (hB : is_minimal_ternary_line_cover n B) (hlo : 3 ^ (n - 1) < B.card) (hhi : B.card < 3 ^ (n - 1) + n - 1) : ∃ S : ZMod 3 → Finset (Fin (n - 1) → ZMod 3), (∀ c, is_ternary_line_cover (n - 1) (S c)) ∧ (∀ y : Fin (n - 1) → ZMod 3, y ∈ S 0 ∨ y ∈ S 1 ∨ y ∈ S 2) ∧ 3 ^ (n - 1) < (∑ c : ZMod 3, (S c).card) ∧ (∑ c : ZMod 3, (S c).card) < 3 ^ (n - 1) + n - 1 ∧ (∀ y : Fin (n - 1) → ZMod 3, 2 ≤ (Finset.univ.filter (fun c : ZMod 3 => y ∈ S c)).card → ∀ c, y ∈ S c → ∃ i : Fin (n - 1), ternary_axis_line (n - 1) i y ∩ S c = {y})ternary_three_slices_excess_one_rigidityIn LeanCombinatorics for TCS
For n ≥ 6 there are no three ternary line covers S_0, S_1, S_2 of (Fin (n-1) → ZMod 3) with union everything, total cardinality exactly 3^(n-1) + 1, and such that every point lying in at least two slices has a private line inside each slice containing it. Together with the slice reduction this says: there is no inclusion-minimal ternary line cover of size 3^(n-1) + 1.
theorem ternary_three_slices_excess_one_rigidity (n : ℕ) (hn : 6 ≤ n) (S : ZMod 3 → Finset (Fin (n - 1) → ZMod 3)) (hcov : ∀ c, is_ternary_line_cover (n - 1) (S c)) (hunion : ∀ y : Fin (n - 1) → ZMod 3, y ∈ S 0 ∨ y ∈ S 1 ∨ y ∈ S 2) (hlo : 3 ^ (n - 1) < (∑ c : ZMod 3, (S c).card)) (hhi : (∑ c : ZMod 3, (S c).card) < 3 ^ (n - 1) + 2) (hess : ∀ y : Fin (n - 1) → ZMod 3, 2 ≤ (Finset.univ.filter (fun c : ZMod 3 => y ∈ S c)).card → ∀ c, y ∈ S c → ∃ i : Fin (n - 1), ternary_axis_line (n - 1) i y ∩ S c = {y}) : Falseternary_three_slices_small_excess_rigidityIn LeanCombinatorics for TCS
For n ≥ 6 there are no three ternary line covers S_0, S_1, S_2 of (Fin (n-1) → ZMod 3) with union everything, total cardinality in the open window (3^(n-1), 3^(n-1) + n - 1), and such that every point lying in at least two slices has a private line inside each slice containing it.
theorem ternary_three_slices_small_excess_rigidity (n : ℕ) (hn : 6 ≤ n) (S : ZMod 3 → Finset (Fin (n - 1) → ZMod 3)) (hcov : ∀ c, is_ternary_line_cover (n - 1) (S c)) (hunion : ∀ y : Fin (n - 1) → ZMod 3, y ∈ S 0 ∨ y ∈ S 1 ∨ y ∈ S 2) (hlo : 3 ^ (n - 1) < (∑ c : ZMod 3, (S c).card)) (hhi : (∑ c : ZMod 3, (S c).card) < 3 ^ (n - 1) + n - 1) (hess : ∀ y : Fin (n - 1) → ZMod 3, 2 ≤ (Finset.univ.filter (fun c : ZMod 3 => y ∈ S c)).card → ∀ c, y ∈ S c → ∃ i : Fin (n - 1), ternary_axis_line (n - 1) i y ∩ S c = {y}) : Falsetetrahedron_boundary_is_cohen_macaulayIn LeanCombinatorics for TCS
The boundary of a tetrahedron, the complex with the four triangular facets {0,1,2}, {0,1,3}, {0,2,3}, {1,2,3} on Fin 4, is Cohen-Macaulay over every field: it is pure of dimension 2, its 1-skeleton and all its vertex links are complete graphs, and it is a 2-sphere so H_1 = 0.
theorem tetrahedron_boundary_is_cohen_macaulay (k : Type*) [Field k] :
is_cohen_macaulay_two_complex ({ {0, 1, 2}, {0, 1, 3}, {0, 2, 3}, {1, 2, 3} } : Finset (Finset (Fin 4))) kthree_ap_free_delta_eq_zeroIn LeanCombinatorics for TCS
If S is a 3AP-free subset of ZMod p, and a, a + δ, a - δ all belong to S, then δ = 0.
theorem three_ap_free_delta_eq_zero {p : ℕ} (S : Set (ZMod p)) (hS : ThreeAPFree S)
(a δ : ZMod p) (ha : a ∈ S) (hplus : a + δ ∈ S) (hminus : a - δ ∈ S) :
δ = 0three_ap_free_shift_distinctIn LeanCombinatorics for TCS
In an additive commutative group, if a subset S is 3-AP free, b_i = a_i + D for all i, and the three differences b_1 - a_0, b_2 - a_0, and b_0 - a_2 all belong to S, then a_0 = a_1 implies a_0 = a_2.
theorem three_ap_free_shift_distinct {α : Type*} [AddCommGroup α] (S : Set α)
(hS : ThreeAPFree S) (a b : Fin 3 → α) (D : α)
(hb : ∀ i, b i = a i + D)
(hS1 : b 1 - a 0 ∈ S)
(hS2 : b 2 - a 0 ∈ S)
(hS3 : b 0 - a 2 ∈ S)
(ha : a 0 = a 1) :
a 0 = a 2three_k4_common_list_colorable_threeIn LeanCombinatorics for TCS
The pair of loopless matroids (three_k4_matroid, three_k4_partition_matroid) with common chromatic number 2 has common list chromatic number at most 3 (hence exactly 3). This settles the concrete counterexample instance of Question 3.1.
theorem three_k4_common_list_colorable_three :
matroid_common_list_colorable three_k4_matroid three_k4_partition_matroid 3three_terms_mem_restricted_sumsetIn LeanCombinatorics for TCS
A sum a + b + c of three pairwise distinct elements of A belongs to the three-fold restricted sumset of A.
theorem three_terms_mem_restricted_sumset {G : Type*} [AddCommGroup G] [DecidableEq G] {A : Finset G} {a b c : G} (ha : a ∈ A) (hb : b ∈ A) (hc : c ∈ A) (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c) : a + b + c ∈ restrictedSumset A 3three_uniform_four_flower_free_base_edges_boundIn LeanCombinatorics for TCS
In any 3-uniform 4-flower-free hypergraph S on Fin 39 with span Fin 39, the number of edges containing only vertices of degree at least 2 is at most 3.
theorem three_uniform_four_flower_free_base_edges_bound
(S : Finset (Finset (Fin 39)))
(h3 : ∀ s ∈ S, s.card = 3)
(hspan : S.biUnion id = Finset.univ)
(hfree : ¬ ∃ F ⊆ S, F.card = 4 ∧ ∃ C, IsSunflower F C) :
(S.filter (fun s => ∀ x ∈ s, 2 ≤ (S.filter (x ∈ ·)).card)).card ≤ 3three_uniform_four_flower_free_quill_count_leIn LeanCombinatorics for TCS
In any 3-uniform 4-flower-free hypergraph S on Fin 39 with span Fin 39, the number of vertices of degree 1 (quills) is at most 30.
theorem three_uniform_four_flower_free_quill_count_le
(S : Finset (Finset (Fin 39)))
(h3 : ∀ s ∈ S, s.card = 3)
(hspan : S.biUnion id = Finset.univ)
(hfree : ¬ ∃ F ⊆ S, F.card = 4 ∧ ∃ C, IsSunflower F C) :
(Finset.univ.filter (fun (x : Fin 39) => (S.filter (x ∈ ·)).card = 1)).card ≤ 30three_uniform_span_bound_iffIn LeanCombinatorics for TCS
For any natural numbers r and a, every 3-uniform r-flower-free system on any type α with decidable equality has span at most a if and only if every 3-uniform r-flower-free system on Fin n has span at most a.
theorem three_uniform_span_bound_iff (r a : ℕ) :
(∀ {α : Type*} [DecidableEq α] (S : Finset (Finset α)),
(∀ A ∈ S, A.card = 3) →
(¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) →
(S.biUnion id).card ≤ a) ↔
(∀ (n : ℕ) (S : Finset (Finset (Fin n))),
(∀ A ∈ S, A.card = 3) →
(¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) →
(S.biUnion id).card ≤ a)three_uniform_to_two_uniform_systemIn LeanCombinatorics for TCS
For any r ≥ 3 and any 3-uniform r-flower-free system S on Fin n, there exists m and a 2-uniform r-flower-free system S' on Fin m whose aura is at least the span of S, i.e., |⋃ S| ≤ |⋃ S'| + (r - 1) * |S'|.
theorem three_uniform_to_two_uniform_system (r : ℕ) (hr : 3 ≤ r)
(n : ℕ) (S : Finset (Finset (Fin n)))
(h3 : ∀ A ∈ S, A.card = 3)
(hfree : ¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) :
∃ (m : ℕ) (S' : Finset (Finset (Fin m))),
(∀ A ∈ S', A.card = 2) ∧
(¬ ∃ F ⊆ S', F.card = r ∧ ∃ C, IsSunflower F C) ∧
(S.biUnion id).card ≤ (S'.biUnion id).card + (r - 1) * S'.cardthue_morse_min_factor_coverages_card_boundIn LeanCombinatorics for TCS
For n ≥ 5, H_min(t_n) has exactly 8n-22 members.
theorem thue_morse_min_factor_coverages_card_bound (n : ℕ) (hn : 5 ≤ n) :
(thue_morse_min_factor_coverages_finset n).card = 8 * n - 22thue_morse_min_factor_coverages_size_ge_eighth_lengthIn LeanCombinatorics for TCS
Every inclusion-minimal factor coverage of t_n has at least 2^(n-3)+2 positions, i.e. at least 1/8 of the length, for n ≥ 5.
theorem thue_morse_min_factor_coverages_size_ge_eighth_length (n : ℕ) (hn : 5 ≤ n) :
∀ C ∈ thue_morse_min_factor_coverages_finset n, 2 ^ n / 8 + 2 ≤ C.cardthue_morse_min_factor_coverages_size_le_half_lengthIn LeanCombinatorics for TCS
Every inclusion-minimal factor coverage of the n-th Thue-Morse word has cardinality at most 2^(n-1), i.e. 2|C| ≤ 2^n, for n ≥ 5.
theorem thue_morse_min_factor_coverages_size_le_half_length (n : ℕ) (hn : 5 ≤ n) :
∀ C ∈ thue_morse_min_factor_coverages_finset n, 2 * C.card ≤ 2 ^ nthue_morse_min_factor_coverages_subset_IccIn LeanCombinatorics for TCS
Every inclusion-minimal factor coverage of the n-th Thue–Morse word consists of positions in [1, 2^n].
theorem thue_morse_min_factor_coverages_subset_Icc (n : ℕ) :
∀ C ∈ thue_morse_min_factor_coverages_finset n, C ⊆ Finset.Icc 1 (2 ^ n)thue_morse_poisson_lower_small_meanIn LeanCombinatorics for TCS
For each C₀ > 0, for all large n and all k with μ_n(k) ≤ C₀, exp(−μ_n(k)) ≤ P_n(k) + 1/C₀.
theorem thue_morse_poisson_lower_small_mean (C₀ : ℝ) (hC₀ : 0 < C₀) :
∀ᶠ n in Filter.atTop, ∀ k : ℕ, thue_morse_unhit_mean n k ≤ C₀ →
Real.exp (-(thue_morse_unhit_mean n k)) ≤ thue_morse_random_attractor_prob n k + 1 / C₀thue_morse_poisson_uniformIn LeanCombinatorics for TCS
The supremum over k of |P_n(k) - exp(-μ_n(k))| tends to 0, where μ_n(k) is the expected number of unhit inclusion-minimal factor coverages of t_n.
theorem thue_morse_poisson_uniform :
Filter.Tendsto (fun n : ℕ => ⨆ k : ℕ,
|thue_morse_random_attractor_prob n k - Real.exp (-(thue_morse_unhit_mean n k))|)
Filter.atTop (nhds 0)thue_morse_poisson_upper_small_meanIn LeanCombinatorics for TCS
For each C₀ > 0, for all large n and all k with μ_n(k) ≤ C₀, P_n(k) ≤ exp(−μ_n(k)) + 1/C₀.
theorem thue_morse_poisson_upper_small_mean (C₀ : ℝ) (hC₀ : 0 < C₀) :
∀ᶠ n in Filter.atTop, ∀ k : ℕ, thue_morse_unhit_mean n k ≤ C₀ →
thue_morse_random_attractor_prob n k ≤ Real.exp (-(thue_morse_unhit_mean n k)) + 1 / C₀thue_morse_random_attractor_prob_eq_hit_allIn LeanCombinatorics for TCS
The probability that k uniformly random positions of t_n form a string attractor equals the fraction of k-tuples of positions in [1, 2^n] whose image meets every inclusion-minimal factor coverage of t_n.
theorem thue_morse_random_attractor_prob_eq_hit_all (n k : ℕ) :
thue_morse_random_attractor_prob n k =
((Finset.univ.filter (fun f : Fin k → ↥(Finset.Icc 1 (2 ^ n)) =>
∀ C ∈ thue_morse_min_factor_coverages_finset n, ∃ i : Fin k, (f i).val ∈ C)).card : ℝ)
/ ((2 : ℝ) ^ n) ^ kthue_morse_random_attractor_prob_monoIn LeanCombinatorics for TCS
Appending one more position to a k-tuple cannot destroy the attractor property, so P_n(k) ≤ P_n(k+1).
theorem thue_morse_random_attractor_prob_mono (n k : ℕ) :
thue_morse_random_attractor_prob n k ≤ thue_morse_random_attractor_prob n (k + 1)thue_morse_random_attractor_prob_union_boundIn LeanCombinatorics for TCS
For all n and k, thue_morse_random_attractor_prob n k ≥ 1 - thue_morse_unhit_mean n k: the probability that k uniform positions of t_n form a string attractor is at least one minus the expected number of unhit inclusion-minimal factor coverages.
theorem thue_morse_random_attractor_prob_union_bound (n k : ℕ) :
1 - thue_morse_unhit_mean n k ≤ thue_morse_random_attractor_prob n kthue_morse_sup_lattice_gumbel_of_poisson_and_meanIn LeanCombinatorics for TCS
If the sup over k of |P_n(k) - exp(-μ_n(k))| and the sup over k of |exp(-μ_n(k)) - exp(-8n(5/6)^k)| both tend to 0, and the expected unhit counts are nonnegative, then the sup over k of |P_n(k) - exp(-8n(5/6)^k)| tends to 0.
theorem thue_morse_sup_lattice_gumbel_of_poisson_and_mean
(hP : ∀ n k, thue_morse_random_attractor_prob n k ∈ Set.Icc (0 : ℝ) 1)
(hμ : ∀ n k, 0 ≤ thue_morse_unhit_mean n k)
(h1 : Filter.Tendsto (fun n : ℕ => ⨆ k : ℕ,
|thue_morse_random_attractor_prob n k - Real.exp (-(thue_morse_unhit_mean n k))|)
Filter.atTop (nhds 0))
(h2 : Filter.Tendsto (fun n : ℕ => ⨆ k : ℕ,
|Real.exp (-(thue_morse_unhit_mean n k)) - Real.exp (-8 * ((n : ℕ) : ℝ) * (5 / 6 : ℝ) ^ k)|)
Filter.atTop (nhds 0)) :
Filter.Tendsto (fun n : ℕ => ⨆ k : ℕ,
|thue_morse_random_attractor_prob n k - Real.exp (-8 * (n : ℝ) * (5 / 6 : ℝ) ^ k)|)
Filter.atTop (nhds 0)thue_morse_unhit_mean_antitoneIn LeanCombinatorics for TCS
The expected number of unhit minimal coverages μ_n(k) is nonincreasing in the number of sampled positions k.
theorem thue_morse_unhit_mean_antitone (n : ℕ) :
Antitone (fun k => thue_morse_unhit_mean n k)thue_morse_unhit_mean_halvingIn LeanCombinatorics for TCS
For all n and k, μ_n(k)/2 ≤ μ_n(k+1).
theorem thue_morse_unhit_mean_halving (n k : ℕ) :
thue_morse_unhit_mean n k / 2 ≤ thue_morse_unhit_mean n (k + 1)thue_morse_unhit_mean_large_tailIn LeanCombinatorics for TCS
When 8n(5/6)^k > M, M/2 ≤ μ_n(k) for large n.
theorem thue_morse_unhit_mean_large_tail (M : ℝ) (hM : 0 < M) :
∀ᶠ (n : ℕ) in Filter.atTop, ∀ k : ℕ,
M < 8 * (n : ℝ) * (5 / 6 : ℝ) ^ k → M / 2 ≤ thue_morse_unhit_mean n kthue_morse_unhit_mean_nearIn LeanCombinatorics for TCS
In the window ε ≤ 8n(5/6)^k ≤ 1/ε, μ_n(k) is within ε of 8n(5/6)^k for large n.
theorem thue_morse_unhit_mean_near (ε : ℝ) (hε : 0 < ε) :
∀ᶠ (n : ℕ) in Filter.atTop, ∀ k : ℕ,
ε ≤ 8 * (n : ℝ) * (5 / 6 : ℝ) ^ k → 8 * (n : ℝ) * (5 / 6 : ℝ) ^ k ≤ 1 / ε →
|thue_morse_unhit_mean n k - 8 * (n : ℝ) * (5 / 6 : ℝ) ^ k| ≤ εthue_morse_unhit_mean_small_tailIn LeanCombinatorics for TCS
When 8n(5/6)^k < ε, μ_n(k) ≤ 2ε for large n.
theorem thue_morse_unhit_mean_small_tail (ε : ℝ) (hε : 0 < ε) :
∀ᶠ (n : ℕ) in Filter.atTop, ∀ k : ℕ,
8 * (n : ℝ) * (5 / 6 : ℝ) ^ k < ε → thue_morse_unhit_mean n k ≤ 2 * εthue_morse_unhit_mean_tendsto_zeroIn LeanCombinatorics for TCS
For fixed n, μ_n(k) → 0 as k → ∞.
theorem thue_morse_unhit_mean_tendsto_zero (n : ℕ) :
Filter.Tendsto (fun k => thue_morse_unhit_mean n k) Filter.atTop (nhds 0)thue_morse_unhit_mean_uniformIn LeanCombinatorics for TCS
The supremum over k of |exp(-μ_n(k)) - exp(-8n(5/6)^k)| tends to 0, i.e. the expected unhit count μ_n(k) is asymptotic to 8n(5/6)^k uniformly in the exponent sup-norm.
theorem thue_morse_unhit_mean_uniform :
Filter.Tendsto (fun n : ℕ => ⨆ k : ℕ,
|Real.exp (-(thue_morse_unhit_mean n k)) - Real.exp (-8 * ((n : ℕ) : ℝ) * (5 / 6 : ℝ) ^ k)|)
Filter.atTop (nhds 0)thue_morse_unhit_mean_window_reductionIn LeanCombinatorics for TCS
Analytical supremum reduction for approximating exp(-8n(5/6)^k) in sup-norm across k.
theorem thue_morse_unhit_mean_window_reduction
(a : ℕ → ℕ → ℝ) (ha_nonneg : ∀ n k, 0 ≤ a n k)
(h_near : ∀ ε > 0, ∀ᶠ (n : ℕ) in Filter.atTop, ∀ k : ℕ,
ε ≤ 8 * (n : ℝ) * (5 / 6 : ℝ) ^ k → 8 * (n : ℝ) * (5 / 6 : ℝ) ^ k ≤ 1 / ε →
|a n k - 8 * (n : ℝ) * (5 / 6 : ℝ) ^ k| ≤ ε)
(h_small : ∀ ε > 0, ∀ᶠ (n : ℕ) in Filter.atTop, ∀ k : ℕ,
8 * (n : ℝ) * (5 / 6 : ℝ) ^ k < ε → a n k ≤ 2 * ε)
(h_large : ∀ M > 0, ∀ᶠ (n : ℕ) in Filter.atTop, ∀ k : ℕ,
M < 8 * (n : ℝ) * (5 / 6 : ℝ) ^ k → M / 2 ≤ a n k) :
Filter.Tendsto (fun n : ℕ => ⨆ k : ℕ,
|Real.exp (-(a n k)) - Real.exp (-8 * ((n : ℕ) : ℝ) * (5 / 6 : ℝ) ^ k)|)
Filter.atTop (nhds 0)thue_morse_unhit_term_exp_boundIn LeanCombinatorics for TCS
For 0 ≤ x ≤ 1 and every k, (1-x)^k ≤ exp(-x k).
theorem thue_morse_unhit_term_exp_bound {x : ℝ} (h0 : 0 ≤ x) (h1 : x ≤ 1) (k : ℕ) :
(1 - x) ^ k ≤ Real.exp (-(x * k))tournament_not_reaches_out_degree_ltIn LeanCombinatorics for TCS
In two tournaments $T_1$ and $T_2$ on a finite type $V$, if a vertex $x$ does not reach a vertex $v$ via $x = v$, an arc in $T_1$, an arc in $T_2$, or an arc in $T_1$ followed by an arc in $T_2$, then the out-degree of $x$ in $T_1$ is strictly less than the out-degree of $v$ in $T_2$.
open Classical in
theorem tournament_not_reaches_out_degree_lt {V : Type*} [Fintype V] (T₁ T₂ : Digraph V)
(hT₁ : digraph_is_tournament T₁) (hT₂ : digraph_is_tournament T₂)
(x v : V)
(hnot : ¬ (x = v ∨ T₁.Adj x v ∨ T₂.Adj x v ∨ ∃ w, T₁.Adj x w ∧ T₂.Adj w v)) :
digraph_out_degree T₁ x < digraph_out_degree T₂ vtournament_sum_out_degreeIn LeanCombinatorics for TCS
In any tournament $T$ on a finite type $V$, the sum over all vertices of their out-degrees in $T$ equals $|V|(|V|-1)/2$.
open Classical in
theorem tournament_sum_out_degree {V : Type*} [Fintype V] (T : Digraph V)
(hT : digraph_is_tournament T) :
∑ i : V, digraph_out_degree T i = (Fintype.card V) * (Fintype.card V - 1) / 2transverse_plane_incidence_double_countIn LeanCombinatorics for TCS
Let p be a prime, S an admissible plane set in (ZMod p)^3 containing the affine line through P in direction v ≠ 0, and Q any point. Then the total, over x in S, of the number of functionals f with f(v) ≠ 0 and f(x) = f(Q), equals p times the number of functionals f with f(v) ≠ 0.
theorem transverse_plane_incidence_double_count
(p : ℕ) [Fact p.Prime] (S : Set (Fin 3 → ZMod p)) [Fintype ↥S]
(hS : admissible_plane_set p S) (P v : Fin 3 → ZMod p) (hv : v ≠ 0)
(hline : affine_line P v ⊆ S) (Q : Fin 3 → ZMod p) :
(∑ x ∈ S.toFinset, Nat.card {f : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p // f v ≠ 0 ∧ f x = f Q})
= p * Nat.card {f : (Fin 3 → ZMod p) →ₗ[ZMod p] ZMod p // f v ≠ 0}tree_exists_leaf_with_good_neighborIn LeanCombinatorics for TCS
For every tree T on at least 3 vertices with maximum degree at most 3, there are vertices v, u with v a leaf adjacent to u such that either u has degree 2, or u is adjacent to a second leaf w ≠ v.
theorem tree_exists_leaf_with_good_neighbor {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) (hdeg : T.maxDegree ≤ 3)
(hcard : 3 ≤ Fintype.card V) :
∃ v u : V, T.degree v = 1 ∧ T.Adj v u ∧
(T.degree u = 2 ∨ ∃ w : V, w ≠ v ∧ T.Adj u w ∧ T.degree w = 1)tree_max_degree_two_petrial_ker_finrank_le_oneIn LeanCombinatorics for TCS
For any tree T with maximum degree at most 2 and any subset F of vertices, the nullspace of petrial_matrix T F has dimension at most 1 over ZMod 2.
theorem tree_max_degree_two_petrial_ker_finrank_le_one
{V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj]
(hT : T.IsTree) (hdeg : T.maxDegree ≤ 2) (F : Finset V) :
Module.finrank (ZMod 2) ↥(petrial_matrix T F).mulVecLin.ker ≤ 1tree_max_degree_two_petrial_ker_zeroIn LeanCombinatorics for TCS
In a tree T with maximum degree at most 2, any vector z in the kernel of the partial Petrial matrix petrial_matrix T F that vanishes at a leaf v0 must be identically zero.
theorem tree_max_degree_two_petrial_ker_zero
{V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj]
(hT : T.IsTree) (hdeg : T.maxDegree ≤ 2) (F : Finset V)
(z : V → ZMod 2) (hz : (petrial_matrix T F).mulVec z = 0)
(v0 : V) (hv0 : T.degree v0 = 1) (hz0 : z v0 = 0) :
z = 0tree_max_degree_two_petrial_matrix_rank_geIn LeanCombinatorics for TCS
For any tree T with maximum degree at most 2 and any subset F of vertices, the rank of petrial_matrix T F over ZMod 2 is at least |V| - 1.
theorem tree_max_degree_two_petrial_matrix_rank_ge
{V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj]
(hT : T.IsTree) (hdeg : T.maxDegree ≤ 2) (F : Finset V) :
Fintype.card V - 1 ≤ (petrial_matrix T F).ranktrig_poly_affine_four_rootsIn LeanCombinatorics for TCS
If a function f(t) = c₀ + c₁ * t + c₂ * cos t + c₃ * sin t has at least four roots in an open interval (a, b) of length less than π, then c₁ = 0, c₂ = 0, and c₃ = 0.
theorem trig_poly_affine_four_roots (c₀ c₁ c₂ c₃ a b : ℝ) (hab : b - a < Real.pi)
(s : Finset ℝ) (hs : ∀ t ∈ s, t ∈ Set.Ioo a b)
(hroot : ∀ t ∈ s, c₀ + c₁ * t + c₂ * Real.cos t + c₃ * Real.sin t = 0)
(hcard : 4 ≤ s.card) : c₁ = 0 ∧ c₂ = 0 ∧ c₃ = 0turan_hypergraph_zycle_free_of_lt_two_mulIn LeanCombinatorics for TCS
For n < 2ℓ the balanced Turán hypergraph T_n is automatically Z_ℓ-free, because Z_ℓ has 2ℓ vertices and therefore cannot be embedded into Fin n. This is the vacuous small-n half of the Z_ℓ-freeness of the Turán construction.
theorem turan_hypergraph_zycle_free_of_lt_two_mul (ℓ n : ℕ) [NeZero ℓ] (h : n < 2 * ℓ) : is_hypergraph_free (turan_hypergraph n) (zycle ℓ)
two_tournaments_reachabilityIn LeanCombinatorics for TCS
Let $T_1, T_2$ be tournaments on a common finite nonempty vertex set $V$. Then there exists a vertex $v \in V$ such that every vertex in $V$ is reached from $v$ by an arc in $T_1$, an arc in $T_2$, or an arc in $T_1$ followed by an arc in $T_2$; that is, for all $u \in V$, $u = v$, or $T_1.Adj\ v\ u$, or $T_2.Adj\ v\ u$, or there exists $w \in V$ such that $T_1.Adj\ v\ w$ and $T_2.Adj\ w\ u$.
open Classical in
theorem two_tournaments_reachability {V : Type*} [Fintype V] [Nonempty V]
(T₁ T₂ : Digraph V) (hT₁ : digraph_is_tournament T₁) (hT₂ : digraph_is_tournament T₂) :
∃ v : V, ∀ u : V, u = v ∨ T₁.Adj v u ∨ T₂.Adj v u ∨ ∃ w : V, T₁.Adj v w ∧ T₂.Adj w utwo_tournaments_sum_out_degree_eqIn LeanCombinatorics for TCS
For any two tournaments $T_1$ and $T_2$ on the same finite vertex type $V$, the sum of the out-degrees of all vertices in $T_1$ equals the sum of the out-degrees of all vertices in $T_2$.
open Classical in
theorem two_tournaments_sum_out_degree_eq {V : Type*} [Fintype V] (T₁ T₂ : Digraph V)
(hT₁ : digraph_is_tournament T₁) (hT₂ : digraph_is_tournament T₂) :
∑ v : V, digraph_out_degree T₁ v = ∑ v : V, digraph_out_degree T₂ vtwo_triangles_sharing_vertex_not_cohen_macaulayIn LeanCombinatorics for TCS
Two triangles sharing exactly one vertex, the complex with facets {0,1,2} and {0,3,4} on Fin 5, is not Cohen-Macaulay over any field: the link of the shared vertex 0 is the two disjoint edges {1,2} and {3,4}, hence disconnected.
theorem two_triangles_sharing_vertex_not_cohen_macaulay (k : Type*) [Field k] :
¬ is_cohen_macaulay_two_complex ({ {0, 1, 2}, {0, 3, 4} } : Finset (Finset (Fin 5))) ktwo_uniform_aura_bound_iffIn LeanCombinatorics for TCS
For any natural numbers r and a, every 2-uniform r-flower-free system on any type α with decidable equality has aura at most a if and only if every 2-uniform r-flower-free system on Fin n has aura at most a.
theorem two_uniform_aura_bound_iff (r a : ℕ) :
(∀ {α : Type*} [DecidableEq α] (S : Finset (Finset α)),
(∀ A ∈ S, A.card = 2) →
(¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) →
(S.biUnion id).card + (r - 1) * S.card ≤ a) ↔
(∀ (n : ℕ) (S : Finset (Finset (Fin n))),
(∀ A ∈ S, A.card = 2) →
(¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) →
(S.biUnion id).card + (r - 1) * S.card ≤ a)two_uniform_aura_finite_boundIn LeanCombinatorics for TCS
For every natural number r ≥ 3, there exists a finite constant M such that every 2-uniform r-flower-free system S on any type α with decidable equality satisfies |⋃ S| + (r - 1) * |S| ≤ M.
theorem two_uniform_aura_finite_bound (r : ℕ) (hr : 3 ≤ r) :
∃ M : ℕ,
∀ {α : Type*} [DecidableEq α] (S : Finset (Finset α)),
(∀ A ∈ S, A.card = 2) →
(¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) →
(S.biUnion id).card + (r - 1) * S.card ≤ Mtwo_uniform_max_aura_existsIn LeanCombinatorics for TCS
For every natural number r ≥ 3, there exists a natural number a such that every 2-uniform r-flower-free system S on any type α with decidable equality satisfies |⋃ S| + (r - 1) * |S| ≤ a, and there exists a natural number n and a 2-uniform r-flower-free system on Fin n attaining aura exactly a.
theorem two_uniform_max_aura_exists (r : ℕ) (hr : 3 ≤ r) :
∃ a : ℕ,
(∀ {α : Type*} [DecidableEq α] (S : Finset (Finset α)),
(∀ A ∈ S, A.card = 2) →
(¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) →
(S.biUnion id).card + (r - 1) * S.card ≤ a) ∧
(∃ (n : ℕ) (S : Finset (Finset (Fin n))),
(∀ A ∈ S, A.card = 2) ∧
(¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) ∧
(S.biUnion id).card + (r - 1) * S.card = a)two_uniform_to_three_uniform_systemIn LeanCombinatorics for TCS
For any r ≥ 3 and any 2-uniform r-flower-free system S on Fin n, there exists m and a 3-uniform r-flower-free system S' on Fin m with span equal to the aura of S, i.e., |⋃ S'| = |⋃ S| + (r - 1) * |S|.
theorem two_uniform_to_three_uniform_system (r : ℕ) (hr : 3 ≤ r)
(n : ℕ) (S : Finset (Finset (Fin n)))
(h2 : ∀ A ∈ S, A.card = 2)
(hfree : ¬ ∃ F ⊆ S, F.card = r ∧ ∃ C, IsSunflower F C) :
∃ (m : ℕ) (S' : Finset (Finset (Fin m))),
(∀ A ∈ S', A.card = 3) ∧
(¬ ∃ F ⊆ S', F.card = r ∧ ∃ C, IsSunflower F C) ∧
(S'.biUnion id).card = (S.biUnion id).card + (r - 1) * S.cardunion_min_of_strong_eliminationIn LeanCombinatorics for TCS
If a finite collection C of finite sets has the strong elimination property, then every nonempty set F in C is a union of sets in collection_min_nonempty C.
theorem union_min_of_strong_elimination {V : Type*} [DecidableEq V]
{C : Finset (Finset V)} (h : has_strong_elimination C)
(F : Finset V) (hF : F ∈ C) (hne : F.Nonempty) :
∃ U ⊆ collection_min_nonempty C, F = U.biUnion idunique_path_of_weight_lt_half_girthIn LeanCombinatorics for TCS
In a graph with nonnegative edge weights where every cycle has weight at least gw, between any two vertices u and v there is at most one path of weight strictly less than gw / 2.
open scoped BigOperators Classical in
theorem unique_path_of_weight_lt_half_girth {V : Type*}
(G : SimpleGraph V) (ω : Sym2 V → ℝ) (hω : ∀ e ∈ G.edgeSet, 0 ≤ ω e)
(gw : ℝ)
(hgirth : ∀ (w : V) (c : G.Walk w w), c.IsCycle → gw ≤ (c.edges.map ω).sum)
{u v : V} (p q : G.Walk u v) (hp : p.IsPath) (hq : q.IsPath)
(hpw : (p.edges.map ω).sum < gw / 2)
(hqw : (q.edges.map ω).sum < gw / 2) :
p = qweakened_cycle_ramsey_property_nonemptyIn LeanCombinatorics for TCS
For any number of colours t ≥ 2 and cycle length ℓ ≥ 3, there exists an integer n such that every t-edge-colouring of K_n contains an ℓ-cycle avoiding at least one colour.
theorem weakened_cycle_ramsey_property_nonempty (t ℓ : ℕ) (ht : 2 ≤ t) (hℓ : 3 ≤ ℓ) :
∃ n : ℕ, weakened_cycle_ramsey_property t ℓ nweakened_cycle_ramsey_property_succ_impIn LeanCombinatorics for TCS
For all integers t ≥ 4, ℓ ≥ 4, and n, if every t-edge-colouring of K_n contains an (ℓ+1)-cycle avoiding at least one colour, then every t-edge-colouring of K_n contains an ℓ-cycle avoiding at least one colour.
theorem weakened_cycle_ramsey_property_succ_imp (t ℓ n : ℕ) (ht : 4 ≤ t) (hℓ : 4 ≤ ℓ)
(h : weakened_cycle_ramsey_property t (ℓ + 1) n) :
weakened_cycle_ramsey_property t ℓ nweakened_cycle_ramsey_property_three_colors_succ_impIn LeanCombinatorics for TCS
For all ℓ ≥ 4 and n, if every 3-edge-colouring of K_n contains an (ℓ+1)-cycle avoiding at least one colour, then every 3-edge-colouring of K_n contains an ℓ-cycle avoiding at least one colour.
theorem weakened_cycle_ramsey_property_three_colors_succ_imp (ℓ n : ℕ) (hℓ : 4 ≤ ℓ)
(h : weakened_cycle_ramsey_property 3 (ℓ + 1) n) :
weakened_cycle_ramsey_property 3 ℓ nweighted_esymm_three_sos_identityIn LeanCombinatorics for TCS
For integer variables indexed by a finite set, the degree-three Newton expression equals a sum over pairs of squared differences times a nonnegative complete homogeneous quadratic on the remaining variables.
theorem weighted_esymm_three_sos_identity {V : Type*} [DecidableEq V] (s : Finset V) (w : V → ℤ) : let e := fun k : ℕ => ∑ A ∈ s.powersetCard k, ∏ i ∈ A, w i; 2 * ((s.card : ℤ) - 2) * (e 2) ^ 2 - 3 * ((s.card : ℤ) - 1) * e 1 * e 3 = ∑ A ∈ s.powersetCard 2, (((∑ i ∈ A, w i) ^ 2 - 4 * (∏ i ∈ A, w i)) * ((∑ z ∈ s \ A, (w z) ^ 2) + ∑ B ∈ (s \ A).powersetCard 2, ∏ z ∈ B, w z))word_min_factor_coverages_eq_of_absorbing_antichainIn LeanCombinatorics for TCS
Let w be a finite word and B a finite set of words such that (L1) every u ∈ B is a nonempty factor of w, (L2) every nonempty factor x of w has Cov_w(u) ⊆ Cov_w(x) for some u ∈ B, and (L3) the covariances Cov_w(u) for u ∈ B are an antichain: if Cov_w(u) ⊆ Cov_w(v) for u, v ∈ B then u = v. Then the inclusion-minimal factor coverages of w are exactly {Cov_w(u) | u ∈ B}, and u ↦ Cov_w(u) is injective on B.
theorem word_min_factor_coverages_eq_of_absorbing_antichain {α : Type*} [DecidableEq α]
(w : List α) (B : Finset (List α))
(h1 : ∀ u ∈ B, u ≠ [] ∧ u <:+: w)
(h2 : ∀ x : List α, x ≠ [] → x <:+: w →
∃ u ∈ B, word_occurrence_coverage w u ⊆ word_occurrence_coverage w x)
(h3 : ∀ u ∈ B, ∀ v ∈ B, word_occurrence_coverage w u ⊆ word_occurrence_coverage w v → u = v) :
word_min_factor_coverages w = {word_occurrence_coverage w u | u ∈ B} ∧
Set.InjOn (word_occurrence_coverage w) ↑Bword_occurrence_coverage_subset_of_located_occurrencesIn LeanCombinatorics for TCS
If every occurrence of u in w starting at p is matched by an occurrence of x in w starting at some q ≤ p with p + |u| ≤ q + |x|, then the coverage of u in w is contained in the coverage of x in w.
theorem word_occurrence_coverage_subset_of_located_occurrences {α : Type*} [DecidableEq α]
(w x u : List α)
(h : ∀ p ∈ Finset.Icc 1 w.length, (w.drop (p - 1)).take u.length = u →
∃ q ∈ Finset.Icc 1 w.length, (w.drop (q - 1)).take x.length = x ∧
q ≤ p ∧ p + u.length ≤ q + x.length) :
word_occurrence_coverage w u ⊆ word_occurrence_coverage w xyoung_diagram_dominates_iff_row_min_sum_leIn LeanCombinatorics for TCS
A Young diagram ν dominates its conjugate diagram if and only if, for every t, the truncated sum ∑_{i < colLen 0} min(ν.rowLen i, t) is at most the truncated sum ∑_{j < rowLen 0} min(ν.colLen j, t). Equivalently: the prefix sums of row lengths are at least the prefix sums of column lengths, tested by their staircase truncations.
theorem young_diagram_dominates_iff_row_min_sum_le (ν : YoungDiagram) :
young_diagram_dominates_conjugate ν ↔ ∀ t : ℕ,
(∑ i ∈ Finset.range (ν.colLen 0), min (ν.rowLen i) t)
≤ ∑ j ∈ Finset.range (ν.rowLen 0), min (ν.colLen j) tyoung_diagram_dvd_rowLenIn LeanCombinatorics for TCS
The greatest common divisor of the row lengths of a Young diagram μ divides the length of any row in μ.
theorem young_diagram_dvd_rowLen (μ : YoungDiagram) (i : ℕ) (hi : i < μ.colLen 0) :
young_diagram_part_gcd μ ∣ μ.rowLen iyoung_diagram_filter_card_eq_sum_colIn LeanCombinatorics for TCS
Double counting along columns: for any predicate P on cells, the number of cells of a Young diagram ν satisfying P is the sum, over the columns j = 0, …, rowLen 0 − 1, of the number of cells of column j satisfying P.
theorem young_diagram_filter_card_eq_sum_col (ν : YoungDiagram) (P : ℕ → ℕ → Prop) [DecidableRel P] :
(ν.cells.filter (fun c => P c.1 c.2)).card
= ∑ j ∈ Finset.range (ν.rowLen 0), ((ν.col j).filter (fun c => P c.1 c.2)).cardyoung_diagram_filter_card_eq_sum_rowIn LeanCombinatorics for TCS
Double counting along rows: for any predicate P on cells, the number of cells of a Young diagram ν satisfying P is the sum, over the rows i = 0, …, colLen 0 − 1, of the number of cells of row i satisfying P.
theorem young_diagram_filter_card_eq_sum_row (ν : YoungDiagram) (P : ℕ → ℕ → Prop) [DecidableRel P] :
(ν.cells.filter (fun c => P c.1 c.2)).card
= ∑ i ∈ Finset.range (ν.colLen 0), ((ν.row i).filter (fun c => P c.1 c.2)).cardyoung_diagram_same_len_rows_below_lt_max_multiplicityIn LeanCombinatorics for TCS
The number of rows in a Young diagram μ strictly below row i of the same length is strictly less than the maximum multiplicity of any row length in μ.
theorem young_diagram_same_len_rows_below_lt_max_multiplicity (μ : YoungDiagram) (i : ℕ) (hi : i < μ.colLen 0) :
young_diagram_same_len_rows_below μ i < young_diagram_max_multiplicity μyoung_diagram_same_len_rows_below_strict_antiIn LeanCombinatorics for TCS
For two rows i₁ < i₂ of equal length in a Young diagram μ, the number of equal-length rows strictly below i₂ is strictly less than that strictly below i₁.
theorem young_diagram_same_len_rows_below_strict_anti (μ : YoungDiagram) (i₁ i₂ : ℕ)
(hi : i₁ < i₂) (heq : μ.rowLen i₁ = μ.rowLen i₂) (h₂ : i₂ < μ.colLen 0) :
young_diagram_same_len_rows_below μ i₂ < young_diagram_same_len_rows_below μ i₁young_diagram_sum_min_col_lenIn LeanCombinatorics for TCS
The cells of a Young diagram ν that lie in one of the first t rows, counted column by column, give ∑_{j} min(ν.colLen j, t); counted row by row they give ∑_{i<t} ν.rowLen i. Hence the two sums agree.
theorem young_diagram_sum_min_col_len (ν : YoungDiagram) (t : ℕ) :
(∑ j ∈ Finset.range (ν.rowLen 0), min (ν.colLen j) t) = ∑ i ∈ Finset.range t, ν.rowLen iyoung_diagram_sum_min_row_lenIn LeanCombinatorics for TCS
The cells of a Young diagram ν that lie in one of the first t columns, counted row by row, give ∑_{i} min(ν.rowLen i, t); counted column by column they give ∑_{j<t} ν.colLen j. Hence the two sums agree.
theorem young_diagram_sum_min_row_len (ν : YoungDiagram) (t : ℕ) :
(∑ i ∈ Finset.range (ν.colLen 0), min (ν.rowLen i) t) = ∑ j ∈ Finset.range t, ν.colLen jzero_rank_l_matrix_order_le_oneIn LeanCombinatorics for TCS
If $M$ is an $n \times n$ $L$-matrix over a field $K$ with $0 \notin L$, and the rank of $M$ is 0, then $n \leq 1$.
theorem zero_rank_l_matrix_order_le_one {n : ℕ} {K : Type*} [Field K]
(L : Set K) (hL0 : (0 : K) ∉ L)
(M : Matrix (Fin n) (Fin n) K) (hM : is_l_matrix M L) (hrank : M.rank = 0) :
n ≤ 1zero_sum_w_bad_length_le_two_mul_rankIn LeanCombinatorics for TCS
Every w-bad sequence of vectors in ℤ^r has length at most 2*r*(n-1).
theorem zero_sum_w_bad_length_le_two_mul_rank (r n : ℕ) (hn : 1 < n) (A : List (Fin r → ℤ)) (hbad : zero_sum_w_bad n A) : A.length ≤ 2 * r * (n - 1)
zero_sum_w_bad_replicate_leIn LeanCombinatorics for TCS
A constant sequence of length k is w-bad only if k ≤ n - 1.
theorem zero_sum_w_bad_replicate_le (n r k : ℕ) (hn : 1 < n) (x : Fin r → ℤ) (hk : 1 ≤ k) (hbad : zero_sum_w_bad n (List.replicate k x)) : k ≤ n - 1
zero_sum_w_bad_sublistIn LeanCombinatorics for TCS
Any sublist of a w-bad sequence is also w-bad.
theorem zero_sum_w_bad_sublist {n r : ℕ} {A B : List (Fin r → ℤ)} (hsub : B.Sublist A) (hbad : zero_sum_w_bad n A) : zero_sum_w_bad n Bzmod8_cube_graph_bipartiteIn LeanCombinatorics for TCS
The cube graph Q_3 on ZMod 8 is bipartite, with the parity of the residue of a vertex as 2-colouring; an edge x ~ y has (x + y).val odd.
theorem zmod8_cube_graph_bipartite : zmod8_cube_graph.IsBipartite
zmod8_cube_graph_degreeIn LeanCombinatorics for TCS
Every vertex of the cube graph Q_3 on ZMod 8 has degree 3.
theorem zmod8_cube_graph_degree (v : ZMod 8) : zmod8_cube_graph.degree v = 3
zmod8_cube_graph_has_edgeIn LeanCombinatorics for TCS
The Hankel cube graph on ZMod 8 has at least one edge (witnessed by the pair (0, 1) since (0 + 1).val = 1).
theorem zmod8_cube_graph_has_edge : ∃ u v : ZMod 8, zmod8_cube_graph.Adj u v
zmod8_cube_graph_not_circulantIn LeanCombinatorics for TCS
The cube graph Q_3 on ZMod 8 is not isomorphic to any circulant graph on ZMod 8: it is bipartite but 3-regular, whereas every 3-regular circulant graph on ZMod 8 has an odd cycle.
theorem zmod8_cube_graph_not_circulant : ¬ is_circulant_graph 8 zmod8_cube_graph
zmod8_cube_graph_sharpIn LeanCombinatorics for TCS
The Hankel cube graph on ZMod 8 admits a sharp cyclic labeling, witnessed by the identity bijection since its adjacency matrix is Hankel and therefore its 2D Fourier transform is diagonal.
theorem zmod8_cube_graph_sharp : admits_sharp_cyclic_labeling 8 zmod8_cube_graph
zmod8_neg_closed_three_cardIn LeanCombinatorics for TCS
Every 3-element subset T of ZMod 8 that is closed under negation and does not contain 0 has the form {a, -a, 4} where a ≠ 0 and a ≠ 4 (so uniquely, the pair of nonzero, non-antipodal residues is determined by T).
theorem zmod8_neg_closed_three_card (T : Finset (ZMod 8)) (hcard : T.card = 3)
(hsym : ∀ w ∈ T, -w ∈ T) (h0 : (0 : ZMod 8) ∉ T) :
∃ a : ZMod 8, a ≠ 0 ∧ a ≠ 4 ∧ T = {a, -a, 4}zmod_four_dft_single_frequency_constantIn LeanCombinatorics for TCS
Let c : ZMod 4 → ℕ. If all but at most one of its Fourier coefficients ∑_y c y · exp(−2πi·(n·y)/4) vanish, then c is constant; in particular the corresponding "graph" is regular.
theorem zmod_four_dft_single_frequency_constant (c : ZMod 4 → ℕ) (n₀ : ZMod 4)
(h : ∀ n : ZMod 4, n ≠ n₀ →
∑ y : ZMod 4, (c y : ℂ) *
Complex.exp (-2 * ↑Real.pi * Complex.I * (↑((n * y).val) / ↑(4 : ℕ))) = 0) :
∃ d : ℕ, ∀ y : ZMod 4, c y = dzmod_power_sums_determine_multisetIn LeanCombinatorics for TCS
Paper Lemma 2.1: over the prime field ZMod q, a multiset of r elements with r < q is determined by its first r power sums Σ a, Σ a², …, Σ a^r.
theorem zmod_power_sums_determine_multiset (q r : ℕ) [Fact q.Prime] (hr : r < q)
(m m' : Multiset (ZMod q)) (hm : m.card = r) (hm' : m'.card = r)
(hp : ∀ j : ℕ, 1 ≤ j → j ≤ r → (m.map (fun a => a ^ j)).sum = (m'.map (fun a => a ^ j)).sum) :
m = m'zmod_sub_reverse_bijectiveIn LeanCombinatorics for TCS
For any element r in ZMod n, the map s ↦ r - s is a bijection on ZMod n.
theorem zmod_sub_reverse_bijective {n : ℕ} (r : ZMod n) :
Function.Bijective (fun s : ZMod n ↦ r - s)zycle_vertex_cardIn LeanCombinatorics for TCS
The zycle Z_ℓ has exactly 2ℓ vertices: its vertex set is ZMod ℓ × Fin 2.
theorem zycle_vertex_card (ℓ : ℕ) [NeZero ℓ] : Fintype.card (ZMod ℓ × Fin 2) = 2 * ℓ
CommunicationComplexity.two_overlapping_rectangles_zeros_length_sum_geIn LeanCommunication Complexity
In any deterministic protocol computing the two-overlapping-rectangles function, the sum of communication lengths on inputs (0, 0) and (2, 2) is at least 5.
theorem CommunicationComplexity.two_overlapping_rectangles_zeros_length_sum_ge
(p : CommunicationComplexity.Deterministic.Protocol (Fin 3) (Fin 3) Bool)
(hcomp : p.Computes CommunicationComplexity.two_overlapping_rectangles) :
5 ≤ p.length 0 0 + p.length 2 2apex_graph_connected_iffIn LeanCommunication Complexity
Let n ≥ 1. The apex graph on Fin (n + 1) formed by adding an apex vertex adjacent to a subset S ⊆ Fin n of a graph H on Fin n is connected if and only if S intersects every connected component of H.
theorem apex_graph_connected_iff (n : ℕ) (hn : 1 ≤ n) (H : SimpleGraph (Fin n)) (S : Finset (Fin n)) :
(apex_graph_fin n H S).Connected ↔ ∀ u : Fin n, ∃ s ∈ S, H.Reachable u scommuting_quantum_efficiency_bddAboveIn LeanCommunication Complexity
The set of conclusive efficiencies achieved by zero-error commuting-operator protocols with K messages for equality on N labels is bounded above.
theorem commuting_quantum_efficiency_bddAbove (K N : ℕ) :
BddAbove {c : ℝ | ∃ (p : Fin N → Fin N × Fin K → Fin K → Option Bool → ℝ),
is_commuting_quantum p ∧
(∀ (s t : Fin N), if s = t then ∑ a, p s (t, a) a (some false) = 0
else ∑ a, p s (t, a) a (some true) = 0) ∧
∀ (s t : Fin N), c ≤ ∑ a, p s (t, a) a (some (decide (s = t)))}commuting_quantum_one_bit_zero_error_vanishingIn LeanCommunication Complexity
Let $\psi$ be a unit vector of a real Hilbert space on which Alice's effects $A^m_s$ and Bob's effects $B^{o}_{t,m}$ act as commuting projections with all Alice operators commuting with all Bob operators. If the total probability of the forbidden answer vanishes on every input pair — $\sum_m \langle\psi, A^m_s B^{\mathrm{false}}_{s,m}\psi\rangle = 0$ on equal inputs and $\sum_m \langle\psi, A^m_s B^{\mathrm{true}}_{t,m}\psi\rangle = 0$ on unequal inputs — then each term vanishes separately, i.e. $A^m_s B^{\mathrm{false}}_{s,m}\psi = 0$ for all $s,m$ and $A^m_s B^{\mathrm{true}}_{t,m}\psi = 0$ whenever $s \ne t$.
theorem commuting_quantum_one_bit_zero_error_vanishing
{E : Type} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E]
{N : ℕ} (ψ : E)
(A : Fin N → Fin 2 → E →L[ℝ] E) (B : Fin N → Fin 2 → Option Bool → E →L[ℝ] E)
(hAproj : ∀ (s : Fin N) (m : Fin 2), IsStarProjection (A s m))
(hBproj : ∀ (t : Fin N) (m : Fin 2) (o : Option Bool), IsStarProjection (B t m o))
(hcomm : ∀ (s : Fin N) (m : Fin 2) (t : Fin N) (m' : Fin 2) (o : Option Bool),
(A s m) * (B t m' o) = (B t m' o) * (A s m))
(hz1 : ∀ s : Fin N, ∑ a : Fin 2, inner ℝ ψ (A s a (B s a (some false) ψ)) = 0)
(hz2 : ∀ s t : Fin N, s ≠ t → ∑ a : Fin 2, inner ℝ ψ (A s a (B t a (some true) ψ)) = 0) :
(∀ (s : Fin N) (a : Fin 2), A s a (B s a (some false) ψ) = 0) ∧
∀ (s t : Fin N) (a : Fin 2), s ≠ t → A s a (B t a (some true) ψ) = 0const_vec_norm_eq_oneIn LeanCommunication Complexity
The normalized constant vector has norm 1.
theorem const_vec_norm_eq_one {ι : Type*} [Fintype ι] [Nonempty ι] : ‖const_vec ι‖ = 1coord_proj_is_star_projectionIn LeanCommunication Complexity
A sum of standard-basis rank-one projections is a star projection.
theorem coord_proj_is_star_projection {ι : Type*} [Fintype ι] [DecidableEq ι] (S : Finset ι) :
IsStarProjection (coord_proj S)coord_proj_mulIn LeanCommunication Complexity
The product of the coordinate projections onto S and onto T is the coordinate projection onto S ∩ T; in particular coordinate projections commute.
theorem coord_proj_mul {ι : Type*} [Fintype ι] [DecidableEq ι] (S T : Finset ι) :
coord_proj S * coord_proj T = coord_proj (S ∩ T)equality_classical_behaviour_successIn LeanCommunication Complexity
The worst-case conclusive success probability of the shared-random-subset protocol equals (K−1)/N: the conclusive answer is always the correct one, and it is given for exactly those r with (s + r) mod N < K − 1 in Fin K, of which there are K − 1.
theorem equality_classical_behaviour_success (K N : ℕ) [NeZero N] (hK : 1 ≤ K) (hN : K ≤ N)
(s t : Fin N) :
∑ a : Fin K, equality_classical_behaviour N K hK s (t, a) a (some (decide (s = t)))
= ((K : ℝ) - 1) / (N : ℝ)equality_classical_behaviour_sum_oneIn LeanCommunication Complexity
For every pair of inputs (s, t), the shares of randomness realizing each (message, output) pair sum to one: ∑_a ∑_o p(s,(t,a),a,o) = 1.
theorem equality_classical_behaviour_sum_one (K N : ℕ) [NeZero N] (hK : 1 ≤ K)
(s t : Fin N) :
∑ a : Fin K, ∑ o : Option Bool, equality_classical_behaviour N K hK s (t, a) a o = 1equality_classical_behaviour_zero_errorIn LeanCommunication Complexity
The protocol never errs: on equal inputs no conclusive 'false' output occurs, and on unequal inputs no conclusive 'true' output occurs.
theorem equality_classical_behaviour_zero_error (K N : ℕ) [NeZero N] (hK : 1 ≤ K) (hN : K ≤ N)
(s t : Fin N) :
(if s = t then ∑ a : Fin K, equality_classical_behaviour N K hK s (t, a) a (some false) = 0
else ∑ a : Fin K, equality_classical_behaviour N K hK s (t, a) a (some true) = 0)gaussian_majority_error_cubic_asymptoticsIn LeanCommunication Complexity
For any sequence lam_q of worst-variance maximizers for q ≥ 2, the rescaled excess error q^3 * (gaussian_majority_error q (lam_q q) - 1 / (4 * (q : ℝ))) tends to gaussian_majority_zeta_constant^2 / 8 as q → ∞.
theorem gaussian_majority_error_cubic_asymptotics (lam_q : ℕ → ℝ)
(h_max : ∀ q ≥ 2, 1 < lam_q q ∧ ∀ lam > 0, lam ≠ lam_q q →
gaussian_majority_error q lam < gaussian_majority_error q (lam_q q)) :
Filter.Tendsto (fun q : ℕ ↦ (q : ℝ) ^ 3 * (gaussian_majority_error q (lam_q q) - 1 / (4 * (q : ℝ))))
Filter.atTop (nhds (gaussian_majority_zeta_constant ^ 2 / 8))gaussian_majority_worst_variance_at_one_ltIn LeanCommunication Complexity
For q ≥ 2 the equal-variance error is strictly smaller than the error at the worst-variance maximizer: gaussian_majority_error q 1 < gaussian_majority_error q (lam_q q).
theorem gaussian_majority_worst_variance_at_one_lt (lam_q : ℕ → ℝ)
(h_max : ∀ q ≥ 2, 1 < lam_q q ∧ ∀ lam > 0, lam ≠ lam_q q →
gaussian_majority_error q lam < gaussian_majority_error q (lam_q q)) :
∀ (q : ℕ), 2 ≤ q → gaussian_majority_error q 1 < gaussian_majority_error q (lam_q q)gaussian_majority_worst_variance_comparisonIn LeanCommunication Complexity
A worst-variance maximizer weakly dominates every positive variance parameter: for every q ≥ 2 and every lam > 0, the error at lam is at most the error at the maximizer lam_q q.
theorem gaussian_majority_worst_variance_comparison (lam_q : ℕ → ℝ)
(h_max : ∀ q ≥ 2, 1 < lam_q q ∧ ∀ lam > 0, lam ≠ lam_q q →
gaussian_majority_error q lam < gaussian_majority_error q (lam_q q)) :
∀ (q : ℕ), 2 ≤ q → ∀ lam > 0, gaussian_majority_error q lam ≤ gaussian_majority_error q (lam_q q)gaussian_majority_worst_variance_lower_bound_trivialIn LeanCommunication Complexity
The lower eventual bound holds outside the interesting region: for every ε ≥ c, for all sufficiently large q, c − ε < q · (lam_q q − 1).
theorem gaussian_majority_worst_variance_lower_bound_trivial (lam_q : ℕ → ℝ)
(h_max : ∀ q ≥ 2, 1 < lam_q q ∧ ∀ lam > 0, lam ≠ lam_q q →
gaussian_majority_error q lam < gaussian_majority_error q (lam_q q)) :
∀ ε ≥ gaussian_majority_zeta_constant, ∀ᶠ (q : ℕ) in Filter.atTop,
gaussian_majority_zeta_constant - ε < (q : ℝ) * (lam_q q - 1)gaussian_majority_worst_variance_rescaled_posIn LeanCommunication Complexity
For every q ≥ 2 the rescaled deviation is strictly positive: 0 < q · (lam_q q − 1).
theorem gaussian_majority_worst_variance_rescaled_pos (lam_q : ℕ → ℝ)
(h_max : ∀ q ≥ 2, 1 < lam_q q ∧ ∀ lam > 0, lam ≠ lam_q q →
gaussian_majority_error q lam < gaussian_majority_error q (lam_q q)) :
∀ (q : ℕ), 2 ≤ q → 0 < (q : ℝ) * (lam_q q - 1)gaussian_majority_worst_variance_tendstoIn LeanCommunication Complexity
For any sequence lam_q of worst-variance maximizers for q ≥ 2, the rescaled deviation q * (lam_q q - 1) tends to the Gaussian majority zeta constant as q → ∞.
theorem gaussian_majority_worst_variance_tendsto (lam_q : ℕ → ℝ)
(h_max : ∀ q ≥ 2, 1 < lam_q q ∧ ∀ lam > 0, lam ≠ lam_q q →
gaussian_majority_error q lam < gaussian_majority_error q (lam_q q)) :
Filter.Tendsto (fun q : ℕ ↦ (q : ℝ) * (lam_q q - 1)) Filter.atTop
(nhds gaussian_majority_zeta_constant)gaussian_majority_worst_variance_tendsto_iff_eventual_boundsIn LeanCommunication Complexity
The rescaled deviation q · (lam_q q − 1) tends to the constant c if and only if for every ε > 0 it is eventually below c + ε and eventually above c − ε.
theorem gaussian_majority_worst_variance_tendsto_iff_eventual_bounds (lam_q : ℕ → ℝ) :
Filter.Tendsto (fun q : ℕ ↦ (q : ℝ) * (lam_q q - 1)) Filter.atTop
(nhds gaussian_majority_zeta_constant) ↔
(∀ ε > 0, ∀ᶠ (q : ℕ) in Filter.atTop,
(q : ℝ) * (lam_q q - 1) < gaussian_majority_zeta_constant + ε) ∧
(∀ ε > 0, ∀ᶠ (q : ℕ) in Filter.atTop,
gaussian_majority_zeta_constant - ε < (q : ℝ) * (lam_q q - 1))gaussian_majority_worst_variance_tendsto_lower_boundIn LeanCommunication Complexity
For every ε > 0, for all sufficiently large q, c − ε < q · (lam_q q − 1), where c is the Gaussian majority zeta constant.
theorem gaussian_majority_worst_variance_tendsto_lower_bound (lam_q : ℕ → ℝ)
(h_max : ∀ q ≥ 2, 1 < lam_q q ∧ ∀ lam > 0, lam ≠ lam_q q →
gaussian_majority_error q lam < gaussian_majority_error q (lam_q q)) :
∀ ε > 0, ∀ᶠ (q : ℕ) in Filter.atTop,
gaussian_majority_zeta_constant - ε < (q : ℝ) * (lam_q q - 1)gaussian_majority_worst_variance_tendsto_upper_boundIn LeanCommunication Complexity
For every ε > 0, for all sufficiently large q, q · (lam_q q − 1) < c + ε, where c is the Gaussian majority zeta constant.
theorem gaussian_majority_worst_variance_tendsto_upper_bound (lam_q : ℕ → ℝ)
(h_max : ∀ q ≥ 2, 1 < lam_q q ∧ ∀ lam > 0, lam ≠ lam_q q →
gaussian_majority_error q lam < gaussian_majority_error q (lam_q q)) :
∀ ε > 0, ∀ᶠ (q : ℕ) in Filter.atTop,
(q : ℝ) * (lam_q q - 1) < gaussian_majority_zeta_constant + εgaussian_majority_worst_variance_uniqueIn LeanCommunication Complexity
For every natural number q ≥ 2, there exists a unique variance ratio λ > 1 that strictly maximizes the distributed Gaussian majority error over all positive variance parameters μ ≠ λ.
theorem gaussian_majority_worst_variance_unique (q : ℕ) (hq : 2 ≤ q) :
∃! lam : ℝ, 1 < lam ∧ ∀ μ > 0, μ ≠ lam → gaussian_majority_error q μ < gaussian_majority_error q lamgaussian_majority_zeta_constant_posIn LeanCommunication Complexity
The Gaussian coin majority zeta constant c = 7 · Re ζ(3) / π² is strictly positive.
theorem gaussian_majority_zeta_constant_pos : 0 < gaussian_majority_zeta_constant
hitting_oracle_reconstruct_reachable_setoidIn LeanCommunication Complexity
There exists a uniform decoder that, given any predicate f : Finset (Fin n) → Bool indicating whether T hits all connected components of a graph H on Fin n (for n ≥ 1), outputs H.reachableSetoid.
theorem hitting_oracle_reconstruct_reachable_setoid (n : ℕ) :
∃ dec : (Finset (Fin n) → Bool) → Setoid (Fin n),
∀ (H : SimpleGraph (Fin n)) (hn : 1 ≤ n) (f : Finset (Fin n) → Bool),
(∀ T : Finset (Fin n), f T = true ↔ ∀ u : Fin n, ∃ s ∈ T, H.Reachable u s) →
dec f = H.reachableSetoidinner_const_vec_coord_projIn LeanCommunication Complexity
For the normalized constant vector ψ and coordinate projections onto S and T, ⟪ψ, P_S P_T ψ⟫ = |S ∩ T| / card ι.
theorem inner_const_vec_coord_proj {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι]
(S T : Finset ι) :
inner ℝ (const_vec ι) (coord_proj S (coord_proj T (const_vec ι)))
= ((S ∩ T).card : ℝ) / (Fintype.card ι)is_commuting_quantum_equality_classical_behaviourIn LeanCommunication Complexity
The shared-random-subset behaviour is realized by a commuting-operator quantum strategy: on E = EuclideanSpace ℝ (ZMod N) with the constant unit vector ψ, Alice's measurement for input s and message a is the coordinate projection onto {r : message(s,r) = a}, and Bob's for input t, message a and output o is the coordinate projection onto {r : output(t,a,r) = o}.
theorem is_commuting_quantum_equality_classical_behaviour (K N : ℕ) [NeZero N] (hK : 1 ≤ K) :
is_commuting_quantum (equality_classical_behaviour N K hK)oneway_connected_components_reduction_from_connectivityIn LeanCommunication Complexity
Let n ≥ 1. If there exists a deterministic one-way communication protocol P : CommunicationComplexity.Deterministic.OneWay.Protocol (SimpleGraph (Fin (n + 1))) (SimpleGraph (Fin (n + 1))) Bool that decides whether G'_A \ G'_B is connected (returning true if and only if (G'_A \ G'_B).Connected) for any graphs G'_B ≤ G'_A on Fin (n + 1), then there exists a deterministic one-way communication protocol P' : CommunicationComplexity.Deterministic.OneWay.Protocol (SimpleGraph (Fin n)) (SimpleGraph (Fin n)) (Setoid (Fin n)) on Fin n with communication cost P'.cost ≤ P.cost that outputs the reachability setoid (G_A \ G_B).reachableSetoid for any subgraphs G_B ≤ G_A on Fin n.
theorem oneway_connected_components_reduction_from_connectivity
(n : ℕ) (hn : 1 ≤ n)
(P : CommunicationComplexity.Deterministic.OneWay.Protocol
(SimpleGraph (Fin (n + 1))) (SimpleGraph (Fin (n + 1))) Bool)
(hP : ∀ (GA GB : SimpleGraph (Fin (n + 1))), GB ≤ GA →
(P.run GA GB = true ↔ (GA \ GB).Connected)) :
∃ P' : CommunicationComplexity.Deterministic.OneWay.Protocol
(SimpleGraph (Fin n)) (SimpleGraph (Fin n)) (Setoid (Fin n)),
P'.cost ≤ P.cost ∧
∀ (GA GB : SimpleGraph (Fin n)), GB ≤ GA →
P'.run GA GB = (GA \ GB).reachableSetoidop_840_commuting_quantum_efficiency_classical_lower_boundIn LeanCommunication Complexity
Classical shared-randomness lower bound for OP-840: for all integers k ≥ 2 and N > 2^k, the optimal zero-error commuting-operator quantum efficiency with 2^k messages is at least (2^k - 1) / N.
theorem op_840_commuting_quantum_efficiency_classical_lower_bound (k : ℕ) (hk : 2 ≤ k) (N : ℕ) (hN : 2 ^ k < N) :
((2 ^ k : ℝ) - 1) / (N : ℝ) ≤ commuting_quantum_efficiency (2 ^ k) Nop_840_commuting_quantum_efficiency_multibit_upper_boundIn LeanCommunication Complexity
Open Problem OP-840 upper bound (arXiv:2610.41448 Sec. 9): for all integers k ≥ 2 and N > 2^k, the optimal zero-error commuting-operator quantum efficiency with 2^k messages is at most (2^k - 1) / N, closing the gap from Theorem 5's bound (2^k - 1) / (N - 1).
theorem op_840_commuting_quantum_efficiency_multibit_upper_bound (k : ℕ) (hk : 2 ≤ k) (N : ℕ) (hN : 2 ^ k < N) :
commuting_quantum_efficiency (2 ^ k) N ≤ ((2 ^ k : ℝ) - 1) / (N : ℝ)sum_coord_proj_fiberIn LeanCommunication Complexity
Summing, over the values of a function f, the coordinate projections onto the fibre of each value, gives the identity operator.
theorem sum_coord_proj_fiber {ι α : Type*} [Fintype ι] [DecidableEq ι] [Fintype α] [DecidableEq α]
(f : ι → α) :
(∑ a : α, coord_proj (Finset.univ.filter (fun i => f i = a))) = 1two_overlapping_rectangles_fooling_cornersIn LeanCommunication Complexity
The four corner inputs $\{(0,0), (0,2), (2,0), (2,2)\}$ form a fooling set for the two-overlapping-rectangles function $\mathrm{CommunicationComplexity.two\_overlapping\_rectangles}$.
theorem two_overlapping_rectangles_fooling_corners :
CommunicationComplexity.Rectangle.IsFoolingSet ({(0, 0), (0, 2), (2, 0), (2, 2)} : Set (Fin 3 × Fin 3))
CommunicationComplexity.two_overlapping_rectanglestwo_overlapping_rectangles_proposition_5_1In LeanCommunication Complexity
For the two-overlapping-rectangles Boolean function $\mathrm{CommunicationComplexity.two\_overlapping\_rectangles} : \mathrm{Fin}\;3 \to \mathrm{Fin}\;3 \to \mathrm{Bool}$, the minimum cover numbers are $C_0(F) = 2$, $C_1(F) = 2$, and $C_{\rm all}(F) = 4$. Moreover, the prior-free rectangle-size bound is $\operatorname{RS}_0(F) = 2$, the minimum number of leaves in any correct deterministic protocol is $\ell(F) = 5$, and the deterministic communication complexity is $D(F) = 3$.
theorem two_overlapping_rectangles_proposition_5_1 :
cover_number CommunicationComplexity.two_overlapping_rectangles false = 2 ∧
cover_number CommunicationComplexity.two_overlapping_rectangles true = 2 ∧
cover_number_all CommunicationComplexity.two_overlapping_rectangles = 4 ∧
rectangle_size_bound CommunicationComplexity.two_overlapping_rectangles = 2 ∧
min_leaf_count CommunicationComplexity.two_overlapping_rectangles = 5 ∧
CommunicationComplexity.Deterministic.communicationComplexity CommunicationComplexity.two_overlapping_rectangles = 3two_overlapping_rectangles_proposition_5_2In LeanCommunication Complexity
Under the zero-error expected communication cost model, the public-coin communication complexity CommunicationComplexity.PublicCoin.zeroErrorCommunicationComplexity of the two-overlapping-rectangles function CommunicationComplexity.two_overlapping_rectangles is (5 : ℝ) / 2, and its private-coin communication complexity CommunicationComplexity.PrivateCoin.zeroErrorCommunicationComplexity is 3.
theorem two_overlapping_rectangles_proposition_5_2 :
CommunicationComplexity.PublicCoin.zeroErrorCommunicationComplexity
CommunicationComplexity.two_overlapping_rectangles = (5 : ℝ) / 2 ∧
CommunicationComplexity.PrivateCoin.zeroErrorCommunicationComplexity
CommunicationComplexity.two_overlapping_rectangles = 3two_overlapping_rectangles_zero_error_priv_geIn LeanCommunication Complexity
The zero-error private-coin expected communication complexity CommunicationComplexity.PrivateCoin.zeroErrorCommunicationComplexity of the two-overlapping-rectangles Boolean function CommunicationComplexity.two_overlapping_rectangles is at least 3.
lemma two_overlapping_rectangles_zero_error_priv_ge :
(3 : ℝ) ≤ CommunicationComplexity.PrivateCoin.zeroErrorCommunicationComplexity
CommunicationComplexity.two_overlapping_rectanglestwo_overlapping_rectangles_zero_error_priv_leIn LeanCommunication Complexity
The zero-error private-coin expected communication complexity CommunicationComplexity.PrivateCoin.zeroErrorCommunicationComplexity of the two-overlapping-rectangles Boolean function CommunicationComplexity.two_overlapping_rectangles is at most 3.
lemma two_overlapping_rectangles_zero_error_priv_le :
CommunicationComplexity.PrivateCoin.zeroErrorCommunicationComplexity
CommunicationComplexity.two_overlapping_rectangles ≤ 3two_overlapping_rectangles_zero_error_pub_geIn LeanCommunication Complexity
The zero-error public-coin expected communication complexity CommunicationComplexity.PublicCoin.zeroErrorCommunicationComplexity of the two-overlapping-rectangles Boolean function CommunicationComplexity.two_overlapping_rectangles is at least (5 : ℝ) / 2.
lemma two_overlapping_rectangles_zero_error_pub_ge :
(5 : ℝ) / 2 ≤ CommunicationComplexity.PublicCoin.zeroErrorCommunicationComplexity
CommunicationComplexity.two_overlapping_rectanglestwo_overlapping_rectangles_zero_error_pub_leIn LeanCommunication Complexity
The zero-error public-coin expected communication complexity CommunicationComplexity.PublicCoin.zeroErrorCommunicationComplexity of the two-overlapping-rectangles Boolean function CommunicationComplexity.two_overlapping_rectangles is at most (5 : ℝ) / 2.
lemma two_overlapping_rectangles_zero_error_pub_le :
CommunicationComplexity.PublicCoin.zeroErrorCommunicationComplexity
CommunicationComplexity.two_overlapping_rectangles ≤ (5 : ℝ) / 2absolute_trace_character_additiveIn LeanFoundations of Cryptography
The absolute-trace character chi(x) = 1 if Tr x = 0 and -1 otherwise is multiplicative: chi(x+y) = chi(x) * chi(y).
theorem absolute_trace_character_additive (m : ℕ) (x y : GaloisField 2 m) :
(if Algebra.trace (ZMod 2) (GaloisField 2 m) (x + y) = 0 then (1 : ℤ) else -1)
= (if Algebra.trace (ZMod 2) (GaloisField 2 m) x = 0 then (1 : ℤ) else -1)
* (if Algebra.trace (ZMod 2) (GaloisField 2 m) y = 0 then (1 : ℤ) else -1)absolute_trace_linear_character_sumIn LeanFoundations of Cryptography
For w in GaloisField 2 m the sum over b of the trace character of w*b equals 2^m if w = 0 and 0 otherwise.
theorem absolute_trace_linear_character_sum (m : ℕ) [Fintype (GaloisField 2 m)]
[DecidableEq (GaloisField 2 m)] (hm : 1 ≤ m) (w : GaloisField 2 m) :
(∑ b : GaloisField 2 m,
(if Algebra.trace (ZMod 2) (GaloisField 2 m) (w * b) = 0 then (1 : ℤ) else -1))
= if w = 0 then (2 : ℤ) ^ m else 0absolute_trace_quadratic_character_sumIn LeanFoundations of Cryptography
For m ≥ 1 and A, B in GaloisField 2 m, the sum over b of the trace character of (A*b^2 + B*b) equals 2^m if A^(2^(m-1)) + B = 0, and 0 otherwise.
theorem absolute_trace_quadratic_character_sum (m : ℕ) [Fintype (GaloisField 2 m)]
[DecidableEq (GaloisField 2 m)] (hm : 1 ≤ m) (A B : GaloisField 2 m) :
(∑ b : GaloisField 2 m,
(if Algebra.trace (ZMod 2) (GaloisField 2 m) (A * b ^ 2 + B * b) = 0 then (1 : ℤ) else -1))
= if A ^ 2 ^ (m - 1) + B = 0 then (2 : ℤ) ^ m else 0bent_comp_linear_equivIn LeanFoundations of Cryptography
If g is a bent function on (Fin 8 → ZMod 2) and L is an invertible linear endomorphism of (Fin 8 → ZMod 2), then x ↦ g (L x) is bent.
theorem bent_comp_linear_equiv (L : (Fin 8 → ZMod 2) ≃ₗ[ZMod 2] (Fin 8 → ZMod 2)) (g : (Fin 8 → ZMod 2) → ZMod 2) (hg : is_bent g) :
is_bent (fun x => g (L x))bent_dim_eight_anf_coeff_zeroIn LeanFoundations of Cryptography
Every bent function on (Fin 8 → ZMod 2) has vanishing algebraic normal form coefficients on all subsets of cardinality greater than 4.
theorem bent_dim_eight_anf_coeff_zero (g : (Fin 8 → ZMod 2) → ZMod 2) (hg : is_bent g)
(S : Finset (Fin 8)) (hS : 4 < S.card) : anf_coeff g S = 0bent_dim_eight_has_degree_le_fourIn LeanFoundations of Cryptography
Every bent function on (Fin 8 → ZMod 2) has algebraic degree at most 4 (Rothaus' theorem for dimension 8).
theorem bent_dim_eight_has_degree_le_four (g : (Fin 8 → ZMod 2) → ZMod 2) (hg : is_bent g) : has_degree_le g 4
bent_dim_eight_subcube_character_sumIn LeanFoundations of Cryptography
For any Boolean function g on (Fin 8 → ZMod 2) and any subset S, the sum of Walsh transform values of g on the subcube complementary to S equals 2^(8 - card S) times the character sum of g on the subcube S.
theorem bent_dim_eight_subcube_character_sum (g : (Fin 8 → ZMod 2) → ZMod 2) (S : Finset (Fin 8)) :
(∑ B ∈ (Finset.univ \ S).powerset,
(∑ x : Fin 8 → ZMod 2, if g x + (∑ i, x i * if i ∈ B then 1 else 0) = 0 then (1 : ℤ) else -1)) =
(2 : ℤ) ^ (8 - S.card) *
(∑ A ∈ S.powerset, if g (fun i => if i ∈ A then 1 else 0) = 0 then (1 : ℤ) else -1)bent_sum_counterexample_E_collapseIn LeanFoundations of Cryptography
For any integer-valued weight g and frequency w, the weighted Walsh sum of the counterexample function collapses over the product block: only the all-ones block contributes, and the result is χ_{w_A}(all-ones) times the weighted Walsh sum of the quadratic block.
theorem bent_sum_counterexample_E_collapse (m : ℕ) (hm : 4 ≤ m)
(g : (Fin (2 * m) → ZMod 2) → ℤ) (w : Fin (2 * m) → ZMod 2) :
(∑ x : Fin (2 * m) → ZMod 2,
g x * (if bent_sum_counterexample_func m hm x = 0 then (0 : ℤ) else 1)
* (if (∑ i : Fin (2 * m), w i * x i) = 0 then (1 : ℤ) else -1))
= (if (∑ i : Fin (m - 2), w ⟨i.val, by omega⟩) = 0 then (1 : ℤ) else -1) *
∑ u : Fin (m + 2) → ZMod 2,
g (fun k => if h : k.val < m - 2 then (1 : ZMod 2)
else u ⟨k.val - (m - 2), by omega⟩)
* (if (u ⟨0, by omega⟩ * u ⟨1, by omega⟩ + u ⟨2, by omega⟩ * u ⟨3, by omega⟩
+ u ⟨4, by omega⟩ * u ⟨5, by omega⟩ : ZMod 2) = 0 then (0 : ℤ) else 1)
* (if (∑ j : Fin (m + 2), w ⟨(m - 2) + j.val, by omega⟩ * u j) = 0 then (1 : ℤ) else -1)bent_sum_counterexample_chi_addIn LeanFoundations of Cryptography
The sign character x ↦ (if a·x = 0 then 1 else -1) on (Fin n → ZMod 2) is multiplicative in the frequency: χ_{a+b}(x) = χ_a(x)·χ_b(x).
theorem bent_sum_counterexample_chi_add {n : ℕ} (a b x : Fin n → ZMod 2) :
(if (∑ i, (a i + b i) * x i) = 0 then (1 : ℤ) else -1)
= (if (∑ i, a i * x i) = 0 then (1 : ℤ) else -1) * (if (∑ i, b i * x i) = 0 then (1 : ℤ) else -1)bent_sum_counterexample_chi_orthogonalityIn LeanFoundations of Cryptography
Walsh character orthogonality on (Fin n → ZMod 2): the characters x ↦ (if a·x = 0 then 1 else -1) are orthogonal with squared norm 2^n.
theorem bent_sum_counterexample_chi_orthogonality {n : ℕ} (a b : Fin n → ZMod 2) :
∑ x : Fin n → ZMod 2,
(if (∑ i, a i * x i) = 0 then (1 : ℤ) else -1) * (if (∑ i, b i * x i) = 0 then (1 : ℤ) else -1)
= if a = b then 2 ^ n else 0bent_sum_counterexample_chi_point_addIn LeanFoundations of Cryptography
The sign character is also multiplicative in its point argument: χ_a(x + y) = χ_a(x)·χ_a(y).
theorem bent_sum_counterexample_chi_point_add {n : ℕ} (a x y : Fin n → ZMod 2) :
(if (∑ i, a i * (x i + y i)) = 0 then (1 : ℤ) else -1)
= (if (∑ i, a i * x i) = 0 then (1 : ℤ) else -1) * (if (∑ i, a i * y i) = 0 then (1 : ℤ) else -1)bent_sum_counterexample_is_bent_walshIn LeanFoundations of Cryptography
For a bent Boolean function b on (Fin n → ZMod 2), every Walsh coefficient Σ_x (-1)^{b(x) + w·x}, written as a product of sign factors, has absolute value 2^(n/2).
theorem bent_sum_counterexample_is_bent_walsh {n : ℕ} (b : (Fin n → ZMod 2) → ZMod 2) (hb : is_bent b) :
∀ w : Fin n → ZMod 2,
|∑ x : Fin n → ZMod 2, (if b x = 0 then (1 : ℤ) else -1) * (if (∑ i, w i * x i) = 0 then (1 : ℤ) else -1)|
= 2 ^ (n / 2)bent_sum_counterexample_not_sum_of_two_bentIn LeanFoundations of Cryptography
Let n ≥ 8 be even and write n = 2m. The Boolean function f_n on (Fin (2 * m) → ZMod 2) defined by the product of the first m - 2 variables and the sum of three quadratic products on the next 6 variables has algebraic degree m and cannot be written as a sum of two bent functions.
theorem bent_sum_counterexample_not_sum_of_two_bent (m : ℕ) (hm : 4 ≤ m) :
let f : (Fin (2 * m) → ZMod 2) → ZMod 2 := fun x =>
(∏ i : Fin (m - 2), x ⟨i.val, by omega⟩) *
(x ⟨m - 2, by omega⟩ * x ⟨m - 1, by omega⟩ +
x ⟨m, by omega⟩ * x ⟨m + 1, by omega⟩ +
x ⟨m + 2, by omega⟩ * x ⟨m + 3, by omega⟩)
has_degree_le f m ∧
(∀ k < m, ¬ has_degree_le f k) ∧
¬ ∃ b₁ b₂ : (Fin (2 * m) → ZMod 2) → ZMod 2,
is_bent b₁ ∧ is_bent b₂ ∧ b₁ + b₂ = fbent_sum_counterexample_not_sum_of_two_bent_auxIn LeanFoundations of Cryptography
For m ≥ 4, the product of the first m-2 coordinates with the three-quadratic-term form on the next 6 coordinates is not the sum of two bent functions on (Fin (2*m) → ZMod 2).
theorem bent_sum_counterexample_not_sum_of_two_bent_aux (m : ℕ) (hm : 4 ≤ m) :
¬ ∃ b₁ b₂ : (Fin (2 * m) → ZMod 2) → ZMod 2,
is_bent b₁ ∧ is_bent b₂ ∧ b₁ + b₂ = bent_sum_counterexample_func m hmbent_sum_counterexample_rest_block_evalIn LeanFoundations of Cryptography
In block coordinates x = (x_A, x_R) with x_A : Fin (m-2) → ZMod 2 and x_R : Fin (m+2) → ZMod 2, the counterexample function is the product of the coordinates of x_A with the six-variable quadratic form on the first six coordinates of x_R.
theorem bent_sum_counterexample_rest_block_eval (m : ℕ) (hm : 4 ≤ m)
(p : (Fin (m - 2) → ZMod 2) × (Fin (m + 2) → ZMod 2)) :
bent_sum_counterexample_func m hm
(fun k => if h : k.val < m - 2 then p.1 ⟨k.val, h⟩ else p.2 ⟨k.val - (m - 2), by omega⟩)
= (∏ i : Fin (m - 2), p.1 i) *
(p.2 ⟨0, by omega⟩ * p.2 ⟨1, by omega⟩ + p.2 ⟨2, by omega⟩ * p.2 ⟨3, by omega⟩
+ p.2 ⟨4, by omega⟩ * p.2 ⟨5, by omega⟩)bent_sum_counterexample_rest_weightIn LeanFoundations of Cryptography
The number of points x_R : Fin (m+2) → ZMod 2 with x_R 0·x_R 1 + x_R 2·x_R 3 + x_R 4·x_R 5 = 1 is 28·2^(m-4), because the last m-4 coordinates are free.
theorem bent_sum_counterexample_rest_weight (m : ℕ) (hm : 4 ≤ m) :
(Finset.filter (fun u : Fin (m + 2) → ZMod 2 =>
(u ⟨0, by omega⟩ * u ⟨1, by omega⟩ + u ⟨2, by omega⟩ * u ⟨3, by omega⟩
+ u ⟨4, by omega⟩ * u ⟨5, by omega⟩ : ZMod 2) = 1) Finset.univ).card
= 28 * 2 ^ (m - 4)bent_sum_counterexample_walsh_inversionIn LeanFoundations of Cryptography
Walsh inversion on (Fin n → ZMod 2): for every integer-valued F, summing the Walsh transform of F against the characters recovers 2^n·F.
theorem bent_sum_counterexample_walsh_inversion {n : ℕ} (F : (Fin n → ZMod 2) → ℤ) (y : Fin n → ZMod 2) :
∑ b : Fin n → ZMod 2,
(∑ x : Fin n → ZMod 2, F x * (if (∑ i, b i * x i) = 0 then (1 : ℤ) else -1))
* (if (∑ i, b i * y i) = 0 then (1 : ℤ) else -1)
= 2 ^ n * F ybent_sum_counterexample_walsh_parsevalIn LeanFoundations of Cryptography
Parseval on (Fin n → ZMod 2): the sum of squares of the Walsh coefficients of an integer-valued F equals 2^n times the sum of squares of F.
theorem bent_sum_counterexample_walsh_parseval {n : ℕ} (F : (Fin n → ZMod 2) → ℤ) :
∑ b : Fin n → ZMod 2,
(∑ x : Fin n → ZMod 2, F x * (if (∑ i, b i * x i) = 0 then (1 : ℤ) else -1)) ^ 2
= 2 ^ n * ∑ x : Fin n → ZMod 2, (F x) ^ 2bent_sum_parity_obstructionIn LeanFoundations of Cryptography
If F is the Walsh transform of a {0,±1}-valued weight G on (Fin N → ZMod 2), if every value of F is in {0, ±2^K}, if Σ F^2 = 7·2^(2K) and N = K+2, then we get a contradiction.
theorem bent_sum_parity_obstruction {N K : ℕ} (F G : (Fin N → ZMod 2) → ℤ)
(hFG : ∀ u : Fin N → ZMod 2,
F u = ∑ y : Fin N → ZMod 2, G y * (if (∑ i, u i * y i) = 0 then (1 : ℤ) else -1))
(hG : ∀ y : Fin N → ZMod 2, G y = 0 ∨ G y = 1 ∨ G y = -1)
(hF : ∀ u : Fin N → ZMod 2, F u = 0 ∨ F u = 2 ^ K ∨ F u = -(2 ^ K))
(hsum : ∑ u : Fin N → ZMod 2, (F u) ^ 2 = 7 * 2 ^ (2 * K))
(hN : N = K + 2) : Falseboolean_derivative_bent_partner_existsIn LeanFoundations of Cryptography
For every balanced Boolean function f on (Fin 8 → ZMod 2) of algebraic degree at most 3 having a nonzero period v, there exists a bent function g on (Fin 8 → ZMod 2) such that D_v g = f.
theorem boolean_derivative_bent_partner_exists (f : (Fin 8 → ZMod 2) → ZMod 2) (hf_bal : is_balanced f) (hf_deg : has_degree_le f 3) (v : Fin 8 → ZMod 2) (hv : v ≠ 0) (hfv : ∀ x, f (x + v) = f x) : ∃ g : (Fin 8 → ZMod 2) → ZMod 2, is_bent g ∧ boolean_derivative v g = f
boolean_derivative_bent_partner_of_semi_bent_signingIn LeanFoundations of Cryptography
Assume every balanced Boolean function of degree at most 3 on (Fin 7 → ZMod 2) has a flat signing. Then every balanced f on (Fin 8 → ZMod 2) of degree at most 3 with a nonzero period v is the derivative D_v g of a bent function g.
theorem boolean_derivative_bent_partner_of_semi_bent_signing (core : ∀ h : (Fin 7 → ZMod 2) → ZMod 2, is_balanced h → has_degree_le h 3 → ∃ a : (Fin 7 → ZMod 2) → ZMod 2, boolean_derivative_signing_flat h a) (f : (Fin 8 → ZMod 2) → ZMod 2) (hf_bal : is_balanced f) (hf_deg : has_degree_le f 3) (v : Fin 8 → ZMod 2) (hv : v ≠ 0) (hfv : ∀ x, f (x + v) = f x) :
∃ g : (Fin 8 → ZMod 2) → ZMod 2, is_bent g ∧ boolean_derivative v g = fboolean_derivative_exists_linear_equiv_of_ne_zeroIn LeanFoundations of Cryptography
For every nonzero vector v in (Fin 8 → ZMod 2) there is an invertible linear map L with L e₇ = v, where e₇ is the last standard basis vector.
theorem boolean_derivative_exists_linear_equiv_of_ne_zero (v : Fin 8 → ZMod 2) (hv : v ≠ 0) :
∃ L : (Fin 8 → ZMod 2) ≃ₗ[ZMod 2] (Fin 8 → ZMod 2), L (fun i => if i = 7 then (1 : ZMod 2) else 0) = vboolean_derivative_semi_bent_signing_existsIn LeanFoundations of Cryptography
Every balanced Boolean function h on (Fin 7 → ZMod 2) of algebraic degree at most 3 admits a flat signing a: on each level set of h the signed Walsh sums Σ (-1)^(a u + w·u) have absolute value 8.
theorem boolean_derivative_semi_bent_signing_exists (h : (Fin 7 → ZMod 2) → ZMod 2) (hh_bal : is_balanced h) (hh_deg : has_degree_le h 3) :
∃ a : (Fin 7 → ZMod 2) → ZMod 2, boolean_derivative_signing_flat h aboolean_derivative_signing_flat_balancedIn LeanFoundations of Cryptography
If (h, a) is a flat signing on (Fin 7 → ZMod 2), then h is balanced, i.e. each level set of h has 64 points.
theorem boolean_derivative_signing_flat_balanced (h a : (Fin 7 → ZMod 2) → ZMod 2) (hf : boolean_derivative_signing_flat h a) : is_balanced h
digit_exchange_walsh_cond_iffIn LeanFoundations of Cryptography
With A = t*a*(a^2+a+c)^2 and B = v + s*(a^2+a+c) + t*a*(a^2+a+c), the condition A^(2^(m-1)) + B = 0 is equivalent to the root polynomial vanishing at a.
theorem digit_exchange_walsh_cond_iff
(m : ℕ) (hm : 1 ≤ m) (c v s t a : GaloisField 2 m) :
((t * a * (a ^ 2 + a + c) ^ 2) ^ 2 ^ (m - 1) +
(v + s * (a ^ 2 + a + c) + t * a * (a ^ 2 + a + c)) = 0) ↔
(Polynomial.C (v ^ 2) + (Polynomial.X ^ 2 + Polynomial.X + Polynomial.C c) ^ 2 *
(Polynomial.C (s ^ 2) + Polynomial.C (t ^ 2) * Polynomial.X ^ 2 + Polynomial.C t * Polynomial.X)
: Polynomial (GaloisField 2 m)).eval a = 0digit_exchange_walsh_inner_sumIn LeanFoundations of Cryptography
Inner-sum collapse: for fixed a, summing the digit-exchange character over b gives 2^m times the character of u*a + t*a*c if the root polynomial vanishes at a, and 0 otherwise.
theorem digit_exchange_walsh_inner_sum
(m : ℕ) [Fintype (GaloisField 2 m)] [DecidableEq (GaloisField 2 m)]
(hm : 1 ≤ m) (c u v s t a : GaloisField 2 m) :
(∑ b : GaloisField 2 m,
(if Algebra.trace (ZMod 2) (GaloisField 2 m)
(u * a + v * b + s * ((a ^ 2 + a + c) * b) +
t * (((a ^ 2 + a + c) * b) ^ 2 + (a ^ 2 + a + c) * b + c) * a) = 0
then (1 : ℤ) else -1))
= if (Polynomial.C (v ^ 2) + (Polynomial.X ^ 2 + Polynomial.X + Polynomial.C c) ^ 2 *
(Polynomial.C (s ^ 2) + Polynomial.C (t ^ 2) * Polynomial.X ^ 2 + Polynomial.C t * Polynomial.X)
: Polynomial (GaloisField 2 m)).eval a = 0
then (2 : ℤ) ^ m *
(if Algebra.trace (ZMod 2) (GaloisField 2 m) (u * a + t * a * c) = 0 then (1 : ℤ) else -1)
else 0digit_exchange_walsh_reductionIn LeanFoundations of Cryptography
The digit-exchange Walsh sum collapses: W = ∑ over a of, if the root polynomial vanishes at a, 2^m times the character of u*a + t*a*c, else 0.
theorem digit_exchange_walsh_reduction
(m : ℕ) [Fintype (GaloisField 2 m)] [DecidableEq (GaloisField 2 m)]
(hm : 1 ≤ m) (c u v s t : GaloisField 2 m) :
digit_exchange_walsh m c u v s t
= ∑ a : GaloisField 2 m,
(if (Polynomial.C (v ^ 2) + (Polynomial.X ^ 2 + Polynomial.X + Polynomial.C c) ^ 2 *
(Polynomial.C (s ^ 2) + Polynomial.C (t ^ 2) * Polynomial.X ^ 2 + Polynomial.C t * Polynomial.X)
: Polynomial (GaloisField 2 m)).eval a = 0
then (2 : ℤ) ^ m *
(if Algebra.trace (ZMod 2) (GaloisField 2 m) (u * a + t * a * c) = 0 then 1 else -1)
else 0)digit_exchange_walsh_root_poly_natDegree_fourIn LeanFoundations of Cryptography
If t = 0 and s ≠ 0, the root polynomial C(v^2) + (X^2+X+C c)^2 * (C(s^2) + C(t^2) X^2 + C t X) has natDegree 4.
theorem digit_exchange_walsh_root_poly_natDegree_four
(m : ℕ) (c v s t : GaloisField 2 m) (ht : t = 0) (hs : s ≠ 0) :
(Polynomial.C (v ^ 2) + (Polynomial.X ^ 2 + Polynomial.X + Polynomial.C c) ^ 2 *
(Polynomial.C (s ^ 2) + Polynomial.C (t ^ 2) * Polynomial.X ^ 2 + Polynomial.C t * Polynomial.X)
: Polynomial (GaloisField 2 m)).natDegree = 4digit_exchange_walsh_root_poly_natDegree_sixIn LeanFoundations of Cryptography
If t ≠ 0, the root polynomial C(v^2) + (X^2+X+C c)^2 * (C(s^2) + C(t^2) X^2 + C t X) has natDegree 6.
theorem digit_exchange_walsh_root_poly_natDegree_six
(m : ℕ) (c v s t : GaloisField 2 m) (ht : t ≠ 0) :
(Polynomial.C (v ^ 2) + (Polynomial.X ^ 2 + Polynomial.X + Polynomial.C c) ^ 2 *
(Polynomial.C (s ^ 2) + Polynomial.C (t ^ 2) * Polynomial.X ^ 2 + Polynomial.C t * Polynomial.X)
: Polynomial (GaloisField 2 m)).natDegree = 6digit_exchange_walsh_root_sum_abs_leIn LeanFoundations of Cryptography
Final triangle-inequality assembly: the collapsed digit-exchange sum has absolute value at most 6 * 2^m.
theorem digit_exchange_walsh_root_sum_abs_le
(m : ℕ) [Fintype (GaloisField 2 m)] [DecidableEq (GaloisField 2 m)]
(hm : 1 ≤ m) (c u v s t : GaloisField 2 m) (hst : (s, t) ≠ (0, 0)) :
|∑ a : GaloisField 2 m,
(if (Polynomial.C (v ^ 2) + (Polynomial.X ^ 2 + Polynomial.X + Polynomial.C c) ^ 2 *
(Polynomial.C (s ^ 2) + Polynomial.C (t ^ 2) * Polynomial.X ^ 2 + Polynomial.C t * Polynomial.X)
: Polynomial (GaloisField 2 m)).eval a = 0
then (2 : ℤ) ^ m *
(if Algebra.trace (ZMod 2) (GaloisField 2 m) (u * a + t * a * c) = 0 then 1 else -1)
else 0)|
≤ 6 * (2 : ℤ) ^ mgalois_field_pow_two_pow_eq_selfIn LeanFoundations of Cryptography
Every element x of the field GaloisField 2 m satisfies x^(2^m) = x.
theorem galois_field_pow_two_pow_eq_self (m : ℕ) (x : GaloisField 2 m) : x ^ 2 ^ m = x
galois_field_trace_quadratic_formIn LeanFoundations of Cryptography
For m ≥ 1, A, b in GaloisField 2 m: Tr(A * b^2) = Tr(A^(2^(m-1)) * b).
theorem galois_field_trace_quadratic_form (m : ℕ) (hm : 1 ≤ m) (A b : GaloisField 2 m) :
Algebra.trace (ZMod 2) (GaloisField 2 m) (A * b ^ 2)
= Algebra.trace (ZMod 2) (GaloisField 2 m) (A ^ 2 ^ (m - 1) * b)galois_field_trace_sqIn LeanFoundations of Cryptography
For m ≥ 1 the absolute trace to ZMod 2 on GaloisField 2 m is invariant under squaring: Tr(y^2) = Tr(y).
theorem galois_field_trace_sq (m : ℕ) (hm : 1 ≤ m) (y : GaloisField 2 m) :
Algebra.trace (ZMod 2) (GaloisField 2 m) (y ^ 2) = Algebra.trace (ZMod 2) (GaloisField 2 m) yhas_degree_le_of_anf_coeff_zeroIn LeanFoundations of Cryptography
A Boolean function whose algebraic normal form coefficients vanish for all subsets of cardinality greater than d has algebraic degree at most d.
theorem has_degree_le_of_anf_coeff_zero {n d : ℕ} (f : (Fin n → ZMod 2) → ZMod 2)
(h_zero : ∀ S : Finset (Fin n), d < S.card → anf_coeff f S = 0) :
has_degree_le f dop928_de_fiber_general_le_twentyIn LeanFoundations of Cryptography
For u ∉ {0, 1} and any v, any solution set S to the differential system has cardinality at most 20 (Fukui arXiv:2611.02572, Section 8, Open Problem (2)).
theorem op928_de_fiber_general_le_twenty {F : Type*} [Field F] [Fintype F] [DecidableEq F] :
(2 : F) = 0 →
∀ (N : ℕ),
(∀ (t : F), (t ^ N) ^ 2 = t) →
∀ (c : F),
(∀ (t : F), t ^ 2 + t + c ≠ 0) →
∀ (u v β1 β2 : F),
u ≠ 0 →
u ≠ 1 →
∀ (S : Finset (F × F)),
(∀ x ∈ S,
((x.1 + u) ^ 2 + (x.1 + u) + c) * (x.2 + v + (x.1 * u) ^ N) + (x.1 ^ 2 + x.1 + c) * x.2 = β1 ∧
((((x.1 + u) ^ 2 + (x.1 + u) + c) * (x.2 + v + (x.1 * u) ^ N)) ^ 2 +
((x.1 + u) ^ 2 + (x.1 + u) + c) * (x.2 + v + (x.1 * u) ^ N) +
c) *
(x.1 + u) +
(x.1 ^ 2 + x.1 + c) * x.2 +
(((x.1 ^ 2 + x.1 + c) * x.2) ^ 2 + (x.1 ^ 2 + x.1 + c) * x.2 + c) * x.1 +
(((x.1 + u) ^ 2 + (x.1 + u) + c) * (x.2 + v + (x.1 * u) ^ N) *
((x.1 ^ 2 + x.1 + c) * x.2)) ^
N =
β2) →
S.card ≤ 20op928_de_fiber_le_twentyIn LeanFoundations of Cryptography
For any non-zero difference pair (u, v) ≠ (0, 0) in a field of characteristic 2 with squaring bijection t ↦ t^N, the fiber size of the differential system is at most 20.
theorem op928_de_fiber_le_twenty {F : Type*} [Field F] [Fintype F] [DecidableEq F] :
(2 : F) = 0 →
∀ (N : ℕ),
(∀ (t : F), (t ^ N) ^ 2 = t) →
∀ (c : F),
(∀ (t : F), t ^ 2 + t + c ≠ 0) →
∀ (u v β1 β2 : F),
¬(u = 0 ∧ v = 0) →
∀ (S : Finset (F × F)),
(∀ x ∈ S,
((x.1 + u) ^ 2 + (x.1 + u) + c) * (x.2 + v + (x.1 * u) ^ N) + (x.1 ^ 2 + x.1 + c) * x.2 = β1 ∧
((((x.1 + u) ^ 2 + (x.1 + u) + c) * (x.2 + v + (x.1 * u) ^ N)) ^ 2 +
((x.1 + u) ^ 2 + (x.1 + u) + c) * (x.2 + v + (x.1 * u) ^ N) +
c) *
(x.1 + u) +
(x.1 ^ 2 + x.1 + c) * x.2 +
(((x.1 ^ 2 + x.1 + c) * x.2) ^ 2 + (x.1 ^ 2 + x.1 + c) * x.2 + c) * x.1 +
(((x.1 + u) ^ 2 + (x.1 + u) + c) * (x.2 + v + (x.1 * u) ^ N) *
((x.1 ^ 2 + x.1 + c) * x.2)) ^
N =
β2) →
S.card ≤ 20op928_de_fiber_one_le_twentyIn LeanFoundations of Cryptography
For u = 1 and any v, any solution set S to the differential system has cardinality at most 20.
theorem op928_de_fiber_one_le_twenty {F : Type*} [Field F] [Fintype F] [DecidableEq F] :
(2 : F) = 0 →
∀ (N : ℕ),
(∀ (t : F), (t ^ N) ^ 2 = t) →
∀ (c : F),
(∀ (t : F), t ^ 2 + t + c ≠ 0) →
∀ (v β1 β2 : F),
∀ (S : Finset (F × F)),
(∀ x ∈ S,
((x.1 + 1) ^ 2 + (x.1 + 1) + c) * (x.2 + v + x.1 ^ N) + (x.1 ^ 2 + x.1 + c) * x.2 = β1 ∧
((((x.1 + 1) ^ 2 + (x.1 + 1) + c) * (x.2 + v + x.1 ^ N)) ^ 2 +
((x.1 + 1) ^ 2 + (x.1 + 1) + c) * (x.2 + v + x.1 ^ N) +
c) *
(x.1 + 1) +
(x.1 ^ 2 + x.1 + c) * x.2 +
(((x.1 ^ 2 + x.1 + c) * x.2) ^ 2 + (x.1 ^ 2 + x.1 + c) * x.2 + c) * x.1 +
(((x.1 + 1) ^ 2 + (x.1 + 1) + c) * (x.2 + v + x.1 ^ N) *
((x.1 ^ 2 + x.1 + c) * x.2)) ^
N =
β2) →
S.card ≤ 20op928_de_fiber_zero_le_twoIn LeanFoundations of Cryptography
For u = 0 and v ≠ 0, any solution set S to the differential system has cardinality at most 2.
theorem op928_de_fiber_zero_le_two {F : Type*} [Field F] [Fintype F] [DecidableEq F] :
(2 : F) = 0 →
∀ (N : ℕ),
(∀ (t : F), (t ^ N) ^ 2 = t) →
∀ (c : F),
(∀ (t : F), t ^ 2 + t + c ≠ 0) →
∀ (v β1 β2 : F),
v ≠ 0 →
∀ (S : Finset (F × F)),
(∀ x ∈ S,
(x.1 ^ 2 + x.1 + c) * (x.2 + v) + (x.1 ^ 2 + x.1 + c) * x.2 = β1 ∧
(((x.1 ^ 2 + x.1 + c) * (x.2 + v)) ^ 2 + (x.1 ^ 2 + x.1 + c) * (x.2 + v) + c) * x.1 +
(x.1 ^ 2 + x.1 + c) * x.2 +
(((x.1 ^ 2 + x.1 + c) * x.2) ^ 2 + (x.1 ^ 2 + x.1 + c) * x.2 + c) * x.1 +
(((x.1 ^ 2 + x.1 + c) * (x.2 + v) * ((x.1 ^ 2 + x.1 + c) * x.2)) ^ N) = β2) →
S.card ≤ 2op_1608_char_two_trace_sqIn LeanFoundations of Cryptography
For every element x in GaloisField 2 m, the absolute trace to ZMod 2 of x^2 equals the trace of x.
theorem op_1608_char_two_trace_sq (m : ℕ) (x : GaloisField 2 m) :
Algebra.trace (ZMod 2) (GaloisField 2 m) (x ^ 2) = Algebra.trace (ZMod 2) (GaloisField 2 m) xop_1608_digit_exchange_walsh_le_six_poly_natDegree_leIn LeanFoundations of Cryptography
For (s,t) ≠ (0,0) the root polynomial is nonzero and has natDegree at most 6.
theorem op_1608_digit_exchange_walsh_le_six_poly_natDegree_le
(m : ℕ) (c v s t : GaloisField 2 m) (hst : (s, t) ≠ (0, 0)) :
(Polynomial.C (v ^ 2) + (Polynomial.X ^ 2 + Polynomial.X + Polynomial.C c) ^ 2 *
(Polynomial.C (s ^ 2) + Polynomial.C (t ^ 2) * Polynomial.X ^ 2 + Polynomial.C t * Polynomial.X)
: Polynomial (GaloisField 2 m)).natDegree ≤ 6op_1608_digit_exchange_walsh_le_six_poly_ne_zeroIn LeanFoundations of Cryptography
For (s,t) ≠ (0,0) the root polynomial C(v^2) + (X^2+X+C c)^2 * (C(s^2) + C(t^2) X^2 + C t X) is nonzero.
theorem op_1608_digit_exchange_walsh_le_six_poly_ne_zero
(m : ℕ) (c v s t : GaloisField 2 m) (hst : (s, t) ≠ (0, 0)) :
(Polynomial.C (v ^ 2) + (Polynomial.X ^ 2 + Polynomial.X + Polynomial.C c) ^ 2 *
(Polynomial.C (s ^ 2) + Polynomial.C (t ^ 2) * Polynomial.X ^ 2 + Polynomial.C t * Polynomial.X)
: Polynomial (GaloisField 2 m)) ≠ 0op_1608_digit_exchange_walsh_le_six_root_countIn LeanFoundations of Cryptography
For (s,t) ≠ (0,0), the number of a in GaloisField 2 m at which the root polynomial vanishes is at most 6.
theorem op_1608_digit_exchange_walsh_le_six_root_count
(m : ℕ) [Fintype (GaloisField 2 m)] [DecidableEq (GaloisField 2 m)]
(c v s t : GaloisField 2 m) (hst : (s, t) ≠ (0, 0)) :
(Finset.univ.filter (fun a : GaloisField 2 m =>
(Polynomial.C (v ^ 2) + (Polynomial.X ^ 2 + Polynomial.X + Polynomial.C c) ^ 2 *
(Polynomial.C (s ^ 2) + Polynomial.C (t ^ 2) * Polynomial.X ^ 2 + Polynomial.C t * Polynomial.X)
: Polynomial (GaloisField 2 m)).eval a = 0)).card ≤ 6op_1608_walsh_mag_ne_fiveIn LeanFoundations of Cryptography
For every integer m ≥ 1, every element c in GaloisField 2 m with absolute trace 1, all input masks u, v, and all nonzero output masks (s, t) ≠ (0, 0), the absolute value of digit_exchange_walsh m c u v s t cannot equal 5 * 2^m.
theorem op_1608_walsh_mag_ne_five (m : ℕ) (hm : 1 ≤ m) (c : GaloisField 2 m)
(hc : Algebra.trace (ZMod 2) (GaloisField 2 m) c = 1)
(u v s t : GaloisField 2 m) (hst : (s, t) ≠ (0, 0)) :
|digit_exchange_walsh m c u v s t| ≠ 5 * (2 : ℤ) ^ mtwo_pow_sub_one_mul_twoIn LeanFoundations of Cryptography
For m ≥ 1, 2^(m-1) * 2 = 2^m as natural numbers.
theorem two_pow_sub_one_mul_two (m : ℕ) (hm : 1 ≤ m) : 2 ^ (m - 1) * 2 = 2 ^ m
flag_hash_offset_bijectiveIn LeanData Structures
For any finite group G equipped with a prime composition series and flag representatives reps, flag_hash_offset reps is a bijective function from Fin (∏ i, p i) to G.
theorem flag_hash_offset_bijective {k : ℕ} {p : Fin k → ℕ}
{G : Type*} [Group G] [Fintype G] [DecidableEq G]
{series : GroupPrimeCompositionSeries G k p} (reps : FlagRepresentatives series) :
Function.Bijective (flag_hash_offset reps)flag_hash_offset_digit_eq_zeroIn LeanData Structures
If j is below the product of the first m quotient orders, then for every digit position i ≥ m the corresponding mixed-radix digit of j is zero.
theorem flag_hash_offset_digit_eq_zero {k : ℕ} (p : Fin k → ℕ) (hp : ∀ i, 0 < p i)
(m : ℕ) (j : ℕ) (i : Fin k)
(hj : j < ∏ a ∈ Finset.univ.filter (fun a : Fin k => (a : ℕ) < m), p a)
(hi : m ≤ (i : ℕ)) :
j / (∏ a ∈ Finset.univ.filter (fun a : Fin k => (a : ℕ) < i), p a) % p i = 0flag_hash_offset_prefix_memIn LeanData Structures
For a prime composition series and flag representatives, every flag offset whose mixed-radix value is below prod over the first m quotient orders lies in the subgroup H m of the chain.
theorem flag_hash_offset_prefix_mem {G : Type*} [Group G] {k : ℕ} {p : Fin k → ℕ}
{series : GroupPrimeCompositionSeries G k p} (reps : FlagRepresentatives series)
(m : ℕ) (hm : m ≤ k) (j : Fin (∏ i : Fin k, p i))
(hj : (j : ℕ) < ∏ a ∈ Finset.univ.filter (fun a : Fin k => (a : ℕ) < m), p a) :
flag_hash_offset reps j ∈ series.H ⟨m, by omega⟩flagprobe_reduced_count_invariantIn LeanData Structures
For two groups with prime composition series of the same length and quotient orders, the number of length-t insertion sequences whose occupied set contains all of the first c flag offsets is the same in both groups.
theorem flagprobe_reduced_count_invariant {k : ℕ} (p : Fin k → ℕ)
(G₁ : Type*) [Group G₁] [Fintype G₁] [DecidableEq G₁]
(series₁ : GroupPrimeCompositionSeries G₁ k p) (reps₁ : FlagRepresentatives series₁)
(G₂ : Type*) [Group G₂] [Fintype G₂] [DecidableEq G₂]
(series₂ : GroupPrimeCompositionSeries G₂ k p) (reps₂ : FlagRepresentatives series₂)
(t c : ℕ) :
(Finset.univ.filter (fun A : Fin t → G₁ => ∀ j : Fin (∏ i : Fin k, p i),
(j : ℕ) < c → flag_hash_offset reps₁ j ∈
group_hash_occupied_slots (∏ i : Fin k, p i) (flag_hash_offset reps₁) (List.ofFn A))).card =
(Finset.univ.filter (fun A : Fin t → G₂ => ∀ j : Fin (∏ i : Fin k, p i),
(j : ℕ) < c → flag_hash_offset reps₂ j ∈
group_hash_occupied_slots (∏ i : Fin k, p i) (flag_hash_offset reps₂) (List.ofFn A))).cardgroup_hash_insert_step_card_of_ltIn LeanData Structures
For any group G with decidable equality, table size n, injective offset sequence r : Fin n → G, and occupied set T with card < n, inserting an element a increases the occupied count by exactly 1.
theorem group_hash_insert_step_card_of_lt {G : Type*} [Group G] [DecidableEq G]
(n : ℕ) (r : Fin n → G) (hr : Function.Injective r) (T : Finset G) (hT : T.card < n) (a : G) :
(group_hash_insert_step n r T a).card = T.card + 1group_hash_insert_step_mul_leftIn LeanData Structures
Left translation commutes with one insertion step: translating the occupied set and the key by the same element c on the left gives the translate of the updated occupied set.
theorem group_hash_insert_step_mul_left {G : Type*} [Group G] [DecidableEq G]
(n : ℕ) (r : Fin n → G) (T : Finset G) (a c : G) :
(group_hash_insert_step n r T a).image (fun x => c * x) =
group_hash_insert_step n r (T.image (fun x => c * x)) (c * a)group_hash_occupied_slots_cardIn LeanData Structures
For any group G with decidable equality, table size n, injective offset sequence r : Fin n → G, and insertion list A of length at most n, the number of occupied slots after inserting A is exactly A.length.
theorem group_hash_occupied_slots_card {G : Type*} [Group G] [DecidableEq G]
(n : ℕ) (r : Fin n → G) (hr : Function.Injective r) (A : List G) (hA : A.length ≤ n) :
(group_hash_occupied_slots n r A).card = A.lengthgroup_hash_occupied_slots_map_mul_leftIn LeanData Structures
Inserting a list A into an occupied set T and then translating the result by c equals inserting the translated list c·A into the translated set c·T.
theorem group_hash_occupied_slots_map_mul_left {G : Type*} [Group G] [DecidableEq G]
(n : ℕ) (r : Fin n → G) (T : Finset G) (A : List G) (c : G) :
(A.foldl (group_hash_insert_step n r) T).image (fun x => c * x) =
(A.map (fun x => c * x)).foldl (group_hash_insert_step n r) (T.image (fun x => c * x))group_hash_probe_tail_count_eq_card_mulIn LeanData Structures
For any finite group G with decidable equality, the check that the first c offsets are occupied costs a factor of exactly |G|: the probe tail count of G at n, r, t, c is |G| times the number of length-t insertion sequences A whose occupied set contains every offset r j with j < c.
theorem group_hash_probe_tail_count_eq_card_mul {G : Type*} [Group G] [Fintype G] [DecidableEq G]
(n : ℕ) (r : Fin n → G) (t c : ℕ) :
group_hash_probe_tail_count G n r t c =
Fintype.card G * (Finset.univ.filter (fun B : Fin t → G =>
∀ j : Fin n, (j : ℕ) < c →
r j ∈ group_hash_occupied_slots n r (List.ofFn B))).cardgroup_hash_probe_tail_count_eq_of_card_and_reduced_eqIn LeanData Structures
For two finite groups of the same cardinality and with equal reduced counts (for the given n, r1/r2, t and c), the probe tail counts are equal.
theorem group_hash_probe_tail_count_eq_of_card_and_reduced_eq
{G₁ : Type*} [Group G₁] [Fintype G₁] [DecidableEq G₁]
{G₂ : Type*} [Group G₂] [Fintype G₂] [DecidableEq G₂]
(hcard : Fintype.card G₁ = Fintype.card G₂)
(n : ℕ) (r₁ : Fin n → G₁) (r₂ : Fin n → G₂) (t c : ℕ)
(hred : (Finset.univ.filter (fun B : Fin t → G₁ =>
∀ j : Fin n, (j : ℕ) < c → r₁ j ∈ group_hash_occupied_slots n r₁ (List.ofFn B))).card =
(Finset.univ.filter (fun B : Fin t → G₂ =>
∀ j : Fin n, (j : ℕ) < c → r₂ j ∈ group_hash_occupied_slots n r₂ (List.ofFn B))).card) :
group_hash_probe_tail_count G₁ n r₁ t c = group_hash_probe_tail_count G₂ n r₂ t cgroup_hash_probe_tail_count_of_gtIn LeanData Structures
For any finite group G with decidable equality, table size n, injective offset sequence r : Fin n → G, and natural numbers t, c with t < n and t < c, the probe tail count is 0.
theorem group_hash_probe_tail_count_of_gt (G : Type*) [Group G] [Fintype G] [DecidableEq G]
(n : ℕ) (r : Fin n → G) (hr : Function.Injective r) (t c : ℕ) (ht : t < n) (hc : t < c) :
group_hash_probe_tail_count G n r t c = 0group_hash_probe_tail_count_oneIn LeanData Structures
For any finite group G with decidable equality, table size n > 0, injective offset sequence r with r ⟨0, hn⟩ = 1, and insertion length t < n, the probe tail count group_hash_probe_tail_count G n r t 1 equals t * (Fintype.card G)^t.
theorem group_hash_probe_tail_count_one (G : Type*) [Group G] [Fintype G] [DecidableEq G]
(n : ℕ) (hn : 0 < n) (r : Fin n → G) (hr : Function.Injective r) (hr0 : r ⟨0, hn⟩ = 1)
(t : ℕ) (ht : t < n) :
group_hash_probe_tail_count G n r t 1 = t * (Fintype.card G) ^ tgroup_hash_reduced_count_of_gtIn LeanData Structures
For an injective offset sequence, table size n, and t < c with t < n, no length-t insertion sequence can occupy c distinct offsets, so the reduced count is zero.
theorem group_hash_reduced_count_of_gt {G : Type*} [Group G] [Fintype G] [DecidableEq G]
(n : ℕ) (r : Fin n → G) (hr : Function.Injective r) (t c : ℕ) (ht : t < n) (hc : t < c) :
(Finset.univ.filter (fun B : Fin t → G =>
∀ j : Fin n, (j : ℕ) < c → r j ∈ group_hash_occupied_slots n r (List.ofFn B))).card = 0group_hash_reduced_count_t_zeroIn LeanData Structures
If the table is nonempty and the threshold c is positive, no length-0 insertion sequence occupies any offset, so the reduced count is zero.
theorem group_hash_reduced_count_t_zero {G : Type*} [Group G] [Fintype G] [DecidableEq G]
(n : ℕ) (hn : 0 < n) (r : Fin n → G) (c : ℕ) (hc : 0 < c) :
(Finset.univ.filter (fun B : Fin 0 → G =>
∀ j : Fin n, (j : ℕ) < c → r j ∈ group_hash_occupied_slots n r (List.ofFn B))).card = 0group_prime_composition_series_cardIn LeanData Structures
For any finite group G with a prime composition series of length k and quotient orders p : Fin k → ℕ, the cardinality of G is equal to ∏ i : Fin k, p i.
theorem group_prime_composition_series_card {k : ℕ} (p : Fin k → ℕ)
(G : Type*) [Group G] [Fintype G]
(series : GroupPrimeCompositionSeries G k p) :
Fintype.card G = ∏ i : Fin k, p igroup_prime_composition_series_monoIn LeanData Structures
The subgroups of a prime composition series are monotone along the chain: H i ≤ H j whenever i ≤ j.
theorem group_prime_composition_series_mono {G : Type*} [Group G] {k : ℕ} {p : Fin k → ℕ}
(series : GroupPrimeCompositionSeries G k p) {i j : Fin (k + 1)} (h : i ≤ j) :
series.H i ≤ series.H jhash_coordinate_deleted_seqs_cardIn LeanData Structures
For any table size n, offset sequence r, slot subset S, length t, and coordinate i : Fin t, the fiber of sequences H : Fin t → ZMod n whose deletion of coordinate i fully occupies S has cardinality n * hash_count_fully_occupied n r S (t - 1).
theorem hash_coordinate_deleted_seqs_card
(n : ℕ) [NeZero n] (r : Fin n → ZMod n)
(S : Finset (ZMod n)) (t : ℕ) (i : Fin t) :
(Finset.univ.filter (fun H : Fin t → ZMod n => hash_occupy_count n r S ((List.ofFn H).eraseIdx i.val) = S.card)).card =
n * hash_count_fully_occupied n r S (t - 1)hash_coordinate_deleted_seqs_subsetIn LeanData Structures
For any table size n, offset sequence r, slot subset S, length t, and coordinate i : Fin t, any sequence H : Fin t → ZMod n whose deletion of coordinate i fully occupies S must also belong to hash_fully_occupied_seqs n r S t.
theorem hash_coordinate_deleted_seqs_subset
(n : ℕ) [NeZero n] (r : Fin n → ZMod n)
(S : Finset (ZMod n)) (t : ℕ) (i : Fin t) :
Finset.univ.filter (fun H : Fin t → ZMod n => hash_occupy_count n r S ((List.ofFn H).eraseIdx i.val) = S.card) ⊆
hash_fully_occupied_seqs n r S thash_fiber_sum_reindexIn LeanData Structures
Summing a function of (deleted sequence, deleted value) over all sequences whose coordinate-i deletion fully occupies S equals summing, over all length-m sequences fully occupying S, the sum over the deleted slot value.
theorem hash_fiber_sum_reindex (n : ℕ) [NeZero n] (r : Fin n → ZMod n) (S : Finset (ZMod n))
(m : ℕ) (i : Fin (m + 1)) (f : List (ZMod n) → ZMod n → ℝ) :
∑ H ∈ Finset.univ.filter (fun H : Fin (m + 1) → ZMod n =>
hash_occupy_count n r S (List.ofFn (i.removeNth H)) = S.card),
f (List.ofFn (i.removeNth H)) (H i) =
∑ B ∈ hash_fully_occupied_seqs n r S m, ∑ e : ZMod n, f (List.ofFn B) ehash_insertNth_filter_fiberIn LeanData Structures
The set of sequences H whose coordinate-i deletion fully occupies S is exactly the image of (slot value) × (fully occupying sequences of length m) under re-inserting coordinate i.
theorem hash_insertNth_filter_fiber (n : ℕ) [NeZero n] (r : Fin n → ZMod n) (S : Finset (ZMod n))
(m : ℕ) (i : Fin (m + 1)) :
Finset.univ.filter (fun H : Fin (m + 1) → ZMod n =>
hash_occupy_count n r S (List.ofFn (i.removeNth H)) = S.card) =
((Finset.univ : Finset (ZMod n)) ×ˢ hash_fully_occupied_seqs n r S m).map
(Fin.insertNthEquiv (fun _ : Fin (m + 1) => ZMod n) i).toEmbeddinghash_insert_step_closeIn LeanData Structures
If T ⊆ T' and T' differs from T by at most one element c, then one insert step from T' lands within one element of one insert step from T (with the extra element allowed to change).
theorem hash_insert_step_close (n : ℕ) (r : Fin n → ZMod n) (T T' : Finset (ZMod n)) (a c : ZMod n)
(h1 : T ⊆ T') (h2 : T' ⊆ T ∪ {c}) :
∃ c', hash_insert_step n r T' a ⊆ hash_insert_step n r T a ∪ {c'}hash_occupied_slots_add_shiftIn LeanData Structures
Shifting every key of an insertion sequence by a constant c shifts the set of occupied slots by the same c: inserting the list A, keywise translated by c, occupies exactly the slots Occ(A) + c.
theorem hash_occupied_slots_add_shift (n : ℕ) (r : Fin n → ZMod n) (A : List (ZMod n)) (c : ZMod n) : hash_occupied_slots n r (A.map (fun a => a + c)) = (hash_occupied_slots n r A).image (fun x => x + c)
hash_occupy_count_append_le_insertIn LeanData Structures
Inserting one element anywhere never decreases the number of occupied slots of S: occ(P ++ Q) ≤ occ(P ++ e :: Q).
theorem hash_occupy_count_append_le_insert (n : ℕ) (r : Fin n → ZMod n) (S : Finset (ZMod n))
(P Q : List (ZMod n)) (e : ZMod n) :
hash_occupy_count n r S (P ++ Q) ≤ hash_occupy_count n r S (P ++ e :: Q)hash_occupy_count_insert_le_appendIn LeanData Structures
occ(P ++ e :: Q) ≤ occ(P ++ Q) + 1.
theorem hash_occupy_count_insert_le_append (n : ℕ) (r : Fin n → ZMod n) (S : Finset (ZMod n))
(P Q : List (ZMod n)) (e : ZMod n) :
hash_occupy_count n r S (P ++ e :: Q) ≤ hash_occupy_count n r S (P ++ Q) + 1hash_occupy_count_swap_leIn LeanData Structures
occ(P ++ e :: Q) ≤ occ(P ++ x :: Q) + 1.
theorem hash_occupy_count_swap_le (n : ℕ) (r : Fin n → ZMod n) (S : Finset (ZMod n))
(P Q : List (ZMod n)) (e x : ZMod n) :
hash_occupy_count n r S (P ++ e :: Q) ≤ hash_occupy_count n r S (P ++ x :: Q) + 1hash_ofFn_eraseIdx_eq_removeNthIn LeanData Structures
For a sequence H : Fin (m+1) → ZMod n, deleting the i-th entry of the list of values of H is the same as listing the values of the sequence with coordinate i removed.
theorem hash_ofFn_eraseIdx_eq_removeNth (n m : ℕ) (H : Fin (m + 1) → ZMod n) (i : Fin (m + 1)) :
(List.ofFn H).eraseIdx i.val = List.ofFn (i.removeNth H)hash_potential_delta_le_oneIn LeanData Structures
For any table size n, offset sequence r, slot subset S, length t, prefix A, and next element e, hash_potential_delta n r S t A e ≤ 1.
theorem hash_potential_delta_le_one
(n : ℕ) [NeZero n] (r : Fin n → ZMod n)
(S : Finset (ZMod n)) (t : ℕ) (A : List (ZMod n)) (e : ZMod n) :
hash_potential_delta n r S t A e ≤ 1hash_potential_delta_sum_eq_zeroIn LeanData Structures
For A shorter than t, ∑ over e : ZMod n of hash_potential_delta n r S t A e is 0.
theorem hash_potential_delta_sum_eq_zero (n : ℕ) [NeZero n] (r : Fin n → ZMod n) (S : Finset (ZMod n))
(t : ℕ) (A : List (ZMod n)) (hA : A.length < t) :
∑ e : ZMod n, hash_potential_delta n r S t A e = 0hash_potential_harmonicIn LeanData Structures
For a prefix A shorter than the target length t, the potential of A is the average over the next inserted element of the potentials of A ++ [e].
theorem hash_potential_harmonic (n : ℕ) [NeZero n] (r : Fin n → ZMod n) (S : Finset (ZMod n))
(t : ℕ) (A : List (ZMod n)) (hA : A.length < t) :
∑ e : ZMod n, hash_potential n r S t (A ++ [e]) = (n : ℝ) * hash_potential n r S t Ahash_prefix_occupancy_aggregate_eq_sum_exact_occupiedIn LeanData Structures
Summing over k the number of length-t insertion sequences whose occupied set contains the first k offsets of r equals the sum over sets S of slots of (number of sequences with occupied set exactly S) times (number of k for which r(0),...,r(k-1) all lie in S).
theorem hash_prefix_occupancy_aggregate_eq_sum_exact_occupied (n : ℕ) [NeZero n] (r : Fin n → ZMod n) (t : ℕ) : (∑ k ∈ Finset.range (n + 1), (Finset.univ.filter (fun A : Fin t → ZMod n => ∀ j : Fin n, j.val < k → r j ∈ hash_occupied_slots n r (List.ofFn A))).card) = ∑ S : Finset (ZMod n), (Finset.univ.filter (fun A : Fin t → ZMod n => hash_occupied_slots n r (List.ofFn A) = S)).card * ((Finset.range (n + 1)).filter (fun k => ∀ j : Fin n, j.val < k → r j ∈ S)).card
hash_prefix_occupancy_aggregate_le_linearIn LeanData Structures
For n ≥ 2, a bijective offset sequence r with r 0 = 0 and r 1 a unit, and t < n, the total over k of the number of length-t insertion sequences whose occupied set contains r(0),...,r(k-1) is at most the corresponding total for linear probing: linear probing maximises the expected length of the occupied initial segment of the probe order.
theorem hash_prefix_occupancy_aggregate_le_linear (n : ℕ) [NeZero n] (hn : 2 ≤ n) (r : Fin n → ZMod n) (hr_bij : Function.Bijective r) (hr0 : r 0 = 0) (hr1 : IsUnit (r 1)) (t : ℕ) (ht : t < n) : (∑ k ∈ Finset.range (n + 1), (Finset.univ.filter (fun A : Fin t → ZMod n => ∀ j : Fin n, j.val < k → r j ∈ hash_occupied_slots n r (List.ofFn A))).card) ≤ (∑ k ∈ Finset.range (n + 1), (Finset.univ.filter (fun A : Fin t → ZMod n => ∀ j : Fin n, j.val < k → linear_probe_offset n j ∈ hash_occupied_slots n (linear_probe_offset n) (List.ofFn A))).card)
hash_probe_expected_cost_eq_tail_count_sum_divIn LeanData Structures
The expected probe cost equals the total over k of the probe tail counts, divided by n^(t+1): the aggregation of the tail probabilities is a single normalised integer sum.
theorem hash_probe_expected_cost_eq_tail_count_sum_div (n : ℕ) [NeZero n] (r : Fin n → ZMod n) (t : ℕ) : hash_probe_expected_cost n r t = ((∑ k ∈ Finset.range (n + 1), hash_probe_tail_count n r t k : ℕ) : ℝ) / (n : ℝ) ^ (t + 1)
hash_probe_expected_cost_le_of_tail_count_sum_leIn LeanData Structures
If the total probe tail count of r at load t is at most that of linear probing, then the expected probe cost of r is at most that of linear probing.
theorem hash_probe_expected_cost_le_of_tail_count_sum_le (n : ℕ) [NeZero n] (r : Fin n → ZMod n) (t : ℕ) (h : (∑ k ∈ Finset.range (n + 1), hash_probe_tail_count n r t k) ≤ ∑ k ∈ Finset.range (n + 1), hash_probe_tail_count n (linear_probe_offset n) t k) : hash_probe_expected_cost n r t ≤ hash_probe_expected_cost n (linear_probe_offset n) t
hash_probe_expected_cost_oneIn LeanData Structures
For any table size n ≥ 2 with [NeZero n], and any bijective offset sequence r with r 0 = 0, the expected probe cost to insert an additional key at load t = 1 is exactly 1 + 1 / (n : ℝ).
theorem hash_probe_expected_cost_one (n : ℕ) [NeZero n] (hn : 2 ≤ n)
(r : Fin n → ZMod n) (hr : Function.Bijective r) (hr0 : r 0 = 0) :
hash_probe_expected_cost n r 1 = 1 + 1 / (n : ℝ)hash_probe_expected_cost_one_freeIn LeanData Structures
With exactly one free slot, the expected insertion cost is (n+1)/2 for any bijective offset order.
theorem hash_probe_expected_cost_one_free (n : ℕ) [NeZero n]
(r : Fin n → ZMod n) (hr : Function.Bijective r) :
hash_probe_expected_cost n r (n-1) = ((n : ℝ) + 1) / 2
hash_probe_expected_cost_unit_scalingIn LeanData Structures
Multiplying every offset of a probe sequence by a unit c of ZMod n leaves the expected probe cost unchanged; in particular one may normalise r 1 to 1.
theorem hash_probe_expected_cost_unit_scaling (n : ℕ) [NeZero n] (r : Fin n → ZMod n) (c : ZMod n) (hc : IsUnit c) (t : ℕ) : hash_probe_expected_cost n (fun j => c * r j) t = hash_probe_expected_cost n r t
hash_probe_tail_count_translation_reductionIn LeanData Structures
The number of (insertion sequence, query slot) pairs whose insertion cost exceeds k equals n times the number of length-t insertion sequences whose occupied set contains r(0),...,r(k-1) — because summing over the query slot is cancelled by translating the keys.
theorem hash_probe_tail_count_translation_reduction (n : ℕ) [NeZero n] (r : Fin n → ZMod n) (t k : ℕ) : hash_probe_tail_count n r t k = n * (Finset.univ.filter (fun A : Fin t → ZMod n => ∀ j : Fin n, j.val < k → r j ∈ hash_occupied_slots n r (List.ofFn A))).card
hash_step_delta_sum_fiber_eq_zeroIn LeanData Structures
For any table size n, offset sequence r, slot subset S, length t, and coordinate i : Fin t, the sum of hash_potential_delta over sequences H in the coordinate-i deletion fiber is 0.
theorem hash_step_delta_sum_fiber_eq_zero
(n : ℕ) [NeZero n] (r : Fin n → ZMod n)
(S : Finset (ZMod n)) (t : ℕ) (i : Fin t) :
∑ H ∈ Finset.univ.filter (fun H : Fin t → ZMod n => hash_occupy_count n r S ((List.ofFn H).eraseIdx i.val) = S.card),
hash_potential_delta n r S t ((List.ofFn H).take i.val) (H i) = 0hash_step_delta_sum_fully_occupied_leIn LeanData Structures
For any slot subset S and index i : Fin t, the sum of potential changes hash_potential_delta n r S t ((List.ofFn H).take i.val) (H i) over all sequences H in hash_fully_occupied_seqs n r S t is at most (hash_count_fully_occupied n r S t : ℝ) - (n : ℝ) * hash_count_fully_occupied n r S (t - 1).
theorem hash_step_delta_sum_fully_occupied_le
(n : ℕ) [NeZero n] (r : Fin n → ZMod n)
(S : Finset (ZMod n)) (t : ℕ) (i : Fin t) :
∑ H ∈ hash_fully_occupied_seqs n r S t,
hash_potential_delta n r S t ((List.ofFn H).take i.val) (H i) ≤
(hash_count_fully_occupied n r S t : ℝ) - (n : ℝ) * hash_count_fully_occupied n r S (t - 1)hash_unit_first_truncated_probe_cost_maximumIn LeanData Structures
Every capped expected insertion cost is conjectured no greater than linear probing for unit-first offsets.
theorem hash_unit_first_truncated_probe_cost_maximum
(n : ℕ) [NeZero n] (hn : 2 ≤ n) (r : Fin n → ZMod n)
(hr : Function.Bijective r) (hr0 : r 0 = 0) (hr1 : IsUnit (r 1))
(t K : ℕ) (ht : t < n) (hK : K ≤ n) :
(∑ k ∈ Finset.range (K+1), hash_probe_tail_prob n r t k) ≤
∑ k ∈ Finset.range (K+1), hash_probe_tail_prob n (linear_probe_offset n) t kmixed_radix_offset_even_double_zero_permIn LeanData Structures
For any even table size n > 2, there exists a permutation P of the prime factors of n such that doubling the offset mixed_radix_offset n P 1 gives 0 in ZMod n.
theorem mixed_radix_offset_even_double_zero_perm (n : ℕ) [NeZero n] (hn : 2 < n) (heven : 2 ∣ n) :
∃ P : List ℕ, P.Perm (Nat.primeFactorsList n) ∧
mixed_radix_offset n P 1 + mixed_radix_offset n P 1 = 0mixed_radix_offset_worst_mean_probe_normalizedIn LeanData Structures
For any table size n ≥ 2, any load t < n, and any normalized bijective probe sequence r with r 0 = 0, there exists an ordering P of the prime factors of n such that the expected probe cost under r is at most that under mixed_radix_offset n P.
theorem mixed_radix_offset_worst_mean_probe_normalized
(n : ℕ) [NeZero n] (hn : 2 ≤ n)
(r : Fin n → ZMod n) (hr_bij : Function.Bijective r) (hr0 : r 0 = 0)
(t : ℕ) (ht : t < n) :
∃ P : List ℕ, P.Perm (Nat.primeFactorsList n) ∧
hash_probe_expected_cost n r t ≤ hash_probe_expected_cost n (mixed_radix_offset n P) tmixed_radix_offset_worst_mean_probe_normalized_endpointIn LeanData Structures
For any table size n ≥ 2, any load t < n satisfying t ≤ 2 or t = n - 1, and any normalized bijective probe sequence r with r 0 = 0, there exists a permutation P of the prime factors of n such that the expected probe cost under r is at most that under mixed_radix_offset n P.
theorem mixed_radix_offset_worst_mean_probe_normalized_endpoint
(n : ℕ) [NeZero n] (hn : 2 ≤ n)
(r : Fin n → ZMod n) (hr_bij : Function.Bijective r) (hr0 : r 0 = 0)
(t : ℕ) (ht : t < n) (ht_cases : t ≤ 2 ∨ t = n - 1) :
∃ P : List ℕ, P.Perm (Nat.primeFactorsList n) ∧
hash_probe_expected_cost n r t ≤ hash_probe_expected_cost n (mixed_radix_offset n P) tmixed_radix_offset_worst_mean_probe_normalized_middleIn LeanData Structures
For any table size n ≥ 5, any intermediate load 3 ≤ t ≤ n - 2, and any normalized bijective probe sequence r with r 0 = 0, there exists a permutation P of the prime factors of n such that the expected probe cost under r is at most that under mixed_radix_offset n P.
theorem mixed_radix_offset_worst_mean_probe_normalized_middle
(n : ℕ) [NeZero n] (hn : 5 ≤ n)
(r : Fin n → ZMod n) (hr_bij : Function.Bijective r) (hr0 : r 0 = 0)
(t : ℕ) (ht_lo : 3 ≤ t) (ht_hi : t ≤ n - 2) :
∃ P : List ℕ, P.Perm (Nat.primeFactorsList n) ∧
hash_probe_expected_cost n r t ≤ hash_probe_expected_cost n (mixed_radix_offset n P) tmixed_radix_offset_zeroIn LeanData Structures
For any table size n > 0 and any list of factors P, the mixed-radix reversed offset at index 0 is 0 in ZMod n.
theorem mixed_radix_offset_zero (n : ℕ) (P : List ℕ) (hn : 0 < n) :
mixed_radix_offset n P ⟨0, hn⟩ = 0odd_probe_offset_double_ne_zeroIn LeanData Structures
For an odd table size n > 2, any bijective offset sequence r with r 0 = 0 satisfies r 1 + r 1 ≠ 0 in ZMod n.
theorem odd_probe_offset_double_ne_zero (n : ℕ) [NeZero n] (hn : 2 < n) (hodd : ¬ 2 ∣ n)
(r : Fin n → ZMod n) (hr : Function.Bijective r) (hr0 : r 0 = 0) :
r 1 + r 1 ≠ 0prime_fixed_offset_linear_probe_tail_prob_interior_leIn LeanData Structures
For prime p, any bijective offset sequence r with r 0 = 0, and load t < p, in the interior regime 2 ≤ k ≤ t, the probe tail probability under r is bounded by that under linear probing.
theorem prime_fixed_offset_linear_probe_tail_prob_interior_le
(p : ℕ) [Fact (Nat.Prime p)]
(r : Fin p → ZMod p) (hr_bij : Function.Bijective r) (hr0 : r 0 = 0)
(t k : ℕ) (ht : t < p) (hk2 : 2 ≤ k) (hkt : k ≤ t) :
hash_probe_tail_prob p r t k ≤ hash_probe_tail_prob p (linear_probe_offset p) t kunit_first_fixed_offset_mean_probe_eq_oneIn LeanData Structures
For every table size n ≥ 2 with NeZero n and every bijective probe sequence r with r 0 = 0 and IsUnit (r 1), the expected probe cost at load t = 1 matches that of linear probing.
theorem unit_first_fixed_offset_mean_probe_eq_one
(n : ℕ) [NeZero n] (hn : 2 ≤ n)
(r : Fin n → ZMod n) (hr_bij : Function.Bijective r)
(hr0 : r 0 = 0) (hr1 : IsUnit (r 1)) :
hash_probe_expected_cost n r 1 = hash_probe_expected_cost n (linear_probe_offset n) 1unit_first_fixed_offset_tail_count_sum_le_linear_fourIn LeanData Structures
For a 4-slot table, every bijective offset sequence with r 0 = 0 and r 1 a unit has, at every load t < 4, a total probe tail count at most that of linear probing; equivalently the expected-cost inequality holds at n = 4.
theorem unit_first_fixed_offset_tail_count_sum_le_linear_four : ∀ (r : Fin 4 → ZMod 4), Function.Bijective r → r 0 = 0 → IsUnit (r 1) → ∀ t : ℕ, t < 4 → (∑ k ∈ Finset.range 5, hash_probe_tail_count 4 r t k) ≤ ∑ k ∈ Finset.range 5, hash_probe_tail_count 4 (linear_probe_offset 4) t k
adjacency_lambda2_eq_adjMatrix_eigenvalues0In LeanGraph Theory & Graph Algorithms
For a simple graph G on a finite vertex type with 2 ≤ |V| and decidable adjacency, adjacency_lambda2 G equals the eigenvalue at index 1 of the Hermitian adjacency matrix G.adjMatrix ℝ.
theorem adjacency_lambda2_eq_adjMatrix_eigenvalues0 {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hn : 2 ≤ Fintype.card V) :
adjacency_lambda2 G = (SimpleGraph.isHermitian_adjMatrix ℝ G).eigenvalues₀ ⟨1, hn⟩adjacency_lambda2_le_of_degree_boundIn LeanGraph Theory & Graph Algorithms
For a finite graph G with 2 ≤ |V|, if every vertex satisfies deg(v) + 2 ≤ mu1(G), then lambda2(A(G)) ≤ mu1(G) - 2.
theorem adjacency_lambda2_le_of_degree_bound {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hn : 2 ≤ Fintype.card V)
(hdeg : ∀ v : V, (G.degree v : ℝ) + 2 ≤ laplacian_mu1 G) :
adjacency_lambda2 G ≤ laplacian_mu1 G - 2adjacency_lambda2_le_of_small_laplacian_spectral_radiusIn LeanGraph Theory & Graph Algorithms
The target inequality holds in the crux regime where the Laplacian spectral radius is smaller than max degree + 2: for a finite graph G with 2 ≤ |V| and some vertex v with mu1(G) < deg(v) + 2, we have lambda2(A(G)) ≤ mu1(G) - 2.
theorem adjacency_lambda2_le_of_small_laplacian_spectral_radius {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hn : 2 ≤ Fintype.card V)
(h : ∃ v : V, laplacian_mu1 G < (G.degree v : ℝ) + 2) :
adjacency_lambda2 G ≤ laplacian_mu1 G - 2adjacency_rank_laplacian_second_eigenvalue_le_two_mul_edge_count_of_card_le_edge_cardIn LeanGraph Theory & Graph Algorithms
If G is a connected simple graph on n >= 2 vertices with at least n edges (so in particular G is not a tree), then mu_2 + rank(A) <= 2m.
theorem adjacency_rank_laplacian_second_eigenvalue_le_two_mul_edge_count_of_card_le_edge_card
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hconn : G.Connected) (hn : 2 ≤ Fintype.card V)
(hm : (Fintype.card V : ℝ) ≤ (G.edgeFinset.card : ℝ)) :
simple_graph_laplacian_second_eigenvalue G + (Matrix.rank (G.adjMatrix ℝ) : ℝ) ≤
2 * (G.edgeFinset.card : ℝ)adjacency_rank_laplacian_second_eigenvalue_le_two_mul_edge_count_of_isTreeIn LeanGraph Theory & Graph Algorithms
For a tree G on n >= 2 vertices, mu_2 + rank(A) <= 2m, i.e. the target conjecture in the tree case.
theorem adjacency_rank_laplacian_second_eigenvalue_le_two_mul_edge_count_of_isTree
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hTree : G.IsTree) (hn : 2 ≤ Fintype.card V) :
simple_graph_laplacian_second_eigenvalue G + (Matrix.rank (G.adjMatrix ℝ) : ℝ) ≤
2 * (G.edgeFinset.card : ℝ)adjacency_rayleigh_indicator_eq_avg_degreeIn LeanGraph Theory & Graph Algorithms
The Rayleigh quotient of the adjacency matrix of G at the indicator vector of a vertex set s equals the average degree of the induced subgraph G[s].
attribute [local instance] Classical.propDecidable in
theorem adjacency_rayleigh_indicator_eq_avg_degree {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (s : Set V) :
(∑ i, Set.indicator s (fun _ => (1 : ℝ)) i *
Matrix.mulVec (G.adjMatrix ℝ) (Set.indicator s (fun _ => (1 : ℝ))) i) /
(∑ i, (Set.indicator s (fun _ => (1 : ℝ)) i) ^ 2)
= (∑ v : s, ((G.induce s).degree v : ℝ)) / (Fintype.card s : ℝ)adjacency_rayleigh_quotient_le_spectral_radiusIn LeanGraph Theory & Graph Algorithms
The Rayleigh quotient of the adjacency matrix of a finite simple graph at a vector of strictly positive squared length is at most the adjacency spectral radius.
attribute [local instance] Classical.propDecidable in
theorem adjacency_rayleigh_quotient_le_spectral_radius
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (x : V → ℝ) (hx : 0 < ∑ i, x i ^ 2) :
ENNReal.ofReal ((∑ i, x i * Matrix.mulVec (G.adjMatrix ℝ) x i) / (∑ i, x i ^ 2))
≤ adjacency_spectral_radius Gadjacency_spectral_radius_ge_of_eigenvectorIn LeanGraph Theory & Graph Algorithms
If w is a nonzero real vector whose adjacency-matrix image is lam times w with lam ≥ 0, then ofReal lam is at most the adjacency spectral radius of G.
open scoped Classical in
theorem adjacency_spectral_radius_ge_of_eigenvector {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (w : V → ℝ) (lam : ℝ) (hlam : 0 ≤ lam) (hw : w ≠ 0)
(h : (G.adjMatrix ℝ).mulVec w = lam • w) :
ENNReal.ofReal lam ≤ adjacency_spectral_radius Gadjacency_spectral_radius_ne_topIn LeanGraph Theory & Graph Algorithms
The adjacency spectral radius of a finite simple graph is finite (not ∞).
theorem adjacency_spectral_radius_ne_top {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) : adjacency_spectral_radius G ≠ ⊤alternating_orientation_minimizes_arborescence_countIn LeanGraph Theory & Graph Algorithms
In a 3-vertex-connected simple plane graph with all degrees even, every alternating orientation D₀ minimises a_r over the Eulerian orientations: a_r(D₀) ≤ a_r(D) for every Eulerian orientation D and every root r.
theorem alternating_orientation_minimizes_arborescence_count {n : ℕ}
(G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(h3 : simple_graph_three_vertex_connected G) (heven : ∀ v, Even (G.degree v))
(σ : Equiv.Perm G.Dart) (hσ : simple_graph_is_plane_rotation_system G σ)
(D₀ D : Digraph (Fin n)) [DecidableRel D₀.Adj] [DecidableRel D.Adj]
(hD₀ : digraph_is_alternating_orientation G σ D₀) (hD : digraph_is_eulerian_orientation G D)
(r : Fin n) :
digraph_arborescence_count_at D₀ r ≤ digraph_arborescence_count_at D ramply_regular_diam_le_of_radial_driftIn LeanGraph Theory & Graph Algorithms
If the radial-drift inequality holds for every triple (v,p,q) with v reachable from p, d(p,q) = 2 and d(v,q) = d(v,p) + 2, then an amply regular graph with parameters (k,ℓ,μ) and diameter at least 3 has diameter at most 2k/(ℓ+2).
theorem amply_regular_diam_le_of_radial_drift {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k ℓ μ : ℕ} (hG : IsAmplyRegular G k ℓ μ) (h3 : 3 ≤ G.diam)
(hdrift : ∀ (v p q : V), G.Reachable v p → G.dist p q = 2 → G.dist v q = G.dist v p + 2 →
(∑ y ∈ G.neighborFinset q, ((G.dist v y : ℤ) - (G.dist v q : ℤ)))
≤ (∑ y ∈ G.neighborFinset p, ((G.dist v y : ℤ) - (G.dist v p : ℤ))) - 2 * ((ℓ : ℤ) + 2)) :
G.diam ≤ 2 * k / (ℓ + 2)amply_regular_diameter_bound_of_mu_ge_lambdaIn LeanGraph Theory & Graph Algorithms
Let G be an amply regular graph on a finite vertex set with parameters (k, ℓ, μ), where 1 < μ and ℓ ≤ μ. Then G.diam ≤ if Even G.diam then 2 * k / μ else (2 * k - ℓ - 2) / μ + 1.
theorem amply_regular_diameter_bound_of_mu_ge_lambda {V : Type*} [Fintype V] (G : SimpleGraph V)
[DecidableRel G.Adj] {k ℓ μ : ℕ} (hG : IsAmplyRegular G k ℓ μ) (hμ1 : 1 < μ) (hμℓ : ℓ ≤ μ) :
G.diam ≤ if Even G.diam then 2 * k / μ else (2 * k - ℓ - 2) / μ + 1amply_regular_diameter_bound_of_three_le_diamIn LeanGraph Theory & Graph Algorithms
Conjecture 3.7 of arXiv:2610.36620 in the case of diameter at least 3: an amply regular graph with parameters (k, ℓ, μ), μ > 2, and diameter at least 3 has diameter at most 2k/(ℓ+2).
theorem amply_regular_diameter_bound_of_three_le_diam {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k ℓ μ : ℕ} (hG : IsAmplyRegular G k ℓ μ) (hμ : 2 < μ) (h3 : 3 ≤ G.diam) :
G.diam ≤ 2 * k / (ℓ + 2)amply_regular_ell_add_mu_add_one_le_k_of_dist_two_adj_dist_threeIn LeanGraph Theory & Graph Algorithms
In an amply regular graph with parameters (k, ℓ, μ), if x and y are at distance 2 and z is at distance 3 from x with y adjacent to z, then ℓ + μ + 1 ≤ k. Proof: the μ common neighbors of x and y in N(y), the ℓ common neighbors of y and z in N(y), and z itself are pairwise disjoint subsets of N(y), so their sum of cardinalities μ + ℓ + 1 is at most deg(y) = k.
theorem amply_regular_ell_add_mu_add_one_le_k_of_dist_two_adj_dist_three
{V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k ℓ μ : ℕ} (hG : IsAmplyRegular G k ℓ μ)
{x y z : V} (hxy : G.dist x y = 2) (hxz : G.dist x z = 3) (hyz : G.Adj y z) :
ℓ + μ + 1 ≤ kamply_regular_icosahedron_cartesian_powerIn LeanGraph Theory & Graph Algorithms
For every integer m ≥ 2, the m-fold Cartesian power of the icosahedron graph is an amply regular graph with parameters (v, k, λ, μ) = (12^m, 5m, 2, 2) and diameter 3m, satisfying μ > 1 and diam(G) > 2k/(λ+2), while having order strictly greater than 12.
theorem amply_regular_icosahedron_cartesian_power (m : ℕ) (hm : 2 ≤ m)
[DecidableRel (cartesian_power_graph icosahedron_graph m).Adj] :
IsAmplyRegular (cartesian_power_graph icosahedron_graph m) (5 * m) 2 2 ∧
(cartesian_power_graph icosahedron_graph m).diam = 3 * m ∧
Fintype.card (Fin m → Fin 12) = 12 ^ m ∧
2 * (5 * m) / (2 + 2) < (cartesian_power_graph icosahedron_graph m).diam ∧
1 < (2 : ℕ) ∧
12 < Fintype.card (Fin m → Fin 12)amply_regular_neighborFinset_common_cardIn LeanGraph Theory & Graph Algorithms
In an amply regular graph with parameters (k,ℓ,μ), every vertex of N(p) has exactly ℓ neighbours inside N(p); equivalently the neighbourhood of p induces an ℓ-regular graph on k vertices.
theorem amply_regular_neighborFinset_common_card {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k ℓ μ : ℕ} (hG : IsAmplyRegular G k ℓ μ) {x p : V} (hxp : G.Adj x p) :
((G.neighborFinset p).filter (fun y => G.Adj x y)).card = ℓamply_regular_radial_driftIn LeanGraph Theory & Graph Algorithms
Radial drift: in an amply regular graph with parameters (k,ℓ,μ) and μ > 2, if v is reachable from p, d(p,q) = 2 and d(v,q) = d(v,p) + 2, then the outward Laplacian of f = d(v,·) drops by at least 2(ℓ+2) from p to q: the sum over N(q) of (f − f(q)) is at most the sum over N(p) of (f − f(p)) minus 2(ℓ+2). With b, c, μ', γ the counts of level-(i+1), level-(i−1) neighbours of p and level-(i+1), level-(i+3) neighbours of q (i = d(v,p)), this says b + μ' ≥ γ + c + 2ℓ + 4.
theorem amply_regular_radial_drift {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k ℓ μ : ℕ} (hG : IsAmplyRegular G k ℓ μ) (hμ : 2 < μ)
{v p q : V} (hvp : G.Reachable v p) (hpq : G.dist p q = 2) (hvq : G.dist v q = G.dist v p + 2) :
(∑ y ∈ G.neighborFinset q, ((G.dist v y : ℤ) - (G.dist v q : ℤ)))
≤ (∑ y ∈ G.neighborFinset p, ((G.dist v y : ℤ) - (G.dist v p : ℤ))) - 2 * ((ℓ : ℤ) + 2)amply_regular_radial_drift_of_mu_ge_lambdaIn LeanGraph Theory & Graph Algorithms
In an amply regular graph G on a finite vertex set with parameters (k, ℓ, μ) satisfying 1 < μ and ℓ ≤ μ, if G.Reachable v p, G.dist p q = 2, and G.dist v q = G.dist v p + 2, then the integer sum ∑ y ∈ G.neighborFinset q, ((G.dist v y : ℤ) - (G.dist v q : ℤ)) is at most (∑ y ∈ G.neighborFinset p, ((G.dist v y : ℤ) - (G.dist v p : ℤ))) - 2 * (μ : ℤ).
theorem amply_regular_radial_drift_of_mu_ge_lambda {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k ℓ μ : ℕ} (hG : IsAmplyRegular G k ℓ μ) (hμ1 : 1 < μ) (hμℓ : ℓ ≤ μ)
{v p q : V} (hvp : G.Reachable v p) (hpq : G.dist p q = 2) (hvq : G.dist v q = G.dist v p + 2) :
(∑ y ∈ G.neighborFinset q, ((G.dist v y : ℤ) - (G.dist v q : ℤ)))
≤ (∑ y ∈ G.neighborFinset p, ((G.dist v y : ℤ) - (G.dist v p : ℤ))) - 2 * (μ : ℤ)amply_regular_radial_drift_of_two_mu_geIn LeanGraph Theory & Graph Algorithms
In an amply regular graph with parameters (k,ℓ,μ) where k + ℓ + 2 ≤ 2μ, the radial-drift inequality holds for every v reachable from p with d(p,q) = 2 and d(v,q) = d(v,p) + 2.
theorem amply_regular_radial_drift_of_two_mu_ge {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k ℓ μ : ℕ} (hG : IsAmplyRegular G k ℓ μ) (hμ : k + ℓ + 2 ≤ 2 * μ)
{v p q : V} (hvp : G.Reachable v p) (hpq : G.dist p q = 2) (hvq : G.dist v q = G.dist v p + 2) :
(∑ y ∈ G.neighborFinset q, ((G.dist v y : ℤ) - (G.dist v q : ℤ)))
≤ (∑ y ∈ G.neighborFinset p, ((G.dist v y : ℤ) - (G.dist v p : ℤ))) - 2 * ((ℓ : ℤ) + 2)amply_regular_radial_sum_of_adjIn LeanGraph Theory & Graph Algorithms
If v and p are adjacent, the radial sum of f = d(v,·) at p equals k − ℓ − 2: exactly one neighbour of p (namely v) lies one level closer than p, and exactly k − 1 − ℓ neighbours of p lie one level further (the neighbours of p other than v that are not common neighbours of v and p).
theorem amply_regular_radial_sum_of_adj {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k ℓ μ : ℕ} (hG : IsAmplyRegular G k ℓ μ) {v p : V} (h : G.Adj v p) :
∑ y ∈ G.neighborFinset p, ((G.dist v y : ℤ) - (G.dist v p : ℤ)) = (k : ℤ) - (ℓ : ℤ) - 2bicirculant_3465_column_cycle_bijectiveIn LeanGraph Theory & Graph Algorithms
The closed-form column cycle (i ↦ -387*(i/3) - (0/35/112 depending on i mod 3)) is a bijection from Fin 1155 onto ZMod 1155.
theorem bicirculant_3465_column_cycle_bijective :
Function.Bijective bicirculant_3465_column_cyclebicirculant_3465_column_cycle_stepIn LeanGraph Theory & Graph Algorithms
Integer carry relation along the column cycle: for each i, the representative of the current column equals that of the next column plus the step (35, 77 or 275 according to i mod 3) minus 1155 times the carry (1 exactly when the current representative is smaller than the step).
theorem bicirculant_3465_column_cycle_step (i : Fin 1155) :
(bicirculant_3465_column_cycle i).val =
(bicirculant_3465_column_cycle (i + 1)).val
+ (if i.val % 3 = 0 then 35 else if i.val % 3 = 1 then 77 else 275)
- 1155 * (if (bicirculant_3465_column_cycle i).val
< (if i.val % 3 = 0 then 35 else if i.val % 3 = 1 then 77 else 275) then 1 else 0)bicirculant_3465_ham_vertices_adjacentIn LeanGraph Theory & Graph Algorithms
Consecutive images in the explicit enumeration are adjacent in the bicirculant graph, cyclically (the last, index 6929, is adjacent back to index 0).
theorem bicirculant_3465_ham_vertices_adjacent :
∀ i : Fin 6930,
bicirculant_3465_graph.Adj (bicirculant_3465_ham_vertices i)
(bicirculant_3465_ham_vertices (i + 1))bicirculant_3465_ham_vertices_injectiveIn LeanGraph Theory & Graph Algorithms
The explicit enumeration bicirculant_3465_ham_vertices of the 6930 vertices is injective (so it is a bijective listing of the whole vertex set).
theorem bicirculant_3465_ham_vertices_injective :
Function.Injective bicirculant_3465_ham_verticesbinary_nonzero_common_difference_octuple_bijectionIn LeanGraph Theory & Graph Algorithms
In any commutative exponent-two group, the set of injective nonzero functions f : Fin 8 → G with equal pair sums f(2k) + f(2k+1) = δ ≠ 0 is in bijection with the set of 5-tuples (d, a0, a1, a2, a3) where d ≠ 0 and each a_k avoids {0, d} and previous pairs {a_j, a_j + d}.
theorem binary_nonzero_common_difference_octuple_bijection
{G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G]
(h2 : ∀ a : G, a + a = 0) :
((Finset.univ : Finset (Fin 8 → G)).filter (fun f =>
Function.Injective f ∧ (∀ i, f i ≠ 0) ∧ (∃ δ : G, δ ≠ 0 ∧ f 0 + f 1 = δ ∧ f 2 + f 3 = δ ∧ f 4 + f 5 = δ ∧ f 6 + f 7 = δ))).card =
((Finset.univ : Finset (G × G × G × G × G)).filter (fun ⟨d, a0, a1, a2, a3⟩ =>
d ≠ 0 ∧
a0 ∉ ({0, d} : Finset G) ∧
a1 ∉ (insert a0 (insert (a0 + d) {0, d}) : Finset G) ∧
a2 ∉ (insert a1 (insert (a1 + d) (insert a0 (insert (a0 + d) {0, d}))) : Finset G) ∧
a3 ∉ (insert a2 (insert (a2 + d) (insert a1 (insert (a1 + d) (insert a0 (insert (a0 + d) {0, d}))))) : Finset G))).cardbinary_nonzero_common_difference_octuple_countIn LeanGraph Theory & Graph Algorithms
In any finite commutative exponent-two group with at least8 elements, the number of injective nonzero ordered8-tuples satisfying the stated zero-sum/common-nonzero-difference constraint equals the stated product of group-cardinality factors.
theorem binary_nonzero_common_difference_octuple_count
{G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G]
(h2 : ∀ a : G, a + a = 0) (hcard : 8 ≤ Fintype.card G) :
((Finset.univ : Finset (Fin 8 → G)).filter (fun f =>
Function.Injective f ∧ (∀ i, f i ≠ 0) ∧ (∃ δ : G, δ ≠ 0 ∧ f 0 + f 1 = δ ∧ f 2 + f 3 = δ ∧ f 4 + f 5 = δ ∧ f 6 + f 7 = δ))).card =
(Fintype.card G - 1) * (Fintype.card G - 2) * (Fintype.card G - 4) * (Fintype.card G - 6) * (Fintype.card G - 8)binary_nonzero_common_difference_tuple_countIn LeanGraph Theory & Graph Algorithms
In any finite commutative exponent-two group with at least 8 elements, the number of 5-tuples (d, a0, a1, a2, a3) with d ≠ 0, a0 ∉ {0, d}, and each subsequent a_k avoiding the union of {0, d} and all previous pairs {a_j, a_j + d} equals (|G|-1)(|G|-2)(|G|-4)(|G|-6)(|G|-8).
theorem binary_nonzero_common_difference_tuple_count
{G : Type*} [AddCommGroup G] [Fintype G] [DecidableEq G]
(h2 : ∀ a : G, a + a = 0) (hcard : 8 ≤ Fintype.card G) :
((Finset.univ : Finset (G × G × G × G × G)).filter (fun ⟨d, a0, a1, a2, a3⟩ =>
d ≠ 0 ∧
a0 ∉ ({0, d} : Finset G) ∧
a1 ∉ (insert a0 (insert (a0 + d) {0, d}) : Finset G) ∧
a2 ∉ (insert a1 (insert (a1 + d) (insert a0 (insert (a0 + d) {0, d}))) : Finset G) ∧
a3 ∉ (insert a2 (insert (a2 + d) (insert a1 (insert (a1 + d) (insert a0 (insert (a0 + d) {0, d}))))) : Finset G))).card =
(Fintype.card G - 1) * (Fintype.card G - 2) * (Fintype.card G - 4) * (Fintype.card G - 6) * (Fintype.card G - 8)bipartite_column_lemma_coloringIn LeanGraph Theory & Graph Algorithms
Given a bipartite graph G ≤ completeBipartiteGraph α β and a nonempty subset V_j ⊆ β where each vertex has a neighbor in α, there exists a coloring of β using K = sup_{x ∈ α} |N(x) ∩ V_j| colors such that any two vertices in V_j whose canonical edges conflict receive distinct colors.
theorem bipartite_column_lemma_coloring
{α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] [LinearOrder α]
(G : SimpleGraph (α ⊕ β)) [DecidableRel G.Adj] (hG : G ≤ completeBipartiteGraph α β)
(V_j : Finset β) (hne : ∀ b ∈ V_j, ∃ a : α, G.Adj (Sum.inl a) (Sum.inr b))
(hV : V_j.Nonempty) :
∃ col : β → Fin (Finset.univ.sup (fun x : α => (Finset.filter (fun b => G.Adj (Sum.inl x) (Sum.inr b)) V_j).card)),
∀ (b : β) (hb : b ∈ V_j) (b' : β) (hb' : b' ∈ V_j),
simple_graph_edge_conflict G
⟨s(Sum.inl ((Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b)) Finset.univ).min' (by obtain ⟨a, ha⟩ := hne b hb; exact ⟨a, Finset.mem_filter.mpr ⟨Finset.mem_univ a, ha⟩⟩)), Sum.inr b), by
have hmem := Finset.min'_mem _ (by obtain ⟨a, ha⟩ := hne b hb; exact ⟨a, Finset.mem_filter.mpr ⟨Finset.mem_univ a, ha⟩⟩)
exact (Finset.mem_filter.mp hmem).2⟩
⟨s(Sum.inl ((Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b')) Finset.univ).min' (by obtain ⟨a, ha⟩ := hne b' hb'; exact ⟨a, Finset.mem_filter.mpr ⟨Finset.mem_univ a, ha⟩⟩)), Sum.inr b'), by
have hmem := Finset.min'_mem _ (by obtain ⟨a, ha⟩ := hne b' hb'; exact ⟨a, Finset.mem_filter.mpr ⟨Finset.mem_univ a, ha⟩⟩)
exact (Finset.mem_filter.mp hmem).2⟩ →
col b ≠ col b'bipartite_column_lemma_conflict_neighborIn LeanGraph Theory & Graph Algorithms
Let G be a bipartite graph with parts α and β, with a linear order on α. If two canonical column edges e_b = (c(b), b) and e_{b'} = (c(b'), b') conflict in G, and c(b') ≤ c(b), then b ≠ b' and G.Adj (Sum.inl c(b)) (Sum.inr b').
theorem bipartite_column_lemma_conflict_neighbor
{α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] [LinearOrder α]
(G : SimpleGraph (α ⊕ β)) [DecidableRel G.Adj] (hG : G ≤ completeBipartiteGraph α β)
{b b' : β}
(h_nonempty : (Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b)) Finset.univ).Nonempty)
(h_nonempty' : (Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b')) Finset.univ).Nonempty)
(h_le : (Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b')) Finset.univ).min' h_nonempty' ≤
(Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b)) Finset.univ).min' h_nonempty)
(h_conflict : simple_graph_edge_conflict G
⟨s(Sum.inl ((Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b)) Finset.univ).min' h_nonempty), Sum.inr b), by
have hmem := Finset.min'_mem _ h_nonempty
exact (Finset.mem_filter.mp hmem).2⟩
⟨s(Sum.inl ((Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b')) Finset.univ).min' h_nonempty'), Sum.inr b'), by
have hmem := Finset.min'_mem _ h_nonempty'
exact (Finset.mem_filter.mp hmem).2⟩) :
b ≠ b' ∧ G.Adj (Sum.inl ((Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b)) Finset.univ).min' h_nonempty)) (Sum.inr b')bipartite_column_lemma_partitionIn LeanGraph Theory & Graph Algorithms
Let G be a finite bipartite graph with parts A and B, let σ be a linear order of A, and let V_j ⊆ B such that every vertex in V_j has a neighbor in A. For each b ∈ V_j, let c(b) = min_σ N(b), and let E_j = {c(b)b : b ∈ V_j}. Then the edge set E_j can be partitioned into at most max_{x ∈ A} |N(x) ∩ V_j| induced matchings of G.
theorem bipartite_column_lemma_partition
{α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] [LinearOrder α]
(G : SimpleGraph (α ⊕ β)) [DecidableRel G.Adj] (hG : G ≤ completeBipartiteGraph α β)
(V_j : Finset β) (hne : ∀ b ∈ V_j, ∃ a : α, G.Adj (Sum.inl a) (Sum.inr b)) :
∃ (M : Fin (Finset.univ.sup (fun x : α => (Finset.filter (fun b => G.Adj (Sum.inl x) (Sum.inr b)) V_j).card)) → Set G.edgeSet),
(∀ i, simple_graph_is_induced_matching G (M i)) ∧
(∀ i, M i ⊆ { e | ∃ (b : β) (hb : b ∈ V_j)
(h : (Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b)) Finset.univ).Nonempty),
e.1 = s(Sum.inl ((Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b)) Finset.univ).min' h), Sum.inr b) }) ∧
(∀ i j, i ≠ j → Disjoint (M i) (M j)) ∧
⋃ i, M i = { e | ∃ (b : β) (hb : b ∈ V_j)
(h : (Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b)) Finset.univ).Nonempty),
e.1 = s(Sum.inl ((Finset.filter (fun a => G.Adj (Sum.inl a) (Sum.inr b)) Finset.univ).min' h), Sum.inr b) }bipartite_cut_obstructs_edge_disjoint_perfect_matchingsIn LeanGraph Theory & Graph Algorithms
Min-cut obstruction for edge-disjoint perfect matchings: if G is a bipartite simple graph on α ⊕ β with no same-side edges, and for some X ⊆ α, Y ⊆ β the number of edges from X into β ∖ Y is less than k·(|X| − |Y|), then G does not have k pairwise edge-disjoint perfect matchings.
theorem bipartite_cut_obstructs_edge_disjoint_perfect_matchings {α β : Type*} [Fintype α] [Fintype β] [DecidableEq α] [DecidableEq β] (G : SimpleGraph (α ⊕ β)) [DecidableRel G.Adj] (hα : ∀ a b : α, ¬ G.Adj (Sum.inl a) (Sum.inl b)) (hβ : ∀ a b : β, ¬ G.Adj (Sum.inr a) (Sum.inr b)) (X : Finset α) (Y : Finset β) (k : ℕ) (hcut : ((X.product (Finset.univ \ Y)).filter (fun p : α × β => G.Adj (Sum.inl p.1) (Sum.inr p.2))).card < k * (X.card - Y.card)) : ¬ simple_graph_has_edge_disjoint_perfect_matchings G kbipartite_subset_colorable_iff_cross_intersectingIn LeanGraph Theory & Graph Algorithms
For k positive, the standard-list coloring exists exactly when, for each color i, there are two families of (k−1)-subsets avoiding i, each side's families cover all (k−1)-subsets, and the two families indexed by i are cross-r-intersecting.
theorem bipartite_subset_colorable_iff_cross_intersecting (k r : ℕ) (hk : 1 ≤ k) : bipartite_subset_standard_list_colorable k r ↔ ∃ (F G : Fin (2*k-1) → Set {B : Finset (Fin (2*k-1)) // B.card = k-1}), (∀ i B, B ∈ F i → i ∉ B.1) ∧ (∀ i B, B ∈ G i → i ∉ B.1) ∧ (∀ B, ∃ i, B ∈ F i) ∧ (∀ B, ∃ i, B ∈ G i) ∧ (∀ i B C, B ∈ F i → C ∈ G i → r ≤ (B.1 ∩ C.1).card)bipartite_subset_colorable_iff_cross_intersecting_coversIn LeanGraph Theory & Graph Algorithms
The standard list coloring exists exactly when, for each color i, there are two families of k-subsets, with every set on each side covered by a family whose color it contains, and with the two families for each color cross-(r+1)-intersecting.
theorem bipartite_subset_colorable_iff_cross_intersecting_covers (k r : ℕ) : bipartite_subset_standard_list_colorable k r ↔ ∃ (A B : Fin (2*k-1) → Set {S : Finset (Fin (2*k-1)) // S.card = k}), (∀ S, ∃ i ∈ S.val, S ∈ A i) ∧ (∀ T, ∃ i ∈ T.val, T ∈ B i) ∧ ∀ i S T, S ∈ A i → T ∈ B i → r < (S.val ∩ T.val).cardbipartite_subset_colorable_iff_selectorsIn LeanGraph Theory & Graph Algorithms
The subset graph is colorable from its standard lists exactly when there are selectors for the two sides, each choosing an element of its set, whose choices differ whenever the sets meet in at most r elements.
theorem bipartite_subset_colorable_iff_selectors (k r : ℕ) : bipartite_subset_standard_list_colorable k r ↔ ∃ (f g : {S : Finset (Fin (2 * k - 1)) // S.card = k} → Fin (2 * k - 1)), (∀ S, f S ∈ S.1) ∧ (∀ T, g T ∈ T.1) ∧ (∀ S T, (S.1 ∩ T.1).card ≤ r → f S ≠ g T)bipartite_subset_colorable_of_core_majoritiesIn LeanGraph Theory & Graph Algorithms
If each color has a core of at most k ground elements, and every k-set S contains a color i whose core meets S in more than half of k+r, then the standard lists admit a proper coloring.
theorem bipartite_subset_colorable_of_core_majorities (k r : ℕ) (C : Fin (2*k-1) → Finset (Fin (2*k-1))) (hC : ∀ i, (C i).card ≤ k) (hcover : ∀ S : {S : Finset (Fin (2*k-1)) // S.card = k}, ∃ i ∈ S.val, k+r+1 ≤ 2*(S.val ∩ C i).card) : bipartite_subset_standard_list_colorable k rbipartite_subset_delete_one_disjoint_palettesIn LeanGraph Theory & Graph Algorithms
For positive k, after deleting any chosen k-subset on one side, there are list selectors on the remaining side and the entire other side whose color ranges are disjoint: the first avoids the deleted set and the second uses only colors in it.
theorem bipartite_subset_delete_one_disjoint_palettes (k : ℕ) (hk : 1 ≤ k) (S₀ : {S : Finset (Fin (2*k-1)) // S.card = k}) : ∃ (leftChoice rightChoice : {S : Finset (Fin (2*k-1)) // S.card = k} → Fin (2*k-1)), (∀ S, S ≠ S₀ → leftChoice S ∈ S.1 ∧ leftChoice S ∉ S₀.1) ∧ (∀ T, rightChoice T ∈ T.1 ∧ rightChoice T ∈ S₀.1)boxProd_completeGraph_powers_well_covered_of_sphere_boundIn LeanGraph Theory & Graph Algorithms
If G has the well-covered powers property and every independent set of G^{d-1} meets the radius-d sphere around any vertex in fewer than t vertices, then G □ K_t has the well-covered powers property.
theorem boxProd_completeGraph_powers_well_covered_of_sphere_bound
{V : Type*} [Fintype V] (G : SimpleGraph V)
(hwc : simple_graph_has_well_covered_powers G)
(t : ℕ) (ht : 1 ≤ t)
(hsphere : ∀ (d : ℕ) (hd : 1 ≤ d) (I : Finset V) (hI : (simple_graph_power G (d - 1)).IsIndepSet (I : Set V))
(v : V), (I.filter (fun w => G.edist v w = (d : ℕ∞))).card < t) :
simple_graph_has_well_covered_powers (G □ SimpleGraph.completeGraph (Fin t))boxProd_is_well_covered_factor_is_well_coveredIn LeanGraph Theory & Graph Algorithms
For any finite connected simple graphs G and H, if their Cartesian product G □ H is well-covered, then at least one of G and H is well-covered (Hartnell and Rall, 1998).
theorem boxProd_is_well_covered_factor_is_well_covered
{V W : Type*} [Fintype V] [Fintype W]
(G : SimpleGraph V) (H : SimpleGraph W)
(hG : G.Connected) (hH : H.Connected)
(hwc : simple_graph_is_well_covered (G □ H)) :
simple_graph_is_well_covered G ∨ simple_graph_is_well_covered HboxProd_wcp_factor_diam_boundIn LeanGraph Theory & Graph Algorithms
If the Cartesian product G □ H of finite connected simple graphs has the well-covered powers property and diam(G) ≥ 3, then diam(H) ≤ 1.
theorem boxProd_wcp_factor_diam_bound
{V W : Type*} [Fintype V] [Fintype W]
(G : SimpleGraph V) (H : SimpleGraph W)
(hG : G.Connected) (hH : H.Connected)
(hprod : simple_graph_has_well_covered_powers (G □ H))
(hdG : 3 ≤ G.diam) :
H.diam ≤ 1c7_box_k3_connected_and_diamIn LeanGraph Theory & Graph Algorithms
C_7 (box) C_3 is connected and has diameter 4: every pair of vertices is at distance at most 4, and diam = 4.
theorem c7_box_k3_connected_and_diam :
c7_box_k3_graph.Connected ∧ c7_box_k3_graph.diam = 4c7_box_k3_distance_basicIn LeanGraph Theory & Graph Algorithms
Basic metric facts for c7_box_k3_distance: it vanishes exactly at equal vertices, satisfies the triangle inequality, is 1 across every edge, is bounded by 4, and from any vertex one can step to a vertex one unit closer to a prescribed target (greedy step).
theorem c7_box_k3_distance_basic :
(∀ u : ZMod 7 × Fin 3, c7_box_k3_distance u u = 0) ∧
(∀ u v : ZMod 7 × Fin 3, c7_box_k3_distance u v = 0 → u = v) ∧
(∀ u v w : ZMod 7 × Fin 3, c7_box_k3_distance u v ≤ c7_box_k3_distance u w + c7_box_k3_distance w v) ∧
(∀ u v : ZMod 7 × Fin 3, c7_box_k3_graph.Adj u v → c7_box_k3_distance u v = 1) ∧
(∀ u v : ZMod 7 × Fin 3, 1 ≤ c7_box_k3_distance u v →
∃ w, c7_box_k3_graph.Adj u w ∧ c7_box_k3_distance w v = c7_box_k3_distance u v - 1) ∧
(∀ u v : ZMod 7 × Fin 3, c7_box_k3_distance u v ≤ 4)c7_box_k3_edistIn LeanGraph Theory & Graph Algorithms
The graph distance in C_7 (box) C_3 equals c7_box_k3_distance: for all u v, edist u v = (c7_box_k3_distance u v : ENat).
theorem c7_box_k3_edist (u v : ZMod 7 × Fin 3) :
c7_box_k3_graph.edist u v = (c7_box_k3_distance u v : ℕ∞)c7_box_k3_independent_set_boundsIn LeanGraph Theory & Graph Algorithms
Packing bounds in C_7 (box) C_3 at thresholds 3 and 4: (a) a set of columns of Z/7 pairwise at cyclic distance at least 2 has at most 3 elements; (b) pairwise at cyclic distance at least 3, at most 2 elements; (c) every vertex has a vertex at distance at least 3; (d) every vertex has a vertex at distance at least 4 (an antipodal pair).
theorem c7_box_k3_independent_set_bounds :
(∀ J : Finset (ZMod 7), (∀ a ∈ J, ∀ b ∈ J, a ≠ b → 2 ≤ cyclic_distance_seven a b) → J.card ≤ 3) ∧
(∀ J : Finset (ZMod 7), (∀ a ∈ J, ∀ b ∈ J, a ≠ b → 3 ≤ cyclic_distance_seven a b) → J.card ≤ 2) ∧
(∀ u : ZMod 7 × Fin 3, ∃ w, 3 ≤ c7_box_k3_distance w u) ∧
(∀ u : ZMod 7 × Fin 3, ∃ w, 4 ≤ c7_box_k3_distance w u)c7_box_k3_pair_extensionIn LeanGraph Theory & Graph Algorithms
Extension of independent pairs at threshold 3 in C_7 (box) C_3: any two vertices at distance at least 3 are extended by a third vertex at distance at least 3 from both (and distinct from both). This is what makes every maximal independent set of the square have exactly 3 vertices.
theorem c7_box_k3_pair_extension :
∀ u v : ZMod 7 × Fin 3, 3 ≤ c7_box_k3_distance u v →
∃ w : ZMod 7 × Fin 3, 3 ≤ c7_box_k3_distance w u ∧ 3 ≤ c7_box_k3_distance w v ∧
w ≠ u ∧ w ≠ vc7_box_k3_power_well_covered_largeIn LeanGraph Theory & Graph Algorithms
For d ≥ 4 every power (C_7 (box) C_3)^d is well-covered (it is the complete graph on 21 vertices, all maximal independent sets of size 1).
theorem c7_box_k3_power_well_covered_large (d : ℕ) (hd : 4 ≤ d) :
simple_graph_is_well_covered (simple_graph_power c7_box_k3_graph d)c7_box_k3_power_well_covered_oneIn LeanGraph Theory & Graph Algorithms
C_7 (box) C_3 is well-covered: every maximal independent set has exactly 7 vertices.
theorem c7_box_k3_power_well_covered_one :
simple_graph_is_well_covered (simple_graph_power c7_box_k3_graph 1)c7_box_k3_power_well_covered_threeIn LeanGraph Theory & Graph Algorithms
The third power (C_7 (box) C_3)^3 is well-covered: every maximal independent set has exactly 2 vertices.
theorem c7_box_k3_power_well_covered_three :
simple_graph_is_well_covered (simple_graph_power c7_box_k3_graph 3)c7_box_k3_power_well_covered_twoIn LeanGraph Theory & Graph Algorithms
The second power (C_7 (box) C_3)^2 is well-covered: every maximal independent set has exactly 3 vertices.
theorem c7_box_k3_power_well_covered_two :
simple_graph_is_well_covered (simple_graph_power c7_box_k3_graph 2)card_biUnion_ve_comp_partIn LeanGraph Theory & Graph Algorithms
If each D C is contained in the part of C, the union over all components C has cardinality the sum of the cardinalities |D C|.
lemma card_biUnion_ve_comp_part {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (v : V)
(D : (G.induce ({v}ᶜ : Set V)).ConnectedComponent → Finset V)
(hsub : ∀ C, (D C : Set V) ⊆ ve_comp_part G v C) :
(Finset.univ.biUnion D).card = ∑ C, (D C).cardcard_disjoint_unions_of_card_eqIn LeanGraph Theory & Graph Algorithms
If A₁, B₁, A₂, B₂ are k-element finsets with A₁ ≠ B₁ and A₂ ≠ B₂, and the unions A₁ ∪ B₁ and A₂ ∪ B₂ are disjoint, then the cardinality of (A₁ ∪ B₁) ∪ (A₂ ∪ B₂) is at least 2k + 2.
theorem card_disjoint_unions_of_card_eq {α : Type*} [DecidableEq α]
(k : ℕ) (A₁ B₁ A₂ B₂ : Finset α)
(hA₁ : A₁.card = k) (hB₁ : B₁.card = k) (hne₁ : A₁ ≠ B₁)
(hA₂ : A₂.card = k) (hB₂ : B₂.card = k) (hne₂ : A₂ ≠ B₂)
(hdisj : Disjoint (A₁ ∪ B₁) (A₂ ∪ B₂)) :
2 * k + 2 ≤ ((A₁ ∪ B₁) ∪ (A₂ ∪ B₂)).cardcard_edgeFinset_turanGraph_128_3In LeanGraph Theory & Graph Algorithms
The Turán graph T(128, 3) has 5461 edges.
theorem card_edgeFinset_turanGraph_128_3 : (SimpleGraph.turanGraph 128 3).edgeFinset.card = 5461
card_edges_diff_induce_eq_of_not_mem_ZIn LeanGraph Theory & Graph Algorithms
For any graphs G ≤ H where all added edges have both endpoints in Z, removing a vertex x ∉ Z preserves the number of added edges: the added edges in H - x not in G - x are in bijection with the added edges in H not in G.
theorem card_edges_diff_induce_eq_of_not_mem_Z
{V : Type*} [Fintype V] [DecidableEq V]
(G H : SimpleGraph V) (Z : Set V)
(hGH_edges : ∀ u v, H.Adj u v → G.Adj u v ∨ (u ∈ Z ∧ v ∈ Z))
(x : V) (hxZ : x ∉ Z) :
Nat.card ↑((H.induce {x}ᶜ).edgeSet \ (G.induce {x}ᶜ).edgeSet) =
Nat.card ↑(H.edgeSet \ G.edgeSet)card_eq_one_add_sum_ve_comp_part_interIn LeanGraph Theory & Graph Algorithms
For a finite vertex set S containing v, |S| = 1 + the sum over connected components C of G - v of |S ∩ V(C)|.
lemma card_eq_one_add_sum_ve_comp_part_inter {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (v : V) (S : Finset V) (hv : v ∈ S) :
S.card = 1 + ∑ C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent,
((S : Set V) ∩ ve_comp_part G v C).ncardcard_induce_edgeFinset_eq_add_boundaryIn LeanGraph Theory & Graph Algorithms
For S ⊆ U, the number of edges of G[U] is the sum of the edges of G[S], edges of G[U \\ S], and edges with one endpoint in S and one in U \\ S.
open scoped Classical in
theorem card_induce_edgeFinset_eq_add_boundary
{V : Type*} [Fintype V] (G : SimpleGraph V)
(U S : Finset V) (hS : S ⊆ U) :
(G.induce (U : Set V)).edgeFinset.card =
(G.induce (S : Set V)).edgeFinset.card +
(G.induce ((U \ S) : Set V)).edgeFinset.card +
(graph_edge_boundary G U S).cardcartesian_power_graph_adj_iffIn LeanGraph Theory & Graph Algorithms
Two vertices f, g of the n-fold Cartesian power of G on Fin n → V are adjacent if and only if there is a coordinate i where they are adjacent in G and they agree in every other coordinate.
theorem cartesian_power_graph_adj_iff {V : Type*} (G : SimpleGraph V) (n : ℕ) (f g : Fin n → V) :
(cartesian_power_graph G n).Adj f g ↔ ∃ i : Fin n, G.Adj (f i) (g i) ∧ ∀ j : Fin n, j ≠ i → f j = g jcartesian_power_graph_common_card_singleIn LeanGraph Theory & Graph Algorithms
If two vertices f, g of the n-fold Cartesian power agree off a single coordinate i, then the number of common neighbours of f and g in the power equals the number of common neighbours of f i and g i in G.
theorem cartesian_power_graph_common_card_single {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (n : ℕ) [DecidableRel (cartesian_power_graph G n).Adj]
{i : Fin n} {f g : Fin n → V} (hagree : ∀ j : Fin n, j ≠ i → f j = g j) (hne : f i ≠ g i) :
Fintype.card ((cartesian_power_graph G n).commonNeighbors f g)
= Fintype.card (G.commonNeighbors (f i) (g i))cartesian_power_graph_common_card_two_coordIn LeanGraph Theory & Graph Algorithms
If two vertices f, g of the n-fold Cartesian power are adjacent in two distinct coordinates i and j and agree elsewhere, then they have exactly 2 common neighbours in the power.
theorem cartesian_power_graph_common_card_two_coord {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (n : ℕ) [DecidableRel (cartesian_power_graph G n).Adj]
{i j : Fin n} (hij : i ≠ j) {f g : Fin n → V}
(hi : G.Adj (f i) (g i)) (hj : G.Adj (f j) (g j))
(hagree : ∀ l : Fin n, l ≠ i → l ≠ j → f l = g l) :
Fintype.card ((cartesian_power_graph G n).commonNeighbors f g) = 2cartesian_power_graph_diam_eq_mulIn LeanGraph Theory & Graph Algorithms
If G is a graph with nonempty vertex set and finite diameter, then for every n the n-fold Cartesian power of G has diameter n times the diameter of G.
theorem cartesian_power_graph_diam_eq_mul {V : Type*} [Nonempty V] (G : SimpleGraph V)
(hG : G.ediam ≠ ⊤) (n : ℕ) : (cartesian_power_graph G n).diam = n * G.diamcartesian_power_graph_dist_eq_sumIn LeanGraph Theory & Graph Algorithms
If G has finite diameter, then the graph distance in the n-fold Cartesian power between two vertices f, g equals the sum over the coordinates i of the distance in G between f i and g i.
theorem cartesian_power_graph_dist_eq_sum {V : Type*} (G : SimpleGraph V) (hG : G.ediam ≠ ⊤) (n : ℕ)
(f g : Fin n → V) :
(cartesian_power_graph G n).dist f g = ∑ i : Fin n, G.dist (f i) (g i)cartesian_power_graph_dist_two_classificationIn LeanGraph Theory & Graph Algorithms
If two vertices f, g of a Cartesian power of G are at distance 2, then either they differ in exactly one coordinate, at distance 2 in G, or they differ in exactly two coordinates, being adjacent in G at each of them.
theorem cartesian_power_graph_dist_two_classification {V : Type*} (G : SimpleGraph V) (hG : G.ediam ≠ ⊤)
(n : ℕ) {f g : Fin n → V} (hfg : (cartesian_power_graph G n).dist f g = 2) :
(∃ i : Fin n, G.dist (f i) (g i) = 2 ∧ ∀ j : Fin n, j ≠ i → f j = g j) ∨
(∃ i j : Fin n, i ≠ j ∧ G.Adj (f i) (g i) ∧ G.Adj (f j) (g j) ∧
∀ l : Fin n, l ≠ i → l ≠ j → f l = g l)cartesian_power_graph_edist_eq_sumIn LeanGraph Theory & Graph Algorithms
The extended graph distance in the n-fold Cartesian power of G between two vertices f and g equals the sum over the coordinates i of the extended distance in G between f i and g i (with ⊤ for disconnected pairs, the sum being ⊤ as soon as one term is).
theorem cartesian_power_graph_edist_eq_sum {V : Type*} (G : SimpleGraph V) (n : ℕ) (f g : Fin n → V) :
(cartesian_power_graph G n).edist f g = ∑ i : Fin n, G.edist (f i) (g i)cartesian_power_graph_isAmplyRegular_of_mu_twoIn LeanGraph Theory & Graph Algorithms
If a finite graph G with decidable adjacency is amply regular with parameters (k, ℓ, 2), then for every n its n-fold Cartesian power is amply regular with parameters (n*k, ℓ, 2).
theorem cartesian_power_graph_isAmplyRegular_of_mu_two {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k ℓ : ℕ} (hG : IsAmplyRegular G k ℓ 2) (n : ℕ)
[DecidableRel (cartesian_power_graph G n).Adj] :
IsAmplyRegular (cartesian_power_graph G n) (n * k) ℓ 2cartesian_power_graph_isRegularOfDegreeIn LeanGraph Theory & Graph Algorithms
If a graph G is regular of degree k, then for every n its n-fold Cartesian power is regular of degree n * k.
theorem cartesian_power_graph_isRegularOfDegree {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (n : ℕ) [DecidableRel (cartesian_power_graph G n).Adj]
{k : ℕ} (hG : G.IsRegularOfDegree k) :
(cartesian_power_graph G n).IsRegularOfDegree (n * k)cartesian_product_complete_graphs_edistIn LeanGraph Theory & Graph Algorithms
In the Cartesian product G = K_{a 0} □ ⋯ □ K_{a (t-1)} of complete graphs, graph distance is Hamming distance: for all vertices u, v, G.edist u v = hammingDist u v.
theorem cartesian_product_complete_graphs_edist {t : ℕ} (a : Fin t → ℕ)
(u v : (i : Fin t) → Fin (a i)) :
(cartesian_product_complete_graphs a).edist u v = (hammingDist u v : ℕ∞)cartesian_product_complete_graphs_exists_maximal_indep_cardIn LeanGraph Theory & Graph Algorithms
For 2 ≤ a 0 ≤ … ≤ a (t-1), with j the last index (j = t-1), the Cartesian product F = K_{a 0} □ … □ K_{a (t-1)} has a maximal independent set of cardinality ∏_{i ∈ Iio j} a i, namely the diagonal transversal {(x, (∑_i x_i) mod a_j) : x a front point}.
theorem cartesian_product_complete_graphs_exists_maximal_indep_card
(t : ℕ) (a : Fin t → ℕ) (h_ge : ∀ i, 2 ≤ a i) (h_mono : Monotone a)
(j : Fin t) (hj : (j : ℕ) = t - 1) :
∃ s : Finset ((i : Fin t) → Fin (a i)),
Maximal (fun u : Finset ((i : Fin t) → Fin (a i)) =>
(cartesian_product_complete_graphs a).IsIndepSet (u : Set _)) s ∧
s.card = ∏ i ∈ Finset.Iio j, a icartesian_product_complete_graphs_exists_small_maximal_indepIn LeanGraph Theory & Graph Algorithms
If a j ≤ ∑_{i ∈ Iio j} (a i − 1), then F = K_{a 0} □ … □ K_{a (t-1)} has a maximal independent set of cardinality strictly less than ∏_{i ∈ Iio j} a i; equivalently F is not well-covered.
theorem cartesian_product_complete_graphs_exists_small_maximal_indep
(t : ℕ) (ht : 2 ≤ t) (a : Fin t → ℕ) (h_ge : ∀ i, 2 ≤ a i) (h_mono : Monotone a)
(j : Fin t) (hj : (j : ℕ) = t - 1)
(hle : a j ≤ ∑ i ∈ Finset.Iio j, (a i - 1)) :
∃ s : Finset ((i : Fin t) → Fin (a i)),
Maximal (fun u : Finset ((i : Fin t) → Fin (a i)) =>
(cartesian_product_complete_graphs a).IsIndepSet (u : Set _)) s ∧
s.card < ∏ i ∈ Finset.Iio j, a icartesian_product_complete_graphs_origin_star_indepIn LeanGraph Theory & Graph Algorithms
If a j ≤ ∑_{i ∈ Iio j} (a i − 1) (top factor no larger than the front degree), then F = K_{a 0} □ … □ K_{a (t-1)} has an independent set T which dominates the whole origin fibre {v : v i = 0 for all i ≠ j}: every origin-fibre vertex is adjacent to some element of T.
theorem cartesian_product_complete_graphs_origin_star_indep
(t : ℕ) (ht : 2 ≤ t) (a : Fin t → ℕ) (h_ge : ∀ i, 2 ≤ a i) (h_mono : Monotone a)
(j : Fin t) (hj : (j : ℕ) = t - 1)
(hle : a j ≤ ∑ i ∈ Finset.Iio j, (a i - 1)) :
∃ T : Finset ((i : Fin t) → Fin (a i)),
(cartesian_product_complete_graphs a).IsIndepSet (T : Set _) ∧
(∀ v : (i : Fin t) → Fin (a i),
(∀ i, i ≠ j → (v i : ℕ) = 0) →
∃ w ∈ T, (cartesian_product_complete_graphs a).Adj v w)cartesian_product_complete_graphs_power_adjIn LeanGraph Theory & Graph Algorithms
For G = K_{a 0} □ ⋯ □ K_{a (t-1)} and d ≥ 0, two vertices are adjacent in the d-th power G^d if and only if they are distinct and their Hamming distance is at most d.
theorem cartesian_product_complete_graphs_power_adj {t : ℕ} (a : Fin t → ℕ) (d : ℕ)
(u v : (i : Fin t) → Fin (a i)) :
(simple_graph_power (cartesian_product_complete_graphs a) d).Adj u v ↔
u ≠ v ∧ hammingDist u v ≤ dcartesian_product_complete_graphs_succ_nonempty_isoIn LeanGraph Theory & Graph Algorithms
The Cartesian product graph K_{a 0} □ ... □ K_{a n} is isomorphic to (K_{a 0} □ ... □ K_{a (n-1)}) □ K_{a n}.
theorem cartesian_product_complete_graphs_succ_nonempty_iso {n : ℕ} (a : Fin (n + 1) → ℕ) :
Nonempty (cartesian_product_complete_graphs a ≃g
(cartesian_product_complete_graphs (fun i => a (Fin.castSucc i)) □
SimpleGraph.completeGraph (Fin (a (Fin.last n)))))cartesian_product_complete_graphs_top_bound_of_wcpIn LeanGraph Theory & Graph Algorithms
If K_{b 0} □ ... □ K_{b (m-1)} has well-covered powers (with m ≥ 3 and b monotone with values ≥ 2), then the top coordinate satisfies 1 + ∑_{i < m-1} (b i - 1) ≤ b (m-1).
theorem cartesian_product_complete_graphs_top_bound_of_wcp
(m : ℕ) (hm : 3 ≤ m) (b : Fin m → ℕ) (h_ge : ∀ i, 2 ≤ b i) (h_mono : Monotone b)
(hwcp : simple_graph_has_well_covered_powers (cartesian_product_complete_graphs b))
(k : Fin m) (hk : (k : ℕ) = m - 1) :
1 + ∑ i ∈ Finset.Iio k, (b i - 1) ≤ b kcartesian_product_complete_graphs_wcp_prefixIn LeanGraph Theory & Graph Algorithms
If a Cartesian product of complete graphs has well-covered powers, then any prefix sub-product obtained by restricting to the first m coordinates also has well-covered powers.
theorem cartesian_product_complete_graphs_wcp_prefix
(t : ℕ) (m : ℕ) (hm : 3 ≤ m) (hmt : m ≤ t) (a : Fin t → ℕ)
(h_ge : ∀ i, 2 ≤ a i) (h_mono : Monotone a)
(hwcp : simple_graph_has_well_covered_powers (cartesian_product_complete_graphs a)) :
simple_graph_has_well_covered_powers
(cartesian_product_complete_graphs (fun i : Fin m => a (Fin.castLE hmt i)))cartesian_product_four_mid_bound_of_wcpIn LeanGraph Theory & Graph Algorithms
For four complete graphs with sizes 2 ≤ a 0 ≤ a 1 ≤ a 2 ≤ a 3, if their Cartesian product has the well-covered powers property, then 1 + (a 0 - 1) + (a 1 - 1) ≤ a 2.
theorem cartesian_product_four_mid_bound_of_wcp
(a : Fin 4 → ℕ) (h_ge : ∀ i, 2 ≤ a i) (h_mono : Monotone a)
(hwcp : simple_graph_has_well_covered_powers (cartesian_product_complete_graphs a)) :
1 + (a 0 - 1) + (a 1 - 1) ≤ a 2cartesian_product_four_top_bound_of_wcpIn LeanGraph Theory & Graph Algorithms
For four complete graphs with sizes 2 ≤ a 0 ≤ a 1 ≤ a 2 ≤ a 3, if their Cartesian product has the well-covered powers property, then 1 + (a 0 - 1) + (a 1 - 1) + (a 2 - 1) ≤ a 3.
theorem cartesian_product_four_top_bound_of_wcp
(a : Fin 4 → ℕ) (h_ge : ∀ i, 2 ≤ a i) (h_mono : Monotone a)
(hwcp : simple_graph_has_well_covered_powers (cartesian_product_complete_graphs a)) :
1 + (a 0 - 1) + (a 1 - 1) + (a 2 - 1) ≤ a 3cayley_graph_lift_power_of_two_cycleIn LeanGraph Theory & Graph Algorithms
Let $G$ be a group generated by an inverse-closed set $S \subseteq G \setminus \{1\}$, and let $P \triangleleft G$ be a normal 2-subgroup. Define $\overline{S} = \{sP : s \in S\} \setminus \{P\} \subseteq G/P$. If the Cayley graph $\operatorname{Cay}(G/P, \overline{S})$ contains a simple cycle of length $2^k$ for some integer $k \ge 2$, then $\operatorname{Cay}(G, S)$ contains a simple cycle of length $2^m$ for some integer $m \ge 2$.
theorem cayley_graph_lift_power_of_two_cycle
{G : Type*} [Group G] (S : Set G) (hS_gen : Subgroup.closure S = ⊤)
(hS_inv : S⁻¹ = S) (hS_one : (1 : G) ∉ S)
(P : Subgroup G) [P.Normal] (hP : IsPGroup 2 P)
(hk : ∃ (k : ℕ) (_ : 2 ≤ k) (u : G ⧸ P)
(p : (SimpleGraph.mulCayley (QuotientGroup.mk '' S \ {1} : Set (G ⧸ P))).Walk u u),
p.IsCycle ∧ p.length = 2 ^ k) :
∃ (m : ℕ) (_ : 2 ≤ m) (v : G) (q : (SimpleGraph.mulCayley S).Walk v v),
q.IsCycle ∧ q.length = 2 ^ mcayley_graph_power_of_two_cycle_of_distinct_same_cosetIn LeanGraph Theory & Graph Algorithms
Let $G$ be a group, $S \subseteq G \setminus \{1\}$ an inverse-closed subset, $P \le G$ a 2-subgroup, and $s, t \in S$ distinct elements satisfying $sP = tP$ in $G/P$. Then $\operatorname{Cay}(G, S)$ contains a simple cycle of length $2^m$ for some integer $m \ge 2$.
theorem cayley_graph_power_of_two_cycle_of_distinct_same_coset
{G : Type*} [Group G] (S : Set G) (hS_inv : S⁻¹ = S) (hS_one : (1 : G) ∉ S)
(P : Subgroup G) (hP : IsPGroup 2 P)
(s t : G) (hs : s ∈ S) (ht : t ∈ S) (hst : s ≠ t)
(h_eq : (QuotientGroup.mk s : G ⧸ P) = QuotientGroup.mk t) :
∃ (m : ℕ) (_ : 2 ≤ m) (v : G) (q : (SimpleGraph.mulCayley S).Walk v v),
q.IsCycle ∧ q.length = 2 ^ mcayley_graph_power_of_two_cycle_of_involution_and_mem_sdiffIn LeanGraph Theory & Graph Algorithms
Let $G$ be a group, $S \subseteq G \setminus \{1\}$ an inverse-closed subset, $P \triangleleft G$ a normal 2-subgroup, $s \in S \cap P$ an element of order 2, and $t \in S \setminus P$. Then $\operatorname{Cay}(G, S)$ contains a simple cycle of length $2^m$ for some integer $m \ge 2$.
theorem cayley_graph_power_of_two_cycle_of_involution_and_mem_sdiff
{G : Type*} [Group G] (S : Set G) (hS_inv : S⁻¹ = S) (hS_one : (1 : G) ∉ S)
(P : Subgroup G) [P.Normal] (hP : IsPGroup 2 P)
(s : G) (hsS : s ∈ S) (hsP : s ∈ P) (hs_inv : orderOf s = 2)
(t : G) (htS : t ∈ S) (htP : t ∉ P) :
∃ (m : ℕ) (_ : 2 ≤ m) (v : G) (q : (SimpleGraph.mulCayley S).Walk v v),
q.IsCycle ∧ q.length = 2 ^ mcayley_graph_power_of_two_cycle_of_mem_inter_order_ge_fourIn LeanGraph Theory & Graph Algorithms
Let $G$ be a group, $S \subseteq G \setminus \{1\}$ an inverse-closed subset, $P \le G$ a 2-subgroup, and $s \in S \cap P$ an element of order at least 4. Then $\operatorname{Cay}(G, S)$ contains a simple cycle of length $2^m$ for some integer $m \ge 2$.
theorem cayley_graph_power_of_two_cycle_of_mem_inter_order_ge_four
{G : Type*} [Group G] (S : Set G) (hS_inv : S⁻¹ = S) (hS_one : (1 : G) ∉ S)
(P : Subgroup G) (hP : IsPGroup 2 P)
(s : G) (hsS : s ∈ S) (hsP : s ∈ P) (hs_order : 4 ≤ orderOf s) :
∃ (m : ℕ) (_ : 2 ≤ m) (v : G) (q : (SimpleGraph.mulCayley S).Walk v v),
q.IsCycle ∧ q.length = 2 ^ mchain_graph_balanced_minimal_k_star_forming_card_le_k_independence_numberIn LeanGraph Theory & Graph Algorithms
For a finite chain graph G with bipartition (A, V \ A), k ≥ 3, and a minimal k-star-forming set S with |S| larger than both |A| and |V \ A|, we have |S| ≤ β_k(G).
theorem chain_graph_balanced_minimal_k_star_forming_card_le_k_independence_number {V : Type*}
[Fintype V] (G : SimpleGraph V) (A : Set V) (hG : simple_graph_is_chain_graph G A) (k : ℕ)
(hk : 3 ≤ k) (S : Finset V) (hS : simple_graph_is_minimal_k_star_forming G k S)
(hbig : max A.ncard Aᶜ.ncard < S.card) :
S.card ≤ simple_graph_k_independence_number G kchain_graph_card_le_k_independence_number_of_card_le_max_partIn LeanGraph Theory & Graph Algorithms
For a finite chain graph G with bipartition (A, V \ A), k ≥ 1, and any vertex set S with |S| ≤ max(|A|, |V \ A|), we have |S| ≤ β_k(G).
theorem chain_graph_card_le_k_independence_number_of_card_le_max_part {V : Type*} [Fintype V]
(G : SimpleGraph V) (A : Set V) (hG : simple_graph_is_chain_graph G A)
(k : ℕ) (hk : 1 ≤ k) (S : Finset V) (h : S.card ≤ max A.ncard Aᶜ.ncard) :
S.card ≤ simple_graph_k_independence_number G kchain_graph_is_k_independent_union_of_partsIn LeanGraph Theory & Graph Algorithms
In a chain graph with bipartition (A, V \ A), if A' ⊆ A and B' ⊆ V \ A are such that every vertex of A' has fewer than k neighbours in B' and every vertex of B' has fewer than k neighbours in A', then A' ∪ B' is k-independent.
theorem chain_graph_is_k_independent_union_of_parts {V : Type*} [DecidableEq V] (G : SimpleGraph V)
(A : Set V) (hG : simple_graph_is_chain_graph G A) (k : ℕ) (A' B' : Finset V)
(hA' : ∀ x ∈ A', x ∈ A) (hB' : ∀ x ∈ B', x ∉ A)
(h1 : ∀ a ∈ A', ({b | b ∈ B' ∧ G.Adj a b} : Set V).ncard < k)
(h2 : ∀ b ∈ B', ({a | a ∈ A' ∧ G.Adj b a} : Set V).ncard < k) :
simple_graph_is_k_independent G k (A' ∪ B')chain_graph_k_independence_number_ge_ncard_partIn LeanGraph Theory & Graph Algorithms
For a finite chain graph G with bipartition (A, V \ A) and k ≥ 1, both |A| and |V \ A| are at most β_k(G).
theorem chain_graph_k_independence_number_ge_ncard_part {V : Type*} [Fintype V]
(G : SimpleGraph V) (A : Set V) (hG : simple_graph_is_chain_graph G A) (k : ℕ) (hk : 1 ≤ k) :
A.ncard ≤ simple_graph_k_independence_number G k ∧
Aᶜ.ncard ≤ simple_graph_k_independence_number G kchain_graph_k_independence_number_ge_two_mul_k_sub_twoIn LeanGraph Theory & Graph Algorithms
For a finite chain graph G with bipartition (A, V \ A) and k ≥ 1, if both sides have at least k - 1 vertices then 2k - 2 ≤ β_k(G).
theorem chain_graph_k_independence_number_ge_two_mul_k_sub_two {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (A : Set V) (hG : simple_graph_is_chain_graph G A) (k : ℕ)
(hk : 1 ≤ k) (hA : k - 1 ≤ A.ncard) (hB : k - 1 ≤ Aᶜ.ncard) :
2 * k - 2 ≤ simple_graph_k_independence_number G kchain_graph_minimal_k_star_forming_card_le_k_independence_numberIn LeanGraph Theory & Graph Algorithms
For a finite chain graph G with bipartition (A, V \ A), k ≥ 3, and every minimal k-star-forming set S, we have |S| ≤ β_k(G).
theorem chain_graph_minimal_k_star_forming_card_le_k_independence_number {V : Type*} [Fintype V]
(G : SimpleGraph V) (A : Set V) (hG : simple_graph_is_chain_graph G A) (k : ℕ) (hk : 3 ≤ k)
(S : Finset V) (hS : simple_graph_is_minimal_k_star_forming G k S) :
S.card ≤ simple_graph_k_independence_number G kchain_graph_parts_edge_freeIn LeanGraph Theory & Graph Algorithms
In a chain graph with bipartition (A, V \ A) no edge joins two vertices of A, and no edge joins two vertices outside A.
theorem chain_graph_parts_edge_free {V : Type*} (G : SimpleGraph V) (A : Set V)
(hG : simple_graph_is_chain_graph G A) :
(∀ u ∈ A, ∀ v ∈ A, ¬ G.Adj u v) ∧ (∀ u, u ∉ A → ∀ v, v ∉ A → ¬ G.Adj u v)choosability_lifting_lemma_for_list_uncolorable_graphsIn LeanGraph Theory & Graph Algorithms
Choosability lifting lemma for list-uncolorable graphs (Lemma 9 of arXiv:2611.03151): Let k, a, b be positive integers with a ≥ b. If a finite simple graph G is k-choosable but not (a:b)-choosable, then there exists a finite simple graph G' on 1 + binom(a+b, b) * |V(G)| vertices that is (k+1)-choosable but not (a+b:b)-choosable. Moreover, if χ(G) = k, then χ(G') = ch(G') = k+1.
theorem choosability_lifting_lemma_for_list_uncolorable_graphs
{V : Type} [Fintype V] (G : SimpleGraph V)
(k a b : ℕ) (hk : 0 < k) (ha : 0 < a) (hb : 0 < b) (hab : b ≤ a)
(h_choosable : simple_graph_is_choosable G k)
(h_not_ab : ¬ simple_graph_is_multiple_choosable G a b) :
∃ (V' : Type) (_ : Fintype V') (G' : SimpleGraph V'),
Fintype.card V' = 1 + (a + b).choose b * Fintype.card V ∧
simple_graph_is_choosable G' (k + 1) ∧
¬ simple_graph_is_multiple_choosable G' (a + b) b ∧
(G.chromaticNumber = k → G'.chromaticNumber = k + 1 ∧ simple_graph_choice_number G' = k + 1)choose_three_eq_cube_subIn LeanGraph Theory & Graph Algorithms
For every n, the binomial coefficient (n+1 choose 3) equals (n^3 - n) / 6.
theorem choose_three_eq_cube_sub (n : ℕ) : (n + 1).choose 3 = (n ^ 3 - n) / 6
chromaticNumber_induce_leIn LeanGraph Theory & Graph Algorithms
Deleting vertices cannot increase the chromatic number: for any graph G and any subset s of its vertices, the chromatic number of the induced subgraph G[s] is at most the chromatic number of G.
theorem chromaticNumber_induce_le {V : Type*} (G : SimpleGraph V) (s : Set V) :
(G.induce s).chromaticNumber ≤ G.chromaticNumberchvatal_hanson_edge_boundIn LeanGraph Theory & Graph Algorithms
Let D and M be natural numbers with 1 ≤ D. Every finite simple graph G with maximum degree G.maxDegree ≤ D and matching number graph_matching_num G ≤ M has at most D * M + (D / 2) * (M / ((D + 1) / 2)) edges.
theorem chvatal_hanson_edge_bound
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(D M : ℕ) (hD : 1 ≤ D)
(hΔ : G.maxDegree ≤ D) (hν : graph_matching_num G ≤ M) :
G.edgeFinset.card ≤ D * M + (D / 2) * (M / ((D + 1) / 2))claw_free_three_neighbours_span_edgeIn LeanGraph Theory & Graph Algorithms
In a claw-free graph, if a vertex u is adjacent to all three vertices of a 3-element set S, then S spans at least one edge.
theorem claw_free_three_neighbours_span_edge {V : Type*} (G : SimpleGraph V) (hclaw : IsClawFree G)
(u : V) (S : Finset V) (hS : S.card = 3) (h : ∀ w ∈ S, G.Adj u w) :
∃ a ∈ S, ∃ b ∈ S, G.Adj a bclaw_free_type_ii_configuration_has_K4In LeanGraph Theory & Graph Algorithms
If G is claw-free, u and v are adjacent, S is a 3-element set, N(u) = {v} ∪ S and N(v) = {u} ∪ S, then some 4-element vertex set K containing both u and v induces a complete graph.
theorem claw_free_type_ii_configuration_has_K4 {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hclaw : IsClawFree G)
(u v : V) (huv : G.Adj u v) (S : Finset V) (hS : S.card = 3)
(hNu : ∀ w : V, G.Adj u w ↔ w = v ∨ w ∈ S)
(hNv : ∀ w : V, G.Adj v w ↔ w = u ∨ w ∈ S) :
∃ K : Finset V, K.card = 4 ∧ u ∈ K ∧ v ∈ K ∧ (∀ a ∈ K, ∀ b ∈ K, a ≠ b → G.Adj a b)claw_type_ii_claw_free_iff_no_claw_quadrupleIn LeanGraph Theory & Graph Algorithms
A graph G is claw-free if and only if there are no four pairwise distinct vertices b, c, d all adjacent to a common vertex a with b, c, d pairwise non-adjacent.
theorem claw_type_ii_claw_free_iff_no_claw_quadruple {V : Type*} (G : SimpleGraph V) :
IsClawFree G ↔ ¬ ∃ a b c d : V, G.Adj a b ∧ G.Adj a c ∧ G.Adj a d ∧
b ≠ c ∧ b ≠ d ∧ c ≠ d ∧ ¬ G.Adj b c ∧ ¬ G.Adj b d ∧ ¬ G.Adj c dclaw_type_ii_connected_component_supp_ncard_eq_filter_cardIn LeanGraph Theory & Graph Algorithms
In a finite graph, the support of a connected component has cardinality equal to the number of vertices whose connected component it is.
theorem claw_type_ii_connected_component_supp_ncard_eq_filter_card {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableEq G.ConnectedComponent] (C : G.ConnectedComponent) :
C.supp.ncard = (Finset.univ.filter (fun v : V => G.connectedComponentMk v = C)).cardclaw_type_ii_odd_components_ncard_eq_filter_cardIn LeanGraph Theory & Graph Algorithms
In a finite graph, the number of odd connected components equals the number of connected components whose support has odd cardinality, counted as a Finset filter over the components using the vertex-count restatement of the support.
theorem claw_type_ii_odd_components_ncard_eq_filter_card {V : Type*} [Fintype V]
(G : SimpleGraph V) [DecidableEq G.ConnectedComponent] :
G.oddComponents.ncard =
(Finset.univ.filter (fun C : G.ConnectedComponent =>
Odd (Finset.univ.filter (fun v : V => G.connectedComponentMk v = C)).card)).cardclaw_type_ii_perfect_matching_iff_involutive_mapIn LeanGraph Theory & Graph Algorithms
A finite simple graph H has a perfect matching (a spanning matching subgraph) if and only if there is a fixed-point-free involutive map f on its vertices sending every vertex to a neighbour.
theorem claw_type_ii_perfect_matching_iff_involutive_map {V : Type*} [Fintype V] (H : SimpleGraph V) :
(∃ M : H.Subgraph, M.IsPerfectMatching) ↔
∃ f : V → V, (∀ x, f (f x) = x) ∧ (∀ v, f v ≠ v) ∧ ∀ v, H.Adj v (f v)clique_count_le_floor_boundIn LeanGraph Theory & Graph Algorithms
Let D, M, and t be natural numbers with 1 ≤ D and 2 ≤ t ≤ D + 1. Every finite simple graph G with maximum degree G.maxDegree ≤ D and matching number graph_matching_num G ≤ M satisfies (G.cliqueFinset t).card ≤ (D - 1).choose (t - 2) * (D * M + (D / 2) * (M / ((D + 1) / 2))) / t.choose 2.
theorem clique_count_le_floor_bound
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(D M t : ℕ) (hD : 1 ≤ D) (ht2 : 2 ≤ t) (htD : t ≤ D + 1)
(hΔ : G.maxDegree ≤ D) (hν : graph_matching_num G ≤ M) :
(G.cliqueFinset t).card ≤
(D - 1).choose (t - 2) * (D * M + (D / 2) * (M / ((D + 1) / 2))) / t.choose 2clique_count_mul_choose_two_le_edge_countIn LeanGraph Theory & Graph Algorithms
For any finite simple graph G with maximum degree at most D and any integer 2 <= t <= D + 1, choose(t, 2) times the number of t-cliques of G is at most choose(D - 1, t - 2) times the number of edges of G.
theorem clique_count_mul_choose_two_le_edge_count
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(D t : ℕ) (hD : 1 ≤ D) (ht2 : 2 ≤ t) (htD : t ≤ D + 1)
(hΔ : G.maxDegree ≤ D) :
t.choose 2 * (G.cliqueFinset t).card ≤ (D - 1).choose (t - 2) * G.edgeFinset.cardclique_count_upper_bound_chvatal_hansonIn LeanGraph Theory & Graph Algorithms
Let D, M, and t be natural numbers with 1 ≤ D and 2 ≤ t ≤ D + 1. Every finite simple graph G with maximum degree G.maxDegree ≤ D and matching number graph_matching_num G ≤ M satisfies ((G.cliqueFinset t).card : ℝ) ≤ ((D - 1).choose (t - 2) : ℝ) / (t.choose 2 : ℝ) * (D * M + (D / 2) * (M / ((D + 1) / 2)) : ℝ).
theorem clique_count_upper_bound_chvatal_hanson
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(D M t : ℕ) (hD : 1 ≤ D) (ht2 : 2 ≤ t) (htD : t ≤ D + 1)
(hΔ : G.maxDegree ≤ D) (hν : graph_matching_num G ≤ M) :
((G.cliqueFinset t).card : ℝ) ≤
((D - 1).choose (t - 2) : ℝ) / (t.choose 2 : ℝ) * (D * M + (D / 2) * (M / ((D + 1) / 2)) : ℝ)closed_walk_exists_connected_subgraph_le_factorIn LeanGraph Theory & Graph Algorithms
For any closed walk p visiting all vertices in an edge-weighted graph on n ≥ 2 vertices with positive edge weights, there exists a connected subgraph H ≤ G of total edge weight at most ((n-1)/n) times the total weight of p.
theorem closed_walk_exists_connected_subgraph_le_factor {V : Type*} [Fintype V]
(G : SimpleGraph V) (hn : 2 ≤ Fintype.card V)
(w : Sym2 V → ℝ) (hw : ∀ e ∈ G.edgeSet, 0 < w e)
(u : V) (p : G.Walk u u) (hp : ∀ v, v ∈ p.support) :
open scoped Classical in
∃ H : SimpleGraph V, H ≤ G ∧ H.Connected ∧
∑ e ∈ H.edgeFinset, w e ≤ ((Fintype.card V - 1 : ℝ) / (Fintype.card V : ℝ)) * (p.edges.map w).sumcolorable_induce_insert_of_card_ltIn LeanGraph Theory & Graph Algorithms
If the induced subgraph of G on s is c-colourable and a vertex v outside s has strictly fewer than c neighbours inside s, then G[s ∪ {v}] is c-colourable.
attribute [local instance] Classical.propDecidable in
theorem colorable_induce_insert_of_card_lt {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (s : Set V) (v : V) (hv : v ∉ s) (c : ℕ)
(hc : (G.induce s).Colorable c)
(hlt : Nat.card {u : V // u ∈ s ∧ G.Adj v u} < c) :
(G.induce (insert v s)).Colorable ccoloring_fin_three_sum_one_edges_incidentIn LeanGraph Theory & Graph Algorithms
If a proper 3-colouring of a finite graph has colour sum 1, then there is a vertex v₀ such that every edge of the graph has an endpoint equal to v₀.
theorem coloring_fin_three_sum_one_edges_incident {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (c : G.Coloring (Fin 3))
(hsum : ∑ v, ((c v : Fin 3) : ℕ) = 1) :
∃ v₀ : V, ∀ x y : V, G.Adj x y → x = v₀ ∨ y = v₀coloring_fin_three_sum_one_exists_of_edges_incidentIn LeanGraph Theory & Graph Algorithms
If a vertex v₀ of a finite graph with at least two vertices is incident to every edge, then the graph has a proper 3-colouring that is 1 at v₀ and 0 elsewhere; in particular its colour sum is 1 and it uses exactly 2 colours.
theorem coloring_fin_three_sum_one_exists_of_edges_incident {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {v₀ : V}
(hv : ∀ x y : V, G.Adj x y → x = v₀ ∨ y = v₀) (hcard : 2 ≤ Fintype.card V) :
∃ c : G.Coloring (Fin 3), (∑ w, ((c w : Fin 3) : ℕ)) = 1 ∧
(Finset.univ.image c).card = 2complete_equipartite_four_connectedIn LeanGraph Theory & Graph Algorithms
For any n ≥ 1, the complete equipartite graph with 4 parts of size n is connected.
theorem complete_equipartite_four_connected (n : ℕ) (hn : 1 ≤ n) :
(SimpleGraph.completeEquipartiteGraph 4 n).Connectedcomplete_graph_balanced_split_le_two_mul_triangle_packingIn LeanGraph Theory & Graph Algorithms
For K_n, the balanced-split edge count (n/2).choose 2 + ((n+1)/2).choose 2 is at most 2·ν(K_n). For even n = 2m this count is m.choose 2 + m.choose 2 = 2·m.choose 2 ≤ 2ν by the even packing lemma. For odd n = 2m+1 it is m.choose 2 + (m+1).choose 2 = m² ≤ 2ν by the odd packing lemma.
theorem complete_graph_balanced_split_le_two_mul_triangle_packing (n : ℕ) :
(n / 2).choose 2 + ((n + 1) / 2).choose 2 ≤
2 * simple_graph_triangle_packing_number (⊤ : SimpleGraph (Fin n))complete_graph_even_triangle_packing_number_geIn LeanGraph Theory & Graph Algorithms
The complete graph K_{2m} contains C(m,2) pairwise edge-disjoint triangles, so ν(K_{2m}) ≥ m.choose 2.
theorem complete_graph_even_triangle_packing_number_ge (m : ℕ) :
m.choose 2 ≤ simple_graph_triangle_packing_number (⊤ : SimpleGraph (Fin (2 * m)))complete_graph_odd_triangle_packing_number_two_mul_geIn LeanGraph Theory & Graph Algorithms
Twice the triangle packing number of K_{2m+1} is at least m²: split the vertices into A (size m) and B (size m+1); properly edge-colour K_{m+1} on B with m+1 colours, discard a colour class with at most half the average (some class has 2·|class| ≤ m by pigeonhole), and join every edge of the remaining m classes to a distinct vertex of A. This gives ≥ (m+1).choose 2 − ⌊m/2⌋ edge-disjoint triangles, whose doubled count is ≥ m².
theorem complete_graph_odd_triangle_packing_number_two_mul_ge (m : ℕ) :
m * m ≤ 2 * simple_graph_triangle_packing_number (⊤ : SimpleGraph (Fin (2 * m + 1)))complete_graph_triangle_cover_number_le_balanced_splitIn LeanGraph Theory & Graph Algorithms
For the complete graph K_n, deleting all edges inside either side of a balanced bipartition into parts of sizes ⌊n/2⌋ and ⌈n/2⌉ leaves a complete bipartite (triangle-free) graph, so those internal edges form a triangle cover: τ(K_n) ≤ C(⌊n/2⌋,2) + C(⌈n/2⌉,2) = (n/2).choose 2 + ((n+1)/2).choose 2.
theorem complete_graph_triangle_cover_number_le_balanced_split (n : ℕ) :
simple_graph_triangle_cover_number (⊤ : SimpleGraph (Fin n)) ≤
(n / 2).choose 2 + ((n + 1) / 2).choose 2complete_split_graph_one_greedy_step_cardIn LeanGraph Theory & Graph Algorithms
For the star complete_split_graph n 1 (centre vertex 0) and any ordering of the vertices, the random greedy independent set is {0} when the centre is the first vertex of the ordering, and the set of all n-1 leaves otherwise; in particular its cardinality is 1 in the first case and n-1 in the second.
open Classical in
theorem complete_split_graph_one_greedy_step_card (n : ℕ) (hn : 1 ≤ n) (σ : Equiv.Perm (Fin n)) :
(List.foldl (fun I v => if ∀ u ∈ I, ¬(complete_split_graph n 1).Adj u v then insert v I else I)
(∅ : Finset (Fin n)) (List.ofFn ⇑σ)).card = if σ ⟨0, hn⟩ = ⟨0, hn⟩ then 1 else n - 1cone_necklace_cover_numberIn LeanGraph Theory & Graph Algorithms
For odd m at least five, the cone-necklace graph has triangle cover number m+(m+1)/2.
open scoped Classical in
theorem cone_necklace_cover_number (m : ℕ) (hm : 5 ≤ m) (hodd : m % 2 = 1) :
simple_graph_triangle_cover_number (cone_necklace_graph m) = m + (m + 1) / 2
cone_necklace_edge_avoidanceIn LeanGraph Theory & Graph Algorithms
For odd m at least five, every edge of the cone-necklace graph is avoided by some triangle packing of size m.
open scoped Classical in
theorem cone_necklace_edge_avoidance (m : ℕ) (hm : 5 ≤ m) (hodd : m % 2 = 1) :
∀ e ∈ (cone_necklace_graph m).edgeSet,
∃ Q : Finset (Finset (Sym2 (Fin (2 * m + 1)))),
Q ⊆ simple_graph_triangle_edge_family (cone_necklace_graph m) ∧
Q.card = m ∧
(Q : Set (Finset (Sym2 (Fin (2 * m + 1))))).Pairwise Disjoint ∧
e ∉ Q.biUnion idcone_necklace_edge_cardIn LeanGraph Theory & Graph Algorithms
For odd m at least five, the cone-necklace graph has exactly 5m edges.
open scoped Classical in
theorem cone_necklace_edge_card (m : ℕ) (hm : 5 ≤ m) (hodd : m % 2 = 1) :
(cone_necklace_graph m).edgeFinset.card = 5 * m
cone_necklace_edge_triangle_codegreesIn LeanGraph Theory & Graph Algorithms
For odd m at least five, every cone-necklace graph edge lies in at least two and at most four triangles.
open scoped Classical in
theorem cone_necklace_edge_triangle_codegrees (m : ℕ) (hm : 5 ≤ m) (hodd : m % 2 = 1) :
∀ e ∈ (cone_necklace_graph m).edgeSet,
2 ≤ ((simple_graph_triangle_edge_family (cone_necklace_graph m)).filter (fun t => e ∈ t)).card ∧
((simple_graph_triangle_edge_family (cone_necklace_graph m)).filter (fun t => e ∈ t)).card ≤ 4cone_necklace_marked_packing_conflict_cycleIn LeanGraph Theory & Graph Algorithms
For odd m at least five, the graph has a size-m triangle packing with one marked edge per triangle containing all singleton-forced edges, and the unmarked conflict graph has the designated m-cycle.
open scoped Classical in
theorem cone_necklace_marked_packing_conflict_cycle (m : ℕ) (hm : 5 ≤ m) (hodd : m % 2 = 1) :
∃ (P : Finset (Finset (Sym2 (Fin (2 * m + 1)))))
(M : Finset (Sym2 (Fin (2 * m + 1)))),
let F := simple_graph_triangle_edge_family (cone_necklace_graph m)
let U := P.biUnion id
P ⊆ F ∧ P.card = m ∧
(P : Set (Finset (Sym2 (Fin (2 * m + 1))))).Pairwise Disjoint ∧
M ⊆ U ∧ (∀ p ∈ P, (M ∩ p).card = 1) ∧
(((F.filter (fun t => (t ∩ U).card = 1)).biUnion id) ∩ U) ⊆ M ∧
∃ f : Fin m → Sym2 (Fin (2 * m + 1)), Function.Injective f ∧
(∀ i, f i ∈ U \ M) ∧
(∀ i : Fin m, ∃ j : Fin m, j.val = (i.val + 1) % m ∧
∃ t ∈ F, f i ∈ t ∧ f j ∈ t ∧ ¬ t ⊆ U)cone_necklace_packing_numberIn LeanGraph Theory & Graph Algorithms
For odd m at least five, the cone-necklace graph has triangle packing number m.
open scoped Classical in
theorem cone_necklace_packing_number (m : ℕ) (hm : 5 ≤ m) (hodd : m % 2 = 1) :
simple_graph_triangle_packing_number (cone_necklace_graph m) = m
cone_necklace_three_vertex_connectedIn LeanGraph Theory & Graph Algorithms
For odd m at least five, deleting any at most two vertices leaves the induced cone-necklace graph connected.
open scoped Classical in
theorem cone_necklace_three_vertex_connected (m : ℕ) (hm : 5 ≤ m) (hodd : m % 2 = 1) :
∀ R : Finset (Fin (2 * m + 1)), R.card ≤ 2 →
((cone_necklace_graph m).induce {v | v ∉ R}).Connectedcone_necklace_triangle_cardIn LeanGraph Theory & Graph Algorithms
For odd m at least five, the cone-necklace graph has exactly 4m triangles.
open scoped Classical in
theorem cone_necklace_triangle_card (m : ℕ) (hm : 5 ≤ m) (hodd : m % 2 = 1) :
(simple_graph_triangle_edge_family (cone_necklace_graph m)).card = 4 * m
conn_set_poly_Q_nonneg_implies_mean_order_geIn LeanGraph Theory & Graph Algorithms
If Q_G is nonnegative on [1,infinity), then for every lambda >= 1 the weighted mean order of G is at least that of K_n.
open scoped BigOperators Polynomial Classical in
theorem conn_set_poly_Q_nonneg_implies_mean_order_ge {V : Type*} [Fintype V] (G : SimpleGraph V)
(hG : G.Connected)
(hQnn : ∀ lam : ℝ, 1 ≤ lam → 0 ≤ (conn_set_poly_Q G).eval lam) :
∀ lam : ℝ, 1 ≤ lam →
weighted_clique_mean (Fintype.card V) lam ≤ connected_induced_mean_order G lamconn_set_poly_Q_top_eq_zeroIn LeanGraph Theory & Graph Algorithms
For the complete graph, Q_G vanishes identically: Z_K = (1+X)^n - 1 has derivative n(1+X)^(n-1), and the two terms of Q cancel.
open scoped BigOperators Polynomial Classical in
theorem conn_set_poly_Q_top_eq_zero {V : Type*} [Fintype V] :
conn_set_poly_Q (⊤ : SimpleGraph V) = 0conn_set_poly_Q_zero_implies_completeIn LeanGraph Theory & Graph Algorithms
If Q_G(lambda) = 0 for some lambda >= 1 forces G to be complete, then equality of the weighted mean orders at any lambda >= 1 forces G to be complete.
open scoped BigOperators Polynomial Classical in
theorem conn_set_poly_Q_zero_implies_complete {V : Type*} [Fintype V] (G : SimpleGraph V)
(hG : G.Connected)
(hQ0 : ∀ lam : ℝ, 1 ≤ lam → (conn_set_poly_Q G).eval lam = 0 → G = ⊤) :
∀ lam : ℝ, 1 ≤ lam →
(connected_induced_mean_order G lam = weighted_clique_mean (Fintype.card V) lam → G = ⊤)conn_set_poly_eval_posIn LeanGraph Theory & Graph Algorithms
For a nonempty finite vertex set and any real lambda >= 1, the connected-set generating polynomial evaluates to a strictly positive number at lambda; hence the mean-order ratio has a nonzero denominator.
open scoped BigOperators Polynomial Classical in
theorem conn_set_poly_eval_pos {V : Type*} [Fintype V] [Nonempty V]
(G : SimpleGraph V) {lam : ℝ} (hlam : 1 ≤ lam) : 0 < (conn_set_poly G).eval lamconn_set_poly_topIn LeanGraph Theory & Graph Algorithms
For the complete graph on a finite vertex type, the connected-set generating polynomial equals (1+X)^|V| - 1.
open scoped BigOperators Polynomial Classical in
theorem conn_set_poly_top {V : Type*} [Fintype V] :
conn_set_poly (⊤ : SimpleGraph V) = (Polynomial.X + 1) ^ Fintype.card V - 1connected_exists_closed_walk_spanningIn LeanGraph Theory & Graph Algorithms
In any finite connected simple graph on at least 2 vertices, there exists a closed walk that visits every vertex.
theorem connected_exists_closed_walk_spanning {V : Type*} [Fintype V]
(G : SimpleGraph V) (hG : G.Connected) (hn : 2 ≤ Fintype.card V) :
∃ (u : V) (p : G.Walk u u), ∀ v, v ∈ p.supportconnected_exists_distance_two_to_cliqueIn LeanGraph Theory & Graph Algorithms
Let G be connected, let Q be a clique with at least two vertices and let some vertex have no neighbour in Q. Then there are vertices y, x and a vertex q of Q such that y is not in Q and has no neighbour in Q, y is adjacent to x, and x is adjacent to q.
theorem connected_exists_distance_two_to_clique {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hconn : G.Connected)
{Q : Finset V} (hQcl : G.IsClique (Q : Set V)) (hQ2 : 2 ≤ Q.card)
(h : ∃ v : V, ∀ u ∈ Q, ¬ G.Adj v u) :
∃ y : V, y ∉ Q ∧ (∀ u ∈ Q, ¬ G.Adj y u) ∧
∃ x : V, G.Adj y x ∧ ∃ q ∈ Q, G.Adj x qconnected_indepNum_eq_radius_claw_freeIn LeanGraph Theory & Graph Algorithms
Every connected finite graph whose independence number equals its radius is claw-free: among any three distinct neighbours of a vertex, two are adjacent.
theorem connected_indepNum_eq_radius_claw_free {V : Type*} [Fintype V] (G : SimpleGraph V)
(hconn : G.Connected) (hα : (G.indepNum : ℕ∞) = G.radius) :
∀ v a b c : V, G.Adj v a → G.Adj v b → G.Adj v c → a ≠ b → a ≠ c → b ≠ c →
G.Adj a b ∨ G.Adj a c ∨ G.Adj b ccops_can_win_if_robber_coveredIn LeanGraph Theory & Graph Algorithms
If, from a position with the cops on C and the robber on R, every vertex the robber could occupy after its next move (namely R itself or a neighbour of R) is at distance at most one from some cop, then the cops can force capture from that position.
theorem cops_can_win_if_robber_covered {V : Type*} (G : SimpleGraph V) {c : ℕ}
(C : Fin c → V) (R : V)
(h : ∀ R' : V, R' = R ∨ G.Adj R R' → ∃ i, C i = R' ∨ G.Adj (C i) R') :
CopsCanWinFrom G c C Rcorona_k1_base_edge_hits_of_transversalIn LeanGraph Theory & Graph Algorithms
If S is an edge geodesic transversal of corona_k1 G and neither pendant edge at u nor at v belongs to S (u ≠ v), then for every geodesic p of G from u to v some edge of S is the image under Sym2.map Sum.inl of an edge of p.
theorem corona_k1_base_edge_hits_of_transversal
{V : Type*} [Fintype V] (G : SimpleGraph V)
(S : Finset (Sym2 (V ⊕ V))) (hS : is_edge_geodesic_transversal (corona_k1 G) S)
{u v : V} (huv : u ≠ v)
(hu : s(Sum.inl u, Sum.inr u) ∉ S) (hv : s(Sum.inl v, Sum.inr v) ∉ S)
{p : G.Walk u v} (hp : p.IsPath) (hlen : p.length = G.dist u v) :
∃ e ∈ S, ∃ e' ∈ p.edges, e = Sym2.map Sum.inl e'corona_k1_dist_ge_of_pathIn LeanGraph Theory & Graph Algorithms
In corona_k1 G, any path from the leaf Sum.inr u to the leaf Sum.inr v with u ≠ v has length at least G.dist u v + 2. (No connectivity is needed: if u and v lie in different components there is no such path.)
theorem corona_k1_dist_ge_of_path
{V : Type*} (G : SimpleGraph V) {u v : V} (huv : u ≠ v)
(q : (corona_k1 G).Walk (Sum.inr u) (Sum.inr v)) (hq : q.IsPath) :
G.dist u v + 2 ≤ q.lengthcorona_k1_dist_leavesIn LeanGraph Theory & Graph Algorithms
In the corona product G ⊙ K₁ of a connected finite graph G the distance between two distinct pendant leaves Sum.inr u and Sum.inr v equals G.dist u v + 2.
theorem corona_k1_dist_leaves
{V : Type*} (G : SimpleGraph V) (hG : G.Connected) {u v : V} (huv : u ≠ v) :
(corona_k1 G).dist (Sum.inr u) (Sum.inr v) = G.dist u v + 2corona_k1_edge_geodesic_transversal_card_geIn LeanGraph Theory & Graph Algorithms
For every finite type V with 2 ≤ Fintype.card V and every connected simple graph G on V, every edge geodesic transversal S of the corona product corona_k1 G satisfies Fintype.card V - 1 ≤ S.card.
theorem corona_k1_edge_geodesic_transversal_card_ge
{V : Type*} [Fintype V] (G : SimpleGraph V) (hG : G.Connected) (hn : 2 ≤ Fintype.card V)
(S : Finset (Sym2 (V ⊕ V))) (hS : is_edge_geodesic_transversal (corona_k1 G) S) :
Fintype.card V - 1 ≤ S.cardcorona_k1_edge_geodesic_transversal_card_ge_of_cruxIn LeanGraph Theory & Graph Algorithms
Assume the pure-graph hitting bound (OP-641, in the form of a hypothesis quantifying over all finite vertex types). Then every edge geodesic transversal S of corona_k1 G satisfies |V| - 1 ≤ |S|.
theorem corona_k1_edge_geodesic_transversal_card_ge_of_crux
(hCrux : ∀ {W : Type*} [Fintype W] (H : SimpleGraph W), H.Connected →
∀ (U : Finset W), 2 ≤ U.card → ∀ F : Finset (Sym2 W),
(∀ e ∈ F, e ∈ H.edgeSet) →
(∀ u ∈ U, ∀ v ∈ U, u ≠ v → ∀ p : H.Walk u v,
p.IsPath → p.length = H.dist u v → ∃ e ∈ F, e ∈ p.edges) →
U.card - 1 ≤ F.card)
{V : Type*} [Fintype V] (G : SimpleGraph V) (hG : G.Connected) (hn : 2 ≤ Fintype.card V)
(S : Finset (Sym2 (V ⊕ V))) (hS : is_edge_geodesic_transversal (corona_k1 G) S) :
Fintype.card V - 1 ≤ S.cardcorona_k1_edge_type_dichotomyIn LeanGraph Theory & Graph Algorithms
Every edge of the corona product corona_k1 G is either a pendant edge s(inl a, inr a) for some a, or a base edge s(inl a, inl b) inherited from G.
theorem corona_k1_edge_type_dichotomy
{V : Type*} (G : SimpleGraph V) {e : Sym2 (V ⊕ V)}
(he : e ∈ (corona_k1 G).edgeSet) :
(∃ a : V, e = s(Sum.inl a, Sum.inr a)) ∨ (∃ a b : V, e = s(Sum.inl a, Sum.inl b))corona_k1_pendant_countIn LeanGraph Theory & Graph Algorithms
For any set S of edges of corona_k1 G, the number of pendant edges in S equals |V| minus the number of vertices a whose pendant edge s(inl a, inr a) is not in S (and every pendant edge occurring in S is of this form).
theorem corona_k1_pendant_count
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (S : Finset (Sym2 (V ⊕ V))) :
(S.filter (fun e => ∃ a : V, e = s(Sum.inl a, Sum.inr a))).card
= Fintype.card V - (Finset.univ.filter (fun a : V => s(Sum.inl a, Sum.inr a) ∉ S)).cardcorona_k1_pendant_edge_injectiveIn LeanGraph Theory & Graph Algorithms
The pendant edges of the corona product are pairwise distinct: if s(inl u, inr u) = s(inl v, inr v) as edges of the corona, then u = v.
theorem corona_k1_pendant_edge_injective
{V : Type*} {u v : V}
(h : s(Sum.inl u, Sum.inr u) = s(Sum.inl v, Sum.inr v)) : u = vcorona_k1_transversal_split_cardIn LeanGraph Theory & Graph Algorithms
For any set S of edges of corona_k1 G, the number of pendant edges of S plus the number of base edges of S equals |S|.
theorem corona_k1_transversal_split_card
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (S : Finset (Sym2 (V ⊕ V)))
(hS : ∀ e ∈ S, e ∈ (corona_k1 G).edgeSet) :
(S.filter (fun e => ∃ a : V, e = s(Sum.inl a, Sum.inr a))).card
+ (S.filter (fun e => ∃ a b : V, e = s(Sum.inl a, Sum.inl b))).card = S.cardcorona_k1_walk_of_base_walkIn LeanGraph Theory & Graph Algorithms
For a walk p : G.Walk u v with u ≠ v, there is a walk in corona_k1 G from Sum.inr u to Sum.inr v obtained by putting a pendant edge at each end of (the image of) p inside the Sum.inl copy; it has length p.length + 2, is a path whenever p is, every edge of it is either a pendant edge or the image Sym2.map Sum.inl of an edge of p, and its only pendant edges are those at u and v.
theorem corona_k1_walk_of_base_walk
{V : Type*} (G : SimpleGraph V) {u v : V} (huv : u ≠ v) (p : G.Walk u v) :
∃ q : (corona_k1 G).Walk (Sum.inr u) (Sum.inr v),
q.length = p.length + 2 ∧ (p.IsPath → q.IsPath) ∧
(∀ e ∈ q.edges, (∃ a : V, e = s(Sum.inl a, Sum.inr a)) ∨
(∃ e' ∈ p.edges, e = Sym2.map Sum.inl e')) ∧
(∀ a : V, s(Sum.inl a, Sum.inr a) ∈ q.edges → a = u ∨ a = v)corona_k1_walk_of_path_inlIn LeanGraph Theory & Graph Algorithms
A path in corona_k1 G whose two endpoints both lie in the first copy (Sum.inl u and Sum.inl v) never visits a vertex of the second copy, and projects to a walk in G from u to v of the same length.
theorem corona_k1_walk_of_path_inl
{V : Type*} (G : SimpleGraph V) {u v : V}
(p : (corona_k1 G).Walk (Sum.inl u) (Sum.inl v)) (hp : p.IsPath) :
∃ q : G.Walk u v, q.length = p.lengthcrown_uniform_lists_overlap_obstructionIn LeanGraph Theory & Graph Algorithms
If m is at least four, p is at least two, and 2p is at most m+1, then any two selectors on all p-element subsets of an m-element ground set agree on some two distinct sets.
theorem crown_uniform_lists_overlap_obstruction (m p : ℕ) (hm : 4 ≤ m) (hp : 2 ≤ p) (hmp : 2*p ≤ m+1) (f g : {S : Finset (Fin m) // S.card = p} → Fin m) (hf : ∀ S, f S ∈ S.val) (hg : ∀ S, g S ∈ S.val) : ∃ S T, S ≠ T ∧ f S = g TcycleGraph_adj_val_iffIn LeanGraph Theory & Graph Algorithms
For n ≥ 2 and x, y : Fin n, x and y are adjacent in the cycle graph on n vertices exactly when their values are consecutive (x.val = y.val + 1 or y.val = x.val + 1) or one of them is 0 and the other is n - 1.
theorem cycleGraph_adj_val_iff {n : ℕ} (hn : 2 ≤ n) {x y : Fin n} :
(SimpleGraph.cycleGraph n).Adj x y ↔
x.val = y.val + 1 ∨ y.val = x.val + 1 ∨
(x.val = 0 ∧ y.val = n - 1) ∨ (y.val = 0 ∧ x.val = n - 1)cycleGraph_dist_eqIn LeanGraph Theory & Graph Algorithms
For n ≥ 3 and vertices u, v of the cycle C_n, the graph distance between u and v is the minimum of the two cyclic separations: dist u v = min (((v + n - u) % n)) (((u + n - v) % n)), computed on the natural-number representatives of u and v.
theorem cycleGraph_dist_eq (n : ℕ) (hn : 3 ≤ n) (u v : Fin n) :
(SimpleGraph.cycleGraph n).dist u v =
min (((v : ℕ) + n - (u : ℕ)) % n) (((u : ℕ) + n - (v : ℕ)) % n)cycle_cover_card_eq_sum_componentsIn LeanGraph Theory & Graph Algorithms
The sum of the sizes of the mutual-reachability classes is the number of vertices.
theorem cycle_cover_card_eq_sum_components {V : Type} [Fintype V] (R : V → V → Prop)
[DecidableEq (Quotient (cycle_cover_mutual_reach_setoid R))] :
(∑ q : Quotient (cycle_cover_mutual_reach_setoid R),
Fintype.card {v // Quotient.mk (cycle_cover_mutual_reach_setoid R) v = q}) = Fintype.card Vcycle_cover_diameter_of_strongly_connected_componentsIn LeanGraph Theory & Graph Algorithms
A quadratic signed-diameter bound for the cycle-cover group of every strongly connected reflexive relation implies the same bound (with the same constant) for the cycle-cover group of every reflexive relation, by summing over the strongly connected components of R.
theorem cycle_cover_diameter_of_strongly_connected_components :
∀ (D : ℕ),
(∀ (W : Type) [Fintype W] [DecidableEq W] (R' : W → W → Prop),
(∀ w, R' w w) → (∀ u v : W, Relation.ReflTransGen R' u v) →
∀ k ∈ Subgroup.closure {p : Equiv.Perm W | ∀ w, R' w (p w)},
∃ w : List (Equiv.Perm W),
(∀ p ∈ w, (∀ v, R' v (p v)) ∨ (∀ v, R' (p v) v)) ∧
w.length ≤ D * (Fintype.card W) ^ 2 ∧ w.prod = k) →
∀ (V : Type) [Fintype V] [DecidableEq V] (R : V → V → Prop), (∀ v, R v v) →
∀ k ∈ Subgroup.closure {p : Equiv.Perm V | ∀ v, R v (p v)},
∃ w : List (Equiv.Perm V),
(∀ p ∈ w, (∀ v, R v (p v)) ∨ (∀ v, R (p v) v)) ∧
w.length ≤ D * (Fintype.card V) ^ 2 ∧ w.prod = kcycle_cover_fiber_strong_connectedIn LeanGraph Theory & Graph Algorithms
Each mutual-reachability class, viewed as a subtype with the restricted relation, is strongly connected: any two points of the class are joined by a restricted path that never leaves the class.
theorem cycle_cover_fiber_strong_connected {V : Type} (R : V → V → Prop)
(q : Quotient (cycle_cover_mutual_reach_setoid R))
(a b : {v // Quotient.mk (cycle_cover_mutual_reach_setoid R) v = q}) :
Relation.ReflTransGen
(fun x y : {v // Quotient.mk (cycle_cover_mutual_reach_setoid R) v = q} => R x.val y.val) a bcycle_cover_flat_length_boundIn LeanGraph Theory & Graph Algorithms
If each component of a relation has a word of length at most D times the square of its size, then concatenating the words over all mutual-reachability classes gives a word of length at most D times the square of the number of vertices.
theorem cycle_cover_flat_length_bound {V : Type} [Fintype V] (R : V → V → Prop)
[DecidableEq (Quotient (cycle_cover_mutual_reach_setoid R))] (D : ℕ)
(F : Quotient (cycle_cover_mutual_reach_setoid R) → List (Equiv.Perm V))
(hF : ∀ q : Quotient (cycle_cover_mutual_reach_setoid R),
(F q).length ≤ D * (Fintype.card {v // Quotient.mk (cycle_cover_mutual_reach_setoid R) v = q}) ^ 2) :
((((Finset.univ : Finset (Quotient (cycle_cover_mutual_reach_setoid R))).toList).map F).flatten).length
≤ D * (Fintype.card V) ^ 2cycle_cover_flat_prod_eq_of_blockwiseIn LeanGraph Theory & Graph Algorithms
The assembly step: if the block of each class acts on the points of that class exactly as a fixed permutation k does (and blocks preserve classes and fix other classes pointwise), then the flattened product over all classes is k.
theorem cycle_cover_flat_prod_eq_of_blockwise {V : Type} (s : Setoid V) [Fintype (Quotient s)]
[DecidableEq (Quotient s)]
(F : Quotient s → List (Equiv.Perm V))
(hpres : ∀ (q : Quotient s) (g : Equiv.Perm V), g ∈ F q → ∀ v : V,
Quotient.mk s (g v) = Quotient.mk s v)
(hfix : ∀ (q : Quotient s) (g : Equiv.Perm V), g ∈ F q → ∀ v : V, Quotient.mk s v ≠ q → g v = v)
(k : Equiv.Perm V)
(hblock : ∀ (q : Quotient s) (x : V), Quotient.mk s x = q → (F q).prod x = k x) :
((((Finset.univ : Finset (Quotient s)).toList).map F).flatten).prod = kcycle_cover_flat_prod_not_memIn LeanGraph Theory & Graph Algorithms
Given a family of permutations block-indexed by the classes of a setoid, where the q-th block fixes pointwise everything outside class q: if the class of x is not in a nodup list of classes, the flattened product over that list fixes x.
theorem cycle_cover_flat_prod_not_mem {V : Type} (s : Setoid V)
(F : Quotient s → List (Equiv.Perm V))
(hfix : ∀ (q : Quotient s) (g : Equiv.Perm V), g ∈ F q → ∀ v : V, Quotient.mk s v ≠ q → g v = v)
(q0 : Quotient s) :
∀ {l : List (Quotient s)}, l.Nodup → q0 ∉ l → ∀ x : V, Quotient.mk s x = q0 →
((l.map F).flatten).prod x = xcycle_cover_flat_prod_of_memIn LeanGraph Theory & Graph Algorithms
Given a family of permutations block-indexed by the classes of a setoid, where every block element preserves classes and fixes everything outside its own class: if the class of x appears in a nodup list of classes, the flattened product over that list acts on x exactly as the block of x's class does.
theorem cycle_cover_flat_prod_of_mem {V : Type} (s : Setoid V)
(F : Quotient s → List (Equiv.Perm V))
(hpres : ∀ (q : Quotient s) (g : Equiv.Perm V), g ∈ F q → ∀ v : V,
Quotient.mk s (g v) = Quotient.mk s v)
(hfix : ∀ (q : Quotient s) (g : Equiv.Perm V), g ∈ F q → ∀ v : V, Quotient.mk s v ≠ q → g v = v)
(q0 : Quotient s) :
∀ {l : List (Quotient s)}, l.Nodup → q0 ∈ l → ∀ x : V, Quotient.mk s x = q0 →
((l.map F).flatten).prod x = (F q0).prod xcycle_cover_group_preserves_classIn LeanGraph Theory & Graph Algorithms
Every element k of the cycle-cover group of R maps each mutual-reachability class onto itself: k x lies in the class of x.
theorem cycle_cover_group_preserves_class {V : Type} [Fintype V] (R : V → V → Prop)
(k : Equiv.Perm V) (hk : k ∈ Subgroup.closure {p : Equiv.Perm V | ∀ v, R v (p v)}) (x : V) :
Quotient.mk (cycle_cover_mutual_reach_setoid R) (k x)
= Quotient.mk (cycle_cover_mutual_reach_setoid R) xcycle_cover_list_prod_fixes_atIn LeanGraph Theory & Graph Algorithms
If every permutation in a list fixes a point x, then the product of the list fixes x.
theorem cycle_cover_list_prod_fixes_at {V : Type} {x : V} :
∀ l : List (Equiv.Perm V), (∀ g ∈ l, g x = x) → l.prod x = xcycle_cover_ofSubtype_is_coverIn LeanGraph Theory & Graph Algorithms
A permutation of one mutual-reachability class, extended by the identity off the class, is a cycle cover of R on the whole type (resp. its inverse is) provided it is a cycle cover (resp. reverse cycle cover) of the restricted relation, using reflexivity off the class.
theorem cycle_cover_ofSubtype_is_cover {V : Type} (R : V → V → Prop) (hR : ∀ v, R v v)
[DecidableEq (Quotient (cycle_cover_mutual_reach_setoid R))]
(q : Quotient (cycle_cover_mutual_reach_setoid R))
(g : Equiv.Perm {v // Quotient.mk (cycle_cover_mutual_reach_setoid R) v = q}) :
((∀ w, R w.val (g w).val) → ∀ v, R v (Equiv.Perm.ofSubtype g v)) ∧
((∀ w, R (g w).val w.val) → ∀ v, R (Equiv.Perm.ofSubtype g v) v)cycle_cover_prod_preserves_classIn LeanGraph Theory & Graph Algorithms
If every permutation in a list maps each element into its own class (fibre of the quotient map of a setoid), then the product of the list does too.
theorem cycle_cover_prod_preserves_class {V : Type} (s : Setoid V) (l : List (Equiv.Perm V))
(h : ∀ g ∈ l, ∀ v : V, Quotient.mk s (g v) = Quotient.mk s v) :
∀ v : V, Quotient.mk s (l.prod v) = Quotient.mk s vcycle_cover_restriction_mem_closureIn LeanGraph Theory & Graph Algorithms
The restriction of an element of the cycle-cover group to one mutual-reachability class lies in the cycle-cover group of that class with the restricted relation, provided k maps each class into itself.
theorem cycle_cover_restriction_mem_closure {V : Type} [Fintype V] (R : V → V → Prop)
(k : Equiv.Perm V) (hk : k ∈ Subgroup.closure {p : Equiv.Perm V | ∀ v, R v (p v)})
(hcls : ∀ (q : Quotient (cycle_cover_mutual_reach_setoid R)), ∀ x : V,
(Quotient.mk (cycle_cover_mutual_reach_setoid R) (k x) = q) ↔
(Quotient.mk (cycle_cover_mutual_reach_setoid R) x = q))
(q : Quotient (cycle_cover_mutual_reach_setoid R)) :
k.subtypePerm (hcls q) ∈
Subgroup.closure {p : Equiv.Perm {v // Quotient.mk (cycle_cover_mutual_reach_setoid R) v = q} |
∀ v, R v.val (p v).val}cycle_cover_sum_sq_le_sq_sumIn LeanGraph Theory & Graph Algorithms
A sum of squares of naturals is at most the square of the sum.
theorem cycle_cover_sum_sq_le_sq_sum {ι : Type} [Fintype ι] (m : ι → ℕ) :
(∑ i, m i ^ 2) ≤ (∑ i, m i) ^ 2cycle_graph_adj_signed_stepIn LeanGraph Theory & Graph Algorithms
If a and b are adjacent in C_n (n >= 2) there is an integer δ congruent to b - a mod n with |δ| = 1.
theorem cycle_graph_adj_signed_step (n : ℕ) (hn : 2 ≤ n) {a b : Fin n}
(h : (SimpleGraph.cycleGraph n).Adj a b) :
∃ δ : ℤ, δ ≡ (b : ℤ) - (a : ℤ) [ZMOD (n : ℤ)] ∧ δ.natAbs = 1cycle_graph_edist_ge_cyclic_distIn LeanGraph Theory & Graph Algorithms
For n >= 3 and vertices u, v of C_n, the extended distance edist u v is at least min(k, n-k) where k = (v - u).val.
theorem cycle_graph_edist_ge_cyclic_dist (n : ℕ) (hn : 3 ≤ n) (u v : Fin n) :
((min ((v - u).val) (n - (v - u).val) : ℕ) : ℕ∞) ≤ (SimpleGraph.cycleGraph n).edist u vcycle_graph_exists_vertex_cyclic_dist_halfIn LeanGraph Theory & Graph Algorithms
For n >= 3 and any vertex u of C_n there is a vertex v with cyclic distance (v - u).val = n/2, i.e. the antipodal vertex.
theorem cycle_graph_exists_vertex_cyclic_dist_half (n : ℕ) (hn : 3 ≤ n) (u : Fin n) :
∃ v : Fin n, (v - u).val = n / 2cycle_graph_fin_sub_int_modEqIn LeanGraph Theory & Graph Algorithms
For a, b : Fin n, the natural number (b - a).val is congruent mod n to the integer b - a.
theorem cycle_graph_fin_sub_int_modEq (n : ℕ) (a b : Fin n) :
(((b - a).val : ℤ) ≡ (b : ℤ) - (a : ℤ) [ZMOD (n : ℤ)])cycle_graph_indepNum_eq_radiusIn LeanGraph Theory & Graph Algorithms
For n >= 3 the cycle graph C_n has independence number floor(n/2) and radius floor(n/2).
theorem cycle_graph_indepNum_eq_radius (n : ℕ) (hn : 3 ≤ n) :
(SimpleGraph.cycleGraph n).indepNum = n / 2 ∧
(SimpleGraph.cycleGraph n).radius = ((n / 2 : ℕ) : ℕ∞)cycle_graph_indepNum_geIn LeanGraph Theory & Graph Algorithms
The even vertices {0,2,4,...} form an independent set of size n/2 in C_n.
theorem cycle_graph_indepNum_ge (n : ℕ) (hn : 3 ≤ n) :
n / 2 ≤ (SimpleGraph.cycleGraph n).indepNumcycle_graph_indepNum_leIn LeanGraph Theory & Graph Algorithms
Any independent set S of the cycle C_n satisfies 2|S| <= n, hence |S| <= n/2.
theorem cycle_graph_indepNum_le (n : ℕ) (hn : 3 ≤ n) :
(SimpleGraph.cycleGraph n).indepNum ≤ n / 2cycle_graph_odd_diamIn LeanGraph Theory & Graph Algorithms
For any natural number m ≥ 1, the diameter of the odd cycle SimpleGraph.cycleGraph (2 * m + 1) equals m.
theorem cycle_graph_odd_diam (m : ℕ) (hm : 1 ≤ m) : (SimpleGraph.cycleGraph (2 * m + 1)).diam = m
cycle_graph_radius_geIn LeanGraph Theory & Graph Algorithms
Every vertex of C_n has a vertex at cyclic distance n/2, so the eccentricity of every vertex and hence the radius is at least n/2.
theorem cycle_graph_radius_ge (n : ℕ) (hn : 3 ≤ n) :
((n / 2 : ℕ) : ℕ∞) ≤ (SimpleGraph.cycleGraph n).radiuscycle_graph_radius_leIn LeanGraph Theory & Graph Algorithms
Every vertex of C_n can be reached from 0 in at most n/2 steps, going the shorter way round, so the radius is at most n/2.
theorem cycle_graph_radius_le (n : ℕ) (hn : 3 ≤ n) :
(SimpleGraph.cycleGraph n).radius ≤ ((n / 2 : ℕ) : ℕ∞)cycle_graph_walk_displacementIn LeanGraph Theory & Graph Algorithms
For n >= 2 and any walk W from u to v in C_n there is an integer x congruent to v - u mod n with |x| <= W.length.
theorem cycle_graph_walk_displacement (n : ℕ) (hn : 2 ≤ n) :
∀ {u v : Fin n} (W : (SimpleGraph.cycleGraph n).Walk u v),
∃ x : ℤ, x ≡ (v : ℤ) - (u : ℤ) [ZMOD (n : ℤ)] ∧ x.natAbs ≤ W.lengthcycle_product_even_even_not_wcpIn LeanGraph Theory & Graph Algorithms
If m and n are even with m, n ≥ 6, then C_m □ C_n is not well-covered (so it does not have the well-covered powers property): it has two maximal independent sets of different sizes.
theorem cycle_product_even_even_not_wcp (m n : ℕ) (hm : Even m) (hn : Even n) (hm6 : 6 ≤ m) (hn6 : 6 ≤ n) :
¬ simple_graph_has_well_covered_powers (SimpleGraph.cycleGraph m □ SimpleGraph.cycleGraph n)cycle_product_mixed_parity_not_wcpIn LeanGraph Theory & Graph Algorithms
If exactly one of m, n is even (the odd one being ≥ 6 and ≠ 7, hence ≥ 9), then C_m □ C_n is not well-covered, so it does not have the well-covered powers property.
theorem cycle_product_mixed_parity_not_wcp (m n : ℕ) (hm6 : 6 ≤ m) (hn6 : 6 ≤ n) (hm7 : m ≠ 7) (hn7 : n ≠ 7)
(hpar : (Even m ∧ Odd n) ∨ (Odd m ∧ Even n)) :
¬ simple_graph_has_well_covered_powers (SimpleGraph.cycleGraph m □ SimpleGraph.cycleGraph n)cycle_product_odd_odd_not_wcpIn LeanGraph Theory & Graph Algorithms
If m and n are both odd with m, n ≥ 6 and m, n ≠ 7 (hence m, n ≥ 9), then C_m □ C_n is not well-covered, so it does not have the well-covered powers property.
theorem cycle_product_odd_odd_not_wcp (m n : ℕ) (hm : Odd m) (hn : Odd n) (hm6 : 6 ≤ m) (hn6 : 6 ≤ n) (hm7 : m ≠ 7) (hn7 : n ≠ 7) :
¬ simple_graph_has_well_covered_powers (SimpleGraph.cycleGraph m □ SimpleGraph.cycleGraph n)cycle_with_two_chords_adj_embed_impIn LeanGraph Theory & Graph Algorithms
Let m ≥ 6 and 3 ≤ a ≤ m - 3. If two vertices of the embedded copy of the (m-1)-cycle inside the m-cycle with chords {0, a-1} and {a, m-1} are adjacent, then their preimages are adjacent in the (m-1)-cycle, or they are the pair {0, a-1} realizing the first chord (in either order).
theorem cycle_with_two_chords_adj_embed_imp {m a : ℕ} (hm : 6 ≤ m) (ha : 3 ≤ a) (ham : a ≤ m - 3)
{p q : Fin (m - 1)}
(h : (cycle_with_two_chords m a).Adj
(⟨p.val, Nat.lt_of_lt_of_le p.isLt (Nat.sub_le m 1)⟩ : Fin m)
(⟨q.val, Nat.lt_of_lt_of_le q.isLt (Nat.sub_le m 1)⟩ : Fin m)) :
(SimpleGraph.cycleGraph (m - 1)).Adj p q ∨ (p.val = 0 ∧ q.val = a - 1) ∨
(q.val = 0 ∧ p.val = a - 1)cycle_with_two_chords_adj_last_embed_impIn LeanGraph Theory & Graph Algorithms
Let m ≥ 6 and 3 ≤ a ≤ m - 3. If the last vertex m - 1 of the m-cycle with chords {0, a-1} and {a, m-1} is adjacent to a vertex of the embedded copy of the (m-1)-cycle with value p.val, then p.val is 0, or m - 2, or a.
theorem cycle_with_two_chords_adj_last_embed_imp {m a : ℕ} (hm : 6 ≤ m) (ha : 3 ≤ a)
(ham : a ≤ m - 3) {p : Fin (m - 1)}
(h : (cycle_with_two_chords m a).Adj (⟨m - 1, by omega⟩ : Fin m)
(⟨p.val, Nat.lt_of_lt_of_le p.isLt (Nat.sub_le m 1)⟩ : Fin m)) :
p.val = 0 ∨ p.val = m - 2 ∨ p.val = acyclic_four_block_coverIn LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: cover.
theorem cyclic_four_block_cover (m : ℕ) (e f : (Fin (2*m+5) × Fin 6))
(hne : cyclic_four_block_edge m e ≠ cyclic_four_block_edge m f) (ht : cyclic_four_block_touch m e f) :
f=cyclic_four_block_N m e (⟨0,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m e (⟨1,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m e (⟨2,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m e (⟨3,by decide⟩ : Fin 4)cyclic_four_block_cover_role0In LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: cover role0.
theorem cyclic_four_block_cover_role0 (m : ℕ) (i : Fin (2*m+5)) (f : Fin (2*m+5) × Fin 6)
(hne : cyclic_four_block_edge m (i, (⟨0, by decide⟩ : Fin 6)) ≠ cyclic_four_block_edge m f) (ht : cyclic_four_block_touch m (i, (⟨0, by decide⟩ : Fin 6)) f) :
f=cyclic_four_block_N m (i, (⟨0, by decide⟩ : Fin 6)) (⟨0,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨0, by decide⟩ : Fin 6)) (⟨1,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨0, by decide⟩ : Fin 6)) (⟨2,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨0, by decide⟩ : Fin 6)) (⟨3,by decide⟩ : Fin 4)cyclic_four_block_cover_role1In LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: cover role1.
theorem cyclic_four_block_cover_role1 (m : ℕ) (i : Fin (2*m+5)) (f : Fin (2*m+5) × Fin 6)
(hne : cyclic_four_block_edge m (i, (⟨1, by decide⟩ : Fin 6)) ≠ cyclic_four_block_edge m f) (ht : cyclic_four_block_touch m (i, (⟨1, by decide⟩ : Fin 6)) f) :
f=cyclic_four_block_N m (i, (⟨1, by decide⟩ : Fin 6)) (⟨0,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨1, by decide⟩ : Fin 6)) (⟨1,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨1, by decide⟩ : Fin 6)) (⟨2,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨1, by decide⟩ : Fin 6)) (⟨3,by decide⟩ : Fin 4)cyclic_four_block_cover_role2In LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: cover role2.
theorem cyclic_four_block_cover_role2 (m : ℕ) (i : Fin (2*m+5)) (f : Fin (2*m+5) × Fin 6)
(hne : cyclic_four_block_edge m (i, (⟨2, by decide⟩ : Fin 6)) ≠ cyclic_four_block_edge m f) (ht : cyclic_four_block_touch m (i, (⟨2, by decide⟩ : Fin 6)) f) :
f=cyclic_four_block_N m (i, (⟨2, by decide⟩ : Fin 6)) (⟨0,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨2, by decide⟩ : Fin 6)) (⟨1,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨2, by decide⟩ : Fin 6)) (⟨2,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨2, by decide⟩ : Fin 6)) (⟨3,by decide⟩ : Fin 4)cyclic_four_block_cover_role3In LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: cover role3.
theorem cyclic_four_block_cover_role3 (m : ℕ) (i : Fin (2*m+5)) (f : Fin (2*m+5) × Fin 6)
(hne : cyclic_four_block_edge m (i, (⟨3, by decide⟩ : Fin 6)) ≠ cyclic_four_block_edge m f) (ht : cyclic_four_block_touch m (i, (⟨3, by decide⟩ : Fin 6)) f) :
f=cyclic_four_block_N m (i, (⟨3, by decide⟩ : Fin 6)) (⟨0,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨3, by decide⟩ : Fin 6)) (⟨1,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨3, by decide⟩ : Fin 6)) (⟨2,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨3, by decide⟩ : Fin 6)) (⟨3,by decide⟩ : Fin 4)cyclic_four_block_cover_role4In LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: cover role4.
theorem cyclic_four_block_cover_role4 (m : ℕ) (i : Fin (2*m+5)) (f : Fin (2*m+5) × Fin 6)
(hne : cyclic_four_block_edge m (i, (⟨4, by decide⟩ : Fin 6)) ≠ cyclic_four_block_edge m f) (ht : cyclic_four_block_touch m (i, (⟨4, by decide⟩ : Fin 6)) f) :
f=cyclic_four_block_N m (i, (⟨4, by decide⟩ : Fin 6)) (⟨0,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨4, by decide⟩ : Fin 6)) (⟨1,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨4, by decide⟩ : Fin 6)) (⟨2,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨4, by decide⟩ : Fin 6)) (⟨3,by decide⟩ : Fin 4)cyclic_four_block_cover_role5In LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: cover role5.
theorem cyclic_four_block_cover_role5 (m : ℕ) (i : Fin (2*m+5)) (f : Fin (2*m+5) × Fin 6)
(hne : cyclic_four_block_edge m (i, (⟨5, by decide⟩ : Fin 6)) ≠ cyclic_four_block_edge m f) (ht : cyclic_four_block_touch m (i, (⟨5, by decide⟩ : Fin 6)) f) :
f=cyclic_four_block_N m (i, (⟨5, by decide⟩ : Fin 6)) (⟨0,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨5, by decide⟩ : Fin 6)) (⟨1,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨5, by decide⟩ : Fin 6)) (⟨2,by decide⟩ : Fin 4) ∨ f=cyclic_four_block_N m (i, (⟨5, by decide⟩ : Fin 6)) (⟨3,by decide⟩ : Fin 4)cyclic_four_block_good_injectiveIn LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: good injective.
theorem cyclic_four_block_good_injective (m : ℕ) (e : (Fin (2*m+5) × Fin 6)) (he : cyclic_four_block_good m e) :
Function.Injective (fun k => cyclic_four_block_col m (cyclic_four_block_N m e k))cyclic_four_block_good_injective_role0In LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: good injective role0.
theorem cyclic_four_block_good_injective_role0 (m : ℕ) (i : Fin (2*m+5)) (he : cyclic_four_block_good m (i, (⟨0, by decide⟩ : Fin 6))) :
Function.Injective (fun k => cyclic_four_block_col m (cyclic_four_block_N m (i, (⟨0, by decide⟩ : Fin 6)) k))cyclic_four_block_good_injective_role1In LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: good injective role1.
theorem cyclic_four_block_good_injective_role1 (m : ℕ) (i : Fin (2*m+5)) (he : cyclic_four_block_good m (i, (⟨1, by decide⟩ : Fin 6))) :
Function.Injective (fun k => cyclic_four_block_col m (cyclic_four_block_N m (i, (⟨1, by decide⟩ : Fin 6)) k))cyclic_four_block_good_injective_role2In LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: good injective role2.
theorem cyclic_four_block_good_injective_role2 (m : ℕ) (i : Fin (2*m+5)) (he : cyclic_four_block_good m (i, (⟨2, by decide⟩ : Fin 6))) :
Function.Injective (fun k => cyclic_four_block_col m (cyclic_four_block_N m (i, (⟨2, by decide⟩ : Fin 6)) k))cyclic_four_block_good_injective_role3In LeanGraph Theory & Graph Algorithms
Step of cyclic_four_block_graph_exists_rich_neighbor_five_coloring: good injective role3.
theorem cyclic_four_block_good_injective_role3 (m : ℕ) (i : Fin (2*m+5)) (he : cyclic_four_block_good m (i, (⟨3, by decide⟩ : Fin 6))) :
Function.Injective (fun k => cyclic_four_block_col m (cyclic_four_block_N m (i, (⟨3, by decide⟩ : Fin 6)) k))cyclic_ramsey_number_le_of_propertyIn LeanGraph Theory & Graph Algorithms
The cyclic Ramsey number R_cyc(H₁, H₂) is at most N whenever N is positive and satisfies the cyclic Ramsey property for H₁ and H₂.
theorem cyclic_ramsey_number_le_of_property {m n N : ℕ} (H₁ : SimpleGraph (Fin m)) (H₂ : SimpleGraph (Fin n)) (hN : 0 < N) (hprop : cyclic_ramsey_property H₁ H₂ N) : cyclic_ramsey_number H₁ H₂ ≤ Ndeficit_change_under_connected_vertex_deletionIn LeanGraph Theory & Graph Algorithms
Let G be a finite connected simple graph on a type V with decidable equality, and let u be a vertex such that the vertex-deleted subgraph G.induce (Set.univ \ {u}) is connected. Then 2 * tau G u ≤ delta G - delta (G.delete u).
theorem deficit_change_under_connected_vertex_deletion {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (hG : G.Connected) (u : V) (hu : (G.induce (Set.univ \ {u})).Connected) : 2 * tau G u ≤ delta G - delta (G.delete u)degree_list_kempe_diameter_fin_eighteen_k5_sub_edgeIn LeanGraph Theory & Graph Algorithms
For H = K5 minus the edge {3,4}, for every tight list assignment L : Fin 5 → Finset (Fin 18) (|L v| = 4 for v = 0,1,2 and |L v| = 3 for v = 3,4) and every two proper L-colourings α, β, there is a chain of at most 6 L-valid Kempe changes from α to β.
theorem degree_list_kempe_diameter_fin_eighteen_k5_sub_edge : degree_list_kempe_diameter_fin_eighteen five_k5_sub_edge
degree_list_kempe_diameter_fin_eighteen_wheel_fourIn LeanGraph Theory & Graph Algorithms
For H = the 4-wheel (hub 0 of degree 4, rim 1-2-3-4 of degree 3), for every tight list assignment L : Fin 5 → Finset (Fin 18) and every two proper L-colourings α, β, there is a chain of at most 6 L-valid Kempe changes from α to β.
theorem degree_list_kempe_diameter_fin_eighteen_wheel_four : degree_list_kempe_diameter_fin_eighteen five_wheel_four
degree_list_kempe_diameter_fiveIn LeanGraph Theory & Graph Algorithms
Base case n = 5: on any 3-vertex-connected simple graph on 5 vertices other than K₅, any two proper tight degree-list colorings α and β can be transformed into one another by at most 6 L-valid Kempe changes.
theorem degree_list_kempe_diameter_five :
∀ (G : SimpleGraph (Fin 5)) [DecidableRel G.Adj],
simple_graph_three_vertex_connected G →
G ≠ ⊤ →
IsEmpty (G ≃g simple_graph_prism 3) →
∀ (C : Type) [Fintype C] [DecidableEq C] (L : Fin 5 → Finset C),
(∀ v, (L v).card = G.degree v) →
∀ (α β : G.Coloring C),
(∀ v, α v ∈ L v) →
(∀ v, β v ∈ L v) →
∃ (k : ℕ), k ≤ 6 ∧
∃ (seq : List (G.Coloring C)),
seq ≠ [] ∧ seq.head? = some α ∧ seq.getLast? = some β ∧
seq.length - 1 = k ∧
seq.IsChain (fun c₁ c₂ => (∀ v, c₁ v ∈ L v) ∧ (∀ v, c₂ v ∈ L v) ∧
∃ (a b : C) (U : Set (Fin 5)),
a ≠ b ∧ U.Nonempty ∧ (∀ v ∈ U, c₁ v = a ∨ c₁ v = b) ∧
(G.induce U).Connected ∧
(∀ u ∈ U, ∀ v : Fin 5, G.Adj u v → (c₁ v = a ∨ c₁ v = b) → v ∈ U) ∧
(∀ v ∈ U, c₂ v = (if c₁ v = a then b else a)) ∧
(∀ v ∉ U, c₂ v = c₁ v))degree_list_kempe_diameter_five_reduce_to_modelsIn LeanGraph Theory & Graph Algorithms
If the Fin-18 Kempe-diameter bound holds for K5-e and for the 4-wheel, then degree_list_kempe_diameter_at_most_six G holds for every 3-vertex-connected G on 5 vertices with G ≠ K5.
theorem degree_list_kempe_diameter_five_reduce_to_models (h₁ : degree_list_kempe_diameter_fin_eighteen five_k5_sub_edge) (h₂ : degree_list_kempe_diameter_fin_eighteen five_wheel_four) (G : SimpleGraph (Fin 5)) [DecidableRel G.Adj] (h3 : simple_graph_three_vertex_connected G) (hne : G ≠ ⊤) (hprism : IsEmpty (G ≃g simple_graph_prism 3)) : degree_list_kempe_diameter_at_most_six G
degree_list_kempe_diameter_of_fin_eighteenIn LeanGraph Theory & Graph Algorithms
If the Kempe-diameter-6 bound holds for the fixed palette Fin 18 for G, and the degree sum of G is at most 18, then it holds for every finite colour type.
theorem degree_list_kempe_diameter_of_fin_eighteen (G : SimpleGraph (Fin 5)) [DecidableRel G.Adj] (hsum : ∑ v, G.degree v ≤ 18) (h : degree_list_kempe_diameter_fin_eighteen G) : degree_list_kempe_diameter_at_most_six G
det_extremal_cubic_bipartite_conn_two_covers_three_connectedIn LeanGraph Theory & Graph Algorithms
Every finite connected cubic bipartite det-extremal graph G with vertex connectivity 2 admits a locally surjective graph homomorphism onto a finite 3-connected cubic bipartite det-extremal graph H.
theorem det_extremal_cubic_bipartite_conn_two_covers_three_connected :
∀ {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj],
G.Connected → G.IsBipartite → G.IsRegularOfDegree 3 →
ghz_graph_vertex_connectivity G = 2 → is_det_extremal G →
∃ (W : Type) (_ : Fintype W) (_ : DecidableEq W) (H : SimpleGraph W) (_ : DecidableRel H.Adj),
H.Connected ∧ H.IsBipartite ∧ H.IsRegularOfDegree 3 ∧
3 ≤ ghz_graph_vertex_connectivity H ∧ is_det_extremal H ∧
∃ (f : V → W), (∀ {u v}, G.Adj u v → H.Adj (f u) (f v)) ∧
(∀ u, H.neighborSet (f u) ⊆ f '' G.neighborSet u)diamond_free_clique_neighbor_card_le_oneIn LeanGraph Theory & Graph Algorithms
In a diamond-free graph, every vertex outside a maximum clique Q of size at least 3 has at most one neighbor in Q.
theorem diamond_free_clique_neighbor_card_le_one {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (h_dfree : is_diamond_free G)
{Q : Finset V} (hQ : G.IsNClique G.cliqueNum Q) (h3 : 3 ≤ G.cliqueNum)
{x : V} (hx : x ∉ Q) : (G.neighborFinset x ∩ Q).card ≤ 1diamond_free_critical_clique_structureIn LeanGraph Theory & Graph Algorithms
Let G be a noncomplete k-vertex-critical diamond-free graph with chromatic number k, maximum degree k, and clique number r at least 4. Then G contains an induced K_s^+ for every 3 ≤ s ≤ r and an induced L_t for every 3 ≤ t ≤ r - 1. Furthermore, if G is L_r-free, then every maximum clique dominates the vertex set of G.
theorem diamond_free_critical_clique_structure
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k r : ℕ} (h_noncomplete : G ≠ ⊤)
(h_crit : is_vertex_critical G k)
(h_dfree : is_diamond_free G)
(h_deg : G.maxDegree = k)
(h_omega : G.cliqueNum = r)
(h_r : 4 ≤ r) :
(∀ s, 3 ≤ s → s ≤ r → SimpleGraph.IsIndContained (k_plus_graph s) G) ∧
(∀ t, 3 ≤ t → t ≤ r - 1 → SimpleGraph.IsIndContained (l_path_graph t) G) ∧
(¬ SimpleGraph.IsIndContained (l_path_graph r) G →
∀ Q : Finset V, G.IsNClique r Q → ∀ v : V, v ∉ Q → ∃ u ∈ Q, G.Adj v u)diamond_free_critical_dominating_cliqueIn LeanGraph Theory & Graph Algorithms
In a noncomplete k-vertex-critical diamond-free graph with clique number r >= 4, if G is L_r-free, every maximum clique dominates V(G).
theorem diamond_free_critical_dominating_clique
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k r : ℕ} (h_noncomplete : G ≠ ⊤)
(h_crit : is_vertex_critical G k)
(h_dfree : is_diamond_free G)
(h_omega : G.cliqueNum = r)
(h_r : 4 ≤ r)
(h_not_l : ¬ SimpleGraph.IsIndContained (l_path_graph r) G) :
∀ Q : Finset V, G.IsNClique r Q → ∀ v : V, v ∉ Q → ∃ u ∈ Q, G.Adj v udiamond_free_critical_k_plus_containedIn LeanGraph Theory & Graph Algorithms
In a noncomplete k-vertex-critical diamond-free graph with clique number r >= 4, G contains an induced K_s^+ for every 3 <= s <= r.
theorem diamond_free_critical_k_plus_contained
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k r : ℕ} (h_noncomplete : G ≠ ⊤)
(h_crit : is_vertex_critical G k)
(h_dfree : is_diamond_free G)
(h_omega : G.cliqueNum = r)
(h_r : 4 ≤ r) :
∀ s, 3 ≤ s → s ≤ r → SimpleGraph.IsIndContained (k_plus_graph s) Gdiamond_free_critical_l_path_containedIn LeanGraph Theory & Graph Algorithms
In a noncomplete k-vertex-critical diamond-free graph with maximum degree k and clique number r >= 4, G contains an induced L_t for every 3 <= t <= r - 1.
theorem diamond_free_critical_l_path_contained
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k r : ℕ} (h_noncomplete : G ≠ ⊤)
(h_crit : is_vertex_critical G k)
(h_dfree : is_diamond_free G)
(h_deg : G.maxDegree = k)
(h_omega : G.cliqueNum = r)
(h_r : 4 ≤ r) :
∀ t, 3 ≤ t → t ≤ r - 1 → SimpleGraph.IsIndContained (l_path_graph t) Gdiamond_free_critical_pendant_pairIn LeanGraph Theory & Graph Algorithms
Let G be a noncomplete k-vertex-critical diamond-free graph with clique number r ≥ 4 and Q a maximum clique of size r. Then some q in Q has a neighbour x outside Q, and x has no other neighbour in Q.
theorem diamond_free_critical_pendant_pair {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k r : ℕ}
(h_noncomplete : G ≠ ⊤) (h_crit : is_vertex_critical G k) (h_dfree : is_diamond_free G)
(h_omega : G.cliqueNum = r) (h_r : 4 ≤ r) {Q : Finset V} (hQ : G.IsNClique r Q) :
∃ q ∈ Q, ∃ x : V, x ∉ Q ∧ G.Adj x q ∧ ∀ q' ∈ Q, G.Adj x q' → q' = qdiamond_free_critical_second_vertexIn LeanGraph Theory & Graph Algorithms
Let G be diamond-free, Q a maximum clique of size at least 3, q in Q and x outside Q adjacent to q. If deg(x) is at least the clique number of G, then x has a neighbour y outside Q that is not adjacent to q.
theorem diamond_free_critical_second_vertex {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (h_dfree : is_diamond_free G)
{Q : Finset V} (hQ : G.IsNClique G.cliqueNum Q) (h3 : 3 ≤ G.cliqueNum)
{q x : V} (hq : q ∈ Q) (hx : x ∉ Q) (hxq : G.Adj x q) (hdeg : G.cliqueNum ≤ G.degree x) :
∃ y : V, G.Adj x y ∧ y ∉ Q ∧ ¬ G.Adj y qdiamond_free_neighborSet_transitiveIn LeanGraph Theory & Graph Algorithms
In a diamond-free graph, if u is adjacent to x, y, and z, and x is adjacent to y, and y is adjacent to z with x ≠ z, then x is adjacent to z.
theorem diamond_free_neighborSet_transitive {V : Type*} [DecidableEq V]
(G : SimpleGraph V) (h_dfree : is_diamond_free G)
{u x y z : V} (hx : G.Adj u x) (hy : G.Adj u y) (hz : G.Adj u z)
(hxy : G.Adj x y) (hyz : G.Adj y z) (hxz : x ≠ z) : G.Adj x zdigraph_128_common_predecessor_indegree_imbalanceIn LeanGraph Theory & Graph Algorithms
In a 7-outregular digraph on 128 vertices whose common-predecessor graph is connected and has no independent set of size four, some vertex has indegree at least eight and another has indegree at most six.
theorem digraph_128_common_predecessor_indegree_imbalance
(D : Digraph (Fin 128)) [DecidableRel D.Adj]
(hreg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card = 7)
(hconn : (digraph_common_predecessor_graph D).Connected)
(hindep : (digraph_common_predecessor_graph D).IndepSetFree 4) :
∃ u v, 8 ≤ (Finset.univ.filter fun w => D.Adj w u).card ∧
(Finset.univ.filter fun w => D.Adj w v).card ≤ 6digraph_18_shared_target_forces_two_cyclesIn LeanGraph Theory & Graph Algorithms
The normalized oriented eighteen-vertex shared-target configuration with three designated parents contains two disjoint cycles, assuming the displayed two-cycle criterion.
theorem digraph_18_shared_target_forces_two_cycles
(D : Digraph (Fin 18)) [DecidableRel D.Adj]
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v : Fin 18, 5 ≤ v.val →
(Finset.univ.filter fun w => D.Adj v w).card = 7)
(hlow : ∀ v : Fin 18, v.val < 5 → D.Adj v 8)
(hout : ∀ v : Fin 18, 9 ≤ v.val → v.val < 16 → D.Adj 8 v)
(hparents : ∀ v : Fin 18, 5 ≤ v.val → v.val < 8 → D.Adj v 8)
(htwo : ∀ T : Finset (Fin 18), T.Nonempty →
(∀ v ∈ T, 3 ≤ (T.filter fun w => D.Adj v w).card) →
∃ c : Fin 2 → Finset (Fin 18), (∀ i, c i ⊆ T ∧ digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))) :
∃ c : Fin 2 → Finset (Fin 18),
(∀ i, digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))digraph_18_target_core_intersectionIn LeanGraph Theory & Graph Algorithms
For a strongly connected sink T of the core containing S, every vertex of which has at least two out-neighbours on S, the vertices K lying on every cycle of T satisfy: S ⊆ K, every vertex of T outside K is missed by a cycle of T, |S| ≤ |T \ K|, and |K ∩ P| + |S| ≤ 5.
theorem digraph_18_target_core_intersection
(D : Digraph (Fin 18)) [DecidableRel D.Adj]
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(T : Finset (Fin 18))
(hTS : digraph_18_target_low_reaching D ⊆ T)
(hTH : T ⊆ digraph_18_target_core)
(hHcore : ∀ C : Finset (Fin 18), C ⊆ digraph_18_target_core → digraph_directed_cycle_on D C →
digraph_18_target_low_reaching D ⊆ C)
(hdisj : Disjoint T (digraph_18_target_middle \ digraph_18_target_low_reaching D))
(hstrong : ∀ u ∈ T, ∀ v ∈ T, ∃ p : List (Fin 18), digraph_is_directed_path D p u v ∧ ∀ z ∈ p, z ∈ T)
(hdeg2 : ∀ s ∈ digraph_18_target_low_reaching D, 2 ≤ (T.filter fun w => D.Adj s w).card) :
∃ K : Finset (Fin 18), K ⊆ T ∧ digraph_18_target_low_reaching D ⊆ K ∧
(∀ C : Finset (Fin 18), C ⊆ T → digraph_directed_cycle_on D C → K ⊆ C) ∧
(∀ x ∈ T, x ∉ K → ∃ C : Finset (Fin 18), C ⊆ T ∧ digraph_directed_cycle_on D C ∧ x ∉ C) ∧
(digraph_18_target_low_reaching D).card ≤ (T \ K).card ∧
(K ∩ digraph_18_target_parents).card + (digraph_18_target_low_reaching D).card ≤ 5digraph_18_target_core_setupIn LeanGraph Theory & Graph Algorithms
In the normalized eighteen-vertex shared-target configuration with no two disjoint directed cycles and S nonempty, there is a nonempty sink strong component T of the core P ∪ R ∪ Z such that S ⊆ T, T is disjoint from R \ S, |S| ≤ 5, every cycle inside P ∪ R ∪ Z contains S, and every s ∈ S has at least two out-neighbours in T.
theorem digraph_18_target_core_setup
(D : Digraph (Fin 18)) [DecidableRel D.Adj]
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v : Fin 18, 5 ≤ v.val → (Finset.univ.filter fun w => D.Adj v w).card = 7)
(hlow : ∀ v : Fin 18, v.val < 5 → D.Adj v 8)
(hout : ∀ v : Fin 18, 9 ≤ v.val → v.val < 16 → D.Adj 8 v)
(hSne : (digraph_18_target_low_reaching D).Nonempty)
(hno : ¬ ∃ c : Fin 2 → Finset (Fin 18), (∀ i, digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))) :
∃ T : Finset (Fin 18), T.Nonempty ∧
digraph_18_target_low_reaching D ⊆ T ∧
T ⊆ digraph_18_target_core ∧
(∀ x ∈ T, ∀ y : Fin 18, y ∈ digraph_18_target_core → D.Adj x y → y ∈ T) ∧
(∀ u ∈ T, ∀ v ∈ T, ∃ p : List (Fin 18), digraph_is_directed_path D p u v ∧ ∀ z ∈ p, z ∈ T) ∧
(∀ C : Finset (Fin 18), C ⊆ digraph_18_target_core → digraph_directed_cycle_on D C →
digraph_18_target_low_reaching D ⊆ C) ∧
Disjoint T (digraph_18_target_middle \ digraph_18_target_low_reaching D) ∧
(digraph_18_target_low_reaching D).card ≤ 5 ∧
(∀ s ∈ digraph_18_target_low_reaching D, 2 ≤ (T.filter fun w => D.Adj s w).card)digraph_18_target_final_contradictionIn LeanGraph Theory & Graph Algorithms
Assume no two disjoint cycles, let T be a sink strong component of the core with S ⊆ T and every cycle of the core containing S, let r be outside T, and suppose every spare vertex is missed by a cycle of T and T = S ∪ P ∪ Z. If r lies in R \ S and sends an arc to every spare vertex, we get a contradiction.
theorem digraph_18_target_final_contradiction
(D : Digraph (Fin 18)) [DecidableRel D.Adj]
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v : Fin 18, 5 ≤ v.val → (Finset.univ.filter fun w => D.Adj v w).card = 7)
(hlow : ∀ v : Fin 18, v.val < 5 → D.Adj v 8)
(hout : ∀ v : Fin 18, 9 ≤ v.val → v.val < 16 → D.Adj 8 v)
(hno : ¬ ∃ c : Fin 2 → Finset (Fin 18), (∀ i, digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j)))
(T : Finset (Fin 18)) (r : Fin 18)
(hTH : T ⊆ digraph_18_target_core)
(hTsink : ∀ x ∈ T, ∀ y : Fin 18, y ∈ digraph_18_target_core → D.Adj x y → y ∈ T)
(hTS : digraph_18_target_low_reaching D ⊆ T)
(hHcore : ∀ C : Finset (Fin 18), C ⊆ digraph_18_target_core → digraph_directed_cycle_on D C →
digraph_18_target_low_reaching D ⊆ C)
(hstrong : ∀ u ∈ T, ∀ v ∈ T, ∃ p : List (Fin 18), digraph_is_directed_path D p u v ∧ ∀ z ∈ p, z ∈ T)
(hsplit : T = digraph_18_target_low_reaching D ∪ digraph_18_target_parents ∪ digraph_18_target_spare)
(hrR : r ∈ digraph_18_target_middle)
(hrS : r ∉ digraph_18_target_low_reaching D)
(hrT : r ∉ T)
(hrZ : ∀ z ∈ digraph_18_target_spare, D.Adj r z)
(homit : ∀ z ∈ digraph_18_target_spare, ∃ C : Finset (Fin 18), C ⊆ T ∧ digraph_directed_cycle_on D C ∧ z ∉ C) :
Falsedigraph_18_target_low_reaching_nonemptyIn LeanGraph Theory & Graph Algorithms
In the normalized eighteen-vertex shared-target configuration (no digons, seven out-neighbours for every vertex of value at least 5, the shared target 8 receiving from 5,6,7 and sending to 9,…,15), if there are no two disjoint directed cycles then the set S of middle vertices 9,…,15 that reach one of the low vertices 0,…,4 is nonempty.
theorem digraph_18_target_low_reaching_nonempty
(D : Digraph (Fin 18)) [DecidableRel D.Adj]
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v : Fin 18, 5 ≤ v.val → (Finset.univ.filter fun w => D.Adj v w).card = 7)
(hout : ∀ v : Fin 18, 9 ≤ v.val → v.val < 16 → D.Adj 8 v)
(hparents : ∀ v : Fin 18, 5 ≤ v.val → v.val < 8 → D.Adj v 8)
(htwo : ∀ T : Finset (Fin 18), T.Nonempty →
(∀ v ∈ T, 3 ≤ (T.filter fun w => D.Adj v w).card) →
∃ c : Fin 2 → Finset (Fin 18), (∀ i, c i ⊆ T ∧ digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j)))
(hno : ¬ ∃ c : Fin 2 → Finset (Fin 18), (∀ i, digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))) :
(digraph_18_target_low_reaching D).Nonemptydigraph_18_target_sink_dominatesIn LeanGraph Theory & Graph Algorithms
Given the sink strong component T with S ⊆ T and T disjoint from R \ S, the middle vertices outside S contain a vertex r, outside T, that sends an arc to every vertex of S and of Z; moreover Z ⊆ T and T = S ∪ P ∪ Z.
theorem digraph_18_target_sink_dominates
(D : Digraph (Fin 18)) [DecidableRel D.Adj]
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v : Fin 18, 5 ≤ v.val → (Finset.univ.filter fun w => D.Adj v w).card = 7)
(hout : ∀ v : Fin 18, 9 ≤ v.val → v.val < 16 → D.Adj 8 v)
(hparents : ∀ v : Fin 18, 5 ≤ v.val → v.val < 8 → D.Adj v 8)
(hno : ¬ ∃ c : Fin 2 → Finset (Fin 18), (∀ i, digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j)))
(hSne : (digraph_18_target_low_reaching D).Nonempty)
(T K : Finset (Fin 18))
(hTS : digraph_18_target_low_reaching D ⊆ T)
(hTH : T ⊆ digraph_18_target_core)
(hdisj : Disjoint T (digraph_18_target_middle \ digraph_18_target_low_reaching D))
(hSK : digraph_18_target_low_reaching D ⊆ K)
(hKT : K ⊆ T)
(homit : ∀ x ∈ T, x ∉ K → ∃ C : Finset (Fin 18), C ⊆ T ∧ digraph_directed_cycle_on D C ∧ x ∉ C)
(hSle : (digraph_18_target_low_reaching D).card ≤ (T \ K).card)
(hbound : (K ∩ digraph_18_target_parents).card + (digraph_18_target_low_reaching D).card ≤ 5) :
∃ r : Fin 18, r ∈ digraph_18_target_middle ∧ r ∉ digraph_18_target_low_reaching D ∧ r ∉ T ∧
(∀ z ∈ digraph_18_target_spare, D.Adj r z) ∧
digraph_18_target_spare ⊆ T ∧
(∀ z ∈ digraph_18_target_spare, ∃ C : Finset (Fin 18), C ⊆ T ∧ digraph_directed_cycle_on D C ∧ z ∉ C) ∧
T = digraph_18_target_low_reaching D ∪ digraph_18_target_parents ∪ digraph_18_target_sparedigraph_alternating_orientation_arborescence_count_eqIn LeanGraph Theory & Graph Algorithms
Any two alternating orientations of a connected simple graph for the same rotation system σ have the same number of spanning arborescences directed towards any root r.
theorem digraph_alternating_orientation_arborescence_count_eq {n : ℕ} (G : SimpleGraph (Fin n))
[DecidableRel G.Adj] (hG : G.Connected) (σ : Equiv.Perm G.Dart)
(hσ : simple_graph_is_rotation_system G σ)
(D₁ D₂ : Digraph (Fin n)) [DecidableRel D₁.Adj] [DecidableRel D₂.Adj]
(h₁ : digraph_is_alternating_orientation G σ D₁)
(h₂ : digraph_is_alternating_orientation G σ D₂) (r : Fin n) :
digraph_arborescence_count_at D₁ r = digraph_arborescence_count_at D₂ rdigraph_arborescence_count_at_eq_det_laplacian_minorIn LeanGraph Theory & Graph Algorithms
The directed matrix-tree theorem: for any loopless digraph D on Fin n and root r, the principal cofactor (determinant of the submatrix deleting row and column r) of the out-degree Laplacian equals the number of spanning arborescences directed towards r.
theorem digraph_arborescence_count_at_eq_det_laplacian_minor {n : ℕ}
(D : Digraph (Fin n)) [DecidableRel D.Adj] (r : Fin n) (hloop : ∀ v, ¬ D.Adj v v) :
(Matrix.of fun (i j : {i : Fin n // i ≠ r}) => digraph_out_laplacian D i.val j.val).det =
(digraph_arborescence_count_at D r : ℝ)digraph_arborescence_count_at_inst_irrelIn LeanGraph Theory & Graph Algorithms
The number of spanning arborescences of D directed towards r is independent of which DecidableRel D.Adj instance is used to compute it.
theorem digraph_arborescence_count_at_inst_irrel {n : ℕ} (D : Digraph (Fin n))
(i j : DecidableRel D.Adj) (r : Fin n) :
@digraph_arborescence_count_at n D i r = @digraph_arborescence_count_at n D j rdigraph_arborescence_count_at_reverse_of_eulerianIn LeanGraph Theory & Graph Algorithms
For an Eulerian digraph D on Fin n, reversing every arc does not change the number of spanning arborescences directed towards r.
theorem digraph_arborescence_count_at_reverse_of_eulerian {n : ℕ} (G : SimpleGraph (Fin n))
(D : Digraph (Fin n)) [DecidableRel D.Adj]
(hD : digraph_is_eulerian_orientation G D) (r : Fin n) :
@digraph_arborescence_count_at n ⟨fun u v => D.Adj v u⟩
(fun u v => inferInstanceAs (Decidable (D.Adj v u))) r =
digraph_arborescence_count_at D rdigraph_both_cuts_ge_ceil_div_six_of_indegree_ltIn LeanGraph Theory & Graph Algorithms
Case 2 of the proof of Theorem 1.4: if G is a loopless digraph with m arcs, minimum outdegree at least 2, and every in-degree below m/3 + 1, then some set A has e(A, V∖A) ≥ ⌈m/6⌉ and e(V∖A, A) ≥ ⌈m/6⌉.
theorem digraph_both_cuts_ge_ceil_div_six_of_indegree_lt {V : Type*} [Fintype V]
[DecidableEq V] (G : Digraph V) [DecidableRel G.Adj] (hloop : ∀ v, ¬ G.Adj v v)
(hdeg : ∀ v, 2 ≤ (Finset.univ.filter (G.Adj v)).card)
(hin : ∀ v, ((Finset.univ.filter fun u => G.Adj u v).card : ℚ) <
(digraph_edge_count G : ℚ) / 3 + 1) :
∃ A : Finset V, ⌈(digraph_edge_count G : ℚ) / 6⌉₊ ≤ digraph_cut_count G A Aᶜ ∧
⌈(digraph_edge_count G : ℚ) / 6⌉₊ ≤ digraph_cut_count G Aᶜ Adigraph_ckk_subdivision_of_two_paths_and_back_arcIn LeanGraph Theory & Graph Algorithms
If D has digirth at least 2*(k-1)+1 and contains two internally disjoint directed paths from u to v plus an arc from v to u, then D contains a subdivision of C(k,k).
open Classical in
theorem digraph_ckk_subdivision_of_two_paths_and_back_arc
{V : Type*} (D : Digraph V) (k : ℕ) (hk : 2 ≤ k)
(hgirth : digraph_has_digirth_ge D (2 * (k - 1) + 1))
(u v : V) (huv : u ≠ v)
(p₁ p₂ : List V)
(hp₁ : digraph_is_directed_path D p₁ u v)
(hp₂ : digraph_is_directed_path D p₂ u v)
(hdisj : ∀ w ∈ p₁, w ∈ p₂ → w = u ∨ w = v)
(hback : D.Adj v u) :
digraph_has_ckk_subdivision D kdigraph_ckk_subdivision_three_exceptionalNeeds helpGraph Theory & Graph Algorithms
Let k ≥ 2. Every finite loopless directed graph D with minimum out-degree at least 1, at most 3 vertices of out-degree 1, and digirth at least 3*(k-1)+1 contains a subdivision of the two-block cycle C(k,k).
open Classical in
theorem digraph_ckk_subdivision_three_exceptional
{V : Type*} [Fintype V] (D : Digraph V) [DecidableRel D.Adj]
(hloop : ∀ v : V, ¬ D.Adj v v)
(k : ℕ) (hk : 2 ≤ k)
(hmin : ∀ v : V, 1 ≤ digraph_out_degree D v)
(hexc : (digraph_exceptional_verts D).card ≤ 3)
(hgirth : digraph_has_digirth_ge D (3 * (k - 1) + 1)) :
digraph_has_ckk_subdivision D kdigraph_ckk_subdivision_three_exceptional_nonemptyIn LeanGraph Theory & Graph Algorithms
Let k ≥ 2. Every finite NONEMPTY loopless directed graph D with minimum out-degree at least 1, at most 3 vertices of out-degree 1, and digirth at least 3*(k-1)+1 contains a subdivision of the two-block cycle C(k,k). This is the faithful form of digraph_ckk_subdivision_three_exceptional (which is refuted by the empty digraph, see not_digraph_ckk_subdivision_three_exceptional): arXiv:2611.00720 works throughout with finite nonempty digraphs, and its Problem 4.1 asks for F_3(k), left open there (Theorem 1.1 covers only r ≥ 4).
open Classical in
theorem digraph_ckk_subdivision_three_exceptional_nonempty
{V : Type*} [Fintype V] [Nonempty V] (D : Digraph V) [DecidableRel D.Adj]
(hloop : ∀ v : V, ¬ D.Adj v v)
(k : ℕ) (hk : 2 ≤ k)
(hmin : ∀ v : V, 1 ≤ digraph_out_degree D v)
(hexc : (digraph_exceptional_verts D).card ≤ 3)
(hgirth : digraph_has_digirth_ge D (3 * (k - 1) + 1)) :
digraph_has_ckk_subdivision D kdigraph_ckk_subdivision_two_exceptionalIn LeanGraph Theory & Graph Algorithms
Let k ≥ 2. Every finite loopless directed graph D with minimum out-degree at least 1, at most 2 vertices of out-degree 1, and digirth at least 2*(k-1)+1 contains a subdivision of the two-block cycle C(k,k).
open Classical in
theorem digraph_ckk_subdivision_two_exceptional
{V : Type*} [Fintype V] (D : Digraph V) [DecidableRel D.Adj]
(hloop : ∀ v : V, ¬ D.Adj v v)
(k : ℕ) (hk : 2 ≤ k)
(hmin : ∀ v : V, 1 ≤ digraph_out_degree D v)
(hexc : (digraph_exceptional_verts D).card ≤ 2)
(hgirth : digraph_has_digirth_ge D (2 * (k - 1) + 1)) :
digraph_has_ckk_subdivision D kdigraph_ckk_subdivision_two_exceptional_exactIn LeanGraph Theory & Graph Algorithms
Let k ≥ 2. Every finite loopless directed graph D with minimum out-degree at least 1, exactly 2 vertices of out-degree 1, and digirth at least 2*(k-1)+1 contains a subdivision of the two-block cycle C(k,k).
open Classical in
theorem digraph_ckk_subdivision_two_exceptional_exact
{V : Type*} [Fintype V] (D : Digraph V) [DecidableRel D.Adj]
(hloop : ∀ v : V, ¬ D.Adj v v)
(k : ℕ) (hk : 2 ≤ k)
(hmin : ∀ v : V, 1 ≤ digraph_out_degree D v)
(hexc : (digraph_exceptional_verts D).card = 2)
(hgirth : digraph_has_digirth_ge D (2 * (k - 1) + 1)) :
digraph_has_ckk_subdivision D kdigraph_common_predecessor_degree_le_six_indegreeIn LeanGraph Theory & Graph Algorithms
If every outdegree is at most seven, the degree of a vertex in the common-predecessor graph is at most six times its indegree in the digraph.
theorem digraph_common_predecessor_degree_le_six_indegree
(α : Type) [Fintype α] [DecidableEq α]
(D : Digraph α) [DecidableRel D.Adj]
(hdeg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card ≤ 7)
(v : α) :
(digraph_common_predecessor_graph D).degree v ≤
6 * (Finset.univ.filter fun w => D.Adj w v).carddigraph_common_predecessor_large_independence_three_indegree_fiveIn LeanGraph Theory & Graph Algorithms
A 7-outregular finite digraph on at least 126 vertices whose common-predecessor graph has independence number at most three has minimum indegree at least five.
theorem digraph_common_predecessor_large_independence_three_indegree_five
(α : Type) [Fintype α] [DecidableEq α] (D : Digraph α) [DecidableRel D.Adj]
(hsize : 126 ≤ Fintype.card α)
(hreg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card = 7)
(hindep : (digraph_common_predecessor_graph D).IndepSetFree 4) :
∀ v, 5 ≤ (Finset.univ.filter fun w => D.Adj w v).carddigraph_common_predecessor_large_independence_three_indegree_fourIn LeanGraph Theory & Graph Algorithms
A 7-outregular finite digraph on at least 121 vertices whose common-predecessor graph has independence number at most three has minimum indegree at least four.
theorem digraph_common_predecessor_large_independence_three_indegree_four
(α : Type) [Fintype α] [DecidableEq α] (D : Digraph α) [DecidableRel D.Adj]
(hsize : 121 ≤ Fintype.card α)
(hreg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card = 7)
(hindep : (digraph_common_predecessor_graph D).IndepSetFree 4) :
∀ v, 4 ≤ (Finset.univ.filter fun w => D.Adj w v).carddigraph_cut_imbalance_eq_sum_net_degreeIn LeanGraph Theory & Graph Algorithms
For any finite digraph G and any vertex subset A, the directed cut count e(A, Aᶜ) minus e(Aᶜ, A) in ℚ equals the sum over v ∈ A of the net degree d⁺(v) - d⁻(v).
theorem digraph_cut_imbalance_eq_sum_net_degree {V : Type*} [Fintype V]
[DecidableEq V] (G : Digraph V) [DecidableRel G.Adj] (A : Finset V) :
((digraph_cut_count G A Aᶜ : ℚ) - (digraph_cut_count G Aᶜ A : ℚ)) =
∑ v ∈ A, (((Finset.univ.filter (G.Adj v)).card : ℚ) -
((Finset.univ.filter (fun u => G.Adj u v)).card : ℚ))digraph_cyclic_partition_cross_arc_lower_boundIn LeanGraph Theory & Graph Algorithms
Suppose the vertices of a finite digraph of minimum outdegree at least r are partitioned into s cyclic parts, each with at least three vertices sending arcs outside. If there are no s+1 disjoint directed cycles and the robust two-cycle condition holds for induced parts, then at least s(r+1) arcs cross the partition.
theorem digraph_cyclic_partition_cross_arc_lower_bound
(α : Type) [Fintype α] [DecidableEq α] (D : Digraph α) [DecidableRel D.Adj]
(r s : ℕ) (hr : 4 ≤ r) (col : α → Fin s)
(hdeg : ∀ v, r ≤ (Finset.univ.filter fun w => D.Adj v w).card)
(hrobust : ∀ T : Finset α, T.Nonempty →
(∀ v ∈ T, 2 ≤ (T.filter fun w => D.Adj v w).card) →
(T.filter fun v => (T.filter fun w => D.Adj v w).card < 3).card ≤ 2 →
∃ c : Fin 2 → Finset α, (∀ i, c i ⊆ T ∧ digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j)))
(hcycles : ∀ i, ∃ C : Finset α,
C ⊆ (Finset.univ.filter fun v => col v = i) ∧ digraph_directed_cycle_on D C)
(htails : ∀ i, 3 ≤ ((Finset.univ.filter fun v => col v = i).filter fun v =>
∃ w, col w ≠ i ∧ D.Adj v w).card)
(hno : ¬ ∃ c : Fin (s + 1) → Finset α,
(∀ i, digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))) :
s * (r + 1) ≤ ∑ v : α, (Finset.univ.filter fun w => col w ≠ col v ∧ D.Adj v w).carddigraph_digirth_le_cardIn LeanGraph Theory & Graph Algorithms
If D is a finite nonempty loopless digraph with minimum out-degree at least 1 and digirth at least g, then g ≤ |V|.
theorem digraph_digirth_le_card {V : Type*} [Fintype V] [Nonempty V] (D : Digraph V) [DecidableRel D.Adj]
(hloop : ∀ v : V, ¬ D.Adj v v) (hmin : ∀ v : V, 1 ≤ digraph_out_degree D v)
(g : ℕ) (hg : digraph_has_digirth_ge D g) : g ≤ Fintype.card Vdigraph_exists_bipartition_weight_discrepancy_and_cut_ge_halfIn LeanGraph Theory & Graph Algorithms
For any finite digraph H and any non-negative vertex weights w bounded by M, there exists a vertex subset S whose weight discrepancy is at most M and whose crossing cut count in H is at least |E(H)|/2.
theorem digraph_exists_bipartition_weight_discrepancy_and_cut_ge_half
{V : Type*} [Fintype V] [DecidableEq V]
(H : Digraph V) [DecidableRel H.Adj]
(w : V → ℚ) (M : ℚ) (hw_nonneg : ∀ v, 0 ≤ w v) (hw_le : ∀ v, w v ≤ M) :
∃ S : Finset V,
|∑ v ∈ S, w v - ∑ v ∈ Sᶜ, w v| ≤ M ∧
(digraph_edge_count H : ℚ) ≤ 2 * ((digraph_cut_count H S Sᶜ : ℚ) + digraph_cut_count H Sᶜ S)digraph_exists_directed_cycleIn LeanGraph Theory & Graph Algorithms
Every finite nonempty loopless digraph with minimum out-degree at least 1 contains a directed cycle: a list c of distinct vertices with 2 ≤ c.length forming a directed chain from its head u to its last vertex v, together with the closing arc v → u.
theorem digraph_exists_directed_cycle {V : Type*} [Fintype V] [Nonempty V] (D : Digraph V) [DecidableRel D.Adj]
(hloop : ∀ v : V, ¬ D.Adj v v) (hmin : ∀ v : V, 1 ≤ digraph_out_degree D v) :
∃ c : List V, c.Nodup ∧ 2 ≤ c.length ∧ c.IsChain D.Adj ∧
∃ u v : V, c.head? = some u ∧ c.getLast? = some v ∧ D.Adj v udigraph_exists_min_quasi_kernelIn LeanGraph Theory & Graph Algorithms
Every finite digraph has a quasi-kernel of minimum cardinality: among all quasi-kernels, one has cardinality no larger than any other.
theorem digraph_exists_min_quasi_kernel (α : Type) [Fintype α] [DecidableEq α]
(D : Digraph α) [DecidableRel D.Adj] :
∃ Q : Finset α, digraph_is_quasi_kernel D Q ∧
∀ Q' : Finset α, digraph_is_quasi_kernel D Q' → Q.card ≤ Q'.carddigraph_exists_two_partitions_crossing_ge_and_imbalance_leIn LeanGraph Theory & Graph Algorithms
In any finite loopless digraph with minimum outdegree at least 2 and every indegree strictly below m/3 + 1, there exist two vertex subsets A₀ and A₁ with combined crossing cut count at least m and combined cut imbalance at most m/3.
theorem digraph_exists_two_partitions_crossing_ge_and_imbalance_le {V : Type*} [Fintype V]
[DecidableEq V] (G : Digraph V) [DecidableRel G.Adj] (hloop : ∀ v, ¬ G.Adj v v)
(hdeg : ∀ v, 2 ≤ (Finset.univ.filter (G.Adj v)).card)
(hin : ∀ v, ((Finset.univ.filter fun u => G.Adj u v).card : ℚ) <
(digraph_edge_count G : ℚ) / 3 + 1) :
∃ A₀ A₁ : Finset V,
(digraph_edge_count G : ℚ) ≤
(digraph_cut_count G A₀ A₀ᶜ : ℚ) + digraph_cut_count G A₀ᶜ A₀ +
digraph_cut_count G A₁ A₁ᶜ + digraph_cut_count G A₁ᶜ A₁ ∧
|(digraph_cut_count G A₀ A₀ᶜ : ℚ) - digraph_cut_count G A₀ᶜ A₀| +
|(digraph_cut_count G A₁ A₁ᶜ : ℚ) - digraph_cut_count G A₁ᶜ A₁| ≤
(digraph_edge_count G : ℚ) / 3digraph_flip_by_matrix_addIn LeanGraph Theory & Graph Algorithms
Flipping a digraph successively by two symmetric F₂-matrices P and Q (reversing every arc uv with P_uv = 1, then every arc uv with Q_uv = 1) is the same as flipping it once by P + Q.
theorem digraph_flip_by_matrix_add {V : Type} (D : Digraph V) (P Q : Matrix V V (ZMod 2))
(hP : P.IsSymm) (hQ : Q.IsSymm) :
digraph_flip_by_matrix (digraph_flip_by_matrix D P) Q = digraph_flip_by_matrix D (P + Q)digraph_flip_by_matrix_gram_columnsIn LeanGraph Theory & Graph Algorithms
Flipping a digraph by the Gram matrix S Sᵀ of a matrix S with t columns over F₂ is the same as successively inverting the t vertex sets {v | S v i = 1} (support of the i-th column), in the order i = 0, …, t−1.
theorem digraph_flip_by_matrix_gram_columns {V : Type} [Fintype V] (D : Digraph V) {t : ℕ}
(S : Matrix V (Fin t) (ZMod 2)) :
digraph_flip_by_matrix D (S * S.transpose) =
(List.ofFn fun i : Fin t => {v : V | S v i = 1}).foldl digraph_invert Ddigraph_four_strong_semicomplete_multipartite_nonadjacent_different_parts_linkedIn LeanGraph Theory & Graph Algorithms
In a 4-strong semicomplete multipartite digraph on at least 9 vertices, if non-adjacent pairs {s₁, t₁} and {s₂, t₂} lie in distinct independent parts, then unilateral 2-linkage exists.
theorem digraph_four_strong_semicomplete_multipartite_nonadjacent_different_parts_linked
{V : Type*} [Fintype V] (D : Digraph V)
(hcard : 9 ≤ Fintype.card V)
(hstrong : digraph_is_k_strong D 4)
(hmulti : digraph_is_semicomplete_multipartite D)
{s₁ t₁ s₂ t₂ : V} (hnodup : [s₁, t₁, s₂, t₂].Nodup)
(hnonadj1 : ¬ D.Adj s₁ t₁ ∧ ¬ D.Adj t₁ s₁)
(hnonadj2 : ¬ D.Adj s₂ t₂ ∧ ¬ D.Adj t₂ s₂)
(hdiff : D.Adj s₁ s₂ ∨ D.Adj s₂ s₁) :
∃ (p₁ p₂ : List V),
(digraph_is_directed_path D p₁ s₁ t₁ ∨ digraph_is_directed_path D p₁ t₁ s₁) ∧
(digraph_is_directed_path D p₂ s₂ t₂ ∨ digraph_is_directed_path D p₂ t₂ s₂) ∧
p₁.Disjoint p₂digraph_four_strong_semicomplete_multipartite_nonadjacent_pairs_linkedIn LeanGraph Theory & Graph Algorithms
Let D be a 4-strong semicomplete multipartite digraph on at least 9 vertices. If s₁, t₁, s₂, t₂ are pairwise distinct vertices such that neither {s₁, t₁} nor {s₂, t₂} has an arc in either direction, then there exist vertex-disjoint directed paths unilaterally linking {s₁, t₁} and {s₂, t₂}.
theorem digraph_four_strong_semicomplete_multipartite_nonadjacent_pairs_linked
{V : Type*} [Fintype V] (D : Digraph V)
(hcard : 9 ≤ Fintype.card V)
(hstrong : digraph_is_k_strong D 4)
(hmulti : digraph_is_semicomplete_multipartite D)
{s₁ t₁ s₂ t₂ : V} (hnodup : [s₁, t₁, s₂, t₂].Nodup)
(hnonadj1 : ¬ D.Adj s₁ t₁ ∧ ¬ D.Adj t₁ s₁)
(hnonadj2 : ¬ D.Adj s₂ t₂ ∧ ¬ D.Adj t₂ s₂) :
∃ (p₁ p₂ : List V),
(digraph_is_directed_path D p₁ s₁ t₁ ∨ digraph_is_directed_path D p₁ t₁ s₁) ∧
(digraph_is_directed_path D p₂ s₂ t₂ ∨ digraph_is_directed_path D p₂ t₂ s₂) ∧
p₁.Disjoint p₂digraph_four_strong_semicomplete_multipartite_nonadjacent_same_part_linkedIn LeanGraph Theory & Graph Algorithms
In a 4-strong semicomplete multipartite digraph on at least 9 vertices, if non-adjacent pairs {s₁, t₁} and {s₂, t₂} lie in the same independent part, then unilateral 2-linkage exists.
theorem digraph_four_strong_semicomplete_multipartite_nonadjacent_same_part_linked
{V : Type*} [Fintype V] (D : Digraph V)
(hcard : 9 ≤ Fintype.card V)
(hstrong : digraph_is_k_strong D 4)
(hmulti : digraph_is_semicomplete_multipartite D)
{s₁ t₁ s₂ t₂ : V} (hnodup : [s₁, t₁, s₂, t₂].Nodup)
(hnonadj1 : ¬ D.Adj s₁ t₁ ∧ ¬ D.Adj t₁ s₁)
(hnonadj2 : ¬ D.Adj s₂ t₂ ∧ ¬ D.Adj t₂ s₂)
(hsame : ¬ D.Adj s₁ s₂ ∧ ¬ D.Adj s₂ s₁) :
∃ (p₁ p₂ : List V),
(digraph_is_directed_path D p₁ s₁ t₁ ∨ digraph_is_directed_path D p₁ t₁ s₁) ∧
(digraph_is_directed_path D p₂ s₂ t₂ ∨ digraph_is_directed_path D p₂ t₂ s₂) ∧
p₁.Disjoint p₂digraph_four_strong_semicomplete_multipartite_same_part_no_router_linkedIn LeanGraph Theory & Graph Algorithms
In a 4-strong semicomplete multipartite digraph on at least 9 vertices, if non-adjacent pairs {s₁, t₁} and {s₂, t₂} lie in the same independent part and neither pair has a 2-step router, then unilateral 2-linkage exists.
theorem digraph_four_strong_semicomplete_multipartite_same_part_no_router_linked
{V : Type*} [Fintype V] (D : Digraph V)
(hcard : 9 ≤ Fintype.card V)
(hstrong : digraph_is_k_strong D 4)
(hmulti : digraph_is_semicomplete_multipartite D)
{s₁ t₁ s₂ t₂ : V} (hnodup : [s₁, t₁, s₂, t₂].Nodup)
(hnonadj1 : ¬ D.Adj s₁ t₁ ∧ ¬ D.Adj t₁ s₁)
(hnonadj2 : ¬ D.Adj s₂ t₂ ∧ ¬ D.Adj t₂ s₂)
(hsame : ¬ D.Adj s₁ s₂ ∧ ¬ D.Adj s₂ s₁)
(hnr1 : ∀ v ∉ [s₁, t₁, s₂, t₂], ¬ ((D.Adj s₁ v ∧ D.Adj v t₁) ∨ (D.Adj t₁ v ∧ D.Adj v s₁)))
(hnr2 : ∀ v ∉ [s₁, t₁, s₂, t₂], ¬ ((D.Adj s₂ v ∧ D.Adj v t₂) ∨ (D.Adj t₂ v ∧ D.Adj v s₂))) :
∃ (p₁ p₂ : List V),
(digraph_is_directed_path D p₁ s₁ t₁ ∨ digraph_is_directed_path D p₁ t₁ s₁) ∧
(digraph_is_directed_path D p₂ s₂ t₂ ∨ digraph_is_directed_path D p₂ t₂ s₂) ∧
p₁.Disjoint p₂digraph_functional_no_ckk_subdivisionIn LeanGraph Theory & Graph Algorithms
If D is loopless, finite, and every vertex has out-degree exactly 1, then for every k ≥ 2 the digraph D contains no subdivision of C(k,k) (in particular the hypothesis "at most 3 exceptional vertices" in the target cannot be dropped: a directed cycle has arbitrarily large digirth and no C(k,k) subdivision).
theorem digraph_functional_no_ckk_subdivision {V : Type*} [Fintype V] (D : Digraph V) [DecidableRel D.Adj]
(hloop : ∀ v : V, ¬ D.Adj v v) (hfun : ∀ v : V, digraph_out_degree D v = 1)
(k : ℕ) (hk : 2 ≤ k) : ¬ digraph_has_ckk_subdivision D kdigraph_has_ckk_subdivision_of_arcs_subsetIn LeanGraph Theory & Graph Algorithms
If every arc of D' is an arc of D and D' contains a subdivision of C(k,k), then D contains a subdivision of C(k,k).
theorem digraph_has_ckk_subdivision_of_arcs_subset {V : Type*} {D D' : Digraph V} {k : ℕ}
(hle : ∀ a b : V, D'.Adj a b → D.Adj a b) (h : digraph_has_ckk_subdivision D' k) :
digraph_has_ckk_subdivision D kdigraph_has_digirth_ge_monoIn LeanGraph Theory & Graph Algorithms
Digirth bound is monotonic: if D has digirth at least g and g' ≤ g, then D has digirth at least g'.
theorem digraph_has_digirth_ge_mono {V : Type*} (D : Digraph V) {g g' : ℕ}
(hg : digraph_has_digirth_ge D g) (hle : g' ≤ g) :
digraph_has_digirth_ge D g'digraph_has_digirth_ge_of_arcs_subsetIn LeanGraph Theory & Graph Algorithms
If every arc of D' is an arc of D and D has digirth at least g, then D' has digirth at least g.
theorem digraph_has_digirth_ge_of_arcs_subset {V : Type*} {D D' : Digraph V} {g : ℕ}
(hle : ∀ a b : V, D'.Adj a b → D.Adj a b) (h : digraph_has_digirth_ge D g) :
digraph_has_digirth_ge D' gdigraph_invert_eq_flip_by_matrix_indicatorIn LeanGraph Theory & Graph Algorithms
Inverting a vertex set X in a digraph coincides with flipping it by the rank-one matrix (indicator of X)(indicator of X)ᵀ.
theorem digraph_invert_eq_flip_by_matrix_indicator {V : Type} (D : Digraph V) (X : Set V) :
digraph_invert D X = digraph_flip_by_matrix D
(Matrix.of fun x y =>
Set.indicator X (fun _ => (1 : ZMod 2)) x * Set.indicator X (fun _ => (1 : ZMod 2)) y)digraph_is_directed_path_pair_of_adjIn LeanGraph Theory & Graph Algorithms
If u → v is an arc of D and u ≠ v, then the two-element list [u, v] is a directed path from u to v.
theorem digraph_is_directed_path_pair_of_adj {V : Type*} (D : Digraph V) {u v : V}
(h : D.Adj u v) (huv : u ≠ v) : digraph_is_directed_path D [u, v] u vdigraph_is_directed_path_triple_of_adjIn LeanGraph Theory & Graph Algorithms
Two consecutive arcs s → a → t, with s, a, t pairwise distinct, make [s, a, t] a directed path from s to t.
theorem digraph_is_directed_path_triple_of_adj {V : Type*} (D : Digraph V) {s a t : V}
(h₁ : D.Adj s a) (h₂ : D.Adj a t) (hsa : s ≠ a) (hat : a ≠ t) (hst : s ≠ t) :
digraph_is_directed_path D [s, a, t] s tdigraph_is_quasi_kernel_iffIn LeanGraph Theory & Graph Algorithms
Q is a quasi-kernel of D if and only if Q is independent (no arc between distinct members in either direction) and every vertex is 2-dominated by Q.
theorem digraph_is_quasi_kernel_iff {α : Type*} (D : Digraph α) (Q : Finset α) :
digraph_is_quasi_kernel D Q ↔
(∀ u ∈ Q, ∀ v ∈ Q, u ≠ v → ¬ D.Adj u v) ∧ ∀ v, digraph_two_dominated D Q vdigraph_laplacian_decomp_sumIn LeanGraph Theory & Graph Algorithms
The shifted out-degree Laplacian s·L_D + α·J of a loopless digraph D decomposes as ∑_k A_k where each row i of A_k has out-arc contribution s*(e_i - e_k) when k is an out-neighbour, plus α on row k = i.
theorem digraph_laplacian_decomp_sum {n : ℕ} (D : Digraph (Fin n)) [DecidableRel D.Adj] (hloop : ∀ v, ¬ D.Adj v v) (s α : ℝ) : s • digraph_out_laplacian D + α • Matrix.of (fun _ _ : Fin n => (1 : ℝ)) = ∑ k : Fin n, Matrix.of (fun i j : Fin n => (if D.Adj i k then s * ((if i = j then (1 : ℝ) else 0) - (if k = j then 1 else 0)) else 0) + (if k = i then α else 0))digraph_laplacian_det_smul_add_onesIn LeanGraph Theory & Graph Algorithms
For a loopless digraph D on Fin n with n ≥ 1 and real numbers s and α, det(s·L_D + α·J) = n·α·s^{n-1}·τ(D), where L_D is the out-degree Laplacian, J is the all-ones matrix and τ(D) is the total number of spanning arborescences.
theorem digraph_laplacian_det_smul_add_ones {n : ℕ} (hn : 1 ≤ n) (D : Digraph (Fin n)) [DecidableRel D.Adj] (hloop : ∀ v, ¬ D.Adj v v) (s α : ℝ) : (s • digraph_out_laplacian D + α • Matrix.of (fun _ _ : Fin n => (1 : ℝ))).det = (n : ℝ) * α * s ^ (n - 1) * (digraph_arborescence_count D : ℝ)digraph_large_common_predecessor_indegree_imbalanceIn LeanGraph Theory & Graph Algorithms
In a 7-outregular digraph on at least 122 vertices whose common-predecessor graph is connected and has no independent set of size four, some vertex has indegree at least eight and another has indegree at most six.
theorem digraph_large_common_predecessor_indegree_imbalance
(n : ℕ) (hn : 122 ≤ n) (D : Digraph (Fin n)) [DecidableRel D.Adj]
(hreg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card = 7)
(hconn : (digraph_common_predecessor_graph D).Connected)
(hindep : (digraph_common_predecessor_graph D).IndepSetFree 4) :
∃ u v, 8 ≤ (Finset.univ.filter fun w => D.Adj w u).card ∧
(Finset.univ.filter fun w => D.Adj w v).card ≤ 6digraph_mem_exceptional_verts_iffIn LeanGraph Theory & Graph Algorithms
A vertex v of a finite digraph D is exceptional (lies in O(D)) if and only if its out-degree is exactly 1.
theorem digraph_mem_exceptional_verts_iff {V : Type*} [Fintype V] (D : Digraph V) [DecidableRel D.Adj]
(v : V) : v ∈ digraph_exceptional_verts D ↔ digraph_out_degree D v = 1digraph_min_outdegree_three_two_disjoint_cyclesIn LeanGraph Theory & Graph Algorithms
Every finite nonempty loopless digraph with minimum outdegree at least three contains two vertex-disjoint directed cycles.
theorem digraph_min_outdegree_three_two_disjoint_cycles (α : Type) [Fintype α] [DecidableEq α] [Nonempty α] (D : Digraph α) [DecidableRel D.Adj] (hloop : ∀ v, ¬ D.Adj v v) (hdeg : ∀ v, 3 ≤ (Finset.univ.filter fun w => D.Adj v w).card) : ∃ s : Fin 2 → Finset α, (∀ i, digraph_directed_cycle_on D (s i)) ∧ Pairwise (fun i j => Disjoint (s i) (s j))
digraph_nested_parents_force_overlap_seventyIn LeanGraph Theory & Graph Algorithms
If five distinct vertices form a transitive tournament, all point to q, and at least 8−t other common predecessors point to q and the first t vertices for every 1≤t≤5, then the common-predecessor overlap is at least 70.
theorem digraph_nested_parents_force_overlap_seventy
(α : Type) [Fintype α] [DecidableEq α]
(D : Digraph α) [DecidableRel D.Adj]
(low : Fin 5 → α) (q : α)
(hinj : Function.Injective low) (hq : ∀ i, low i ≠ q)
(htrans : ∀ i j : Fin 5, i.val < j.val → D.Adj (low j) (low i))
(htarget : ∀ i, D.Adj (low i) q)
(hparents : ∀ t : ℕ, 1 ≤ t → t ≤ 5 →
8 - t ≤ (Finset.univ.filter fun p : α => p ≠ q ∧
(∀ i, p ≠ low i) ∧ D.Adj p q ∧
∀ i : Fin 5, i.val < t → D.Adj p (low i)).card) :
70 ≤ (∑ v : α, Nat.choose (Finset.univ.filter fun w => D.Adj v w).card 2) -
(digraph_common_predecessor_graph D).edgeFinset.carddigraph_oriented_degree_profile_13_has_two_cyclesIn LeanGraph Theory & Graph Algorithms
An oriented 13-vertex digraph with outdegrees 1,2,3,4,5 and eight sevens contains two disjoint cycles, assuming the displayed robust two-cycle criterion.
theorem digraph_oriented_degree_profile_13_has_two_cycles
(D : Digraph (Fin 13)) [DecidableRel D.Adj]
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hloop : ∀ u, ¬ D.Adj u u)
(hdeg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card =
if v.val < 5 then v.val + 1 else 7)
(htwo : ∀ T : Finset (Fin 13), T.Nonempty →
(∀ v ∈ T, 2 ≤ (T.filter fun w => D.Adj v w).card) →
(T.filter fun v => (T.filter fun w => D.Adj v w).card < 3).card ≤ 2 →
∃ c : Fin 2 → Finset (Fin 13), (∀ i, c i ⊆ T ∧ digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))) :
∃ c : Fin 2 → Finset (Fin 13),
(∀ i, digraph_directed_cycle_on D (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j))digraph_oriented_general_cut_boundary_cardIn LeanGraph Theory & Graph Algorithms
In digraph_oriented_general_cut_example d with d ≥ 3, the number of outgoing arcs from B to Bᶜ is Nat.choose d 2 - 1.
open Classical in
theorem digraph_oriented_general_cut_boundary_card (d : ℕ) (hd : 3 ≤ d) :
let D := digraph_oriented_general_cut_example d
let B : Finset (Fin (4 * d - 2)) := Finset.univ.filter fun v => v.val < 3 * d - 1
(∑ v ∈ B, (Bᶜ.filter fun w => D.Adj v w).card) = Nat.choose d 2 - 1digraph_oriented_general_cut_no_two_cyclesIn LeanGraph Theory & Graph Algorithms
For d ≥ 3, digraph_oriented_general_cut_example d contains no two vertex-disjoint directed cycles.
open Classical in
theorem digraph_oriented_general_cut_no_two_cycles (d : ℕ) (hd : 3 ≤ d) :
let D := digraph_oriented_general_cut_example d
¬ ∃ c : Fin 2 → Finset (Fin (4 * d - 2)),
(∀ i, digraph_directed_cycle_on D (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j))digraph_oriented_general_cut_orientationIn LeanGraph Theory & Graph Algorithms
For any d ≥ 3, the parametric digraph digraph_oriented_general_cut_example d is oriented.
theorem digraph_oriented_general_cut_orientation (d : ℕ) (hd : 3 ≤ d) (u v : Fin (4 * d - 2)) :
(digraph_oriented_general_cut_example d).Adj u v → ¬ (digraph_oriented_general_cut_example d).Adj v udigraph_oriented_general_cut_part_outdegreeIn LeanGraph Theory & Graph Algorithms
In digraph_oriented_general_cut_example d with d ≥ 3, the set B of vertices with index < 3d - 1 has size at least d and every vertex in B has outdegree d.
open Classical in
theorem digraph_oriented_general_cut_part_outdegree (d : ℕ) (hd : 3 ≤ d) :
let D := digraph_oriented_general_cut_example d
let B : Finset (Fin (4 * d - 2)) := Finset.univ.filter fun v => v.val < 3 * d - 1
d ≤ B.card ∧ ∀ v ∈ B, (Finset.univ.filter fun w => D.Adj v w).card = ddigraph_oriented_general_cut_robustIn LeanGraph Theory & Graph Algorithms
In digraph_oriented_general_cut_example d with d ≥ 3, any nonempty induced subset T of minimum outdegree at least 2 contains at least three vertices of induced outdegree 2.
open Classical in
theorem digraph_oriented_general_cut_robust (d : ℕ) (hd : 3 ≤ d) :
let D := digraph_oriented_general_cut_example d
∀ T : Finset (Fin (4 * d - 2)), T.Nonempty →
(∀ v ∈ T, 2 ≤ (T.filter fun w => D.Adj v w).card) →
3 ≤ (T.filter fun v => (T.filter fun w => D.Adj v w).card < 3).carddigraph_oriented_general_cut_sharpIn LeanGraph Theory & Graph Algorithms
For each d at least three, the parametric example is oriented, has a d-outregular part of size 3d−1 with choose(d,2)−1 outgoing arcs, has no two disjoint cycles, and satisfies the displayed robust two-cycle premise.
theorem digraph_oriented_general_cut_sharp
(d : ℕ) (hd : 3 ≤ d) :
let D := digraph_oriented_general_cut_example d
let B : Finset (Fin (4 * d - 2)) := Finset.univ.filter fun v => v.val < 3 * d - 1
(∀ u v, D.Adj u v → ¬ D.Adj v u) ∧ d ≤ B.card ∧
(∀ v ∈ B, (Finset.univ.filter fun w => D.Adj v w).card = d) ∧
(∑ v ∈ B, (Bᶜ.filter fun w => D.Adj v w).card) = Nat.choose d 2 - 1 ∧
(¬ ∃ c : Fin 2 → Finset (Fin (4 * d - 2)),
(∀ i, digraph_directed_cycle_on D (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j))) ∧
(∀ T : Finset (Fin (4 * d - 2)), T.Nonempty →
(∀ v ∈ T, 2 ≤ (T.filter fun w => D.Adj v w).card) →
3 ≤ (T.filter fun v => (T.filter fun w => D.Adj v w).card < 3).card)digraph_oriented_twenty_profile_nested_parentsIn LeanGraph Theory & Graph Algorithms
Under the displayed two-cycle degree-sequence criteria, an oriented two-cycle-free equality-profile graph whose first five vertices are transitive with common target has at least 8−t high vertices pointing to that target and the first t low vertices, for every 1≤t≤5.
theorem digraph_oriented_twenty_profile_nested_parents
(n : ℕ) (D : Digraph (Fin n)) [DecidableRel D.Adj]
(hn : 20 ≤ n)
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card =
if v.val < 5 then v.val + 1 else 7)
(htrans : ∀ u v : Fin n, u.val < 5 → v.val < u.val → D.Adj u v)
(q : Fin n) (hq : 5 ≤ q.val)
(hlow : ∀ v : Fin n, v.val < 5 → D.Adj v q)
(hsequence : ∀ (s : ℕ) (β : Type) [Fintype β] [DecidableEq β] [Nonempty β]
(E : Digraph β) [DecidableRel E.Adj],
1 ≤ s → 2 * s + 1 ≤ Fintype.card β →
(∀ v, ¬ E.Adj v v) →
(∀ v, 1 ≤ (Finset.univ.filter fun w => E.Adj v w).card) →
(Finset.univ.filter fun v => (Finset.univ.filter fun w => E.Adj v w).card < s + 1).card ≤ s - 1 →
(Finset.univ.filter fun v => (Finset.univ.filter fun w => E.Adj v w).card < s + 2).card ≤ 2 * s →
∃ c : Fin 2 → Finset β, (∀ i, digraph_directed_cycle_on E (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j)))
(hno : ¬ ∃ c : Fin 2 → Finset (Fin n),
(∀ i, digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))) :
∀ t : ℕ, 1 ≤ t → t ≤ 5 →
8 - t ≤ (Finset.univ.filter fun p : Fin n => 5 ≤ p.val ∧ D.Adj p q ∧
∀ v : Fin n, v.val < t → D.Adj p v).carddigraph_oriented_twenty_profile_one_suppression_reductionIn LeanGraph Theory & Graph Algorithms
Assuming the displayed two-cycle degree-sequence criteria, an oriented two-cycle-free graph with transitive low-degree profile 1,2,3,4,5 followed by sevens has a common target for the five low vertices, at least seven high common predecessors of that target and the first low vertex, and at least twenty vertices.
theorem digraph_oriented_twenty_profile_one_suppression_reduction
(n : ℕ) (D : Digraph (Fin n)) [DecidableRel D.Adj]
(hn : 12 ≤ n)
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card =
if v.val < 5 then v.val + 1 else 7)
(htrans : ∀ u v : Fin n, u.val < 5 → v.val < u.val → D.Adj u v)
(hsequence : ∀ (s : ℕ) (β : Type) [Fintype β] [DecidableEq β] [Nonempty β]
(E : Digraph β) [DecidableRel E.Adj],
1 ≤ s → 2 * s + 1 ≤ Fintype.card β →
(∀ v, ¬ E.Adj v v) → (∀ v, 1 ≤ (Finset.univ.filter fun w => E.Adj v w).card) →
(Finset.univ.filter fun v => (Finset.univ.filter fun w => E.Adj v w).card < s + 1).card ≤ s - 1 →
(Finset.univ.filter fun v => (Finset.univ.filter fun w => E.Adj v w).card < s + 2).card ≤ 2 * s →
∃ c : Fin 2 → Finset β, (∀ i, digraph_directed_cycle_on E (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j)))
(hno : ¬ ∃ c : Fin 2 → Finset (Fin n), (∀ i, digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))) :
∃ q : Fin n, 5 ≤ q.val ∧ (∀ v : Fin n, v.val < 5 → D.Adj v q) ∧
7 ≤ (Finset.univ.filter fun p : Fin n =>
5 ≤ p.val ∧ D.Adj p q ∧ D.Adj p ⟨0, by omega⟩).card ∧ 20 ≤ ndigraph_oriented_twenty_profile_order_ge_twelveIn LeanGraph Theory & Graph Algorithms
An oriented graph whose first five outdegrees are 1,2,3,4,5 and all remaining outdegrees are seven has at least twelve vertices.
theorem digraph_oriented_twenty_profile_order_ge_twelve
(n : ℕ) (D : Digraph (Fin n)) [DecidableRel D.Adj] (hn : 5 ≤ n)
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card =
if v.val < 5 then v.val + 1 else 7) : 12 ≤ ndigraph_oriented_twenty_profile_seven_parentsIn LeanGraph Theory & Graph Algorithms
Assuming the displayed two-cycle degree-sequence criterion, an oriented two-cycle-free graph with outdegrees 1,2,3,4,5 followed by sevens, whose first five vertices point to a common high target q, has at least seven high common predecessors of the first low vertex and q, and has at least twenty vertices.
theorem digraph_oriented_twenty_profile_seven_parents
(n : ℕ) (D : Digraph (Fin n)) [DecidableRel D.Adj]
(hn : 5 ≤ n)
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card =
if v.val < 5 then v.val + 1 else 7)
(q : Fin n) (hq : 5 ≤ q.val)
(hlow : ∀ v : Fin n, v.val < 5 → D.Adj v q)
(hsequence : ∀ (β : Type) [Fintype β] [DecidableEq β] [Nonempty β]
(E : Digraph β) [DecidableRel E.Adj],
5 ≤ Fintype.card β →
(∀ v, ¬ E.Adj v v) →
(∀ v, 1 ≤ (Finset.univ.filter fun w => E.Adj v w).card) →
(Finset.univ.filter fun v => (Finset.univ.filter fun w => E.Adj v w).card < 6).card ≤ 4 →
(Finset.univ.filter fun v => (Finset.univ.filter fun w => E.Adj v w).card < 7).card ≤ 10 →
∃ c : Fin 2 → Finset β, (∀ i, digraph_directed_cycle_on E (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j)))
(hno : ¬ ∃ c : Fin 2 → Finset (Fin n),
(∀ i, digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))) :
7 ≤ (Finset.univ.filter fun p : Fin n =>
5 ≤ p.val ∧ D.Adj p q ∧ D.Adj p ⟨0, by omega⟩).card ∧ 20 ≤ ndigraph_oriented_twenty_profile_shared_target_lower_boundIn LeanGraph Theory & Graph Algorithms
Under the displayed universal robust two-cycle criterion, an oriented two-cycle-free degree-profile digraph with the first five vertices transitive has a common high outneighbor for those five, at least three high vertices dominating all five and that outneighbor, and at least sixteen vertices.
theorem digraph_oriented_twenty_profile_shared_target_lower_bound
(n : ℕ) (D : Digraph (Fin n)) [DecidableRel D.Adj]
(hn : 5 ≤ n)
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card =
if v.val < 5 then v.val + 1 else 7)
(htrans : ∀ u v : Fin n, u.val < 5 → v.val < u.val → D.Adj u v)
(hrobust_all : ∀ (β : Type) [Fintype β] [DecidableEq β] [Nonempty β]
(E : Digraph β) [DecidableRel E.Adj],
(∀ v, ¬ E.Adj v v) →
(∀ v, 2 ≤ (Finset.univ.filter fun w => E.Adj v w).card) →
(Finset.univ.filter fun v => (Finset.univ.filter fun w => E.Adj v w).card < 3).card ≤ 2 →
∃ c : Fin 2 → Finset β, (∀ i, digraph_directed_cycle_on E (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j)))
(hno : ¬ ∃ c : Fin 2 → Finset (Fin n),
(∀ i, digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))) :
∃ q : Fin n, 5 ≤ q.val ∧
(∀ v : Fin n, v.val < 5 → D.Adj v q) ∧
3 ≤ (Finset.univ.filter fun p : Fin n =>
5 ≤ p.val ∧ D.Adj p q ∧ ∀ v : Fin n, v.val < 5 → D.Adj p v).card ∧
16 ≤ ndigraph_out_degree_pos_iffIn LeanGraph Theory & Graph Algorithms
A vertex v of a finite digraph D has positive out-degree if and only if it has an out-neighbour.
theorem digraph_out_degree_pos_iff {V : Type*} [Fintype V] (D : Digraph V) [DecidableRel D.Adj]
(v : V) : 0 < digraph_out_degree D v ↔ ∃ w : V, D.Adj v wdigraph_out_laplacian_transpose_of_eulerianIn LeanGraph Theory & Graph Algorithms
Reversing an Eulerian digraph transposes its out-degree Laplacian matrix.
theorem digraph_out_laplacian_transpose_of_eulerian {n : ℕ} (G : SimpleGraph (Fin n))
(D : Digraph (Fin n)) [DecidableRel D.Adj]
(hD : digraph_is_eulerian_orientation G D) :
@digraph_out_laplacian n ⟨fun u v => D.Adj v u⟩
(fun u v => inferInstanceAs (Decidable (D.Adj v u))) =
(digraph_out_laplacian D).transposedigraph_quasi_kernel_private_witnessIn LeanGraph Theory & Graph Algorithms
If Q is a quasi-kernel of minimum cardinality in a finite digraph, then there is a map f from the members of Q to the vertices such that for every q in Q the vertex f q is 2-dominated by the singleton {q} but not by Q with q removed; any such map is injective, so Q embeds into the vertex set.
theorem digraph_quasi_kernel_private_witness {α : Type} [Fintype α] [DecidableEq α]
(D : Digraph α) (Q : Finset α) (hQ : digraph_is_quasi_kernel D Q)
(hmin : ∀ Q' : Finset α, digraph_is_quasi_kernel D Q' → Q.card ≤ Q'.card) :
∃ f : {q // q ∈ Q} → α,
(∀ q, digraph_two_dominated D {q.1} (f q) ∧ ¬ digraph_two_dominated D (Q.erase q.1) (f q)) ∧
Function.Injective fdigraph_quasi_kernel_self_witness_of_no_outIn LeanGraph Theory & Graph Algorithms
Let Q contain a vertex q with no out-neighbour. Then any map f from the members of Q that assigns to each member x a vertex 2-dominated by {x} but not by Q with x removed must satisfy f q = q.
theorem digraph_quasi_kernel_self_witness_of_no_out {α : Type} [Fintype α] [DecidableEq α]
(D : Digraph α) (Q : Finset α) {q : α} (hqQ : q ∈ Q) (hq : ∀ y, ¬ D.Adj q y)
(f : {x // x ∈ Q} → α)
(hf : ∀ x, digraph_two_dominated D {x.1} (f x) ∧ ¬ digraph_two_dominated D (Q.erase x.1) (f x)) :
f ⟨q, hqQ⟩ = qdigraph_regular_common_predecessor_card_le_121In LeanGraph Theory & Graph Algorithms
A digraph with indegree and outdegree exactly seven at every vertex has at most 121 vertices if its common-predecessor graph is connected and has no independent set of size four.
theorem digraph_regular_common_predecessor_card_le_121
(n : ℕ) (D : Digraph (Fin n)) [DecidableRel D.Adj]
(hout : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card = 7)
(hin : ∀ v, (Finset.univ.filter fun w => D.Adj w v).card = 7)
(hconn : (digraph_common_predecessor_graph D).Connected)
(hindep : (digraph_common_predecessor_graph D).IndepSetFree 4) : n ≤ 121digraph_semicomplete_multipartite_no_router_in_out_partitionIn LeanGraph Theory & Graph Algorithms
In a semicomplete multipartite digraph, if a non-adjacent pair {s₁, t₁} has no 2-step router, every vertex v outside their independent part is either purely in-directed to both s₁ and t₁ or purely out-directed from both s₁ and t₁.
theorem digraph_semicomplete_multipartite_no_router_in_out_partition
{V : Type*} [Fintype V] (D : Digraph V)
(hmulti : digraph_is_semicomplete_multipartite D)
{s₁ t₁ : V} (hne : s₁ ≠ t₁)
(hnonadj : ¬ D.Adj s₁ t₁ ∧ ¬ D.Adj t₁ s₁)
(hnorouter : ∀ v ∉ [s₁, t₁], ¬ ((D.Adj s₁ v ∧ D.Adj v t₁) ∨ (D.Adj t₁ v ∧ D.Adj v s₁)))
(v : V) (hv : v ≠ s₁ ∧ v ≠ t₁) (hnot_part : D.Adj s₁ v ∨ D.Adj v s₁) :
(D.Adj s₁ v ∧ D.Adj t₁ v ∧ ¬ D.Adj v s₁ ∧ ¬ D.Adj v t₁) ∨
(D.Adj v s₁ ∧ D.Adj v t₁ ∧ ¬ D.Adj s₁ v ∧ ¬ D.Adj t₁ v)digraph_semicomplete_part_short_pathIn LeanGraph Theory & Graph Algorithms
Let W be a vertex set on which D is semicomplete (every two distinct vertices of W are joined by at least one arc). If u, v ∈ W are distinct and both lie outside a finite set T, then some list of at most 2 vertices is a directed path from u to v or from v to u, all of whose vertices avoid T.
theorem digraph_semicomplete_part_short_path {V : Type*} (D : Digraph V) (W : Set V)
(hsem : ∀ u ∈ W, ∀ v ∈ W, u ≠ v → D.Adj u v ∨ D.Adj v u)
{u v : V} (hu : u ∈ W) (hv : v ∈ W) (huv : u ≠ v) (T : Finset V)
(huT : u ∉ T) (hvT : v ∉ T) :
∃ p : List V, (digraph_is_directed_path D p u v ∨ digraph_is_directed_path D p v u) ∧
p.length ≤ 2 ∧ ∀ x ∈ p, x ∉ Tdigraph_six_circulant_digirth_ge_fourIn LeanGraph Theory & Graph Algorithms
The digraph digraph_six_circulant has digirth at least 4.
theorem digraph_six_circulant_digirth_ge_four : digraph_has_digirth_ge digraph_six_circulant 4
digraph_six_circulant_has_ckk_subdivision_twoIn LeanGraph Theory & Graph Algorithms
The digraph digraph_six_circulant contains a subdivision of C(2,2): the two internally disjoint paths 0 → 3 → 4 and 0 → 1 → 4.
theorem digraph_six_circulant_has_ckk_subdivision_two :
digraph_has_ckk_subdivision digraph_six_circulant 2digraph_six_circulant_three_exceptional_instanceIn LeanGraph Theory & Graph Algorithms
The digraph digraph_six_circulant on six vertices is loopless, has minimum out-degree at least 1, has exactly 3 vertices of out-degree 1 (namely 3, 4, 5), has digirth at least 3*(2-1)+1 = 4, and contains a subdivision of C(2,2). So the hypotheses of the target for k = 2 are satisfiable by a nonempty digraph that also satisfies the conclusion.
theorem digraph_six_circulant_three_exceptional_instance :
(∀ v : Fin 6, ¬ digraph_six_circulant.Adj v v) ∧
(∀ v : Fin 6, 1 ≤ digraph_out_degree digraph_six_circulant v) ∧
(digraph_exceptional_verts digraph_six_circulant).card ≤ 3 ∧
digraph_has_digirth_ge digraph_six_circulant (3 * (2 - 1) + 1) ∧
digraph_has_ckk_subdivision digraph_six_circulant 2digraph_small_quasi_kernel_of_bipartiteIn LeanGraph Theory & Graph Algorithms
Let D be a finite source-free digraph on a vertex set partitioned into two disjoint parts A and B with every arc joining A to B, and (for definiteness) every vertex in A or in B. Then the smaller of A and B is independent and 2-dominates every vertex, so D has a quasi-kernel Q with 2|Q| ≤ |V|.
theorem digraph_small_quasi_kernel_of_bipartite (α : Type) [Fintype α] [DecidableEq α]
(D : Digraph α) [DecidableRel D.Adj] (hsrc : ∀ v, ∃ u, D.Adj u v)
(A B : Finset α) (hcover : ∀ v, v ∈ A ∨ v ∈ B) (hdisj : Disjoint A B)
(hcross : ∀ u v, D.Adj u v → (u ∈ A ∧ v ∈ B) ∨ (u ∈ B ∧ v ∈ A)) :
∃ Q : Finset α, digraph_is_quasi_kernel D Q ∧ 2 * Q.card ≤ Fintype.card αdigraph_small_quasi_kernel_of_card_le_twoIn LeanGraph Theory & Graph Algorithms
If a finite loopless digraph has at most two vertices and every vertex has an in-neighbour, then it has a quasi-kernel Q with 2|Q| ≤ |V|.
theorem digraph_small_quasi_kernel_of_card_le_two (α : Type) [Fintype α] [DecidableEq α]
(D : Digraph α) [DecidableRel D.Adj] (hloop : ∀ v, ¬ D.Adj v v) (hsrc : ∀ v, ∃ u, D.Adj u v)
(hcard : Fintype.card α ≤ 2) :
∃ Q : Finset α, digraph_is_quasi_kernel D Q ∧ 2 * Q.card ≤ Fintype.card αdigraph_suppress_set_to_two_cycles_liftIn LeanGraph Theory & Graph Algorithms
If each suppressed vertex points to q, every pair of vertex-disjoint cycles after suppressing the set into q lifts to a disjoint pair in the original digraph.
theorem digraph_suppress_set_to_two_cycles_lift
(α : Type) [DecidableEq α] (D : Digraph α) (S : Finset α) (q : α)
(hq : q ∉ S) (hSq : ∀ x ∈ S, D.Adj x q)
(c : Fin 2 → Finset {v : α // v ∉ S})
(hcyc : ∀ i, digraph_directed_cycle_on (digraph_suppress_set_to D S q) (c i))
(hdis : Pairwise (fun i j => Disjoint (c i) (c j))) :
∃ d : Fin 2 → Finset α, (∀ i, digraph_directed_cycle_on D (d i)) ∧
Pairwise (fun i j => Disjoint (d i) (d j))digraph_three_boundary_tails_robust_cut_boundIn LeanGraph Theory & Graph Algorithms
A vertex set in a digraph of minimum outdegree r at least four, with three distinct tails of arcs leaving it and no two disjoint internal directed cycles, has at least r+1 leaving arcs, provided the robust two-cycle criterion holds on that set.
theorem digraph_three_boundary_tails_robust_cut_bound
(α : Type) [Fintype α] [DecidableEq α] (D : Digraph α) [DecidableRel D.Adj]
(r : ℕ) (hr : 4 ≤ r) (B : Finset α)
(hdeg : ∀ v ∈ B, r ≤ (Finset.univ.filter fun w => D.Adj v w).card)
(htails : 3 ≤ (B.filter fun v => ∃ w ∈ Bᶜ, D.Adj v w).card)
(hrobust : (∀ v ∈ B, 2 ≤ (B.filter fun w => D.Adj v w).card) →
(B.filter fun v => (B.filter fun w => D.Adj v w).card < 3).card ≤ 2 →
∃ c : Fin 2 → Finset α, (∀ i, c i ⊆ B ∧ digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j)))
(hno : ¬ ∃ c : Fin 2 → Finset α, (∀ i, c i ⊆ B ∧ digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j))) :
r + 1 ≤ ∑ v ∈ B, (Bᶜ.filter fun w => D.Adj v w).carddigraph_three_exceptional_vertex_out_degree_twoIn LeanGraph Theory & Graph Algorithms
Let k ≥ 2. In a finite nonempty loopless digraph D with minimum out-degree at least 1, at most 3 vertices of out-degree 1, and digirth at least 3*(k-1)+1, some vertex has out-degree at least 2.
open Classical in
theorem digraph_three_exceptional_vertex_out_degree_two
{V : Type*} [Fintype V] [Nonempty V] (D : Digraph V) [DecidableRel D.Adj]
(hloop : ∀ v : V, ¬ D.Adj v v)
(k : ℕ) (hk : 2 ≤ k)
(hmin : ∀ v : V, 1 ≤ digraph_out_degree D v)
(hexc : (digraph_exceptional_verts D).card ≤ 3)
(hgirth : digraph_has_digirth_ge D (3 * (k - 1) + 1)) :
∃ v : V, 2 ≤ digraph_out_degree D vdigraph_three_strong_card_four_cross_short_pathIn LeanGraph Theory & Graph Algorithms
If D is a 3-strong digraph on exactly 4 vertices, then any two distinct vertices are joined by a directed path with at most 4 vertices (this is the smallest instance of the cross short-path lemma; in fact 3-strongness on 4 vertices forces a bidirected complete digraph).
theorem digraph_three_strong_card_four_cross_short_path {V : Type*} [Fintype V]
(D : Digraph V) (h3 : digraph_is_k_strong D 3) (hcard : Fintype.card V = 4) {s t : V}
(hst : s ≠ t) :
∃ p : List V,
(digraph_is_directed_path D p s t ∨ digraph_is_directed_path D p t s) ∧ p.length ≤ 4digraph_three_strong_co_bipartite_cross_short_pathIn LeanGraph Theory & Graph Algorithms
Let D be a digraph whose vertex set is partitioned into two disjoint sets V₁, V₂, each inducing a semicomplete subdigraph. If D is 3-strong, then for every s ∈ V₁ and t ∈ V₂ with s ≠ t there is a directed path joining s and t in one of the two directions with at most 4 vertices (at most 3 arcs).
theorem digraph_three_strong_co_bipartite_cross_short_path {V : Type*} [Fintype V]
(D : Digraph V) (V₁ V₂ : Set V) (hcover : ∀ v, v ∈ V₁ ∨ v ∈ V₂) (hdisj : Disjoint V₁ V₂)
(hsem₁ : ∀ u ∈ V₁, ∀ v ∈ V₁, u ≠ v → D.Adj u v ∨ D.Adj v u)
(hsem₂ : ∀ u ∈ V₂, ∀ v ∈ V₂, u ≠ v → D.Adj u v ∨ D.Adj v u)
(h3 : digraph_is_k_strong D 3) {s t : V} (hs : s ∈ V₁) (ht : t ∈ V₂) (hst : s ≠ t) :
∃ p : List V,
(digraph_is_directed_path D p s t ∨ digraph_is_directed_path D p t s) ∧ p.length ≤ 4digraph_three_strong_co_bipartite_cross_short_path_avoidingIn LeanGraph Theory & Graph Algorithms
Same setting as the previous lemma (D 3-strong, V = V₁ ⊔ V₂ with each part semicomplete), plus a forbidden set A₀ with |A₀| + 4 ≤ |V|. The 3-strongness hypothesis is spelled out for paths avoiding A₀ as well: for every T with |T| < 3 and distinct u, v outside T ∪ A₀ there is a u→v path avoiding T ∪ A₀. Then for s ∈ V₁ and t ∈ V₂ outside A₀ with s ≠ t there is a path joining s and t in one of the two directions with at most 4 vertices, avoiding A₀ entirely.
theorem digraph_three_strong_co_bipartite_cross_short_path_avoiding {V : Type*} [Fintype V]
(D : Digraph V) (V₁ V₂ : Set V) (hcover : ∀ v, v ∈ V₁ ∨ v ∈ V₂) (hdisj : Disjoint V₁ V₂)
(hsem₁ : ∀ u ∈ V₁, ∀ v ∈ V₁, u ≠ v → D.Adj u v ∨ D.Adj v u)
(hsem₂ : ∀ u ∈ V₂, ∀ v ∈ V₂, u ≠ v → D.Adj u v ∨ D.Adj v u)
(A₀ : Finset V) (hbig : A₀.card + 4 ≤ Fintype.card V)
(h3 : ∀ (T : Finset V), T.card < 3 → ∀ u v : V, u ∉ T → v ∉ T → u ∉ A₀ → v ∉ A₀ →
u ≠ v → ∃ p : List V, digraph_is_directed_path D p u v ∧ (∀ x ∈ p, x ∉ T) ∧
∀ x ∈ p, x ∉ A₀)
{s t : V} (hs : s ∈ V₁) (ht : t ∈ V₂) (hsa : s ∉ A₀) (hta : t ∉ A₀) (hst : s ≠ t) :
∃ p : List V,
(digraph_is_directed_path D p s t ∨ digraph_is_directed_path D p t s) ∧
p.length ≤ 4 ∧ ∀ x ∈ p, x ∉ A₀digraph_three_strong_co_bipartite_small_part_cross_short_pathIn LeanGraph Theory & Graph Algorithms
Let D be 3-strong with V = V₁ ⊔ V₂, V₂ inducing a semicomplete subdigraph and V₁ having at most three vertices. Then for s ∈ V₁ and t ∈ V₂ with s ≠ t there is a directed path joining s and t in one of the two directions with at most 4 vertices.
theorem digraph_three_strong_co_bipartite_small_part_cross_short_path {V : Type*} [Fintype V]
(D : Digraph V) (V₁ V₂ : Set V) (hcover : ∀ v, v ∈ V₁ ∨ v ∈ V₂) (hdisj : Disjoint V₁ V₂)
(hsem₂ : ∀ u ∈ V₂, ∀ v ∈ V₂, u ≠ v → D.Adj u v ∨ D.Adj v u)
(h3 : digraph_is_k_strong D 3) (hsmall : V₁.ncard ≤ 3) {s t : V} (hs : s ∈ V₁) (ht : t ∈ V₂)
(hst : s ≠ t) :
∃ p : List V,
(digraph_is_directed_path D p s t ∨ digraph_is_directed_path D p t s) ∧ p.length ≤ 4digraph_twenty_cut_equality_forces_overlap_seventyIn LeanGraph Theory & Graph Algorithms
In an oriented graph, a seven-outregular two-cycle-free part whose outgoing cut has exactly twenty arcs forces common-predecessor overlap at least seventy, assuming the displayed published cycle and degree-sequence criteria.
theorem digraph_twenty_cut_equality_forces_overlap_seventy
(α : Type) [Fintype α] [DecidableEq α] (D : Digraph α) [DecidableRel D.Adj]
(B : Finset α) (hB : 7 ≤ B.card)
(hori : ∀ u v, D.Adj u v → ¬ D.Adj v u)
(hdeg : ∀ v ∈ B, (Finset.univ.filter fun w => D.Adj v w).card = 7)
(hrobust : ∀ T : Finset α, T.Nonempty →
(∀ v ∈ T, 2 ≤ (T.filter fun w => D.Adj v w).card) →
(T.filter fun v => (T.filter fun w => D.Adj v w).card < 3).card ≤ 2 →
∃ c : Fin 2 → Finset α, (∀ i, c i ⊆ T ∧ digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j)))
(hseq1 : (∀ v ∈ B, 2 ≤ (B.filter fun w => D.Adj v w).card) →
(B.filter fun v => (B.filter fun w => D.Adj v w).card < 4).card ≤ 3 →
∃ c : Fin 2 → Finset α, (∀ i, c i ⊆ B ∧ digraph_directed_cycle_on D (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j)))
(hseq2 : (∀ v ∈ B, 1 ≤ (B.filter fun w => D.Adj v w).card) →
(B.filter fun v => (B.filter fun w => D.Adj v w).card < 3).card ≤ 1 →
(B.filter fun v => (B.filter fun w => D.Adj v w).card < 4).card ≤ 4 →
∃ c : Fin 2 → Finset α, (∀ i, c i ⊆ B ∧ digraph_directed_cycle_on D (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j)))
(hseq3 : (∀ v ∈ B, 1 ≤ (B.filter fun w => D.Adj v w).card) →
(B.filter fun v => (B.filter fun w => D.Adj v w).card < 4).card ≤ 2 →
(B.filter fun v => (B.filter fun w => D.Adj v w).card < 5).card ≤ 6 →
∃ c : Fin 2 → Finset α, (∀ i, c i ⊆ B ∧ digraph_directed_cycle_on D (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j)))
(hrobust_all : ∀ (β : Type) [Fintype β] [DecidableEq β] [Nonempty β]
(E : Digraph β) [DecidableRel E.Adj],
(∀ v, ¬ E.Adj v v) →
(∀ v, 2 ≤ (Finset.univ.filter fun w => E.Adj v w).card) →
(Finset.univ.filter fun v => (Finset.univ.filter fun w => E.Adj v w).card < 3).card ≤ 2 →
∃ c : Fin 2 → Finset β, (∀ i, digraph_directed_cycle_on E (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j)))
(hsequence_all : ∀ (s : ℕ) (β : Type) [Fintype β] [DecidableEq β] [Nonempty β]
(E : Digraph β) [DecidableRel E.Adj],
1 ≤ s → 2 * s + 1 ≤ Fintype.card β →
(∀ v, ¬ E.Adj v v) → (∀ v, 1 ≤ (Finset.univ.filter fun w => E.Adj v w).card) →
(Finset.univ.filter fun v => (Finset.univ.filter fun w => E.Adj v w).card < s + 1).card ≤ s - 1 →
(Finset.univ.filter fun v => (Finset.univ.filter fun w => E.Adj v w).card < s + 2).card ≤ 2 * s →
∃ c : Fin 2 → Finset β, (∀ i, digraph_directed_cycle_on E (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j)))
(hno : ¬ ∃ c : Fin 2 → Finset α, (∀ i, c i ⊆ B ∧ digraph_directed_cycle_on D (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j)))
(hcut : (∑ v ∈ B, (Bᶜ.filter fun w => D.Adj v w).card) = 20) :
70 ≤ (∑ v : α, Nat.choose (Finset.univ.filter fun w => D.Adj v w).card 2) -
(digraph_common_predecessor_graph D).edgeFinset.carddigraph_two_dominated_monoIn LeanGraph Theory & Graph Algorithms
If a vertex is 2-dominated by S and S is contained in T, then it is 2-dominated by T (the same witness u in S is used).
theorem digraph_two_dominated_mono {α : Type*} (D : Digraph α) {S T : Finset α} (hST : S ⊆ T) {v : α}
(h : digraph_two_dominated D S v) : digraph_two_dominated D T vdigraph_two_dominated_singleton_of_no_outIn LeanGraph Theory & Graph Algorithms
If q has no out-neighbour in D, then the only vertex 2-dominated by the singleton {q} is q.
theorem digraph_two_dominated_singleton_of_no_out {α : Type*} (D : Digraph α) {q : α}
(hq : ∀ y, ¬ D.Adj q y) (v : α) : digraph_two_dominated D {q} v ↔ v = qdigraph_two_mul_card_le_add_self_witnessIn LeanGraph Theory & Graph Algorithms
For any finite vertex type α, any finite set Q and any injective f from the members of Q to α, twice the cardinality of Q is at most the cardinality of α plus the number of members q of Q with f q again in Q.
theorem digraph_two_mul_card_le_add_self_witness {α : Type} [Fintype α] [DecidableEq α]
(Q : Finset α) (f : {q // q ∈ Q} → α) (hinj : Function.Injective f) :
2 * Q.card ≤ Fintype.card α + (Finset.univ.filter (fun q : {q // q ∈ Q} => f q ∈ Q)).carddigraph_unilaterally_two_linked_of_cross_short_pathIn LeanGraph Theory & Graph Algorithms
Let D be a 5-strong digraph whose vertices are covered by two sets V₁, V₂ each inducing a semicomplete subdigraph. Suppose moreover that for every set A₀ of at most 2 vertices and every s ∈ V₁, t ∈ V₂ outside A₀ with s ≠ t, some path of at most 4 vertices joins s and t in one of the two directions while avoiding A₀. Then D is unilaterally 2-linked.
theorem digraph_unilaterally_two_linked_of_cross_short_path {V : Type*} [Fintype V]
(D : Digraph V) (hstrong : digraph_is_k_strong D 5)
(V₁ V₂ : Set V) (hcover : ∀ v, v ∈ V₁ ∨ v ∈ V₂)
(hsem₁ : ∀ u ∈ V₁, ∀ v ∈ V₁, u ≠ v → D.Adj u v ∨ D.Adj v u)
(hsem₂ : ∀ u ∈ V₂, ∀ v ∈ V₂, u ≠ v → D.Adj u v ∨ D.Adj v u)
(hshort : ∀ (A₀ : Finset V), A₀.card ≤ 2 → A₀.card + 4 ≤ Fintype.card V →
∀ s t : V, s ∈ V₁ → t ∈ V₂ → s ∉ A₀ → t ∉ A₀ → s ≠ t →
∃ p : List V, (digraph_is_directed_path D p s t ∨ digraph_is_directed_path D p t s) ∧
p.length ≤ 4 ∧ ∀ x ∈ p, x ∉ A₀) :
digraph_is_unilaterally_two_linked Ddist_common_neighbor_eq_succIn LeanGraph Theory & Graph Algorithms
If d(v,q) = d(v,p) + 2 and z is adjacent to both p and q, then d(v,z) = d(v,p) + 1.
theorem dist_common_neighbor_eq_succ {V : Type*} (G : SimpleGraph V)
{v p q z : V} (hvq : G.dist v q = G.dist v p + 2)
(hzp : G.Adj z p) (hzq : G.Adj z q) :
G.dist v z = G.dist v p + 1dist_two_graph_adj_iffIn LeanGraph Theory & Graph Algorithms
Two vertices are adjacent in the square of G exactly when they are distinct and are either adjacent in G or have a common neighbour in G; in particular every edge of G is an edge of its square.
theorem dist_two_graph_adj_iff {V : Type} (G : SimpleGraph V) (a b : V) :
(dist_two_graph G).Adj a b ↔
a ≠ b ∧ (G.Adj a b ∨ ∃ c, G.Adj a c ∧ G.Adj b c) ∧ (G.Adj a b ∨ ∃ c, G.Adj a c ∧ G.Adj c b)dist_two_graph_degree_le_fourIn LeanGraph Theory & Graph Algorithms
If every vertex of a finite simple graph G has degree at most 2, then in the graph joining vertices at distance 1 or 2 every vertex has degree at most 4.
theorem dist_two_graph_degree_le_four {V : Type} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hdeg : ∀ v, G.degree v ≤ 2) (v : V) :
(dist_two_graph G).degree v ≤ 4distance_hereditary_induceIn LeanGraph Theory & Graph Algorithms
Every induced subgraph of a distance-hereditary graph is distance-hereditary.
theorem distance_hereditary_induce {α : Type*} (F : SimpleGraph α) (hF : is_distance_hereditary F)
(s : Set α) : is_distance_hereditary (SimpleGraph.induce s F)distance_hereditary_no_chordless_cycle_ge_fiveIn LeanGraph Theory & Graph Algorithms
A distance-hereditary graph has no chordless cycle of length at least 5.
theorem distance_hereditary_no_chordless_cycle_ge_five {α : Type*} (F : SimpleGraph α)
(hF : is_distance_hereditary F) {v : α} {c : F.Walk v v}
(hc : c.IsCycle) (hch : c.IsChordless) : c.length ≤ 4distance_hereditary_pendant_or_twinIn LeanGraph Theory & Graph Algorithms
Every finite distance-hereditary graph with at least two vertices has a pendant vertex, or a pair of false twins (equal neighbourhoods), or a pair of true twins (neighbourhoods equal after adding the vertex itself).
theorem distance_hereditary_pendant_or_twin {α : Type*} [Fintype α] (F : SimpleGraph α)
(hF : is_distance_hereditary F) (h2 : 2 ≤ Fintype.card α) :
(∃ v : α, Nat.card ↥(F.neighborSet v) = 1) ∨
(∃ u v : α, u ≠ v ∧ F.neighborSet u = F.neighborSet v) ∨
(∃ u v : α, u ≠ v ∧ F.neighborSet u ∪ {u} = F.neighborSet v ∪ {v})distance_regular_c_zeroIn LeanGraph Theory & Graph Algorithms
In a distance-regular graph of diameter d > 0 with intersection parameters (b, c), we have c(0) = 1.
theorem distance_regular_c_zero {V : Type*} (G : SimpleGraph V) (d : ℕ)
(b c : Fin d → ℕ) (hG : is_distance_regular_with G d b c) (hd : 0 < d)
(u v : V) (h : G.dist u v = 1) : c ⟨0, hd⟩ = 1distance_regular_card_geodesics_eq_prodIn LeanGraph Theory & Graph Algorithms
In any distance-regular graph G with parameters d, b, c, for every index i : Fin d and any vertices u, v with dist(u, v) = i + 1, the number of geodesics between u and v is equal to the product of c(j) for all j ≤ i.
theorem distance_regular_card_geodesics_eq_prod {V : Type*} [Fintype V]
(G : SimpleGraph V) (d : ℕ) (b c : Fin d → ℕ)
(hG : is_distance_regular_with G d b c) (i : Fin d)
(u v : V) (hdist : G.dist u v = i.val + 1) :
Nat.card {p : G.Walk u v // is_geodesic p} = ∏ j ∈ Finset.Iic i, c jdominating_average_star_like_vertex_stability_of_not_star_likeIn LeanGraph Theory & Graph Algorithms
If G has n ≥ 2 vertices, no isolated vertex, and G is not star-like, then 5 d_*(G) ≤ 51 (2n/3 - avd(G)).
theorem dominating_average_star_like_vertex_stability_of_not_star_like {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (hn : 2 ≤ Fintype.card V) (hiso : ∀ w, 0 < G.degree w) (hnot : ¬ simple_graph_is_star_like G) : 5 * (simple_graph_star_like_deletion_number G : ℚ) ≤ 51 * (2 * (Fintype.card V : ℚ) / 3 - simple_graph_avg_dominating_order G)edge_finset_is_edge_geodesic_transversalIn LeanGraph Theory & Graph Algorithms
In a finite simple graph in which every vertex has a neighbour, the set of all edges is an edge geodesic transversal. In particular a finite edge geodesic transversal exists.
theorem edge_finset_is_edge_geodesic_transversal {V : Type*} [Fintype V] (G : SimpleGraph V)
[DecidableRel G.Adj] (hne : ∀ v, ∃ w, G.Adj v w) :
is_edge_geodesic_transversal G G.edgeFinsetedge_geodesic_transversal_bound_of_edge_disjoint_finiteIn LeanGraph Theory & Graph Algorithms
Let G be a connected finite simple graph in which every vertex has a neighbour. If G contains k mutually edge-disjoint maximal geodesics, then the edge geodesic transversal number of G is at least k.
theorem edge_geodesic_transversal_bound_of_edge_disjoint_finite {V : Type*} [Fintype V] (G : SimpleGraph V)
[DecidableRel G.Adj] (hG : G.Connected) (hne : ∀ v, ∃ w, G.Adj v w) (k : ℕ)
(h_disj : ∃ (u v : Fin k → V) (P : (i : Fin k) → G.Walk (u i) (v i)),
(∀ i, is_maximal_geodesic (P i)) ∧
∀ (i j : Fin k), i ≠ j → ∀ e ∈ (P i).edges, e ∉ (P j).edges) :
k ≤ edge_geodesic_transversal_number Gedge_geodesic_transversal_card_ge_of_edge_disjoint_maximal_geodesicsIn LeanGraph Theory & Graph Algorithms
Let G be a simple graph and S a finite edge geodesic transversal of G. If G contains k mutually edge-disjoint maximal geodesics, then S has at least k edges.
theorem edge_geodesic_transversal_card_ge_of_edge_disjoint_maximal_geodesics {V : Type*} (G : SimpleGraph V)
(k : ℕ) (S : Finset (Sym2 V)) (hS : is_edge_geodesic_transversal G S)
(h_disj : ∃ (u v : Fin k → V) (P : (i : Fin k) → G.Walk (u i) (v i)),
(∀ i, is_maximal_geodesic (P i)) ∧
∀ (i j : Fin k), i ≠ j → ∀ e ∈ (P i).edges, e ∉ (P j).edges) :
k ≤ S.cardedge_geodesic_transversal_number_ge_of_edge_disjoint_maximal_geodesicsIn LeanGraph Theory & Graph Algorithms
Let G be a simple graph that admits at least one finite edge geodesic transversal. If G contains k mutually edge-disjoint maximal geodesics, then the edge geodesic transversal number of G is at least k.
theorem edge_geodesic_transversal_number_ge_of_edge_disjoint_maximal_geodesics {V : Type*} (G : SimpleGraph V)
(k : ℕ) (hT : ∃ S : Finset (Sym2 V), is_edge_geodesic_transversal G S)
(h_disj : ∃ (u v : Fin k → V) (P : (i : Fin k) → G.Walk (u i) (v i)),
(∀ i, is_maximal_geodesic (P i)) ∧
∀ (i j : Fin k), i ≠ j → ∀ e ∈ (P i).edges, e ∉ (P j).edges) :
k ≤ edge_geodesic_transversal_number Gedge_hitting_all_shortest_paths_card_geIn LeanGraph Theory & Graph Algorithms
In a connected finite simple graph G, any edge set F that meets every geodesic (shortest path) between every two distinct vertices of a set U with 2 ≤ |U| has at least |U| - 1 edges. This is the pure-graph core (OP-641) of the corona lower bound: the corona target follows from it via the corona bookkeeping lemmas, and conversely it follows from the corona target (take the corona of G and the transversal F together with all pendant edges but one), so it is exactly as hard as the parent node.
theorem edge_hitting_all_shortest_paths_card_ge
{V : Type*} [Fintype V] (G : SimpleGraph V) (hG : G.Connected)
(U : Finset V) (hU : 2 ≤ U.card) (F : Finset (Sym2 V))
(hF : ∀ e ∈ F, e ∈ G.edgeSet)
(h : ∀ u ∈ U, ∀ v ∈ U, u ≠ v → ∀ p : G.Walk u v,
p.IsPath → p.length = G.dist u v → ∃ e ∈ F, e ∈ p.edges) :
U.card - 1 ≤ F.cardedge_hitting_all_shortest_paths_card_ge_of_isTreeIn LeanGraph Theory & Graph Algorithms
The edge-hitting bound holds for trees: if G is a tree and F meets every geodesic between distinct vertices of a set U with 2 ≤ |U|, then |U| - 1 ≤ |F|.
theorem edge_hitting_all_shortest_paths_card_ge_of_isTree
{V : Type*} [Fintype V] (G : SimpleGraph V) (hG : G.IsTree)
(U : Finset V) (hU : 2 ≤ U.card) (F : Finset (Sym2 V))
(hF : ∀ e ∈ F, e ∈ G.edgeSet)
(h : ∀ u ∈ U, ∀ v ∈ U, u ≠ v → ∀ p : G.Walk u v,
p.IsPath → p.length = G.dist u v → ∃ e ∈ F, e ∈ p.edges) :
U.card - 1 ≤ F.cardedge_rotation_quadratic_form_differenceIn LeanGraph Theory & Graph Algorithms
For an edge vw of a finite simple graph X and a vertex u with u ≠ w and u not adjacent to w, the quadratic form of the rotated graph X' = X - vw + uw at any real vector x equals the quadratic form of X at x plus 2(x u - x v)(x w).
attribute [local instance] Classical.propDecidable in
theorem edge_rotation_quadratic_form_difference
{V : Type*} [Fintype V] [DecidableEq V]
(X : SimpleGraph V) (u v w : V) (he : X.Adj v w) (huw : ¬ X.Adj u w) (huv : u ≠ w)
(x : V → ℝ) :
(∑ i, x i * Matrix.mulVec ((X.deleteEdges {s(v, w)} ⊔
SimpleGraph.fromEdgeSet {s(u, w)}).adjMatrix ℝ) x i)
- (∑ i, x i * Matrix.mulVec (X.adjMatrix ℝ) x i)
= 2 * (x u - x v) * x wedge_rotation_spectral_radius_gtIn LeanGraph Theory & Graph Algorithms
Let X be a connected simple graph on a finite vertex type V, with edge vw, and let u be a vertex distinct from w and not adjacent to w. If vec is a Perron vector of X with vec v ≤ vec u, then replacing edge vw with uw yields a graph with strictly greater adjacency spectral radius.
theorem edge_rotation_spectral_radius_gt
{V : Type*} [Fintype V] [DecidableEq V]
(X : SimpleGraph V) (hX : X.Connected)
(u v w : V) (he : X.Adj v w) (huw : ¬ X.Adj u w) (huv : u ≠ w)
(vec : V → ℝ) (hvec : is_perron_vector X vec) (huv_le : vec v ≤ vec u) :
adjacency_spectral_radius X <
adjacency_spectral_radius (X.deleteEdges {s(v, w)} ⊔ SimpleGraph.fromEdgeSet {s(u, w)})edge_rotation_strict_gain_vectorIn LeanGraph Theory & Graph Algorithms
Let X be a finite simple graph with edge vw, u ≠ w a vertex not adjacent to w, and vec a Perron vector of X with vec v ≤ vec u. Then some vector of positive squared length has Rayleigh quotient in the rotated graph X - vw + uw strictly greater than the spectral radius of X.
attribute [local instance] Classical.propDecidable in
theorem edge_rotation_strict_gain_vector
{V : Type*} [Fintype V] [DecidableEq V]
(X : SimpleGraph V) (u v w : V) (he : X.Adj v w) (huw : ¬ X.Adj u w) (huv : u ≠ w)
(vec : V → ℝ) (hvec : is_perron_vector X vec) (hle : vec v ≤ vec u) :
∃ x : V → ℝ, 0 < ∑ i, x i ^ 2 ∧
(adjacency_spectral_radius X).toReal <
(∑ i, x i * Matrix.mulVec ((X.deleteEdges {s(v, w)} ⊔
SimpleGraph.fromEdgeSet {s(u, w)}).adjMatrix ℝ) x i) /
(∑ i, x i ^ 2)even_degree_edgeFinset_card_le_twoIn LeanGraph Theory & Graph Algorithms
A finite simple graph all of whose vertex degrees are even cannot have exactly one or two edges; if it has at most two edges it is empty.
theorem even_degree_edgeFinset_card_le_two
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hGeven : ∀ v, Even (G.degree v))
(hcard : G.edgeFinset.card ≤ 2) :
G.edgeFinset.card = 0exists_adj_of_gamma_ve_induce_eq_pend_ve_num_succIn LeanGraph Theory & Graph Algorithms
If gamma_ve(G[A]) = a_C + 1 then v has a neighbour in A (otherwise A ∪ {v} is a disjoint union and a_C = gamma_ve(G[A]), contradicting the strict inequality).
lemma exists_adj_of_gamma_ve_induce_eq_pend_ve_num_succ {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (A : Set V) [Fintype ↥A] (v : V) (hvA : v ∉ A)
(h : gamma_ve (G.induce A) = pend_ve_num G A v + 1) :
∃ x ∈ A, G.Adj v xexists_claw_free_minimal_3_factor_critical_type_ii_edgeIn LeanGraph Theory & Graph Algorithms
There exists a finite simple graph G in universe u with decidable equality and adjacency, and adjacent vertices u and v of degree at least 5, such that G is claw-free, minimal 3-factor-critical, and uv is a type II edge with parameter 3.
theorem exists_claw_free_minimal_3_factor_critical_type_ii_edge.{u} :
∃ (V : Type u) (_ : Fintype V) (_ : DecidableEq V) (G : SimpleGraph V) (_ : DecidableRel G.Adj)
(u v : V) (he : G.Adj u v) (hu : 5 ≤ G.degree u) (hv : 5 ≤ G.degree v),
IsClawFree G ∧ is_minimal_k_factor_critical G 3 ∧ is_type_ii_edge G u v 3exists_diameter_two_four_chromatic_not_mutual_visibility_colorable_threeIn LeanGraph Theory & Graph Algorithms
There is a finite connected simple graph of diameter 2 that is 4-colourable but not 3-colourable and is not mutual-visibility 3-colourable.
theorem exists_diameter_two_four_chromatic_not_mutual_visibility_colorable_three :
∃ (V : Type) (_ : Fintype V) (G : SimpleGraph V),
G.Connected ∧ G.diam = 2 ∧ G.Colorable 4 ∧ ¬ G.Colorable 3 ∧
¬ graph_is_mutual_visibility_colorable G 3exists_diameter_two_mv_chromatic_number_four_of_witnessIn LeanGraph Theory & Graph Algorithms
If there is a finite connected simple graph of diameter 2 that is 4-colourable, not 3-colourable and not mutual-visibility 3-colourable, then there is a finite connected simple graph G of diameter 2 with mutual-visibility chromatic number 4 and chromatic number 4.
theorem exists_diameter_two_mv_chromatic_number_four_of_witness
(h : ∃ (W : Type) (_ : Fintype W) (H : SimpleGraph W),
H.Connected ∧ H.diam = 2 ∧ H.Colorable 4 ∧ ¬ H.Colorable 3 ∧
¬ graph_is_mutual_visibility_colorable H 3) :
∃ (V : Type) (_ : Fintype V) (G : SimpleGraph V) (_ : DecidableRel G.Adj),
G.Connected ∧ G.diam = 2 ∧
graph_mutual_visibility_chromatic_number G = 4 ∧ G.chromaticNumber = 4exists_dist_three_cut_potential_witnessIn LeanGraph Theory & Graph Algorithms
Sharp cut certificate: in the regime |E(X,Xᶜ)| < δ(G) there are vertices x, y with d(x,y) = 3 and a 1-Lipschitz potential f with f(x) − f(y) = 3 whose neighbourhood averages satisfy 3 − A_x + A_y ≤ 2|E(X,Xᶜ)|/δ(G).
theorem exists_dist_three_cut_potential_witness
{V : Type} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hG : G.Connected) (hd : 3 ≤ G.diam) (X : Finset V)
(hX1 : X.Nonempty) (hX2 : (Xᶜ : Finset V).Nonempty)
(hk : (G.edgeFinset.filter (fun e => ∃ u ∈ X, ∃ v ∈ (Xᶜ : Finset V), e = s(u, v))).card
< G.minDegree) :
∃ (x y : V) (f : V → ℝ), G.dist x y = 3 ∧
(∀ a b : V, f a - f b ≤ (G.dist a b : ℝ)) ∧
f x - f y = 3 ∧
(3 - (∑ a ∈ G.neighborFinset x, f a) / (G.degree x : ℝ)
+ (∑ b ∈ G.neighborFinset y, f b) / (G.degree y : ℝ))
≤ 2 * ((G.edgeFinset.filter (fun e => ∃ u ∈ X, ∃ v ∈ (Xᶜ : Finset V), e = s(u, v))).card : ℝ) /
(G.minDegree : ℝ)exists_dist_three_lly_curvature_le_cutIn LeanGraph Theory & Graph Algorithms
For any finite connected graph G with diameter at least 3 and any non-trivial vertex cut (X, X^c), κ_LLY^(3)(G) ≤ 2 |E(X, X^c)| / (3 δ(G)).
theorem exists_dist_three_lly_curvature_le_cut
{V : Type} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hG : G.Connected) (hd : 3 ≤ G.diam) (X : Finset V)
(hX1 : X.Nonempty) (hX2 : (Xᶜ : Finset V).Nonempty) :
graph_lly_curvature_lower_bound G 3 ≤
(2 * ((G.edgeFinset.filter (fun e => ∃ u ∈ X, ∃ v ∈ (Xᶜ : Finset V), e = s(u, v))).card : ℝ)) /
(3 * (G.minDegree : ℝ))exists_dominated_vertex_of_false_twinsIn LeanGraph Theory & Graph Algorithms
If u and v are distinct vertices in a simple graph with identical open neighbourhoods, then v is dominated by u.
theorem exists_dominated_vertex_of_false_twins {α : Type*} (F : SimpleGraph α) (u v : α)
(huv : u ≠ v) (h : F.neighborSet u = F.neighborSet v) :
∃ u' : α, u' ≠ v ∧ F.neighborSet v ⊆ F.neighborSet u' ∪ {u'}exists_dominated_vertex_of_pendantIn LeanGraph Theory & Graph Algorithms
If a vertex v in a simple graph F has exactly one neighbour u, then u is distinct from v and the neighbourhood of v is contained in N(u) ∪ {u}.
theorem exists_dominated_vertex_of_pendant {α : Type*} (F : SimpleGraph α) (v : α)
(hv : Nat.card ↥(F.neighborSet v) = 1) :
∃ u : α, u ≠ v ∧ F.neighborSet v ⊆ F.neighborSet u ∪ {u}exists_dominated_vertex_of_pendant_or_twinIn LeanGraph Theory & Graph Algorithms
If a graph has a pendant vertex, or a pair of false twins, or a pair of true twins, then it has a vertex v dominated by another vertex u, i.e. N(v) ⊆ N(u) ∪ {u} with u ≠ v.
theorem exists_dominated_vertex_of_pendant_or_twin {α : Type*} (F : SimpleGraph α)
(h : (∃ v : α, Nat.card ↥(F.neighborSet v) = 1) ∨
(∃ u v : α, u ≠ v ∧ F.neighborSet u = F.neighborSet v) ∨
(∃ u v : α, u ≠ v ∧ F.neighborSet u ∪ {u} = F.neighborSet v ∪ {v})) :
∃ u v : α, u ≠ v ∧ F.neighborSet v ⊆ F.neighborSet u ∪ {u}exists_index_pend_delta_eq_oneIn LeanGraph Theory & Graph Algorithms
If b_i - a_i ∈ {0,1} for all i and the b_i sum to one more than the a_i, then some b_i exceeds a_i by exactly one.
lemma exists_index_pend_delta_eq_one {ι : Type*} [Fintype ι] (b a : ι → ℕ)
(hsum : ∑ i, b i = 1 + ∑ i, a i) (hle : ∀ i, a i ≤ b i) (hdelta : ∀ i, b i ≤ a i + 1) :
∃ i, b i = a i + 1exists_pend_ve_num_eq_gamma_ve_add_oneIn LeanGraph Theory & Graph Algorithms
Under the hypotheses gamma_ve(G - v) = gamma_ve(G), gamma_ve(G) = 1 + sum of a_C, and a_C ≤ b_C ≤ a_C + 1 for every component, there is a component C with b_C = a_C + 1.
theorem exists_pend_ve_num_eq_gamma_ve_add_one {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (v : V)
[Fintype ↥({v}ᶜ : Set V)]
[∀ C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent, Fintype ↥(ve_comp_part G v C)]
(hgamma : gamma_ve (G.induce ({v}ᶜ : Set V)) = gamma_ve G)
(hsum : gamma_ve G = 1 + ∑ C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent,
pend_ve_num G (ve_comp_part G v C) v)
(hbound : ∀ C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent,
gamma_ve (G.induce (ve_comp_part G v C)) ≤ pend_ve_num G (ve_comp_part G v C) v + 1) :
∃ C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent,
gamma_ve (G.induce (ve_comp_part G v C)) = pend_ve_num G (ve_comp_part G v C) v + 1exists_three_universal_tournament_fourIn LeanGraph Theory & Graph Algorithms
There exists a 3-universal tournament on 4 vertices.
theorem exists_three_universal_tournament_four :
∃ (T : Digraph (Fin 4)), digraph_is_tournament T ∧ tournament_is_universal 3 Texists_unique_ve_comp_partIn LeanGraph Theory & Graph Algorithms
Every vertex different from v lies in exactly one component part of G - v.
lemma exists_unique_ve_comp_part {V : Type*} (G : SimpleGraph V) (v : V) {x : V} (hx : x ≠ v) :
∃! C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent, x ∈ ve_comp_part G v Cexists_ve_dominates_inside_card_eq_gamma_ve_induceIn LeanGraph Theory & Graph Algorithms
Every vertex set A has a set S contained in A, ve-dominating all edges of G with both endpoints in A, with |S| = gamma_ve(G[A]).
lemma exists_ve_dominates_inside_card_eq_gamma_ve_induce {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (A : Set V) [Fintype ↥A] :
∃ S : Finset V, (S : Set V) ⊆ A ∧ ve_dominates_inside G (S : Set V) A ∧
S.card = gamma_ve (G.induce A)exists_ve_dominating_card_eq_gamma_veIn LeanGraph Theory & Graph Algorithms
Every finite simple graph has a vertex-edge dominating set whose cardinality is exactly gamma_ve(G).
lemma exists_ve_dominating_card_eq_gamma_ve {V : Type*} [Fintype V] (G : SimpleGraph V) :
∃ S : Finset V, is_ve_dominating G (S : Set V) ∧ S.card = gamma_ve Gexists_ve_dominating_card_eq_gamma_ve_avoidingIn LeanGraph Theory & Graph Algorithms
If gamma_ve(G - v) = gamma_ve(G), the components C of G - v have pendant parameters with gamma_ve(G[C]) = a_C + 1 for one C, and the unique neighbour u in C is as given, then G has a minimum vertex-edge dominating set avoiding v.
theorem exists_ve_dominating_card_eq_gamma_ve_avoiding {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (v : V)
[Fintype ↥({v}ᶜ : Set V)]
[∀ C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent, Fintype ↥(ve_comp_part G v C)]
(hgamma : gamma_ve (G.induce ({v}ᶜ : Set V)) = gamma_ve G)
(C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent) (u : V)
(hadj : G.Adj v u) (humem : u ∈ ve_comp_part G v C)
(huniq : ∀ x : V, x ∈ ve_comp_part G v C → G.Adj v x → x = u)
(heq : gamma_ve (G.induce (ve_comp_part G v C)) = pend_ve_num G (ve_comp_part G v C) v + 1) :
∃ S : Finset V, is_ve_dominating G (S : Set V) ∧ S.card = gamma_ve G ∧ v ∉ Sexposed_singleton_new_pair_is_fortIn LeanGraph Theory & Graph Algorithms
In any finite graph rooted at r, if singleton t is root-exposed, singletons p and q are not, and the pair p,q is root-exposed, then t,p,q form a fort.
theorem exposed_singleton_new_pair_is_fort {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (r t p q : V) (htp : t ≠ p) (htq : t ≠ q) (hpq : p ≠ q) (ht : zero_forcing_root_exposed_fort G r ({t} : Finset V)) (hp : ¬ zero_forcing_root_exposed_fort G r ({p} : Finset V)) (hq : ¬ zero_forcing_root_exposed_fort G r ({q} : Finset V)) (hpair : zero_forcing_root_exposed_fort G r ({p,q} : Finset V)) : simple_graph_is_fort G ({t,p,q} : Set V)fall_coloring_eq_of_eq_neighborSetIn LeanGraph Theory & Graph Algorithms
In a fall colouring with three colours, two vertices with the same open neighbourhood receive the same colour.
theorem fall_coloring_eq_of_eq_neighborSet {V α : Type*} [Fintype α] (hα : Fintype.card α = 3)
{G : SimpleGraph V} (c : G.Coloring α)
(hc : ∀ v, ⇑c '' insert v (G.neighborSet v) = Set.univ)
{v w : V} (h : G.neighborSet v = G.neighborSet w) : c v = c wfall_coloring_neighbor_image_eq_complIn LeanGraph Theory & Graph Algorithms
If a proper colouring c of G with a 3-element colour type is a fall colouring (every closed neighbourhood shows all colours), then for every vertex v the colours appearing on the open neighbourhood of v are exactly the colours other than c v.
theorem fall_coloring_neighbor_image_eq_compl {V α : Type*} [Fintype α] (hα : Fintype.card α = 3)
{G : SimpleGraph V} (c : G.Coloring α)
(hc : ∀ v, ⇑c '' insert v (G.neighborSet v) = Set.univ) (v : V) :
⇑c '' G.neighborSet v = {c v}ᶜfin3_eq_of_ne_of_neIn LeanGraph Theory & Graph Algorithms
Two elements of a 3-element set that both avoid two given distinct elements a ≠ b must be equal.
theorem fin3_eq_of_ne_of_ne {a b w w' : Fin 3} (hab : a ≠ b) (h1 : w ≠ a) (h2 : w ≠ b)
(h3 : w' ≠ a) (h4 : w' ≠ b) : w = w'fin3_pair_eq_complIn LeanGraph Theory & Graph Algorithms
If a two-element subset {x,y} of a 3-element set is the complement of the singleton {z}, then x ≠ y.
theorem fin3_pair_eq_compl {x y z : Fin 3} (h : ({x, y} : Set (Fin 3)) = {z}ᶜ) : x ≠ yfin_sub_val_eq_one_iffIn LeanGraph Theory & Graph Algorithms
For n ≥ 2 and a, b : Fin n, the value of the difference a - b is 1 exactly when a.val = b.val + 1, or a.val = 0 and b.val = n - 1 (the wraparound case).
theorem fin_sub_val_eq_one_iff {n : ℕ} (hn : 2 ≤ n) (a b : Fin n) :
(a - b).val = 1 ↔ a.val = b.val + 1 ∨ (a.val = 0 ∧ b.val = n - 1)finite_binary_three_packing_exists_line_free_independent_tripleIn LeanGraph Theory & Graph Algorithms
In a finite binary geometry with a maximal 3-packing P having at most 1 singly forced point per line, there exists a 3-point independent set in the conflict graph on the packing support that is line-free and avoids all singly forced points.
theorem finite_binary_three_packing_exists_line_free_independent_triple
(n : ℕ) (S : Finset (Fin n → ZMod 2))
(F P : Finset (Finset (Fin n → ZMod 2)))
(hzero : 0 ∉ S)
(hF : ∀ t : Finset (Fin n → ZMod 2),
t ∈ F ↔ t ⊆ S ∧ t.card = 3 ∧ t.sum id = 0)
(hsub : P ⊆ F) (hPcard : P.card = 3)
(hpack : (P : Set (Finset (Fin n → ZMod 2))).Pairwise Disjoint)
(hmaximal : ∀ t ∈ F, ¬ Disjoint (P.biUnion id) t)
(hforced : ∀ p ∈ P,
(((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id) ∩ p).card ≤ 1) :
∃ I : Finset (Fin n → ZMod 2),
I ⊆ P.biUnion id ∧ I.card = 3 ∧
(∀ t ∈ F, (t ∩ P.biUnion id).card = 1 → Disjoint I t) ∧
(∀ x ∈ I, ∀ y ∈ I, x ≠ y → x + y ∉ S \ P.biUnion id) ∧
(∀ t ∈ F, ¬ t ⊆ I)finite_binary_three_packing_supported_coverIn LeanGraph Theory & Graph Algorithms
In any finite binary geometry, if three pairwise disjoint lines form a maximal packing and at most one point on each line is singly forced relative to the packing support, there is a six-point cover contained in that support.
theorem finite_binary_three_packing_supported_cover
(n : ℕ) (S : Finset (Fin n → ZMod 2))
(F P : Finset (Finset (Fin n → ZMod 2)))
(hzero : 0 ∉ S)
(hF : ∀ t : Finset (Fin n → ZMod 2),
t ∈ F ↔ t ⊆ S ∧ t.card = 3 ∧ t.sum id = 0)
(hsub : P ⊆ F) (hPcard : P.card = 3)
(hpack : (P : Set (Finset (Fin n → ZMod 2))).Pairwise Disjoint)
(hmaximal : ∀ t ∈ F, ¬ Disjoint (P.biUnion id) t)
(hforced : ∀ p ∈ P,
(((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id) ∩ p).card ≤ 1) :
∃ C : Finset (Fin n → ZMod 2), C ⊆ P.biUnion id ∧ C.card ≤ 6 ∧
∀ t ∈ F, ¬ Disjoint C tfinite_family_lexicographic_cover_two_private_setsIn LeanGraph Theory & Graph Algorithms
Let H be a cover of a finite set family. If C minimizes cover size and, subject to that, minimizes its number of points outside H, then every point in C outside H is the unique C-point of at least two distinct family members.
theorem finite_family_lexicographic_cover_two_private_sets
{α : Type*} [DecidableEq α] (F : Finset (Finset α)) (H C : Finset α)
(hH : ∀ t ∈ F, ¬ Disjoint H t)
(hC : ∀ t ∈ F, ¬ Disjoint C t)
(hlex : ∀ D : Finset α, (∀ t ∈ F, ¬ Disjoint D t) →
C.card ≤ D.card ∧ (D.card = C.card → (C \ H).card ≤ (D \ H).card)) :
∀ x ∈ C \ H, ∃ A ∈ F, ∃ B ∈ F,
A ≠ B ∧ A ∩ C = {x} ∧ B ∩ C = {x}finite_vertex_set_edge_encoding_cardIn LeanGraph Theory & Graph Algorithms
A finite vertex set of size n spans exactly C(n,2) non-diagonal unordered pairs.
theorem finite_vertex_set_edge_encoding_card {V : Type*} [DecidableEq V] (s : Finset V) :
(finite_vertex_set_edge_encoding s).card = s.card.choose 2finset_exists_injective_fin_of_cardIn LeanGraph Theory & Graph Algorithms
Given a finite set Q of vertices, a vertex q in Q, and natural numbers 1 ≤ s ≤ |Q|, there is an injective s-tuple of vertices all drawn from Q whose first entry is q.
theorem finset_exists_injective_fin_of_card {V : Type*} [DecidableEq V] {Q : Finset V} {q : V} (hq : q ∈ Q)
{s : ℕ} (hs : 0 < s) (hcard : s ≤ Q.card) :
∃ f : Fin s → V, Function.Injective f ∧ f ⟨0, hs⟩ = q ∧ ∀ i, f i ∈ Qfinset_prod_Iic_fin_succIn LeanGraph Theory & Graph Algorithms
For c : Fin d → ℕ and indices i, ip : Fin d with i.val = ip.val + 1, the product of c over Iic i equals the product over Iic ip times c i.
theorem finset_prod_Iic_fin_succ {d : ℕ} (c : Fin d → ℕ) (ip i : Fin d)
(hs : i.val = ip.val + 1) :
∏ j ∈ Finset.Iic i, c j = (∏ j ∈ Finset.Iic ip, c j) * c ifinset_sum_desc_factorial_threeIn LeanGraph Theory & Graph Algorithms
For any finite set s and real-valued function X on s, the third falling factorial (sum X)_3 = (sum X)(sum X - 1)(sum X - 2) expands into the sum of (X_b)_3 over s, plus 3 times the sum of (X_a)_2 * X_b over distinct pairs (a,b), plus the sum of X_a * X_b * X_c over distinct triples (a,b,c).
theorem finset_sum_desc_factorial_three {β : Type*} [DecidableEq β] (s : Finset β) (X : β → ℝ) :
(∑ b ∈ s, X b) * ((∑ b ∈ s, X b) - 1) * ((∑ b ∈ s, X b) - 2) =
(∑ b ∈ s, X b * (X b - 1) * (X b - 2)) +
3 * (∑ a ∈ s, ∑ b ∈ s \ {a}, X a * (X a - 1) * X b) +
(∑ a ∈ s, ∑ b ∈ s \ {a}, ∑ c ∈ (s \ {a}) \ {b}, X a * X b * X c)finset_sum_iio_castLE_sub_oneIn LeanGraph Theory & Graph Algorithms
For any sequence a, the sum of a(i) - 1 over i < k in Fin m equals the sum of a(i) - 1 over i < j in Fin t when k and j have the same natural number value and m ≤ t.
theorem finset_sum_iio_castLE_sub_one
(t m : ℕ) (hmt : m ≤ t) (a : Fin t → ℕ) (j : Fin t) (k : Fin m) (hjk : (j : ℕ) = (k : ℕ)) :
∑ i ∈ Finset.Iio k, (a (Fin.castLE hmt i) - 1) = ∑ i ∈ Finset.Iio j, (a i - 1)finset_transversal_number_le_cardIn LeanGraph Theory & Graph Algorithms
For any finite collection C of subsets of a finite set V, the transversal number tau(C) is at most the cardinality of V.
theorem finset_transversal_number_le_card {V : Type*} [Fintype V] [DecidableEq V]
(C : Finset (Finset V)) :
finset_transversal_number C ≤ Fintype.card Vforall_power_well_covered_iff_forall_lt_diamIn LeanGraph Theory & Graph Algorithms
For any finite connected graph G, all powers G^d (d ≥ 1) are well-covered if and only if G^d is well-covered for all 1 ≤ d < diam(G).
theorem forall_power_well_covered_iff_forall_lt_diam {V : Type*} [Fintype V] (G : SimpleGraph V) (hconn : G.Connected) : (∀ d : ℕ, 1 ≤ d → simple_graph_is_well_covered (simple_graph_power G d)) ↔ (∀ d : ℕ, 1 ≤ d → d < G.diam → simple_graph_is_well_covered (simple_graph_power G d))forall_power_well_covered_of_diam_le_oneIn LeanGraph Theory & Graph Algorithms
Every finite connected simple graph of diameter at most 1 has the well-covered powers property (its positive integer powers are complete graphs or trivial, so all maximal independent sets have size 1).
theorem forall_power_well_covered_of_diam_le_one
{V : Type*} [Fintype V] (G : SimpleGraph V)
(hG : G.Connected) (hdG : G.diam ≤ 1) :
simple_graph_has_well_covered_powers Gforest_single_exposure_cross_edges_leIn LeanGraph Theory & Graph Algorithms
In a finite forest G with a root-exposed fort F incident to exactly one edge from r, the number of cross edges between F and Fᶜ is at most 2c - 1, where c is the number of connected components of G[F].
open scoped Classical in
theorem forest_single_exposure_cross_edges_le
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hG : G.IsAcyclic) (r : V) (F : Finset V) (hr : r ∉ F)
(hone : (F.filter (fun v => G.Adj r v)).card = 1)
(hfort : ∀ u : V, u ≠ r → u ∉ F → ∀ w : V, w ∈ F → G.Adj u w → ∃ x : V, x ∈ F ∧ G.Adj u x ∧ x ≠ w) :
(∑ u ∈ Fᶜ, (F.filter (fun v => G.Adj u v)).card) ≤
2 * Fintype.card (G.induce (F : Set V)).ConnectedComponent - 1gamma_ve_eq_one_add_sum_pend_ve_numIn LeanGraph Theory & Graph Algorithms
If v belongs to every minimum vertex-edge dominating set of G, then gamma_ve(G) = 1 + the sum over the connected components C of G - v of a_C.
theorem gamma_ve_eq_one_add_sum_pend_ve_num {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (v : V)
[Fintype ↥({v}ᶜ : Set V)]
[∀ C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent, Fintype ↥(ve_comp_part G v C)]
(hfix : ∀ S : Finset V, is_ve_dominating G (S : Set V) → S.card = gamma_ve G → v ∈ S) :
gamma_ve G = 1 + ∑ C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent,
pend_ve_num G (ve_comp_part G v C) vgamma_ve_induce_eq_sum_of_closed_partitionIn LeanGraph Theory & Graph Algorithms
If A is partitioned into parts P i closed under adjacency of G (no edge inside A leaves its part), then gamma_ve(G[A]) equals the sum over i of gamma_ve(G[P i]).
theorem gamma_ve_induce_eq_sum_of_closed_partition {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) {A : Set V} [Fintype ↥A] {ι : Type*} [Fintype ι] (P : ι → Set V)
[∀ i, Fintype ↥(P i)]
(hsub : ∀ i, P i ⊆ A)
(hcover : ∀ x : V, x ∈ A → ∃! i : ι, x ∈ P i)
(hclosed : ∀ (i : ι) ⦃x y : V⦄, G.Adj x y → x ∈ A → y ∈ A → (x ∈ P i ↔ y ∈ P i)) :
gamma_ve (G.induce A) = ∑ i, gamma_ve (G.induce (P i))gamma_ve_induce_le_card_of_ve_dominates_insideIn LeanGraph Theory & Graph Algorithms
If a finite vertex set S is contained in A and ve-dominates every edge of G with both endpoints in A, then gamma_ve(G[A]) ≤ |S|.
lemma gamma_ve_induce_le_card_of_ve_dominates_inside {V : Type*} [Fintype V] (G : SimpleGraph V)
(A : Set V) [Fintype ↥A] (S : Finset V) (hSA : (S : Set V) ⊆ A)
(hdom : ve_dominates_inside G (S : Set V) A) :
gamma_ve (G.induce A) ≤ S.cardgamma_ve_induce_le_pend_ve_num_add_oneIn LeanGraph Theory & Graph Algorithms
If v has at most one neighbour u in A, then gamma_ve(G[A]) ≤ a_C + 1: restrict a minimum vertex-edge dominating set of A ∪ {v} to A and, if it used v, replace v by u.
lemma gamma_ve_induce_le_pend_ve_num_add_one {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (A : Set V) [Fintype ↥A] (v u : V) (hvA : v ∉ A)
(huniq : ∀ x : V, x ∈ A → G.Adj v x → x = u) :
gamma_ve (G.induce A) ≤ pend_ve_num G A v + 1gamma_ve_le_card_of_ve_dominatingIn LeanGraph Theory & Graph Algorithms
Any vertex-edge dominating set of a finite simple graph has cardinality at least gamma_ve(G).
lemma gamma_ve_le_card_of_ve_dominating {V : Type*} [Fintype V] (G : SimpleGraph V) (S : Finset V)
(hS : is_ve_dominating G (S : Set V)) : gamma_ve G ≤ S.cardgeneralized_kneser_chromatic_ge_fourteenIn LeanGraph Theory & Graph Algorithms
For every natural number n ≥ 5, the chromatic number of the generalized Kneser graph KG(2n, n, 3) is at least 14.
theorem generalized_kneser_chromatic_ge_fourteen (n : ℕ) (hn : 5 ≤ n) :
14 ≤ (generalized_kneser_graph n 3).chromaticNumbergeneralized_kneser_four_three_chromatic_ge_fourteenIn LeanGraph Theory & Graph Algorithms
The chromatic number of the generalized Kneser graph KG(8, 4, 3) is at least 14.
theorem generalized_kneser_four_three_chromatic_ge_fourteen :
14 ≤ (generalized_kneser_graph 4 3).chromaticNumbergeneralized_kneser_four_three_chromatic_le_fourteenIn LeanGraph Theory & Graph Algorithms
The chromatic number of the generalized Kneser graph KG(8, 4, 3) is at most 14.
theorem generalized_kneser_four_three_chromatic_le_fourteen :
(generalized_kneser_graph 4 3).chromaticNumber ≤ 14generalized_kneser_graph_chromaticNumber_of_leIn LeanGraph Theory & Graph Algorithms
If n ≤ r then the chromatic number of KG(2n, n, r) equals its number of vertices C(2n, n). In particular χ(KG(4,2,3)) = 6 and χ(KG(6,3,3)) = 20, and the chromatic number is finite in this range.
theorem generalized_kneser_graph_chromaticNumber_of_le (n r : ℕ) (h : n ≤ r) :
(generalized_kneser_graph n r).chromaticNumber = ((2 * n).choose n : ℕ∞)generalized_kneser_graph_cliqueFree_threeIn LeanGraph Theory & Graph Algorithms
For n ≥ 7 the generalized Kneser graph KG(2n, n, 3) contains no triangle: three vertices would be n-element subsets with pairwise intersections of size at most 2, so their union would have at least 3n - 6 > 2n elements, which is impossible inside Fin (2n).
theorem generalized_kneser_graph_cliqueFree_three (n : ℕ) (hn : 7 ≤ n) :
(generalized_kneser_graph n 3).CliqueFree 3generalized_kneser_graph_colorable_iffIn LeanGraph Theory & Graph Algorithms
KG(2n, n, r) admits a proper colouring with k colours if and only if there is a map c from its vertices to Fin k such that any two distinct n-element subsets with the same colour intersect in at least r elements. Equivalently, χ(KG(2n, n, r)) ≤ k iff the vertex set can be partitioned into k r-intersecting families.
theorem generalized_kneser_graph_colorable_iff (n r k : ℕ) :
(generalized_kneser_graph n r).Colorable k ↔
∃ c : {s : Finset (Fin (2 * n)) // s.card = n} → Fin k,
∀ a b, a ≠ b → c a = c b → r ≤ (a.1 ∩ b.1).cardgeneralized_kneser_graph_eq_top_of_leIn LeanGraph Theory & Graph Algorithms
If n ≤ r then the generalized Kneser graph KG(2n, n, r) is the complete graph on its vertex type: two distinct n-element subsets of a 2n-set intersect in at most n - 1 < r elements, so every two distinct vertices are adjacent. In particular KG(2n, n, n) is complete.
theorem generalized_kneser_graph_eq_top_of_le (n r : ℕ) (h : n ≤ r) :
generalized_kneser_graph n r = ⊤generalized_kneser_graph_exists_nonadjacentIn LeanGraph Theory & Graph Algorithms
For n ≥ 4 the generalized Kneser graph KG(2n, n, 3) is not complete: there are two distinct vertices that are not adjacent, namely an n-element subset and the n-element subset obtained from it by exchanging one element, whose intersection has n - 1 ≥ 3 elements.
theorem generalized_kneser_graph_exists_nonadjacent (n : ℕ) (hn : 4 ≤ n) :
∃ s t : {s : Finset (Fin (2 * n)) // s.card = n},
s ≠ t ∧ ¬ (generalized_kneser_graph n 3).Adj s tgeneralized_kneser_graph_hom_of_leIn LeanGraph Theory & Graph Algorithms
For any natural numbers c, m, n with c + 1 ≤ m and m ≤ n, there exists a graph homomorphism from the generalized Kneser graph KG(2n, n, c + 1) to the generalized Kneser graph KG(2m, m, c + 1).
theorem generalized_kneser_graph_hom_of_le (c : ℕ) {m n : ℕ} (hcm : c + 1 ≤ m) (hmn : m ≤ n) :
Nonempty (generalized_kneser_graph n (c + 1) →g generalized_kneser_graph m (c + 1))generalized_kneser_graph_hom_stepIn LeanGraph Theory & Graph Algorithms
For any natural numbers c and k with c + 2 ≤ k, there exists a graph homomorphism from the generalized Kneser graph KG(2k, k, c + 1) to the generalized Kneser graph KG(2(k - 1), k - 1, c + 1).
theorem generalized_kneser_graph_hom_step (c : ℕ) {k : ℕ} (hk : c + 2 ≤ k) :
Nonempty (generalized_kneser_graph k (c + 1) →g generalized_kneser_graph (k - 1) (c + 1))generalized_kneser_graph_isIndepSet_iffIn LeanGraph Theory & Graph Algorithms
A set S of vertices of KG(2n, n, r) is independent if and only if any two distinct members of S intersect in at least r elements, i.e. S is an r-intersecting family of n-element subsets of Fin (2n).
theorem generalized_kneser_graph_isIndepSet_iff (n r : ℕ)
(S : Set {s : Finset (Fin (2 * n)) // s.card = n}) :
(generalized_kneser_graph n r).IsIndepSet S ↔
∀ a ∈ S, ∀ b ∈ S, a ≠ b → r ≤ (a.1 ∩ b.1).cardgeneralized_kneser_graph_mono_rIn LeanGraph Theory & Graph Algorithms
The generalized Kneser graphs are monotone in the intersection threshold: if r ≤ r' then KG(2n, n, r) is a subgraph of KG(2n, n, r'), because raising the threshold can only turn non-adjacent vertices into adjacent ones.
theorem generalized_kneser_graph_mono_r (n : ℕ) {r r' : ℕ} (h : r ≤ r') :
generalized_kneser_graph n r ≤ generalized_kneser_graph n r'geodesic_card_eq_c_mulIn LeanGraph Theory & Graph Algorithms
Let G be distance-regular with parameters d, b, c, let u, v be at distance i + 1, and suppose that every vertex w adjacent to v with dist(u, w) = i carries exactly N geodesics from u. Then the number of geodesics from u to v equals c(i) · N.
theorem geodesic_card_eq_c_mul {V : Type*} [Fintype V] (G : SimpleGraph V) (d : ℕ)
(b c : Fin d → ℕ) (hG : is_distance_regular_with G d b c) (i : Fin d) (u v : V)
(hdist : G.dist u v = i.val + 1) (N : ℕ)
(hN : ∀ w : V, G.Adj v w → G.dist u w = i.val →
Nat.card {q : G.Walk u w // is_geodesic q} = N) :
Nat.card {p : G.Walk u v // is_geodesic p} = c i * Ngeodesic_count_dist_oneIn LeanGraph Theory & Graph Algorithms
If dist(u, v) = 1 then there is exactly one geodesic from u to v, namely the walk consisting of the single edge uv.
theorem geodesic_count_dist_one {V : Type*} (G : SimpleGraph V) (u v : V)
(h : G.dist u v = 1) : Nat.card {p : G.Walk u v // is_geodesic p} = 1geodesic_fiber_card_eqIn LeanGraph Theory & Graph Algorithms
Let u, v be at distance k ≥ 1 and let w be a neighbour of v with dist(u, w) = k − 1. Then the geodesics from u to v whose penultimate vertex is w are in bijection with the geodesics from u to w; in particular the two cardinalities agree.
theorem geodesic_fiber_card_eq {V : Type*} (G : SimpleGraph V) {u v w : V} {k : ℕ}
(hv : G.dist u v = k) (hk : 1 ≤ k) (hw : G.Adj v w) (hkw : G.dist u w = k - 1) :
Nat.card {p : G.Walk u v // is_geodesic p ∧ p.penultimate = w}
= Nat.card {q : G.Walk u w // is_geodesic q}geodesic_penultimate_adj_distIn LeanGraph Theory & Graph Algorithms
If p is a geodesic walk from u to v in G of length k ≥ 1, then the penultimate vertex of p is adjacent to v and is at distance k − 1 from u.
theorem geodesic_penultimate_adj_dist {V : Type*} (G : SimpleGraph V) {u v : V} {k : ℕ}
{p : G.Walk u v} (hp : is_geodesic p) (hlen : p.length = k) (hk : 1 ≤ k) :
G.Adj p.penultimate v ∧ G.dist u p.penultimate = k - 1ghz_cycle_list_adj_nextIn LeanGraph Theory & Graph Algorithms
In a cycle list, every vertex is adjacent to its cyclic successor.
theorem ghz_cycle_list_adj_next {V : Type*} {G : SimpleGraph V} {l : List V} (hl : ghz_cycle_list G l)
(i : Fin l.length) :
G.Adj (l.get i) (l.get ⟨(i.1 + 1) % l.length, Nat.mod_lt _ (by have := i.2; omega)⟩)ghz_cycle_list_exists_isCycleIn LeanGraph Theory & Graph Algorithms
A cycle list of length n yields a closed walk which is a cycle (Walk.IsCycle) of length n.
theorem ghz_cycle_list_exists_isCycle {V : Type*} [DecidableEq V] {G : SimpleGraph V} {l : List V}
(h : ghz_cycle_list G l) : ∃ u : V, ∃ p : G.Walk u u, p.IsCycle ∧ p.length = l.lengthghz_cycle_list_not_length_twoIn LeanGraph Theory & Graph Algorithms
The two-element list [0,1] is not a cycle list — a negative witness distinguishing the definition from mere paths.
theorem ghz_cycle_list_not_length_two : ¬ ghz_cycle_list (⊤ : SimpleGraph (Fin 3)) [0,1]
ghz_cycle_list_top_threeIn LeanGraph Theory & Graph Algorithms
The list [0,1,2] is a cycle list of the complete graph on Fin 3 — a positive witness that ghz_cycle_list is inhabited.
theorem ghz_cycle_list_top_three : ghz_cycle_list (⊤ : SimpleGraph (Fin 3)) [0,1,2]
ghz_enat_add_one_le_natIn LeanGraph Theory & Graph Algorithms
For naturals a and b, if a plus one is at most b once both are read as extended naturals, then a plus one is at most b as naturals.
theorem ghz_enat_add_one_le_nat (a b : ℕ) (h : (a : ℕ∞) + 1 ≤ (b : ℕ∞)) : a + 1 ≤ b
ghz_exists_component_outsideIn LeanGraph Theory & Graph Algorithms
For a vertex x off a list l, the vertex set H of the connected component of G − l containing x is a non-empty set of vertices off l, inducing a preconnected subgraph, and closed under neighbours outside l.
theorem ghz_exists_component_outside {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(l : List V) (x : V) (hx : x ∉ l) :
∃ H : Finset V, x ∈ H ∧ Disjoint H l.toFinset ∧ (G.induce ((H : Set V))).Preconnected ∧
∀ u ∈ H, ∀ w : V, G.Adj u w → w ∉ l.toFinset → w ∈ Hghz_exists_cycle_list_of_two_connectedIn LeanGraph Theory & Graph Algorithms
A 2-connected graph on at least three vertices contains a cycle, exhibited as a cycle list.
theorem ghz_exists_cycle_list_of_two_connected {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (hV : 3 ≤ Fintype.card V) (hconn : G.Preconnected)
(h2 : ∀ v : V, (G.induce ({v}ᶜ : Set V)).Preconnected) :
∃ l : List V, ghz_cycle_list G lghz_exists_longest_cycle_listIn LeanGraph Theory & Graph Algorithms
If the graph has at least one cycle list, then it has a cycle list of maximum length.
theorem ghz_exists_longest_cycle_list {V : Type*} (G : SimpleGraph V)
(h : ∃ l : List V, ghz_cycle_list G l) :
∃ l : List V, ghz_cycle_list G l ∧ ∀ l' : List V, ghz_cycle_list G l' → l'.length ≤ l.lengthghz_exists_path_through_finsetIn LeanGraph Theory & Graph Algorithms
If H induces a preconnected subgraph, H is disjoint from S, a ∉ H is adjacent to a vertex of H, and b ≠ a is either in H or adjacent to a vertex of H, then there is a path from a to b whose internal vertices lie outside S.
theorem ghz_exists_path_through_finset {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(H S : Finset V) (hH : (G.induce ((H : Set V))).Preconnected)
(hHS : Disjoint H S) {a b : V} (ha : a ∉ H) (hab : a ≠ b)
(haH : ∃ h ∈ H, G.Adj a h) (hbH : b ∈ H ∨ ∃ h ∈ H, G.Adj b h) :
∃ Q : G.Walk a b, Q.IsPath ∧ ∀ w ∈ Q.support.tail.dropLast, w ∉ Sghz_isHamiltonian_of_cycle_lengthIn LeanGraph Theory & Graph Algorithms
If a finite graph has a cycle (Walk.IsCycle closed walk) of length equal to the number of vertices, it is Hamiltonian.
theorem ghz_isHamiltonian_of_cycle_length {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(h : ∃ u : V, ∃ p : G.Walk u u, p.IsCycle ∧ p.length = Fintype.card V) :
G.IsHamiltonianghz_no_chord_between_nextsIn LeanGraph Theory & Graph Algorithms
Let l be a longest cycle list and Q a path of length at least two between two distinct cycle vertices l[i], l[j] with internal vertices off the cycle. Then the cyclic successors of l[i] and l[j] are not adjacent.
theorem ghz_no_chord_between_nexts {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
{l : List V} (hl : ghz_cycle_list G l)
(hmax : ∀ l' : List V, ghz_cycle_list G l' → l'.length ≤ l.length)
(i j : Fin l.length) (hij : i ≠ j)
(Q : G.Walk (l.get i) (l.get j)) (hQp : Q.IsPath)
(hQ : ∀ w ∈ Q.support.tail.dropLast, w ∉ l) (hlen : 2 ≤ Q.length) :
¬ G.Adj (l.get ⟨(i.1 + 1) % l.length, Nat.mod_lt _ (by have := i.2; omega)⟩)
(l.get ⟨(j.1 + 1) % l.length, Nat.mod_lt _ (by have := j.2; omega)⟩)ghz_no_outside_path_to_nextIn LeanGraph Theory & Graph Algorithms
Let l be a longest cycle list of G. If v = l[i] has cyclic successor u and there is a path of length at least two from v to u with all internal vertices off the cycle, then l was not longest.
theorem ghz_no_outside_path_to_next {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
{l : List V} (hl : ghz_cycle_list G l)
(hmax : ∀ l' : List V, ghz_cycle_list G l' → l'.length ≤ l.length)
(i : Fin l.length)
(Q : G.Walk (l.get i) (l.get ⟨(i.1 + 1) % l.length, Nat.mod_lt _ (by have := i.2; omega)⟩))
(hQp : Q.IsPath) (hQ : ∀ w ∈ Q.support.tail.dropLast, w ∉ l) (hlen : 2 ≤ Q.length) : Falseghz_vertex_connectivity_le_induce_compl_universal_succIn LeanGraph Theory & Graph Algorithms
Deleting a universal vertex lowers the vertex connectivity by at most one: if u is adjacent to every other vertex, then kappa(G) <= kappa(G - u) + 1.
theorem ghz_vertex_connectivity_le_induce_compl_universal_succ {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (u : V) (hu : ∀ w : V, w ≠ u → G.Adj u w) : ghz_graph_vertex_connectivity G ≤ ghz_graph_vertex_connectivity (G.induce {v : V | v ≠ u}) + 1graceful_supertree_size_bound_via_diamIn LeanGraph Theory & Graph Algorithms
Let V be a finite nonempty type and T a simple graph on V that is a tree with at least 1 edge (1 ≤ Nat.card T.edgeSet). Then the graceful supertree size of T satisfies all three bounds: (1) graceful_supertree_size T ≤ 2 * Nat.card T.edgeSet - T.diam; (2) if 2 ≤ Nat.card T.edgeSet, then graceful_supertree_size T ≤ 2 * Nat.card T.edgeSet - 2; and (3) if T is not a star graph (that is, ¬ ∃ r : V, T = SimpleGraph.starGraph r), then graceful_supertree_size T ≤ 2 * Nat.card T.edgeSet - 3.
theorem graceful_supertree_size_bound_via_diam {V : Type*} [Fintype V] [Nonempty V] (T : SimpleGraph V) (hT : T.IsTree) (hm : 1 ≤ Nat.card T.edgeSet) : graceful_supertree_size T ≤ 2 * Nat.card T.edgeSet - T.diam ∧ (2 ≤ Nat.card T.edgeSet → graceful_supertree_size T ≤ 2 * Nat.card T.edgeSet - 2) ∧ (¬ (∃ r : V, T = SimpleGraph.starGraph r) → graceful_supertree_size T ≤ 2 * Nat.card T.edgeSet - 3)graph_128_near_extremal_three_coloringIn LeanGraph Theory & Graph Algorithms
Every four-clique-free graph on 128 vertices with at least 5421 edges has a proper three-coloring.
theorem graph_128_near_extremal_three_coloring (G : SimpleGraph (Fin 128)) [DecidableRel G.Adj] (hf : G.CliqueFree 4) (he : 5421 ≤ G.edgeFinset.card) : G.Colorable 3
graph_admits_involutory_weighted_adj_matrix_top_twoIn LeanGraph Theory & Graph Algorithms
The complete graph on 2 vertices (top on Fin 2) admits an involutory weighted adjacency matrix over the rational numbers Q.
theorem graph_admits_involutory_weighted_adj_matrix_top_two :
graph_admits_involutory_weighted_adj_matrix (⊤ : SimpleGraph (Fin 2)) ℚgraph_clique_free_near_extremal_coloringIn LeanGraph Theory & Graph Algorithms
For s at least two and n at least 2s+1, an n-vertex graph without an (s+1)-clique is s-colorable if it is within floor(n/s)−2 edges of the maximum for such a graph.
theorem graph_clique_free_near_extremal_coloring
(n s : ℕ) (hs : 2 ≤ s) (hn : 2 * s + 1 ≤ n)
(G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(hf : G.CliqueFree (s + 1))
(he : (SimpleGraph.turanGraph n s).edgeFinset.card + 2 ≤ G.edgeFinset.card + n / s) :
G.Colorable sgraph_color_sets_card_eq_sq_imp_star_complIn LeanGraph Theory & Graph Algorithms
Let G be a noncomplete simple graph on a finite vertex type V with |V| ≥ 2, and let L be an admissible |V|-list assignment realizing exactly |V|^2 distinct color sets. Then all edges of Gᶜ have a common endpoint.
theorem graph_color_sets_card_eq_sq_imp_star_compl {V : Type*} [Fintype V]
(G : SimpleGraph V) (h_noncomplete : G ≠ ⊤) (hn : 2 ≤ Fintype.card V)
(L : V → Finset ℕ) (hL : is_admissible_list_assignment G (Fintype.card V) L)
(hcard : (graph_color_sets G L).card = (Fintype.card V) ^ 2) :
∃ c : V, ∀ u v : V, Gᶜ.Adj u v → u = c ∨ v = cgraph_color_sets_card_ge_sq_of_star_complIn LeanGraph Theory & Graph Algorithms
Let G be a noncomplete simple graph on a finite vertex type V with |V| ≥ 2, and let c : V be such that every edge of Gᶜ is incident with c. Then every admissible |V|-list assignment L on G realizes at least |V|^2 distinct color sets.
theorem graph_color_sets_card_ge_sq_of_star_compl {V : Type*} [Fintype V]
(G : SimpleGraph V) (h_noncomplete : G ≠ ⊤) (hn : 2 ≤ Fintype.card V)
(c : V) (hc : ∀ u v : V, Gᶜ.Adj u v → u = c ∨ v = c)
(L : V → Finset ℕ) (hL : is_admissible_list_assignment G (Fintype.card V) L) :
(Fintype.card V) ^ 2 ≤ (graph_color_sets G L).cardgraph_color_sets_mem_iffIn LeanGraph Theory & Graph Algorithms
For a finite vertex type V with a simple graph G and list assignment L, a finset X of natural numbers is a color set of an L-coloring of G (i.e. X ∈ graph_color_sets G L) if and only if there is a map φ : V → ℕ with φ v ∈ L v for every v, φ u ≠ φ v whenever G.Adj u v, and X = φ '' V.
theorem graph_color_sets_mem_iff {V : Type*} [Fintype V]
(G : SimpleGraph V) (L : V → Finset ℕ) (X : Finset ℕ) :
X ∈ graph_color_sets G L ↔
∃ φ : V → ℕ, (∀ v : V, φ v ∈ L v) ∧
(∀ u v : V, G.Adj u v → φ u ≠ φ v) ∧ Finset.univ.image φ = Xgraph_config_not_stackable_of_le_oneIn LeanGraph Theory & Graph Algorithms
A configuration in which no vertex holds two pebbles (c v ≤ 1 everywhere) and whose support has at least two distinct vertices is not stackable: no pebbling step applies at all, so it can never be consolidated.
theorem graph_config_not_stackable_of_le_one {V : Type*} [DecidableEq V] (G : SimpleGraph V)
(c : V → ℕ) (hc : ∀ v, c v ≤ 1) (h2 : ∃ a b : V, a ≠ b ∧ 0 < c a ∧ 0 < c b) :
¬ graph_config_stackable G cgraph_dismantling_class_cone_zeroIn LeanGraph Theory & Graph Algorithms
Every finite cone belongs to dismantling class 0.
theorem graph_dismantling_class_cone_zero (V : Type) [Fintype V] (G : SimpleGraph V) (hcone : graph_dismantling_class (-1) V G) : graph_dismantling_class 0 V G
graph_dismantling_class_iff_constructorsIn LeanGraph Theory & Graph Algorithms
Membership of G in the dismantling class D_j is exactly a disjunction of the three constructor shapes: j = -1 and G is a non-empty cone; or j >= 0 and G is non-empty with a single vertex; or j >= 0 and there is a vertex v whose open neighbourhood graph N(v) lies in D_{j-1} while G - v still lies in D_j.
theorem graph_dismantling_class_iff_constructors (j : ℤ) (V : Type) (G : SimpleGraph V) :
graph_dismantling_class j V G ↔
(j = -1 ∧ Nonempty V ∧ ∃ apex : V, ∀ v : V, v ≠ apex → G.Adj apex v) ∨
(0 ≤ j ∧ Nonempty V ∧ Subsingleton V) ∨
(0 ≤ j ∧ ∃ v : V,
graph_dismantling_class (j - 1) ↥(G.neighborSet v) (SimpleGraph.induce (G.neighborSet v) G) ∧
graph_dismantling_class j ↥{w : V | w ≠ v} (SimpleGraph.induce {w : V | w ≠ v} G))graph_dismantling_class_iff_exists_stepIn LeanGraph Theory & Graph Algorithms
If j >= 0 and G has at least two vertices, then G lies in D_j if and only if some vertex v can be deleted first: the open neighbourhood of v lies in D_{j-1} and G - v lies in D_j.
theorem graph_dismantling_class_iff_exists_step (j : ℤ) (hj : 0 ≤ j) (V : Type) [Fintype V]
(G : SimpleGraph V) (hV : 2 ≤ Fintype.card V) :
graph_dismantling_class j V G ↔
∃ v : V,
graph_dismantling_class (j - 1) ↥(G.neighborSet v) (SimpleGraph.induce (G.neighborSet v) G) ∧
graph_dismantling_class j ↥{w : V | w ≠ v} (SimpleGraph.induce {w : V | w ≠ v} G)graph_dismantling_class_monoIn LeanGraph Theory & Graph Algorithms
The dismantling hierarchy is monotone: for any j ≥ 0, every graph in D_j also belongs to D_{j+1}.
theorem graph_dismantling_class_mono (j : ℤ) (hj : 0 ≤ j) (V : Type) [Fintype V] (G : SimpleGraph V) (h : graph_dismantling_class j V G) : graph_dismantling_class (j + 1) V G
graph_dismantling_class_neg_one_q_zeroIn LeanGraph Theory & Graph Algorithms
If a finite simple graph G belongs to the dismantling class D_{-1}, then its alternating clique count vanishes: q(G) = 0.
theorem graph_dismantling_class_neg_one_q_zero (V : Type) [Fintype V] (G : SimpleGraph V)
(h : graph_dismantling_class (-1) V G) :
simple_graph_q G = 0graph_dismantling_class_no_isolatedIn LeanGraph Theory & Graph Algorithms
For j >= 0, a finite graph on at least two vertices having an isolated vertex belongs to no dismantling class D_j.
theorem graph_dismantling_class_no_isolated (j : ℤ) (hj : 0 ≤ j) (V : Type) [Fintype V]
(G : SimpleGraph V) (v : V) (hv : G.IsIsolated v) (hcard : 2 ≤ Fintype.card V) :
¬ graph_dismantling_class j V Ggraph_dismantling_class_nonemptyIn LeanGraph Theory & Graph Algorithms
Every graph in any dismantling class D_j (for any integer j) is non-empty; in particular the empty graph belongs to no class, and the empty vertex set is in no class.
theorem graph_dismantling_class_nonempty (j : ℤ) (V : Type) (G : SimpleGraph V)
(h : graph_dismantling_class j V G) : Nonempty Vgraph_dismantling_class_one_min_orderIn LeanGraph Theory & Graph Algorithms
Every finite simple graph on at most 7 vertices that belongs to dismantling class 1 already belongs to dismantling class 0 (Dochtermann, Joswig, Sanyal 2023: m_1 = 8).
theorem graph_dismantling_class_one_min_order (V : Type) [Fintype V] (G : SimpleGraph V) (hcard : Fintype.card V ≤ 7) (h : graph_dismantling_class 1 V G) : graph_dismantling_class 0 V G
graph_dismantling_class_q_vanishingIn LeanGraph Theory & Graph Algorithms
Let r >= -1 be an integer, and let H be a finite simple graph. If H belongs to the dismantling class D_r, then q(H) = 0.
theorem graph_dismantling_class_q_vanishing (r : ℤ) (hr : -1 ≤ r) (V : Type) [Fintype V]
(H : SimpleGraph V) (hH : graph_dismantling_class r V H) :
simple_graph_q H = 0graph_dismantling_class_strict_one_witness_eightIn LeanGraph Theory & Graph Algorithms
There is a graph on 8 vertices that is strictly 1-dismantlable: it lies in D_1 and not in D_0. This is the graph H_1 of Proposition 7.1 of arXiv:2611.14430, the induced subgraph of the 16-vertex seed A^(4) on the vertex set S_1 = {2,4,5,8,9,10,12,13}; it realises the known minimum m_1 = 8.
theorem graph_dismantling_class_strict_one_witness_eight :
∃ G : SimpleGraph (Fin 8), graph_dismantling_class 1 (Fin 8) G ∧ ¬ graph_dismantling_class 0 (Fin 8) Ggraph_dismantling_class_strict_two_witness_elevenIn LeanGraph Theory & Graph Algorithms
There is a strictly 2-dismantlable graph on 11 vertices: a graph G on Fin 11 with G in D_2 and not in D_1. (Existence is open; all 10-vertex and smaller cases are eliminated, so 11 is the only remaining order below 12.)
theorem graph_dismantling_class_strict_two_witness_eleven :
∃ G : SimpleGraph (Fin 11), graph_dismantling_class 2 (Fin 11) G ∧ ¬ graph_dismantling_class 1 (Fin 11) Ggraph_dismantling_class_strict_two_witness_twelveIn LeanGraph Theory & Graph Algorithms
There is a graph on 12 vertices that lies in D_2 and not in D_1. This is the graph H_2 of Proposition 7.1 of arXiv:2611.14430, the induced subgraph of the 16-vertex seed A^(4) on S_2 = {2,3,...,13}. It is the only strict-level-2 example the literature provides, and it certifies m_2 <= 12 — so the target node asks whether it can be beaten below 12.
theorem graph_dismantling_class_strict_two_witness_twelve :
∃ G : SimpleGraph (Fin 12), graph_dismantling_class 2 (Fin 12) G ∧ ¬ graph_dismantling_class 1 (Fin 12) Ggraph_exists_unstackable_config_of_two_le_of_le_cardIn LeanGraph Theory & Graph Algorithms
For any graph G on a finite vertex set V, and any t with 2 ≤ t ≤ |V|, there is a configuration of exactly t pebbles on G that is not stackable (put one pebble on each of t distinct vertices; no vertex then holds two pebbles, so no move is possible).
theorem graph_exists_unstackable_config_of_two_le_of_le_card {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) {t : ℕ} (h2 : 2 ≤ t) (ht : t ≤ Fintype.card V) :
∃ c : V → ℕ, (∑ v, c v) = t ∧ ¬ graph_config_stackable G cgraph_interval_index_le_path_graphIn LeanGraph Theory & Graph Algorithms
For every connected simple graph G on n ≥ 1 vertices, the interval index satisfies Int(G) ≤ (n^3 - n)/6 = Int(P_n), with equality if and only if G ≅ P_n, or n = 4 and G ≅ C_4.
theorem graph_interval_index_le_path_graph {V : Type*} [Fintype V]
(G : SimpleGraph V) (hG : G.Connected) :
graph_interval_index G ≤ (Fintype.card V ^ 3 - Fintype.card V) / 6 ∧
(graph_interval_index G = (Fintype.card V ^ 3 - Fintype.card V) / 6 ↔
Nonempty (G ≃g SimpleGraph.pathGraph (Fintype.card V)) ∨
(Fintype.card V = 4 ∧ Nonempty (G ≃g SimpleGraph.cycleGraph 4)))graph_interval_index_path_graphIn LeanGraph Theory & Graph Algorithms
For every n ≥ 1, the interval index of the path graph P_n equals (n^3 - n) / 6.
theorem graph_interval_index_path_graph (n : ℕ) (hn : 1 ≤ n) :
graph_interval_index (SimpleGraph.pathGraph n) = (n ^ 3 - n) / 6graph_interval_index_path_graph_eq_pair_sumIn LeanGraph Theory & Graph Algorithms
The interval index of P_n equals the sum, over ordered pairs a < b of vertices, of the distance b - a.
theorem graph_interval_index_path_graph_eq_pair_sum (n : ℕ) :
graph_interval_index (SimpleGraph.pathGraph n) =
∑ p ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun p : Fin n × Fin n => p.1 < p.2),
(p.2.val - p.1.val)graph_is_forcing_matching_of_cut_setIn LeanGraph Theory & Graph Algorithms
Let H be a simple graph with a perfect matching M and a matching S ≤ M. Suppose there is a vertex set A such that (i) every H-edge that is not an M-edge crosses the cut A, and (ii) every M-edge that is not an S-edge has both endpoints in A. Then S is a forcing matching of H (that is, M is the unique perfect matching of H containing S).
theorem graph_is_forcing_matching_of_cut_set {V : Type*} (H : SimpleGraph V)
(M S : H.Subgraph) (A : Set V) (hM : M.IsPerfectMatching) (hS : S ≤ M)
(hSmat : S.IsMatching)
(hcross : ∀ ⦃u v : V⦄, H.Adj u v → ¬ M.Adj u v → (u ∈ A ↔ v ∉ A))
(hmono : ∀ ⦃u v : V⦄, M.Adj u v → ¬ S.Adj u v → u ∈ A ∧ v ∈ A) :
graph_is_forcing_matching H Sgraph_is_mutual_visibility_colorable_iff_forall_common_neighborIn LeanGraph Theory & Graph Algorithms
In a graph in which every two distinct vertices are at distance at most 2, G is mutual-visibility n-colorable if and only if there is a colouring c : V → Fin n such that for every colour i, every two distinct non-adjacent vertices u, v with c u = c v = i have a common neighbour w with c w ≠ i.
theorem graph_is_mutual_visibility_colorable_iff_forall_common_neighbor {V : Type*}
(G : SimpleGraph V) (h : ∀ u v : V, u ≠ v → G.dist u v ≤ 2) (n : ℕ) :
graph_is_mutual_visibility_colorable G n ↔
∃ c : V → Fin n, ∀ i : Fin n, ∀ u v : V, c u = i → c v = i → u ≠ v → ¬ G.Adj u v →
∃ w : V, c w ≠ i ∧ G.Adj u w ∧ G.Adj v wgraph_is_mutual_visibility_colorable_monoIn LeanGraph Theory & Graph Algorithms
If a simple graph is mutual-visibility n-colourable and n ≤ m, then it is mutual-visibility m-colourable.
theorem graph_is_mutual_visibility_colorable_mono {V : Type*} (G : SimpleGraph V) {n m : ℕ}
(hnm : n ≤ m) (h : graph_is_mutual_visibility_colorable G n) :
graph_is_mutual_visibility_colorable G mgraph_is_mutual_visibility_colorable_three_of_forall_mem_three_cliquesIn LeanGraph Theory & Graph Algorithms
If the vertex set of a simple graph G is covered by three cliques (equivalently, the complement of G is 3-colourable), then G is mutual-visibility 3-colourable.
theorem graph_is_mutual_visibility_colorable_three_of_forall_mem_three_cliques {V : Type*}
(G : SimpleGraph V) (C₁ C₂ C₃ : Set V)
(hcov : ∀ v : V, v ∈ C₁ ∨ v ∈ C₂ ∨ v ∈ C₃)
(h₁ : G.IsClique C₁) (h₂ : G.IsClique C₂) (h₃ : G.IsClique C₃) :
graph_is_mutual_visibility_colorable G 3graph_is_mutual_visibility_set_iff_forall_common_neighborIn LeanGraph Theory & Graph Algorithms
In a graph in which every two distinct vertices are at distance at most 2, a set S of vertices is a mutual-visibility set if and only if every two distinct non-adjacent vertices u, v of S have a common neighbour w that is outside S.
theorem graph_is_mutual_visibility_set_iff_forall_common_neighbor {V : Type*} (G : SimpleGraph V)
(h : ∀ u v : V, u ≠ v → G.dist u v ≤ 2) (S : Set V) :
graph_is_mutual_visibility_set G S ↔
∀ u ∈ S, ∀ v ∈ S, u ≠ v → ¬ G.Adj u v →
∃ w, w ∉ S ∧ G.Adj u w ∧ G.Adj v wgraph_is_mutual_visibility_set_of_isCliqueIn LeanGraph Theory & Graph Algorithms
Every clique of a simple graph is a mutual-visibility set.
theorem graph_is_mutual_visibility_set_of_isClique {V : Type*} (G : SimpleGraph V) {S : Set V}
(hS : G.IsClique S) : graph_is_mutual_visibility_set G Sgraph_min_color_sets_exists_attainingIn LeanGraph Theory & Graph Algorithms
For every simple graph G on a finite vertex type V there is a list assignment L : V → Finset ℕ that is admissible for list size |V| on G and whose number of color sets is exactly graph_min_color_sets G |V|.
theorem graph_min_color_sets_exists_attaining {V : Type*} [Fintype V] (G : SimpleGraph V) :
∃ L : V → Finset ℕ, is_admissible_list_assignment G (Fintype.card V) L ∧
graph_min_color_sets G (Fintype.card V) = (graph_color_sets G L).cardgraph_min_color_sets_le_sq_of_star_complIn LeanGraph Theory & Graph Algorithms
Let G be a simple graph on a finite vertex type V and let c : V have the property that every edge of Gᶜ is incident with c (so G − c is a clique). Then graph_min_color_sets G |V| ≤ |V|^2: the assignment giving c the block of colours [n, 2n) and every other vertex the block [0, n) is admissible and has exactly |V|^2 color sets, where n = |V|.
theorem graph_min_color_sets_le_sq_of_star_compl {V : Type*} [Fintype V]
(G : SimpleGraph V) (c : V) (hc : ∀ u v : V, Gᶜ.Adj u v → u = c ∨ v = c) :
graph_min_color_sets G (Fintype.card V) ≤ (Fintype.card V) ^ 2graph_min_forcing_num_le_edgeSet_encardIn LeanGraph Theory & Graph Algorithms
If S is a forcing matching of a simple graph G, then the minimum forcing number of G is at most the extended cardinality of S's edge set.
theorem graph_min_forcing_num_le_edgeSet_encard {V : Type*} {G : SimpleGraph V}
{S : G.Subgraph} (h : graph_is_forcing_matching G S) :
graph_min_forcing_num G ≤ S.edgeSet.encardgraph_mutual_visibility_chromatic_number_eq_four_packagingIn LeanGraph Theory & Graph Algorithms
If a finite simple graph G of diameter 2 is 4-colourable but not 3-colourable and is not mutual-visibility 3-colourable, then its chromatic number is 4 and its mutual-visibility chromatic number is 4.
theorem graph_mutual_visibility_chromatic_number_eq_four_packaging {V : Type*} [Fintype V]
(G : SimpleGraph V) (hdiam : G.diam = 2) (h4 : G.Colorable 4) (h3 : ¬ G.Colorable 3)
(hmv : ¬ graph_is_mutual_visibility_colorable G 3) :
graph_mutual_visibility_chromatic_number G = 4 ∧ G.chromaticNumber = 4graph_mutual_visibility_chromatic_number_le_iffIn LeanGraph Theory & Graph Algorithms
For any simple graph G and natural number n, the mutual-visibility chromatic number of G is at most n if and only if G is mutual-visibility n-colourable.
theorem graph_mutual_visibility_chromatic_number_le_iff {V : Type*} (G : SimpleGraph V) (n : ℕ) :
graph_mutual_visibility_chromatic_number G ≤ (n : ℕ∞) ↔
graph_is_mutual_visibility_colorable G ngraph_not_dismantling_class_of_q_ne_zeroIn LeanGraph Theory & Graph Algorithms
Let H be a finite simple graph. If q(H) ≠ 0, then H does not belong to the dismantling class D_r for any integer r >= -1.
theorem graph_not_dismantling_class_of_q_ne_zero (V : Type) [Fintype V]
(H : SimpleGraph V) (hq : simple_graph_q H ≠ 0) (r : ℤ) (hr : -1 ≤ r) :
¬ graph_dismantling_class r V Hgraph_pebbling_step_stackableIn LeanGraph Theory & Graph Algorithms
If a configuration c transitions to c' in one pebbling step and c' is stackable, then c is stackable.
theorem graph_pebbling_step_stackable {V : Type*} [DecidableEq V] (G : SimpleGraph V)
{c c' : V → ℕ} (hstep : graph_pebbling_step G c c') (h : graph_config_stackable G c') :
graph_config_stackable G cgraph_pebbling_trans_stackableIn LeanGraph Theory & Graph Algorithms
If a configuration c reaches c' via a sequence of pebbling steps and c' is stackable, then c is stackable.
theorem graph_pebbling_trans_stackable {V : Type*} [DecidableEq V] (G : SimpleGraph V)
{c c' : V → ℕ} (htr : Relation.ReflTransGen (graph_pebbling_step G) c c')
(h : graph_config_stackable G c') : graph_config_stackable G cgraph_perfect_matching_edgeSet_ncardIn LeanGraph Theory & Graph Algorithms
For a finite simple graph G on V and a perfect matching M of G, the number of edges of M is |V| / 2.
theorem graph_perfect_matching_edgeSet_ncard {V : Type*} [Fintype V] {G : SimpleGraph V}
{M : G.Subgraph} (hM : M.IsPerfectMatching) : M.edgeSet.ncard = Fintype.card V / 2graph_power_two_quadratic_form_leIn LeanGraph Theory & Graph Algorithms
For any non-negative vector y on the vertex set of a finite simple graph G, the quadratic form of the adjacency matrix of G^2 at y is at most the squared Euclidean norm of A(G) * y.
attribute [local instance] Classical.propDecidable in
theorem graph_power_two_quadratic_form_le {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (y : V → ℝ) (hy : ∀ i, 0 ≤ y i) :
∑ i, y i * Matrix.mulVec ((simple_graph_power G 2).adjMatrix ℝ) y i ≤
∑ i, (Matrix.mulVec (G.adjMatrix ℝ) y i) ^ 2graph_proper_list_coloring_of_degree_ltIn LeanGraph Theory & Graph Algorithms
Greedy list colouring: if every vertex of H has strictly fewer neighbours than the number of colours on its list, then H has a proper colouring which picks at each vertex a colour from that vertex's list.
theorem graph_proper_list_coloring_of_degree_lt {V κ : Type} [Fintype V] [DecidableEq V]
[DecidableEq κ] (H : SimpleGraph V) [DecidableRel H.Adj] (L : V → Finset κ)
(h : ∀ v, H.degree v < (L v).card) :
∃ f : V → κ, (∀ v, f v ∈ L v) ∧ ∀ ⦃u v : V⦄, H.Adj u v → f u ≠ f vgraph_square_lower_bound_color_sets_iffIn LeanGraph Theory & Graph Algorithms
Let G be a noncomplete simple graph on a finite vertex type V with n = |V| ≥ 2. Then the minimum number of color sets graph_min_color_sets G n over admissible n-list assignments on G equals n^2 if and only if all edges of the complement graph Gᶜ share a common endpoint (there exists c : V such that for every edge uv of Gᶜ, u = c or v = c).
theorem graph_square_lower_bound_color_sets_iff {V : Type*} [Fintype V]
(G : SimpleGraph V) (h_noncomplete : G ≠ ⊤)
(hn : 2 ≤ Fintype.card V) :
graph_min_color_sets G (Fintype.card V) = (Fintype.card V) ^ 2 ↔
∃ c : V, ∀ u v : V, Gᶜ.Adj u v → u = c ∨ v = cgraph_stacking_number_eq_tree_estimate_of_all_stackable_of_bad_configsIn LeanGraph Theory & Graph Algorithms
If every configuration of size estim(T) on T is stackable and every size t with 2 ≤ t < estim(T) admits a non-stackable configuration of size t, then stack(T) = estim(T).
theorem graph_stacking_number_eq_tree_estimate_of_all_stackable_of_bad_configs {V : Type*}
[Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj]
(hU : ∀ c : V → ℕ, (∑ v, c v) = simple_graph_tree_estimate T → graph_config_stackable T c)
(hB : ∀ t : ℕ, 2 ≤ t → t < simple_graph_tree_estimate T →
∃ c : V → ℕ, (∑ v, c v) = t ∧ ¬ graph_config_stackable T c) :
graph_stacking_number T = simple_graph_tree_estimate Tgreedy_indep_var_complete_split_graph_oneIn LeanGraph Theory & Graph Algorithms
The star on n >= 3 vertices attains the bound: the variance of its random greedy independent set size equals (n-1)(n-2)^2/n^2, which is split_graph_var_bound n 1.
theorem greedy_indep_var_complete_split_graph_one (n : ℕ) (hn : 3 ≤ n) : greedy_indep_var (complete_split_graph n 1) = split_graph_var_bound n 1
greedy_indep_var_congrIn LeanGraph Theory & Graph Algorithms
The random greedy independent set variance is invariant under graph isomorphism.
theorem greedy_indep_var_congr {n : ℕ} (G H : SimpleGraph (Fin n)) (e : G ≃g H) : greedy_indep_var G = greedy_indep_var Hgreedy_indep_var_eq_split_graph_max_var_impIn LeanGraph Theory & Graph Algorithms
If the random greedy independent set variance of G attains split_graph_max_var n, then G is isomorphic to complete_split_graph n k for some k in Finset.Ico 1 n attaining split_graph_var_bound n k = split_graph_max_var n.
theorem greedy_indep_var_eq_split_graph_max_var_imp (n : ℕ) (hn : 3 ≤ n) (G : SimpleGraph (Fin n)) (h : greedy_indep_var G = split_graph_max_var n) : ∃ k ∈ Finset.Ico 1 n, split_graph_var_bound n k = split_graph_max_var n ∧ Nonempty (G ≃g complete_split_graph n k)
greedy_indep_var_forest_eq_star_boundIn LeanGraph Theory & Graph Algorithms
For n >= 3, if a forest F on vertex set Fin n has greedy independent set variance exactly (n-1)(n-2)^2/n^2 = split_graph_var_bound n 1, then F is isomorphic to the star complete_split_graph n 1.
theorem greedy_indep_var_forest_eq_star_bound {n : ℕ} (hn : 3 ≤ n) (F : SimpleGraph (Fin n))
(hF : F.IsAcyclic) (h : greedy_indep_var F = split_graph_var_bound n 1) :
Nonempty (F ≃g complete_split_graph n 1)greedy_indep_var_forest_le_star_boundIn LeanGraph Theory & Graph Algorithms
For every n >= 1 and every forest (acyclic simple graph) F on vertex set Fin n, the variance of the random greedy independent set size is at most the star's variance (n-1)(n-2)^2/n^2 = split_graph_var_bound n 1.
theorem greedy_indep_var_forest_le_star_bound {n : ℕ} (hn : 1 ≤ n) (F : SimpleGraph (Fin n))
(hF : F.IsAcyclic) : greedy_indep_var F ≤ split_graph_var_bound n 1greedy_indep_var_iso_typesIn LeanGraph Theory & Graph Algorithms
The random greedy independent set variance is invariant under graph isomorphism, even when the two graphs are labelled by different finite types Fin n and Fin m (so that one is a relabelling of the other).
theorem greedy_indep_var_iso_types {n m : ℕ} {G : SimpleGraph (Fin n)} {H : SimpleGraph (Fin m)} (e : G ≃g H) : greedy_indep_var G = greedy_indep_var Hgreedy_indep_var_le_split_graph_max_varIn LeanGraph Theory & Graph Algorithms
For every simple graph G on n >= 3 vertices, the random greedy independent set variance is at most split_graph_max_var n.
theorem greedy_indep_var_le_split_graph_max_var (n : ℕ) (hn : 3 ≤ n) (G : SimpleGraph (Fin n)) : greedy_indep_var G ≤ split_graph_max_var n
gt_twenty_four_zero_forcing_poly_not_unimodalIn LeanGraph Theory & Graph Algorithms
The zero forcing polynomial of the graph gt_graph 24 is not unimodal.
theorem gt_twenty_four_zero_forcing_poly_not_unimodal :
¬ polynomial_is_unimodal (zero_forcing_poly (gt_graph 24))gt_vertex_cardIn LeanGraph Theory & Graph Algorithms
The graph G_t has 10 + 3t vertices: |A|=3, |B|=2, |C|=2, |D|=3, |P|=|Q|=|R|=t.
theorem gt_vertex_card (t : ℕ) : Fintype.card (GtVertex t) = 10 + 3 * t
gt_zero_forcing_poly_coeff_complIn LeanGraph Theory & Graph Algorithms
The coefficient of x^{n-c} (where n = 10+3t) in the zero forcing polynomial of G_t is the number of c-element sets T whose complement is a zero forcing set.
theorem gt_zero_forcing_poly_coeff_compl (t c : ℕ) (hc : c ≤ 10 + 3 * t) :
(zero_forcing_poly (gt_graph t)).coeff (10 + 3 * t - c) =
{T : Finset (GtVertex t) | T.card = c ∧ is_zero_forcing_set (gt_graph t) ((Finset.univ \ T : Finset (GtVertex t)) : Set (GtVertex t))}.ncardgt_zero_forcing_poly_not_unimodalIn LeanGraph Theory & Graph Algorithms
For every integer t ≥ 24, the zero forcing polynomial of the graph gt_graph t is not unimodal.
theorem gt_zero_forcing_poly_not_unimodal (t : ℕ) (ht : 24 ≤ t) :
¬ polynomial_is_unimodal (zero_forcing_poly (gt_graph t))gt_zfs_compl_count_fourIn LeanGraph Theory & Graph Algorithms
Exactly 36 + 108t four-element sets T have a zero forcing complement in G_t (for t ≥ 24).
theorem gt_zfs_compl_count_four (t : ℕ) (ht : 24 ≤ t) :
{T : Finset (GtVertex t) | T.card = 4 ∧
is_zero_forcing_set (gt_graph t) ((Finset.univ \ T : Finset (GtVertex t)) : Set (GtVertex t))}.ncard
= 36 + 108 * tgt_zfs_compl_count_threeIn LeanGraph Theory & Graph Algorithms
Exactly 60 + 99t three-element sets T have a zero forcing complement in G_t (for t ≥ 24).
theorem gt_zfs_compl_count_three (t : ℕ) (ht : 24 ≤ t) :
{T : Finset (GtVertex t) | T.card = 3 ∧
is_zero_forcing_set (gt_graph t) ((Finset.univ \ T : Finset (GtVertex t)) : Set (GtVertex t))}.ncard
= 60 + 99 * tgt_zfs_compl_count_twoIn LeanGraph Theory & Graph Algorithms
Exactly 37 + 30t + 3t^2 two-element sets T have a zero forcing complement in G_t (for t ≥ 24).
theorem gt_zfs_compl_count_two (t : ℕ) (ht : 24 ≤ t) :
{T : Finset (GtVertex t) | T.card = 2 ∧
is_zero_forcing_set (gt_graph t) ((Finset.univ \ T : Finset (GtVertex t)) : Set (GtVertex t))}.ncard
= 37 + 30 * t + 3 * t ^ 2hamming_three_exists_blocking_setIn LeanGraph Theory & Graph Algorithms
If a 2 ≤ (a 0 - 1) + (a 1 - 1), then in F = K_{a 0} □ K_{a 1} □ K_{a 2} there are a fibre (over some (x,y) in the first two coordinates) and an independent set T of size (a 0 - 1) + (a 1 - 1) such that every vertex of that fibre is adjacent to a member of T.
theorem hamming_three_exists_blocking_set (a : Fin 3 → ℕ) (h_ge : ∀ i, 2 ≤ a i)
(h_mono : Monotone a) (hb : a 2 ≤ (a 0 - 1) + (a 1 - 1)) :
∃ (x : Fin (a 0)) (y : Fin (a 1)) (T : Finset ((i : Fin 3) → Fin (a i))),
(cartesian_product_complete_graphs a).IsIndepSet (T : Set _) ∧
(∀ v : (i : Fin 3) → Fin (a i), v 0 = x → v 1 = y →
∃ u ∈ T, (cartesian_product_complete_graphs a).Adj u v) ∧
T.card = (a 0 - 1) + (a 1 - 1)hamming_three_fiber_covering_of_boundIn LeanGraph Theory & Graph Algorithms
If 1 + (a 0 - 1) + (a 1 - 1) ≤ a 2, every maximal independent set s of F = K_{a 0} □ K_{a 1} □ K_{a 2} meets every fibre {(x,y,*)} of the first two coordinates.
theorem hamming_three_fiber_covering_of_bound (a : Fin 3 → ℕ) (h_ge : ∀ i, 2 ≤ a i)
(h_mono : Monotone a) (hb : 1 + (a 0 - 1) + (a 1 - 1) ≤ a 2)
(s : Finset ((i : Fin 3) → Fin (a i)))
(hs : Maximal (fun u : Finset ((i : Fin 3) → Fin (a i)) =>
(cartesian_product_complete_graphs a).IsIndepSet (u : Set _)) s) :
∀ (x : Fin (a 0)) (y : Fin (a 1)), ∃ u ∈ s, u 0 = x ∧ u 1 = yhamming_three_not_well_covered_of_smallIn LeanGraph Theory & Graph Algorithms
If a 2 < 1 + (a 0 - 1) + (a 1 - 1) then F = K_{a 0} □ K_{a 1} □ K_{a 2} is not well-covered (two maximal independent sets of different sizes), hence does not have the well-covered powers property.
theorem hamming_three_not_well_covered_of_small (a : Fin 3 → ℕ) (h_ge : ∀ i, 2 ≤ a i)
(h_mono : Monotone a) (hb : a 2 < 1 + (a 0 - 1) + (a 1 - 1)) :
¬ simple_graph_has_well_covered_powers (cartesian_product_complete_graphs a)hamming_three_power_ge_three_well_coveredIn LeanGraph Theory & Graph Algorithms
For 2 ≤ a 0, 2 ≤ a 1, 2 ≤ a 2 and d ≥ 3, the d-th power of K_{a 0} □ K_{a 1} □ K_{a 2} is well-covered (indeed it is the complete graph).
theorem hamming_three_power_ge_three_well_covered (a : Fin 3 → ℕ) (h_ge : ∀ i, 2 ≤ a i)
(d : ℕ) (hd : 3 ≤ d) :
simple_graph_is_well_covered (simple_graph_power (cartesian_product_complete_graphs a) d)hamming_three_power_two_well_coveredIn LeanGraph Theory & Graph Algorithms
For 2 ≤ a 0 ≤ a 1 ≤ a 2, every maximal independent set of the square (K_{a 0} □ K_{a 1} □ K_{a 2})^2 has exactly a 0 vertices, so that square is well-covered.
theorem hamming_three_power_two_well_covered (a : Fin 3 → ℕ) (h_ge : ∀ i, 2 ≤ a i)
(h_mono : Monotone a) :
simple_graph_is_well_covered (simple_graph_power (cartesian_product_complete_graphs a) 2)hamming_three_transversal_maximal_indep_setIn LeanGraph Theory & Graph Algorithms
For 2 ≤ a 0 ≤ a 1 ≤ a 2 there is a maximal independent set of F = K_{a 0} □ K_{a 1} □ K_{a 2} of size a 0 * a 1, namely the "diagonal" {(i,j,i+j mod a 2)}.
theorem hamming_three_transversal_maximal_indep_set (a : Fin 3 → ℕ) (h_ge : ∀ i, 2 ≤ a i)
(h_mono : Monotone a) :
∃ s : Finset ((i : Fin 3) → Fin (a i)),
Maximal (fun u : Finset ((i : Fin 3) → Fin (a i)) =>
(cartesian_product_complete_graphs a).IsIndepSet (u : Set _)) s ∧
s.card = a 0 * a 1hamming_three_wcp_of_boundIn LeanGraph Theory & Graph Algorithms
If 1 + (a 0 - 1) + (a 1 - 1) ≤ a 2 then F = K_{a 0} □ K_{a 1} □ K_{a 2} has the well-covered powers property: every maximal independent set of every positive power has the appropriate size.
theorem hamming_three_wcp_of_bound (a : Fin 3 → ℕ) (h_ge : ∀ i, 2 ≤ a i)
(h_mono : Monotone a) (hb : 1 + (a 0 - 1) + (a 1 - 1) ≤ a 2) :
simple_graph_has_well_covered_powers (cartesian_product_complete_graphs a)has_fall_coloring_of_locally_surjective_homIn LeanGraph Theory & Graph Algorithms
Let G and H be simple graphs on types V and W, and let f : V → W be a graph homomorphism such that for every vertex u of G, H.neighborSet (f u) ⊆ f '' G.neighborSet u. If H admits a fall coloring with colors in α, then G admits a fall coloring with colors in α.
theorem has_fall_coloring_of_locally_surjective_hom {V W α : Type*}
(G : SimpleGraph V) (H : SimpleGraph W)
(f : V → W) (hf_hom : ∀ {u v}, G.Adj u v → H.Adj (f u) (f v))
(hf_surj : ∀ u, H.neighborSet (f u) ⊆ f '' G.neighborSet u)
(hcol : has_fall_coloring α H) :
has_fall_coloring α Ghas_hole_of_length_at_least_cycle_graph_fiveIn LeanGraph Theory & Graph Algorithms
The cycle on 5 vertices has a hole of length at least 5, so HasHoleOfLengthAtLeast is not vacuous.
theorem has_hole_of_length_at_least_cycle_graph_five :
HasHoleOfLengthAtLeast (SimpleGraph.cycleGraph 5) 5has_mad_lt_induceIn LeanGraph Theory & Graph Algorithms
If has_mad_lt G q holds then has_mad_lt (G.induce S) q holds for every set S of vertices.
theorem has_mad_lt_induce {V : Type} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {q : ℚ} (hmad : has_mad_lt G q)
(S : Set V) [DecidablePred (· ∈ S)] :
has_mad_lt (G.induce S) qinduced_avg_degree_le_adjacency_spectral_radiusIn LeanGraph Theory & Graph Algorithms
For a finite simple graph G and any vertex set s, the average degree of the induced subgraph G[s] is at most the adjacency spectral radius of G.
attribute [local instance] Classical.propDecidable in
theorem induced_avg_degree_le_adjacency_spectral_radius {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (s : Set V) :
ENNReal.ofReal ((∑ v : s, ((G.induce s).degree v : ℝ)) / (Fintype.card s : ℝ))
≤ adjacency_spectral_radius GisIndepSet_iff_induce_eq_botIn LeanGraph Theory & Graph Algorithms
The induced subgraph on a subset of vertices is empty (bot) if and only if that subset is an independent set.
theorem isIndepSet_iff_induce_eq_bot {V : Type*} (G : SimpleGraph V) (s : Set V) :
G.induce s = ⊥ ↔ G.IsIndepSet sisTree_avoids_geodesic_of_avoids_walkIn LeanGraph Theory & Graph Algorithms
In a tree, if some walk from u to v uses no edge of F, then the geodesic from u to v uses no edge of F either: a tree has a unique path between two vertices, and any F-avoiding walk can be reduced to that path without gaining edges.
theorem isTree_avoids_geodesic_of_avoids_walk
{V : Type*} (G : SimpleGraph V) (hG : G.IsTree)
{F : Finset (Sym2 V)} {u v : V} {q : G.Walk u v}
(hq : ∀ e ∈ q.edges, e ∉ F) :
∃ p : G.Walk u v, p.IsPath ∧ p.length = G.dist u v ∧ ∀ e ∈ p.edges, e ∉ FisTree_lapMatrix_second_eigenvalue_le_card_sub_twoIn LeanGraph Theory & Graph Algorithms
For a tree on n >= 2 vertices, the second largest Laplacian eigenvalue is at most n - 2 (with equality for K_2, K_3 and P_4).
theorem isTree_lapMatrix_second_eigenvalue_le_card_sub_two {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hTree : G.IsTree) (hn : 2 ≤ Fintype.card V) :
simple_graph_laplacian_second_eigenvalue G ≤ (Fintype.card V : ℝ) - 2is_caterpillar_iso_of_third_ps_eq_of_card_fourIn LeanGraph Theory & Graph Algorithms
Any two caterpillars on 4 vertices with equal third principal specializations are isomorphic.
theorem is_caterpillar_iso_of_third_ps_eq_of_card_four
{V₁ V₂ : Type*} [Fintype V₁] [DecidableEq V₁] [Fintype V₂] [DecidableEq V₂]
(T₁ : SimpleGraph V₁) (T₂ : SimpleGraph V₂)
[DecidableRel T₁.Adj] [DecidableRel T₂.Adj]
(hT₁ : is_caterpillar T₁) (hT₂ : is_caterpillar T₂)
(hcard₁ : Fintype.card V₁ = 4) (hcard₂ : Fintype.card V₂ = 4)
(heq : third_principal_specialization T₁ = third_principal_specialization T₂) :
Nonempty (T₁ ≃g T₂)is_geodesic_card_of_adjIn LeanGraph Theory & Graph Algorithms
For any two adjacent vertices u and v in a simple graph G, the number of geodesics between u and v is exactly 1.
theorem is_geodesic_card_of_adj {V : Type*} (G : SimpleGraph V) {u v : V} (h : G.Adj u v) :
Nat.card {p : G.Walk u v // is_geodesic p} = 1is_graph_orientation_looplessIn LeanGraph Theory & Graph Algorithms
An orientation of a simple graph has no self-loops: for any vertex v, ¬ D.Adj v v.
theorem is_graph_orientation_loopless {n : ℕ} (G : SimpleGraph (Fin n)) (D : Digraph (Fin n))
(hD : is_graph_orientation G D) (v : Fin n) : ¬ D.Adj v vis_knrs_of_edge_density_boundIn LeanGraph Theory & Graph Algorithms
If for every n > 0 and every graph G on n vertices the homomorphism density satisfies q(F,G) ≥ (2|E(G)|/n²)^(e(F)), then F satisfies the KNRS conjecture.
theorem is_knrs_of_edge_density_bound {α : Type*} [Fintype α] (F : SimpleGraph α)
(h : ∀ (n : ℕ), 0 < n → ∀ G : SimpleGraph (Fin n),
(2 * (Nat.card ↑G.edgeSet : ℝ) / (n : ℝ) ^ 2) ^ (Nat.card ↑F.edgeSet) ≤ graph_hom_density F G) :
is_knrs Fis_knrs_sumIn LeanGraph Theory & Graph Algorithms
If the graphs F and H both satisfy the KNRS conjecture, then so does their disjoint union F ⊔ H.
theorem is_knrs_sum {α β : Type*} [Fintype α] [Fintype β] (F : SimpleGraph α) (H : SimpleGraph β)
(hF : is_knrs F) (hH : is_knrs H) : is_knrs (SimpleGraph.sum F H)is_mst_for_of_zero_subgraph_reachableIn LeanGraph Theory & Graph Algorithms
If T is a spanning tree of G and the 0-weight edges of T span all 0-weight edges of G under realization α, then T is a minimum spanning tree for G under α.
open scoped Classical in
theorem is_mst_for_of_zero_subgraph_reachable {V : Type*} [Fintype V]
(G T : SimpleGraph V) (hTG : T ≤ G) (hT : T.IsTree) (α : G.edgeSet → Bool)
(hreach : (T ⊓ SimpleGraph.fromEdgeSet {s | ∃ h : s ∈ G.edgeSet, α ⟨s, h⟩ = false}).Reachable =
(SimpleGraph.fromEdgeSet {s | ∃ h : s ∈ G.edgeSet, α ⟨s, h⟩ = false}).Reachable) :
is_mst_for G T αis_spanning_path_graph_connectedIn LeanGraph Theory & Graph Algorithms
A graph on n ≥ 2 vertices whose vertices can be ordered so that exactly consecutive vertices are adjacent is connected.
theorem is_spanning_path_graph_connected {n : ℕ} (hn : 2 ≤ n) {H : SimpleGraph (Fin n)}
(h : is_spanning_path_graph H) : H.Connectedis_steiner_system_one_one_fin1In LeanGraph Theory & Graph Algorithms
On the type Fin 1, the set containing only the universe Finset.univ is a Steiner system with parameters t = 1 and r = 1.
theorem is_steiner_system_one_one_fin1 :
is_steiner_system 1 1 ({Finset.univ} : Set (Finset (Fin 1)))is_strong_odd_coloring_of_dist_two_properIn LeanGraph Theory & Graph Algorithms
If a colouring of G gives distinct colours to any two vertices joined by a walk of length 1 or 2 (equivalently, is a proper colouring of the square of G), then it is a strong odd colouring of G.
theorem is_strong_odd_coloring_of_dist_two_proper {V κ : Type} [Fintype V] [DecidableEq V]
[DecidableEq κ] (G : SimpleGraph V) [DecidableRel G.Adj] (f : V → κ)
(hproper : ∀ ⦃u v : V⦄, (dist_two_graph G).Adj u v → f u ≠ f v) :
is_strong_odd_coloring G fis_tree_eq_starGraph_of_forall_neighbor_card_le_oneIn LeanGraph Theory & Graph Algorithms
In any tree T on Fin n with 2 ≤ n, if every neighbor of u has degree at most 1, then T is the star graph centered at u.
theorem is_tree_eq_starGraph_of_forall_neighbor_card_le_one (n : ℕ) (hn : 2 ≤ n) (T : SimpleGraph (Fin n)) (hT : T.IsTree) (u : Fin n) (h : ∀ v, T.Adj u v → Nat.card (T.neighborSet v) ≤ 1) : T = SimpleGraph.starGraph u
is_vertex_critical_cliqueNum_add_one_leIn LeanGraph Theory & Graph Algorithms
A noncomplete k-vertex-critical graph has clique number at most k - 1. Indeed, if it had a clique of size k, then since it is k-critical and noncomplete it has more than k vertices, so some vertex v misses that clique; but then G - v still contains a k-clique and hence has chromatic number at least k, contradicting vertex-criticality.
theorem is_vertex_critical_cliqueNum_add_one_le {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k r : ℕ}
(h_noncomplete : G ≠ ⊤) (h_crit : is_vertex_critical G k) (h_omega : G.cliqueNum = r) :
r + 1 ≤ kis_vertex_critical_connectedIn LeanGraph Theory & Graph Algorithms
A noncomplete k-vertex-critical graph is connected: if G split into two nonempty parts with no edges between them, a (k-1)-colouring of G - v (v in the other part) would colour one part with k-1 colours and a (k-1)-colouring of G - u would colour the other, and together they would (k-1)-colour G.
theorem is_vertex_critical_connected {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ}
(h_noncomplete : G ≠ ⊤) (h_crit : is_vertex_critical G k) : G.Connectedis_vertex_critical_min_degreeIn LeanGraph Theory & Graph Algorithms
In any k-vertex-critical graph, every vertex has degree at least k - 1.
theorem is_vertex_critical_min_degree {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {k : ℕ} (hcrit : is_vertex_critical G k) (v : V) :
k - 1 ≤ G.degree vk99_join_compl_k2_not_isContainedIn LeanGraph Theory & Graph Algorithms
The Petersen graph is not contained as a subgraph in the complete bipartite join graph K_{9,9} ∨ Compl(K_2).
theorem k99_join_compl_k2_not_isContained :
¬ SimpleGraph.IsContained petersen_graph k99_join_compl_k2k99_join_compl_k2_petersen_freeIn LeanGraph Theory & Graph Algorithms
The complete bipartite join graph K_{9,9} ∨ Compl(K_2) contains no subgraph isomorphic to the Petersen graph: there is no injective graph homomorphism from the Petersen graph into K_{9,9} ∨ Compl(K_2).
theorem k99_join_compl_k2_petersen_free :
IsEmpty (SimpleGraph.Copy petersen_graph k99_join_compl_k2)k_plus_isIndContained_of_clique_enumIn LeanGraph Theory & Graph Algorithms
Let f : Fin s → V be an injective map whose image is a clique, and let x be a vertex outside the image that is adjacent to f 0 and to no other f i. Then the example graph K_s^+ (the clique K_s plus one pendant vertex attached to a single clique vertex) is induced in G.
theorem k_plus_isIndContained_of_clique_enum {V : Type*} (G : SimpleGraph V) {s : ℕ} (hs : 0 < s)
{f : Fin s → V} (finj : Function.Injective f)
(hcl : ∀ i j : Fin s, i ≠ j → G.Adj (f i) (f j))
{x : V} (hx : ∀ i, x ≠ f i) (hadj : G.Adj x (f ⟨0, hs⟩))
(huniq : ∀ i : Fin s, G.Adj x (f i) → i = ⟨0, hs⟩) :
SimpleGraph.IsIndContained (k_plus_graph s) Gkneser_compl_adjIn LeanGraph Theory & Graph Algorithms
Two vertices s and t in the complement of the Kneser graph K(n, k) are adjacent if and only if they are distinct and have nonempty intersection.
theorem kneser_compl_adj (n k : ℕ) (s t : {s : Finset (Fin n) // s.card = k}) :
(kneser_compl n k).Adj s t ↔ s ≠ t ∧ ¬ Disjoint s.1 t.1kneser_compl_cov_two_k_two_free_leIn LeanGraph Theory & Graph Algorithms
For integers k ≥ 2 and n ≥ 2k + 1, the complement of the Kneser graph K(n, k) can be covered by n - 2k many 2K₂-free graphs; that is, there exist n - 2k simple graphs G_0, ..., G_{n-2k-1} on the k-element subsets of Fin n, each 2K₂-free, whose union of edge sets is the edge set of the complement of K(n, k).
theorem kneser_compl_cov_two_k_two_free_le (n k : ℕ) (hk : 2 ≤ k) (hn : 2 * k + 1 ≤ n) :
∃ G : Fin (n - 2 * k) → SimpleGraph {s : Finset (Fin n) // s.card = k},
(∀ i, IsTwoKTwoFree (G i)) ∧
∀ s t, (kneser_compl n k).Adj s t ↔ ∃ i, (G i).Adj s tkneser_hom_cycle_reduction_to_cycle_with_chordsIn LeanGraph Theory & Graph Algorithms
Let k ≥ 2, m ≥ 6, and 3 ≤ a ≤ m - 3. For every graph G, there exists a graph homomorphism from the G-stable Kneser graph of the disjoint sum of G and the (m-1)-cycle to the G-stable Kneser graph of the disjoint sum of G and the m-cycle with two chords {1, a} and {a+1, m}.
theorem kneser_hom_cycle_reduction_to_cycle_with_chords
{V : Type*} (G : SimpleGraph V) (k m a : ℕ)
(hk : 2 ≤ k) (hm : 6 ≤ m) (ha : 3 ≤ a) (ham : a ≤ m - 3) :
Nonempty (GStableKneser (G.sum (SimpleGraph.cycleGraph (m - 1))) k →g
GStableKneser (G.sum (cycle_with_two_chords m a)) k)knrs_of_card_le_oneIn LeanGraph Theory & Graph Algorithms
Every finite graph on at most one vertex satisfies the KNRS homomorphism density conjecture.
theorem knrs_of_card_le_one {α : Type*} [Fintype α] (F : SimpleGraph α) (h : Fintype.card α ≤ 1) :
is_knrs Fknrs_of_dominated_vertexIn LeanGraph Theory & Graph Algorithms
If deleting a vertex v yields a graph satisfying the KNRS conjecture, and v is dominated by another vertex u (its neighbourhood is contained in N(u) ∪ {u}), then F itself satisfies the KNRS conjecture.
theorem knrs_of_dominated_vertex {α : Type*} [Fintype α] [DecidableEq α] (F : SimpleGraph α) (v : α)
(hF' : is_knrs (SimpleGraph.induce {x : α | x ≠ v} F))
(hdom : ∃ u : α, u ≠ v ∧ F.neighborSet v ⊆ F.neighborSet u ∪ {u}) : is_knrs Fl_path_isIndContained_of_clique_enumIn LeanGraph Theory & Graph Algorithms
Let f : Fin t → V be an injective map whose image is a clique, and let x, y be two vertices outside the image with x adjacent to f 0 and to no other f i, y adjacent to x and to no f i. Then the example graph L_t (the clique K_t with a path of length two attached to a single clique vertex) is induced in G.
theorem l_path_isIndContained_of_clique_enum {V : Type*} (G : SimpleGraph V) {t : ℕ} (ht : 0 < t)
{f : Fin t → V} (finj : Function.Injective f)
(hcl : ∀ i j : Fin t, i ≠ j → G.Adj (f i) (f j))
{x y : V} (hx : ∀ i, x ≠ f i) (hy : ∀ i, y ≠ f i) (hxy : x ≠ y)
(hxadj : G.Adj x (f ⟨0, ht⟩))
(hxuniq : ∀ i : Fin t, G.Adj x (f i) → i = ⟨0, ht⟩)
(hyx : G.Adj y x) (hyq : ∀ i : Fin t, ¬ G.Adj y (f i)) :
SimpleGraph.IsIndContained (l_path_graph t) GlapMatrix_commute_scalar_sub_all_onesIn LeanGraph Theory & Graph Algorithms
For any simple graph G and natural number d, the Laplacian matrix L(G) over ℝ commutes with ((d+1)I - J), where J is the all-ones matrix.
open scoped Classical in
theorem lapMatrix_commute_scalar_sub_all_ones
{V : Type*} [Fintype V] (d : ℕ) (G : SimpleGraph V) :
Commute (G.lapMatrix ℝ)
(((d + 1 : ℝ) • (1 : Matrix V V ℝ) - Matrix.of fun (_ _ : V) ↦ (1 : ℝ)))laplacian_mu1_eq_lapMatrix_eigenvalues0In LeanGraph Theory & Graph Algorithms
For a simple graph G on a nonempty finite vertex type with decidable adjacency, laplacian_mu1 G equals the eigenvalue at index 0 of the Hermitian Laplacian matrix L = D - A of G.
theorem laplacian_mu1_eq_lapMatrix_eigenvalues0 {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (h : 1 ≤ Fintype.card V) :
laplacian_mu1 G = (SimpleGraph.isHermitian_lapMatrix ℝ G).eigenvalues₀ ⟨0, h⟩large_cycle_product_not_wcpIn LeanGraph Theory & Graph Algorithms
For m, n ≥ 6 with m, n ≠ 7, the Cartesian product C_m □ C_n does NOT have the well-covered powers property (core of Proposition 5.1 for the case where neither factor is C_3, C_4, C_5 or C_7).
theorem large_cycle_product_not_wcp (m n : ℕ) (hm6 : 6 ≤ m) (hm7 : m ≠ 7) (hn6 : 6 ≤ n) (hn7 : n ≠ 7) :
¬ simple_graph_has_well_covered_powers (SimpleGraph.cycleGraph m □ SimpleGraph.cycleGraph n)leaf_rich_except_zero_forcing_poly_log_concaveIn LeanGraph Theory & Graph Algorithms
For any finite graph in which every vertex away from r is either a leaf attached to a non-leaf different from r or has at least two leaf neighbors different from r, the coefficients of the zero forcing polynomial are log-concave.
theorem leaf_rich_except_zero_forcing_poly_log_concave {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (r : V) (hG : graph_leaf_rich_except G r) : ∀ k : ℕ, (zero_forcing_poly G).coeff k * (zero_forcing_poly G).coeff (k + 2) ≤ (zero_forcing_poly G).coeff (k + 1) * (zero_forcing_poly G).coeff (k + 1)leaf_rich_exchange_has_candidateIn LeanGraph Theory & Graph Algorithms
For two zero forcing complements A and B with |A| < |B|, there exists an element x ∈ B \ A falling into one of the four insertion cases.
theorem leaf_rich_exchange_has_candidate {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (r : V) (hG : graph_leaf_rich_except G r) (A B : Finset V) (hA : is_zero_forcing_set G ((Finset.univ \ A : Finset V) : Set V)) (hB : is_zero_forcing_set G ((Finset.univ \ B : Finset V) : Set V)) (hcard : A.card < B.card) : ∃ x ∈ B \ A, (x ≠ r ∧ G.degree x ≠ 1) ∨ (r ∉ A ∧ x ≠ r ∧ ∀ b ∈ A, ∀ v : V, G.Adj v x → b ≠ r → G.Adj v b → G.degree b ≠ 1) ∨ (r ∉ A ∧ x = r ∧ ∃ v : V, G.Adj v r ∧ 2 ≤ G.degree v ∧ ∀ a ∈ A, a ≠ r → G.Adj v a → G.degree a ≠ 1) ∨ (x ≠ r ∧ G.degree x = 1 ∧ (∀ b ∈ A, ∀ v : V, G.Adj v x → b ≠ r → G.Adj v b → G.degree b ≠ 1) ∧ ∃ w : V, G.Adj w r ∧ 2 ≤ G.degree w ∧ (∀ a : V, a ≠ r → G.Adj w a → G.degree a = 1 → a ∉ A) ∧ ¬ G.Adj w x)leaf_rich_insert_leaf_of_not_mem_rIn LeanGraph Theory & Graph Algorithms
When r ∉ A, inserting a leaf x ≠ r into A preserves zero forcing provided A contains no other leaf at x's support.
theorem leaf_rich_insert_leaf_of_not_mem_r {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (r : V) (hG : graph_leaf_rich_except G r) (A : Finset V) (x : V) (hA : is_zero_forcing_set G ((Finset.univ \ A : Finset V) : Set V)) (hrA : r ∉ A) (hxr : x ≠ r) (hleaf : ∀ b ∈ A, ∀ v : V, G.Adj v x → b ≠ r → G.Adj v b → G.degree b ≠ 1) : is_zero_forcing_set G ((Finset.univ \ insert x A : Finset V) : Set V)leaf_rich_insert_leaf_of_witnessIn LeanGraph Theory & Graph Algorithms
Inserting a leaf x into A preserves zero forcing when A has no other leaf at x's support, provided A possesses a witness support w adjacent to r that is not adjacent to x.
theorem leaf_rich_insert_leaf_of_witness {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (r : V) (hG : graph_leaf_rich_except G r) (A : Finset V) (x : V) (hA : is_zero_forcing_set G ((Finset.univ \ A : Finset V) : Set V)) (hxr : x ≠ r) (hdx : G.degree x = 1) (hleaf : ∀ b ∈ A, ∀ v : V, G.Adj v x → b ≠ r → G.Adj v b → G.degree b ≠ 1) (w : V) (hwr : G.Adj w r) (hwd : 2 ≤ G.degree w) (hw : ∀ a : V, a ≠ r → G.Adj w a → G.degree a = 1 → a ∉ A) (hnot_adj : ¬ G.Adj w x) : is_zero_forcing_set G ((Finset.univ \ insert x A : Finset V) : Set V)leaf_rich_insert_non_leafIn LeanGraph Theory & Graph Algorithms
Inserting a vertex x ≠ r that is not a leaf into the complement of a zero forcing set preserves the zero forcing property.
theorem leaf_rich_insert_non_leaf {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (r : V) (hG : graph_leaf_rich_except G r) (A : Finset V) (x : V) (hA : is_zero_forcing_set G ((Finset.univ \ A : Finset V) : Set V)) (hxr : x ≠ r) (hdx : G.degree x ≠ 1) : is_zero_forcing_set G ((Finset.univ \ insert x A : Finset V) : Set V)leaf_rich_insert_rootIn LeanGraph Theory & Graph Algorithms
If r ∉ A and some support v adjacent to r with degree ≥ 2 has no leaves in A, then inserting r into A preserves zero forcing.
theorem leaf_rich_insert_root {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (r : V) (hG : graph_leaf_rich_except G r) (A : Finset V) (hA : is_zero_forcing_set G ((Finset.univ \ A : Finset V) : Set V)) (v : V) (hvr : G.Adj v r) (hvd : 2 ≤ G.degree v) (hvl : ∀ a ∈ A, a ≠ r → G.Adj v a → G.degree a ≠ 1) : is_zero_forcing_set G ((Finset.univ \ insert r A : Finset V) : Set V)linear_forest_wiener_bound_of_le_threeIn LeanGraph Theory & Graph Algorithms
Every finite connected simple graph G with decidable equality on its vertex type whose maximum order of an induced linear forest is at most 3 satisfies 4 * W(G) ≤ L(G) * n * (n - 1), where W(G) is the Wiener index of G, L(G) is the maximum order of an induced linear forest in G, and n is the number of vertices of G.
theorem linear_forest_wiener_bound_of_le_three {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (hconn : G.Connected) (hL : max_induced_linear_forest G ≤ 3) : 4 * wiener_index G ≤ max_induced_linear_forest G * Fintype.card V * (Fintype.card V - 1)locally_dense_edge_densityIn LeanGraph Theory & Graph Algorithms
If an N-vertex graph G is (ρ,d)-locally dense with ρ ≤ 1, then G has at least d·N²/2 edges, i.e. d·N² ≤ 2·|E(G)|.
theorem locally_dense_edge_density {β : Type*} [Fintype β] (G : SimpleGraph β) {ρ d : ℝ}
(hd : is_locally_dense G ρ d) (hρ : ρ ≤ 1) :
d * (Fintype.card β : ℝ) ^ 2 ≤ 2 * (Nat.card ↑G.edgeSet : ℝ)loopless_digraph_count_dominatingIn LeanGraph Theory & Graph Algorithms
In any loopless digraph with in- and out-degrees d, a dominating vertex has arcs in both directions to all other vertices, so loopless_digraph_count d equals the count on n vertices with v deleted and degrees reduced by 1.
theorem loopless_digraph_count_dominating (n : ℕ) (d : Fin (n + 1) → ℕ) (v : Fin (n + 1)) (hv : d v = n) : loopless_digraph_count d = loopless_digraph_count (fun w => d (v.succAbove w) - 1)
loopless_digraph_count_isolatedIn LeanGraph Theory & Graph Algorithms
In any loopless digraph with in- and out-degrees d, an isolated vertex has no incident arcs, so loopless_digraph_count d equals the count on n vertices with v deleted.
theorem loopless_digraph_count_isolated (n : ℕ) (d : Fin (n + 1) → ℕ) (v : Fin (n + 1)) (hv : d v = 0) : loopless_digraph_count d = loopless_digraph_count (d ∘ v.succAbove)
loopless_digraph_count_zeroIn LeanGraph Theory & Graph Algorithms
For n = 0, the unique digraph on Fin 0 is loopless and trivially satisfies the degree conditions, so loopless_digraph_count d = 1.
theorem loopless_digraph_count_zero (d : Fin 0 → ℕ) : loopless_digraph_count d = 1
matrix_abs_det_le_sqrt_prod_row_sum_sqIn LeanGraph Theory & Graph Algorithms
Hadamard's determinant inequality: for a real n × n matrix A, |det A| ≤ √(∏_{i=1}^n ∑_j A_ij²), the square root of the product of the squared Euclidean norms of the rows.
theorem matrix_abs_det_le_sqrt_prod_row_sum_sq {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) : |A.det| ≤ Real.sqrt (∏ i : Fin n, ∑ j : Fin n, (A i j) ^ 2)matrix_det_zero_of_row_sum_zeroIn LeanGraph Theory & Graph Algorithms
A real square matrix of size n ≥ 1 whose rows all sum to zero has determinant zero (since the all-ones vector is in its kernel).
theorem matrix_det_zero_of_row_sum_zero {n : ℕ} (hn : 1 ≤ n) (M : Matrix (Fin n) (Fin n) ℝ) (h_row : ∀ i : Fin n, ∑ j : Fin n, M i j = 0) : M.det = 0matrix_geom_arborescence_detIn LeanGraph Theory & Graph Algorithms
For a self-map f of Fin n with unique fixed point r, the matrix with row r all ones and rows i ≠ r equal to e_i - e_{f i} has determinant n if iterating f from every vertex reaches r, and 0 otherwise.
theorem matrix_geom_arborescence_det {n : ℕ} (hn : 1 ≤ n) (f : Fin n → Fin n) (r : Fin n) (hr : f r = r) (hne : ∀ v : Fin n, v ≠ r → f v ≠ v) : (Matrix.of (fun i j : Fin n => if i = r then (1 : ℝ) else (if i = j then (1 : ℝ) else 0) - (if f i = j then (1 : ℝ) else 0))).det = (n : ℝ) * if (∀ v : Fin n, f^[n] v = r) then (1 : ℝ) else 0matrix_spectral_radius_eq_toEuclideanCLMIn LeanGraph Theory & Graph Algorithms
The spectral radius of a real square matrix equals the spectral radius of the continuous linear operator on Euclidean space that it induces.
theorem matrix_spectral_radius_eq_toEuclideanCLM {V : Type*} [Fintype V] [DecidableEq V]
(A : Matrix V V ℝ) :
spectralRadius ℝ A = spectralRadius ℝ ((Matrix.toEuclideanCLM (𝕜 := ℝ) (n := V)) A)matrix_spectral_radius_ge_of_eigenvectorIn LeanGraph Theory & Graph Algorithms
If a real square matrix A has a nonzero real eigenvector w for a nonnegative eigenvalue lam, then ofReal lam is at most the spectral radius of A.
theorem matrix_spectral_radius_ge_of_eigenvector {n : Type*} [Fintype n] [DecidableEq n]
(A : Matrix n n ℝ) (w : n → ℝ) (lam : ℝ) (hlam : 0 ≤ lam) (hw : w ≠ 0)
(h : A.mulVec w = lam • w) : ENNReal.ofReal lam ≤ spectralRadius ℝ Amatrix_toEuclideanCLM_isSelfAdjoint_of_isSymmIn LeanGraph Theory & Graph Algorithms
If A is a real symmetric matrix, the continuous linear operator on Euclidean space that it induces is self-adjoint.
theorem matrix_toEuclideanCLM_isSelfAdjoint_of_isSymm {V : Type*} [Fintype V] [DecidableEq V]
(A : Matrix V V ℝ) (hA : A.IsSymm) :
IsSelfAdjoint (Matrix.toEuclideanCLM (𝕜 := ℝ) A)max_induced_linear_forest_delete_leIn LeanGraph Theory & Graph Algorithms
For any vertex u in a finite simple graph G with decidable equality on its vertex type, the maximum order of an induced linear forest in G.delete u is at most that in G, max_induced_linear_forest (G.delete u) ≤ max_induced_linear_forest G.
theorem max_induced_linear_forest_delete_le {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (u : V) : max_induced_linear_forest (G.delete u) ≤ max_induced_linear_forest Gmax_induced_linear_forest_ge_three_of_not_completeIn LeanGraph Theory & Graph Algorithms
Every finite connected simple graph that is not complete has maximum order of an induced linear forest at least 3.
theorem max_induced_linear_forest_ge_three_of_not_complete {V : Type*} [Fintype V] (G : SimpleGraph V) (hconn : G.Connected) (hnot : G ≠ ⊤) : 3 ≤ max_induced_linear_forest Gmean_order_eq_iff_q_zeroIn LeanGraph Theory & Graph Algorithms
For lambda >= 1 the weighted mean order of G equals that of K_n if and only if Q_G(lambda) vanishes at lambda.
open scoped BigOperators Polynomial Classical in
theorem mean_order_eq_iff_q_zero {V : Type*} [Fintype V] [Nonempty V]
(G : SimpleGraph V) {lam : ℝ} (hlam : 1 ≤ lam) :
connected_induced_mean_order G lam = weighted_clique_mean (Fintype.card V) lam ↔
(conn_set_poly_Q G).eval lam = 0mean_order_ge_iff_q_nonnegIn LeanGraph Theory & Graph Algorithms
For lambda >= 1 the weighted mean order of G is at least that of K_n if and only if Q_G(lambda) is nonnegative, since the denominator Z_G(lambda)*((1+lambda)^n-1) is positive.
open scoped BigOperators Polynomial Classical in
theorem mean_order_ge_iff_q_nonneg {V : Type*} [Fintype V] [Nonempty V]
(G : SimpleGraph V) {lam : ℝ} (hlam : 1 ≤ lam) :
weighted_clique_mean (Fintype.card V) lam ≤ connected_induced_mean_order G lam ↔
0 ≤ (conn_set_poly_Q G).eval lammean_order_sub_clique_meanIn LeanGraph Theory & Graph Algorithms
The lambda-weighted mean order of G minus that of K_n equals lambda times Q_G(lambda), divided by Z_G(lambda) times ((1+lambda)^n - 1).
open scoped BigOperators Polynomial Classical in
theorem mean_order_sub_clique_mean {V : Type*} [Fintype V] (G : SimpleGraph V) (lam : ℝ)
(hZ : (conn_set_poly G).eval lam ≠ 0) (hD : (1 + lam) ^ Fintype.card V - 1 ≠ 0) :
connected_induced_mean_order G lam - weighted_clique_mean (Fintype.card V) lam
= lam * (conn_set_poly_Q G).eval lam
/ ((conn_set_poly G).eval lam * ((1 + lam) ^ Fintype.card V - 1))minor_bridge_edges_sup_forest_isAcyclicIn LeanGraph Theory & Graph Algorithms
For any partial realization β on a graph G, taking an acyclic subgraph F₀ of the weight-0 edges together with all bridge edges in the minor G_β produces an acyclic graph.
open scoped Classical in
theorem minor_bridge_edges_sup_forest_isAcyclic {V : Type*} [Fintype V]
(G : SimpleGraph V) (β : G.edgeSet → Option Bool)
(F₀ : SimpleGraph V)
(hF₀_le : F₀ ≤ SimpleGraph.fromEdgeSet {s | ∃ h : s ∈ G.edgeSet, β ⟨s, h⟩ = some false})
(hF₀_ac : F₀.IsAcyclic) :
(F₀ ⊔ SimpleGraph.fromEdgeSet
{s | ∃ h : s ∈ G.edgeSet, β ⟨s, h⟩ = none ∧ minor_edge_is_bridge G β ⟨s, h⟩}).IsAcyclicminor_edges_loop_or_bridge_imp_mst_id_certificateIn LeanGraph Theory & Graph Algorithms
If every unqueried edge of a connected simple graph G on a finite vertex set is either a loop or a bridge in the minor G_β, then β is an MST identification certificate for G.
open scoped Classical in
theorem minor_edges_loop_or_bridge_imp_mst_id_certificate {V : Type*} [Fintype V]
(G : SimpleGraph V) (hG : G.Connected) (β : G.edgeSet → Option Bool)
(hall : ∀ (e : G.edgeSet), β e = none →
minor_edge_is_loop G β e ∨ minor_edge_is_bridge G β e) :
is_mst_certificate G βmst_and_dist_bounds_on_optimal_tour_lengthIn LeanGraph Theory & Graph Algorithms
For every finite connected undirected graph G on n ≥ 2 vertices with positive edge weights w, (a) the weight of a minimum spanning tree is at most ((n - 1) / n) times the minimum length of a closed walk visiting all vertices, and (b) the minimum length of a closed walk visiting all vertices is at least twice the shortest-path distance between any two vertices u and v.
theorem mst_and_dist_bounds_on_optimal_tour_length {V : Type*} [Fintype V]
(G : SimpleGraph V) (hG : G.Connected) (hn : 2 ≤ Fintype.card V)
(w : Sym2 V → ℝ) (hw : ∀ e ∈ G.edgeSet, 0 < w e) :
mst_weight G w ≤ ((Fintype.card V - 1 : ℝ) / (Fintype.card V : ℝ)) * optimal_tour_length G w ∧
∀ u v : V, 2 * weighted_dist G w u v ≤ optimal_tour_length G wmst_id_certificate_iff_minor_edges_loop_or_bridgeIn LeanGraph Theory & Graph Algorithms
Let G be a connected simple graph on a finite vertex set and let β : G.edgeSet → Option Bool be a partial realization of edge weights. Then β is an MST identification certificate on graph G if and only if every unqueried edge of the minor G_β (obtained by contracting edges with weight 0 and deleting edges with weight 1) is either a loop or a bridge.
open scoped Classical in
theorem mst_id_certificate_iff_minor_edges_loop_or_bridge {V : Type*} [Fintype V]
(G : SimpleGraph V) (hG : G.Connected) (β : G.edgeSet → Option Bool) :
is_mst_certificate G β ↔
∀ (e : G.edgeSet), β e = none →
minor_edge_is_loop G β e ∨ minor_edge_is_bridge G β emst_le_factor_optimal_tourIn LeanGraph Theory & Graph Algorithms
In any finite connected simple graph G on n ≥ 2 vertices with positive edge weights w, the weight of a minimum spanning tree is at most ((n - 1) / n) times the minimum length of a closed walk visiting all vertices.
theorem mst_le_factor_optimal_tour {V : Type*} [Fintype V]
(G : SimpleGraph V) (hG : G.Connected) (hn : 2 ≤ Fintype.card V)
(w : Sym2 V → ℝ) (hw : ∀ e ∈ G.edgeSet, 0 < w e) :
mst_weight G w ≤ ((Fintype.card V - 1 : ℝ) / (Fintype.card V : ℝ)) * optimal_tour_length G wmst_weight_le_of_connected_subgraphIn LeanGraph Theory & Graph Algorithms
In any finite edge-weighted graph G with non-negative edge weights w, the minimum spanning tree weight is bounded above by the total edge weight of any connected spanning subgraph H ≤ G.
theorem mst_weight_le_of_connected_subgraph {V : Type*} [Fintype V]
(G : SimpleGraph V) (w : Sym2 V → ℝ) (hw : ∀ e ∈ G.edgeSet, 0 ≤ w e)
(H : SimpleGraph V) (hH : H.Connected) (hHG : H ≤ G) :
open scoped Classical in
mst_weight G w ≤ ∑ e ∈ H.edgeFinset, w emultiflow_unit_reduction_c4In LeanGraph Theory & Graph Algorithms
If capacities u : E → ℝ and demands d : K → ℝ are integral, f is a feasible multiflow, and the total flow on edge e0 is strictly less than u e0, then reducing the capacity of e0 by 1 still satisfies condition (C4) with demands d.
theorem multiflow_unit_reduction_c4
{V E K : Type*} [Fintype E] [Fintype K] [DecidableEq V] [DecidableEq E]
(G : DirectedMultigraph V E) (H : DirectedMultigraph V K)
(u : E → ℝ) (d : K → ℝ) (hu_int : IsIntegralWeight u) (hd_int : IsIntegralWeight d)
(f : K → E → ℝ) (hfeas : IsFeasibleMultiflow G H u d f)
(e0 : E) (he0 : (∑ i : K, f i e0) < u e0) :
SatisfiesC4 G H (fun e => if e = e0 then u e - 1 else u e) dmutual_visibility_set_card_boundIn LeanGraph Theory & Graph Algorithms
Let G be a d-regular simple graph of girth at least 5 on a finite vertex set V. If S is a finite mutual-visibility set of G, then (2 * d - 1) * S.card ≤ d * Fintype.card V.
theorem mutual_visibility_set_card_bound {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d)
(hgirth : 5 ≤ G.girth) {S : Finset V} (hS : is_mutual_visibility_set G (S : Set V)) :
(2 * d - 1) * S.card ≤ d * Fintype.card Vmutual_visibility_set_max_degree_le_oneIn LeanGraph Theory & Graph Algorithms
Let G be a simple graph of girth at least 5 on a finite vertex set. If S is a finite mutual-visibility set of G, then every vertex in S has at most one neighbor in S.
theorem mutual_visibility_set_max_degree_le_one {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hgirth : 5 ≤ G.girth)
{S : Finset V} (hS : is_mutual_visibility_set G (S : Set V)) {u : V} (hu : u ∈ S) :
(G.neighborFinset u ∩ S).card ≤ 1nat_card_perm_preserving_finsetIn LeanGraph Theory & Graph Algorithms
If s and t are disjoint finsets covering a finite type V, then the number of permutations of V mapping s setwise onto itself is |s|! · |t|!.
theorem nat_card_perm_preserving_finset {V : Type*} [Fintype V] [DecidableEq V]
(s t : Finset V) (hdisj : Disjoint s t) (huniv : s ∪ t = Finset.univ) :
Nat.card {σ : Equiv.Perm V // ∀ v : V, (v ∈ s ↔ σ v ∈ s)} = s.card.factorial * t.card.factorialnat_k_le_one_add_choose_twoIn LeanGraph Theory & Graph Algorithms
For any natural number k, k ≤ 1 + k.choose 2.
theorem nat_k_le_one_add_choose_two (k : ℕ) : k ≤ 1 + k.choose 2
nat_min_cyclic_dist_le_natAbsIn LeanGraph Theory & Graph Algorithms
If an integer x is congruent to k mod n with k < n, then |x| >= min(k, n-k).
theorem nat_min_cyclic_dist_le_natAbs (n k : ℕ) (x : ℤ) (hk : k < n)
(h : x ≡ (k : ℤ) [ZMOD (n : ℤ)]) : min k (n - k) ≤ x.natAbsnet_graph_claw_freeIn LeanGraph Theory & Graph Algorithms
The net graph is claw-free: its only vertices of degree at least 3 are 0, 4 and 5 (each of degree 3), and each has an adjacent pair among its three neighbours (4-5, 0-5, 0-4 respectively), so no vertex has three pairwise non-adjacent neighbours, i.e. no induced K_{1,3}.
theorem net_graph_claw_free : IsClawFree net_graph
net_graph_connectedIn LeanGraph Theory & Graph Algorithms
The net graph is connected: every vertex reaches 0 (1→4→0, 2→5→0, 3→0, 4→0, 5→0).
theorem net_graph_connected : net_graph.Connected
net_graph_no_dominating_pairIn LeanGraph Theory & Graph Algorithms
The net graph has no dominating pair: every closed neighbourhood has size at most 4, and for every pair {u,v} some vertex is undominated ({0,4} misses 2, {0,5} misses 1, {4,5} misses 3; any pair containing a leaf only covers less).
theorem net_graph_no_dominating_pair : ¬ (∃ u v : ULift (Fin 6), ∀ w : ULift (Fin 6), w = u ∨ w = v ∨ net_graph.Adj u w ∨ net_graph.Adj v w)
net_graph_no_long_cycleIn LeanGraph Theory & Graph Algorithms
The net graph contains no induced cycle of length at least 6: for m > 6 an induced embedding is an injection Fin m → Fin 6 (impossible), and for m = 6 no induced 6-cycle exists because the three leaves have degree 1 while every vertex of C6 has degree 2.
theorem net_graph_no_long_cycle : ∀ (m : ℕ), 6 ≤ m → IsEmpty (SimpleGraph.cycleGraph m ↪g net_graph)
net_graph_no_six_cycleIn LeanGraph Theory & Graph Algorithms
The net graph contains no induced 6-cycle. Every vertex of C6 has two distinct neighbours; an induced embedding preserves this, but the leaves 1, 2, 3 of the net graph have exactly one neighbour each, so the image of the embedding must lie in {0,4,5}, contradicting injectivity of a map from a 6-element set.
theorem net_graph_no_six_cycle : IsEmpty (SimpleGraph.cycleGraph 6 ↪g net_graph)
net_graph_pk_freeIn LeanGraph Theory & Graph Algorithms
The net graph on 6 vertices is P7-free, since an induced P7 needs 7 distinct vertices but the graph has only 6.
theorem net_graph_pk_free : IsPkFree net_graph 7
non_unimodal_connected_and_total_forcing_polynomials_gtIn LeanGraph Theory & Graph Algorithms
For every integer t ≥ 24, the connected forcing polynomial and the total forcing polynomial of gt_graph t are both equal to the zero forcing polynomial of gt_graph t, and neither the connected forcing polynomial nor the total forcing polynomial is unimodal.
theorem non_unimodal_connected_and_total_forcing_polynomials_gt (t : ℕ) (ht : 24 ≤ t) :
connected_forcing_poly (gt_graph t) = zero_forcing_poly (gt_graph t) ∧
total_forcing_poly (gt_graph t) = zero_forcing_poly (gt_graph t) ∧
¬ polynomial_is_unimodal (connected_forcing_poly (gt_graph t)) ∧
¬ polynomial_is_unimodal (total_forcing_poly (gt_graph t))nonsustainable_tree_has_nonsustainable_successor_closer_to_starIn LeanGraph Theory & Graph Algorithms
Every non-sustainable tree X on Fin n (n ≥ 2) that is not isomorphic to the star completeBipartiteGraph (Fin 1) (Fin (n-1)) has a non-sustainable generalized-tree-shift successor Y whose adjacency spectral radius is strictly larger.
theorem nonsustainable_tree_has_nonsustainable_successor_closer_to_star
(n : ℕ) (hn : 2 ≤ n) (X : SimpleGraph (Fin n))
(hX : is_nonsustainable_tree X)
(hXs : ¬ Nonempty (X ≃g completeBipartiteGraph (Fin 1) (Fin (n - 1)))) :
∃ Y : SimpleGraph (Fin n),
is_nonsustainable_tree Y ∧ is_generalized_tree_shift X Y ∧
adjacency_spectral_radius X < adjacency_spectral_radius Ynot_diam_le_three_of_forall_power_well_coveredIn LeanGraph Theory & Graph Algorithms
The statement diam_le_three_of_forall_power_well_covered is false: The statement is false. Counterexample: the circulant graph G = C_21(1,7) on V = Z/21Z, with x ~ y iff (y − x) mod 21 ∈ {1, 7, 14, 20} (i.e. y−x = ±1 or ±7).
It satisfies all hypotheses of the theorem but has diameter 4 > 3:
1. Connected: the ±1 edges alone make C_21 a spanning cycle.
2. diam(G) = 4: not all vertex pairs are within distance 3, but all are within distance 4; explicitly dist(0,4) = 4.
3. Every power G^d is well-covered (all maximal independent sets of G^d have the same size):
- d = 1: every maximal independent set has size 7 (there are 129 of them),
- d = 2: every maximal independent set has size 3 (84 of them),
- d = 3: every maximal independent set has size 2 (42 of them),
- d ≥ 4: G^d is the complete graph K_21 (since diam = 4), whose maximal independent sets are the 21 singletons, all of size 1.
So ∀ d ≥ 1, simple_graph_is_well_covered (simple_graph_power G d) holds, while G.diam = 4, contradicting G.diam ≤ 3.
This was checked with Lean's own evaluator against the graph's exact combinatorics (experiments 2061 and 2062, recorded in memory): experiment 2061 computed the maximal-independent-set size tallies [(7,129)], [(3,84)], [(2,42)] for d = 1,2,3, and experiment 2062 confirmed all pairs reachable (connected), all pairs within distance 4, and some pair NOT within distance 3. Independent Python/networkx experiments 2019, 2020, 2022, 2023 (also in memory) agree, and experiment 2020 found the whole family C_21(i,7), C_28(i,7,14), etc., as well as the Cartesian products C_7 □ K_m (m ≥ 3, diameter 3+1 = 4) with all powers well-covered.
My own exhaustive search for n ≤ 7 (experiments 2055–2058) found no smaller counterexample, which is consistent: the smallest witness genuinely needs 21 vertices.
theorem not_diam_le_three_of_forall_power_well_covered : ¬ (∀ {V : Type} [Fintype V] (G : SimpleGraph V), G.Connected →
(∀ d : ℕ, 1 ≤ d → simple_graph_is_well_covered (simple_graph_power G d)) → G.diam ≤ 3)not_digraph_two_cycle_free_degree_profile_transitive_fiveIn LeanGraph Theory & Graph Algorithms
The statement digraph_two_cycle_free_degree_profile_transitive_five is false: The statement is false for n = 5.
When n = 5, the degree hypothesis hdeg specifies outdegrees 1, 2, 3, 4, 5 for vertices 0, 1, 2, 3, 4 respectively.
Consider the digraph D on Fin 5 with adjacency:
- 0 -> {0}
- 1 -> {0, 4}
- 2 -> {0, 1, 4}
- 3 -> {0, 1, 2, 4}
- 4 -> {0, 1, 2, 3, 4}.
This graph satisfies all hypotheses:
1. hn : 5 ≤ 5 is trivial.
2. hdeg: outdegrees are exactly 1, 2, 3, 4, 5 (all v.val < 5, so the else 7 branch is never reached).
3. htwo: For any nonempty subset T ⊆ Fin 5, T cannot have minimum induced outdegree at least 2. Indeed, vertex 0 only points to 0, so 0 ∉ T. Then 1 only points to 4 in Fin 5 \ {0}, so 1 ∉ T. Then 2 only points to 4 in Fin 5 \ {0, 1}, so 2 ∉ T. Similarly 3 ∉ T and 4 ∉ T. Hence no nonempty T satisfies the premise of htwo, making htwo vacuously true.
4. hno: Any directed cycle of length at least 2 cannot be contained in {0, 1, 2, 3} (since 0 has no outneighbors in {1, 2, 3}, and on {1, 2, 3} the adjacency is strictly decreasing in vertex index, precluding directed cycles). Thus every directed cycle of length ≥ 2 contains vertex 4. Therefore, any two directed cycles intersect at vertex 4 and cannot be disjoint. Hence hno holds.
However, the second conclusion conjunct asserts:
3 ≤ (Finset.univ.filter fun u : Fin n => 5 ≤ u.val ∧ ∀ v : Fin n, v.val < 5 → D.Adj u v).card.
For n = 5, no vertex u : Fin 5 satisfies 5 ≤ u.val, so this filter is empty, having cardinality 0. The assertion 3 ≤ 0 is false.
theorem not_digraph_two_cycle_free_degree_profile_transitive_five : ¬ (∀ (n : ℕ) (D : Digraph (Fin n)) [DecidableRel D.Adj]
(hn : 5 ≤ n)
(hdeg : ∀ v, (Finset.univ.filter fun w => D.Adj v w).card =
if v.val < 5 then v.val + 1 else 7)
(htwo : ∀ T : Finset (Fin n), T.Nonempty →
(∀ v ∈ T, 2 ≤ (T.filter fun w => D.Adj v w).card) →
(T.filter fun v => (T.filter fun w => D.Adj v w).card < 3).card ≤ 2 →
∃ c : Fin 2 → Finset (Fin n), (∀ i, c i ⊆ T ∧ digraph_directed_cycle_on D (c i)) ∧
Pairwise (fun i j => Disjoint (c i) (c j)))
(hno : ¬ ∃ c : Fin 2 → Finset (Fin n),
(∀ i, digraph_directed_cycle_on D (c i)) ∧ Pairwise (fun i j => Disjoint (c i) (c j))), (∀ u v : Fin n, u.val < 5 → v.val < u.val → D.Adj u v) ∧
3 ≤ (Finset.univ.filter fun u : Fin n =>
5 ≤ u.val ∧ ∀ v : Fin n, v.val < 5 → D.Adj u v).card)not_forall_power_well_covered_diam_le_three_and_twin_free_boundedIn LeanGraph Theory & Graph Algorithms
The statement forall_power_well_covered_diam_le_three_and_twin_free_bounded is false: The statement is false. Both conjuncts of the conjunction fail with explicit families of counterexamples:
1. The first conjunct asserts that every finite connected graph G whose powers G^d are all well-covered has diam(G) ≤ 3.
Counterexample: The circulant graph C_21(1, 7) on 21 vertices (experiment 2022) is connected and has diameter exactly 4. Its powers G^d have all maximal independent sets of equal cardinality:
- d = 1: all maximal independent sets have size 7
- d = 2: all maximal independent sets have size 3
- d = 3: all maximal independent sets have size 2
- d ≥ 4: G^d = K_21, all maximal independent sets have size 1.
Thus G^d is well-covered for all d ≥ 1, but diam(G) = 4 > 3.
Similarly, the Cartesian products C_7 □ K_m for any m ≥ 3 also have diameter 3 + 1 = 4 and have all powers well-covered (experiment 2023).
2. The second conjunct asserts that there is a uniform bound M on the order of connected, twin-free graphs of diameter 3 with all powers well-covered.
Counterexample: The Cartesian product G_m = C_5 □ K_m for m ≥ 3 (experiment 2023):
- diam(G_m) = diam(C_5) + diam(K_m) = 2 + 1 = 3.
- G_m is twin-free: for any adjacent u, v, N[u] ≠ N[v]. Specifically, if u = (x, i) and v = (x, j) with i ≠ j in K_m, then (x-1, i) ∈ N[u] \ N[v]. If u = (x, i) and v = (x+1, i) along C_5, then (x, j) ∈ N[u] \ N[v] for any j ≠ i (which exists since m ≥ 2).
- All powers of G_m are well-covered: for d = 1, every maximal independent set has size 5; for d = 2, size 2; for d ≥ 3, size 1.
- |V(G_m)| = 5m, which is unbounded as m → ∞. Hence no finite uniform bound M exists.
theorem not_forall_power_well_covered_diam_le_three_and_twin_free_bounded : ¬ ((∀ {V : Type} [Fintype V] (G : SimpleGraph V), G.Connected →
(∀ d : ℕ, 1 ≤ d → simple_graph_is_well_covered (simple_graph_power G d)) → G.diam ≤ 3) ∧
∃ M : ℕ, ∀ {V : Type} [Fintype V] (G : SimpleGraph V), G.Connected →
(∀ d : ℕ, 1 ≤ d → simple_graph_is_well_covered (simple_graph_power G d)) → G.diam = 3 →
(∀ u v : V, G.Adj u v → insert u (G.neighborSet u) ≠ insert v (G.neighborSet v)) →
Fintype.card V ≤ M)not_has_hole_of_length_at_least_top_fin_fourIn LeanGraph Theory & Graph Algorithms
The complete graph on 4 vertices has no hole of length at least 5: there are not enough vertices to support an induced cycle on 5 or more vertices.
theorem not_has_hole_of_length_at_least_top_fin_four :
¬ HasHoleOfLengthAtLeast (⊤ : SimpleGraph (Fin 4)) 5not_is_fix_v0_of_neighbors_unreachableIn LeanGraph Theory & Graph Algorithms
If no two distinct neighbors of a vertex v in a finite simple graph G are reachable from each other in the vertex-deleted subgraph G - v, then v does not belong to V_fix^0(G).
lemma not_is_fix_v0_of_neighbors_unreachable {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (v : V)
(hunreach : ∀ (u w : V) (hu : G.Adj v u) (hw : G.Adj v w), u ≠ w →
¬ (G.induce ({v}ᶜ : Set V)).Reachable ⟨u, (G.ne_of_adj hu).symm⟩ ⟨w, (G.ne_of_adj hw).symm⟩) :
¬ is_fix_v0 G vnot_proportionally_choosable_of_no_independent_transversalIn LeanGraph Theory & Graph Algorithms
Suppose G is a finite simple graph and for some m ≥ 2 and k ≥ 2, {A_1, ..., A_m} is a partition of V(G) into blocks of size k. If there is no independent set I in G such that |I ∩ A_i| = 1 for each i ∈ [m], then G is not proportionally k-choosable (hence χ_pc(G) > k).
theorem not_proportionally_choosable_of_no_independent_transversal
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(m k : ℕ) (hm : 2 ≤ m) (hk : 2 ≤ k)
(A : Fin m → Finset V)
(hcard : ∀ i, (A i).card = k)
(hdisj : Pairwise (fun i j => Disjoint (A i) (A j)))
(hunion : Finset.univ.biUnion A = Finset.univ)
(hno_indep : ¬ ∃ I : Finset V, G.IsIndepSet (I : Set V) ∧ ∀ i : Fin m, (I ∩ A i).card = 1) :
¬ ∀ (α : Type) [Fintype α] [DecidableEq α] (L : V → Finset α),
(∀ v, (L v).card = k) →
∃ f : G.Coloring α,
(∀ v, f v ∈ L v) ∧
∀ c : α,
let η := (Finset.univ.filter (fun v => c ∈ L v)).card
let uses := (Finset.univ.filter (fun v => f v = c)).card
uses = η / k ∨ uses = η ⌈/⌉ knot_simple_graph_local_avg_dominating_order_eq_one_add_half_leaf_count_add_avg_erase_leaf_neighborsIn LeanGraph Theory & Graph Algorithms
The statement simple_graph_local_avg_dominating_order_eq_one_add_half_leaf_count_add_avg_erase_leaf_neighbors is false: The statement is false as stated. The hypothesis hstem allows z = v, so when v is a leaf whose neighbor y has degree > 1, y's leaf neighbor z can be v itself. In that case, S \ K does not necessarily dominate G - K (e.g. S = {0, 3} in P4 dominates P4, but S \ {0} = {3} does not dominate P4 - {0} = P3). For P4 at an endpoint (v = 0), the LHS avd_0(P4) = 17/6, but the RHS is 1 + 0/2 + avd(P3) = 3, and 17/6 ≠ 3. The hypothesis needs either that v is a stem (e.g., degree v ≥ 2, or simple_graph_leaf_neighbor_count G v ≥ 1, or z ≠ v).
theorem not_simple_graph_local_avg_dominating_order_eq_one_add_half_leaf_count_add_avg_erase_leaf_neighbors : ¬ (∀ {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (v : V)
(hstem : ∀ y, G.Adj v y → G.degree y ≠ 1 → ∃ z, G.Adj y z ∧ G.degree z = 1), simple_graph_local_avg_dominating_order G v =
1 + (simple_graph_leaf_neighbor_count G v : ℚ) / 2 +
simple_graph_avg_dominating_order
(G.induce ((Finset.univ \ insert v ((G.neighborFinset v).filter
(fun u => G.degree u = 1)) : Finset V) : Set V)))not_strictly_dismantlable_of_isEmptyIn LeanGraph Theory & Graph Algorithms
If a vertex type V is empty, then no simple graph G on V is strictly k-dismantlable for any integer k.
theorem not_strictly_dismantlable_of_isEmpty (k : ℤ) (V : Type) [IsEmpty V] (G : SimpleGraph V) : ¬ graph_is_strictly_dismantlable k V G
not_strictly_dismantlable_singleIn LeanGraph Theory & Graph Algorithms
If a vertex type V is nonempty and a subsingleton, then no simple graph G on V is strictly k-dismantlable for any integer k ≥ 1.
theorem not_strictly_dismantlable_single (k : ℤ) (hk : 1 ≤ k) (V : Type) [Nonempty V] [Subsingleton V] (G : SimpleGraph V) : ¬ graph_is_strictly_dismantlable k V G
one_add_pow_card_sub_one_posIn LeanGraph Theory & Graph Algorithms
For a nonempty finite vertex set and any real lambda >= 1, (1+lambda)^n - 1 is strictly positive.
open scoped BigOperators Polynomial Classical in
theorem one_add_pow_card_sub_one_pos {V : Type*} [Fintype V] [Nonempty V]
{lam : ℝ} (hlam : 1 ≤ lam) : 0 < (1 + lam) ^ Fintype.card V - 1op1012_one_le_adjacency_spectral_radiusIn LeanGraph Theory & Graph Algorithms
For any connected simple graph G on a finite vertex set with at least 2 vertices, its real adjacency spectral radius is at least 1.
attribute [local instance] Classical.propDecidable in
theorem op1012_one_le_adjacency_spectral_radius
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(hconn : G.Connected) (hn : 2 ≤ Fintype.card V) :
1 ≤ (adjacency_spectral_radius G).toRealop1012_randic_index_eq_quadratic_formIn LeanGraph Theory & Graph Algorithms
The Randić index relates to the quadratic form of the real adjacency matrix: 2 * randic_index G equals the sum over u and v of (1/sqrt(deg u)) * A_{uv} * (1/sqrt(deg v)) (with 0 for isolated vertices).
attribute [local instance] Classical.propDecidable in
theorem op1012_randic_index_eq_quadratic_form
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) :
2 * randic_index G =
∑ u : V, ∑ v : V,
(if G.degree u = 0 then (0 : ℝ) else 1 / Real.sqrt (G.degree u : ℝ)) *
(G.adjMatrix ℝ u v) *
(if G.degree v = 0 then (0 : ℝ) else 1 / Real.sqrt (G.degree v : ℝ))op1012_randic_le_rank_mul_spectral_radius_of_regularIn LeanGraph Theory & Graph Algorithms
For any connected d-regular simple graph G with d ≥ 1, twice the Randić index is at most the rank of its real adjacency matrix times its spectral radius.
attribute [local instance] Classical.propDecidable in
theorem op1012_randic_le_rank_mul_spectral_radius_of_regular
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(hconn : G.Connected) (d : ℕ) (hd : 1 ≤ d) (hreg : G.IsRegularOfDegree d) :
2 * randic_index G ≤ (Matrix.rank (G.adjMatrix ℝ) : ℝ) * (adjacency_spectral_radius G).toRealop1012_two_le_rank_adjMatrixIn LeanGraph Theory & Graph Algorithms
For any connected simple graph G on a finite vertex set with at least 2 vertices, the matrix rank of its real adjacency matrix is at least 2.
attribute [local instance] Classical.propDecidable in
theorem op1012_two_le_rank_adjMatrix
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(hconn : G.Connected) (hn : 2 ≤ Fintype.card V) :
2 ≤ Matrix.rank (G.adjMatrix ℝ)op1012_two_mul_randic_index_of_regularIn LeanGraph Theory & Graph Algorithms
For any d-regular simple graph G on a finite vertex set V with degree d ≥ 1, twice the Randić index equals the vertex count |V|.
attribute [local instance] Classical.propDecidable in
theorem op1012_two_mul_randic_index_of_regular
{V : Type*} [Fintype V] (G : SimpleGraph V) (d : ℕ) (hd : 1 ≤ d)
(hreg : G.IsRegularOfDegree d) :
2 * randic_index G = Fintype.card Vop1514_strictly_two_dismantlable_not_card_elevenIn LeanGraph Theory & Graph Algorithms
No finite simple graph on 11 vertices is strictly 2-dismantlable (every 11-vertex graph in D_2 already belongs to D_1).
theorem op1514_strictly_two_dismantlable_not_card_eleven (V : Type) [Fintype V] (G : SimpleGraph V) (hcard : Fintype.card V = 11) : ¬ graph_is_strictly_dismantlable 2 V G
op1514_strictly_two_dismantlable_not_card_tenIn LeanGraph Theory & Graph Algorithms
No finite simple graph on 10 vertices is strictly 2-dismantlable (every 10-vertex graph in D_2 already belongs to D_1).
theorem op1514_strictly_two_dismantlable_not_card_ten (V : Type) [Fintype V] (G : SimpleGraph V) (hcard : Fintype.card V = 10) : ¬ graph_is_strictly_dismantlable 2 V G
op1633_witness_bipartiteIn LeanGraph Theory & Graph Algorithms
The witness graph G* is bipartite, with parts {0,1,2,6,7,8} and {3,4,5,9,10,11}.
theorem op1633_witness_bipartite : op1633_witness_graph.IsBipartite
op1633_witness_connectedIn LeanGraph Theory & Graph Algorithms
The witness graph G* is connected.
theorem op1633_witness_connected : op1633_witness_graph.Connected
op1633_witness_connectivityIn LeanGraph Theory & Graph Algorithms
The witness graph G* has vertex connectivity two: no set of at most one vertex disconnects it, and the pair {0,3} does.
theorem op1633_witness_connectivity : ghz_graph_vertex_connectivity op1633_witness_graph = 2
op1633_witness_cut_twoIn LeanGraph Theory & Graph Algorithms
The vertex set {0,3} is a vertex cut of G* of size 2: removing it leaves a disconnected induced subgraph.
theorem op1633_witness_cut_two :
¬ (op1633_witness_graph.induce (({0, 3} : Finset (Fin 12)) : Set (Fin 12))ᶜ).Preconnectedop1633_witness_no_fallIn LeanGraph Theory & Graph Algorithms
The witness graph G* does not admit a fall colouring with three colours.
theorem op1633_witness_no_fall : ¬ has_fall_coloring (Fin 3) op1633_witness_graph
op1633_witness_no_fall_copy_oneIn LeanGraph Theory & Graph Algorithms
In any fall 3-colouring of G* the colours satisfy c(3) = c(7) and c(9) = c(1).
theorem op1633_witness_no_fall_copy_one (c : op1633_witness_graph.Coloring (Fin 3))
(hc : ∀ v, ⇑c '' insert v (op1633_witness_graph.neighborSet v) = Set.univ) :
c 3 = c 7 ∧ c 9 = c 1op1633_witness_no_fall_copy_twoIn LeanGraph Theory & Graph Algorithms
In any fall 3-colouring of G* the colours satisfy c(3) = c(9).
theorem op1633_witness_no_fall_copy_two (c : op1633_witness_graph.Coloring (Fin 3))
(hc : ∀ v, ⇑c '' insert v (op1633_witness_graph.neighborSet v) = Set.univ) :
c 3 = c 9op1633_witness_regularIn LeanGraph Theory & Graph Algorithms
The witness graph G* is 3-regular.
theorem op1633_witness_regular : op1633_witness_graph.IsRegularOfDegree 3
op223_adjMatrix_sq_diagIn LeanGraph Theory & Graph Algorithms
The diagonal entry of the square of the adjacency matrix at a vertex is the degree of that vertex: (A^2)_{vv} = deg v.
open scoped Classical in
theorem op223_adjMatrix_sq_diag {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (v : V) :
(G.adjMatrix ℝ ^ 2) v v = (Nat.card (G.neighborSet v) : ℝ)op223_adjacency_spectral_radius_isoIn LeanGraph Theory & Graph Algorithms
The adjacency spectral radius is an isomorphism invariant of finite simple graphs: if G and H are isomorphic finite simple graphs then their adjacency spectral radii are equal.
theorem op223_adjacency_spectral_radius_iso {V W : Type*} [Fintype V] [DecidableEq V]
[Fintype W] [DecidableEq W]
{G : SimpleGraph V} {H : SimpleGraph W} (e : G ≃g H) :
adjacency_spectral_radius G = adjacency_spectral_radius Hop223_adjacent_gts_spectral_radius_ltIn LeanGraph Theory & Graph Algorithms
For any tree T on a finite type V and adjacent vertices u, v where v has degree at least 2, shifting the neighbours of v other than u to u strictly increases the adjacency spectral radius.
theorem op223_adjacent_gts_spectral_radius_lt {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) (hT : T.IsTree) (u v : V) (huv : T.Adj u v)
(hv : 2 ≤ Nat.card (T.neighborSet v)) :
adjacency_spectral_radius T < adjacency_spectral_radius (gts_graph T u v u)op223_example_graph_edge_04_sustainableIn LeanGraph Theory & Graph Algorithms
Edge 0-4 in op223_example_graph is sustainable.
theorem op223_example_graph_edge_04_sustainable : is_sustainable_edge op223_example_graph s(0, 4)
op223_example_graph_edge_07_sustainableIn LeanGraph Theory & Graph Algorithms
Edge 0-7 in op223_example_graph is sustainable.
theorem op223_example_graph_edge_07_sustainable : is_sustainable_edge op223_example_graph s(0, 7)
op223_example_graph_edge_12_sustainableIn LeanGraph Theory & Graph Algorithms
Edge 1-2 in op223_example_graph is sustainable.
theorem op223_example_graph_edge_12_sustainable : is_sustainable_edge op223_example_graph s(1, 2)
op223_example_graph_edge_23_sustainableIn LeanGraph Theory & Graph Algorithms
Edge 2-3 in op223_example_graph is sustainable.
theorem op223_example_graph_edge_23_sustainable : is_sustainable_edge op223_example_graph s(2, 3)
op223_example_graph_edge_45_sustainableIn LeanGraph Theory & Graph Algorithms
Edge 4-5 in op223_example_graph is sustainable.
theorem op223_example_graph_edge_45_sustainable : is_sustainable_edge op223_example_graph s(4, 5)
op223_example_graph_edge_46_sustainableIn LeanGraph Theory & Graph Algorithms
Edge 4-6 in op223_example_graph is sustainable.
theorem op223_example_graph_edge_46_sustainable : is_sustainable_edge op223_example_graph s(4, 6)
op223_example_slide_edge_memIn LeanGraph Theory & Graph Algorithms
The edge {0,7} belongs to the edge set of both slide graphs of the eight-vertex example (the slides at b = 0 and b = 6).
theorem op223_example_slide_edge_mem (b : Fin 8) (hb : b = 0 ∨ b = 6) :
s(0, 7) ∈ (op223_example_slide b).edgeSetop223_example_slide_leaf_slide_radius_ltIn LeanGraph Theory & Graph Algorithms
For either slide of the example and any non-edge f such that deleting the edge {0,7} and adding f gives a tree, that tree has adjacency spectral radius strictly less than ofReal 2.
theorem op223_example_slide_leaf_slide_radius_lt (b : Fin 8) (hb : b = 0 ∨ b = 6)
(f : Sym2 (Fin 8)) (hf : f ∈ (op223_example_slide b)ᶜ.edgeSet)
(htree : ((op223_example_slide b).deleteEdges {s(0, 7)} ⊔
SimpleGraph.fromEdgeSet {f}).IsTree) :
adjacency_spectral_radius ((op223_example_slide b).deleteEdges {s(0, 7)} ⊔
SimpleGraph.fromEdgeSet {f}) < ENNReal.ofReal 2op223_example_slide_leaf_swap_radius_ltIn LeanGraph Theory & Graph Algorithms
For each vertex x distinct from 0 and 7, the graph obtained from a slide of the example by deleting the leaf edge {0,7} and adding {7,x} has adjacency spectral radius at most ofReal (199/100), in particular strictly less than ofReal 2.
theorem op223_example_slide_leaf_swap_radius_lt (b : Fin 8) (hb : b = 0 ∨ b = 6)
(x : Fin 8) (hx0 : x ≠ 0) (hx7 : x ≠ 7) :
adjacency_spectral_radius ((op223_example_slide b).deleteEdges {s(0, 7)} ⊔
SimpleGraph.fromEdgeSet {s(7, x)}) ≤ ENNReal.ofReal ((199 : ℝ) / 100)op223_example_slide_radius_eq_twoIn LeanGraph Theory & Graph Algorithms
Both slide graphs of the example (b = 0 and b = 6) have adjacency spectral radius exactly ofReal 2.
theorem op223_example_slide_radius_eq_two (b : Fin 8) (hb : b = 0 ∨ b = 6) :
adjacency_spectral_radius (op223_example_slide b) = ENNReal.ofReal 2op223_example_slide_radius_ge_twoIn LeanGraph Theory & Graph Algorithms
Both slide graphs of the example have adjacency spectral radius at least ofReal 2, witnessed by an explicit nonzero eigenvector for the eigenvalue 2.
theorem op223_example_slide_radius_ge_two (b : Fin 8) (hb : b = 0 ∨ b = 6) :
ENNReal.ofReal 2 ≤ adjacency_spectral_radius (op223_example_slide b)op223_example_slide_radius_le_twoIn LeanGraph Theory & Graph Algorithms
Both slide graphs of the example have adjacency spectral radius at most ofReal 2.
theorem op223_example_slide_radius_le_two (b : Fin 8) (hb : b = 0 ∨ b = 6) :
adjacency_spectral_radius (op223_example_slide b) ≤ ENNReal.ofReal 2op223_example_slide_swap_is_leaf_edgeIn LeanGraph Theory & Graph Algorithms
If f is a non-edge of a slide graph of the example and replacing the edge {0,7} by f yields a tree, then f is {7,x} for some vertex x which is neither 7 nor 0 and is not already adjacent to 7.
theorem op223_example_slide_swap_is_leaf_edge (b : Fin 8) (hb : b = 0 ∨ b = 6)
(f : Sym2 (Fin 8)) (hf : f ∈ (op223_example_slide b)ᶜ.edgeSet)
(htree : ((op223_example_slide b).deleteEdges {s(0, 7)} ⊔
SimpleGraph.fromEdgeSet {f}).IsTree) :
∃ x : Fin 8, x ≠ 0 ∧ x ≠ 7 ∧ f = s(7, x)op223_is_sustainable_tree_iso_invariantIn LeanGraph Theory & Graph Algorithms
For isomorphic finite simple graphs G and H, G is a sustainable tree if and only if H is.
theorem op223_is_sustainable_tree_iso_invariant {V W : Type*} [Fintype V] [DecidableEq V]
[Fintype W] [DecidableEq W] {G : SimpleGraph V} {H : SimpleGraph W} (e : G ≃g H) :
is_sustainable_tree G ↔ is_sustainable_tree Hop223_leaf_slide_radius_ltIn LeanGraph Theory & Graph Algorithms
Let X be a tree, v a leaf reached from a vertex u of degree at least 3 along a path whose interior vertices have degree 2, and b a neighbour of u not adjacent to v, such that the slide Y = X − ub + vb is again a tree. Then the adjacency spectral radius of Y is strictly smaller than that of X.
theorem op223_leaf_slide_radius_lt {V : Type*} [Fintype V] [DecidableEq V]
(X : SimpleGraph V) (hX : X.IsTree) (u v b : V)
(huv : u ≠ v) (hub : X.Adj u b) (hvb : ¬ X.Adj v b)
(hv : Nat.card (X.neighborSet v) = 1)
(hu : 3 ≤ Nat.card (X.neighborSet u))
(hpath : ∃ p : X.Walk u v, p.IsPath ∧
∀ x ∈ p.support, x ≠ u → x ≠ v → Nat.card (X.neighborSet x) = 2)
(hYtree : (X.deleteEdges {s(u, b)} ⊔ SimpleGraph.fromEdgeSet {s(v, b)}).IsTree) :
adjacency_spectral_radius (X.deleteEdges {s(u, b)} ⊔ SimpleGraph.fromEdgeSet {s(v, b)}) <
adjacency_spectral_radius Xop223_nonneg_matrix_pow_mulVec_leIn LeanGraph Theory & Graph Algorithms
If A is a real nonnegative matrix and d a strictly positive vector whose row sums weighted by d are at most R times d, then every entrywise component of A^k applied to d is at most R^k times the corresponding component of d.
theorem op223_nonneg_matrix_pow_mulVec_le {ι : Type*} [Fintype ι] [DecidableEq ι]
(A : Matrix ι ι ℝ) (d : ι → ℝ) (hd : ∀ i, 0 < d i) (hA : ∀ i j, 0 ≤ A i j) (R : ℝ)
(hR : ∀ k, ∑ j, A k j * d j ≤ R * d k) (m : ℕ) :
∀ i, (A ^ m).mulVec d i ≤ R ^ m * d iop223_nonstar_has_adjacent_high_degreeIn LeanGraph Theory & Graph Algorithms
Every tree on Fin n (n ≥ 2) that is not isomorphic to a star has two adjacent vertices each of degree at least 2.
theorem op223_nonstar_has_adjacent_high_degree
(n : ℕ) (hn : 2 ≤ n) (X : SimpleGraph (Fin n)) (hX : X.IsTree)
(hXs : ¬ Nonempty (X ≃g completeBipartiteGraph (Fin 1) (Fin (n - 1)))) :
∃ u v : Fin n, X.Adj u v ∧ 2 ≤ Nat.card (X.neighborSet u) ∧ 2 ≤ Nat.card (X.neighborSet v)
op223_nonsustainable_adjacent_gts_successorIn LeanGraph Theory & Graph Algorithms
Every non-sustainable tree on Fin n (n ≥ 2) that is not a star has an edge uv with deg v ≥ 2 such that the adjacent generalized tree shift gts_graph X u v u is non-sustainable.
theorem op223_nonsustainable_adjacent_gts_successor
(n : ℕ) (hn : 2 ≤ n) (X : SimpleGraph (Fin n))
(hX : is_nonsustainable_tree X)
(hXs : ¬ Nonempty (X ≃g completeBipartiteGraph (Fin 1) (Fin (n - 1)))) :
∃ u v : Fin n, X.Adj u v ∧ 2 ≤ Nat.card (X.neighborSet v) ∧
is_nonsustainable_tree (gts_graph X u v u)op223_offchain_neighbour_of_slide_treeIn LeanGraph Theory & Graph Algorithms
Let p be a path from u to v in the tree X whose interior vertices all have degree 2, with u ≠ v. If b is a neighbour of u which is not adjacent to v, and the slide Y = X − ub + vb is again a tree, then b is not a vertex of p.
theorem op223_offchain_neighbour_of_slide_tree {V : Type*} [Fintype V] [DecidableEq V]
(X : SimpleGraph V) (hX : X.IsTree) (u v b : V) (p : X.Walk u v)
(huv : u ≠ v) (hp : p.IsPath)
(hint : ∀ x ∈ p.support, x ≠ u → x ≠ v → Nat.card (X.neighborSet x) = 2)
(hub : X.Adj u b) (hvb : ¬ X.Adj v b)
(hYtree : (X.deleteEdges {s(u, b)} ⊔ SimpleGraph.fromEdgeSet {s(v, b)}).IsTree) :
b ∉ p.supportop223_path_four_radius_le_seventeen_tenthsIn LeanGraph Theory & Graph Algorithms
The adjacency spectral radius of the path on four vertices is at most 17/10.
theorem op223_path_four_radius_le_seventeen_tenths :
adjacency_spectral_radius (SimpleGraph.pathGraph 4) ≤ ENNReal.ofReal ((17 : ℝ) / 10)op223_pendant_closed_walk_leIn LeanGraph Theory & Graph Algorithms
open scoped Classical in
theorem op223_pendant_closed_walk_le {V : Type*} [Fintype V] [DecidableEq V]
(R : SimpleGraph V) (hR : R.IsTree) (u v : V) (huv : u ≠ v)
(hv : Nat.card (R.neighborSet v) = 1) (hu : 2 ≤ Nat.card (R.neighborSet u))
(hpath : ∃ p : R.Walk u v, p.IsPath ∧
∀ x ∈ p.support, x ≠ u → x ≠ v → Nat.card (R.neighborSet x) = 2) :
(∀ k : ℕ, (R.adjMatrix ℝ ^ k) v v ≤ (R.adjMatrix ℝ ^ k) u u) ∧
(R.adjMatrix ℝ ^ 2) v v < (R.adjMatrix ℝ ^ 2) u uop223_slide_gts_graph_eqIn LeanGraph Theory & Graph Algorithms
Let X be a graph with u adjacent to b, b not adjacent to v, and w the unique neighbour of v in X. Then the single-edge slide Y = X − ub + vb, taken as a generalized tree shift with candidate v and neighbour w, gives back X: gts_graph Y u v w = X.
theorem op223_slide_gts_graph_eq {V : Type*} [Fintype V] [DecidableEq V]
(X : SimpleGraph V) (u v b w : V)
(hub : X.Adj u b) (hvb : ¬ X.Adj v b) (hvw : X.Adj v w)
(hv : Nat.card (X.neighborSet v) = 1) :
gts_graph (X.deleteEdges {s(u, b)} ⊔ SimpleGraph.fromEdgeSet {s(v, b)}) u v w = Xop223_slide_is_generalized_tree_shift_of_leafIn LeanGraph Theory & Graph Algorithms
Let p be a path from u to v in the graph X whose interior vertices all have degree 2 in X, with u ≠ v and v a leaf of X (degree 1). Let b be a neighbour of u which is not a vertex of p and is not adjacent to v. If the slide Y = X − ub + vb is a tree, then X is obtained from Y by a generalized tree shift, i.e. is_generalized_tree_shift Y X.
theorem op223_slide_is_generalized_tree_shift_of_leaf {V : Type*} [Fintype V] [DecidableEq V]
(X : SimpleGraph V) (u v b : V) (p : X.Walk u v)
(huv : u ≠ v) (hp : p.IsPath)
(hint : ∀ x ∈ p.support, x ≠ u → x ≠ v → Nat.card (X.neighborSet x) = 2)
(hv : Nat.card (X.neighborSet v) = 1)
(hub : X.Adj u b) (hvb : ¬ X.Adj v b) (hb : b ∉ p.support)
(hYtree : (X.deleteEdges {s(u, b)} ⊔ SimpleGraph.fromEdgeSet {s(v, b)}).IsTree) :
is_generalized_tree_shift (X.deleteEdges {s(u, b)} ⊔ SimpleGraph.fromEdgeSet {s(v, b)}) Xop223_spectral_radius_le_of_weighted_rowsumIn LeanGraph Theory & Graph Algorithms
If A is a real nonnegative matrix with zero diagonal and d a strictly positive weight vector whose weighted row sums (1/d k) * sum_j A k j * d j are all at most R with R >= 0, then the spectral radius of A is at most ofReal R.
theorem op223_spectral_radius_le_of_weighted_rowsum {ι : Type*} [Fintype ι] [DecidableEq ι]
(A : Matrix ι ι ℝ) (d : ι → ℝ) (hd : ∀ i, 0 < d i)
(hdiag : ∀ i, A i i = 0) (hA : ∀ i j, 0 ≤ A i j)
(R : ℝ) (hR : ∀ k, (1 / d k) * ∑ j, A k j * d j ≤ R) :
spectralRadius ℝ A ≤ ENNReal.ofReal Rop223_sqrt_three_le_star_three_radiusIn LeanGraph Theory & Graph Algorithms
The adjacency spectral radius of the star K_{1,3} is at least sqrt 3.
theorem op223_sqrt_three_le_star_three_radius :
ENNReal.ofReal (Real.sqrt 3) ≤
adjacency_spectral_radius (completeBipartiteGraph (Fin 1) (Fin 3))op223_star_adjacency_spectral_radiusIn LeanGraph Theory & Graph Algorithms
The adjacency spectral radius of the star K_{1,n-1} (as completeBipartiteGraph (Fin 1) (Fin (n-1))) is sqrt(n-1), for n >= 2.
theorem op223_star_adjacency_spectral_radius (n : ℕ) (hn : 2 ≤ n) :
adjacency_spectral_radius (completeBipartiteGraph (Fin 1) (Fin (n - 1))) =
ENNReal.ofReal (Real.sqrt ((n : ℝ) - 1))op223_star_edge_swap_radius_ltIn LeanGraph Theory & Graph Algorithms
If S is a star K_{1,n-1} on n >= 4 vertices, e is an edge of S, f a non-edge of S, and deleting e and adding f yields a tree, then that tree has strictly smaller adjacency spectral radius than S.
theorem op223_star_edge_swap_radius_lt {V : Type*} [Fintype V] [DecidableEq V] (S : SimpleGraph V)
(n : ℕ) (hn : 4 ≤ n)
(hS : Nonempty (S ≃g completeBipartiteGraph (Fin 1) (Fin (n - 1))))
(e : Sym2 V) (he : e ∈ S.edgeSet) (f : Sym2 V) (hf : f ∈ Sᶜ.edgeSet)
(htree : (S.deleteEdges {e} ⊔ SimpleGraph.fromEdgeSet {f}).IsTree) :
adjacency_spectral_radius (S.deleteEdges {e} ⊔ SimpleGraph.fromEdgeSet {f}) <
adjacency_spectral_radius Sop223_star_like_edgeSet_nonemptyIn LeanGraph Theory & Graph Algorithms
A finite simple graph S isomorphic to the star K_{1,n-1} with n >= 4 has at least one edge.
theorem op223_star_like_edgeSet_nonempty {V : Type*} [Fintype V] [DecidableEq V] (S : SimpleGraph V) (n : ℕ)
(hn : 4 ≤ n) (hS : Nonempty (S ≃g completeBipartiteGraph (Fin 1) (Fin (n - 1)))) :
∃ e, e ∈ S.edgeSetop223_star_like_is_treeIn LeanGraph Theory & Graph Algorithms
Any finite simple graph S isomorphic to the star K_{1,n-1} with n >= 2 is a tree.
theorem op223_star_like_is_tree {V : Type*} [Fintype V] [DecidableEq V] (S : SimpleGraph V) (n : ℕ)
(hn : 2 ≤ n) (hS : Nonempty (S ≃g completeBipartiteGraph (Fin 1) (Fin (n - 1)))) :
S.IsTreeop223_star_swap_radius_lt_canonicalIn LeanGraph Theory & Graph Algorithms
At the canonical star K_{1,n-1} with n >= 4, moving leaf b off the centre (Sum.inl 0) and onto a different leaf m (i.e. deleting {centre, b} and adding {b, m}) strictly decreases the adjacency spectral radius.
theorem op223_star_swap_radius_lt_canonical (n : ℕ) (hn : 4 ≤ n) (b m : Fin (n - 1)) (hbm : b ≠ m) :
adjacency_spectral_radius
((completeBipartiteGraph (Fin 1) (Fin (n - 1))).deleteEdges {s(Sum.inl 0, Sum.inr b)} ⊔
SimpleGraph.fromEdgeSet {s(Sum.inr b, Sum.inr m)}) <
adjacency_spectral_radius (completeBipartiteGraph (Fin 1) (Fin (n - 1)))op223_star_swap_structureIn LeanGraph Theory & Graph Algorithms
At the canonical star K_{1,n-1} with n >= 4, if e is an edge and f a non-edge such that deleting e and adding f yields a tree, then e joins the centre to some leaf b and f joins that same leaf b to a different leaf m.
theorem op223_star_swap_structure (n : ℕ) (hn : 4 ≤ n)
(e f : Sym2 (Fin 1 ⊕ Fin (n - 1)))
(he : e ∈ (completeBipartiteGraph (Fin 1) (Fin (n - 1))).edgeSet)
(hf : f ∈ (completeBipartiteGraph (Fin 1) (Fin (n - 1)))ᶜ.edgeSet)
(htree : ((completeBipartiteGraph (Fin 1) (Fin (n - 1))).deleteEdges {e} ⊔ SimpleGraph.fromEdgeSet {f}).IsTree) :
∃ (b m : Fin (n - 1)), b ≠ m ∧ e = s(Sum.inl 0, Sum.inr b) ∧ f = s(Sum.inr b, Sum.inr m)op223_star_swap_transportIn LeanGraph Theory & Graph Algorithms
Transporting an edge-swap at a star along an isomorphism: if S is isomorphic to the star K_{1,n-1}, and e is an edge, f a non-edge, with S - e + f a tree, then there are an edge e' and non-edge f' of the canonical star such that the canonical swap is again a tree and the swap graphs S - e + f and star - e' + f' are isomorphic.
theorem op223_star_swap_transport {V : Type*} [Fintype V] [DecidableEq V] (S : SimpleGraph V) (n : ℕ)
(hS : Nonempty (S ≃g completeBipartiteGraph (Fin 1) (Fin (n - 1))))
(e f : Sym2 V) (he : e ∈ S.edgeSet) (hf : f ∈ Sᶜ.edgeSet)
(htree : (S.deleteEdges {e} ⊔ SimpleGraph.fromEdgeSet {f}).IsTree) :
∃ (e' f' : Sym2 (Fin 1 ⊕ Fin (n - 1))),
e' ∈ (completeBipartiteGraph (Fin 1) (Fin (n - 1))).edgeSet ∧
f' ∈ (completeBipartiteGraph (Fin 1) (Fin (n - 1)))ᶜ.edgeSet ∧
((completeBipartiteGraph (Fin 1) (Fin (n - 1))).deleteEdges {e'} ⊔
SimpleGraph.fromEdgeSet {f'}).IsTree ∧
Nonempty ((S.deleteEdges {e} ⊔ SimpleGraph.fromEdgeSet {f}) ≃g
((completeBipartiteGraph (Fin 1) (Fin (n - 1))).deleteEdges {e'} ⊔
SimpleGraph.fromEdgeSet {f'}))op223_star_three_not_sustainableIn LeanGraph Theory & Graph Algorithms
Any finite simple graph isomorphic to the star K_{1,3} is not a sustainable tree.
theorem op223_star_three_not_sustainable {V : Type*} [Fintype V] [DecidableEq V]
(S : SimpleGraph V) (hS : Nonempty (S ≃g completeBipartiteGraph (Fin 1) (Fin 3))) :
¬ is_sustainable_tree Sop223_star_three_swap_yields_pathIn LeanGraph Theory & Graph Algorithms
At the canonical star K_{1,3}, if e is an edge and f a non-edge such that deleting e and adding f yields a tree, then the resulting tree is isomorphic to the path graph on four vertices.
theorem op223_star_three_swap_yields_path (e f : Sym2 (Fin 1 ⊕ Fin 3))
(he : e ∈ (completeBipartiteGraph (Fin 1) (Fin 3)).edgeSet)
(hf : f ∈ (completeBipartiteGraph (Fin 1) (Fin 3))ᶜ.edgeSet)
(htree : ((completeBipartiteGraph (Fin 1) (Fin 3)).deleteEdges {e} ⊔
SimpleGraph.fromEdgeSet {f}).IsTree) :
Nonempty (((completeBipartiteGraph (Fin 1) (Fin 3)).deleteEdges {e} ⊔
SimpleGraph.fromEdgeSet {f}) ≃g SimpleGraph.pathGraph 4)op223_sustainable_slide_predecessorNeeds helpGraph Theory & Graph Algorithms
Let X be a sustainable tree on Fin n, v a leaf reached from a vertex u of degree at least 3 by a path p whose interior vertices have degree 2. Then some neighbour b of u which does not lie on p and is not adjacent to v yields a slide Y = X − ub + vb that is again a sustainable tree.
theorem op223_sustainable_slide_predecessor
(n : ℕ) (X : SimpleGraph (Fin n)) (hX : is_sustainable_tree X)
(u v : Fin n) (p : X.Walk u v)
(huv : u ≠ v) (hp : p.IsPath)
(hint : ∀ x ∈ p.support, x ≠ u → x ≠ v → Nat.card (X.neighborSet x) = 2)
(hu : 3 ≤ Nat.card (X.neighborSet u))
(hv : Nat.card (X.neighborSet v) = 1) :
∃ b : Fin n, X.Adj u b ∧ ¬ X.Adj v b ∧ b ∉ p.support ∧
is_sustainable_tree (X.deleteEdges {s(u, b)} ⊔ SimpleGraph.fromEdgeSet {s(v, b)})op223_tree_deg_le_two_is_pathIn LeanGraph Theory & Graph Algorithms
A tree on Fin n all of whose vertices have degree at most 2 is isomorphic to the path graph pathGraph n.
theorem op223_tree_deg_le_two_is_path (n : ℕ) (X : SimpleGraph (Fin n)) (hX : X.IsTree)
(hdeg : ∀ x : Fin n, Nat.card (X.neighborSet x) ≤ 2) :
Nonempty (X ≃g SimpleGraph.pathGraph n)op223_tree_pendant_chain_configurationIn LeanGraph Theory & Graph Algorithms
A tree on Fin n that is not isomorphic to the path graph pathGraph n has a vertex u of degree at least 3 and a leaf v (degree 1) such that u and v are joined by a path all of whose interior vertices have degree 2.
theorem op223_tree_pendant_chain_configuration
(n : ℕ) (X : SimpleGraph (Fin n)) (hX : X.IsTree)
(hnotpath : ¬ Nonempty (X ≃g SimpleGraph.pathGraph n)) :
∃ u v : Fin n, u ≠ v ∧ 3 ≤ Nat.card (X.neighborSet u) ∧
Nat.card (X.neighborSet v) = 1 ∧
(∃ p : X.Walk u v, p.IsPath ∧
∀ x ∈ p.support, x ≠ u → x ≠ v → Nat.card (X.neighborSet x) = 2)op223_weighted_pendant_shift_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a nonnegatively weighted finite tree whose unique diagonal-resolvent maximum is lost after the complete adjacent shift toward it, even when the two resolvent parameters satisfy the same pendant-edge secular equation. This refutes a weighted extension of the pendant-edge preservation route, not the unweighted conjecture.
theorem op223_weighted_pendant_shift_counterexample :
∃ (n : ℕ) (T : SimpleGraph (Fin n)) (A B : Matrix (Fin n) (Fin n) ℝ)
(u v x : Fin n) (z₀ z₁ s : ℝ),
T.IsTree ∧ u ≠ v ∧ x ≠ u ∧
A.transpose = A ∧ B.transpose = B ∧
(∀ i j, 0 ≤ A i j ∧ 0 ≤ B i j) ∧
(∀ i, A i i = 0 ∧ B i i = 0) ∧
(∀ i j, T.Adj i j ↔ 0 < A i j) ∧ 0 < A u v ∧
B u v = A u v ∧
(∀ j, j ≠ u → j ≠ v → B u j = A u j + A v j ∧ B v j = 0) ∧
(∀ i j, i ≠ u → i ≠ v → j ≠ u → j ≠ v → B i j = A i j) ∧
0 < z₀ ∧ z₀ < z₁ ∧ 0 < s ∧
(let M₀ := z₀ • (1 : Matrix (Fin n) (Fin n) ℝ) - A
let M₁ := z₁ • (1 : Matrix (Fin n) (Fin n) ℝ) - B
let R₀ := M₀⁻¹
let R₁ := M₁⁻¹
M₀.PosDef ∧ M₁.PosDef ∧
R₀ u u = z₀ / s ∧ R₁ u u = z₁ / s ∧
(∀ y, y ≠ u → R₀ y y < R₀ u u) ∧ R₁ u u < R₁ x x)op223_weighted_spectral_radius_boundIn LeanGraph Theory & Graph Algorithms
Collatz–Wielandt / Gershgorin row-sum bound: if A is a real nonnegative matrix with zero diagonal and d is a strictly positive weight vector whose weighted row sums (1/d k) * sum_j A k j * d j are all at most R, then the spectral radius of A is at most R.
theorem op223_weighted_spectral_radius_bound {ι : Type*} [Fintype ι] [DecidableEq ι] [Nonempty ι]
(A : Matrix ι ι ℝ) (d : ι → ℝ) (hd : ∀ i, 0 < d i)
(hdiag : ∀ i, A i i = 0) (hA : ∀ i j, 0 ≤ A i j)
(R : ℝ) (hR : ∀ k, (1 / d k) * ∑ j, A k j * d j ≤ R) :
spectralRadius ℝ A ≤ ENNReal.ofReal Rop652_divisors_eqIn LeanGraph Theory & Graph Algorithms
1248191226 = 2·3²·37⁵, so its set of positive divisors equals the explicit 36-element Finset op652_divisor_list.
theorem op652_divisors_eq : Nat.divisors 1248191226 = op652_divisor_list
op652_model_cut_obstructionIn LeanGraph Theory & Graph Algorithms
The cut data for the model graph: X = the 12 divisors of 1248191226 divisible by 6, Y = the 11 terms {41,43,47,49,53,55,59,61,65,67,71}; then |X| = 12, |Y| = 11, and exactly 2 edges join X to the complement of Y (both into the term 37).
theorem op652_model_cut_obstruction : ∃ X : Finset ↥op652_divisor_list, ∃ Y : Finset ↥op652_progression_image, X.card = 12 ∧ Y.card = 11 ∧ ((X.product (Finset.univ \ Y)).filter (fun p : ↥op652_divisor_list × ↥op652_progression_image => op652_model_graph.Adj (Sum.inl p.1) (Sum.inr p.2))).card = 2
op652_model_graph_isoIn LeanGraph Theory & Graph Algorithms
The literal graph coprime_divisor_progression_graph 1248191226 37 1 is isomorphic to the model graph on the explicit small carriers.
theorem op652_model_graph_iso : Nonempty (coprime_divisor_progression_graph 1248191226 37 1 ≃g op652_model_graph)
op652_model_min_degreeIn LeanGraph Theory & Graph Algorithms
Every vertex of the 72-vertex model graph has degree at least 5; in fact the minimum degree is exactly 6.
theorem op652_model_min_degree : 5 ≤ op652_model_graph.minDegree
op652_model_not_packingIn LeanGraph Theory & Graph Algorithms
For every k ≥ 3 the model graph does not admit k pairwise edge-disjoint perfect matchings: the cut (X, Y) has only 2 edges while k·(|X| − |Y|) = k ≥ 3.
theorem op652_model_not_packing : ∀ k : ℕ, 3 ≤ k → ¬ simple_graph_has_edge_disjoint_perfect_matchings op652_model_graph k
op652_model_perfect_matchingIn LeanGraph Theory & Graph Algorithms
The model graph has a perfect matching: the 36 explicit pairs (1,72),(6,71),…,(18,37) form a bijection between the divisors and the progression terms with every pair coprime.
theorem op652_model_perfect_matching : ∃ M : op652_model_graph.Subgraph, M.IsPerfectMatching
op652_progression_eqIn LeanGraph Theory & Graph Algorithms
With |D(1248191226)| = 36 and a = 37, b = 1, the literal progression image {37 + 1·t : 0 ≤ t < 36} equals the explicit Finset {37, ..., 72}.
theorem op652_progression_eq : (Finset.range (Nat.divisors 1248191226).card).image (fun t : ℕ => 37 + 1 * (t : ℤ)) = op652_progression_image
op_1258_cyclic_ramsey_property_upperIn LeanGraph Theory & Graph Algorithms
For all k ≥ 1 and l ≥ 3, the cyclic Ramsey property holds for the nested matching NM_{2k} and monotone path MP_l on N = k*l - k + 1 - (if 2 ∣ k then l - 2 else 0) vertices.
theorem op_1258_cyclic_ramsey_property_upper (k l : ℕ) (hk : 1 ≤ k) (hl : 3 ≤ l) :
cyclic_ramsey_property (nested_matching k) (monotone_path l)
(k * l - k + 1 - (if 2 ∣ k then l - 2 else 0))op_1258_cyclic_ramsey_target_posIn LeanGraph Theory & Graph Algorithms
For all integers k ≥ 1 and l ≥ 3, k*l - k + 1 - (if 2 ∣ k then l - 2 else 0) is strictly positive.
theorem op_1258_cyclic_ramsey_target_pos (k l : ℕ) (hk : 1 ≤ k) (hl : 3 ≤ l) :
0 < k * l - k + 1 - (if 2 ∣ k then l - 2 else 0)op_1258_cyclic_ramsey_upper_boundIn LeanGraph Theory & Graph Algorithms
For all integers k ≥ 1 and l ≥ 3, the cyclic Ramsey number R_cyc(NM_{2k}, MP_l) is at most k*l - k + 1 - (if 2 ∣ k then l - 2 else 0).
theorem op_1258_cyclic_ramsey_upper_bound (k l : ℕ) (hk : 1 ≤ k) (hl : 3 ≤ l) :
cyclic_ramsey_number (nested_matching k) (monotone_path l) ≤
k * l - k + 1 - (if 2 ∣ k then l - 2 else 0)op_1371_bipartite_color_class_balanceIn LeanGraph Theory & Graph Algorithms
If c : Fin n → Fin 2 is a proper 2-colouring of a simple graph G on Fin n and G has a perfect matching M, then the two colour classes each have exactly n / 2 elements.
theorem op_1371_bipartite_color_class_balance {n : ℕ} (G : SimpleGraph (Fin n))
(c : Fin n → Fin 2) (hc : ∀ ⦃v w : Fin n⦄, G.Adj v w → c v ≠ c w)
(M : G.Subgraph) (hM : M.IsPerfectMatching) :
(Finset.univ.filter (fun v => c v = 0)).card = n / 2 ∧
(Finset.univ.filter (fun v => c v = 1)).card = n / 2op_1371_box_path_le_of_evenIn LeanGraph Theory & Graph Algorithms
If G is a bipartite simple graph on Fin n with a perfect matching and k ≥ 2 is even, then the minimum forcing number of G □ P_k is at most (n/2)*((k+1)/2) = nk/4.
theorem op_1371_box_path_le_of_even {n : ℕ} (G : SimpleGraph (Fin n)) (hG : G.IsBipartite) (hM : ∃ M : G.Subgraph, M.IsPerfectMatching) (k : ℕ) (hk : 2 ≤ k) (hke : Even k) : graph_min_forcing_num (G □ SimpleGraph.pathGraph k) ≤ ((n / 2 * ((k + 1) / 2) : ℕ) : ℕ∞)op_1371_box_path_le_of_oddIn LeanGraph Theory & Graph Algorithms
If G is a bipartite simple graph on Fin n with a perfect matching and k ≥ 2 is odd, then the minimum forcing number of G □ P_k is at most (n/2)*((k+1)/2).
theorem op_1371_box_path_le_of_odd {n : ℕ} (G : SimpleGraph (Fin n)) (hG : G.IsBipartite) (hM : ∃ M : G.Subgraph, M.IsPerfectMatching) (k : ℕ) (hk : 2 ≤ k) (hko : Odd k) : graph_min_forcing_num (G □ SimpleGraph.pathGraph k) ≤ ((n / 2 * ((k + 1) / 2) : ℕ) : ℕ∞)op_1371_perfect_matching_of_involutoryIn LeanGraph Theory & Graph Algorithms
If a bipartite simple graph on Fin n admits an involutory weighted adjacency matrix over some field, then it has a perfect matching.
theorem op_1371_perfect_matching_of_involutory {n : ℕ} (G : SimpleGraph (Fin n)) (F : Type*) [Field F] (hG : G.IsBipartite) (hA : graph_admits_involutory_weighted_adj_matrix G F) : ∃ M : G.Subgraph, M.IsPerfectMatchingop_1611_not_diam_gt_matching_of_diam_bound_threeIn LeanGraph Theory & Graph Algorithms
If for every finite graph G with maximum degree at most 3 the diameter of the (Δ+2)-recolour graph is at most |V| + matching number, then no Δ ≤ 3 satisfies simple_graph_reconfiguration_diam_gt_matching.
theorem op_1611_not_diam_gt_matching_of_diam_bound_three (hbound : ∀ (V : Type) [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj], G.maxDegree ≤ 3 → (simple_graph_reconfiguration_graph G (G.maxDegree + 2)).diam ≤ (Fintype.card V : ℕ∞) + graph_matching_num G) : ∀ Δ : ℕ, Δ ≤ 3 → ¬ simple_graph_reconfiguration_diam_gt_matching Δ
op_1611_subcubic_reconfiguration_diam_le_card_add_matchingIn LeanGraph Theory & Graph Algorithms
For every finite simple graph G of maximum degree at most 3, the diameter of the (maxDegree+2)-colouring reconfiguration graph is at most |V| plus the matching number of G.
theorem op_1611_subcubic_reconfiguration_diam_le_card_add_matching {V : Type} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (hG : G.maxDegree ≤ 3) : (simple_graph_reconfiguration_graph G (G.maxDegree + 2)).diam ≤ (Fintype.card V : ℕ∞) + graph_matching_num Gop_193_cycle13_parity_from_blocksIn LeanGraph Theory & Graph Algorithms
If the thirteen-cycle same-side noncycle pair parity bound holds for each of the sixteen blocks with first color false, then it holds for every Boolean coloring.
theorem op_193_cycle13_parity_from_blocks
(h0 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,false,false,false,false,a,b,c,d,e,f,g,h])
(h1 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,false,false,false,true,a,b,c,d,e,f,g,h])
(h2 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,false,false,true,false,a,b,c,d,e,f,g,h])
(h3 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,false,false,true,true,a,b,c,d,e,f,g,h])
(h4 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,false,true,false,false,a,b,c,d,e,f,g,h])
(h5 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,false,true,false,true,a,b,c,d,e,f,g,h])
(h6 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,false,true,true,false,a,b,c,d,e,f,g,h])
(h7 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,false,true,true,true,a,b,c,d,e,f,g,h])
(h8 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,true,false,false,false,a,b,c,d,e,f,g,h])
(h9 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,true,false,false,true,a,b,c,d,e,f,g,h])
(h10 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,true,false,true,false,a,b,c,d,e,f,g,h])
(h11 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,true,false,true,true,a,b,c,d,e,f,g,h])
(h12 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,true,true,false,false,a,b,c,d,e,f,g,h])
(h13 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,true,true,false,true,a,b,c,d,e,f,g,h])
(h14 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,true,true,true,false,a,b,c,d,e,f,g,h])
(h15 : ∀ (a b c d e f g h : Bool), op193Parity13 ![false,true,true,true,true,a,b,c,d,e,f,g,h])
(F : Fin 13 → Bool) : op193Parity13 Fop_193_cycle14_balanced_case_odd_degreesIn LeanGraph Theory & Graph Algorithms
If a two-colouring of the fourteen-cycle has exactly 7 vertices of one colour and exactly 12 monochromatic cycle edges (i.e. exactly two bichromatic edges), then exactly four vertices have odd degree in the set of same-colour noncycle pairs.
theorem op_193_cycle14_balanced_case_odd_degrees (f : Fin 14 → Bool)
(hk : ((Finset.univ : Finset (Fin 14)).filter (fun x => f x = true)).card = 7)
(hM : ((Finset.univ : Finset (Fin 14)).filter (fun i => f i = f (i + 1))).card = 12) :
let P := ((Finset.univ : Finset (Fin 14)).product Finset.univ).filter
(fun e => e.1 < e.2 ∧ f e.1 = f e.2 ∧ ¬ (SimpleGraph.cycleGraph 14).Adj e.1 e.2)
((Finset.univ : Finset (Fin 14)).filter
(fun x => Odd (P.filter (fun e => e.1 = x ∨ e.2 = x)).card)).card = 4op_193_cycle14_monochromatic_edges_leIn LeanGraph Theory & Graph Algorithms
If a two-colouring of the fourteen-cycle uses both colours, then at most 12 of the 14 cycle edges are monochromatic.
theorem op_193_cycle14_monochromatic_edges_le (f : Fin 14 → Bool)
(htrue : ∃ x, f x = true) (hfalse : ∃ x, f x = false) :
((Finset.univ : Finset (Fin 14)).filter (fun i => f i = f (i + 1))).card ≤ 12op_193_cycle14_same_colour_pair_countIn LeanGraph Theory & Graph Algorithms
For a two-colouring of the fourteen-cycle with k vertices of one colour and M monochromatic cycle edges, twice the number of same-colour noncycle pairs equals k(k-1) + (14-k)(13-k) - 2M.
theorem op_193_cycle14_same_colour_pair_count (f : Fin 14 → Bool) :
let k := ((Finset.univ : Finset (Fin 14)).filter (fun x => f x = true)).card
let M := ((Finset.univ : Finset (Fin 14)).filter (fun i => f i = f (i + 1))).card
2 * (((Finset.univ : Finset (Fin 14)).product Finset.univ).filter
(fun e => e.1 < e.2 ∧ f e.1 = f e.2 ∧
¬ (SimpleGraph.cycleGraph 14).Adj e.1 e.2)).card
= k * (k - 1) + (14 - k) * (13 - k) - 2 * Mop_193_fourteen_avoidance_graph_edge_countIn LeanGraph Theory & Graph Algorithms
The graph obtained from the complete graph on fourteen vertices by deleting the fourteen cycle edges and every pair that lies inside one of ten sets of size at most three has at least 91 - 14 - 30 = 47 edges.
theorem op_193_fourteen_avoidance_graph_edge_count
(A : Fin 10 → Finset (Fin 14)) (hA : ∀ j, (A j).card ≤ 3)
(G : SimpleGraph (Fin 14)) [DecidableRel G.Adj]
(hG : ∀ x y, G.Adj x y ↔ x ≠ y ∧ ¬ (SimpleGraph.cycleGraph 14).Adj x y ∧
∀ j, ¬ (x ∈ A j ∧ y ∈ A j)) : 47 ≤ G.edgeFinset.cardop_193_fourteen_edge_bound_from_odd_cycle_certificateIn LeanGraph Theory & Graph Algorithms
A triangle-free graph on fourteen vertices containing a chordless odd cycle of length at least five has at most 43 edges.
theorem op_193_fourteen_edge_bound_from_odd_cycle_certificate
(G : SimpleGraph (Fin 14)) [DecidableRel G.Adj]
(hfree : G.CliqueFree 3)
{u : Fin 14} {p : G.Walk u u}
(hcycle : p.IsCycle) (hodd : Odd p.length) (h5 : 5 ≤ p.length) (hchord : p.IsChordless) :
G.edgeFinset.card ≤ 43op_193_nine_anchors_capacity_parityIn LeanGraph Theory & Graph Algorithms
Any family of 9 anchors of size at most 3 covering the same-side noncycle pairs P satisfies the capacity-parity inequality 2*E + O <= 54, where E = |P| and O is the number of odd-degree vertices in P.
theorem op_193_nine_anchors_capacity_parity
(f : Fin 13 → Bool)
(A : Fin 9 → Finset (Fin 13)) (hA : ∀ j, (A j).card ≤ 3)
(h_cover : ∀ x y, x < y → f x = f y → ¬ (SimpleGraph.cycleGraph 13).Adj x y →
∃ j, x ∈ A j ∧ y ∈ A j) :
let P := ((Finset.univ : Finset (Fin 13)).product Finset.univ).filter
(fun e => e.1 < e.2 ∧ f e.1 = f e.2 ∧ ¬ (SimpleGraph.cycleGraph 13).Adj e.1 e.2)
let E := P.card
let O := ((Finset.univ : Finset (Fin 13)).filter
(fun x => Odd (P.filter (fun e => e.1 = x ∨ e.2 = x)).card)).card
2 * E + O ≤ 54op_193_ten_anchors_capacity_parityIn LeanGraph Theory & Graph Algorithms
If the same-side noncycle pairs of a two-colouring of the fourteen-cycle are all covered by ten sets of size at most three, then 2*E + O <= 60, where E is the number of those pairs and O the number of vertices of odd degree in that pair set.
theorem op_193_ten_anchors_capacity_parity
(f : Fin 14 → Bool)
(A : Fin 10 → Finset (Fin 14)) (hA : ∀ j, (A j).card ≤ 3)
(h_cover : ∀ x y, x < y → f x = f y → ¬ (SimpleGraph.cycleGraph 14).Adj x y →
∃ j, x ∈ A j ∧ y ∈ A j) :
let P := ((Finset.univ : Finset (Fin 14)).product Finset.univ).filter
(fun e => e.1 < e.2 ∧ f e.1 = f e.2 ∧ ¬ (SimpleGraph.cycleGraph 14).Adj e.1 e.2)
let E := P.card
let O := ((Finset.univ : Finset (Fin 14)).filter
(fun x => Odd (P.filter (fun e => e.1 = x ∨ e.2 = x)).card)).card
2 * E + O ≤ 60op_193_trianglefree_nonbipartite_odd_cycle_certificateIn LeanGraph Theory & Graph Algorithms
A triangle-free non-bipartite graph on fourteen vertices contains a chordless odd cycle of length at least five: there are a vertex u, a closed walk p at u, and p is a cycle, has odd length >= 5 and has no chords.
theorem op_193_trianglefree_nonbipartite_odd_cycle_certificate
(G : SimpleGraph (Fin 14)) [DecidableRel G.Adj]
(hfree : G.CliqueFree 3) (hnb : ¬ G.IsBipartite) :
∃ (u : Fin 14) (p : G.Walk u u), p.IsCycle ∧ Odd p.length ∧ 5 ≤ p.length ∧ p.IsChordlessop_292_p6_claw_hole_dominatingIn LeanGraph Theory & Graph Algorithms
In a finite connected (P_6, claw)-free graph, every hole of length 5 or 6 is dominating: every vertex is either a vertex of the hole or adjacent to one.
theorem op_292_p6_claw_hole_dominating {V : Type*} [Fintype V] (G : SimpleGraph V)
(hconn : G.Connected) (hp : IsPkFree G 6) (hclaw : IsClawFree G) {n : ℕ} (hn5 : 5 ≤ n)
(hn6 : n ≤ 6) (f : SimpleGraph.cycleGraph n ↪g G) (v : V) :
∃ i : Fin n, v = f i ∨ G.Adj v (f i)op_292_p6_claw_no_long_hole_two_copsIn LeanGraph Theory & Graph Algorithms
Every finite connected (P_6, claw)-free graph with no hole of length 5 or more admits a winning strategy for 2 cops.
theorem op_292_p6_claw_no_long_hole_two_cops {V : Type*} [Fintype V] (G : SimpleGraph V)
(hconn : G.Connected) (hp : IsPkFree G 6) (hclaw : IsClawFree G)
(hno : ¬ HasHoleOfLengthAtLeast G 5) :
HasCopWinStrategy G 2op_292_pk_free_no_long_holeIn LeanGraph Theory & Graph Algorithms
If a graph has no induced path on k ≥ 3 vertices, then it contains no induced cycle of length k+1 or more: the first k vertices of such a hole induce a path on k vertices.
theorem op_292_pk_free_no_long_hole {V : Type*} (G : SimpleGraph V) {k : ℕ} (hk : 3 ≤ k)
(hp : IsPkFree G k) {n : ℕ} (hn : k + 1 ≤ n) :
¬ SimpleGraph.IsIndContained (SimpleGraph.cycleGraph n) Gop_292_two_cops_dominating_holeIn LeanGraph Theory & Graph Algorithms
Let G be a finite (P_6, claw)-free graph containing a dominating induced cycle C of length 5 or 6 (every vertex of G is on C or adjacent to it). Then 2 cops have a winning strategy on G.
theorem op_292_two_cops_dominating_hole {V : Type*} [Fintype V] (G : SimpleGraph V)
(hclaw : IsClawFree G) (hp : IsPkFree G 6) {n : ℕ} (hn5 : 5 ≤ n) (hn6 : n ≤ 6)
(f : SimpleGraph.cycleGraph n ↪g G)
(hdom : ∀ v : V, ∃ i : Fin n, v = f i ∨ G.Adj v (f i)) :
HasCopWinStrategy G 2op_599_mean_order_sub_mu_eq_QIn LeanGraph Theory & Graph Algorithms
The difference between the lambda-weighted mean order and the complete graph baseline mu equals lambda * Q_G(lambda) / (Z_G(lambda) * ((1 + lambda)^n - 1)).
open scoped BigOperators Polynomial in
theorem op_599_mean_order_sub_mu_eq_Q
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(lam : ℝ) (hZ : (open scoped Classical in ∑ S ∈ (Finset.univ.filter (fun (S : Finset V) => is_connected_vertex_set G (↑S : Set V))),
(Polynomial.X : Polynomial ℝ) ^ Finset.card S).eval lam ≠ 0)
(hK : (1 + lam) ^ (Fintype.card V) - 1 ≠ 0) :
let Z := open scoped Classical in
∑ S ∈ (Finset.univ.filter (fun (S : Finset V) => is_connected_vertex_set G (↑S : Set V))),
(Polynomial.X : Polynomial ℝ) ^ Finset.card S
let mu := (Fintype.card V : ℝ) * lam * (1 + lam) ^ (Fintype.card V - 1) / ((1 + lam) ^ (Fintype.card V) - 1)
let mean_order := lam * (Polynomial.derivative Z).eval lam / Z.eval lam
let Q := ((Polynomial.X + 1) ^ (Fintype.card V) - 1) * Polynomial.derivative Z -
Polynomial.C (Fintype.card V : ℝ) * (Polynomial.X + 1) ^ (Fintype.card V - 1) * Z
mean_order - mu = lam * Q.eval lam / (Z.eval lam * ((1 + lam) ^ (Fintype.card V) - 1))op_599_q_ge_zero_of_connected_inducedIn LeanGraph Theory & Graph Algorithms
For any connected simple graph on n >= 4 vertices with minimum degree at least 3, and any lambda >= 1, Q_G(lambda) >= 0 with equality iff G is complete.
open scoped BigOperators Polynomial in
theorem op_599_q_ge_zero_of_connected_induced
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (hG : G.Connected)
(hn : 4 ≤ Fintype.card V)
(hdeg : ∀ v : V, 3 ≤ G.degree v)
(lam : ℝ) (hlam : 1 ≤ lam) :
let Z := open scoped Classical in
∑ S ∈ (Finset.univ.filter (fun (S : Finset V) => is_connected_vertex_set G (↑S : Set V))),
(Polynomial.X : Polynomial ℝ) ^ Finset.card S
let Q := ((Polynomial.X + 1) ^ (Fintype.card V) - 1) * Polynomial.derivative Z -
Polynomial.C (Fintype.card V : ℝ) * (Polynomial.X + 1) ^ (Fintype.card V - 1) * Z
0 ≤ Q.eval lam ∧ (Q.eval lam = 0 ↔ G = ⊤)op_599_weighted_coreIn LeanGraph Theory & Graph Algorithms
For every finite connected simple graph on n >= 4 vertices with minimum degree at least 3, the defect polynomial Q_G = ((1+X)^n - 1)Z_G' - n(1+X)^(n-1)Z_G is nonnegative on [1,infinity), and for lambda >= 1, Q_G(lambda) = 0 only if G is complete.
open scoped BigOperators Polynomial Classical in
theorem op_599_weighted_core {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hG : G.Connected)
(hn : 4 ≤ Fintype.card V) (hdeg : ∀ v : V, 3 ≤ G.degree v) :
(∀ lam : ℝ, 1 ≤ lam → 0 ≤ (conn_set_poly_Q G).eval lam) ∧
(∀ lam : ℝ, 1 ≤ lam → (conn_set_poly_Q G).eval lam = 0 → G = ⊤)ordered_ramsey_monotone_cycle_alternating_path_lowerIn LeanGraph Theory & Graph Algorithms
For k ≥ 3 and l ≥ 2, no integer M strictly less than ⌈(k - 1/2)(l - 1)⌉ satisfies the ordered Ramsey property for MC_k and AP_l.
theorem ordered_ramsey_monotone_cycle_alternating_path_lower
(k l : ℕ) (hk : 3 ≤ k) (hl : 2 ≤ l) :
∀ M < ⌈((k : ℝ) - 1 / 2) * ((l : ℝ) - 1)⌉₊,
¬ ordered_ramsey_prop (monotone_cycle k) (alternating_path l) Mordered_ramsey_monotone_cycle_alternating_path_lower_criticalIn LeanGraph Theory & Graph Algorithms
For all k ≥ 3 and l ≥ 2, the ordered Ramsey property for MC_k and AP_l fails at the critical threshold N - 1 = ⌈(k - 1/2)(l - 1)⌉ - 1.
theorem ordered_ramsey_monotone_cycle_alternating_path_lower_critical
(k l : ℕ) (hk : 3 ≤ k) (hl : 2 ≤ l) :
¬ ordered_ramsey_prop (monotone_cycle k) (alternating_path l)
(⌈((k : ℝ) - 1 / 2) * ((l : ℝ) - 1)⌉₊ - 1)ordered_ramsey_monotone_cycle_alternating_path_lower_threeIn LeanGraph Theory & Graph Algorithms
For all k ≥ 3, the ordered Ramsey property for MC_k and AP_3 fails for all M < 2k - 1.
theorem ordered_ramsey_monotone_cycle_alternating_path_lower_three
(k : ℕ) (hk : 3 ≤ k) :
∀ M < 2 * k - 1,
¬ ordered_ramsey_prop (monotone_cycle k) (alternating_path 3) Mordered_ramsey_monotone_cycle_alternating_path_upperNeeds helpGraph Theory & Graph Algorithms
For k ≥ 3 and l ≥ 2, every 2-edge coloring of the complete ordered graph on ⌈(k - 1/2)(l - 1)⌉ vertices contains an ordered MC_k in the first colour or an ordered AP_l in the second colour.
theorem ordered_ramsey_monotone_cycle_alternating_path_upper
(k l : ℕ) (hk : 3 ≤ k) (hl : 2 ≤ l) :
ordered_ramsey_prop (monotone_cycle k) (alternating_path l)
⌈((k : ℝ) - 1 / 2) * ((l : ℝ) - 1)⌉₊ordered_ramsey_prop_monoIn LeanGraph Theory & Graph Algorithms
The ordered Ramsey property is monotone in the host graph size N: if it holds at M, it holds for all N ≥ M.
theorem ordered_ramsey_prop_mono {α β : Type*} [LinearOrder α] [LinearOrder β]
(H : SimpleGraph α) (H' : SimpleGraph β) {M N : ℕ}
(hMN : M ≤ N) (h : ordered_ramsey_prop H H' M) :
ordered_ramsey_prop H H' Np7_claw_free_dominating_pair_of_no_holeNeeds helpGraph Theory & Graph Algorithms
Every finite connected (P_7, claw)-free graph with no induced cycle of length at least 6 has a dominating pair of vertices.
theorem p7_claw_free_dominating_pair_of_no_hole {V : Type*} [Fintype V] (G : SimpleGraph V)
(hconn : G.Connected) (hp : IsPkFree G 7) (hclaw : IsClawFree G)
(hno_hole : ∀ m ≥ 6, IsEmpty (SimpleGraph.cycleGraph m ↪g G)) :
∃ u v : V, ∀ w : V, w = u ∨ w = v ∨ G.Adj u w ∨ G.Adj v wpathGraph_exists_spanning_pathIn LeanGraph Theory & Graph Algorithms
Every non-empty path graph contains a path whose support contains all vertices.
theorem pathGraph_exists_spanning_path (n : ℕ) (hn : 0 < n) : ∃ (u v : Fin n) (p : (SimpleGraph.pathGraph n).Walk u v), p.IsPath ∧ ∀ w : Fin n, w ∈ p.support
pathGraph_isTreeIn LeanGraph Theory & Graph Algorithms
Every non-empty path graph is a tree.
theorem pathGraph_isTree (n : ℕ) (hn : 0 < n) : (SimpleGraph.pathGraph n).IsTree
pathGraph_zf_set_iffIn LeanGraph Theory & Graph Algorithms
For n ≥ 1 and S a set of vertices of the path P_n (Mathlib's pathGraph n, vertices Fin n with v adjacent to v+1), S is a zero forcing set if and only if S is not an independent set all of whose vertices are interior (i.e. not both 0 < v and v+1 < n).
theorem pathGraph_zf_set_iff (n : ℕ) (hn : 1 ≤ n) (S : Finset (Fin n)) :
is_zero_forcing_set (SimpleGraph.pathGraph n) (S : Set (Fin n)) ↔
¬ ((SimpleGraph.pathGraph n).IsIndepSet (S : Set (Fin n)) ∧
∀ v ∈ S, 0 < (v : ℕ) ∧ (v : ℕ) + 1 < n)path_graph_dist_of_leIn LeanGraph Theory & Graph Algorithms
In the path graph P_n on Fin n, the graph distance from u to v, for u ≤ v, is the difference v - u of the vertex indices.
theorem path_graph_dist_of_le {n : ℕ} (u v : Fin n) (h : u ≤ v) :
(SimpleGraph.pathGraph n).dist u v = v.val - u.valpath_graph_interval_eq_IccIn LeanGraph Theory & Graph Algorithms
In the path graph P_n on Fin n, for a ≤ b the interval I(a,b) = {w : d(a,w) + d(w,b) = d(a,b)} is exactly Finset.Icc a b, the vertices between a and b.
theorem path_graph_interval_eq_Icc {n : ℕ} (a b : Fin n) (h : a ≤ b) :
(Finset.univ.filter (fun w : Fin n =>
(SimpleGraph.pathGraph n).dist a w + (SimpleGraph.pathGraph n).dist w b
= (SimpleGraph.pathGraph n).dist a b)) = Finset.Icc a bpath_graph_two_elem_set_interval_cardIn LeanGraph Theory & Graph Algorithms
For a < b in Fin n, the number of vertices of P_n lying on every interval I(u,v) with {u,v} the 2-element set {a,b}, minus one, equals b - a.
theorem path_graph_two_elem_set_interval_card {n : ℕ} (a b : Fin n) (hab : a < b) :
((Finset.univ.filter (fun w : Fin n => ∀ u ∈ ({a, b} : Finset (Fin n)),
∀ v ∈ ({a, b} : Finset (Fin n)), u ≠ v →
(SimpleGraph.pathGraph n).dist u w + (SimpleGraph.pathGraph n).dist w v
= (SimpleGraph.pathGraph n).dist u v)).card - 1) = b.val - a.valpath_graph_white_rank_two_and_codim_oneIn LeanGraph Theory & Graph Algorithms
On a path with at least four vertices, every two-element white set is fort-free, and exactly two white sets of size n−1 are fort-free.
theorem path_graph_white_rank_two_and_codim_one (n : ℕ) (hn : 4 ≤ n) : {W : Finset (Fin n) | W.card = 2 ∧ is_zero_forcing_set (SimpleGraph.pathGraph n) ((Finset.univ \ W : Finset (Fin n)) : Set (Fin n))}.ncard = Nat.choose n 2 ∧ {W : Finset (Fin n) | W.card = n - 1 ∧ is_zero_forcing_set (SimpleGraph.pathGraph n) ((Finset.univ \ W : Finset (Fin n)) : Set (Fin n))}.ncard = 2path_graph_zero_forcing_poly_coeff_succ_leIn LeanGraph Theory & Graph Algorithms
In the zero forcing polynomial of the path graph on n vertices, the coefficient of X^(k+1) is at most the coefficient of X^k whenever k ≥ (n + 1) / 2.
theorem path_graph_zero_forcing_poly_coeff_succ_le (n : ℕ) (k : ℕ)
(hk : (n + 1) / 2 ≤ k) :
(zero_forcing_poly (SimpleGraph.pathGraph n)).coeff (k + 1) ≤
(zero_forcing_poly (SimpleGraph.pathGraph n)).coeff kpath_graph_zero_forcing_set_of_large_cardIn LeanGraph Theory & Graph Algorithms
In the path graph on n vertices (n > 0), any subset S of vertices of cardinality at least (n + 1) / 2 is a zero forcing set.
theorem path_graph_zero_forcing_set_of_large_card (n : ℕ) (hn : 0 < n) (S : Finset (Fin n))
(hS : (n + 1) / 2 ≤ S.card) :
is_zero_forcing_set (SimpleGraph.pathGraph n) (S : Set (Fin n))path_is_caterpillarIn LeanGraph Theory & Graph Algorithms
Every non-empty path graph is a caterpillar.
theorem path_is_caterpillar (n : ℕ) (hn : 0 < n) : is_caterpillar (SimpleGraph.pathGraph n)
pend_ve_num_le_gamma_ve_induceIn LeanGraph Theory & Graph Algorithms
Attaching the single vertex v to A can only make domination harder, so a_C ≤ b_C: any minimum vertex-edge dominating set of G[A] together with v ve-dominates G[A ∪ {v}].
lemma pend_ve_num_le_gamma_ve_induce {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (A : Set V) [Fintype ↥A] (v : V) :
pend_ve_num G A v ≤ gamma_ve (G.induce A)perm_decomp_refl_trans_gen_swapsIn LeanGraph Theory & Graph Algorithms
Every permutation k of a finite type V that preserves reachability along a relation R can be factored into at most |V| transpositions between mutually reachable pairs.
theorem perm_decomp_refl_trans_gen_swaps {V : Type*} [Fintype V] [DecidableEq V]
(R : V → V → Prop) (k : Equiv.Perm V) (hk : ∀ v, Relation.ReflTransGen R v (k v)) :
∃ l : List (Equiv.Perm V),
(∀ p ∈ l, ∃ a b, Relation.ReflTransGen R a b ∧ p = Equiv.swap a b) ∧
l.length ≤ Fintype.card V ∧ l.prod = kperron_quadratic_formIn LeanGraph Theory & Graph Algorithms
For a Perron vector vec of a finite simple graph X, the quadratic form of the adjacency matrix at vec equals (spectral radius of X) times the squared length of vec.
attribute [local instance] Classical.propDecidable in
theorem perron_quadratic_form
{V : Type*} [Fintype V] [DecidableEq V]
(X : SimpleGraph V) (vec : V → ℝ) (hvec : is_perron_vector X vec) :
∑ i, vec i * Matrix.mulVec (X.adjMatrix ℝ) vec i
= (adjacency_spectral_radius X).toReal * ∑ i, vec i ^ 2petersen_ramsey_blue_graph_has_no_petersenIn LeanGraph Theory & Graph Algorithms
Lemma 1 of arXiv:2611.09347: the blue graph G_B (the join graph K_{9,9} ∨ K_2ᶜ) contains no subgraph isomorphic to the Petersen graph.
theorem petersen_ramsey_blue_graph_has_no_petersen : ¬ SimpleGraph.IsContained petersen_graph petersen_ramsey_blue_graph
petersen_ramsey_lower_bound_twenty_oneIn LeanGraph Theory & Graph Algorithms
Theorem 1 of arXiv:2611.09347: the diagonal Ramsey number of the Petersen graph satisfies R(P, P) ≥ 21; that is, the 2-coloring of the complete graph K_20 by the red graph G_R and its complement G_Rᶜ contains no monochromatic copy of the Petersen graph.
theorem petersen_ramsey_lower_bound_twenty_one : ¬ SimpleGraph.IsContained petersen_graph petersen_ramsey_red_graph ∧ ¬ SimpleGraph.IsContained petersen_graph petersen_ramsey_red_graphᶜ
petersen_ramsey_red_graph_has_no_petersenIn LeanGraph Theory & Graph Algorithms
The red graph G_R on 20 vertices (a disjoint union of K_9, K_9, and K_2) contains no subgraph isomorphic to the Petersen graph.
theorem petersen_ramsey_red_graph_has_no_petersen : ¬ SimpleGraph.IsContained petersen_graph petersen_ramsey_red_graph
plane_dart_move_reachableIn LeanGraph Theory & Graph Algorithms
In a connected simple graph with a rotation system, any dart can be reached from any other by repeatedly applying the two moves "reverse the dart" (d ↦ d.symm) and "go to the next dart around the head" (d ↦ σ d). Equivalently, the dart graph generated by these two moves is connected.
theorem plane_dart_move_reachable {n : ℕ} (G : SimpleGraph (Fin n)) (hG : G.Connected)
(σ : Equiv.Perm G.Dart) (hσ : simple_graph_is_rotation_system G σ) (d e : G.Dart) :
Relation.ReflTransGen (fun a b : G.Dart => b = a.symm ∨ b = σ a) d eplane_eulerian_orientation_exists_face_heightIn LeanGraph Theory & Graph Algorithms
Every Eulerian orientation D of a connected simple graph with a rotation system σ is induced by a height function: there is y : darts → ℤ, constant on σ-faces and with y d = y d.symm ± 1, such that the arc u → v of D is present exactly when y(u→v) = y(v→u) + 1. (The height-function dictionary: Eulerian orientations of a plane graph are exactly the gradients of integer face potentials.)
theorem plane_eulerian_orientation_exists_face_height {n : ℕ} (G : SimpleGraph (Fin n))
[DecidableRel G.Adj] (hG : G.Connected) (σ : Equiv.Perm G.Dart)
(hσ : simple_graph_is_rotation_system G σ) (D : Digraph (Fin n)) [DecidableRel D.Adj]
(hD : digraph_is_eulerian_orientation G D) :
∃ y : G.Dart → ℤ, plane_face_height G σ y ∧
∀ u v : Fin n, D.Adj u v ↔ (plane_face_height_orientation G y).Adj u vplane_face_height_alternating_is_two_valuedIn LeanGraph Theory & Graph Algorithms
Conversely, if the orientation induced by a height function y of a connected graph is alternating for σ, then y takes only two consecutive values. Together with plane_face_height_two_valued_is_alternating this identifies alternating orientations with two-valued height functions.
theorem plane_face_height_alternating_is_two_valued {n : ℕ} (G : SimpleGraph (Fin n))
(hG : G.Connected) (σ : Equiv.Perm G.Dart) (hσ : simple_graph_is_rotation_system G σ)
(y : G.Dart → ℤ) (h : plane_face_height G σ y)
(halt : digraph_is_alternating_orientation G σ (plane_face_height_orientation G y)) :
∃ c : ℤ, ∀ d : G.Dart, y d = c ∨ y d = c + 1plane_face_height_orientation_is_eulerianIn LeanGraph Theory & Graph Algorithms
The orientation induced by any height function of a rotation system is Eulerian: every edge is oriented one way (the two heights across it differ by exactly 1) and at every vertex the out-degree equals the in-degree.
theorem plane_face_height_orientation_is_eulerian {n : ℕ} (G : SimpleGraph (Fin n))
(σ : Equiv.Perm G.Dart) (hσ : simple_graph_is_rotation_system G σ) (y : G.Dart → ℤ)
(h : plane_face_height G σ y) :
@digraph_is_eulerian_orientation n G (plane_face_height_orientation G y) (Classical.decRel _)plane_face_height_orientation_is_orientationIn LeanGraph Theory & Graph Algorithms
The digraph induced by any height function is an orientation of G in the sense of is_graph_orientation: every edge of G carries exactly one of its two arcs, and no edge carries both.
theorem plane_face_height_orientation_is_orientation {n : ℕ} (G : SimpleGraph (Fin n))
(σ : Equiv.Perm G.Dart) (y : G.Dart → ℤ) (h : plane_face_height G σ y) :
is_graph_orientation G (plane_face_height_orientation G y)plane_face_height_sanityIn LeanGraph Theory & Graph Algorithms
Sanity checks for the height-function predicate: the edgeless graph on one vertex admits a height function (it has no darts, so both conditions are vacuous), while the single edge K₂ admits no height function for the identity rotation system, since there the two darts of the single edge lie on a common face (so must have equal height) and also must differ by exactly 1.
theorem plane_face_height_sanity :
plane_face_height (⊥ : SimpleGraph (Fin 1)) (Equiv.refl (⊥ : SimpleGraph (Fin 1)).Dart) (fun _ => 0) ∧
(∀ y : (⊤ : SimpleGraph (Fin 2)).Dart → ℤ,
¬ plane_face_height (⊤ : SimpleGraph (Fin 2))
(Equiv.refl (⊤ : SimpleGraph (Fin 2)).Dart) y)plane_face_height_strict_descentIn LeanGraph Theory & Graph Algorithms
Height-function form of the crux: in a 3-vertex-connected simple plane graph with all degrees even, a height function y that is not two-valued admits another height function y' whose induced Eulerian orientation has strictly fewer spanning arborescences directed towards r.
theorem plane_face_height_strict_descent {n : ℕ} (G : SimpleGraph (Fin n))
[DecidableRel G.Adj] (h3 : simple_graph_three_vertex_connected G)
(heven : ∀ v, Even (G.degree v)) (σ : Equiv.Perm G.Dart)
(hσ : simple_graph_is_plane_rotation_system G σ) (y : G.Dart → ℤ)
(hy : plane_face_height G σ y)
(h2 : ¬ ∃ c : ℤ, ∀ d : G.Dart, y d = c ∨ y d = c + 1) (r : Fin n) :
∃ y' : G.Dart → ℤ, plane_face_height G σ y' ∧
@digraph_arborescence_count_at n (plane_face_height_orientation G y') (Classical.decRel _) r <
@digraph_arborescence_count_at n (plane_face_height_orientation G y) (Classical.decRel _) rplane_face_height_symm_eqIn LeanGraph Theory & Graph Algorithms
In a height function y for the rotation system σ, the dart σ d and the reverse dart d.symm always have equal height. (This is the face permutation φ = σ ∘ symm applied to d.symm.)
theorem plane_face_height_symm_eq {V : Type*} (G : SimpleGraph V) (σ : Equiv.Perm G.Dart)
(y : G.Dart → ℤ) (h : plane_face_height G σ y) (d : G.Dart) :
y (σ d) = y d.symmplane_face_height_two_valued_is_alternatingIn LeanGraph Theory & Graph Algorithms
If the height function y takes only the two consecutive values c and c+1, then the orientation it induces is alternating for σ: consecutive darts around every vertex point in opposite directions.
theorem plane_face_height_two_valued_is_alternating {n : ℕ} (G : SimpleGraph (Fin n))
(σ : Equiv.Perm G.Dart) (y : G.Dart → ℤ) (h : plane_face_height G σ y) (c : ℤ)
(hc : ∀ d : G.Dart, y d = c ∨ y d = c + 1) :
digraph_is_alternating_orientation G σ (plane_face_height_orientation G y)polynomial_is_unimodal_of_halvesIn LeanGraph Theory & Graph Algorithms
A polynomial with coefficients in ℕ is unimodal as soon as its coefficient sequence is weakly increasing up to an index m and weakly decreasing from m onwards (adjacent-step form).
theorem polynomial_is_unimodal_of_halves (p : Polynomial ℕ) (m : ℕ)
(hlo : ∀ i, i < m → p.coeff i ≤ p.coeff (i + 1))
(hhi : ∀ j, m ≤ j → p.coeff (j + 1) ≤ p.coeff j) :
polynomial_is_unimodal pquadripartite_colour_class_card_le_two_mulIn LeanGraph Theory & Graph Algorithms
In a proper edge-colouring of K_{n,n,n,n} with 3n colours, the set of edges of any fixed colour has at most 2n elements (it is a matching on 4n vertices).
theorem quadripartite_colour_class_card_le_two_mul (n : ℕ)
(c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)))
(i : Fin (3 * n)) :
(Finset.univ.filter (fun e : (SimpleGraph.completeEquipartiteGraph 4 n).edgeSet => c e = i)).card ≤ 2 * nquadripartite_colour_class_perfect_matchingIn LeanGraph Theory & Graph Algorithms
In a proper edge colouring of K_{n,n,n,n} with the 3n colours Fin (3*n), the edges of any fixed colour form a perfect matching: every vertex is an endpoint of exactly one edge of that colour, and there are exactly 2n edges of that colour.
theorem quadripartite_colour_class_perfect_matching (n : ℕ) (hn : 1 ≤ n)
(c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)))
(i : Fin (3 * n)) :
(∀ v : Fin 4 × Fin n, ∃! e : (SimpleGraph.completeEquipartiteGraph 4 n).edgeSet,
c e = i ∧ v ∈ (e : Sym2 (Fin 4 × Fin n))) ∧
(Finset.univ.filter (fun e : (SimpleGraph.completeEquipartiteGraph 4 n).edgeSet =>
c e = i)).card = 2 * nquadripartite_exists_coloring_no_two_n_edge_connecting_coreIn LeanGraph Theory & Graph Algorithms
For n ≥ 4 there is a proper 3n-edge-colouring of K_{n,n,n,n} with no colour-connecting edge set of cardinality exactly 2n.
theorem quadripartite_exists_coloring_no_two_n_edge_connecting_core
(n : ℕ) (hn : 4 ≤ n) :
∃ c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)),
∀ W : Finset (Sym2 (Fin 4 × Fin n)), W.card = 2 * n →
¬ simple_graph_is_color_connecting (SimpleGraph.completeEquipartiteGraph 4 n) c (↑W : Set (Sym2 (Fin 4 × Fin n)))quadripartite_exists_coloring_no_two_n_edge_connecting_setIn LeanGraph Theory & Graph Algorithms
For n ≥ 4 there is a proper 3n-edge-colouring of K_{n,n,n,n} no set of at most 2n edges of which is colour-connecting; equivalently (with the universal upper bound) a colouring whose wild number is exactly 2n + 1.
theorem quadripartite_exists_coloring_no_two_n_edge_connecting_set (n : ℕ) (hn : 4 ≤ n) :
∃ c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)),
∀ W : Finset (Sym2 (Fin 4 × Fin n)), W.card ≤ 2 * n →
¬ simple_graph_is_color_connecting (SimpleGraph.completeEquipartiteGraph 4 n) c ↑Wquadripartite_seal_free_partition_block_boundIn LeanGraph Theory & Graph Algorithms
A seal-free partition of K_{n,n,n,n} under a proper 3n-edge-colouring has at most 2n+1 blocks, so in particular the target's bound 2n-1 is within 2 of the best possible.
theorem quadripartite_seal_free_partition_block_bound (n : ℕ) (hn : 1 ≤ n)
(c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)))
(q : ℕ) (p : Fin 4 × Fin n → Fin q)
(hp : simple_graph_is_seal_free_partition (SimpleGraph.completeEquipartiteGraph 4 n) c q p) :
q ≤ 2 * n + 1quadripartite_seal_free_partition_existsIn LeanGraph Theory & Graph Algorithms
For n ≥ 4, every proper 3n-edge-colouring of K_{n,n,n,n} admits a seal-free partition into at least 2n − 1 connected blocks.
theorem quadripartite_seal_free_partition_exists (n : ℕ) (hn : 4 ≤ n)
(c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n))) :
∃ q : ℕ, 2 * n - 1 ≤ q ∧ ∃ p : Fin 4 × Fin n → Fin q,
simple_graph_is_seal_free_partition (SimpleGraph.completeEquipartiteGraph 4 n) c q pquadripartite_seal_free_partition_of_three_partIn LeanGraph Theory & Graph Algorithms
Reduction of the four-part target to the three-part one. If the first three parts admit an (n-1)-block partition whose blocks are connected and which every colour class crosses (both conditions stated on the induced subgraph of K_{n,n,n,n}), then the whole four-part graph admits a seal-free partition into 2n-1 blocks, namely those n-1 blocks together with the n vertices of the fourth part as singletons.
theorem quadripartite_seal_free_partition_of_three_part (n : ℕ) (hn : 1 ≤ n)
(c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)))
(p3 : Fin 4 × Fin n → Fin (n - 1))
(hblock : ∀ j : Fin (n - 1),
(SimpleGraph.induce {x : Fin 4 × Fin n | x.1.val < 3 ∧ p3 x = j}
(SimpleGraph.completeEquipartiteGraph 4 n)).Connected)
(hcut : ∀ (i : Fin (3 * n)) (T : Finset (Fin (n - 1))), T.Nonempty → T ≠ Finset.univ →
∃ (u v : Fin 4 × Fin n) (h : (SimpleGraph.completeEquipartiteGraph 4 n).Adj u v),
u.1.val < 3 ∧ v.1.val < 3 ∧ p3 u ∈ T ∧ p3 v ∉ T ∧
c ⟨s(u, v), (SimpleGraph.mem_edgeSet _).mpr h⟩ = i) :
∃ q : ℕ, 2 * n - 1 ≤ q ∧ ∃ p : Fin 4 × Fin n → Fin q,
simple_graph_is_seal_free_partition (SimpleGraph.completeEquipartiteGraph 4 n) c q pquadripartite_three_part_connecting_partition_existsIn LeanGraph Theory & Graph Algorithms
CRUX (this is the open part). For n ≥ 4, every proper 3n-edge-colouring of K_{n,n,n,n} admits a partition of the first three parts (3n vertices) into n-1 connected blocks such that for every colour i, the colour-i edges inside the first three parts cross every cut between blocks, i.e. each colour class connects the n-1 blocks.
theorem quadripartite_three_part_connecting_partition_exists (n : ℕ) (hn : 4 ≤ n)
(c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n))) :
∃ p3 : Fin 4 × Fin n → Fin (n - 1),
(∀ j : Fin (n - 1),
(SimpleGraph.induce {x : Fin 4 × Fin n | x.1.val < 3 ∧ p3 x = j}
(SimpleGraph.completeEquipartiteGraph 4 n)).Connected) ∧
∀ (i : Fin (3 * n)) (T : Finset (Fin (n - 1))), T.Nonempty → T ≠ Finset.univ →
∃ (u v : Fin 4 × Fin n) (h : (SimpleGraph.completeEquipartiteGraph 4 n).Adj u v),
u.1.val < 3 ∧ v.1.val < 3 ∧ p3 u ∈ T ∧ p3 v ∉ T ∧
c ⟨s(u, v), (SimpleGraph.mem_edgeSet _).mpr h⟩ = iquadripartite_three_part_internal_edges_cardIn LeanGraph Theory & Graph Algorithms
In a proper 3n-edge-colouring of K_{n,n,n,n}, exactly n edges of each colour have both endpoints among the first three parts (the other n edges of that colour pair each vertex of the fourth part with a vertex of the first three parts).
theorem quadripartite_three_part_internal_edges_card (n : ℕ) (hn : 1 ≤ n)
(c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)))
(i : Fin (3 * n)) :
(Finset.univ.filter (fun e : (SimpleGraph.completeEquipartiteGraph 4 n).edgeSet =>
c e = i ∧ ∀ v ∈ (e : Sym2 (Fin 4 × Fin n)), v.1.val < 3)).card = nquadripartite_two_n_colour_class_meets_at_most_oneIn LeanGraph Theory & Graph Algorithms
In any proper edge-colouring of K_{n,n,n,n}, a colour-connecting edge set W of exactly 2n edges meets every colour class in at most one edge; equivalently the colouring is injective on W (W is rainbow).
theorem quadripartite_two_n_colour_class_meets_at_most_one
(n : ℕ) (hn : 1 ≤ n)
(c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)))
(W : Finset (Sym2 (Fin 4 × Fin n)))
(hcard : W.card = 2 * n)
(hW : simple_graph_is_color_connecting (SimpleGraph.completeEquipartiteGraph 4 n) c (↑W : Set (Sym2 (Fin 4 × Fin n))))
(i : Fin (3 * n)) :
(W.filter (fun e => ∃ (he : e ∈ (SimpleGraph.completeEquipartiteGraph 4 n).edgeSet),
c ⟨e, he⟩ = i)).card ≤ 1quadripartite_two_n_exclusion_reduces_to_card_two_nIn LeanGraph Theory & Graph Algorithms
If every colour-connecting edge set in K_{n,n,n,n} has at least 2n edges, and some colouring defeats every colour-connecting set of exactly 2n edges, then that colouring defeats every colour-connecting set of at most 2n edges.
theorem quadripartite_two_n_exclusion_reduces_to_card_two_n (n : ℕ)
(hlb : ∀ (c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)))
(W : Finset (Sym2 (Fin 4 × Fin n))),
simple_graph_is_color_connecting (SimpleGraph.completeEquipartiteGraph 4 n) c (↑W : Set (Sym2 (Fin 4 × Fin n))) → 2 * n ≤ W.card)
(hcore : ∃ c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)),
∀ W : Finset (Sym2 (Fin 4 × Fin n)), W.card = 2 * n →
¬ simple_graph_is_color_connecting (SimpleGraph.completeEquipartiteGraph 4 n) c (↑W : Set (Sym2 (Fin 4 × Fin n)))) :
∃ c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)),
∀ W : Finset (Sym2 (Fin 4 × Fin n)), W.card ≤ 2 * n →
¬ simple_graph_is_color_connecting (SimpleGraph.completeEquipartiteGraph 4 n) c (↑W : Set (Sym2 (Fin 4 × Fin n)))quadripartite_wild_number_le_of_seal_free_partitionIn LeanGraph Theory & Graph Algorithms
If a proper 3n-edge-colouring of K_{n,n,n,n} admits a seal-free partition into at least 2n − 1 connected blocks, then its wild number is at most 2n + 1.
theorem quadripartite_wild_number_le_of_seal_free_partition (n : ℕ) (hn : 1 ≤ n)
(c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)))
(q : ℕ) (hq : 2 * n - 1 ≤ q) (p : Fin 4 × Fin n → Fin q)
(hp : simple_graph_is_seal_free_partition (SimpleGraph.completeEquipartiteGraph 4 n) c q p) :
simple_graph_wild_number (SimpleGraph.completeEquipartiteGraph 4 n) c ≤ 2 * n + 1radial_drift_two_step_telescopeIn LeanGraph Theory & Graph Algorithms
If a sequence of integers satisfies a(i+2) ≤ a(i) − 2c for all i < d, with a(0) ≤ K and a(1) ≤ K − c, then a(i) ≤ K − i·c for every i ≤ d.
theorem radial_drift_two_step_telescope (a : ℕ → ℤ) {K c : ℤ} (d : ℕ)
(h0 : a 0 ≤ K) (h1 : a 1 ≤ K - c)
(hstep : ∀ i, i + 2 ≤ d → a (i + 2) ≤ a i - 2 * c) :
∀ i, i ≤ d → a i ≤ K - (i : ℤ) * cradial_sum_eq_level_countsIn LeanGraph Theory & Graph Algorithms
For a vertex v reachable from p, the 'outward Laplacian' of the radial function f = d(v,·) at p equals b − c, where b is the number of neighbours of p one level further from v and c the number of neighbours of p one level closer to v.
theorem radial_sum_eq_level_counts {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
{v p : V} (hvp : G.Reachable v p) :
∑ y ∈ G.neighborFinset p, ((G.dist v y : ℤ) - (G.dist v p : ℤ))
= (((G.neighborFinset p).filter (fun y => G.dist v y = G.dist v p + 1)).card : ℤ)
- (((G.neighborFinset p).filter (fun y => G.dist v y = G.dist v p - 1)).card : ℤ)radial_sum_ge_neg_degreeIn LeanGraph Theory & Graph Algorithms
At a vertex p of degree k the radial sum of f = d(v,·) is at least −k, because every summand is at least −1.
theorem radial_sum_ge_neg_degree {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
{k : ℕ} {v p : V} (hdeg : G.degree p = k) :
-(k : ℤ) ≤ ∑ y ∈ G.neighborFinset p, ((G.dist v y : ℤ) - (G.dist v p : ℤ))radial_sum_self_eq_degreeIn LeanGraph Theory & Graph Algorithms
At the base point v itself the radial sum equals the degree k, since every neighbour is at distance 1 and v at distance 0.
theorem radial_sum_self_eq_degree {V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj]
(v : V) {k : ℕ} (hdeg : G.degree v = k) :
∑ y ∈ G.neighborFinset v, ((G.dist v y : ℤ) - (G.dist v v : ℤ)) = (k : ℤ)radius_independence_connectivity_hamiltonian_radius_oneIn LeanGraph Theory & Graph Algorithms
In the boundary case where G has radius 1, there exists a universal vertex u. The condition alpha(G) + 1 <= kappa(G) guarantees that G is Hamiltonian.
theorem radius_independence_connectivity_hamiltonian_radius_one {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (hV : 3 ≤ Fintype.card V) (hκ : 2 ≤ ghz_graph_vertex_connectivity G) (hrad : G.radius = 1) (hα : (G.indepNum : ℕ∞) + 1 ≤ (ghz_graph_vertex_connectivity G : ℕ∞)) : G.IsHamiltonianramsey_r33_triangle_freeIn LeanGraph Theory & Graph Algorithms
Every triangle-free simple graph on 6 vertices has an independent set of size 3 (the R(3,3)=6 theorem for triangle-free graphs).
theorem ramsey_r33_triangle_free
{α : Type*} [DecidableEq α] (V : Finset α) (hV : V.card = 6)
(adj : α → α → Prop) [DecidableRel adj]
(hadj_symm : ∀ x y, adj x y ↔ adj y x)
(hadj_irrefl : ∀ x, ¬ adj x x)
(htriangle_free : ∀ x ∈ V, ∀ y ∈ V, ∀ z ∈ V,
x ≠ y → y ≠ z → z ≠ x → adj x y → adj y z → ¬ adj z x) :
∃ I : Finset α, I ⊆ V ∧ I.card = 3 ∧
∀ x ∈ I, ∀ y ∈ I, x ≠ y → ¬ adj x yreflexive_rel_strongly_connected_cycle_cover_quadratic_diameterIn LeanGraph Theory & Graph Algorithms
There is an absolute constant C > 0 such that for every finite type V and every reflexive, strongly connected relation R on V, every element of the subgroup generated by the cycle covers of R is a signed product of at most C·|V|² cycle covers or their inverses.
theorem reflexive_rel_strongly_connected_cycle_cover_quadratic_diameter :
∃ C : ℕ, 0 < C ∧ ∀ (V : Type) [Fintype V] [DecidableEq V] (R : V → V → Prop),
(∀ v, R v v) → (∀ u v : V, Relation.ReflTransGen R u v) →
∀ k ∈ Subgroup.closure {p : Equiv.Perm V | ∀ v, R v (p v)},
∃ w : List (Equiv.Perm V),
(∀ p ∈ w, (∀ v, R v (p v)) ∨ (∀ v, R (p v) v)) ∧
w.length ≤ C * (Fintype.card V) ^ 2 ∧ w.prod = kreflexive_rel_swap_word_of_refl_trans_genIn LeanGraph Theory & Graph Algorithms
In any reflexive and symmetric relation R on a finite type V, for any pair u, v connected along R, the transposition swap u v can be expressed as a product of at most 2 * |V| cycle covers of R (each an edge transposition swap x y with R x y).
theorem reflexive_rel_swap_word_of_refl_trans_gen {V : Type*} [Fintype V] [DecidableEq V]
(R : V → V → Prop) (hR : ∀ v, R v v) (hR_symm : ∀ u v, R u v → R v u) {u v : V}
(h : Relation.ReflTransGen R u v) :
∃ w : List (Equiv.Perm V),
(∀ p ∈ w, ∀ x, R x (p x)) ∧ w.length ≤ 2 * Fintype.card V ∧ w.prod = Equiv.swap u vreflexive_rel_symmetric_cycle_cover_quadratic_diameterIn LeanGraph Theory & Graph Algorithms
If R is symmetric as well as reflexive, then every element of the subgroup generated by the cycle covers of R has a signed word of length at most C·|V|² (C = 4 suffices): every transposition (u v) with R u v is a cycle cover, and permutations decompose into such transpositions along paths.
theorem reflexive_rel_symmetric_cycle_cover_quadratic_diameter :
∃ C : ℕ, 0 < C ∧ ∀ (V : Type) [Fintype V] [DecidableEq V] (R : V → V → Prop),
(∀ v, R v v) → (∀ u v : V, R u v → R v u) →
∀ k ∈ Subgroup.closure {p : Equiv.Perm V | ∀ v, R v (p v)},
∃ w : List (Equiv.Perm V),
(∀ p ∈ w, (∀ v, R v (p v)) ∨ (∀ v, R (p v) v)) ∧
w.length ≤ C * (Fintype.card V) ^ 2 ∧ w.prod = kregular_eight_triangle_distinct_witnessIn LeanGraph Theory & Graph Algorithms
There is an explicit edge list on the vertices {0,…,n−1}, with 15 ≤ n ≤ 29, whose graph is 8-regular and has pairwise distinct vertex triangle-degrees. Equivalently: an explicit certificate for the regularity-8 case, which the literature leaves open (regular irregularity witnesses are known only for 9 ≤ r ≤ 29).
theorem regular_eight_triangle_distinct_witness :
∃ (n : ℕ) (L : List (Fin n × Fin n)), 15 ≤ n ∧ n ≤ 29 ∧
(simple_graph_of_edge_list L).IsRegularOfDegree 8 ∧
simple_graph_is_triangle_distinct (simple_graph_of_edge_list L)regular_eight_triangle_distinct_witness_fin_nineteenIn LeanGraph Theory & Graph Algorithms
There is an explicit edge list on the 19 vertices {0,…,18} whose graph is 8-regular and has pairwise distinct vertex triangle-degrees. This is the target statement at one pinned order; it implies the parent by instantiation, since 15 ≤ 19 ≤ 29.
theorem regular_eight_triangle_distinct_witness_fin_nineteen :
∃ L : List (Fin 19 × Fin 19), (simple_graph_of_edge_list L).IsRegularOfDegree 8 ∧
simple_graph_is_triangle_distinct (simple_graph_of_edge_list L)regular_eight_triangle_distinct_witness_fin_twenty_twoIn LeanGraph Theory & Graph Algorithms
There is an explicit edge list on the 22 vertices {0,…,21} whose graph is 8-regular and has pairwise distinct vertex triangle-degrees. This is the target statement at one pinned order; it implies the parent by instantiation, since 15 ≤ 22 ≤ 29.
theorem regular_eight_triangle_distinct_witness_fin_twenty_two :
∃ L : List (Fin 22 × Fin 22), (simple_graph_of_edge_list L).IsRegularOfDegree 8 ∧
simple_graph_is_triangle_distinct (simple_graph_of_edge_list L)regular_girth_five_mutual_visibility_boundIn LeanGraph Theory & Graph Algorithms
Let G be a d-regular simple graph of order n and girth at least 5 on a finite vertex set V. Then the mutual-visibility number of G satisfies mutual_visibility_number G ≤ (d * Fintype.card V) / (2 * d - 1).
theorem regular_girth_five_mutual_visibility_bound {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {d : ℕ} (hreg : G.IsRegularOfDegree d)
(hgirth : 5 ≤ G.girth) :
mutual_visibility_number G ≤ (d * Fintype.card V) / (2 * d - 1)regular_graph_compl_adj_trace_seq_diff_eq_lap_diff_of_eq_on_ltIn LeanGraph Theory & Graph Algorithms
For two d-regular graphs G and H on a finite vertex set V, if their Laplacian trace sequences agree at all positive integer indices j < k, then the difference of their complement adjacency traces at index k equals the difference of their Laplacian traces at index k.
open scoped Classical in
theorem regular_graph_compl_adj_trace_seq_diff_eq_lap_diff_of_eq_on_lt
{V : Type*} [Fintype V] (d : ℕ) (G H : SimpleGraph V)
(hG : G.IsRegularOfDegree d) (hH : H.IsRegularOfDegree d) (k : ℕ+)
(h : ∀ j < k, graph_lap_trace_seq G j = graph_lap_trace_seq H j) :
graph_adj_trace_seq Gᶜ k - graph_adj_trace_seq Hᶜ k =
graph_lap_trace_seq G k - graph_lap_trace_seq H kregular_graph_lap_trace_minimal_iff_compl_adj_trace_minimalIn LeanGraph Theory & Graph Algorithms
Let d and n be integers such that d ≥ 1 and n ≥ d + 1. A d-regular graph G on a finite vertex set of cardinality n is Laplacian trace-minimal in the class of d-regular graphs on n vertices if and only if its complement Gᶜ is trace-minimal in the class of (n - 1 - d)-regular graphs on n vertices.
open scoped Classical in
theorem regular_graph_lap_trace_minimal_iff_compl_adj_trace_minimal
{V : Type*} [Fintype V] (d : ℕ) (G : SimpleGraph V)
(hd : 1 ≤ d) (hn : d + 1 ≤ Fintype.card V) (hreg : G.IsRegularOfDegree d) :
is_lap_trace_minimal d G ↔ is_adj_trace_minimal (Fintype.card V - 1 - d) Gᶜregular_graph_toLex_lap_trace_le_iff_compl_adj_trace_leIn LeanGraph Theory & Graph Algorithms
For any two d-regular graphs G and H on a finite vertex set V, the lexicographic order of their Laplacian trace sequences matches the lexicographic order of the adjacency trace sequences of their complements.
open scoped Classical in
theorem regular_graph_toLex_lap_trace_le_iff_compl_adj_trace_le
{V : Type*} [Fintype V] (d : ℕ) (G H : SimpleGraph V)
(hG : G.IsRegularOfDegree d) (hH : H.IsRegularOfDegree d) :
toLex (graph_lap_trace_seq G) ≤ toLex (graph_lap_trace_seq H) ↔
toLex (graph_adj_trace_seq Gᶜ) ≤ toLex (graph_adj_trace_seq Hᶜ)relation_refltransgen_mem_of_step_invariantIn LeanGraph Theory & Graph Algorithms
If a set S contains a and is closed under the relation r, then every point reachable from a by r lies in S.
theorem relation_refltransgen_mem_of_step_invariant {α : Type*} {r : α → α → Prop} {S : Set α} {a : α}
(ha : a ∈ S) (hstep : ∀ x ∈ S, ∀ y, r x y → y ∈ S) :
∀ b : α, Relation.ReflTransGen r a b → b ∈ Ssimple_graph_active_edge_matching_le_two_mul_triangle_packingIn LeanGraph Theory & Graph Algorithms
In any finite simple graph, every vertex-disjoint matching of edges that each lie in a triangle has at most twice the triangle packing number.
theorem simple_graph_active_edge_matching_le_two_mul_triangle_packing (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (M : Finset (Sym2 (Fin n))) (hactive : ∀ e ∈ M, e ∈ G.edgeSet ∧ ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ e ∈ finite_vertex_set_edge_encoding t) (hmatching : (M : Set (Sym2 (Fin n))).Pairwise (fun e f => Disjoint e.toFinset f.toFinset)) : M.card ≤ 2 * simple_graph_triangle_packing_number G
simple_graph_avg_connected_induced_order_clique_four_bridge_cliqueIn LeanGraph Theory & Graph Algorithms
For n ≥ 8, A(K_4 –e– K_{n−4}) = (32 + (n+24)2^{n−5} + (n−5)2^{n−3}) / (5·2^{n−4} + 14).
theorem simple_graph_avg_connected_induced_order_clique_four_bridge_clique (n : ℕ) (hn : 8 ≤ n) :
simple_graph_avg_connected_induced_order (simple_graph_clique_four_bridge_clique n) =
((32 + (n + 24) * 2 ^ (n - 5) + (n - 5) * 2 ^ (n - 3) : ℕ) : ℚ) /
((5 * 2 ^ (n - 4) + 14 : ℕ) : ℚ)simple_graph_avg_connected_induced_order_eq_two_side_avgIn LeanGraph Theory & Graph Algorithms
If V is partitioned into A and B (as Finsets) and the only edges between A and B are the bridge uv, then the average order A(G) equals the two-side expression R(G[A], G[B], u, v).
theorem simple_graph_avg_connected_induced_order_eq_two_side_avg {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
{A B : Finset V} (hU : (A : Set V) ∪ (B : Set V) = Set.univ) (hD : Disjoint (A : Set V) (B : Set V))
{u v : V} (hu : u ∈ A) (hv : v ∈ B) (huv : G.Adj u v)
(hcross : ∀ x ∈ A, ∀ y ∈ B, G.Adj x y → (x = u ∧ y = v) ∨ (x = v ∧ y = u)) :
simple_graph_avg_connected_induced_order G =
simple_graph_two_side_avg (G.induce (A : Set V)) (G.induce (B : Set V)) ⟨u, hu⟩ ⟨v, hv⟩simple_graph_avg_connected_induced_order_min_of_bridgeIn LeanGraph Theory & Graph Algorithms
For every n ≥ 8, among connected graphs of order n with minimum degree at least 3 and a cut edge, the average order A(G) of connected induced subgraphs is minimised exactly by K_4 joined by one edge to K_{n−4} (unique up to isomorphism).
theorem simple_graph_avg_connected_induced_order_min_of_bridge {V : Type*} [Fintype V]
[DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (hn : 8 ≤ Fintype.card V)
(hc : G.Connected) (hδ : ∀ v, 3 ≤ G.degree v)
(hbr : ∃ e ∈ G.edgeSet, G.IsBridge e) :
simple_graph_avg_connected_induced_order
(simple_graph_clique_four_bridge_clique (Fintype.card V)) ≤
simple_graph_avg_connected_induced_order G ∧
(simple_graph_avg_connected_induced_order G =
simple_graph_avg_connected_induced_order
(simple_graph_clique_four_bridge_clique (Fintype.card V)) →
Nonempty (G ≃g simple_graph_clique_four_bridge_clique (Fintype.card V)))simple_graph_avg_dominating_order_eq_two_mul_card_div_three_iff_star_likeIn LeanGraph Theory & Graph Algorithms
If G has order n ≥ 2 and no isolated vertices, then avd(G) = 2n/3 if and only if G is star-like (every vertex is a leaf or has 1 or 2 leaf neighbours). The backward direction is what yields the equality half of the target: for star-like G with exactly one leaf neighbour at v the leaf-stripping identity gives avd_v(G) = 3/2 + 2(n-2)/3 = (4n+1)/6.
theorem simple_graph_avg_dominating_order_eq_two_mul_card_div_three_iff_star_like {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hn : 2 ≤ Fintype.card V) (hiso : ∀ w, 0 < G.degree w) :
simple_graph_avg_dominating_order G = 2 * (Fintype.card V : ℚ) / 3 ↔
simple_graph_is_star_like Gsimple_graph_avg_dominating_order_equivIn LeanGraph Theory & Graph Algorithms
The global average dominating order is invariant under graph isomorphism.
theorem simple_graph_avg_dominating_order_equiv {V : Type*} {V' : Type*} [Fintype V] [DecidableEq V] [Fintype V'] [DecidableEq V'] (G : SimpleGraph V) [DecidableRel G.Adj] (G' : SimpleGraph V') [DecidableRel G'.Adj] (e : V ≃ V') (he : ∀ u v, G'.Adj (e u) (e v) ↔ G.Adj u v) : simple_graph_avg_dominating_order G' = simple_graph_avg_dominating_order Gsimple_graph_avg_dominating_order_le_of_acyclicIn LeanGraph Theory & Graph Algorithms
Beaton--Cameron in the acyclic case: if a finite forest G has no isolated vertex (so every component has at least two vertices), then the average size of its dominating sets is at most 2|V|/3. This is exactly the target statement restricted to acyclic G (δ ≥ 1 already forces |V| ≥ 2 when |V| > 0), so it is an honest special case, not a restatement of the target.
theorem simple_graph_avg_dominating_order_le_of_acyclic {V : Type*} [Fintype V]
[DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (h : G.IsAcyclic)
(hiso : ∀ w, 0 < G.degree w) :
simple_graph_avg_dominating_order G ≤ 2 * (Fintype.card V : ℚ) / 3simple_graph_avg_dominating_order_le_two_mul_card_div_threeIn LeanGraph Theory & Graph Algorithms
If G has order n ≥ 2 and no isolated vertices, then the average size of all dominating sets of G is at most 2n/3. (Beaton--Cameron, quoted as Lemma 5.1 / [5, Theorem 2.10] in arXiv:2610.11446.)
theorem simple_graph_avg_dominating_order_le_two_mul_card_div_three {V : Type*} [Fintype V]
[DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (hn : 2 ≤ Fintype.card V)
(hiso : ∀ w, 0 < G.degree w) :
simple_graph_avg_dominating_order G ≤ 2 * (Fintype.card V : ℚ) / 3simple_graph_avg_dominating_order_sumIn LeanGraph Theory & Graph Algorithms
The average order of the dominating sets is additive over disjoint unions: for graphs G on V and H on W, the graph G ⊔ H on the disjoint vertex type V ⊕ W (Mathlib SimpleGraph.sum, notation ⊕g) satisfies avd(G ⊔ H) = avd(G) + avd(H). A set dominates the disjoint union iff its two halves dominate G and H respectively, so the counting sum factorises and the ratio telescopes.
theorem simple_graph_avg_dominating_order_sum {V W : Type*} [Fintype V] [DecidableEq V]
[Fintype W] [DecidableEq W] (G : SimpleGraph V) [DecidableRel G.Adj]
(H : SimpleGraph W) [DecidableRel H.Adj] [DecidableRel (G ⊕g H).Adj] :
simple_graph_avg_dominating_order (G ⊕g H) =
simple_graph_avg_dominating_order G + simple_graph_avg_dominating_order Hsimple_graph_avoided_edge_book_at_most_two_pages_share_packing_triangleIn LeanGraph Theory & Graph Algorithms
A triangle s that avoids edge e can share an edge with at most two book pages containing e.
open scoped Classical in
theorem simple_graph_avoided_edge_book_at_most_two_pages_share_packing_triangle
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(e : Sym2 V) (he : e ∈ G.edgeSet)
(s : Finset V) (hs : G.IsNClique 3 s) (havoid : ¬ (∀ x ∈ e, x ∈ s)) :
((Finset.univ : Finset (Finset V)).filter (fun t =>
G.IsNClique 3 t ∧ (∀ x ∈ e, x ∈ t) ∧ 2 ≤ (s ∩ t).card)).card ≤ 2simple_graph_avoided_edge_book_average_twoIn LeanGraph Theory & Graph Algorithms
Given a maximum triangle packing that avoids an edge e, there is a nonempty finite collection of maximum triangle packings such that every triangle containing e has average edge overlap at least two with the packings in the collection.
theorem simple_graph_avoided_edge_book_average_two
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(e : Sym2 V) (he : e ∈ G.edgeSet)
(Q : Finset (Finset V))
(hcl : ∀ t ∈ Q, G.IsNClique 3 t)
(hpair : (Q : Set (Finset V)).Pairwise (fun s t => (s ∩ t).card ≤ 1))
(hsize : Q.card = simple_graph_triangle_packing_number G)
(havoid : ∀ t ∈ Q, ¬ (∀ x ∈ e, x ∈ t)) :
∃ K : Finset (Finset (Finset V)), K.Nonempty ∧
(∀ P ∈ K, (∀ t ∈ P, G.IsNClique 3 t) ∧
(P : Set (Finset V)).Pairwise (fun s t => (s ∩ t).card ≤ 1) ∧
P.card = simple_graph_triangle_packing_number G) ∧
(∀ t : Finset V, G.IsNClique 3 t → (∀ x ∈ e, x ∈ t) →
2 * K.card ≤ ∑ P ∈ K,
(finite_vertex_set_edge_encoding t ∩
(P.image finite_vertex_set_edge_encoding).biUnion id).card)simple_graph_avoided_edge_book_double_hit_page_overlap_ge_twoIn LeanGraph Theory & Graph Algorithms
Any book page t that meets Q in at least two edges retains edge overlap at least two after exchanging any triangle s_del in Q for a book page T containing e.
theorem simple_graph_avoided_edge_book_double_hit_page_overlap_ge_two
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(e : Sym2 V) (he : e ∈ G.edgeSet)
(Q : Finset (Finset V))
(hcl : ∀ t ∈ Q, G.IsNClique 3 t)
(hpair : (Q : Set (Finset V)).Pairwise (fun s t => (s ∩ t).card ≤ 1))
(havoid : ∀ t ∈ Q, ¬ (∀ x ∈ e, x ∈ t))
(s_del T : Finset V) (heT : ∀ x ∈ e, x ∈ T)
(t : Finset V) (ht : G.IsNClique 3 t) (het : ∀ x ∈ e, x ∈ t)
(hge2 : 2 ≤ (finite_vertex_set_edge_encoding t ∩
(Q.image finite_vertex_set_edge_encoding).biUnion id).card) :
2 ≤ (finite_vertex_set_edge_encoding t ∩
((insert T (Q.erase s_del)).image finite_vertex_set_edge_encoding).biUnion id).cardsimple_graph_avoided_edge_single_hit_triangle_exchange_injectiveIn LeanGraph Theory & Graph Algorithms
If two triangle packings formed by swapping an edge-avoiding triangle in Q for a book page containing e are equal, then the swapped book pages are identical.
theorem simple_graph_avoided_edge_single_hit_triangle_exchange_injective
{V : Type*} [DecidableEq V]
(e : Sym2 V) (Q : Finset (Finset V))
(havoid : ∀ t ∈ Q, ¬ (∀ x ∈ e, x ∈ t))
(T1 T2 : Finset V) (he1 : ∀ x ∈ e, x ∈ T1) (he2 : ∀ x ∈ e, x ∈ T2)
(s1 s2 : Finset V)
(heq : insert T1 (Q.erase s1) = insert T2 (Q.erase s2)) :
T1 = T2simple_graph_avoided_edge_single_hit_triangle_exchange_packingIn LeanGraph Theory & Graph Algorithms
A book page of an edge e that meets a maximum packing Q avoiding e in exactly one edge conflicts with a unique triangle s in Q, and exchanging s for T produces another maximum triangle packing.
theorem simple_graph_avoided_edge_single_hit_triangle_exchange_packing
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(e : Sym2 V) (he : e ∈ G.edgeSet)
(Q : Finset (Finset V))
(hcl : ∀ t ∈ Q, G.IsNClique 3 t)
(hpair : (Q : Set (Finset V)).Pairwise (fun s t => (s ∩ t).card ≤ 1))
(hsize : Q.card = simple_graph_triangle_packing_number G)
(havoid : ∀ t ∈ Q, ¬ (∀ x ∈ e, x ∈ t))
(T : Finset V) (hT : G.IsNClique 3 T) (heT : ∀ x ∈ e, x ∈ T)
(hsingle : (finite_vertex_set_edge_encoding T ∩
(Q.image finite_vertex_set_edge_encoding).biUnion id).card = 1) :
∃ s ∈ Q, 2 ≤ (s ∩ T).card ∧
(∀ s' ∈ Q, 2 ≤ (s' ∩ T).card → s' = s) ∧
(∀ t ∈ insert T (Q.erase s), G.IsNClique 3 t) ∧
((insert T (Q.erase s) : Finset (Finset V)) : Set (Finset V)).Pairwise
(fun a b => (a ∩ b).card ≤ 1) ∧
(insert T (Q.erase s)).card = simple_graph_triangle_packing_number Gsimple_graph_bridge_side_setsIn LeanGraph Theory & Graph Algorithms
A bridge uv of a connected graph G with min degree ≥ 3 splits G into two Finsets A, B whose induced subgraphs are connected, have at least 4 vertices, every non-endpoint vertex has internal degree ≥ 3 and the endpoint internal degree ≥ 2.
theorem simple_graph_bridge_side_sets {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hc : G.Connected)
(hδ : ∀ x, 3 ≤ G.degree x) {u v : V} (huv : G.Adj u v) (hb : G.IsBridge s(u, v)) :
∃ (A B : Finset V) (hu : u ∈ A) (hv : v ∈ B),
(A : Set V) ∪ (B : Set V) = Set.univ ∧ Disjoint (A : Set V) (B : Set V) ∧
(∀ x ∈ A, ∀ y ∈ B, G.Adj x y → (x = u ∧ y = v) ∨ (x = v ∧ y = u)) ∧
(G.induce (A : Set V)).Connected ∧ (G.induce (B : Set V)).Connected ∧
4 ≤ A.card ∧ 4 ≤ B.card ∧
(∀ x : (A : Set V), x ≠ ⟨u, hu⟩ → 3 ≤ (G.induce (A : Set V)).degree x) ∧
2 ≤ (G.induce (A : Set V)).degree ⟨u, hu⟩ ∧
(∀ x : (B : Set V), x ≠ ⟨v, hv⟩ → 3 ≤ (G.induce (B : Set V)).degree x) ∧
2 ≤ (G.induce (B : Set V)).degree ⟨v, hv⟩simple_graph_card_edgeFinset_ge_of_indepSetFree_threeIn LeanGraph Theory & Graph Algorithms
A finite simple graph with independence number at most two has at least choose(n, 2) - n^2 / 4 edges.
theorem simple_graph_card_edgeFinset_ge_of_indepSetFree_three
(V : Type) [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(h : G.IndepSetFree 3) :
(Fintype.card V).choose 2 - (Fintype.card V) ^ 2 / 4 ≤ G.edgeFinset.cardsimple_graph_clique_polynomial_delete_vertexIn LeanGraph Theory & Graph Algorithms
For every vertex $v$ of a finite simple graph $H$, the clique polynomial of $H$ satisfies $C_H(z) = C_{H-v}(z) + z C_{H[N_H(v)]}(z)$, where $H-v$ is the induced subgraph on $V(H) \setminus \{v\}$ and $H[N_H(v)]$ is the induced subgraph on the open neighbourhood of $v$.
open scoped Classical in
theorem simple_graph_clique_polynomial_delete_vertex {V : Type*} [Fintype V] (H : SimpleGraph V) (v : V) :
simple_graph_clique_polynomial H =
simple_graph_clique_polynomial (H.induce ({v}ᶜ : Set V)) +
Polynomial.X * simple_graph_clique_polynomial (H.induce (H.neighborSet v))simple_graph_complete_tip_cycle_packing_two_rim_edges_decreaseIn LeanGraph Theory & Graph Algorithms
Suppose a maximum triangle packing contains an isolated vertex-disjoint cycle block of k at least five triangles, with distinct rim vertices and distinct private tips, and every tip is adjacent to every rim vertex. Then deleting any two different rim edges decreases the triangle-packing number by at least two. Other packed triangles and arbitrary additional graph edges are permitted.
theorem simple_graph_complete_tip_cycle_packing_two_rim_edges_decrease (n k : ℕ) (hk : 5 ≤ k) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (v c : Fin k → Fin n) (hv : Function.Injective v) (hc : Function.Injective c) (hvc : Disjoint (Finset.univ.image v) (Finset.univ.image c)) (hP : ∀ i : Fin k, ({v i, v ⟨(i.val + 1) % k, Nat.mod_lt _ (by omega)⟩, c i} : Finset (Fin n)) ∈ P) (hrest : ∀ t ∈ P, (∀ i : Fin k, t ≠ ({v i, v ⟨(i.val + 1) % k, Nat.mod_lt _ (by omega)⟩, c i} : Finset (Fin n))) → Disjoint t ((Finset.univ.image v) ∪ (Finset.univ.image c))) (hcomplete : ∀ i j : Fin k, G.Adj (c i) (v j)) : let R : Finset (Sym2 (Fin n)) := Finset.univ.image (fun i : Fin k => s(v i, v ⟨(i.val + 1) % k, Nat.mod_lt _ (by omega)⟩)); ∀ e ∈ R, ∀ f ∈ R, e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) + 2 ≤ simple_graph_triangle_packing_number Gsimple_graph_complete_triangle_cover_le_two_mul_packingIn LeanGraph Theory & Graph Algorithms
For every complete graph, its triangle cover number is at most twice its triangle packing number.
theorem simple_graph_complete_triangle_cover_le_two_mul_packing (n : ℕ) :
simple_graph_triangle_cover_number (⊤ : SimpleGraph (Fin n)) ≤
2 * simple_graph_triangle_packing_number (⊤ : SimpleGraph (Fin n))simple_graph_cone_fork_plus_center_supported_triangle_coverIn LeanGraph Theory & Graph Algorithms
Consider a cone over 2m paired vertices, with all matching edges present. Suppose the other base edges lie in a triangle-free graph whose edges are contained in one fork per pair together with edges through one extra vertex. Then the m apex triangles over the matching support a triangle cover with at most 2m edges.
theorem simple_graph_cone_fork_plus_center_supported_triangle_cover
(m : ℕ) (G : SimpleGraph (Option (Fin m × Fin 2)))
(H : SimpleGraph (Fin m × Fin 2))
(w : Fin m → Fin m × Fin 2) (z : Fin m × Fin 2)
(hw : ∀ i, (w i).1 ≠ i)
(hH : ∀ x y, H.Adj x y →
(∃ i : Fin m, (x.1 = i ∧ y = w i) ∨ (y.1 = i ∧ x = w i)) ∨ x = z ∨ y = z)
(htriangle : H.CliqueFree 3)
(hapex : ∀ x, G.Adj none (some x))
(hmatching : ∀ i : Fin m, G.Adj (some (i, 0)) (some (i, 1)))
(hbase : ∀ x y, G.Adj (some x) (some y) →
H.Adj x y ∨ (x.1 = y.1 ∧ x.2 ≠ y.2)) :
let P := (Finset.univ : Finset (Fin m)).image (fun i =>
finite_vertex_set_edge_encoding
({none, some (i, 0), some (i, 1)} : Finset (Option (Fin m × Fin 2))))
let U := P.biUnion id
∃ C : Finset (Sym2 (Option (Fin m × Fin 2))), C ⊆ U ∧ C.card ≤ 2 * m ∧
∀ t ∈ simple_graph_triangle_edge_family G, (C ∩ t).Nonemptysimple_graph_connected_almost_balanced_edge_bipartitionIn LeanGraph Theory & Graph Algorithms
Every finite connected graph has a partition of its edges into two classes whose incident counts differ by at most one at every vertex, except possibly one vertex where they differ by at most two; a genuine exceptional vertex is needed only for an all-even graph with an odd number of edges.
theorem simple_graph_connected_almost_balanced_edge_bipartition
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(hconn : H.Connected) :
∃ R : Finset (Sym2 (Fin n)), R ⊆ H.edgeFinset ∧
∃ X : Finset (Fin n), X.card ≤ 1 ∧
(X.Nonempty → (∀ v, Even (H.degree v)) ∧ Odd H.edgeFinset.card) ∧
∀ v, let a := (H.incidenceFinset v ∩ R).card
let b := (H.incidenceFinset v \ R).card
(a ≤ b + 2 ∧ b ≤ a + 2) ∧
(v ∉ X → a ≤ b + 1 ∧ b ≤ a + 1)simple_graph_connected_eq_univ_of_neighborhood_closedIn LeanGraph Theory & Graph Algorithms
If a finite set of vertices of a connected simple graph contains a vertex v and is closed under taking neighbours, then it is the whole vertex set.
theorem simple_graph_connected_eq_univ_of_neighborhood_closed {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] (hconn : H.Connected) {S : Finset V} {v : V}
(hv : v ∈ S) (hclosed : ∀ x ∈ S, H.neighborFinset x ⊆ S) : S = Finset.univsimple_graph_connected_even_degree_almost_balanced_edge_bipartitionIn LeanGraph Theory & Graph Algorithms
Every finite connected simple graph with all even degrees has an edge bipartition into two classes whose incident counts differ by at most one, except possibly one vertex where they differ by at most two (and this exceptional vertex is needed only if the number of edges is odd).
theorem simple_graph_connected_even_degree_almost_balanced_edge_bipartition
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hconn : G.Connected) (heven : ∀ v, Even (G.degree v)) :
∃ R : Finset (Sym2 V), R ⊆ G.edgeFinset ∧
∃ X : Finset V, X.card ≤ 1 ∧
(X.Nonempty → Odd G.edgeFinset.card) ∧
∀ v, let a := (G.incidenceFinset v ∩ R).card
let b := (G.incidenceFinset v \ R).card
(a ≤ b + 2 ∧ b ≤ a + 2) ∧
(v ∉ X → a ≤ b + 1 ∧ b ≤ a + 1)simple_graph_connected_even_degree_exists_eulerian_circuitIn LeanGraph Theory & Graph Algorithms
Every finite connected simple graph where every vertex has even degree admits an Eulerian circuit.
theorem simple_graph_connected_even_degree_exists_eulerian_circuit
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hconn : G.Connected) (heven : ∀ v, Even (G.degree v)) :
∃ (u : V) (p : G.Walk u u), p.IsEuleriansimple_graph_connected_four_regular_codegree_two_card_five_or_sixIn LeanGraph Theory & Graph Algorithms
A connected four-regular finite simple graph in which the endpoints of every edge have at least two common neighbors has five or six vertices.
theorem simple_graph_connected_four_regular_codegree_two_card_five_or_six (n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj] (hconnected : H.Connected) (hregular : ∀ v, H.degree v = 4) (hcodeg : ∀ u v, H.Adj u v → 2 ≤ (H.neighborFinset u ∩ H.neighborFinset v).card) : n = 5 ∨ n = 6
simple_graph_connected_not_isTree_card_le_edge_cardIn LeanGraph Theory & Graph Algorithms
A connected simple graph that is not a tree has at least as many edges as vertices.
theorem simple_graph_connected_not_isTree_card_le_edge_card {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hconn : G.Connected) (hnt : ¬ G.IsTree) :
Fintype.card V ≤ G.edgeFinset.cardsimple_graph_connected_odd_degree_balanced_edge_bipartitionIn LeanGraph Theory & Graph Algorithms
Every finite connected simple graph with at least one vertex of odd degree has a balanced edge bipartition with incident count difference at most one everywhere (with no exceptional vertex needed).
theorem simple_graph_connected_odd_degree_balanced_edge_bipartition
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hconn : G.Connected) (hodd : ∃ v, Odd (G.degree v)) :
∃ R : Finset (Sym2 V), R ⊆ G.edgeFinset ∧
∀ v, let a := (G.incidenceFinset v ∩ R).card
let b := (G.incidenceFinset v \ R).card
a ≤ b + 1 ∧ b ≤ a + 1simple_graph_connected_two_regular_iso_cycle_graphIn LeanGraph Theory & Graph Algorithms
Every finite connected simple graph in which every vertex has degree 2 is isomorphic to a cycle graph: there is a bijection of the vertex set with Fin |V| that carries adjacency to adjacency in SimpleGraph.cycleGraph |V|.
theorem simple_graph_connected_two_regular_iso_cycle_graph {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hconn : G.Connected) (hdeg : ∀ v, G.degree v = 2) :
∃ e : V ≃ Fin (Fintype.card V),
∀ u v, G.Adj u v ↔ (SimpleGraph.cycleGraph (Fintype.card V)).Adj (e u) (e v)simple_graph_csym_max_nullity_eq_fort_transversal_number_of_all_fortsIn LeanGraph Theory & Graph Algorithms
If the combinatorially symmetric maximum nullity N(G) is at least the transversal number of all forts of G, then N(G) equals the fort transversal number T(G).
theorem simple_graph_csym_max_nullity_eq_fort_transversal_number_of_all_forts
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(h : finset_transversal_number (open Classical in (Finset.univ : Finset (Finset V)).filter (fun F => simple_graph_is_fort G ↑F)) ≤ simple_graph_csym_max_nullity G) :
simple_graph_csym_max_nullity G = simple_graph_fort_transversal_number Gsimple_graph_cycleGraph_hop_is_rotationIn LeanGraph Theory & Graph Algorithms
On the cycle graph of odd order n, every hop is a rotation: h = finRotate n ^ k for some k.
theorem simple_graph_cycleGraph_hop_is_rotation {n : ℕ} (hn : Odd n) (h : Equiv.Perm (Fin n))
(hh : simple_graph_is_hop (SimpleGraph.cycleGraph n) h) : ∃ k : ℕ, h = finRotate n ^ ksimple_graph_degree_three_nbrsIn LeanGraph Theory & Graph Algorithms
A vertex u of degree three with a neighbour v has exactly two further neighbours a and b, distinct from each other and from v, and its neighbourhood is {v, a, b}.
theorem simple_graph_degree_three_nbrs {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (u v : V) (huv : G.Adj u v) (hu : G.degree u = 3) :
∃ a b : V, a ≠ b ∧ a ≠ v ∧ b ≠ v ∧ G.Adj u a ∧ G.Adj u b ∧
G.neighborFinset u = {v, a, b}simple_graph_dense_high_degree_unforced_internal_k4_anchor_counterexampleIn LeanGraph Theory & Graph Algorithms
A four-connected, two-edge-stable graph has 31 vertices, 109 edges, packing number 26, maximum degree at least 16, every edge in at least two triangles, and no one-point triangle-family separator; nevertheless it has a full-support maximum packing with a fully forced K4 face whose internal anchor is contained only in unforced packed triangles. Its average degree exceeds seven.
theorem simple_graph_dense_high_degree_unforced_internal_k4_anchor_counterexample : let P : Finset (Finset (Fin 31)) := {{0,1,5},{0,2,3},{2,6,7},{2,8,9},{3,6,9},{3,7,8},{4,5,9},{5,6,8},{3,10,12},{4,11,12},{10,13,15},{11,14,15},{6,13,16},{7,14,16},{3,17,19},{8,18,19},{17,20,22},{18,21,22},{5,20,23},{7,21,23},{2,24,26},{3,25,26},{24,27,29},{25,28,29},{6,27,30},{8,28,30}}; ∃ (G : SimpleGraph (Fin 31)) (E : Finset (Sym2 (Fin 31))), (↑E : Set (Sym2 (Fin 31))) = G.edgeSet ∧ E.card = 109 ∧ (∀ t ∈ P, G.IsNClique 3 t) ∧ (P : Set (Finset (Fin 31))).Pairwise (fun t u => (t ∩ u).card ≤ 1) ∧ P.card = 26 ∧ P.card = simple_graph_triangle_packing_number G ∧ P.biUnion id = Finset.univ ∧ (∀ e f : Sym2 (Fin 31), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) ∧ (∀ e ∈ G.edgeSet, 2 ≤ ((simple_graph_triangle_edge_family G).filter (fun t => e ∈ t)).card) ∧ (∀ R : Finset (Fin 31), R.card ≤ 3 → (G.induce {v | v ∉ R}).Connected) ∧ (∃ v : Fin 31, ∃ N : Finset (Fin 31), N.card = 16 ∧ ∀ w ∈ N, G.Adj v w) ∧ (∀ e ∈ G.edgeSet, ∀ a ∈ simple_graph_triangle_edge_family G, ∀ b ∈ simple_graph_triangle_edge_family G, Relation.ReflTransGen (fun x y : Finset (Sym2 (Fin 31)) => x ∈ simple_graph_triangle_edge_family G ∧ y ∈ simple_graph_triangle_edge_family G ∧ ¬ Disjoint (x.erase e) (y.erase e)) a b) ∧ G.IsNClique 4 ({1,2,8,9} : Finset (Fin 31)) ∧ ({2,8,9} : Finset (Fin 31)) ∈ P ∧ finite_vertex_set_edge_encoding ({2,8,9} : Finset (Fin 31)) ⊆ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id) ∧ (∃ q ∈ P, (1 : Fin 31) ∈ q) ∧ (∀ q ∈ P, (1 : Fin 31) ∈ q → Disjoint (finite_vertex_set_edge_encoding q) (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id))simple_graph_diam_two_nut_graph_has_triangle_free_or_subset_nbhNeeds helpGraph Theory & Graph Algorithms
Every finite simple nut graph of diameter 2 has either a triangle-free edge or a pair of vertices with strictly nested neighborhoods.
theorem simple_graph_diam_two_nut_graph_has_triangle_free_or_subset_nbh
{V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hnut : simple_graph_is_nut_graph G) (hdiam : G.diam = 2) :
(∃ u v : V, G.Adj u v ∧ ∀ w : V, ¬(G.Adj u w ∧ G.Adj v w)) ∨
(∃ u v : V, G.neighborSet v ⊂ G.neighborSet u)simple_graph_dominating_sets_monoIn LeanGraph Theory & Graph Algorithms
If H is a spanning subgraph of G on the same vertex set (every edge of H is an edge of G, written H ≤ G), then every dominating set of H is a dominating set of G, i.e. D(H) ⊆ D(G). Adding edges can only enlarge the family of dominating sets.
theorem simple_graph_dominating_sets_mono {V : Type*} [Fintype V] [DecidableEq V]
{G H : SimpleGraph V} [DecidableRel G.Adj] [DecidableRel H.Adj] (h : H ≤ G) :
simple_graph_dominating_sets H ⊆ simple_graph_dominating_sets Gsimple_graph_domination_number_le_cardIn LeanGraph Theory & Graph Algorithms
If S is a dominating set of G with |S| = k then the domination number of G is at most k.
theorem simple_graph_domination_number_le_card {V : Type*} [Fintype V] (G : SimpleGraph V)
(S : Finset V) (h : simple_graph_is_dominating G (S : Set V)) :
simple_graph_domination_number G ≤ S.cardsimple_graph_eq_top_of_card_four_min_degree_threeIn LeanGraph Theory & Graph Algorithms
Every finite simple graph on 4 vertices with minimum degree at least 3 is the complete graph.
theorem simple_graph_eq_top_of_card_four_min_degree_three
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hn : Fintype.card V = 4) (hdeg : ∀ v : V, 3 ≤ G.degree v) :
G = ⊤simple_graph_exists_cycle_edge_degree_posIn LeanGraph Theory & Graph Algorithms
If a finite graph G has no isolated vertex and is not acyclic, then some edge uv (lying on a cycle) can be deleted while keeping the minimum degree at least 1: every vertex of G - uv still has positive degree, and the number of edges goes down by exactly one.
theorem simple_graph_exists_cycle_edge_degree_pos {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hiso : ∀ w, 0 < G.degree w)
(hcyc : ¬ G.IsAcyclic) :
∃ u v : V, G.Adj u v ∧ (∀ w, 0 < (G.deleteEdges {s(u, v)}).degree w) ∧
(G.deleteEdges {s(u, v)}).edgeFinset.card + 1 = G.edgeFinset.cardsimple_graph_exists_deletion_edge_not_acyclicIn LeanGraph Theory & Graph Algorithms
If a finite graph G has no isolated vertex and contains a cycle, then some edge uv satisfies: G - uv still has no isolated vertex (every vertex keeps positive degree) and the average dominating-set order does not decrease when the edge is deleted, avd(G) ≤ avd(G - uv). This is the induction step of the edge-count induction.
theorem simple_graph_exists_deletion_edge_not_acyclic {V : Type*} [Fintype V]
[DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hiso : ∀ w, 0 < G.degree w) (hcyc : ¬ G.IsAcyclic) :
∃ u v : V, G.Adj u v ∧ (∀ w, 0 < (G.deleteEdges {s(u, v)}).degree w) ∧
simple_graph_avg_dominating_order G ≤
simple_graph_avg_dominating_order (G.deleteEdges {s(u, v)})simple_graph_exists_even_order_hop_of_not_same_cycleIn LeanGraph Theory & Graph Algorithms
If h is a hop of odd order and uv is an edge whose endpoints lie on different cycles of h, then G has a hop of even order.
theorem simple_graph_exists_even_order_hop_of_not_same_cycle {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (h : Equiv.Perm V) (hh : simple_graph_is_hop G h)
(hodd : Odd (orderOf h)) {u v : V} (huv : G.Adj u v) (hsame : ¬ h.SameCycle u v) :
∃ g : Equiv.Perm V, simple_graph_is_hop G g ∧ Even (orderOf g)simple_graph_exists_even_order_hop_of_not_traversedIn LeanGraph Theory & Graph Algorithms
If h is a hop of odd order and uv is an edge with h u ≠ v and h v ≠ u, then G admits a hop of even order.
theorem simple_graph_exists_even_order_hop_of_not_traversed {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (h : Equiv.Perm V) (hh : simple_graph_is_hop G h)
(hodd : Odd (orderOf h)) {u v : V} (huv : G.Adj u v) (hu : h u ≠ v) (hv : h v ≠ u) :
∃ g : Equiv.Perm V, simple_graph_is_hop G g ∧ Even (orderOf g)simple_graph_exists_even_order_hop_of_same_cycleIn LeanGraph Theory & Graph Algorithms
If h is a hop of odd order, uv is an edge traversed by neither direction (h u ≠ v and h v ≠ u), and u and v lie on the same cycle of h, then G has a hop of even order.
theorem simple_graph_exists_even_order_hop_of_same_cycle {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (h : Equiv.Perm V) (hh : simple_graph_is_hop G h)
(hodd : Odd (orderOf h)) {u v : V} (huv : G.Adj u v) (hsame : h.SameCycle u v)
(hu : h u ≠ v) (hv : h v ≠ u) :
∃ g : Equiv.Perm V, simple_graph_is_hop G g ∧ Even (orderOf g)simple_graph_exists_hamiltonian_walk_of_isHamiltonianIn LeanGraph Theory & Graph Algorithms
A Hamiltonian graph on at least one vertex has a Hamiltonian path between some pair of vertices.
theorem simple_graph_exists_hamiltonian_walk_of_isHamiltonian {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (hV : Fintype.card V ≠ 1) (h : G.IsHamiltonian) : ∃ a b : V, ∃ p : G.Walk a b, p.IsHamiltoniansimple_graph_exists_max_length_pathIn LeanGraph Theory & Graph Algorithms
In a finite graph with at least one vertex there is a path of maximum length: a path a ~> b such that every path in G is no longer.
theorem simple_graph_exists_max_length_path {V : Type*} [Fintype V] [Nonempty V] (G : SimpleGraph V) : ∃ (a b : V) (p : G.Walk a b), p.IsPath ∧ ∀ (c d : V) (q : G.Walk c d), q.IsPath → q.length ≤ p.lengthsimple_graph_exists_maximum_triangle_packingIn LeanGraph Theory & Graph Algorithms
Every finite simple graph has a pairwise edge-disjoint triangle packing achieving its triangle packing number.
theorem simple_graph_exists_maximum_triangle_packing
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) :
∃ T : Finset (Finset V),
(∀ t ∈ T, G.IsNClique 3 t) ∧
(T : Set (Finset V)).Pairwise (fun s t => (s ∩ t).card ≤ 1) ∧
T.card = simple_graph_triangle_packing_number Gsimple_graph_exists_spanning_tree_cardIn LeanGraph Theory & Graph Algorithms
Every finite connected simple graph has a spanning tree: a set W of exactly |V| − 1 of its edges whose edge set, viewed as a graph on all of V, is connected.
theorem simple_graph_exists_spanning_tree_card {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (hG : G.Connected) :
∃ W : Finset (Sym2 V), (W : Set (Sym2 V)) ⊆ G.edgeSet ∧
W.card = Fintype.card V - 1 ∧ (SimpleGraph.fromEdgeSet (W : Set (Sym2 V))).Connectedsimple_graph_five_packing_min_two_forced_independentIn LeanGraph Theory & Graph Algorithms
In a finite graph where every edge belongs to at least two triangles, let five edge-disjoint triangles form a maximum packing. For any marking of one edge in each packed triangle that includes every singleton-forced edge, the unmarked conflict graph has an independent set of five vertices.
theorem simple_graph_five_packing_min_two_forced_independent
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(P : Finset (Finset (Sym2 V))) (M : Finset (Sym2 V))
(hpack : P ⊆ simple_graph_triangle_edge_family G ∧ P.card = 5 ∧
(P : Set (Finset (Sym2 V))).Pairwise Disjoint)
(hmax : ∀ Q : Finset (Finset (Sym2 V)),
Q ⊆ simple_graph_triangle_edge_family G →
(Q : Set (Finset (Sym2 V))).Pairwise Disjoint → Q.card ≤ 5)
(hmin : ∀ e ∈ G.edgeSet,
2 ≤ ((simple_graph_triangle_edge_family G).filter (fun t => e ∈ t)).card)
(hmark : M ⊆ P.biUnion id ∧ (∀ p ∈ P, (M ∩ p).card = 1) ∧
((((simple_graph_triangle_edge_family G).filter
(fun t => (t ∩ P.biUnion id).card = 1)).biUnion id) ∩ P.biUnion id) ⊆ M) :
∃ I : Finset (Sym2 V), I ⊆ P.biUnion id \ M ∧ I.card = 5 ∧
∀ t ∈ simple_graph_triangle_edge_family G, (t ∩ I).card = 2 → t ⊆ P.biUnion idsimple_graph_five_packing_min_two_forced_independent_cover_kernelIn LeanGraph Theory & Graph Algorithms
Given a maximum five-triangle packing whose support meets every triangle, a graph in which every edge lies in at least two triangles, and a marking of exactly one edge per packed triangle that includes every singly-supported support edge, there are five support edges outside the marking which do not contain the support-intersection of any single triangle.
theorem simple_graph_five_packing_min_two_forced_independent_cover_kernel
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(P : Finset (Finset (Sym2 V))) (M : Finset (Sym2 V))
(hpack : P ⊆ simple_graph_triangle_edge_family G ∧ P.card = 5 ∧
(P : Set (Finset (Sym2 V))).Pairwise Disjoint)
(hmeet : ∀ t ∈ simple_graph_triangle_edge_family G, (t ∩ P.biUnion id).Nonempty)
(hmin : ∀ e ∈ G.edgeSet,
2 ≤ ((simple_graph_triangle_edge_family G).filter (fun t => e ∈ t)).card)
(hmark : M ⊆ P.biUnion id ∧ (∀ p ∈ P, (M ∩ p).card = 1) ∧
((((simple_graph_triangle_edge_family G).filter
(fun t => (t ∩ P.biUnion id).card = 1)).biUnion id) ∩ P.biUnion id) ⊆ M) :
∃ I : Finset (Sym2 V), I ⊆ P.biUnion id \ M ∧ I.card = 5 ∧
∀ t ∈ simple_graph_triangle_edge_family G, ¬ (t ∩ P.biUnion id ⊆ I)simple_graph_five_packing_min_two_forced_supported_coverIn LeanGraph Theory & Graph Algorithms
In a finite graph where every edge belongs to at least two triangles, let five edge-disjoint triangles form a maximum packing admitting a marking of one edge per packed triangle that includes every singleton-forced edge. Then a triangle cover of at most ten edges lies entirely in the packing support.
theorem simple_graph_five_packing_min_two_forced_supported_cover
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(P : Finset (Finset (Sym2 V))) (M : Finset (Sym2 V))
(hpack : P ⊆ simple_graph_triangle_edge_family G ∧ P.card = 5 ∧
(P : Set (Finset (Sym2 V))).Pairwise Disjoint)
(hmax : ∀ Q : Finset (Finset (Sym2 V)),
Q ⊆ simple_graph_triangle_edge_family G →
(Q : Set (Finset (Sym2 V))).Pairwise Disjoint → Q.card ≤ 5)
(hmin : ∀ e ∈ G.edgeSet,
2 ≤ ((simple_graph_triangle_edge_family G).filter (fun t => e ∈ t)).card)
(hmark : M ⊆ P.biUnion id ∧ (∀ p ∈ P, (M ∩ p).card = 1) ∧
((((simple_graph_triangle_edge_family G).filter
(fun t => (t ∩ P.biUnion id).card = 1)).biUnion id) ∩ P.biUnion id) ⊆ M) :
∃ C : Finset (Sym2 V), C ⊆ P.biUnion id ∧ C.card ≤ 10 ∧
∀ t ∈ simple_graph_triangle_edge_family G, (C ∩ t).Nonemptysimple_graph_five_packing_support_triangle_meets_supportIn LeanGraph Theory & Graph Algorithms
Every triangle of a graph meets the edge support of any maximum five-triangle packing.
theorem simple_graph_five_packing_support_triangle_meets_support
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(P : Finset (Finset (Sym2 V)))
(hpack : P ⊆ simple_graph_triangle_edge_family G ∧ P.card = 5 ∧
(P : Set (Finset (Sym2 V))).Pairwise Disjoint)
(hmax : ∀ Q : Finset (Finset (Sym2 V)),
Q ⊆ simple_graph_triangle_edge_family G →
(Q : Set (Finset (Sym2 V))).Pairwise Disjoint → Q.card ≤ 5) :
∀ t ∈ simple_graph_triangle_edge_family G, (t ∩ P.biUnion id).Nonemptysimple_graph_fixed_two_budget_example_full_supportIn LeanGraph Theory & Graph Algorithms
The displayed maximum packing in the nine-vertex fixed-two-budget counterexample covers every vertex.
theorem simple_graph_fixed_two_budget_example_full_support : In701Budget.P.biUnion id = Finset.univ
simple_graph_fort_transversal_number_le_cardIn LeanGraph Theory & Graph Algorithms
For any finite simple graph G on a finite vertex type V, the fort transversal number T(G) is at most the number of vertices |V|.
theorem simple_graph_fort_transversal_number_le_card
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) :
simple_graph_fort_transversal_number G ≤ Fintype.card Vsimple_graph_four_regular_codeg_mixed_case_falseIn LeanGraph Theory & Graph Algorithms
In a four-regular finite simple graph in which the endpoints of every edge have at least two common neighbours, no vertex v has two neighbours x and y such that x has exactly three and y has exactly two common neighbours with v.
theorem simple_graph_four_regular_codeg_mixed_case_false {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] (hreg : ∀ x, H.degree x = 4)
(hcodeg : ∀ u w, H.Adj u w → 2 ≤ (H.neighborFinset u ∩ H.neighborFinset w).card)
{v x y : V} (hx : x ∈ H.neighborFinset v) (hcx : (H.neighborFinset v ∩ H.neighborFinset x).card = 3)
(hy : y ∈ H.neighborFinset v) (hcy : (H.neighborFinset v ∩ H.neighborFinset y).card = 2) : Falsesimple_graph_four_regular_codeg_three_neighborFinsetIn LeanGraph Theory & Graph Algorithms
If x is a neighbour of v in a four-regular graph and x has three common neighbours with v, then the neighbourhood of x consists exactly of v together with the three neighbours of v different from x.
theorem simple_graph_four_regular_codeg_three_neighborFinset {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] (hreg : ∀ x, H.degree x = 4) {v x : V}
(hx : x ∈ H.neighborFinset v) (hc : (H.neighborFinset v ∩ H.neighborFinset x).card = 3) :
H.neighborFinset x = insert v ((H.neighborFinset v).erase x)simple_graph_four_regular_codeg_two_neighborFinsetIn LeanGraph Theory & Graph Algorithms
If x is a neighbour of v in a four-regular graph and x has exactly two common neighbours with v, then x has exactly one further neighbour z outside {v} ∪ N(v), and the neighbourhood of x is {z, v} together with the two common neighbours.
theorem simple_graph_four_regular_codeg_two_neighborFinset {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] (hreg : ∀ x, H.degree x = 4) {v x : V}
(hx : x ∈ H.neighborFinset v) (hc : (H.neighborFinset v ∩ H.neighborFinset x).card = 2) :
∃ z : V, z ∉ H.neighborFinset v ∧ z ≠ v ∧
H.neighborFinset x = insert z (insert v (H.neighborFinset v ∩ H.neighborFinset x))simple_graph_four_regular_codeg_uniform_dichotomyIn LeanGraph Theory & Graph Algorithms
In a four-regular graph in which the endpoints of every edge have at least two common neighbours, for any vertex v the number of common neighbours of v with its neighbours is either always three or always two.
theorem simple_graph_four_regular_codeg_uniform_dichotomy {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] (hreg : ∀ x, H.degree x = 4)
(hcodeg : ∀ u w, H.Adj u w → 2 ≤ (H.neighborFinset u ∩ H.neighborFinset w).card) (v : V) :
(∀ x, x ∈ H.neighborFinset v → (H.neighborFinset v ∩ H.neighborFinset x).card = 3) ∨
(∀ x, x ∈ H.neighborFinset v → (H.neighborFinset v ∩ H.neighborFinset x).card = 2)simple_graph_four_regular_codeg_uniform_three_card_fiveIn LeanGraph Theory & Graph Algorithms
If every neighbour of a vertex v of a connected four-regular finite simple graph has exactly three common neighbours with v, then the graph has exactly five vertices.
theorem simple_graph_four_regular_codeg_uniform_three_card_five {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] (hconn : H.Connected) (hreg : ∀ x, H.degree x = 4) (v : V)
(hv : ∀ x, x ∈ H.neighborFinset v → (H.neighborFinset v ∩ H.neighborFinset x).card = 3) :
Fintype.card V = 5simple_graph_four_regular_codeg_uniform_two_card_sixIn LeanGraph Theory & Graph Algorithms
If every neighbour of a vertex v of a connected four-regular finite simple graph has exactly two common neighbours with v, and every edge has at least two common neighbours, then the graph has exactly six vertices.
theorem simple_graph_four_regular_codeg_uniform_two_card_six {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] (hconn : H.Connected) (hreg : ∀ x, H.degree x = 4)
(hcodeg : ∀ u w, H.Adj u w → 2 ≤ (H.neighborFinset u ∩ H.neighborFinset w).card) (v : V)
(hv : ∀ x, x ∈ H.neighborFinset v → (H.neighborFinset v ∩ H.neighborFinset x).card = 2) :
Fintype.card V = 6simple_graph_four_regular_neighbor_codeg_le_threeIn LeanGraph Theory & Graph Algorithms
In a four-regular simple graph on a finite vertex type, two adjacent vertices have at most three common neighbours.
theorem simple_graph_four_regular_neighbor_codeg_le_three {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) [DecidableRel H.Adj] (hreg : ∀ x, H.degree x = 4) {v w : V}
(hw : w ∈ H.neighborFinset v) : (H.neighborFinset w ∩ H.neighborFinset v).card ≤ 3simple_graph_fully_forced_triangle_unique_k4In LeanGraph Theory & Graph Algorithms
A fully singleton-forced triangle in a maximum triangle packing belongs to a K4 whose remaining three edges avoid the packing, and every singleton witness at one of its edges lies in that same K4.
open scoped Sym2
theorem simple_graph_fully_forced_triangle_unique_k4
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(P : Finset (Finset (Sym2 V)))
(hP : P ⊆ simple_graph_triangle_edge_family G)
(hdisj : (P : Set (Finset (Sym2 V))).Pairwise Disjoint)
(hmax : ∀ Q : Finset (Finset (Sym2 V)), Q ⊆ simple_graph_triangle_edge_family G →
(Q : Set (Finset (Sym2 V))).Pairwise Disjoint → Q.card ≤ P.card)
(a b c : V) (hab : a ≠ b) (hac : a ≠ c) (hbc : b ≠ c)
(hp : ({s(a,b), s(a,c), s(b,c)} : Finset (Sym2 V)) ∈ P)
(hforced : ∀ e ∈ ({s(a,b), s(a,c), s(b,c)} : Finset (Sym2 V)),
∃ t ∈ simple_graph_triangle_edge_family G, (t ∩ P.biUnion id).card = 1 ∧ e ∈ t) :
∃ d : V, d ≠ a ∧ d ≠ b ∧ d ≠ c ∧
let K : Finset (Sym2 V) := {s(a,b),s(a,c),s(b,c),s(a,d),s(b,d),s(c,d)}
(↑K : Set (Sym2 V)) ⊆ G.edgeSet ∧
K ∩ P.biUnion id = ({s(a,b),s(a,c),s(b,c)} : Finset (Sym2 V)) ∧
∀ t ∈ simple_graph_triangle_edge_family G,
(t ∩ P.biUnion id).card = 1 →
(∃ e ∈ ({s(a,b), s(a,c), s(b,c)} : Finset (Sym2 V)), e ∈ t) → t ⊆ Ksimple_graph_good_packing_multi_witness_support_kernelIn LeanGraph Theory & Graph Algorithms
For a good maximum triangle packing P, if an outside vertex spans at least m packed edges, a support-signature-preserving induced subgraph contains P and uses at most 4|P|−m+1 vertices.
theorem simple_graph_good_packing_multi_witness_support_kernel (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hgood : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) (x : Fin n) (m : ℕ) (hx : x ∉ P.biUnion id) (hm : m ≤ ((P.biUnion finite_vertex_set_edge_encoding).filter (fun e => ∀ v ∈ e, G.Adj x v)).card) : ∃ W : Finset (Fin n), W.card + m ≤ 4 * P.card + 1 ∧ P.biUnion id ⊆ W ∧ ∀ t : Finset (Fin n), G.IsNClique 3 t → ∃ s : Finset (Fin n), G.IsNClique 3 s ∧ s ⊆ W ∧ finite_vertex_set_edge_encoding s ∩ (P.biUnion finite_vertex_set_edge_encoding) = finite_vertex_set_edge_encoding t ∩ (P.biUnion finite_vertex_set_edge_encoding)
simple_graph_good_sunflower_components_supported_coverIn LeanGraph Theory & Graph Algorithms
If a good maximum packing can be partitioned into sunflower families whose vertex supports are pairwise disjoint, the graph has a triangle cover within the packed edges of size at most twice the packing size.
theorem simple_graph_good_sunflower_components_supported_cover (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (B : Finset (Finset (Finset (Fin n)))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hgood : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) (hpartition : B.biUnion id = P) (hparts : (B : Set (Finset (Finset (Fin n)))).Pairwise (fun A D => Disjoint (A.biUnion id) (D.biUnion id))) (hstar : ∀ A ∈ B, ∃ r, ∀ t ∈ A, r ∈ t) : ∃ C : Finset (Sym2 (Fin n)), C ⊆ P.biUnion finite_vertex_set_edge_encoding ∧ C.card ≤ 2 * P.card ∧ ∀ t : Finset (Fin n), G.IsNClique 3 t → ¬ Disjoint (finite_vertex_set_edge_encoding t) C
simple_graph_good_sunflower_forced_base_half_independence_packedIn LeanGraph Theory & Graph Algorithms
Conjectural sunflower bottleneck: in a good maximum sunflower packing, let F be the singly forced packed edges avoiding the root. After deleting F from the graph on their 2|F| endpoints, there is an independent set of size |F|.
theorem simple_graph_good_sunflower_forced_base_half_independence_packed (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hroot : ∀ t ∈ P, r ∈ t) (hgood : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) : ∃ Z : Finset (Fin n), Z ⊆ F.biUnion Sym2.toFinset ∧ F.card ≤ Z.card ∧ ∀ u ∈ Z, ∀ v ∈ Z, G.Adj u v → s(u,v) ∈ F
simple_graph_good_sunflower_forced_base_subpacking_kernel_packedIn LeanGraph Theory & Graph Algorithms
Given a good maximum sunflower packing, restrict it to its forced bases. There is a spanning subgraph whose maximum packing is exactly this subpacking, whose forced packed edges are exactly those bases, and whose graph on their endpoints is unchanged. It has at most three vertices per forced base plus the root incident to any retained edge.
theorem simple_graph_good_sunflower_forced_base_subpacking_kernel_packed (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P Q : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hroot : ∀ t ∈ P, r ∈ t) (hgood : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (hQ : Q = P.filter (fun p => ∃ e ∈ F, e ∈ finite_vertex_set_edge_encoding p)) : ∃ (H : SimpleGraph (Fin n)) (W : Finset (Fin n)), H ≤ G ∧ W.card ≤ 3 * Q.card + 1 ∧ Q.biUnion id ⊆ W ∧ (∀ u v, H.Adj u v → u ∈ W ∧ v ∈ W) ∧ (∀ u ∈ Q.biUnion id, ∀ v ∈ Q.biUnion id, H.Adj u v ↔ G.Adj u v) ∧ (∀ e ∈ P.biUnion finite_vertex_set_edge_encoding, e ∈ H.edgeSet ↔ e ∈ Q.biUnion finite_vertex_set_edge_encoding) ∧ Q.card = simple_graph_triangle_packing_number H ∧ (Q.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family H).filter (fun t => (t ∩ Q.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)) = F
simple_graph_good_sunflower_packing_supported_coverIn LeanGraph Theory & Graph Algorithms
A graph with a good maximum sunflower triangle packing has a triangle cover within the packed edges of size at most twice the packing size.
theorem simple_graph_good_sunflower_packing_supported_cover (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (r : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hroot : ∀ t ∈ P, r ∈ t) (hgood : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) : ∃ C : Finset (Sym2 (Fin n)), C ⊆ P.biUnion finite_vertex_set_edge_encoding ∧ C.card ≤ 2 * P.card ∧ ∀ t : Finset (Fin n), G.IsNClique 3 t → ¬ Disjoint (finite_vertex_set_edge_encoding t) C
simple_graph_good_sunflower_supported_cover_of_forced_base_independence_packedIn LeanGraph Theory & Graph Algorithms
For a good maximum sunflower packing, suppose the endpoints of its singly forced base edges contain at least as many vertices as there are forced bases, with every edge between those selected vertices itself a forced base. Then the graph has a triangle cover of at most twice the packing size contained in the packed edges.
theorem simple_graph_good_sunflower_supported_cover_of_forced_base_independence_packed (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (r : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hroot : ∀ t ∈ P, r ∈ t) (hgood : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) (F : Finset (Sym2 (Fin n))) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (Z : Finset (Fin n)) (hZsub : Z ⊆ F.biUnion Sym2.toFinset) (hZsize : F.card ≤ Z.card) (hZind : ∀ u ∈ Z, ∀ v ∈ Z, G.Adj u v → s(u,v) ∈ F) : ∃ C : Finset (Sym2 (Fin n)), C ⊆ P.biUnion finite_vertex_set_edge_encoding ∧ C.card ≤ 2 * P.card ∧ ∀ t : Finset (Fin n), G.IsNClique 3 t → ¬ Disjoint (finite_vertex_set_edge_encoding t) C
simple_graph_good_sunflower_three_forced_bases_supported_cover_packedIn LeanGraph Theory & Graph Algorithms
Suppose a maximum triangle packing is a sunflower and each packed triangle has at most one singly supported edge. If at most three singly supported packing edges avoid the common vertex, then the graph has a triangle edge cover of at most twice the packing size contained entirely in the packed edges.
theorem simple_graph_good_sunflower_three_forced_bases_supported_cover_packed (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (r : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hroot : ∀ t ∈ P, r ∈ t) (hgood : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) (hthree : ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset)).card ≤ 3) : ∃ C : Finset (Sym2 (Fin n)), C ⊆ P.biUnion finite_vertex_set_edge_encoding ∧ C.card ≤ 2 * P.card ∧ ∀ t : Finset (Fin n), G.IsNClique 3 t → ¬ Disjoint (finite_vertex_set_edge_encoding t) C
simple_graph_has_edge_disjoint_perfect_matchings_isoIn LeanGraph Theory & Graph Algorithms
Having k pairwise edge-disjoint perfect matchings is invariant under graph isomorphism.
theorem simple_graph_has_edge_disjoint_perfect_matchings_iso {V W : Type*} {G : SimpleGraph V} {G' : SimpleGraph W} (e : G ≃g G') (k : ℕ) : simple_graph_has_edge_disjoint_perfect_matchings G k ↔ simple_graph_has_edge_disjoint_perfect_matchings G' ksimple_graph_has_well_covered_powers_boxProd_commIn LeanGraph Theory & Graph Algorithms
The well-covered powers property of Cartesian products of finite graphs is symmetric under swapping factors.
theorem simple_graph_has_well_covered_powers_boxProd_comm
{V W : Type*} [Fintype V] [Fintype W]
(G : SimpleGraph V) (H : SimpleGraph W)
(hprod : simple_graph_has_well_covered_powers (G □ H)) :
simple_graph_has_well_covered_powers (H □ G)simple_graph_has_well_covered_powers_of_isoIn LeanGraph Theory & Graph Algorithms
Graph isomorphism preserves the well-covered powers property.
theorem simple_graph_has_well_covered_powers_of_iso {V W : Type*} [Fintype V] [Fintype W]
{G : SimpleGraph V} {H : SimpleGraph W} (e : G ≃g H) :
simple_graph_has_well_covered_powers G ↔ simple_graph_has_well_covered_powers Hsimple_graph_high_degree_connected_every_max_packing_fully_forced_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a four-connected graph with 52 vertices, 240 edges, packing number 56, a vertex of degree at least eleven and triangle codegrees between two and six, in which every edge is avoided by some maximum packing but every maximum packing contains a fully singleton-forced triangle.
theorem simple_graph_high_degree_connected_every_max_packing_fully_forced_counterexample :
∃ (G : SimpleGraph (Fin 52)) (E : Finset (Sym2 (Fin 52))),
let F := simple_graph_triangle_edge_family G
(↑E : Set (Sym2 (Fin 52))) = G.edgeSet ∧ E.card = 240 ∧
(∀ Q : Finset (Finset (Sym2 (Fin 52))), Q ⊆ F →
(Q : Set (Finset (Sym2 (Fin 52)))).Pairwise Disjoint → Q.card ≤ 56) ∧
(∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset (Sym2 (Fin 52))),
Q ⊆ F ∧ Q.card = 56 ∧
(Q : Set (Finset (Sym2 (Fin 52)))).Pairwise Disjoint ∧ e ∉ Q.biUnion id) ∧
(∀ e ∈ G.edgeSet, 2 ≤ (F.filter (fun t => e ∈ t)).card ∧
(F.filter (fun t => e ∈ t)).card ≤ 6) ∧
(∀ R : Finset (Fin 52), R.card ≤ 3 → (G.induce {v | v ∉ R}).Connected) ∧
(∃ v : Fin 52, ∃ N : Finset (Fin 52), N.card = 11 ∧ ∀ w ∈ N, G.Adj v w) ∧
∀ P : Finset (Finset (Sym2 (Fin 52))),
P ⊆ F → P.card = 56 →
(P : Set (Finset (Sym2 (Fin 52)))).Pairwise Disjoint →
∃ p ∈ P, p ⊆ ((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)simple_graph_high_degree_stable_connected_triangle_family_every_packing_fully_forced_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a 4-connected graph on 112 vertices with 432 edges, a vertex of degree at least 18, triangle codegrees from two to fifteen, connected triangle-intersection graph, and packing number 104, in which every edge is avoidable by some maximum packing yet every maximum packing contains a fully singleton-forced triangle.
theorem simple_graph_high_degree_stable_connected_triangle_family_every_packing_fully_forced_counterexample :
∃ (G : SimpleGraph (Fin 112)) (E : Finset (Sym2 (Fin 112))),
let F := simple_graph_triangle_edge_family G
(↑E : Set (Sym2 (Fin 112))) = G.edgeSet ∧ E.card = 432 ∧
(∀ Q : Finset (Finset (Sym2 (Fin 112))), Q ⊆ F →
(Q : Set (Finset (Sym2 (Fin 112)))).Pairwise Disjoint → Q.card ≤ 104) ∧
(∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset (Sym2 (Fin 112))),
Q ⊆ F ∧ Q.card = 104 ∧
(Q : Set (Finset (Sym2 (Fin 112)))).Pairwise Disjoint ∧ e ∉ Q.biUnion id) ∧
(∀ e ∈ G.edgeSet, 2 ≤ (F.filter (fun t => e ∈ t)).card ∧
(F.filter (fun t => e ∈ t)).card ≤ 15) ∧
(∀ R : Finset (Fin 112), R.card ≤ 3 → (G.induce {v | v ∉ R}).Connected) ∧
(∃ v : Fin 112, ∃ N : Finset (Fin 112), N.card = 18 ∧ ∀ w ∈ N, G.Adj v w) ∧
(∀ a ∈ F, ∀ b ∈ F, Relation.ReflTransGen
(fun x y : Finset (Sym2 (Fin 112)) => x ∈ F ∧ y ∈ F ∧ ¬ Disjoint x y) a b) ∧
∀ P : Finset (Finset (Sym2 (Fin 112))),
P ⊆ F → P.card = 104 →
(P : Set (Finset (Sym2 (Fin 112)))).Pairwise Disjoint →
∃ p ∈ P, p ⊆ ((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)simple_graph_high_degree_stable_connected_triangle_family_every_packing_fully_forced_familyIn LeanGraph Theory & Graph Algorithms
For each odd r at least seven, there is a 4-connected graph on 16r vertices with 48r+96 edges, maximum degree at least 18, triangle codegrees from two to fifteen and connected triangle-intersection graph, with triangle-cover number 16r+48 and packing number 10r+34, such that every edge is avoidable by a maximum packing but every maximum packing has at least 2r−2 fully singleton-forced triangles.
theorem simple_graph_high_degree_stable_connected_triangle_family_every_packing_fully_forced_family
(r : ℕ) (hr : 7 ≤ r) (hodd : Odd r) :
∃ (G : SimpleGraph (Fin (16 * r))) (E : Finset (Sym2 (Fin (16 * r)))),
let F := simple_graph_triangle_edge_family G
let k := 10 * r + 34
(↑E : Set (Sym2 (Fin (16 * r)))) = G.edgeSet ∧ E.card = 48 * r + 96 ∧
simple_graph_triangle_cover_number G = 16 * r + 48 ∧
(∀ Q : Finset (Finset (Sym2 (Fin (16 * r)))), Q ⊆ F →
(Q : Set (Finset (Sym2 (Fin (16 * r))))).Pairwise Disjoint → Q.card ≤ k) ∧
(∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset (Sym2 (Fin (16 * r)))),
Q ⊆ F ∧ Q.card = k ∧
(Q : Set (Finset (Sym2 (Fin (16 * r))))).Pairwise Disjoint ∧ e ∉ Q.biUnion id) ∧
(∀ e ∈ G.edgeSet, 2 ≤ (F.filter (fun t => e ∈ t)).card ∧
(F.filter (fun t => e ∈ t)).card ≤ 15) ∧
(∀ R : Finset (Fin (16 * r)), R.card ≤ 3 → (G.induce {v | v ∉ R}).Connected) ∧
(∃ v : Fin (16 * r), ∃ N : Finset (Fin (16 * r)), N.card = 18 ∧ ∀ w ∈ N, G.Adj v w) ∧
(∀ a ∈ F, ∀ b ∈ F, Relation.ReflTransGen
(fun x y : Finset (Sym2 (Fin (16 * r))) => x ∈ F ∧ y ∈ F ∧ ¬ Disjoint x y) a b) ∧
∀ P : Finset (Finset (Sym2 (Fin (16 * r)))),
P ⊆ F → P.card = k →
(P : Set (Finset (Sym2 (Fin (16 * r))))).Pairwise Disjoint →
2 * r - 2 ≤ (P.filter (fun p =>
p ⊆ ((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id))).cardsimple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a stable seven-connected twelve-vertex graph with a vertex of degree eleven, triangle codegree at least four and no one-point triangle-family split, with a maximum packing from which every packing reachable by single-triangle exchanges has a fully singleton-forced triangle, although another maximum packing has none.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample :
∃ (G : SimpleGraph (Fin 12)) (E : Finset (Sym2 (Fin 12)))
(P Q : Finset (Finset (Sym2 (Fin 12)))),
let F := simple_graph_triangle_edge_family G
let Adj := fun A B : Finset (Finset (Sym2 (Fin 12))) =>
B ⊆ F ∧ B.card = 16 ∧ (B : Set (Finset (Sym2 (Fin 12)))).Pairwise Disjoint ∧
(A ∩ B).card = 15
(↑E : Set (Sym2 (Fin 12))) = G.edgeSet ∧ E.card = 54 ∧
(∀ R : Finset (Fin 12), R.card ≤ 6 → (G.induce {v | v ∉ R}).Connected) ∧
(∃ v : Fin 12, ∃ N : Finset (Fin 12), N.card = 11 ∧ ∀ w ∈ N, G.Adj v w) ∧
(∀ e ∈ G.edgeSet, 4 ≤ (F.filter (fun t => e ∈ t)).card) ∧
(∀ e ∈ G.edgeSet, ∀ a ∈ F, ∀ b ∈ F,
Relation.ReflTransGen (fun x y : Finset (Sym2 (Fin 12)) =>
x ∈ F ∧ y ∈ F ∧ ∃ f ∈ x, f ∈ y ∧ f ≠ e) a b) ∧
(∀ R : Finset (Finset (Sym2 (Fin 12))), R ⊆ F →
(R : Set (Finset (Sym2 (Fin 12)))).Pairwise Disjoint → R.card ≤ 16) ∧
(∀ e ∈ G.edgeSet, ∃ R : Finset (Finset (Sym2 (Fin 12))),
R ⊆ F ∧ R.card = 16 ∧
(R : Set (Finset (Sym2 (Fin 12)))).Pairwise Disjoint ∧ e ∉ R.biUnion id) ∧
P ⊆ F ∧ P.card = 16 ∧ (P : Set (Finset (Sym2 (Fin 12)))).Pairwise Disjoint ∧
(∀ R, Relation.ReflTransGen Adj P R →
∃ r ∈ R, r ⊆ ((F.filter (fun t => (t ∩ R.biUnion id).card = 1)).biUnion id)) ∧
Q ⊆ F ∧ Q.card = 16 ∧ (Q : Set (Finset (Sym2 (Fin 12)))).Pairwise Disjoint ∧
∀ q ∈ Q, ¬ q ⊆ ((F.filter (fun t => (t ∩ Q.biUnion id).card = 1)).biUnion id)simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_adj_iff_testBitIn LeanGraph Theory & Graph Algorithms
For all vertices a, b, the witness graph has edge ab exactly when bit b is set in the neighbour bitmask of a.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_adj_iff_testBit :
∀ a b : Fin 12, simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.Adj a b ↔
(simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_nbr a).testBit b.valsimple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_codegreeIn LeanGraph Theory & Graph Algorithms
Each edge of the witness graph is contained in at least four triangles.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_codegree :
∀ e ∈ simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.edgeSet,
4 ≤ ((simple_graph_triangle_edge_family
simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph).filter
(fun t => e ∈ t)).cardsimple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_edge_avoidableIn LeanGraph Theory & Graph Algorithms
For every edge of the witness graph there is a sixteen-triangle packing none of whose triangles uses that edge.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_edge_avoidable :
∀ e ∈ simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.edgeSet,
∃ R : Finset (Finset (Sym2 (Fin 12))),
R ⊆ simple_graph_triangle_edge_family simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph ∧
R.card = 16 ∧
(R : Set (Finset (Sym2 (Fin 12)))).Pairwise Disjoint ∧ e ∉ R.biUnion idsimple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_edge_setIn LeanGraph Theory & Graph Algorithms
The listed edge set is the edge set of the witness graph, it has 54 elements, and vertex 10 is adjacent to the other eleven vertices.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_edge_set :
(↑simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_edges : Set (Sym2 (Fin 12))) =
simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.edgeSet ∧
simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_edges.card = 54 ∧
(∃ v : Fin 12, ∃ N : Finset (Fin 12), N.card = 11 ∧
∀ w ∈ N, simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.Adj v w)simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_family_connected_per_edgeIn LeanGraph Theory & Graph Algorithms
For every edge e, any two triangles of the witness graph are joined by a chain of triangles in which consecutive triangles share an edge other than e.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_family_connected_per_edge :
let F := simple_graph_triangle_edge_family simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph
∀ e ∈ simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.edgeSet,
∀ a ∈ F, ∀ b ∈ F,
Relation.ReflTransGen (fun x y : Finset (Sym2 (Fin 12)) =>
x ∈ F ∧ y ∈ F ∧ ∃ f ∈ x, f ∈ y ∧ f ≠ e) a bsimple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_mem_triIn LeanGraph Theory & Graph Algorithms
Each member t of the triangle edge family of the witness graph is of the form tri a b c where a, b, c are pairwise adjacent vertices.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_mem_tri :
∀ t ∈ simple_graph_triangle_edge_family simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph,
∃ a b c : Fin 12,
t = simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_tri a b c ∧
simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.Adj a b ∧
simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.Adj b c ∧
simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.Adj a csimple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_packing_P_forcingIn LeanGraph Theory & Graph Algorithms
P is a sixteen-triangle packing of the witness graph and, in every maximum packing reachable from P by repeatedly swapping one triangle, some triangle has all three edges lying in no other triangle of the packing.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_packing_P_forcing :
let F := simple_graph_triangle_edge_family simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph
let P := simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_packing_P
P ⊆ F ∧ P.card = 16 ∧ (P : Set (Finset (Sym2 (Fin 12)))).Pairwise Disjoint ∧
(∀ R, Relation.ReflTransGen
(fun A B : Finset (Finset (Sym2 (Fin 12))) =>
B ⊆ F ∧ B.card = 16 ∧ (B : Set (Finset (Sym2 (Fin 12)))).Pairwise Disjoint ∧ (A ∩ B).card = 15)
P R →
∃ r ∈ R, r ⊆ ((F.filter (fun t => (t ∩ R.biUnion id).card = 1)).biUnion id))simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_packing_Q_forcingIn LeanGraph Theory & Graph Algorithms
Q is a sixteen-triangle packing of the witness graph, and no triangle of Q has all three of its edges forced (each edge in exactly one triangle of Q).
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_packing_Q_forcing :
let F := simple_graph_triangle_edge_family simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph
let Q := simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_packing_Q
Q ⊆ F ∧ Q.card = 16 ∧ (Q : Set (Finset (Sym2 (Fin 12)))).Pairwise Disjoint ∧
∀ q ∈ Q, ¬ q ⊆ ((F.filter (fun t => (t ∩ Q.biUnion id).card = 1)).biUnion id)simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_packing_upperIn LeanGraph Theory & Graph Algorithms
Any family of pairwise edge-disjoint triangles of the witness graph has at most 16 members.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_packing_upper :
∀ R : Finset (Finset (Sym2 (Fin 12))),
R ⊆ simple_graph_triangle_edge_family simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph →
(R : Set (Finset (Sym2 (Fin 12)))).Pairwise Disjoint → R.card ≤ 16simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_seven_connectedIn LeanGraph Theory & Graph Algorithms
For every set R of at most six vertices, the subgraph induced by the complement of R is connected.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_seven_connected :
∀ R : Finset (Fin 12), R.card ≤ 6 →
(simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.induce
{v | v ∉ R}).Connectedsimple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_tri_memIn LeanGraph Theory & Graph Algorithms
If a, b, c are pairwise adjacent in the witness graph, then the three-edge set of abc belongs to the triangle edge family.
theorem simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_tri_mem : ∀ a b c : Fin 12,
simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.Adj a b →
simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.Adj a c →
simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graph.Adj b c →
simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_tri a b c ∈
simple_graph_triangle_edge_family simple_graph_high_degree_stable_point_irreducible_forced_exchange_barrier_counterexample_graphsimple_graph_hop_commute_of_two_regular_oddIn LeanGraph Theory & Graph Algorithms
If G is 2-regular with all connected components of odd size, then any two hops of G commute.
theorem simple_graph_hop_commute_of_two_regular_odd {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hd : ∀ v, G.degree v = 2) (hc : ∀ v, Odd (G.connectedComponentMk v).supp.ncard)
(g h : Equiv.Perm V) (hg : simple_graph_is_hop G g) (hh : simple_graph_is_hop G h) :
g * h = h * gsimple_graph_hop_orderOf_odd_of_leap_group_card_oddIn LeanGraph Theory & Graph Algorithms
If the leap group of G has odd order, then every hop of G has odd order.
theorem simple_graph_hop_orderOf_odd_of_leap_group_card_odd {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (h : Equiv.Perm V) (hh : simple_graph_is_hop G h)
(hc : Odd (Nat.card (simple_graph_leap_group G))) : Odd (orderOf h)simple_graph_hop_orderOf_odd_of_two_regular_oddIn LeanGraph Theory & Graph Algorithms
If G is 2-regular with all connected components of odd size, then every hop of G has odd order.
theorem simple_graph_hop_orderOf_odd_of_two_regular_odd {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hd : ∀ v, G.degree v = 2) (hc : ∀ v, Odd (G.connectedComponentMk v).supp.ncard)
(h : Equiv.Perm V) (hh : simple_graph_is_hop G h) : Odd (orderOf h)simple_graph_hypercube_adj_weight_parityIn LeanGraph Theory & Graph Algorithms
Adjacent vertices of the hypercube Q_n have Hamming weights of opposite parity.
theorem simple_graph_hypercube_adj_weight_parity (n : ℕ) {x y : Fin n → Bool}
(h : (simple_graph_hypercube n).Adj x y) :
hammingDist x (fun _ => false) % 2 ≠ hammingDist y (fun _ => false) % 2simple_graph_hypercube_coordinate_flip_memIn LeanGraph Theory & Graph Algorithms
Inverting a single coordinate of Q_n is a hop: every vertex moves to its unique neighbour differing in that coordinate. Hence the coordinate flip lies in the leap group.
theorem simple_graph_hypercube_coordinate_flip_mem (n : ℕ) (i : Fin n) :
simple_graph_hypercube_coordinate_flip n i ∈
simple_graph_leap_group (simple_graph_hypercube n)simple_graph_hypercube_leap_group_card_geIn LeanGraph Theory & Graph Algorithms
The leap group of Q_n has at least 2·((2^(n-1))!)² elements.
theorem simple_graph_hypercube_leap_group_card_ge (n : ℕ) (h1 : 1 ≤ n) :
2 * ((2 ^ (n - 1)).factorial) ^ 2 ≤ Nat.card (simple_graph_leap_group (simple_graph_hypercube n))simple_graph_hypercube_leap_group_card_leIn LeanGraph Theory & Graph Algorithms
The leap group of Q_n has at most 2·((2^(n-1))!)² elements.
theorem simple_graph_hypercube_leap_group_card_le (n : ℕ) (h1 : 1 ≤ n) :
Nat.card (simple_graph_leap_group (simple_graph_hypercube n)) ≤ 2 * ((2 ^ (n - 1)).factorial) ^ 2simple_graph_hypercube_leap_group_contains_swapsIn LeanGraph Theory & Graph Algorithms
Any transposition of two vertices of the hypercube Q_n whose Hamming weights have the same parity belongs to the leap group of Q_n.
theorem simple_graph_hypercube_leap_group_contains_swaps (n : ℕ) (h1 : 1 ≤ n)
(x y : Fin n → Bool) (hxy : x ≠ y)
(hpar : hammingDist x (fun _ => false) % 2 = hammingDist y (fun _ => false) % 2) :
Equiv.swap x y ∈ simple_graph_leap_group (simple_graph_hypercube n)simple_graph_hypercube_weight_class_cardIn LeanGraph Theory & Graph Algorithms
For n ≥ 1, the vertices of Q_n whose Hamming weight is congruent to b mod 2 number 2^(n-1): exactly one of each complementary pair x, x-with-coordinate-0-flipped has weight of each parity.
theorem simple_graph_hypercube_weight_class_card (n : ℕ) (hn : 1 ≤ n) (b : ℕ) :
(Finset.univ.filter
(fun x : Fin n → Bool => hammingDist x (fun _ => false) % 2 = b % 2)).card = 2 ^ (n - 1)simple_graph_indepNum_induce_leIn LeanGraph Theory & Graph Algorithms
The independence number of an induced subgraph is at most the independence number of the whole graph.
theorem simple_graph_indepNum_induce_le {V : Type*} [Fintype V] (G : SimpleGraph V) (s : Set V) : (G.induce s).indepNum ≤ G.indepNumsimple_graph_indepNum_le_vertex_connectivity_induce_compl_universalIn LeanGraph Theory & Graph Algorithms
If u is a universal vertex of G and alpha(G) + 1 <= kappa(G), then the graph obtained by deleting u has independence number at most its vertex connectivity, and is preconnected.
theorem simple_graph_indepNum_le_vertex_connectivity_induce_compl_universal {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (u : V) (hu : ∀ w : V, w ≠ u → G.Adj u w) (hκ : 2 ≤ ghz_graph_vertex_connectivity G) (hα : (G.indepNum : ℕ∞) + 1 ≤ (ghz_graph_vertex_connectivity G : ℕ∞)) : (G.induce {v : V | v ≠ u}).indepNum ≤ ghz_graph_vertex_connectivity (G.induce {v : V | v ≠ u}) ∧ (G.induce {v : V | v ≠ u}).Preconnectedsimple_graph_indep_free_four_non_neighbor_induce_indep_free_threeIn LeanGraph Theory & Graph Algorithms
In a simple graph with no independent set of size four, the induced subgraph on the non-neighborhood of any vertex has no independent set of size three.
theorem simple_graph_indep_free_four_non_neighbor_induce_indep_free_three
(V : Type) [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hindep : G.IndepSetFree 4) (v : V) :
(G.induce {u | u ≠ v ∧ ¬ G.Adj v u}).IndepSetFree 3simple_graph_indep_set_iff_induce_eq_botIn LeanGraph Theory & Graph Algorithms
A finset L of vertices is independent iff the subgraph induced on L is the empty graph.
open SimpleGraph in
theorem simple_graph_indep_set_iff_induce_eq_bot {V : Type*} [DecidableEq V]
(G : SimpleGraph V) (L : Finset V) :
G.IsIndepSet (L : Set V) ↔ G.induce (L : Set V) = ⊥simple_graph_irreducible_stable_high_degree_every_max_packing_forced_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a four-connected graph on 120 vertices with 456 edges and a vertex of degree at least 18, triangle codegrees between two and fifteen, and triangle packing number 109, such that every graph edge is avoidable by a maximum packing, the triangle family remains connected through shared edges after ignoring any one graph edge, and every maximum packing contains a triangle all of whose edges are singleton-forced.
theorem simple_graph_irreducible_stable_high_degree_every_max_packing_forced_counterexample :
∃ (G : SimpleGraph (Fin 120)) (E : Finset (Sym2 (Fin 120))),
let F := simple_graph_triangle_edge_family G
(↑E : Set (Sym2 (Fin 120))) = G.edgeSet ∧ E.card = 456 ∧
(∀ Q : Finset (Finset (Sym2 (Fin 120))), Q ⊆ F →
(Q : Set (Finset (Sym2 (Fin 120)))).Pairwise Disjoint → Q.card ≤ 109) ∧
(∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset (Sym2 (Fin 120))),
Q ⊆ F ∧ Q.card = 109 ∧
(Q : Set (Finset (Sym2 (Fin 120)))).Pairwise Disjoint ∧ e ∉ Q.biUnion id) ∧
(∀ e ∈ G.edgeSet, 2 ≤ (F.filter (fun t => e ∈ t)).card ∧
(F.filter (fun t => e ∈ t)).card ≤ 15) ∧
(∀ R : Finset (Fin 120), R.card ≤ 3 → (G.induce {v | v ∉ R}).Connected) ∧
(∃ v : Fin 120, ∃ N : Finset (Fin 120), N.card = 18 ∧ ∀ w ∈ N, G.Adj v w) ∧
(∀ e ∈ G.edgeSet, ∀ a ∈ F, ∀ b ∈ F, Relation.ReflTransGen
(fun x y : Finset (Sym2 (Fin 120)) => x ∈ F ∧ y ∈ F ∧
¬ Disjoint (x.erase e) (y.erase e)) a b) ∧
∀ P : Finset (Finset (Sym2 (Fin 120))),
P ⊆ F → P.card = 109 →
(P : Set (Finset (Sym2 (Fin 120)))).Pairwise Disjoint →
∃ p ∈ P, p ⊆ ((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)simple_graph_isAcyclic_card_edgeFinset_add_card_connectedComponentIn LeanGraph Theory & Graph Algorithms
In any finite acyclic simple graph (forest), the number of edges plus the number of connected components equals the number of vertices.
open scoped Classical in
theorem simple_graph_isAcyclic_card_edgeFinset_add_card_connectedComponent
{V : Type*} [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] (hG : G.IsAcyclic) :
G.edgeFinset.card + Fintype.card G.ConnectedComponent = Fintype.card Vsimple_graph_isHamiltonian_of_chain_listIn LeanGraph Theory & Graph Algorithms
If a repetition-free list of vertices has length equal to the number of vertices and its consecutive vertices are adjacent cyclically (i.e. also the last and the first, encoded as (l ++ l.take 1).IsChain G.Adj), then the graph is Hamiltonian.
theorem simple_graph_isHamiltonian_of_chain_list {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (l : List V) (hne : l ≠ [])
(hnodup : l.Nodup) (hlen : l.length = Fintype.card V) (hcard : 3 ≤ Fintype.card V)
(hchain : (l ++ l.take 1).IsChain G.Adj) : G.IsHamiltoniansimple_graph_isHamiltonian_of_cycle_fnIn LeanGraph Theory & Graph Algorithms
If G is a simple graph on a finite vertex type V with at least 3 vertices, and f : Fin n -> V is an injection of length |V| such that consecutive elements (cyclically) are adjacent in G, then G is Hamiltonian.
theorem simple_graph_isHamiltonian_of_cycle_fn {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (n : ℕ) [NeZero n] (hn : n = Fintype.card V) (hn3 : 3 ≤ n)
(f : Fin n → V) (hinj : Function.Injective f)
(hadj : ∀ i : Fin n, G.Adj (f i) (f (i + 1))) :
G.IsHamiltoniansimple_graph_is_cone_of_subsingletonIn LeanGraph Theory & Graph Algorithms
Every simple graph on a nonempty subsingleton vertex type is a cone.
theorem simple_graph_is_cone_of_subsingleton (V : Type*) [Subsingleton V] [Nonempty V] (G : SimpleGraph V) :
simple_graph_is_cone Gsimple_graph_is_cone_open_neighborhood_iff_dominatedIn LeanGraph Theory & Graph Algorithms
In a simple graph $H$, for any vertex $u$, the open neighbourhood subgraph $H[N_H(u)]$ is a cone if and only if $u$ is dominated by another vertex in $H$.
theorem simple_graph_is_cone_open_neighborhood_iff_dominated {V : Type*} (H : SimpleGraph V) (u : V) :
simple_graph_is_cone (H.induce (H.neighborSet u)) ↔ simple_graph_vertex_dominated H usimple_graph_is_cone_open_neighborhood_of_dominatedIn LeanGraph Theory & Graph Algorithms
If a vertex $v$ of a simple graph $H$ is dominated by another vertex, then the open neighbourhood graph $H[N_H(v)]$ is a cone.
theorem simple_graph_is_cone_open_neighborhood_of_dominated {V : Type*} (H : SimpleGraph V) (v : V)
(hdom : simple_graph_vertex_dominated H v) :
simple_graph_is_cone (H.induce (H.neighborSet v))simple_graph_is_minimal_k_star_forming_iff_eraseIn LeanGraph Theory & Graph Algorithms
A k-star-forming set S is minimal if and only if S is k-star-forming and, for every u in S, S with u deleted is not k-star-forming.
theorem simple_graph_is_minimal_k_star_forming_iff_erase {V : Type*} [DecidableEq V]
(G : SimpleGraph V) (k : ℕ) (S : Finset V) :
simple_graph_is_minimal_k_star_forming G k S ↔
simple_graph_is_k_star_forming G k S ∧
∀ u ∈ S, ¬ simple_graph_is_k_star_forming G k (S.erase u)simple_graph_is_tree_all_stackable_of_almost_stackedIn LeanGraph Theory & Graph Algorithms
If every almost stacked configuration of size t on a finite tree T is stackable, then every configuration of size t on T is stackable.
theorem simple_graph_is_tree_all_stackable_of_almost_stacked {V : Type*} [Fintype V]
[DecidableEq V] (T : SimpleGraph V) (hT : T.IsTree) (t : ℕ)
(h_almost : ∀ c : V → ℕ, (∃ r : V, ∀ v : V, v ≠ r → c v ≤ 1) → ∑ v, c v = t → graph_config_stackable T c) :
∀ c : V → ℕ, ∑ v, c v = t → graph_config_stackable T csimple_graph_is_tree_all_stackable_of_tree_estimateIn LeanGraph Theory & Graph Algorithms
Every configuration of size estim(T) on a finite tree T is stackable.
theorem simple_graph_is_tree_all_stackable_of_tree_estimate {V : Type*} [Fintype V]
[DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) :
∀ c : V → ℕ, ∑ v, c v = simple_graph_tree_estimate T → graph_config_stackable T csimple_graph_is_tree_almost_stacked_stackable_of_tree_estimateIn LeanGraph Theory & Graph Algorithms
Every almost stacked configuration of size estim(T) on a finite tree T is stackable.
theorem simple_graph_is_tree_almost_stacked_stackable_of_tree_estimate {V : Type*} [Fintype V]
[DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) :
∀ c : V → ℕ, (∃ r : V, ∀ v : V, v ≠ r → c v ≤ 1) →
∑ v, c v = simple_graph_tree_estimate T → graph_config_stackable T csimple_graph_is_tree_bad_config_of_card_lt_of_lt_tree_estimateIn LeanGraph Theory & Graph Algorithms
For every finite tree T and every size t with 2 ≤ t, Fintype.card V < t and t < estim(T), there is a configuration of exactly t pebbles that cannot be gathered onto any single vertex. This is the hard remainder (t > |V|) of the lower bound stack(T) ≥ estim(T).
theorem simple_graph_is_tree_bad_config_of_card_lt_of_lt_tree_estimate {V : Type*} [Fintype V]
[DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) :
∀ t : ℕ, 2 ≤ t → Fintype.card V < t → t < simple_graph_tree_estimate T →
∃ c : V → ℕ, (∑ v, c v) = t ∧ ¬ graph_config_stackable T csimple_graph_is_tree_stacking_number_le_tree_estimateIn LeanGraph Theory & Graph Algorithms
For every finite tree T, stack(T) ≤ estim(T).
theorem simple_graph_is_tree_stacking_number_le_tree_estimate {V : Type*} [Fintype V]
[DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) :
graph_stacking_number T ≤ simple_graph_tree_estimate Tsimple_graph_is_well_covered_of_card_le_and_extensionIn LeanGraph Theory & Graph Algorithms
If every independent set of a finite graph H has at most k vertices, and every independent set with fewer than k vertices can be enlarged by one vertex, then H is well-covered (every maximal independent set has exactly k vertices).
theorem simple_graph_is_well_covered_of_card_le_and_extension {V : Type*} [Fintype V] [DecidableEq V]
(H : SimpleGraph V) (k : ℕ)
(hle : ∀ s : Finset V, H.IsIndepSet ↑s → s.card ≤ k)
(hext : ∀ s : Finset V, H.IsIndepSet ↑s → s.card < k →
∃ v : V, v ∉ s ∧ H.IsIndepSet ↑(insert v s)) :
simple_graph_is_well_covered Hsimple_graph_is_well_covered_topIn LeanGraph Theory & Graph Algorithms
The complete graph on a nonempty finite vertex set is well-covered: every maximal independent set has size 1.
theorem simple_graph_is_well_covered_top {V : Type*} [Fintype V] [Nonempty V] : simple_graph_is_well_covered (⊤ : SimpleGraph V)simple_graph_k16_forbidden_edge_packing_templatesIn LeanGraph Theory & Graph Algorithms
There are thirty-seven edge-disjoint triangles in each of three complete sixteen-vertex graph edge-deletion cases: seven disjoint forbidden edges, six such edges plus a matched-to-unmatched edge, and six plus an edge between unmatched vertices.
open scoped Sym2
theorem simple_graph_k16_forbidden_edge_packing_templates :
(∃ P : Finset (Finset (Sym2 (Fin 16))),
P ⊆ simple_graph_triangle_edge_family (⊤ : SimpleGraph (Fin 16)) ∧ P.card = 37 ∧
(P : Set (Finset (Sym2 (Fin 16)))).Pairwise Disjoint ∧
Disjoint (P.biUnion id) {s(0, 1), s(2, 3), s(4, 5), s(6, 7), s(8, 9), s(10, 11), s(12, 13)}) ∧
(∃ P : Finset (Finset (Sym2 (Fin 16))),
P ⊆ simple_graph_triangle_edge_family (⊤ : SimpleGraph (Fin 16)) ∧ P.card = 37 ∧
(P : Set (Finset (Sym2 (Fin 16)))).Pairwise Disjoint ∧
Disjoint (P.biUnion id) {s(0, 1), s(2, 3), s(4, 5), s(6, 7), s(8, 9), s(10, 11), s(0, 12)}) ∧
(∃ P : Finset (Finset (Sym2 (Fin 16))),
P ⊆ simple_graph_triangle_edge_family (⊤ : SimpleGraph (Fin 16)) ∧ P.card = 37 ∧
(P : Set (Finset (Sym2 (Fin 16)))).Pairwise Disjoint ∧
Disjoint (P.biUnion id) {s(0, 1), s(2, 3), s(4, 5), s(6, 7), s(8, 9), s(10, 11), s(12, 13)})simple_graph_k16_forbidden_matching_packing_upperIn LeanGraph Theory & Graph Algorithms
A packing of triangles in the complete sixteen-vertex graph that avoids a prescribed perfect matching has at most thirty-six triangles.
open scoped Sym2
theorem simple_graph_k16_forbidden_matching_packing_upper
(P : Finset (Finset (Sym2 (Fin 16))))
(hP : P ⊆ simple_graph_triangle_edge_family (⊤ : SimpleGraph (Fin 16)))
(hdisj : (P : Set (Finset (Sym2 (Fin 16)))).Pairwise Disjoint)
(havoid : Disjoint (P.biUnion id) {s(0, 1), s(2, 3), s(4, 5), s(6, 7), s(8, 9), s(10, 11), s(12, 13), s(14, 15)}) : P.card ≤ 36simple_graph_k4_disjoint_eraseIn LeanGraph Theory & Graph Algorithms
For an edge-disjoint triangle packing P containing a 3-element triangle p and a vertex x whose spokes to p are unused in P, the edges spanned by insert x p are disjoint from the edges spanned by P \ {p}.
theorem simple_graph_k4_disjoint_erase {V : Type*} [Fintype V] [DecidableEq V] (P : Finset (Finset V)) (p : Finset V) (hp : p ∈ P) (hp_card : p.card = 3) (x : V) (hdisj : (P : Set (Finset V)).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hfree : ∀ v ∈ p, s(x, v) ∉ P.biUnion finite_vertex_set_edge_encoding) : Disjoint (finite_vertex_set_edge_encoding (insert x p)) ((P.erase p).biUnion finite_vertex_set_edge_encoding)simple_graph_lapMatrix_trace_eq_two_mul_edge_cardIn LeanGraph Theory & Graph Algorithms
The trace of the Laplacian matrix of a finite simple graph equals twice its number of edges.
theorem simple_graph_lapMatrix_trace_eq_two_mul_edge_card {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
(G.lapMatrix ℝ).trace = 2 * (G.edgeFinset.card : ℝ)simple_graph_laplacian_matrix_eq_lapMatrixIn LeanGraph Theory & Graph Algorithms
The Laplacian matrix used in this knowledge base is Mathlib's SimpleGraph.lapMatrix ℝ: both are the degree diagonal matrix minus the adjacency matrix.
theorem simple_graph_laplacian_matrix_eq_lapMatrix {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
simple_graph_laplacian_matrix G = G.lapMatrix ℝsimple_graph_laplacian_second_eigenvalue_le_edge_cardIn LeanGraph Theory & Graph Algorithms
For every finite simple graph G with m edges, the second largest Laplacian eigenvalue mu_2 satisfies mu_2 <= m.
theorem simple_graph_laplacian_second_eigenvalue_le_edge_card {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
simple_graph_laplacian_second_eigenvalue G ≤ (G.edgeFinset.card : ℝ)simple_graph_le_csym_max_nullity_of_is_csymIn LeanGraph Theory & Graph Algorithms
For any combinatorially symmetric matrix A associated with G, the dimension of the kernel of A is at most the combinatorially symmetric maximum nullity N(G).
theorem simple_graph_le_csym_max_nullity_of_is_csym
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(A : Matrix V V ℝ) (hA : is_csym_matrix G A) :
Module.finrank ℝ A.mulVecLin.ker ≤ simple_graph_csym_max_nullity Gsimple_graph_le_fort_transversal_number_of_compatibleIn LeanGraph Theory & Graph Algorithms
For any finite simple graph G and any compatible collection C of forts of G, the transversal number tau(C) is at most the fort transversal number T(G).
theorem simple_graph_le_fort_transversal_number_of_compatible
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(C : Finset (Finset V))
(hfort : ∀ F ∈ C, simple_graph_is_fort G (F : Set V))
(hcompat : is_compatible_collection C) :
finset_transversal_number C ≤ simple_graph_fort_transversal_number Gsimple_graph_leap_group_card_ge_of_swaps_and_flip_nonemptyIn LeanGraph Theory & Graph Algorithms
Let (A,B) partition the vertex set of a finite graph G with A nonempty. If every transposition inside A and every transposition inside B is a leap, and some leap τ interchanges A with B, then the leap group of G has at least 2·|A|!·|B|! elements.
theorem simple_graph_leap_group_card_ge_of_swaps_and_flip_nonempty {V : Type*} [Fintype V] [DecidableEq V]
{G : SimpleGraph V} {A B : Finset V}
(hdisj : Disjoint A B) (huniv : A ∪ B = Finset.univ) (hAne : A.Nonempty)
(hA : ∀ u ∈ A, ∀ v ∈ A, u ≠ v → Equiv.swap u v ∈ simple_graph_leap_group G)
(hB : ∀ u ∈ B, ∀ v ∈ B, u ≠ v → Equiv.swap u v ∈ simple_graph_leap_group G)
(hflip : ∃ τ ∈ simple_graph_leap_group G, ∀ v : V, (v ∈ A ↔ τ v ∈ B)) :
2 * A.card.factorial * B.card.factorial ≤ Nat.card (simple_graph_leap_group G)simple_graph_leap_group_card_le_of_bipartitionIn LeanGraph Theory & Graph Algorithms
If every edge of a finite simple graph G joins the complementary finsets s and t, then the leap group of G has at most 2·|s|!·|t|! elements.
theorem simple_graph_leap_group_card_le_of_bipartition {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (s t : Finset V) (hdisj : Disjoint s t) (huniv : s ∪ t = Finset.univ)
(hadj : ∀ u v : V, G.Adj u v → (u ∈ s ∧ v ∈ t) ∨ (u ∈ t ∧ v ∈ s)) :
Nat.card (simple_graph_leap_group G) ≤ 2 * s.card.factorial * t.card.factorialsimple_graph_leap_group_card_odd_iffIn LeanGraph Theory & Graph Algorithms
Let G be a finite simple graph that admits a hop. Then the leap group Λ₁(G) has odd order if and only if G is a disjoint union of cycles of odd length, i.e. G is 2-regular and every connected component has an odd number of vertices.
theorem simple_graph_leap_group_card_odd_iff {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hG : ∃ h, simple_graph_is_hop G h) :
Odd (Nat.card (simple_graph_leap_group G)) ↔
(∀ v, G.degree v = 2) ∧ ∀ v, Odd (G.connectedComponentMk v).supp.ncardsimple_graph_leap_group_card_odd_of_commuting_odd_hopsIn LeanGraph Theory & Graph Algorithms
If every hop of G has odd order and any two hops commute, then the leap group of G has odd order.
theorem simple_graph_leap_group_card_odd_of_commuting_odd_hops {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hodd : ∀ h, simple_graph_is_hop G h → Odd (orderOf h))
(hcomm : ∀ g h, simple_graph_is_hop G g → simple_graph_is_hop G h → g * h = h * g) :
Odd (Nat.card (simple_graph_leap_group G))simple_graph_leap_group_card_odd_of_two_regular_oddIn LeanGraph Theory & Graph Algorithms
If G is 2-regular with all connected components of odd size, then the leap group of G has odd order.
theorem simple_graph_leap_group_card_odd_of_two_regular_odd {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hd : ∀ v, G.degree v = 2) (hc : ∀ v, Odd (G.connectedComponentMk v).supp.ncard) :
Odd (Nat.card (simple_graph_leap_group G))simple_graph_leap_group_closure_swaps_of_partitionIn LeanGraph Theory & Graph Algorithms
Let (A, B) be a partition of a finite set V. The subgroup generated by the transpositions inside A together with the transpositions inside B is the full symmetric group on A times the full symmetric group on B, i.e. it consists of every permutation of V that maps A onto A.
theorem simple_graph_leap_group_closure_swaps_of_partition {V : Type*} [Fintype V] [DecidableEq V]
{A B : Finset V} (huniv : A ∪ B = Finset.univ) {σ : Equiv.Perm V}
(hσ : ∀ v : V, (v ∈ A ↔ σ v ∈ A)) :
σ ∈ Subgroup.closure ({τ : Equiv.Perm V | ∃ u ∈ A, ∃ v ∈ A, u ≠ v ∧ τ = Equiv.swap u v} ∪
{τ : Equiv.Perm V | ∃ u ∈ B, ∃ v ∈ B, u ≠ v ∧ τ = Equiv.swap u v})simple_graph_lex_cover_two_outside_private_triangles_disjointIn LeanGraph Theory & Graph Algorithms
Let H be a triangle edge cover, and let C be a minimum triangle edge cover minimizing its number of edges outside H. Any two distinct edges of C outside H have private triangles that are edge-disjoint from each other.
theorem simple_graph_lex_cover_two_outside_private_triangles_disjoint
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(H C : Finset (Sym2 V))
(hHedges : ∀ e ∈ H, e ∈ G.edgeSet) (hCedges : ∀ e ∈ C, e ∈ G.edgeSet)
(hH : ∀ t : Finset V, G.IsNClique 3 t → ∃ e ∈ H, ∀ x ∈ e, x ∈ t)
(hC : ∀ t : Finset V, G.IsNClique 3 t → ∃ e ∈ C, ∀ x ∈ e, x ∈ t)
(hlex : ∀ D : Finset (Sym2 V),
(∀ e ∈ D, e ∈ G.edgeSet) →
(∀ t : Finset V, G.IsNClique 3 t → ∃ e ∈ D, ∀ x ∈ e, x ∈ t) →
C.card ≤ D.card ∧ (D.card = C.card → (C \ H).card ≤ (D \ H).card)) :
∀ e ∈ C \ H, ∀ f ∈ C \ H, e ≠ f →
∃ t s : Finset V, G.IsNClique 3 t ∧ G.IsNClique 3 s ∧
(∀ x ∈ e, x ∈ t) ∧ (∀ x ∈ f, x ∈ s) ∧
(∀ g ∈ C, (∀ x ∈ g, x ∈ t) → g = e) ∧
(∀ g ∈ C, (∀ x ∈ g, x ∈ s) → g = f) ∧
(t ∩ s).card ≤ 1simple_graph_line_graph_degree_four_matching_link_decreasing_pairIn LeanGraph Theory & Graph Algorithms
Let H be a finite simple graph and v a degree-four vertex whose neighborhood induces a matching. In the line graph of H, there are two disjoint edges within the four-clique of root edges incident to v whose deletion strictly decreases the maximum triangle packing number.
theorem simple_graph_line_graph_degree_four_matching_link_decreasing_pair (n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj] (v : Fin n) (hdeg : H.degree v = 4) (hlink : ∀ a b c : Fin n, H.Adj v a → H.Adj v b → H.Adj v c → H.Adj a b → H.Adj a c → b = c) : ∃ e f : Sym2 H.edgeSet, e ∈ H.lineGraph.edgeSet ∧ f ∈ H.lineGraph.edgeSet ∧ (∀ x ∈ e, v ∈ x.val) ∧ (∀ x ∈ f, v ∈ x.val) ∧ (∀ x ∈ e, x ∉ f) ∧ simple_graph_triangle_packing_number (H.lineGraph.deleteEdges {e, f}) < simple_graph_triangle_packing_number H.lineGraphsimple_graph_line_graph_degree_four_weak_link_decreasing_pairIn LeanGraph Theory & Graph Algorithms
Let H be a finite simple graph and v a degree-four vertex with a neighbor having at most one neighbor inside the neighborhood of v. In the line graph of H, there are two disjoint edges within the four-clique of root edges incident to v whose deletion strictly decreases the maximum triangle packing number.
theorem simple_graph_line_graph_degree_four_weak_link_decreasing_pair (n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj] (v : Fin n) (hdeg : H.degree v = 4) (hweak : ∃ a : Fin n, H.Adj v a ∧ ∀ b c : Fin n, H.Adj v b → H.Adj v c → H.Adj a b → H.Adj a c → b = c) : ∃ e f : Sym2 H.edgeSet, e ∈ H.lineGraph.edgeSet ∧ f ∈ H.lineGraph.edgeSet ∧ (∀ x ∈ e, v ∈ x.val) ∧ (∀ x ∈ f, v ∈ x.val) ∧ (∀ x ∈ e, x ∉ f) ∧ simple_graph_triangle_packing_number (H.lineGraph.deleteEdges {e, f}) < simple_graph_triangle_packing_number H.lineGraphsimple_graph_link_min_degree_forces_disjointness_matchingIn LeanGraph Theory & Graph Algorithms
A finite graph with at least five edges and minimum nonzero degree greater than a positive integer r has at least max(2,r+1) disjoint pairs of vertex-disjoint edges, all edge-pair members distinct.
theorem simple_graph_link_min_degree_forces_disjointness_matching (n r : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hr : 1 ≤ r) (hE : 5 ≤ G.edgeFinset.card) (hdeg : ∀ v : Fin n, (G.neighborFinset v).card = 0 ∨ r < (G.neighborFinset v).card) : ∃ M : Finset (Finset (Sym2 (Fin n))), 2 ≤ M.card ∧ r + 1 ≤ M.card ∧ (∀ p ∈ M, p.card = 2 ∧ p ⊆ G.edgeFinset ∧ (∀ e ∈ p, ∀ f ∈ p, e ≠ f → Disjoint e.toFinset f.toFinset)) ∧ (M : Set (Finset (Sym2 (Fin n)))).Pairwise Disjoint
simple_graph_list_vertex_coloring_maxDegree_two_connectedIn LeanGraph Theory & Graph Algorithms
Let G be a connected finite simple graph with maximum degree at most 2, and let L assign to each vertex a list of at least 2 colours from Fin 5, at least one list having size at least 3. Then G has a proper vertex colouring c with c v in L v for every vertex v.
theorem simple_graph_list_vertex_coloring_maxDegree_two_connected {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hconn : G.Connected) (hdeg : G.maxDegree ≤ 2) (L : V → Finset (Fin 5))
(h2 : ∀ v, 2 ≤ (L v).card) (h3 : ∃ v, 3 ≤ (L v).card) :
∃ c : G.Coloring (Fin 5), ∀ v, c v ∈ L vsimple_graph_local_avg_dominating_order_eq_one_add_half_leaf_count_add_avg_erase_leaf_neighborsIn LeanGraph Theory & Graph Algorithms
If every neighbour of v is either a leaf or has a leaf neighbour, then avd_v(G) = 1 + l/2 + avd(G - L[v]), where l is the number of leaf neighbours of v and G - L[v] is the graph induced on the vertices different from v and from every leaf neighbour of v. This is identity (6) of the paper in the form avd_v(G) = (1 + l/2) + avd(G - L[v]) (line 532), the exact recurrence behind Theorem 5.2; it is an equality, with no bound on the core average. It generalises the banked one-leaf recursion to all l simultaneously and stops the 'grade' of the problem: everything left is a statement about the global average of the core graph.
theorem simple_graph_local_avg_dominating_order_eq_one_add_half_leaf_count_add_avg_erase_leaf_neighbors
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (v : V)
(hstem : ∀ y, G.Adj v y → G.degree y ≠ 1 → ∃ z, G.Adj y z ∧ G.degree z = 1) :
simple_graph_local_avg_dominating_order G v =
1 + (simple_graph_leaf_neighbor_count G v : ℚ) / 2 +
simple_graph_avg_dominating_order
(G.induce ((Finset.univ \ insert v ((G.neighborFinset v).filter
(fun u => G.degree u = 1)) : Finset V) : Set V))simple_graph_local_avg_dominating_order_equivIn LeanGraph Theory & Graph Algorithms
The local average dominating order is invariant under graph isomorphism.
theorem simple_graph_local_avg_dominating_order_equiv {V : Type*} {V' : Type*} [Fintype V] [DecidableEq V] [Fintype V'] [DecidableEq V'] (G : SimpleGraph V) [DecidableRel G.Adj] (G' : SimpleGraph V') [DecidableRel G'.Adj] (e : V ≃ V') (he : ∀ u v, G'.Adj (e u) (e v) ↔ G.Adj u v) (v : V) : simple_graph_local_avg_dominating_order G' (e v) = simple_graph_local_avg_dominating_order G vsimple_graph_local_avg_dominating_order_le_four_mul_sub_leaf_count_add_two_of_neighborsIn LeanGraph Theory & Graph Algorithms
If G has no isolated vertices and every neighbour of v is either a leaf or has a leaf neighbour, then avd_v(G) ≤ (4n - l + 2)/6, where l is the number of leaf neighbours of v; in particular avd_v(G) ≤ (4n+1)/6 whenever l ≥ 1. This is the 'all neighbours are leaves or stems' regime of the stem conjecture, and it is the exact place where the global average bound enters.
theorem simple_graph_local_avg_dominating_order_le_four_mul_sub_leaf_count_add_two_of_neighbors
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hiso : ∀ w, 0 < G.degree w) (v : V)
(hnbr : ∀ y, G.Adj v y → G.degree y = 1 ∨ ∃ z, G.Adj y z ∧ G.degree z = 1) :
simple_graph_local_avg_dominating_order G v ≤
(4 * (Fintype.card V : ℚ) - (simple_graph_leaf_neighbor_count G v : ℚ) + 2) / 6simple_graph_longest_cycles_card_eqIn LeanGraph Theory & Graph Algorithms
Any two longest cycles of a simple graph have the same number of vertices.
theorem simple_graph_longest_cycles_card_eq {V : Type*} {G : SimpleGraph V} (C D : G.Subgraph) (hC : simple_graph_is_longest_cycle C) (hD : simple_graph_is_longest_cycle D) : C.verts.ncard = D.verts.ncardsimple_graph_maxDegree_two_isCycles_of_not_acyclicIn LeanGraph Theory & Graph Algorithms
Let G be a finite connected simple graph with maximum degree at most 2 that is not acyclic (so it contains a cycle). Then every vertex with at least one neighbour has exactly 2 neighbours (i.e. G is a disjoint union of cycles; being connected, it is a single cycle).
theorem simple_graph_maxDegree_two_isCycles_of_not_acyclic {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hconn : G.Connected) (hdeg : G.maxDegree ≤ 2) (hacyc : ¬ G.IsAcyclic) :
G.IsCyclessimple_graph_maxDegree_two_rankingIn LeanGraph Theory & Graph Algorithms
Let G be a connected finite simple graph with maximum degree at most 2, and let b be any vertex. Then there is a ranking pos : V → ℕ of the vertices, injective across every edge (adjacent vertices get different ranks), such that every vertex v has at most one neighbour of strictly smaller rank, with the single exception of v = b, which has at most two.
theorem simple_graph_maxDegree_two_ranking {V : Type*}
[Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hconn : G.Connected) (hdeg : G.maxDegree ≤ 2)
(b : V) :
∃ pos : V → ℕ, (∀ v u, G.Adj v u → pos v ≠ pos u) ∧
∀ v, ((G.neighborFinset v).filter (fun u => pos u < pos v)).card ≤ (if v = b then 2 else 1)simple_graph_maxDegree_two_ranking_of_acyclicIn LeanGraph Theory & Graph Algorithms
Let G be a finite connected acyclic simple graph (a tree) with maximum degree at most 2, and let b be any vertex. Then there is a ranking pos : V → ℕ, injective across every edge, such that every vertex v has at most one neighbour of strictly smaller rank, except v = b which has at most two.
theorem simple_graph_maxDegree_two_ranking_of_acyclic {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hconn : G.Connected) (hdeg : G.maxDegree ≤ 2) (hacyc : G.IsAcyclic) (b : V) :
∃ pos : V → ℕ, (∀ v u, G.Adj v u → pos v ≠ pos u) ∧
∀ v, ((G.neighborFinset v).filter (fun u => pos u < pos v)).card ≤ (if v = b then 2 else 1)simple_graph_maxDegree_two_ranking_of_isCyclesIn LeanGraph Theory & Graph Algorithms
Let G be a finite connected simple graph in which every vertex with a neighbour has exactly 2 neighbours (so G is a single cycle), and let b be any vertex. Then there is a ranking pos : V → ℕ, injective across every edge, such that every vertex v has at most one neighbour of strictly smaller rank, except v = b which has at most two.
theorem simple_graph_maxDegree_two_ranking_of_isCycles {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hconn : G.Connected) (hcyc : G.IsCycles) (b : V) :
∃ pos : V → ℕ, (∀ v u, G.Adj v u → pos v ≠ pos u) ∧
∀ v, ((G.neighborFinset v).filter (fun u => pos u < pos v)).card ≤ (if v = b then 2 else 1)simple_graph_max_three_edge_colorable_deficient_degreeIn LeanGraph Theory & Graph Algorithms
For every natural number n and simple graph H on Fin n with decidable adjacency, let M be a triple of pairwise edge-disjoint matchings in H of maximum total size. Every vertex incident with fewer than three selected edges has at most that many H-neighbors that are also incident with fewer than three selected edges.
theorem simple_graph_max_three_edge_colorable_deficient_degree
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(M : Fin 3 → Finset (Sym2 (Fin n)))
(hmatch : ∀ i, M i ⊆ H.edgeFinset ∧
∀ e ∈ M i, ∀ f ∈ M i, e ≠ f → ∀ v ∈ e, v ∉ f)
(hdisj : ∀ i j : Fin 3, i ≠ j → Disjoint (M i) (M j))
(hmax : ∀ N : Fin 3 → Finset (Sym2 (Fin n)),
(∀ i, N i ⊆ H.edgeFinset ∧
∀ e ∈ N i, ∀ f ∈ N i, e ≠ f → ∀ v ∈ e, v ∉ f) →
(∀ i j : Fin 3, i ≠ j → Disjoint (N i) (N j)) →
(N 0).card + (N 1).card + (N 2).card ≤
(M 0).card + (M 1).card + (M 2).card) :
let E := M 0 ∪ M 1 ∪ M 2
∀ v : Fin n, (E.filter (fun e => v ∈ e)).card < 3 →
(Finset.univ.filter (fun w => H.Adj v w ∧
(E.filter (fun e => w ∈ e)).card < 3)).card ≤
(E.filter (fun e => v ∈ e)).cardsimple_graph_maximum_packing_forced_k4_singleton_witness_uniqueIn LeanGraph Theory & Graph Algorithms
For a maximum triangle packing, once a packed face and an unpacked-spoke K4 anchor are fixed, every singleton-witness triangle meeting that face lies in the same four-clique.
theorem simple_graph_maximum_packing_forced_k4_singleton_witness_unique (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (p : Finset (Fin n)) (hp : p ∈ P) (x : Fin n) (hx : x ∉ p) (hk4 : G.IsNClique 4 (insert x p)) (hfree : ∀ v ∈ p, s(x,v) ∉ P.biUnion finite_vertex_set_edge_encoding) (t : Finset (Fin n)) (ht : G.IsNClique 3 t) (hsingle : (finite_vertex_set_edge_encoding t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1) (hmeets : ¬ Disjoint (finite_vertex_set_edge_encoding t) (finite_vertex_set_edge_encoding p)) : t ⊆ insert x p
simple_graph_maximum_packing_private_k4_core_symmetry_blocks_neighborIn LeanGraph Theory & Graph Algorithms
Let a maximum triangle packing contain abc with a and b private, and let abcx be a four-clique with cx unused by the packing. Let y be outside that four-clique and adjacent to a and x. Then there is no permutation fixing a, b and x, carrying c to y, and preserving the graph's adjacencies between vertices outside a and b.
theorem simple_graph_maximum_packing_private_k4_core_symmetry_blocks_neighbor (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (a b c x y : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hp : ({a,b,c} : Finset (Fin n)) ∈ P) (hk4 : G.IsNClique 4 ({a,b,c,x} : Finset (Fin n))) (hprivate : ∀ q ∈ P, q ≠ ({a,b,c} : Finset (Fin n)) → a ∉ q ∧ b ∉ q) (hfree : s(c,x) ∉ P.biUnion finite_vertex_set_edge_encoding) (hy : y ∉ ({a,b,c,x} : Finset (Fin n))) (hay : G.Adj a y) (hxy : G.Adj x y) (σ : Equiv.Perm (Fin n)) (hfixa : σ a = a) (hfixb : σ b = b) (hfixx : σ x = x) (hmove : σ c = y) (hcore : ∀ u v : Fin n, u ≠ a → u ≠ b → v ≠ a → v ≠ b → G.Adj u v → G.Adj (σ u) (σ v)) : Falsesimple_graph_maximum_packing_private_k4_link_edges_packedIn LeanGraph Theory & Graph Algorithms
In a maximum packing, let abc be a packed triangle with a and b private, and let abcx be a four-clique with all three x-spokes unused. Every triangle through a other than the three four-clique triangles through a has its edge opposite a in the packing. The same conclusion holds for b after interchanging a and b.
theorem simple_graph_maximum_packing_private_k4_link_edges_packed (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (a b c x : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hp : ({a,b,c} : Finset (Fin n)) ∈ P) (hk4 : G.IsNClique 4 ({a,b,c,x} : Finset (Fin n))) (hprivate : ∀ q ∈ P, q ≠ ({a,b,c} : Finset (Fin n)) → a ∉ q ∧ b ∉ q) (hfree : ∀ v ∈ ({a,b,c} : Finset (Fin n)), s(x,v) ∉ P.biUnion finite_vertex_set_edge_encoding) : ∀ y z : Fin n, G.Adj a y → G.Adj a z → G.Adj y z → ({y,z} : Finset (Fin n)) ≠ {b,c} → ({y,z} : Finset (Fin n)) ≠ {b,x} → ({y,z} : Finset (Fin n)) ≠ {c,x} → s(y,z) ∈ P.biUnion finite_vertex_set_edge_encodingsimple_graph_min_degree_two_edge_count_le_vertices_is_two_regularIn LeanGraph Theory & Graph Algorithms
If a finite simple graph has minimum degree at least two and at most as many edges as vertices, every vertex has degree exactly two.
theorem simple_graph_min_degree_two_edge_count_le_vertices_is_two_regular (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hmin : ∀ v : Fin n, 2 ≤ (G.neighborFinset v).card) (hedges : G.edgeFinset.card ≤ n) : ∀ v : Fin n, (G.neighborFinset v).card = 2
simple_graph_min_nonzero_degree_two_five_edges_has_two_disjoint_pairsIn LeanGraph Theory & Graph Algorithms
In any finite simple graph with at least five edges and no degree-one vertices, four distinct edges can be chosen as two vertex-disjoint pairs.
theorem simple_graph_min_nonzero_degree_two_five_edges_has_two_disjoint_pairs (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hE : 5 ≤ G.edgeFinset.card) (hdeg : ∀ v : Fin n, (G.neighborFinset v).card = 0 ∨ 2 ≤ (G.neighborFinset v).card) : ∃ e₁ ∈ G.edgeFinset, ∃ e₂ ∈ G.edgeFinset, ∃ e₃ ∈ G.edgeFinset, ∃ e₄ ∈ G.edgeFinset, ({e₁,e₂,e₃,e₄} : Finset (Sym2 (Fin n))).card = 4 ∧ Disjoint e₁.toFinset e₂.toFinset ∧ Disjoint e₃.toFinset e₄.toFinsetsimple_graph_minimal_k_star_forming_exists_private_witnessIn LeanGraph Theory & Graph Algorithms
Let S be a minimal k-star-forming set, k ≥ 1, and u ∈ S a vertex with at least k neighbours in S (so u cannot itself witness the failure of S \ {u} being k-star-forming). Then some vertex z outside S has fewer than k neighbours in S \ {u} and is adjacent to no vertex w of S \ {u} that has at least k - 1 neighbours in S \ {u}.
theorem simple_graph_minimal_k_star_forming_exists_private_witness {V : Type*} [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (k : ℕ) (hk : 1 ≤ k) (S : Finset V)
(hS : simple_graph_is_minimal_k_star_forming G k S) (u : V) (hu : u ∈ S)
(hdeg : k ≤ (S.filter (G.Adj u)).card) :
∃ z, z ∉ S ∧ ((S.erase u).filter (G.Adj z)).card < k ∧
∀ w ∈ S.erase u, G.Adj z w → ((S.erase u).filter (G.Adj w)).card < k - 1simple_graph_minimum_triangle_cover_outside_maximum_packing_supportIn LeanGraph Theory & Graph Algorithms
There is a seven-vertex graph with triangle packing number five and triangle cover number six, and two graph edges such that no maximum triangle packing uses either edge but every minimum triangle cover uses at least one of them. Thus the union of all maximum packing edges need not contain a minimum triangle cover.
theorem simple_graph_minimum_triangle_cover_outside_maximum_packing_support :
∃ (G : SimpleGraph (Fin 7)) (e f : Sym2 (Fin 7)),
e ∈ G.edgeSet ∧ f ∈ G.edgeSet ∧
simple_graph_triangle_packing_number G = 5 ∧
simple_graph_triangle_cover_number G = 6 ∧
(∀ P : Finset (Finset (Fin 7)),
(∀ t ∈ P, G.IsNClique 3 t) →
(P : Set (Finset (Fin 7))).Pairwise (fun s t => (s ∩ t).card ≤ 1) →
P.card = 5 →
∀ t ∈ P, ¬ (∀ x ∈ e, x ∈ t) ∧ ¬ (∀ x ∈ f, x ∈ t)) ∧
(∀ C : Finset (Sym2 (Fin 7)),
(∀ g ∈ C, g ∈ G.edgeSet) →
(∀ t : Finset (Fin 7), G.IsNClique 3 t →
∃ g ∈ C, ∀ x ∈ g, x ∈ t) →
C.card = 6 → e ∈ C ∨ f ∈ C)simple_graph_no_good_packing_forced_k4_decreasing_pairIn LeanGraph Theory & Graph Algorithms
If every maximum triangle packing has a fully singleton-forced triangle, some maximum packing has such a triangle contained in a four-clique with an opposite pair of edges whose deletion lowers the packing number.
theorem simple_graph_no_good_packing_forced_k4_decreasing_pair
(n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(hbad : ∀ P : Finset (Finset (Sym2 (Fin n))),
P ⊆ simple_graph_triangle_edge_family G →
P.card = simple_graph_triangle_packing_number G →
(P : Set (Finset (Sym2 (Fin n)))).Pairwise Disjoint →
∃ p ∈ P, p ⊆ (((simple_graph_triangle_edge_family G).filter
(fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)) :
∃ (P : Finset (Finset (Sym2 (Fin n)))) (p : Finset (Sym2 (Fin n)))
(e f : Sym2 (Fin n)) (U : Finset (Fin n)),
P ⊆ simple_graph_triangle_edge_family G ∧
P.card = simple_graph_triangle_packing_number G ∧
(P : Set (Finset (Sym2 (Fin n)))).Pairwise Disjoint ∧
p ∈ P ∧ p ⊆ (((simple_graph_triangle_edge_family G).filter
(fun t => (t ∩ P.biUnion id).card = 1)).biUnion id) ∧
G.IsNClique 4 U ∧
(∀ q ∈ p, ∀ v ∈ q, v ∈ U) ∧ e ∈ p ∧ f ∈ G.edgeSet ∧
(∀ v ∈ f, v ∈ U) ∧ (∀ v ∈ e, v ∉ f) ∧
simple_graph_triangle_packing_number (G.deleteEdges {e, f}) <
simple_graph_triangle_packing_number Gsimple_graph_nonempty_iso_clique_four_bridge_cliqueIn LeanGraph Theory & Graph Algorithms
A graph that is two complete Finset sides joined by the single edge uv, with one side of order 4, is isomorphic to simple_graph_clique_four_bridge_clique (card V).
theorem simple_graph_nonempty_iso_clique_four_bridge_clique {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
{A B : Finset V} (hU : (A : Set V) ∪ (B : Set V) = Set.univ) (hD : Disjoint (A : Set V) (B : Set V))
{u v : V} (hu : u ∈ A) (hv : v ∈ B) (huv : G.Adj u v)
(hcross : ∀ x ∈ A, ∀ y ∈ B, G.Adj x y → (x = u ∧ y = v) ∨ (x = v ∧ y = u))
(hAtop : G.induce (A : Set V) = ⊤) (hBtop : G.induce (B : Set V) = ⊤)
(hcard : A.card = 4 ∨ B.card = 4) :
Nonempty (G ≃g simple_graph_clique_four_bridge_clique (Fintype.card V))simple_graph_normalized_hop_group_quadratic_word_diameterIn LeanGraph Theory & Graph Algorithms
There exists an absolute constant C > 0 such that for every connected finite simple graph G on at least 2 vertices admitting a hop h₀, every element of the normalized subgroup K relative to h₀ has signed normalized word length at most C * |V|² with respect to P ∪ P⁻¹.
theorem simple_graph_normalized_hop_group_quadratic_word_diameter :
∃ C : ℕ, 0 < C ∧ ∀ (V : Type) [Fintype V] [DecidableEq V] (G : SimpleGraph V) (h₀ : Equiv.Perm V),
2 ≤ Fintype.card V → G.Connected → simple_graph_is_hop G h₀ →
∀ k ∈ simple_graph_normalized_hop_group G h₀,
∃ w : List (Equiv.Perm V),
(∀ p ∈ w, simple_graph_normalized_hop G h₀ p ∨ simple_graph_normalized_hop G h₀ p⁻¹) ∧
w.length ≤ C * (Fintype.card V) ^ 2 ∧ w.prod = ksimple_graph_normalized_hop_quadratic_diameter_of_relationIn LeanGraph Theory & Graph Algorithms
The general relation form of the quadratic diameter bound implies the graph form: setting R u v := G.Adj u (h0 v), cycle covers of R are exactly the normalized hops, and inverses of covers are exactly the inverted normalized hops.
theorem simple_graph_normalized_hop_quadratic_diameter_of_relation :
(∃ C : ℕ, 0 < C ∧ ∀ (W : Type) [Fintype W] [DecidableEq W] (R : W → W → Prop),
(∀ v, R v v) →
∀ k ∈ Subgroup.closure {p : Equiv.Perm W | ∀ v, R v (p v)},
∃ w : List (Equiv.Perm W),
(∀ p ∈ w, (∀ v, R v (p v)) ∨ (∀ v, R (p v) v)) ∧
w.length ≤ C * (Fintype.card W) ^ 2 ∧ w.prod = k) →
∃ C : ℕ, 0 < C ∧ ∀ (V : Type) [Fintype V] [DecidableEq V] (G : SimpleGraph V) (h₀ : Equiv.Perm V),
2 ≤ Fintype.card V → G.Connected → simple_graph_is_hop G h₀ →
∀ k ∈ simple_graph_normalized_hop_group G h₀,
∃ w : List (Equiv.Perm V),
(∀ p ∈ w, simple_graph_normalized_hop G h₀ p ∨ simple_graph_normalized_hop G h₀ p⁻¹) ∧
w.length ≤ C * (Fintype.card V) ^ 2 ∧ w.prod = ksimple_graph_nu_le_five_nine_seed_two_book_classificationIn LeanGraph Theory & Graph Algorithms
In a finite graph with triangle-packing number at most five containing the specified twenty-edge graph on nine vertices, every triangle lies in the nine-vertex support or consists of an outside vertex and one of the two disjoint support edges 26 and 34.
theorem simple_graph_nu_le_five_nine_seed_two_book_classification (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (f : Fin 9 → Fin n) (hinj : Function.Injective f) (hcontains : ∀ i j : Fin 9, (i,j) ∈ ({(0,1),(0,2),(0,3),(0,4),(1,2),(1,3),(1,6),(2,3),(2,4),(2,6),(2,7),(2,8),(3,4),(3,5),(3,6),(3,7),(4,5),(4,7),(6,7),(6,8)} : Finset (Fin 9 × Fin 9)) → G.Adj (f i) (f j)) (hbound : simple_graph_triangle_packing_number G ≤ 5) : let S := (Finset.univ : Finset (Fin 9)).image f; ∀ t : Finset (Fin n), G.IsNClique 3 t → t ⊆ S ∨ ∃ w, w ∉ S ∧ (t = {f 2,f 6,w} ∨ t = {f 3,f 4,w})simple_graph_nu_le_five_ten_seed_four_book_classificationIn LeanGraph Theory & Graph Algorithms
In a finite graph with triangle-packing number at most five containing the specified twenty-edge graph on ten vertices, every triangle lies in the ten-vertex support or consists of an outside vertex and one of the support edges 24, 27, 34 or 37.
theorem simple_graph_nu_le_five_ten_seed_four_book_classification (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (f : Fin 10 → Fin n) (hinj : Function.Injective f) (hcontains : ∀ i j : Fin 10, (i,j) ∈ ({(0,1),(0,2),(0,3),(0,4),(1,2),(1,3),(1,7),(2,3),(2,4),(2,6),(2,7),(2,9),(3,4),(3,5),(3,7),(3,8),(4,5),(4,6),(7,8),(7,9)} : Finset (Fin 10 × Fin 10)) → G.Adj (f i) (f j)) (hbound : simple_graph_triangle_packing_number G ≤ 5) : let S := (Finset.univ : Finset (Fin 10)).image f; ∀ t : Finset (Fin n), G.IsNClique 3 t → t ⊆ S ∨ ∃ w, w ∉ S ∧ (t = {f 2,f 4,w} ∨ t = {f 2,f 7,w} ∨ t = {f 3,f 4,w} ∨ t = {f 3,f 7,w})simple_graph_odd_cycle_linegraph_stable_fully_forced_familyIn LeanGraph Theory & Graph Algorithms
For each odd r at least five, form a 4-regular graph on two r-cycles by joining v_i to v_(i+1), w_i to w_(i+2), and w_i to v_i and v_(i+1). Its line graph has 4r vertices and 12r edges, triangle codegrees two or three, packing number (5r-1)/2, a connected triangle-intersection graph and stable edge deletion; every maximum packing has a fully singleton-forced triangle.
open scoped Sym2
theorem simple_graph_odd_cycle_linegraph_stable_fully_forced_family
(r : ℕ) [NeZero r] (hr : 5 ≤ r) (hodd : Odd r)
(H : SimpleGraph (ZMod r × Fin 2)) [DecidableRel H.Adj]
(hH : ∀ x y, H.Adj x y ↔ x ≠ y ∧ ∃ i : ZMod r,
s(x, y) = s((i, 0), (i + 1, 0)) ∨
s(x, y) = s((i, 1), (i + 2, 1)) ∨
s(x, y) = s((i, 1), (i, 0)) ∨
s(x, y) = s((i, 1), (i + 1, 0))) :
let G := H.lineGraph
let F := simple_graph_triangle_edge_family G
let k := (5 * r - 1) / 2
Fintype.card H.edgeSet = 4 * r ∧
(∃ E : Finset (Sym2 H.edgeSet), (↑E : Set (Sym2 H.edgeSet)) = G.edgeSet ∧ E.card = 12 * r) ∧
(∃ P : Finset (Finset (Sym2 H.edgeSet)), P ⊆ F ∧ P.card = k ∧
(P : Set (Finset (Sym2 H.edgeSet))).Pairwise Disjoint) ∧
(∀ Q : Finset (Finset (Sym2 H.edgeSet)), Q ⊆ F →
(Q : Set (Finset (Sym2 H.edgeSet))).Pairwise Disjoint → Q.card ≤ k) ∧
(∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset (Sym2 H.edgeSet)), Q ⊆ F ∧ Q.card = k ∧
(Q : Set (Finset (Sym2 H.edgeSet))).Pairwise Disjoint ∧ e ∉ Q.biUnion id) ∧
(∀ e ∈ G.edgeSet, 2 ≤ (F.filter (fun t => e ∈ t)).card ∧ (F.filter (fun t => e ∈ t)).card ≤ 3) ∧
(∀ a ∈ F, ∀ b ∈ F, Relation.ReflTransGen
(fun x y : Finset (Sym2 H.edgeSet) => x ∈ F ∧ y ∈ F ∧ ¬ Disjoint x y) a b) ∧
∀ P : Finset (Finset (Sym2 H.edgeSet)), P ⊆ F → P.card = k →
(P : Set (Finset (Sym2 H.edgeSet))).Pairwise Disjoint →
∃ p ∈ P, p ⊆ ((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)simple_graph_opposite_pair_stable_external_k4_attachmentIn LeanGraph Theory & Graph Algorithms
Let P be a maximum edge-disjoint triangle packing containing abc, and let x outside its vertex support complete abc to a four-clique. If deleting the opposite edges ab and cx preserves the packing number, then another triangle of P contains a or b and a vertex y outside abc that is adjacent to x.
theorem simple_graph_opposite_pair_stable_external_k4_attachment (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (a b c x : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hp : ({a,b,c} : Finset (Fin n)) ∈ P) (hx : x ∉ P.biUnion id) (hk4 : G.IsNClique 4 ({a,b,c,x} : Finset (Fin n))) (hstable : simple_graph_triangle_packing_number (G.deleteEdges {s(a,b), s(c,x)}) = simple_graph_triangle_packing_number G) : ∃ t ∈ P, t ≠ ({a,b,c} : Finset (Fin n)) ∧ (a ∈ t ∨ b ∈ t) ∧ ∃ y ∈ t, y ∉ ({a,b,c} : Finset (Fin n)) ∧ G.Adj x ysimple_graph_packing_card_le_of_hitting_setIn LeanGraph Theory & Graph Algorithms
A hitting set for a pairwise edge-disjoint family of edge sets has cardinality at least the size of the family.
theorem simple_graph_packing_card_le_of_hitting_set {V : Type*} (S : Finset (Sym2 V)) (R : Finset (Finset (Sym2 V)))
(hdisj : (R : Set (Finset (Sym2 V))).Pairwise Disjoint)
(hhit : ∀ t ∈ R, ∃ s ∈ S, s ∈ t) : R.card ≤ S.cardsimple_graph_packing_thirteen_stable_seed_good_packingIn LeanGraph Theory & Graph Algorithms
Every stable supergraph of the displayed 18-vertex seed with triangle packing number thirteen has a maximum packing without a fully singleton-forced triangle.
open scoped Sym2
theorem simple_graph_packing_thirteen_stable_seed_good_packing :
let E₀ : Finset (Sym2 (Fin 18)) := {s(0, 1), s(0, 4), s(0, 6), s(0, 7), s(0, 8), s(0, 11), s(1, 5), s(1, 8), s(1, 11), s(1, 12), s(1, 13), s(1, 14), s(2, 3), s(2, 4), s(2, 5), s(2, 6), s(2, 12), s(2, 15), s(3, 4), s(3, 5), s(3, 11), s(3, 14), s(3, 16), s(4, 5), s(4, 6), s(4, 7), s(5, 13), s(5, 14), s(6, 7), s(6, 12), s(6, 15), s(7, 8), s(7, 9), s(7, 10), s(8, 9), s(8, 10), s(8, 11), s(9, 10), s(9, 12), s(9, 13), s(9, 17), s(10, 15), s(10, 16), s(10, 17), s(11, 14), s(11, 15), s(11, 16), s(12, 13), s(12, 15), s(12, 17), s(13, 14), s(13, 17), s(14, 16), s(15, 16), s(15, 17), s(16, 17)}
∀ (G : SimpleGraph (Fin 18)),
let F := simple_graph_triangle_edge_family G
(↑E₀ : Set (Sym2 (Fin 18))) ⊆ G.edgeSet →
(∀ Q : Finset (Finset (Sym2 (Fin 18))), Q ⊆ F →
(Q : Set (Finset (Sym2 (Fin 18)))).Pairwise Disjoint → Q.card ≤ 13) →
(∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset (Sym2 (Fin 18))), Q ⊆ F ∧ Q.card = 13 ∧
(Q : Set (Finset (Sym2 (Fin 18)))).Pairwise Disjoint ∧ e ∉ Q.biUnion id) →
∃ P : Finset (Finset (Sym2 (Fin 18))), P ⊆ F ∧ P.card = 13 ∧
(P : Set (Finset (Sym2 (Fin 18)))).Pairwise Disjoint ∧
∀ p ∈ P, ¬ p ⊆ ((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)simple_graph_pair_stable_active_vertices_four_k_minus_fiveIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable finite graph with triangle packing number k≥5, at most 4k−5 vertices lie in triangles.
theorem simple_graph_pair_stable_active_vertices_four_k_minus_five (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hk : 5 ≤ simple_graph_triangle_packing_number G) : (((Finset.univ : Finset (Finset (Fin n))).filter (G.IsNClique 3)).biUnion id).card + 5 ≤ 4 * simple_graph_triangle_packing_number Gsimple_graph_pair_stable_deficit_one_outside_impossibleIn LeanGraph Theory & Graph Algorithms
A support-maximal maximum packing in a two-edge-stable graph has no active outside vertex in exactly |P|−1 triangles when every active vertex lies in at least |P|−1 triangles.
theorem simple_graph_pair_stable_deficit_one_outside_impossible (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) (hlocal : ∀ y : Fin n, (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ y ∈ t) → P.card ≤ (((Finset.univ : Finset (Finset (Fin n))).filter (fun t => G.IsNClique 3 t ∧ y ∈ t)).card) + 1) (hdeficit : (((Finset.univ : Finset (Finset (Fin n))).filter (fun t => G.IsNClique 3 t ∧ x ∈ t)).card) + 1 = P.card) : Falsesimple_graph_pair_stable_four_cycle_books_twenty_vertex_kernelIn LeanGraph Theory & Graph Algorithms
If every triangle of a two-edge-stable finite graph is either inside S or has one outside vertex and an edge of a four-cycle on S, at most twenty outside vertices can be retained so the induced graph has the same triangle-packing number and remains two-edge-stable.
theorem simple_graph_pair_stable_four_cycle_books_twenty_vertex_kernel (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (S : Finset (Fin n)) (a b c d : Fin n) (habcd : ({a,b,c,d} : Finset (Fin n)).card = 4) (hS : ({a,b,c,d} : Finset (Fin n)) ⊆ S) (hclass : ∀ t : Finset (Fin n), G.IsNClique 3 t → t ⊆ S ∨ ∃ w, w ∉ S ∧ (t = {a,c,w} ∨ t = {a,d,w} ∨ t = {b,c,w} ∨ t = {b,d,w})) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) : ∃ U : Finset (Fin n), Disjoint U S ∧ U.card ≤ 20 ∧ let H := G.induce (↑(S ∪ U) : Set (Fin n)); simple_graph_triangle_packing_number H = simple_graph_triangle_packing_number G ∧ ∀ e f : Sym2 {v : Fin n // v ∈ S ∪ U}, e ∈ H.edgeSet → f ∈ H.edgeSet → e ≠ f → simple_graph_triangle_packing_number (H.deleteEdges {e,f}) = simple_graph_triangle_packing_number Hsimple_graph_pair_stable_good_packing_support_four_k_minus_four_kernelIn LeanGraph Theory & Graph Algorithms
If a two-edge-stable graph has a good maximum packing of k≥4 triangles, it has an induced support-signature kernel containing the packing on at most 4k−4 vertices.
theorem simple_graph_pair_stable_good_packing_support_four_k_minus_four_kernel (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hgood : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hfour : 4 ≤ P.card) : ∃ W : Finset (Fin n), W.card + 4 ≤ 4 * P.card ∧ P.biUnion id ⊆ W ∧ ∀ t : Finset (Fin n), G.IsNClique 3 t → ∃ s : Finset (Fin n), G.IsNClique 3 s ∧ s ⊆ W ∧ finite_vertex_set_edge_encoding s ∩ (P.biUnion finite_vertex_set_edge_encoding) = finite_vertex_set_edge_encoding t ∩ (P.biUnion finite_vertex_set_edge_encoding)simple_graph_pair_stable_k4_every_face_pair_extends_linkIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph, fix a four-clique with a distinguished vertex x. For any two other clique vertices, at least one has a common neighbor with x outside the four-clique. Consequently at least two of the three face vertices have such an external common neighbor.
theorem simple_graph_pair_stable_k4_every_face_pair_extends_link (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (x a b c : Fin n) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hk4 : G.IsNClique 4 ({x,a,b,c} : Finset (Fin n))) : ∀ u ∈ ({a,b,c} : Finset (Fin n)), ∀ v ∈ ({a,b,c} : Finset (Fin n)), u ≠ v → ∃ y : Fin n, y ∉ ({x,a,b,c} : Finset (Fin n)) ∧ G.Adj x y ∧ (G.Adj u y ∨ G.Adj v y)simple_graph_pair_stable_k4_forest_forces_another_packing_edgeIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph, let a maximum triangle packing have a forest as its vertex-intersection graph. If a packed face belongs to a four-clique whose three anchor spokes are unused, then some different packed triangle has a singleton-forced edge.
theorem simple_graph_pair_stable_k4_forest_forces_another_packing_edge (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hforest : ∀ F : Finset (Finset (Fin n)), F ⊆ P → F.Nonempty → ∃ t ∈ F, (F.filter (fun u => u ≠ t ∧ ¬ Disjoint u t)).card ≤ 1) (a b c x : Fin n) (hp : ({a,b,c} : Finset (Fin n)) ∈ P) (hk4 : G.IsNClique 4 ({x,a,b,c} : Finset (Fin n))) (hfree : ∀ v ∈ ({a,b,c} : Finset (Fin n)), s(x,v) ∉ P.biUnion finite_vertex_set_edge_encoding) : ∃ q ∈ P, q ≠ ({a,b,c} : Finset (Fin n)) ∧ ¬ Disjoint (finite_vertex_set_edge_encoding q) (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)simple_graph_pair_stable_large_intersecting_packing_at_most_one_forced_edgeIn LeanGraph Theory & Graph Algorithms
In a pair-stable graph, if a maximum packing has at least eight triangles and every two of its triangles share a vertex, then each packed triangle has at most one singleton-forced edge. Consequently the packing has no fully forced triangle.
theorem simple_graph_pair_stable_large_intersecting_packing_at_most_one_forced_edge (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hinter : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).Nonempty)) (hmax : P.card = simple_graph_triangle_packing_number G) (hlarge : 8 ≤ P.card) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1simple_graph_pair_stable_link_no_four_cycle_componentIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph, the link of a vertex cannot have an induced four-cycle as a connected component, even if other components are present.
theorem simple_graph_pair_stable_link_no_four_cycle_component (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (x : Fin n) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (a b c d : Fin n) (hdist : ({a,b,c,d} : Finset (Fin n)).card = 4) (hcycle : ({s(a,b),s(b,c),s(c,d),s(d,a)} : Finset (Sym2 (Fin n))) ⊆ G.edgeFinset.filter (fun e => ∀ v ∈ e, G.Adj x v)) (hcomponent : ∀ e ∈ G.edgeFinset.filter (fun e => ∀ v ∈ e, G.Adj x v), (a ∈ e ∨ b ∈ e ∨ c ∈ e ∨ d ∈ e) → e ∈ ({s(a,b),s(b,c),s(c,d),s(d,a)} : Finset (Sym2 (Fin n)))) : Falsesimple_graph_pair_stable_link_no_triangle_componentIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph, the link of a vertex cannot have a triangle as a connected component, even if other components are present.
theorem simple_graph_pair_stable_link_no_triangle_component (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (x : Fin n) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (a b c : Fin n) (hdist : ({a,b,c} : Finset (Fin n)).card = 3) (hcycle : ({s(a,b),s(b,c),s(c,a)} : Finset (Sym2 (Fin n))) ⊆ G.edgeFinset.filter (fun e => ∀ v ∈ e, G.Adj x v)) (hcomponent : ∀ e ∈ G.edgeFinset.filter (fun e => ∀ v ∈ e, G.Adj x v), (a ∈ e ∨ b ∈ e ∨ c ∈ e) → e ∈ ({s(a,b),s(b,c),s(c,a)} : Finset (Sym2 (Fin n)))) : Falsesimple_graph_pair_stable_minimum_outside_link_has_small_degreeIn LeanGraph Theory & Graph Algorithms
Minimize the number of triangles through an active outside vertex over all support-maximal maximum packings of a two-edge-stable graph. The resulting link deficit is at least two, and some nonisolated link vertex has degree at most that deficit.
theorem simple_graph_pair_stable_minimum_outside_link_has_small_degree (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) (E : Finset (Sym2 (Fin n))) (hE : E = G.edgeFinset.filter (fun e => ∀ v ∈ e, G.Adj x v)) (r : ℕ) (hr : E.card + r = P.card) (hminimal : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card = (P.biUnion id).card → ∀ y : Fin n, y ∉ Q.biUnion id → (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ y ∈ t) → (((Finset.univ : Finset (Finset (Fin n))).filter (fun t => G.IsNClique 3 t ∧ x ∈ t)).card) ≤ (((Finset.univ : Finset (Finset (Fin n))).filter (fun t => G.IsNClique 3 t ∧ y ∈ t)).card)) : 2 ≤ r ∧ ∃ v : Fin n, 2 ≤ (E.filter (fun e => v ∈ e)).card ∧ (E.filter (fun e => v ∈ e)).card ≤ rsimple_graph_pair_stable_no_good_finite_kernelIn LeanGraph Theory & Graph Algorithms
If a finite simple graph has triangle packing number k, deleting any two edges preserves that number, and every maximum packing contains a triangle all of whose edges are singleton-forced, then an induced subgraph on at most 3k+(k+2)2^(3k) vertices has the same three properties, including packing number k.
theorem simple_graph_pair_stable_no_good_finite_kernel (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → simple_graph_triangle_packing_number (G.deleteEdges {e, f}) = simple_graph_triangle_packing_number G) (hbad : ∀ P : Finset (Finset (Sym2 (Fin n))), P ⊆ simple_graph_triangle_edge_family G → P.card = simple_graph_triangle_packing_number G → (P : Set (Finset (Sym2 (Fin n)))).Pairwise Disjoint → ∃ p ∈ P, p ⊆ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)) : ∃ W : Finset (Fin n), W.card ≤ 3 * simple_graph_triangle_packing_number G + (simple_graph_triangle_packing_number G + 2) * 2 ^ (3 * simple_graph_triangle_packing_number G) ∧ let H := G.induce (W : Set (Fin n)); simple_graph_triangle_packing_number H = simple_graph_triangle_packing_number G ∧ (∀ e f : Sym2 {x : Fin n // x ∈ W}, e ∈ H.edgeSet → f ∈ H.edgeSet → simple_graph_triangle_packing_number (H.deleteEdges {e, f}) = simple_graph_triangle_packing_number H) ∧ (∀ P : Finset (Finset (Sym2 {x : Fin n // x ∈ W})), P ⊆ simple_graph_triangle_edge_family H → P.card = simple_graph_triangle_packing_number H → (P : Set (Finset (Sym2 {x : Fin n // x ∈ W}))).Pairwise Disjoint → ∃ p ∈ P, p ⊆ (((simple_graph_triangle_edge_family H).filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id))simple_graph_pair_stable_no_good_sharp_quadratic_kernelIn LeanGraph Theory & Graph Algorithms
If a finite simple graph has triangle packing number k, deleting any two edges preserves that number, and every maximum packing contains a triangle all of whose edges are singleton-forced, then an induced subgraph on at most k²+4k−1 vertices has the same three properties, including packing number k.
theorem simple_graph_pair_stable_no_good_sharp_quadratic_kernel (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → simple_graph_triangle_packing_number (G.deleteEdges {e, f}) = simple_graph_triangle_packing_number G) (hbad : ∀ P : Finset (Finset (Sym2 (Fin n))), P ⊆ simple_graph_triangle_edge_family G → P.card = simple_graph_triangle_packing_number G → (P : Set (Finset (Sym2 (Fin n)))).Pairwise Disjoint → ∃ p ∈ P, p ⊆ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)) : ∃ W : Finset (Fin n), W.card + 1 ≤ simple_graph_triangle_packing_number G * simple_graph_triangle_packing_number G + 4 * simple_graph_triangle_packing_number G ∧ let H := G.induce (W : Set (Fin n)); simple_graph_triangle_packing_number H = simple_graph_triangle_packing_number G ∧ (∀ e f : Sym2 {x : Fin n // x ∈ W}, e ∈ H.edgeSet → f ∈ H.edgeSet → simple_graph_triangle_packing_number (H.deleteEdges {e, f}) = simple_graph_triangle_packing_number H) ∧ (∀ P : Finset (Finset (Sym2 {x : Fin n // x ∈ W})), P ⊆ simple_graph_triangle_edge_family H → P.card = simple_graph_triangle_packing_number H → (P : Set (Finset (Sym2 {x : Fin n // x ∈ W}))).Pairwise Disjoint → ∃ p ∈ P, p ⊆ (((simple_graph_triangle_edge_family H).filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id))simple_graph_pair_stable_nu_le_five_excludes_eight_saturated_seedIn LeanGraph Theory & Graph Algorithms
A two-edge-stable graph with triangle-packing number at most five cannot contain the specified twenty-edge graph on eight vertices as a subgraph.
theorem simple_graph_pair_stable_nu_le_five_excludes_eight_saturated_seed (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (f : Fin 8 → Fin n) (hinj : Function.Injective f) (hcontains : ∀ i j : Fin 8, (i,j) ∈ ({(0,1),(0,2),(0,3),(0,4),(1,2),(1,3),(1,6),(2,3),(2,4),(2,5),(2,6),(2,7),(3,4),(3,5),(3,6),(3,7),(4,5),(4,7),(5,6),(6,7)} : Finset (Fin 8 × Fin 8)) → G.Adj (f i) (f j)) (hbound : simple_graph_triangle_packing_number G ≤ 5) (hstable : ∀ e g : Sym2 (Fin n), e ∈ G.edgeSet → g ∈ G.edgeSet → e ≠ g → simple_graph_triangle_packing_number (G.deleteEdges {e,g}) = simple_graph_triangle_packing_number G) : Falsesimple_graph_pair_stable_outside_general_deficit_low_degree_obstructionIn LeanGraph Theory & Graph Algorithms
If an outside link of a support-maximal maximum packing has positive deficit r and every active vertex lies in at least as many triangles as there are link edges, then some nonisolated link vertex has degree at most r.
theorem simple_graph_pair_stable_outside_general_deficit_low_degree_obstruction (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) (E : Finset (Sym2 (Fin n))) (hE : E = G.edgeFinset.filter (fun e => ∀ v ∈ e, G.Adj x v)) (r : ℕ) (hr : E.card + r = P.card) (hlocal : ∀ y : Fin n, (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ y ∈ t) → E.card ≤ (((Finset.univ : Finset (Finset (Fin n))).filter (fun t => G.IsNClique 3 t ∧ y ∈ t)).card)) (hrpos : 1 ≤ r) : ∃ v : Fin n, 1 ≤ (E.filter (fun e => v ∈ e)).card ∧ (E.filter (fun e => v ∈ e)).card ≤ rsimple_graph_pair_stable_outside_general_deficit_obstructionIn LeanGraph Theory & Graph Algorithms
For an outside vertex of a support-maximal maximum packing of a two-edge-stable graph, the following cannot all hold: every active vertex has at least as many triangles as the link has edges, every nonisolated link vertex has degree greater than the packing deficit, and the disjointness graph of link edges has a sufficiently large matching.
theorem simple_graph_pair_stable_outside_general_deficit_obstruction (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) (E : Finset (Sym2 (Fin n))) (hE : E = G.edgeFinset.filter (fun e => ∀ v ∈ e, G.Adj x v)) (r : ℕ) (hr : E.card + r = P.card) (hlocal : ∀ y : Fin n, (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ y ∈ t) → E.card ≤ (((Finset.univ : Finset (Finset (Fin n))).filter (fun t => G.IsNClique 3 t ∧ y ∈ t)).card)) (hdeg : ∀ v : Fin n, (E.filter (fun e => v ∈ e)).card = 0 ∨ r < (E.filter (fun e => v ∈ e)).card) (hmatching : ∃ M : Finset (Finset (Sym2 (Fin n))), 2 ≤ M.card ∧ r + 1 ≤ M.card ∧ (∀ p ∈ M, p.card = 2 ∧ p ⊆ E ∧ (∀ e ∈ p, ∀ f ∈ p, e ≠ f → Disjoint e.toFinset f.toFinset)) ∧ (M : Set (Finset (Sym2 (Fin n)))).Pairwise Disjoint) : Falsesimple_graph_pair_stable_outside_general_deficit_private_tip_obstructionIn LeanGraph Theory & Graph Algorithms
The arbitrary-deficit outside-support obstruction needs the triangle-count lower bound only for private tips of packing triangles that own a link edge.
theorem simple_graph_pair_stable_outside_general_deficit_private_tip_obstruction (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) (E : Finset (Sym2 (Fin n))) (hE : E = G.edgeFinset.filter (fun e => ∀ v ∈ e, G.Adj x v)) (r : ℕ) (hr : E.card + r = P.card) (hlocal : ∀ t ∈ P, ∀ c ∈ t, (∀ q ∈ P, q ≠ t → c ∉ q) → (∃ u ∈ t, ∃ v ∈ t, u ≠ v ∧ c ≠ u ∧ c ≠ v ∧ s(u,v) ∈ E) → E.card ≤ (((Finset.univ : Finset (Finset (Fin n))).filter (fun z => G.IsNClique 3 z ∧ c ∈ z)).card)) (hdeg : ∀ v : Fin n, (E.filter (fun e => v ∈ e)).card = 0 ∨ r < (E.filter (fun e => v ∈ e)).card) (hmatching : ∃ M : Finset (Finset (Sym2 (Fin n))), 2 ≤ M.card ∧ r + 1 ≤ M.card ∧ (∀ p ∈ M, p.card = 2 ∧ p ⊆ E ∧ (∀ e ∈ p, ∀ f ∈ p, e ≠ f → Disjoint e.toFinset f.toFinset)) ∧ (M : Set (Finset (Sym2 (Fin n)))).Pairwise Disjoint) : Falsesimple_graph_pair_stable_outside_link_has_nonuniversal_private_tipIn LeanGraph Theory & Graph Algorithms
If the disjointness graph of an outside link has a matching of size at least the packing deficit (and at least one), some private tip of a link-edge owner misses a link vertex.
theorem simple_graph_pair_stable_outside_link_has_nonuniversal_private_tip (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) (E : Finset (Sym2 (Fin n))) (hE : E = G.edgeFinset.filter (fun e => ∀ v ∈ e, G.Adj x v)) (r : ℕ) (hr : E.card + r = P.card) (hmatching : ∃ M : Finset (Finset (Sym2 (Fin n))), 1 ≤ M.card ∧ r ≤ M.card ∧ (∀ p ∈ M, p.card = 2 ∧ p ⊆ E ∧ (∀ e ∈ p, ∀ f ∈ p, e ≠ f → Disjoint e.toFinset f.toFinset)) ∧ (M : Set (Finset (Sym2 (Fin n)))).Pairwise Disjoint) : ∃ t ∈ P, ∃ c ∈ t, (∀ q ∈ P, q ≠ t → c ∉ q) ∧ (∃ u ∈ t, ∃ v ∈ t, u ≠ v ∧ c ≠ u ∧ c ≠ v ∧ s(u,v) ∈ E) ∧ ∃ z : Fin n, (∃ e ∈ E, z ∈ e) ∧ ¬ G.Adj c zsimple_graph_pair_stable_outside_link_support_boundIn LeanGraph Theory & Graph Algorithms
For a support-maximal maximum triangle packing in a two-edge-stable graph, an active outside vertex in m triangles and a packing deficit r yield a support-plus-vertex set of size at most 2m+3r+1.
theorem simple_graph_pair_stable_outside_link_support_bound (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) (m r : ℕ) (hm : m = (((Finset.univ : Finset (Finset (Fin n))).filter (fun t => G.IsNClique 3 t ∧ x ∈ t)).card)) (hr : m + r = P.card) : (insert x (P.biUnion id)).card ≤ 2 * m + 3 * r + 1simple_graph_pair_stable_outside_vertex_link_edge_spoke_exchangeIn LeanGraph Theory & Graph Algorithms
At a vertex outside a maximum packing of a two-edge-stable graph, every link edge yz and every link vertex w admit another link edge meeting yz and avoiding w.
theorem simple_graph_pair_stable_outside_vertex_link_edge_spoke_exchange (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (x : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hx : x ∉ P.biUnion id) (y z w : Fin n) (hy : G.Adj x y) (hz : G.Adj x z) (hyz : G.Adj y z) (hw : G.Adj x w) : ∃ u v, G.Adj x u ∧ G.Adj x v ∧ G.Adj u v ∧ (u = y ∨ u = z ∨ v = y ∨ v = z) ∧ u ≠ w ∧ v ≠ w ∧ s(u,v) ≠ s(y,z)simple_graph_pair_stable_outside_vertex_link_not_four_cycleIn LeanGraph Theory & Graph Algorithms
The link of an active outside vertex of a two-edge-stable maximum triangle packing cannot be exactly a four-cycle.
theorem simple_graph_pair_stable_outside_vertex_link_not_four_cycle (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (x : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hx : x ∉ P.biUnion id) (a b c d : Fin n) (hdist : ({a,b,c,d} : Finset (Fin n)).card = 4) : ((P.biUnion finite_vertex_set_edge_encoding).filter (fun e => ∀ v ∈ e, G.Adj x v)) ≠ ({s(a,b),s(b,c),s(c,d),s(d,a)} : Finset (Sym2 (Fin n)))simple_graph_pair_stable_outside_vertex_spans_five_packing_edgesIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph, every triangle-active vertex outside a maximum packing spans at least five edges of that packing.
theorem simple_graph_pair_stable_outside_vertex_spans_five_packing_edges (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (x : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) : 5 ≤ ((P.biUnion finite_vertex_set_edge_encoding).filter (fun e => ∀ v ∈ e, G.Adj x v)).cardsimple_graph_pair_stable_outside_vertex_spans_three_packing_edgesIn LeanGraph Theory & Graph Algorithms
In a graph whose triangle packing number survives every two-edge deletion, any triangle-active vertex outside a maximum packing spans at least three different edges of that packing.
theorem simple_graph_pair_stable_outside_vertex_spans_three_packing_edges (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (x : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) : 3 ≤ ((P.biUnion finite_vertex_set_edge_encoding).filter (fun e => ∀ v ∈ e, G.Adj x v)).cardsimple_graph_pair_stable_packing_le_five_active_vertices_le_three_nuIn LeanGraph Theory & Graph Algorithms
A two-edge-stable graph whose triangle-packing number is at most five has at most three times that number of triangle-active vertices.
theorem simple_graph_pair_stable_packing_le_five_active_vertices_le_three_nu (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hfive : simple_graph_triangle_packing_number G ≤ 5) : (((Finset.univ : Finset (Finset (Fin n))).filter (G.IsNClique 3)).biUnion id).card ≤ 3 * simple_graph_triangle_packing_number Gsimple_graph_pair_stable_private_k4_anchor_neighbor_not_pendantIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph, suppose a maximum packing contains abc, a and b are private to it, and abcx is a four-clique whose x-spokes are unused by the packing. If a packed triangle q contains x and an a-neighbor other than x, then q has a vertex other than x that also belongs to another packed triangle.
theorem simple_graph_pair_stable_private_k4_anchor_neighbor_not_pendant (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (a b c x : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hp : ({a,b,c} : Finset (Fin n)) ∈ P) (hk4 : G.IsNClique 4 ({a,b,c,x} : Finset (Fin n))) (hprivate : ∀ q ∈ P, q ≠ ({a,b,c} : Finset (Fin n)) → a ∉ q ∧ b ∉ q) (hfree : ∀ v ∈ ({a,b,c} : Finset (Fin n)), s(x,v) ∉ P.biUnion finite_vertex_set_edge_encoding) : ∀ q ∈ P, x ∈ q → (∃ y ∈ q, y ≠ x ∧ G.Adj a y) → ∃ z ∈ q, z ≠ x ∧ ∃ r ∈ P, r ≠ q ∧ z ∈ rsimple_graph_pair_stable_private_k4_core_stabilizer_not_transitiveIn LeanGraph Theory & Graph Algorithms
A two-edge-stable maximum packing with a four-clique face abc, two private vertices a,b and unused anchor spokes has an additional common neighbor y of a and the anchor x. The vertex y is outside the orbit of c under every core edge-preserving permutation fixing a, b and x. In particular the stabilizer of x in the graph induced outside a,b is not transitive on its neighbors.
theorem simple_graph_pair_stable_private_k4_core_stabilizer_not_transitive (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (a b c x : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hp : ({a,b,c} : Finset (Fin n)) ∈ P) (hk4 : G.IsNClique 4 ({a,b,c,x} : Finset (Fin n))) (hprivate : ∀ q ∈ P, q ≠ ({a,b,c} : Finset (Fin n)) → a ∉ q ∧ b ∉ q) (hfree : ∀ v ∈ ({a,b,c} : Finset (Fin n)), s(x,v) ∉ P.biUnion finite_vertex_set_edge_encoding) : ∃ y : Fin n, y ∉ ({a,b,c,x} : Finset (Fin n)) ∧ G.Adj a y ∧ G.Adj x y ∧ ∀ σ : Equiv.Perm (Fin n), σ a = a → σ b = b → σ x = x → σ c = y → ¬ (∀ u v : Fin n, u ≠ a → u ≠ b → v ≠ a → v ≠ b → G.Adj u v → G.Adj (σ u) (σ v))simple_graph_pair_stable_saturated_outside_has_low_triangle_private_tipIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph, if an active vertex outside a support-maximal maximum packing lies in at least as many triangles as the packing size, then some packed triangle has a private vertex lying in fewer triangles than the packing size.
theorem simple_graph_pair_stable_saturated_outside_has_low_triangle_private_tip (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) (hsaturated : P.card ≤ (((Finset.univ : Finset (Finset (Fin n))).filter (fun t => G.IsNClique 3 t ∧ x ∈ t)).card)) : ∃ t ∈ P, ∃ c ∈ t, (∀ q ∈ P, q ≠ t → c ∉ q) ∧ (((Finset.univ : Finset (Finset (Fin n))).filter (fun u => G.IsNClique 3 u ∧ c ∈ u)).card) < P.cardsimple_graph_pair_stable_sunflower_packing_at_most_one_forced_edgeIn LeanGraph Theory & Graph Algorithms
In a pair-stable graph, if every triangle of a maximum packing contains one common vertex, then each packed triangle has at most one singleton-forced edge. In particular, that maximum packing contains no fully forced triangle.
theorem simple_graph_pair_stable_sunflower_packing_at_most_one_forced_edge (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (r : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hroot : ∀ t ∈ P, r ∈ t) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1simple_graph_pair_stable_support_max_high_triangle_count_covers_activeIn LeanGraph Theory & Graph Algorithms
Let P be a support-maximal maximum triangle packing in a two-edge-stable graph. If every triangle-active vertex lies in at least |P| triangles, then P covers every triangle-active vertex.
theorem simple_graph_pair_stable_support_max_high_triangle_count_covers_active (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hlocal : ∀ y : Fin n, (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ y ∈ t) → P.card ≤ (((Finset.univ : Finset (Finset (Fin n))).filter (fun t => G.IsNClique 3 t ∧ y ∈ t)).card)) : ∀ x : Fin n, (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) → x ∈ P.biUnion idsimple_graph_pair_stable_support_max_near_high_triangle_count_covers_activeIn LeanGraph Theory & Graph Algorithms
If every active vertex of a two-edge-stable graph lies in at least |P|−1 triangles, then a support-maximal maximum packing P covers all active vertices.
theorem simple_graph_pair_stable_support_max_near_high_triangle_count_covers_active (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hlocal : ∀ y : Fin n, (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ y ∈ t) → P.card ≤ (((Finset.univ : Finset (Finset (Fin n))).filter (fun t => G.IsNClique 3 t ∧ y ∈ t)).card) + 1) : ∀ x : Fin n, (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) → x ∈ P.biUnion idsimple_graph_pair_stable_support_max_outside_face_shared_verticesIn LeanGraph Theory & Graph Algorithms
In a support-maximal maximum packing of a two-edge-stable graph, if an outside vertex x forms triangle abx on packed triangle abc, then c is private, x is nonadjacent to c, and the two retained vertices a and b occur in two distinct other packed triangles.
theorem simple_graph_pair_stable_support_max_outside_face_shared_vertices (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (a b c x : Fin n) (hp : ({a,b,c} : Finset (Fin n)) ∈ P) (hx : x ∉ P.biUnion id) (hface : G.IsNClique 3 ({a,b,x} : Finset (Fin n))) : (∀ q ∈ P, q ≠ ({a,b,c} : Finset (Fin n)) → c ∉ q) ∧ ¬ G.Adj x c ∧ ∃ qa ∈ P, ∃ qb ∈ P, qa ≠ ({a,b,c} : Finset (Fin n)) ∧ qb ≠ ({a,b,c} : Finset (Fin n)) ∧ qa ≠ qb ∧ a ∈ qa ∧ b ∈ qbsimple_graph_pair_stable_support_max_outside_five_private_nonneighborsIn LeanGraph Theory & Graph Algorithms
For a support-maximal maximum packing in a two-edge-stable graph, each active vertex outside the packing has at least five distinct nonneighbors in the packing support, each private to one packed triangle.
theorem simple_graph_pair_stable_support_max_outside_five_private_nonneighbors (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) : 5 ≤ (((P.biUnion id).filter (fun v => ¬ G.Adj x v ∧ ∃ p ∈ P, v ∈ p ∧ ∀ q ∈ P, q ≠ p → v ∉ q)).card)simple_graph_pair_stable_support_max_outside_has_triple_incidence_neighborIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph, any triangle-active vertex outside a support-maximal maximum packing has a neighbor contained in at least three packed triangles. Thus a support-maximal maximum packing in which every graph vertex belongs to at most two packed triangles covers every active vertex.
theorem simple_graph_pair_stable_support_max_outside_has_triple_incidence_neighbor (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) : ∃ v : Fin n, G.Adj x v ∧ 3 ≤ (P.filter (fun t => v ∈ t)).cardsimple_graph_pair_stable_support_max_outside_support_deficit_fiveIn LeanGraph Theory & Graph Algorithms
For a support-maximal maximum triangle packing of a two-edge-stable graph, the existence of a triangle-active outside vertex forces at least five units of overlap in the packing: its vertex support has size at most three times its size minus five.
theorem simple_graph_pair_stable_support_max_outside_support_deficit_five (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x : Fin n) (hx : x ∉ P.biUnion id) (hactive : ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) : (P.biUnion id).card + 5 ≤ 3 * P.cardsimple_graph_pair_stable_support_max_packing_number_le_five_covers_activeIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph with triangle-packing number at most five, every support-maximal maximum triangle packing covers every triangle-active vertex.
theorem simple_graph_pair_stable_support_max_packing_number_le_five_covers_active (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hfive : simple_graph_triangle_packing_number G ≤ 5) : ∀ x : Fin n, (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) → x ∈ P.biUnion idsimple_graph_pair_stable_support_max_packing_number_le_six_covers_activeIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph with triangle-packing number at most six, every support-maximal maximum triangle packing covers every triangle-active vertex.
theorem simple_graph_pair_stable_support_max_packing_number_le_six_covers_active (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hsix : simple_graph_triangle_packing_number G ≤ 6) : ∀ x : Fin n, (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) → x ∈ P.biUnion idsimple_graph_pair_stable_support_max_private_vertex_no_outside_triangleIn LeanGraph Theory & Graph Algorithms
For a support-maximal maximum packing in a two-edge-stable graph, a private packed vertex cannot share a graph triangle with any outside vertex. Consequently, after removing triangle-inactive edges, outside vertices have neighbors only among vertices shared by at least two packed triangles.
theorem simple_graph_pair_stable_support_max_private_vertex_no_outside_triangle (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (x v : Fin n) (p : Finset (Fin n)) (hx : x ∉ P.biUnion id) (hp : p ∈ P) (hv : v ∈ p) (hprivate : ∀ q ∈ P, q ≠ p → v ∉ q) : ¬ ∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t ∧ v ∈ tsimple_graph_pair_stable_support_max_pseudoforest_covers_active_verticesIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable finite graph, a maximum triangle packing with maximum vertex support covers all triangle-active vertices if the vertex-intersection graph of the packed triangles is a pseudoforest. The hypothesis counts intersecting unordered pairs in every packed subfamily.
theorem simple_graph_pair_stable_support_max_pseudoforest_covers_active_vertices (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (hpseudo : ∀ F : Finset (Finset (Fin n)), F ⊆ P → (F.sym2.filter (fun e => ¬ e.IsDiag ∧ ∃ t ∈ F, ∃ u ∈ F, e = s(t,u) ∧ ¬ Disjoint t u)).card ≤ F.card) : ∀ x : Fin n, (∃ t : Finset (Fin n), G.IsNClique 3 t ∧ x ∈ t) → x ∈ P.biUnion idsimple_graph_pair_stable_support_max_separated_pseudoforest_no_outside_linkIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph, no vertex outside a support-maximal maximum triangle packing spans an edge of a packed triangle in a vertex-separated pseudoforest subfamily. The pseudoforest condition counts intersecting unordered pairs in every subfamily.
theorem simple_graph_pair_stable_support_max_separated_pseudoforest_no_outside_link (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hsupport : ∀ Q : Finset (Finset (Fin n)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → (Q.biUnion id).card ≤ (P.biUnion id).card) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) (F : Finset (Finset (Fin n))) (hFsub : F ⊆ P) (hsep : ∀ t ∈ F, ∀ q ∈ P, q ∉ F → Disjoint t q) (hpseudo : ∀ A : Finset (Finset (Fin n)), A ⊆ F → (A.sym2.filter (fun e => ¬ e.IsDiag ∧ ∃ t ∈ A, ∃ u ∈ A, e = s(t,u) ∧ ¬ Disjoint t u)).card ≤ A.card) : ∀ x : Fin n, x ∉ P.biUnion id → ∀ t ∈ F, ∀ u ∈ t, ∀ v ∈ t, u ≠ v → G.Adj x u → ¬ G.Adj x vsimple_graph_pair_stable_two_disjoint_books_six_vertex_kernelIn LeanGraph Theory & Graph Algorithms
If every triangle of a two-edge-stable finite graph is either inside a set S or has one outside vertex and one of two vertex-disjoint edges of S, at most six outside vertices can be retained so that the induced graph has the same triangle-packing number and remains two-edge-stable.
theorem simple_graph_pair_stable_two_disjoint_books_six_vertex_kernel (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (S : Finset (Fin n)) (a b c d : Fin n) (habcd : ({a,b,c,d} : Finset (Fin n)).card = 4) (hS : ({a,b,c,d} : Finset (Fin n)) ⊆ S) (hclass : ∀ t : Finset (Fin n), G.IsNClique 3 t → t ⊆ S ∨ ∃ w, w ∉ S ∧ (t = {a,b,w} ∨ t = {c,d,w})) (hstable : ∀ e f : Sym2 (Fin n), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) : ∃ U : Finset (Fin n), Disjoint U S ∧ U.card ≤ 6 ∧ let H := G.induce (↑(S ∪ U) : Set (Fin n)); simple_graph_triangle_packing_number H = simple_graph_triangle_packing_number G ∧ ∀ e f : Sym2 {v : Fin n // v ∈ S ∪ U}, e ∈ H.edgeSet → f ∈ H.edgeSet → e ≠ f → simple_graph_triangle_packing_number (H.deleteEdges {e,f}) = simple_graph_triangle_packing_number Hsimple_graph_paired_fork_bij_half_independentIn LeanGraph Theory & Graph Algorithms
In a paired-fork graph on m pairs where the fork map i ↦ (w i).1 is bijective, every vertex z can be avoided by an independent set containing at least m vertices (at least half of the vertices).
theorem simple_graph_paired_fork_bij_half_independent
(m : ℕ) (G : SimpleGraph (Fin m × Fin 2)) (w : Fin m → Fin m × Fin 2)
(hw : ∀ i, (w i).1 ≠ i)
(hG : ∀ x y, G.Adj x y ↔
∃ i : Fin m, (x.1 = i ∧ y = w i) ∨ (y.1 = i ∧ x = w i))
(hbij : Function.Bijective (fun i => (w i).1))
(z : Fin m × Fin 2) :
∃ I : Finset (Fin m × Fin 2),
m ≤ I.card ∧ z ∉ I ∧ G.IsIndepSet (I : Set (Fin m × Fin 2))simple_graph_paired_fork_half_independent_avoiding_vertexIn LeanGraph Theory & Graph Algorithms
Partition the vertices of a finite graph into pairs and choose one vertex outside each pair. Join each endpoint of a pair to its chosen vertex and add no other edges. For every vertex z, there is an independent set of at least half the vertices that omits z.
theorem simple_graph_paired_fork_half_independent_avoiding_vertex
(m : ℕ) (G : SimpleGraph (Fin m × Fin 2)) (w : Fin m → Fin m × Fin 2)
(hw : ∀ i, (w i).1 ≠ i)
(hG : ∀ x y, G.Adj x y ↔
∃ i : Fin m, (x.1 = i ∧ y = w i) ∨ (y.1 = i ∧ x = w i)) :
∀ z : Fin m × Fin 2, ∃ I : Finset (Fin m × Fin 2),
m ≤ I.card ∧ z ∉ I ∧ G.IsIndepSet (I : Set (Fin m × Fin 2))simple_graph_paired_fork_half_independent_of_non_surjectiveIn LeanGraph Theory & Graph Algorithms
If the fork map i ↦ (w i).1 on m + 1 pairs is not surjective, then for any vertex z there exists an independent set of size at least m + 1 avoiding z, assuming the induction hypothesis for m pairs.
theorem simple_graph_paired_fork_half_independent_of_non_surjective
(m : ℕ) (G : SimpleGraph (Fin (m + 1) × Fin 2)) (w : Fin (m + 1) → Fin (m + 1) × Fin 2)
(hw : ∀ i, (w i).1 ≠ i)
(hG : ∀ x y, G.Adj x y ↔
∃ i : Fin (m + 1), (x.1 = i ∧ y = w i) ∨ (y.1 = i ∧ x = w i))
(hnonsurj : ¬ Function.Surjective (fun i => (w i).1))
(ih : ∀ (G' : SimpleGraph (Fin m × Fin 2)) (w' : Fin m → Fin m × Fin 2)
(hw' : ∀ i, (w' i).1 ≠ i)
(hG' : ∀ x y, G'.Adj x y ↔ ∃ i : Fin m, (x.1 = i ∧ y = w' i) ∨ (y.1 = i ∧ x = w' i))
(z' : Fin m × Fin 2),
∃ I' : Finset (Fin m × Fin 2), m ≤ I'.card ∧ z' ∉ I' ∧ G'.IsIndepSet (I' : Set (Fin m × Fin 2)))
(z : Fin (m + 1) × Fin 2) :
∃ I : Finset (Fin (m + 1) × Fin 2),
m + 1 ≤ I.card ∧ z ∉ I ∧ G.IsIndepSet (I : Set (Fin (m + 1) × Fin 2))simple_graph_paired_fork_one_center_extra_half_independentIn LeanGraph Theory & Graph Algorithms
If a paired-fork graph is augmented by edges all incident to one additional vertex, the resulting graph still has an independent set of at least half its vertices.
theorem simple_graph_paired_fork_one_center_extra_half_independent
(m : ℕ) (G H : SimpleGraph (Fin m × Fin 2)) (w : Fin m → Fin m × Fin 2)
(z : Fin m × Fin 2) (hw : ∀ i, (w i).1 ≠ i)
(hH : ∀ x y, H.Adj x y ↔
∃ i : Fin m, (x.1 = i ∧ y = w i) ∨ (y.1 = i ∧ x = w i))
(hG : ∀ x y, G.Adj x y → H.Adj x y ∨ x = z ∨ y = z) :
∃ I : Finset (Fin m × Fin 2), m ≤ I.card ∧ G.IsIndepSet (I : Set (Fin m × Fin 2))simple_graph_pendant_triple_expand_edge_casesIn LeanGraph Theory & Graph Algorithms
Every edge of the pendant-triple expansion is either the image of an old edge different from uv, or one of the seven new edges u-0, 0-1, 1-2, 2-v, 03, 14, 25.
theorem simple_graph_pendant_triple_expand_edge_cases {V : Type*} (G : SimpleGraph V) (u v : V)
(E : (simple_graph_pendant_triple_expand G u v).edgeSet) :
(∃ (e0 : G.edgeSet), (e0 : Sym2 V) ≠ s(u, v) ∧
(E : Sym2 (V ⊕ Fin 6)) = Sym2.map Sum.inl (e0 : Sym2 V)) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inl u, Sum.inr 0) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 0, Sum.inr 1) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 1, Sum.inr 2) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 2, Sum.inl v) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 0, Sum.inr 3) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 1, Sum.inr 4) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 2, Sum.inr 5)simple_graph_pendant_triple_expand_internal_adjIn LeanGraph Theory & Graph Algorithms
In the pendant-triple expansion the three new internal path vertices have exactly the expected neighbours: 0 is adjacent to u, 1 and 3; 1 is adjacent to 0, 2 and 4; 2 is adjacent to 1, v and 5.
theorem simple_graph_pendant_triple_expand_internal_adj {V : Type*} (G : SimpleGraph V) (u v : V) :
(∀ p : V ⊕ Fin 6, (simple_graph_pendant_triple_expand G u v).Adj (Sum.inr 0) p ↔
p = Sum.inl u ∨ p = Sum.inr 1 ∨ p = Sum.inr 3) ∧
(∀ p : V ⊕ Fin 6, (simple_graph_pendant_triple_expand G u v).Adj (Sum.inr 1) p ↔
p = Sum.inr 0 ∨ p = Sum.inr 2 ∨ p = Sum.inr 4) ∧
(∀ p : V ⊕ Fin 6, (simple_graph_pendant_triple_expand G u v).Adj (Sum.inr 2) p ↔
p = Sum.inr 1 ∨ p = Sum.inl v ∨ p = Sum.inr 5)simple_graph_pendant_triple_extend_paletteIn LeanGraph Theory & Graph Algorithms
At a cubic edge uv with edge colouring c, the two further incident edges ua1, ua2 at u and vb1, vb2 at v exist, and with x = c(uv) the colours along the boundary are pairwise distinct, so the subdivide-three palette contract applies and yields colours y, z, A, B, C; moreover if uv is a rich edge then the four boundary colours are pairwise distinct.
theorem simple_graph_pendant_triple_extend_palette {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(u v : V) (huv : G.Adj u v) (hu : G.degree u = 3) (hv : G.degree v = 3)
(c : G.lineGraph.Coloring (Fin 5)) :
∃ (x y z A B C : Fin 5) (a1 a2 b1 b2 : V)
(h1 : G.Adj u a1) (h2 : G.Adj u a2) (h3 : G.Adj v b1) (h4 : G.Adj v b2),
x = c ⟨s(u, v), huv⟩ ∧
G.neighborFinset u = {v, a1, a2} ∧ G.neighborFinset v = {u, b1, b2} ∧
[x, y, A].Pairwise (· ≠ ·) ∧ [y, z, B].Pairwise (· ≠ ·) ∧
[z, x, C].Pairwise (· ≠ ·) ∧
(([c ⟨s(u, a1), h1⟩, c ⟨s(u, a2), h2⟩, y, A].Pairwise (· ≠ ·)) ∨
([x, A, z, B].Pairwise (· ≠ ·))) ∧
(([x, A, z, B].Pairwise (· ≠ ·)) ∨ ([y, B, x, C].Pairwise (· ≠ ·))) ∧
(([y, B, x, C].Pairwise (· ≠ ·)) ∨
([z, C, c ⟨s(v, b1), h3⟩, c ⟨s(v, b2), h4⟩].Pairwise (· ≠ ·))) ∧
([c ⟨s(u, a1), h1⟩, c ⟨s(u, a2), h2⟩, c ⟨s(v, b1), h3⟩,
c ⟨s(v, b2), h4⟩].Pairwise (· ≠ ·) →
[c ⟨s(u, a1), h1⟩, c ⟨s(u, a2), h2⟩, y, A].Pairwise (· ≠ ·) ∧
[z, C, c ⟨s(v, b1), h3⟩, c ⟨s(v, b2), h4⟩].Pairwise (· ≠ ·)) ∧
(simple_graph_edge_is_rich G c ⟨s(u, v), huv⟩ →
[c ⟨s(u, a1), h1⟩, c ⟨s(u, a2), h2⟩, c ⟨s(v, b1), h3⟩,
c ⟨s(v, b2), h4⟩].Pairwise (· ≠ ·))simple_graph_pendant_triple_image_neighborsIn LeanGraph Theory & Graph Algorithms
Let r be an old edge different from uv, and let E be a copy of r in the expansion. Then every edge of the expansion adjacent to E is either the copy of an old edge adjacent to r (and different from uv), or one of the two new end edges u-0 and 2-v (the first only if u lies in r, the second only if v lies in r).
theorem simple_graph_pendant_triple_image_neighbors {V : Type*} (G : SimpleGraph V) (u v : V)
(r : G.edgeSet) (hr : (r : Sym2 V) ≠ s(u, v))
(E F : (simple_graph_pendant_triple_expand G u v).edgeSet)
(hE : (E : Sym2 (V ⊕ Fin 6)) = Sym2.map Sum.inl (r : Sym2 V))
(hF : (simple_graph_pendant_triple_expand G u v).lineGraph.Adj E F) :
(∃ (g : G.edgeSet), (g : Sym2 V) ≠ s(u, v) ∧ G.lineGraph.Adj r g ∧
(F : Sym2 (V ⊕ Fin 6)) = Sym2.map Sum.inl (g : Sym2 V)) ∨
((F : Sym2 (V ⊕ Fin 6)) = s(Sum.inl u, Sum.inr 0) ∧ u ∈ (r : Set V)) ∨
((F : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 2, Sum.inl v) ∧ v ∈ (r : Set V))simple_graph_pendant_triple_new_edge_richIn LeanGraph Theory & Graph Algorithms
In the recoloured pendant-triple expansion the three pendant edges 03, 14, 25 are rich. Moreover the path edge u-0 is rich whenever the colours of ua1, ua2, 0-1, 03 are pairwise distinct, the path edge 0-1 whenever those of u-0, 03, 1-2, 14 are, the path edge 1-2 whenever those of 0-1, 14, 2-v, 25 are, and the path edge 2-v whenever those of 1-2, 25, vb1, vb2 are.
theorem simple_graph_pendant_triple_new_edge_rich {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(u v : V) (c : G.lineGraph.Coloring (Fin 5)) (f : Sym2 V → Fin 5)
(hf : ∀ (e : Sym2 V) (h : e ∈ G.edgeSet), f e = c ⟨e, h⟩)
(a1 a2 b1 b2 : V) (h1 : G.Adj u a1) (h2 : G.Adj u a2) (h3 : G.Adj v b1) (h4 : G.Adj v b2)
(y z A B C x : Fin 5) (hnu : G.neighborFinset u = {v, a1, a2})
(hnv : G.neighborFinset v = {u, b1, b2})
(hxyA : [x, y, A].Pairwise (· ≠ ·)) (hyzB : [y, z, B].Pairwise (· ≠ ·))
(hzxC : [z, x, C].Pairwise (· ≠ ·)) :
(∀ E : (simple_graph_pendant_triple_expand G u v).edgeSet,
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 0, Sum.inr 3) →
simple_graph_edge_is_rich (simple_graph_pendant_triple_expand G u v)
(simple_graph_pendant_triple_recolor G u v f x y z A B C) E) ∧
(∀ E : (simple_graph_pendant_triple_expand G u v).edgeSet,
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 1, Sum.inr 4) →
simple_graph_edge_is_rich (simple_graph_pendant_triple_expand G u v)
(simple_graph_pendant_triple_recolor G u v f x y z A B C) E) ∧
(∀ E : (simple_graph_pendant_triple_expand G u v).edgeSet,
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 2, Sum.inr 5) →
simple_graph_edge_is_rich (simple_graph_pendant_triple_expand G u v)
(simple_graph_pendant_triple_recolor G u v f x y z A B C) E) ∧
(∀ E : (simple_graph_pendant_triple_expand G u v).edgeSet,
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inl u, Sum.inr 0) →
[c ⟨s(u, a1), h1⟩, c ⟨s(u, a2), h2⟩, y, A].Pairwise (· ≠ ·) →
simple_graph_edge_is_rich (simple_graph_pendant_triple_expand G u v)
(simple_graph_pendant_triple_recolor G u v f x y z A B C) E) ∧
(∀ E : (simple_graph_pendant_triple_expand G u v).edgeSet,
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 0, Sum.inr 1) →
[x, A, z, B].Pairwise (· ≠ ·) →
simple_graph_edge_is_rich (simple_graph_pendant_triple_expand G u v)
(simple_graph_pendant_triple_recolor G u v f x y z A B C) E) ∧
(∀ E : (simple_graph_pendant_triple_expand G u v).edgeSet,
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 1, Sum.inr 2) →
[y, B, x, C].Pairwise (· ≠ ·) →
simple_graph_edge_is_rich (simple_graph_pendant_triple_expand G u v)
(simple_graph_pendant_triple_recolor G u v f x y z A B C) E) ∧
(∀ E : (simple_graph_pendant_triple_expand G u v).edgeSet,
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 2, Sum.inl v) →
[z, C, c ⟨s(v, b1), h3⟩, c ⟨s(v, b2), h4⟩].Pairwise (· ≠ ·) →
simple_graph_edge_is_rich (simple_graph_pendant_triple_expand G u v)
(simple_graph_pendant_triple_recolor G u v f x y z A B C) E)simple_graph_pendant_triple_new_edge_rich_neighborIn LeanGraph Theory & Graph Algorithms
In the recoloured triple expansion each of the seven new edges u-0, 0-1, 1-2, 2-v, 03, 14, 25 is adjacent to a rich edge.
theorem simple_graph_pendant_triple_new_edge_rich_neighbor {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(u v : V) (c : G.lineGraph.Coloring (Fin 5)) (f : Sym2 V → Fin 5)
(hf : ∀ (e : Sym2 V) (h : e ∈ G.edgeSet), f e = c ⟨e, h⟩)
(a1 a2 b1 b2 : V) (h1 : G.Adj u a1) (h2 : G.Adj u a2) (h3 : G.Adj v b1) (h4 : G.Adj v b2)
(y z A B C x : Fin 5) (hnu : G.neighborFinset u = {v, a1, a2})
(hnv : G.neighborFinset v = {u, b1, b2})
(hxyA : [x, y, A].Pairwise (· ≠ ·)) (hyzB : [y, z, B].Pairwise (· ≠ ·))
(hzxC : [z, x, C].Pairwise (· ≠ ·))
(h4a : ([c ⟨s(u, a1), h1⟩, c ⟨s(u, a2), h2⟩, y, A].Pairwise (· ≠ ·)) ∨
([x, A, z, B].Pairwise (· ≠ ·)))
(h5a : ([x, A, z, B].Pairwise (· ≠ ·)) ∨ ([y, B, x, C].Pairwise (· ≠ ·)))
(h6a : ([y, B, x, C].Pairwise (· ≠ ·)) ∨
([z, C, c ⟨s(v, b1), h3⟩, c ⟨s(v, b2), h4⟩].Pairwise (· ≠ ·))) :
∀ E : (simple_graph_pendant_triple_expand G u v).edgeSet,
((E : Sym2 (V ⊕ Fin 6)) = s(Sum.inl u, Sum.inr 0) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 0, Sum.inr 1) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 1, Sum.inr 2) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 2, Sum.inl v) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 0, Sum.inr 3) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 1, Sum.inr 4) ∨
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 2, Sum.inr 5)) →
∃ F : (simple_graph_pendant_triple_expand G u v).edgeSet,
(simple_graph_pendant_triple_expand G u v).lineGraph.Adj E F ∧
simple_graph_edge_is_rich (simple_graph_pendant_triple_expand G u v)
(simple_graph_pendant_triple_recolor G u v f x y z A B C) Fsimple_graph_pendant_triple_old_edge_richIn LeanGraph Theory & Graph Algorithms
If r is an old edge different from uv which is rich for c, then its copy in the pendant-triple expansion is rich for the recolouring.
theorem simple_graph_pendant_triple_old_edge_rich {V : Type*} (G : SimpleGraph V) (u v : V)
(huv : G.Adj u v) (c : G.lineGraph.Coloring (Fin 5)) (f : Sym2 V → Fin 5)
(hf : ∀ (e : Sym2 V) (h : e ∈ G.edgeSet), f e = c ⟨e, h⟩)
(x y z A B C : Fin 5) (hx : x = c ⟨s(u, v), huv⟩)
(r : G.edgeSet) (hr : (r : Sym2 V) ≠ s(u, v))
(E : (simple_graph_pendant_triple_expand G u v).edgeSet)
(hE : (E : Sym2 (V ⊕ Fin 6)) = Sym2.map Sum.inl (r : Sym2 V))
(hrich : simple_graph_edge_is_rich G c r) :
simple_graph_edge_is_rich (simple_graph_pendant_triple_expand G u v)
(simple_graph_pendant_triple_recolor G u v f x y z A B C) Esimple_graph_pendant_triple_recolor_applyIn LeanGraph Theory & Graph Algorithms
Computation rules for the recolouring of the triple expansion: an edge which is the image of an unordered pair e0 keeps the colour f e0, and the seven new edges u-0, 0-1, 1-2, 2-v, 03, 14, 25 receive x, y, z, x, A, B, C respectively.
theorem simple_graph_pendant_triple_recolor_apply {V : Type*} (G : SimpleGraph V) (u v : V)
(f : Sym2 V → Fin 5) (x y z A B C : Fin 5) :
(∀ (E : (simple_graph_pendant_triple_expand G u v).edgeSet) (e0 : Sym2 V),
(E : Sym2 (V ⊕ Fin 6)) = Sym2.map Sum.inl e0 →
simple_graph_pendant_triple_recolor G u v f x y z A B C E = f e0) ∧
(∀ (E : (simple_graph_pendant_triple_expand G u v).edgeSet),
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inl u, Sum.inr 0) →
simple_graph_pendant_triple_recolor G u v f x y z A B C E = x) ∧
(∀ (E : (simple_graph_pendant_triple_expand G u v).edgeSet),
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 0, Sum.inr 1) →
simple_graph_pendant_triple_recolor G u v f x y z A B C E = y) ∧
(∀ (E : (simple_graph_pendant_triple_expand G u v).edgeSet),
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 1, Sum.inr 2) →
simple_graph_pendant_triple_recolor G u v f x y z A B C E = z) ∧
(∀ (E : (simple_graph_pendant_triple_expand G u v).edgeSet),
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 2, Sum.inl v) →
simple_graph_pendant_triple_recolor G u v f x y z A B C E = x) ∧
(∀ (E : (simple_graph_pendant_triple_expand G u v).edgeSet),
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 0, Sum.inr 3) →
simple_graph_pendant_triple_recolor G u v f x y z A B C E = A) ∧
(∀ (E : (simple_graph_pendant_triple_expand G u v).edgeSet),
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 1, Sum.inr 4) →
simple_graph_pendant_triple_recolor G u v f x y z A B C E = B) ∧
(∀ (E : (simple_graph_pendant_triple_expand G u v).edgeSet),
(E : Sym2 (V ⊕ Fin 6)) = s(Sum.inr 2, Sum.inr 5) →
simple_graph_pendant_triple_recolor G u v f x y z A B C E = C)simple_graph_pendant_triple_recolor_richIn LeanGraph Theory & Graph Algorithms
Given a rich-neighbor 5-edge-colouring of G and the palette data at the cubic edge uv (the two other neighbours at each end, the colours x,y,z,A,B,C and the three disjunctions of the subdivide-three contract, plus the fact that richness of uv forces the four boundary colours to be distinct), the recolouring of the pendant-triple expansion is again a rich-neighbor 5-edge-colouring.
theorem simple_graph_pendant_triple_recolor_rich {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(u v : V) (huv : G.Adj u v) (c : G.lineGraph.Coloring (Fin 5))
(hc : simple_graph_is_rich_neighbor_coloring G c) (f : Sym2 V → Fin 5)
(hf : ∀ (e : Sym2 V) (h : e ∈ G.edgeSet), f e = c ⟨e, h⟩)
(a1 a2 b1 b2 : V) (h1 : G.Adj u a1) (h2 : G.Adj u a2) (h3 : G.Adj v b1) (h4 : G.Adj v b2)
(y z A B C x : Fin 5) (hx : x = c ⟨s(u, v), huv⟩)
(hnu : G.neighborFinset u = {v, a1, a2}) (hnv : G.neighborFinset v = {u, b1, b2})
(hxyA : [x, y, A].Pairwise (· ≠ ·)) (hyzB : [y, z, B].Pairwise (· ≠ ·))
(hzxC : [z, x, C].Pairwise (· ≠ ·))
(h4a : ([c ⟨s(u, a1), h1⟩, c ⟨s(u, a2), h2⟩, y, A].Pairwise (· ≠ ·)) ∨
([x, A, z, B].Pairwise (· ≠ ·)))
(h5a : ([x, A, z, B].Pairwise (· ≠ ·)) ∨ ([y, B, x, C].Pairwise (· ≠ ·)))
(h6a : ([y, B, x, C].Pairwise (· ≠ ·)) ∨
([z, C, c ⟨s(v, b1), h3⟩, c ⟨s(v, b2), h4⟩].Pairwise (· ≠ ·)))
(h7a : [c ⟨s(u, a1), h1⟩, c ⟨s(u, a2), h2⟩, c ⟨s(v, b1), h3⟩,
c ⟨s(v, b2), h4⟩].Pairwise (· ≠ ·) →
[c ⟨s(u, a1), h1⟩, c ⟨s(u, a2), h2⟩, y, A].Pairwise (· ≠ ·) ∧
[z, C, c ⟨s(v, b1), h3⟩, c ⟨s(v, b2), h4⟩].Pairwise (· ≠ ·))
(h7b : simple_graph_edge_is_rich G c ⟨s(u, v), huv⟩ →
[c ⟨s(u, a1), h1⟩, c ⟨s(u, a2), h2⟩, c ⟨s(v, b1), h3⟩,
c ⟨s(v, b2), h4⟩].Pairwise (· ≠ ·)) :
∃ cc : (simple_graph_pendant_triple_expand G u v).lineGraph.Coloring (Fin 5),
simple_graph_is_rich_neighbor_coloring (simple_graph_pendant_triple_expand G u v) ccsimple_graph_pendant_triple_recolor_validIn LeanGraph Theory & Graph Algorithms
The recolouring of the pendant-triple expansion is a proper edge colouring: two distinct edges sharing a vertex never get the same colour, provided the two end edges get the colour x of uv and the three path and pendant colour triples x,y,A; y,z,B; z,x,C are pairwise distinct.
theorem simple_graph_pendant_triple_recolor_valid {V : Type*} (G : SimpleGraph V) (u v : V)
(huv : G.Adj u v) (c : G.lineGraph.Coloring (Fin 5)) (f : Sym2 V → Fin 5)
(hf : ∀ (e : Sym2 V) (h : e ∈ G.edgeSet), f e = c ⟨e, h⟩)
(y z A B C x : Fin 5) (hx : x = c ⟨s(u, v), huv⟩)
(hxyA : [x, y, A].Pairwise (· ≠ ·)) (hyzB : [y, z, B].Pairwise (· ≠ ·))
(hzxC : [z, x, C].Pairwise (· ≠ ·)) :
∀ E F : (simple_graph_pendant_triple_expand G u v).edgeSet,
(simple_graph_pendant_triple_expand G u v).lineGraph.Adj E F →
simple_graph_pendant_triple_recolor G u v f x y z A B C E ≠
simple_graph_pendant_triple_recolor G u v f x y z A B C Fsimple_graph_power_eq_top_of_diam_leIn LeanGraph Theory & Graph Algorithms
For any finite connected graph G and any d ≥ diam(G), the d-th graph power G^d is the complete graph ⊤.
theorem simple_graph_power_eq_top_of_diam_le {V : Type*} [Fintype V] (G : SimpleGraph V) (hconn : G.Connected) (d : ℕ) (hd : G.diam ≤ d) : simple_graph_power G d = ⊤simple_graph_power_is_well_covered_of_diam_leIn LeanGraph Theory & Graph Algorithms
For any finite connected graph G and any d ≥ diam(G), the power G^d is well-covered (since it is the complete graph).
theorem simple_graph_power_is_well_covered_of_diam_le {V : Type*} [Fintype V] (G : SimpleGraph V) (hconn : G.Connected) (d : ℕ) (hd : G.diam ≤ d) : simple_graph_is_well_covered (simple_graph_power G d)simple_graph_power_two_opNorm_le_sqIn LeanGraph Theory & Graph Algorithms
The operator norm of the continuous linear map induced by the adjacency matrix of the square of G is at most the square of the operator norm of the continuous linear map induced by the adjacency matrix of G.
attribute [local instance] Classical.propDecidable in
theorem simple_graph_power_two_opNorm_le_sq {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) :
‖Matrix.toEuclideanCLM (𝕜 := ℝ) (n := V) ((simple_graph_power G 2).adjMatrix ℝ)‖ ≤
‖Matrix.toEuclideanCLM (𝕜 := ℝ) (n := V) (G.adjMatrix ℝ)‖ ^ 2simple_graph_prism_adj_iffIn LeanGraph Theory & Graph Algorithms
In the prism graph P₁ □ C_n two vertices (a,i) and (b,j) are adjacent exactly when either they sit in the same fibre of the cycle and their fibres differ (a ≠ b, i = j), or they sit in the same layer and are adjacent in C_n (a = b and C_n-adjacent).
theorem simple_graph_prism_adj_iff (n : ℕ) (u v : Fin 2 × Fin n) :
(simple_graph_prism n).Adj u v ↔
(u.1 ≠ v.1 ∧ u.2 = v.2) ∨ (u.1 = v.1 ∧ (SimpleGraph.cycleGraph n).Adj u.2 v.2)simple_graph_prism_even_leap_group_card_geIn LeanGraph Theory & Graph Algorithms
For even n ≥ 3 the leap group of P₁ □ C_n has at least 2·(n!)² elements.
theorem simple_graph_prism_even_leap_group_card_ge (n : ℕ) (h3 : 3 ≤ n) (he : Even n) :
2 * n.factorial ^ 2 ≤ Nat.card (simple_graph_leap_group (simple_graph_prism n))simple_graph_prism_even_leap_group_card_leIn LeanGraph Theory & Graph Algorithms
For even n ≥ 3 the leap group of P₁ □ C_n has at most 2·(n!)² elements.
theorem simple_graph_prism_even_leap_group_card_le (n : ℕ) (h3 : 3 ≤ n) (he : Even n) :
Nat.card (simple_graph_leap_group (simple_graph_prism n)) ≤ 2 * n.factorial ^ 2simple_graph_prism_even_leap_group_contains_swapsIn LeanGraph Theory & Graph Algorithms
For even n ≥ 3, the transposition of two vertices of P₁ □ C_n lying in the same parity class (a + i ≡ b + j mod 2) belongs to the leap group.
theorem simple_graph_prism_even_leap_group_contains_swaps (n : ℕ) (h3 : 3 ≤ n) (he : Even n)
(u v : Fin 2 × Fin n) (huv : u ≠ v)
(hpar : (u.1.val + u.2.val) % 2 = (v.1.val + v.2.val) % 2) :
Equiv.swap u v ∈ simple_graph_leap_group (simple_graph_prism n)simple_graph_prism_odd_leap_group_eq_topIn LeanGraph Theory & Graph Algorithms
For odd n ≥ 3, the leap group of the prism graph P₁ □ C_n is the full symmetric group on its 2n vertices.
theorem simple_graph_prism_odd_leap_group_eq_top (n : ℕ) (h3 : 3 ≤ n) (ho : Odd n) :
simple_graph_leap_group (simple_graph_prism n) = ⊤simple_graph_prism_parity_class_cardIn LeanGraph Theory & Graph Algorithms
For n > 0, the two classes {(a,i) : a + i ≡ b mod 2} of the prism each have n elements: i ↦ (b mod 2, i) is a bijection onto the b-class.
theorem simple_graph_prism_parity_class_card (n : ℕ) (hn : 0 < n) (b : ℕ) :
(Finset.univ.filter (fun v : Fin 2 × Fin n => (v.1.val + v.2.val) % 2 = b % 2)).card = nsimple_graph_prism_vertical_flip_memIn LeanGraph Theory & Graph Algorithms
Swapping the two layers of the prism P₁ □ C_n, (a,i) ↦ (1-a,i), is a hop, hence an element of the leap group.
theorem simple_graph_prism_vertical_flip_mem (n : ℕ) :
Equiv.prodCongr (Equiv.swap (0 : Fin 2) 1) (Equiv.refl (Fin n)) ∈
simple_graph_leap_group (simple_graph_prism n)simple_graph_q_delete_vertexIn LeanGraph Theory & Graph Algorithms
For every vertex $v$ of a finite simple graph $H$, the invariant $q(H) = C_H(-1)$ satisfies the recurrence $q(H) = q(H-v) - q(H[N_H(v)])$.
open scoped Classical in
theorem simple_graph_q_delete_vertex {V : Type*} [Fintype V] (H : SimpleGraph V) (v : V) :
simple_graph_q H =
simple_graph_q (H.induce ({v}ᶜ : Set V)) -
simple_graph_q (H.induce (H.neighborSet v))simple_graph_q_eq_zero_of_stepIn LeanGraph Theory & Graph Algorithms
Let G be a finite simple graph and v a vertex of G. If q vanishes on the open neighbourhood graph of v and on the vertex deletion G - v, then q(G) = 0.
open scoped Classical in
theorem simple_graph_q_eq_zero_of_step (V : Type) [Fintype V] (G : SimpleGraph V) (v : V)
(h_elig : simple_graph_q (G.induce (G.neighborSet v)) = 0)
(h_rem : simple_graph_q (G.induce {w : V | w ≠ v}) = 0) :
simple_graph_q G = 0simple_graph_q_foldIn LeanGraph Theory & Graph Algorithms
If a vertex $v$ is dominated by another vertex in a finite simple graph $H$, then $q(H) = q(H-v)$.
open scoped Classical in
theorem simple_graph_q_fold {V : Type*} [Fintype V] (H : SimpleGraph V) (v : V)
(hdom : simple_graph_vertex_dominated H v) :
simple_graph_q H = simple_graph_q (H.induce ({v}ᶜ : Set V))simple_graph_q_subsingletonIn LeanGraph Theory & Graph Algorithms
Every simple graph on a nonempty subsingleton vertex type has vanishing alternating clique count: q(G) = 0.
theorem simple_graph_q_subsingleton (V : Type*) [Fintype V] [Subsingleton V] [Nonempty V] (G : SimpleGraph V) :
simple_graph_q G = 0simple_graph_reconfiguration_diam_ge_hammingIn LeanGraph Theory & Graph Algorithms
If the reconfiguration graph of k-colourings of a finite graph G has finite diameter, then any two k-colourings differ in at most diam many vertices.
theorem simple_graph_reconfiguration_diam_ge_hamming {V : Type*} [Fintype V] {G : SimpleGraph V} {k : ℕ} (a b : G.Coloring (Fin k)) (h : (simple_graph_reconfiguration_graph G k).ediam ≠ ⊤) : (Finset.univ.filter (fun v => a v ≠ b v)).card ≤ (simple_graph_reconfiguration_graph G k).diamsimple_graph_reconfiguration_edist_ge_hammingIn LeanGraph Theory & Graph Algorithms
For two k-colourings of a finite graph G, the number of vertices where they differ, viewed in ℕ∞, is at most their extended distance in the reconfiguration graph.
theorem simple_graph_reconfiguration_edist_ge_hamming {V : Type*} [Fintype V] {G : SimpleGraph V} {k : ℕ} (a b : G.Coloring (Fin k)) : ((Finset.univ.filter (fun v => a v ≠ b v)).card : ℕ∞) ≤ (simple_graph_reconfiguration_graph G k).edist a bsimple_graph_reconfiguration_graph_adj_iffIn LeanGraph Theory & Graph Algorithms
Two proper k-colourings of G are adjacent in the k-recolour graph exactly when they differ on a unique vertex.
theorem simple_graph_reconfiguration_graph_adj_iff {V : Type*} (G : SimpleGraph V) (k : ℕ) (c₁ c₂ : G.Coloring (Fin k)) : (simple_graph_reconfiguration_graph G k).Adj c₁ c₂ ↔ ∃! v, c₁ v ≠ c₂ vsimple_graph_reconfiguration_walk_hamming_leIn LeanGraph Theory & Graph Algorithms
If two k-colourings of a finite graph G are joined by a walk of length L in the reconfiguration graph, then they differ in at most L vertices.
theorem simple_graph_reconfiguration_walk_hamming_le {V : Type*} [Fintype V] {G : SimpleGraph V} {k : ℕ} : ∀ (a b : G.Coloring (Fin k)) (w : (simple_graph_reconfiguration_graph G k).Walk a b), (Finset.univ.filter (fun v => a v ≠ b v)).card ≤ w.lengthsimple_graph_rich_neighbor_five_pendant_triple_extendIn LeanGraph Theory & Graph Algorithms
If uv has both endpoints of degree three and G admits a rich-neighbor five-edge-coloring, replacing uv by a four-edge path with one pendant leaf at each new internal vertex preserves existence of such a coloring.
theorem simple_graph_rich_neighbor_five_pendant_triple_extend {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(u v : V) (huv : G.Adj u v) (hu : G.degree u = 3) (hv : G.degree v = 3)
(hc : ∃ c : G.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring G c) :
∃ c : (simple_graph_pendant_triple_expand G u v).lineGraph.Coloring (Fin 5),
simple_graph_is_rich_neighbor_coloring (simple_graph_pendant_triple_expand G u v) csimple_graph_sibling_leaves_is_fortIn LeanGraph Theory & Graph Algorithms
Two leaves sharing a common neighbor in any finite simple graph form a fort of size two.
theorem simple_graph_sibling_leaves_is_fort {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] {a b c : V} (hab : a ≠ b) (ha : G.degree a = 1) (hb : G.degree b = 1) (hac : G.Adj a c) (hbc : G.Adj b c) : simple_graph_is_fort G ({a, b} : Set V)simple_graph_single_edge_stable_outside_active_vertices_le_packingIn LeanGraph Theory & Graph Algorithms
In a single-edge-stable finite graph, the number of triangle-active vertices outside any maximum triangle packing is at most the packing size.
theorem simple_graph_single_edge_stable_outside_active_vertices_le_packing (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hstable : ∀ e : Sym2 (Fin n), e ∈ G.edgeSet → simple_graph_triangle_packing_number (G.deleteEdges {e}) = simple_graph_triangle_packing_number G) : ((((Finset.univ : Finset (Finset (Fin n))).filter (G.IsNClique 3)).biUnion id) \ P.biUnion id).card ≤ P.cardsimple_graph_single_edge_stable_triangle_active_vertices_linear_boundIn LeanGraph Theory & Graph Algorithms
If every single-edge deletion of a finite simple graph preserves its triangle packing number k, at most 4k vertices lie in triangles.
theorem simple_graph_single_edge_stable_triangle_active_vertices_linear_bound (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hstable : ∀ e : Sym2 (Fin n), e ∈ G.edgeSet → simple_graph_triangle_packing_number (G.deleteEdges {e}) = simple_graph_triangle_packing_number G) : (((Finset.univ : Finset (Finset (Fin n))).filter (G.IsNClique 3)).biUnion id).card ≤ 4 * simple_graph_triangle_packing_number Gsimple_graph_single_edge_stable_triangle_active_vertices_quadratic_boundIn LeanGraph Theory & Graph Algorithms
If a finite simple graph has triangle packing number k at least two and every single-edge deletion preserves k, at most k(k+2) vertices lie in triangles.
theorem simple_graph_single_edge_stable_triangle_active_vertices_quadratic_bound (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hstable : ∀ e : Sym2 (Fin n), e ∈ G.edgeSet → simple_graph_triangle_packing_number (G.deleteEdges {e}) = simple_graph_triangle_packing_number G) (hk : 2 ≤ simple_graph_triangle_packing_number G) : (((Finset.univ : Finset (Finset (Fin n))).filter (G.IsNClique 3)).biUnion id).card ≤ simple_graph_triangle_packing_number G * (simple_graph_triangle_packing_number G + 2)simple_graph_singleton_witness_disjoint_eraseIn LeanGraph Theory & Graph Algorithms
If a triangle t has exactly one edge in the packing union and meets p in an edge, then its edges are disjoint from all triangles in P \ {p}.
theorem simple_graph_singleton_witness_disjoint_erase {V : Type*} [DecidableEq V] (P : Finset (Finset V)) (p : Finset V) (hp : p ∈ P) (t : Finset V) (hsingle : (finite_vertex_set_edge_encoding t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1) (hmeets : ¬ Disjoint (finite_vertex_set_edge_encoding t) (finite_vertex_set_edge_encoding p)) (hdisj : (P : Set (Finset V)).Pairwise (fun a b => (a ∩ b).card ≤ 1)) : Disjoint (finite_vertex_set_edge_encoding t) ((P.erase p).biUnion finite_vertex_set_edge_encoding)simple_graph_spanning_path_of_indepNum_le_vertex_connectivityIn LeanGraph Theory & Graph Algorithms
Chvátal–Erdős, path form: a finite preconnected graph with at least one vertex whose independence number is at most its vertex connectivity has a Hamiltonian (spanning) path.
theorem simple_graph_spanning_path_of_indepNum_le_vertex_connectivity {V : Type*} [Fintype V] [DecidableEq V] [Nonempty V] (G : SimpleGraph V) (hconn : G.Preconnected) (hα : G.indepNum ≤ ghz_graph_vertex_connectivity G) : ∃ a b : V, ∃ p : G.Walk a b, p.IsHamiltoniansimple_graph_stable_conflict_independence_apex_edge_countIn LeanGraph Theory & Graph Algorithms
Any family of pairwise edge-disjoint triangles drawn from the 19 triangles has at most six members, and if it has six then one of its members is a leaf triangle, and it covers every apex edge: for every v = 1,...,10 some member contains the edge {0,v}.
theorem simple_graph_stable_conflict_independence_apex_edge_count
(Q : Finset (Finset (Sym2 (Fin 11))))
(hQ : Q ⊆ simple_graph_stable_conflict_independence_triangles)
(hdisj : (Q : Set (Finset (Sym2 (Fin 11)))).Pairwise Disjoint) :
Q.card ≤ 6 ∧
(Q.card = 6 → ∃ t ∈ Q,
(t ∩ simple_graph_stable_conflict_independence_apex_edges).card = 0) ∧
(Q.card = 6 → ∀ v : Fin 11, v ≠ 0 →
∃ t ∈ Q, Sym2.mk (0 : Fin 11) v ∈ t)simple_graph_stable_conflict_independence_conflict_clauseIn LeanGraph Theory & Graph Algorithms
No five of the ten unmarked apex edges form a conflict-free set: every 5-element set I of apex edges meets one of the 19 triangles in exactly two edges, in a triangle that is not contained in the 15-edge packing support.
theorem simple_graph_stable_conflict_independence_conflict_clause
(I : Finset (Sym2 (Fin 11)))
(hI : I ⊆ simple_graph_stable_conflict_independence_apex_edges)
(hcard : I.card = 5) :
∃ t ∈ simple_graph_stable_conflict_independence_triangles,
(t ∩ I).card = 2 ∧
¬ t ⊆ simple_graph_stable_conflict_independence_packing_supportsimple_graph_stable_conflict_independence_counterexampleIn LeanGraph Theory & Graph Algorithms
There is an 11-vertex graph with a maximum packing of five edge-disjoint triangles, each graph edge omitted by some maximum packing, and a marking of one edge per packed triangle including every singleton-forced edge, such that the unmarked conflict graph has no independent set of size five.
theorem simple_graph_stable_conflict_independence_counterexample :
∃ (G : SimpleGraph (Fin 11))
(P : Finset (Finset (Sym2 (Fin 11)))) (M : Finset (Sym2 (Fin 11))),
let F := simple_graph_triangle_edge_family G
let U := P.biUnion id
P ⊆ F ∧ P.card = 5 ∧
(P : Set (Finset (Sym2 (Fin 11)))).Pairwise Disjoint ∧
(∀ Q : Finset (Finset (Sym2 (Fin 11))),
Q ⊆ F → (Q : Set (Finset (Sym2 (Fin 11)))).Pairwise Disjoint → Q.card ≤ 5) ∧
(∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset (Sym2 (Fin 11))),
Q ⊆ F ∧ Q.card = 5 ∧
(Q : Set (Finset (Sym2 (Fin 11)))).Pairwise Disjoint ∧ e ∉ Q.biUnion id) ∧
M ⊆ U ∧ (∀ p ∈ P, (M ∩ p).card = 1) ∧
(((F.filter (fun t => (t ∩ U).card = 1)).biUnion id) ∩ U) ⊆ M ∧
(∀ I : Finset (Sym2 (Fin 11)), I ⊆ U \ M → I.card = 5 →
∃ t ∈ F, (t ∩ I).card = 2 ∧ ¬ t ⊆ U)simple_graph_stable_conflict_independence_packing_boundIn LeanGraph Theory & Graph Algorithms
Maximum-packing bound: any family of pairwise edge-disjoint triangles drawn from the 19 triangles of the counterexample graph has at most five members, so the five-triangle packing is maximum and the packing number of the graph is exactly five.
theorem simple_graph_stable_conflict_independence_packing_bound
(Q : Finset (Finset (Sym2 (Fin 11))))
(hQ : Q ⊆ simple_graph_stable_conflict_independence_triangles)
(hdisj : (Q : Set (Finset (Sym2 (Fin 11)))).Pairwise Disjoint) :
Q.card ≤ 5simple_graph_stable_conflict_independence_triangle_local_factsIn LeanGraph Theory & Graph Algorithms
Local facts about the 19 triangles: each triangle uses at most two apex edges; the only triangles using no apex edge are the two leaves {1,3,7} and {1,5,7}, which share the edge {1,7}; a triangle containing {0,1} is one of {0,1,3}, {0,1,5}, {0,1,7} (so it contains the matching base edge and the matching apex edge); a triangle containing {0,7} is one of {0,1,7}, {0,3,7}, {0,5,7}; and there are exactly ten apex edges.
theorem simple_graph_stable_conflict_independence_triangle_local_facts :
(∀ t ∈ simple_graph_stable_conflict_independence_triangles,
(t ∩ simple_graph_stable_conflict_independence_apex_edges).card ≤ 2) ∧
(∀ t ∈ simple_graph_stable_conflict_independence_triangles,
((t ∩ simple_graph_stable_conflict_independence_apex_edges).card = 0 ↔
t = simple_graph_stable_conflict_independence_leaf_one ∨
t = simple_graph_stable_conflict_independence_leaf_two)) ∧
(∀ t ∈ simple_graph_stable_conflict_independence_triangles,
Sym2.mk (0 : Fin 11) 1 ∈ t →
((Sym2.mk (1 : Fin 11) 3 ∈ t ∧ Sym2.mk (0 : Fin 11) 3 ∈ t) ∨
(Sym2.mk (1 : Fin 11) 5 ∈ t ∧ Sym2.mk (0 : Fin 11) 5 ∈ t) ∨
(Sym2.mk (1 : Fin 11) 7 ∈ t ∧ Sym2.mk (0 : Fin 11) 7 ∈ t))) ∧
(∀ t ∈ simple_graph_stable_conflict_independence_triangles,
Sym2.mk (0 : Fin 11) 7 ∈ t →
((Sym2.mk (1 : Fin 11) 7 ∈ t ∧ Sym2.mk (0 : Fin 11) 1 ∈ t) ∨
(Sym2.mk (3 : Fin 11) 7 ∈ t ∧ Sym2.mk (0 : Fin 11) 3 ∈ t) ∨
(Sym2.mk (5 : Fin 11) 7 ∈ t ∧ Sym2.mk (0 : Fin 11) 5 ∈ t))) ∧
¬ Disjoint simple_graph_stable_conflict_independence_leaf_one
simple_graph_stable_conflict_independence_leaf_two ∧
(simple_graph_stable_conflict_independence_apex_edges).card = 10simple_graph_stable_connected_triangle_family_every_packing_fully_forced_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a 6-connected 6-regular 20-vertex graph with 60 edges, triangle codegrees two or three, packing number twelve, stable edge deletion, and a connected triangle-intersection graph, such that every maximum packing contains a fully singleton-forced triangle.
theorem simple_graph_stable_connected_triangle_family_every_packing_fully_forced_counterexample :
∃ (G : SimpleGraph (Fin 20)) (E : Finset (Sym2 (Fin 20))),
let F := simple_graph_triangle_edge_family G
(↑E : Set (Sym2 (Fin 20))) = G.edgeSet ∧ E.card = 60 ∧
(∀ v : Fin 20, ∃ N : Finset (Fin 20), N.card = 6 ∧ ∀ w, G.Adj v w ↔ w ∈ N) ∧
(∀ Q : Finset (Finset (Sym2 (Fin 20))), Q ⊆ F →
(Q : Set (Finset (Sym2 (Fin 20)))).Pairwise Disjoint → Q.card ≤ 12) ∧
(∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset (Sym2 (Fin 20))),
Q ⊆ F ∧ Q.card = 12 ∧
(Q : Set (Finset (Sym2 (Fin 20)))).Pairwise Disjoint ∧ e ∉ Q.biUnion id) ∧
(∀ e ∈ G.edgeSet, 2 ≤ (F.filter (fun t => e ∈ t)).card ∧
(F.filter (fun t => e ∈ t)).card ≤ 3) ∧
(∀ R : Finset (Fin 20), R.card ≤ 5 → (G.induce {v | v ∉ R}).Connected) ∧
(∀ a ∈ F, ∀ b ∈ F, Relation.ReflTransGen
(fun x y : Finset (Sym2 (Fin 20)) => x ∈ F ∧ y ∈ F ∧ ¬ Disjoint x y) a b) ∧
∀ P : Finset (Finset (Sym2 (Fin 20))),
P ⊆ F → P.card = 12 →
(P : Set (Finset (Sym2 (Fin 20)))).Pairwise Disjoint →
∃ p ∈ P, p ⊆ ((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)simple_graph_stable_forced_anchor_max_incidence_counterexampleIn LeanGraph Theory & Graph Algorithms
Even among full-support maximum packings maximizing the sum of squared vertex incidence counts, a two-edge-stable graph can have a fully forced K4 face whose anchor is contained only in unforced packed triangles.
theorem simple_graph_stable_forced_anchor_max_incidence_counterexample : let P : Finset (Finset (Fin 10)) := {{0,1,5},{0,2,3},{2,8,9},{2,6,7},{3,7,8},{5,6,8},{3,6,9},{4,5,9}}; ∃ G : SimpleGraph (Fin 10), (∀ t ∈ P, G.IsNClique 3 t) ∧ (P : Set (Finset (Fin 10))).Pairwise (fun t u => (t ∩ u).card ≤ 1) ∧ P.card = simple_graph_triangle_packing_number G ∧ P.biUnion id = Finset.univ ∧ (∀ Q : Finset (Finset (Fin 10)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin 10))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → Q.biUnion id = Finset.univ → (∑ v : Fin 10, ((Q.filter (fun t => v ∈ t)).card)^2) ≤ (∑ v : Fin 10, ((P.filter (fun t => v ∈ t)).card)^2)) ∧ (∀ e f : Sym2 (Fin 10), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) ∧ G.IsNClique 4 ({1,2,8,9} : Finset (Fin 10)) ∧ ({2,8,9} : Finset (Fin 10)) ∈ P ∧ finite_vertex_set_edge_encoding ({2,8,9} : Finset (Fin 10)) ⊆ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id) ∧ (∃ q ∈ P, (1 : Fin 10) ∈ q) ∧ (∀ q ∈ P, (1 : Fin 10) ∈ q → Disjoint (finite_vertex_set_edge_encoding q) (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id))simple_graph_stable_forced_anchor_three_exchange_barrier_counterexampleIn LeanGraph Theory & Graph Algorithms
In a two-edge-stable graph, a full-support maximum packing maximizing squared incidences can remain bad under every exchange of at most three triangles that preserves full support and does not decrease that score.
theorem simple_graph_stable_forced_anchor_three_exchange_barrier_counterexample : let P : Finset (Finset (Fin 10)) := {{0,2,3},{0,4,5},{1,5,9},{2,6,7},{2,8,9},{3,6,9},{3,7,8},{5,6,8}}; ∃ G : SimpleGraph (Fin 10), (∀ t ∈ P, G.IsNClique 3 t) ∧ (P : Set (Finset (Fin 10))).Pairwise (fun t u => (t ∩ u).card ≤ 1) ∧ P.card = simple_graph_triangle_packing_number G ∧ P.biUnion id = Finset.univ ∧ (∀ Q : Finset (Finset (Fin 10)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin 10))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → Q.biUnion id = Finset.univ → (∑ v : Fin 10, ((Q.filter (fun t => v ∈ t)).card)^2) ≤ (∑ v : Fin 10, ((P.filter (fun t => v ∈ t)).card)^2)) ∧ (∀ e f : Sym2 (Fin 10), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) ∧ (∀ Q : Finset (Finset (Fin 10)), (∀ t ∈ Q, G.IsNClique 3 t) → (Q : Set (Finset (Fin 10))).Pairwise (fun t u => (t ∩ u).card ≤ 1) → Q.card = P.card → Q.biUnion id = Finset.univ → (∑ v : Fin 10, ((P.filter (fun t => v ∈ t)).card)^2) ≤ (∑ v : Fin 10, ((Q.filter (fun t => v ∈ t)).card)^2) → (P \ Q).card ≤ 3 → ∃ q ∈ Q, finite_vertex_set_edge_encoding q ⊆ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ Q.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id))simple_graph_stable_forced_k4_anchor_avoiding_packings_one_clique_one_mixedIn LeanGraph Theory & Graph Algorithms
For a distinct clique edge of {4,5,6,7,8} and a distinct edge leaving the clique, there is a family of eight pairwise edge-disjoint triangles of the witness graph avoiding both edges.
theorem simple_graph_stable_forced_k4_anchor_avoiding_packings_one_clique_one_mixed :
∀ e f : Sym2 (Fin 9),
e ∈ simple_graph_stable_forced_k4_anchor_test_graph.edgeSet →
f ∈ simple_graph_stable_forced_k4_anchor_test_graph.edgeSet → e ≠ f →
e ∈ finite_vertex_set_edge_encoding ({4,5,6,7,8} : Finset (Fin 9)) →
f ∉ finite_vertex_set_edge_encoding ({4,5,6,7,8} : Finset (Fin 9)) →
∃ Q : Finset (Finset (Fin 9)),
(∀ t ∈ Q, simple_graph_stable_forced_k4_anchor_test_graph.IsNClique 3 t) ∧
(Q : Set (Finset (Fin 9))).Pairwise (fun s t => (s ∩ t).card ≤ 1) ∧
Q.card = 8 ∧
∀ t ∈ Q, e ∉ finite_vertex_set_edge_encoding t ∧ f ∉ finite_vertex_set_edge_encoding tsimple_graph_stable_forced_k4_anchor_avoiding_packings_two_clique_edgesIn LeanGraph Theory & Graph Algorithms
For any two distinct edges of the K5 on {4,5,6,7,8} there is a family of eight pairwise edge-disjoint triangles of the witness graph avoiding both edges.
theorem simple_graph_stable_forced_k4_anchor_avoiding_packings_two_clique_edges :
∀ e f : Sym2 (Fin 9),
e ∈ simple_graph_stable_forced_k4_anchor_test_graph.edgeSet →
f ∈ simple_graph_stable_forced_k4_anchor_test_graph.edgeSet → e ≠ f →
e ∈ finite_vertex_set_edge_encoding ({4,5,6,7,8} : Finset (Fin 9)) →
f ∈ finite_vertex_set_edge_encoding ({4,5,6,7,8} : Finset (Fin 9)) →
∃ Q : Finset (Finset (Fin 9)),
(∀ t ∈ Q, simple_graph_stable_forced_k4_anchor_test_graph.IsNClique 3 t) ∧
(Q : Set (Finset (Fin 9))).Pairwise (fun s t => (s ∩ t).card ≤ 1) ∧
Q.card = 8 ∧
∀ t ∈ Q, e ∉ finite_vertex_set_edge_encoding t ∧ f ∉ finite_vertex_set_edge_encoding tsimple_graph_stable_forced_k4_anchor_avoiding_packings_two_mixed_edgesIn LeanGraph Theory & Graph Algorithms
For two distinct edges leaving the clique {4,5,6,7,8}, there is a family of eight pairwise edge-disjoint triangles of the witness graph avoiding both edges.
theorem simple_graph_stable_forced_k4_anchor_avoiding_packings_two_mixed_edges :
∀ e f : Sym2 (Fin 9),
e ∈ simple_graph_stable_forced_k4_anchor_test_graph.edgeSet →
f ∈ simple_graph_stable_forced_k4_anchor_test_graph.edgeSet → e ≠ f →
e ∉ finite_vertex_set_edge_encoding ({4,5,6,7,8} : Finset (Fin 9)) →
f ∉ finite_vertex_set_edge_encoding ({4,5,6,7,8} : Finset (Fin 9)) →
∃ Q : Finset (Finset (Fin 9)),
(∀ t ∈ Q, simple_graph_stable_forced_k4_anchor_test_graph.IsNClique 3 t) ∧
(Q : Set (Finset (Fin 9))).Pairwise (fun s t => (s ∩ t).card ≤ 1) ∧
Q.card = 8 ∧
∀ t ∈ Q, e ∉ finite_vertex_set_edge_encoding t ∧ f ∉ finite_vertex_set_edge_encoding tsimple_graph_stable_forced_k4_anchor_forcingIn LeanGraph Theory & Graph Algorithms
Each of the three edges of {5,7,8} lies in a triangle meeting the packing's edge support in exactly one edge, and every packed triangle containing vertex 1 is edge-disjoint from the union of all such single-hit triangles.
theorem simple_graph_stable_forced_k4_anchor_forcing :
finite_vertex_set_edge_encoding ({5,7,8} : Finset (Fin 9)) ⊆
(((simple_graph_triangle_edge_family simple_graph_stable_forced_k4_anchor_test_graph).filter
(fun t => (t ∩ simple_graph_stable_forced_k4_anchor_pack.biUnion
finite_vertex_set_edge_encoding).card = 1)).biUnion id) ∧
(∀ q ∈ simple_graph_stable_forced_k4_anchor_pack, (1 : Fin 9) ∈ q →
Disjoint (finite_vertex_set_edge_encoding q)
(((simple_graph_triangle_edge_family simple_graph_stable_forced_k4_anchor_test_graph).filter
(fun t => (t ∩ simple_graph_stable_forced_k4_anchor_pack.biUnion
finite_vertex_set_edge_encoding).card = 1)).biUnion id))simple_graph_stable_forced_k4_anchor_pack_basicIn LeanGraph Theory & Graph Algorithms
The displayed eight triangles are pairwise edge-disjoint triangles of the witness graph, their vertex union is all nine vertices, four of {1,5,7,8} span a clique, {5,7,8} is one of the eight triangles, and the anchor 1 lies in one of them.
theorem simple_graph_stable_forced_k4_anchor_pack_basic :
(∀ t ∈ simple_graph_stable_forced_k4_anchor_pack, simple_graph_stable_forced_k4_anchor_test_graph.IsNClique 3 t) ∧
((simple_graph_stable_forced_k4_anchor_pack : Set (Finset (Fin 9))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) ∧
simple_graph_stable_forced_k4_anchor_pack.card = 8 ∧
simple_graph_stable_forced_k4_anchor_pack.biUnion id = Finset.univ ∧
simple_graph_stable_forced_k4_anchor_test_graph.IsNClique 4 ({1,5,7,8} : Finset (Fin 9)) ∧
({5,7,8} : Finset (Fin 9)) ∈ simple_graph_stable_forced_k4_anchor_pack ∧
(∃ q ∈ simple_graph_stable_forced_k4_anchor_pack, (1 : Fin 9) ∈ q)simple_graph_stable_forced_k4_anchor_packing_numberIn LeanGraph Theory & Graph Algorithms
The join of K5 on {4,5,6,7,8} with the independent set {0,1,2,3} has triangle packing number 8.
theorem simple_graph_stable_forced_k4_anchor_packing_number : simple_graph_triangle_packing_number simple_graph_stable_forced_k4_anchor_test_graph = 8
simple_graph_stable_forced_k4_anchor_pair_stabilityIn LeanGraph Theory & Graph Algorithms
For any two distinct edges of the witness graph, deleting both leaves triangle packing number 8.
theorem simple_graph_stable_forced_k4_anchor_pair_stability :
∀ e f : Sym2 (Fin 9),
e ∈ simple_graph_stable_forced_k4_anchor_test_graph.edgeSet →
f ∈ simple_graph_stable_forced_k4_anchor_test_graph.edgeSet → e ≠ f →
simple_graph_triangle_packing_number
(simple_graph_stable_forced_k4_anchor_test_graph.deleteEdges {e, f}) =
simple_graph_triangle_packing_number simple_graph_stable_forced_k4_anchor_test_graphsimple_graph_stable_forced_k4_anchor_unforced_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a two-edge-stable graph and a full-support maximum triangle packing containing a fully singleton-forced packed face with an internal K4 anchor, such that no packed triangle containing that anchor has any singleton-forced edge.
theorem simple_graph_stable_forced_k4_anchor_unforced_counterexample : let P : Finset (Finset (Fin 9)) := {{0,4,5},{3,6,7},{0,6,8},{3,4,8},{1,4,6},{2,4,7},{2,5,6},{5,7,8}}; ∃ G : SimpleGraph (Fin 9), (∀ t ∈ P, G.IsNClique 3 t) ∧ (P : Set (Finset (Fin 9))).Pairwise (fun t u => (t ∩ u).card ≤ 1) ∧ P.card = simple_graph_triangle_packing_number G ∧ P.biUnion id = Finset.univ ∧ (∀ e f : Sym2 (Fin 9), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) ∧ G.IsNClique 4 ({1,5,7,8} : Finset (Fin 9)) ∧ ({5,7,8} : Finset (Fin 9)) ∈ P ∧ finite_vertex_set_edge_encoding ({5,7,8} : Finset (Fin 9)) ⊆ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id) ∧ (∃ q ∈ P, (1 : Fin 9) ∈ q) ∧ (∀ q ∈ P, (1 : Fin 9) ∈ q → Disjoint (finite_vertex_set_edge_encoding q) (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id))simple_graph_stable_forced_packing_triangle_active_vertices_boundIn LeanGraph Theory & Graph Algorithms
If a finite simple graph has triangle packing number k at least two, every single-edge deletion preserves k, and a maximum packing contains a fully singleton-forced triangle, then at most k²+k+2 vertices lie in triangles.
theorem simple_graph_stable_forced_packing_triangle_active_vertices_bound (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hstable : ∀ e : Sym2 (Fin n), e ∈ G.edgeSet → simple_graph_triangle_packing_number (G.deleteEdges {e}) = simple_graph_triangle_packing_number G) (hk : 2 ≤ simple_graph_triangle_packing_number G) (P : Finset (Finset (Fin n))) (hcl : ∀ t ∈ P, G.IsNClique 3 t) (hpack : (P : Set (Finset (Fin n))).Pairwise (fun s t => (s ∩ t).card ≤ 1)) (hsize : P.card = simple_graph_triangle_packing_number G) (hforced : ∃ p ∈ P, finite_vertex_set_edge_encoding p ⊆ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ (P.image finite_vertex_set_edge_encoding).biUnion id).card = 1)).biUnion id)) : (((Finset.univ : Finset (Finset (Fin n))).filter (G.IsNClique 3)).biUnion id).card ≤ simple_graph_triangle_packing_number G * simple_graph_triangle_packing_number G + simple_graph_triangle_packing_number G + 2simple_graph_stable_internal_forced_anchor_active_vertices_boundIn LeanGraph Theory & Graph Algorithms
If every single-edge deletion preserves the maximum triangle packing number k and a maximum packing P contains a triangle abc in a four-clique abcd whose other three edges are unused by P, with d already in P’s vertex union, then at most |V(P)|+k−1 vertices lie in triangles.
open scoped Sym2
theorem simple_graph_stable_internal_forced_anchor_active_vertices_bound (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hstable : ∀ e : Sym2 (Fin n), e ∈ G.edgeSet → simple_graph_triangle_packing_number (G.deleteEdges {e}) = simple_graph_triangle_packing_number G) (P : Finset (Finset (Fin n))) (hcl : ∀ t ∈ P, G.IsNClique 3 t) (hpack : (P : Set (Finset (Fin n))).Pairwise (fun s t => (s ∩ t).card ≤ 1)) (hsize : P.card = simple_graph_triangle_packing_number G) (a b c d : Fin n) (hp : ({a,b,c} : Finset (Fin n)) ∈ P) (hd : d ∈ P.biUnion id) (hK : G.IsNClique 4 ({a,b,c,d} : Finset (Fin n))) (hfree : ∀ e ∈ ({s(a,d),s(b,d),s(c,d)} : Finset (Sym2 (Fin n))), e ∉ (P.image finite_vertex_set_edge_encoding).biUnion id) : (((Finset.univ : Finset (Finset (Fin n))).filter (G.IsNClique 3)).biUnion id).card + 1 ≤ (P.biUnion id).card + simple_graph_triangle_packing_number Gsimple_graph_stable_irreducible_six_chromatic_bipartite_cover_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a six-chromatic 48-vertex 21-connected graph with 543 edges and packing number 67, a vertex of degree 47 and triangle codegrees between three and forty-six, such that every edge is avoidable by a maximum packing, its triangle family remains connected after ignoring any one edge, but every bipartition leaves at least 138 monochromatic edges.
theorem simple_graph_stable_irreducible_six_chromatic_bipartite_cover_counterexample :
∃ (G : SimpleGraph (Fin 48)) (E : Finset (Sym2 (Fin 48))),
let F := simple_graph_triangle_edge_family G
(↑E : Set (Sym2 (Fin 48))) = G.edgeSet ∧ E.card = 543 ∧
(¬ G.Colorable 5 ∧ G.Colorable 6) ∧
(∀ Q : Finset (Finset (Sym2 (Fin 48))), Q ⊆ F →
(Q : Set (Finset (Sym2 (Fin 48)))).Pairwise Disjoint → Q.card ≤ 67) ∧
(∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset (Sym2 (Fin 48))),
Q ⊆ F ∧ Q.card = 67 ∧
(Q : Set (Finset (Sym2 (Fin 48)))).Pairwise Disjoint ∧ e ∉ Q.biUnion id) ∧
(∀ e ∈ G.edgeSet, 3 ≤ (F.filter (fun t => e ∈ t)).card ∧
(F.filter (fun t => e ∈ t)).card ≤ 46) ∧
(∀ R : Finset (Fin 48), R.card ≤ 20 → (G.induce {v | v ∉ R}).Connected) ∧
(∃ v : Fin 48, ∃ N : Finset (Fin 48), N.card = 47 ∧ ∀ w ∈ N, G.Adj v w) ∧
(∀ e ∈ G.edgeSet, ∀ a ∈ F, ∀ b ∈ F, Relation.ReflTransGen
(fun x y : Finset (Sym2 (Fin 48)) => x ∈ F ∧ y ∈ F ∧
¬ Disjoint (x.erase e) (y.erase e)) a b) ∧
∀ A : Finset (Fin 48),
138 ≤ (E.filter (fun e => (∀ v ∈ e, v ∈ A) ∨ (∀ v ∈ e, v ∉ A))).cardsimple_graph_stable_maximum_packing_outside_book_cardIn LeanGraph Theory & Graph Algorithms
In a finite simple graph with triangle packing number k at least two, if every single-edge deletion preserves k, then for any maximum packing P and any edge ab of a packed triangle, at most k−1 common neighbors of a and b lie outside the vertex union of P.
theorem simple_graph_stable_maximum_packing_outside_book_card (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (hstable : ∀ e : Sym2 (Fin n), e ∈ G.edgeSet → simple_graph_triangle_packing_number (G.deleteEdges {e}) = simple_graph_triangle_packing_number G) (hk : 2 ≤ simple_graph_triangle_packing_number G) (P : Finset (Finset (Fin n))) (hcl : ∀ t ∈ P, G.IsNClique 3 t) (hpack : (P : Set (Finset (Fin n))).Pairwise (fun s t => (s ∩ t).card ≤ 1)) (hsize : P.card = simple_graph_triangle_packing_number G) (p : Finset (Fin n)) (hp : p ∈ P) (a b : Fin n) (ha : a ∈ p) (hb : b ∈ p) (hab : a ≠ b) : ((Finset.univ : Finset (Fin n)).filter (fun x => x ∉ P.biUnion id ∧ G.Adj a x ∧ G.Adj b x)).card + 1 ≤ simple_graph_triangle_packing_number Gsimple_graph_stable_min_two_triangles_odd_conflict_cycle_familyIn LeanGraph Theory & Graph Algorithms
For every odd m at least five there is a graph on 2m+1 vertices with 5m edges, packing number m and covering number m+ceil(m/2), whose every edge is in two to four triangles and is omitted by some maximum triangle packing, which stays connected after deletion of any two vertices, and which has a maximum packing and a forced-respecting marking whose unmarked conflict graph has a cycle of length m.
theorem simple_graph_stable_min_two_triangles_odd_conflict_cycle_family
(m : ℕ) (hm : 5 ≤ m) (hodd : m % 2 = 1) :
∃ (G : SimpleGraph (Fin (2 * m + 1)))
(E : Finset (Sym2 (Fin (2 * m + 1))))
(P : Finset (Finset (Sym2 (Fin (2 * m + 1)))))
(M : Finset (Sym2 (Fin (2 * m + 1)))),
let F := simple_graph_triangle_edge_family G
let U := P.biUnion id
(↑E : Set (Sym2 (Fin (2 * m + 1)))) = G.edgeSet ∧ E.card = 5 * m ∧
simple_graph_triangle_packing_number G = m ∧
simple_graph_triangle_cover_number G = m + (m + 1) / 2 ∧
P ⊆ F ∧ P.card = m ∧
(P : Set (Finset (Sym2 (Fin (2 * m + 1))))).Pairwise Disjoint ∧
(∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset (Sym2 (Fin (2 * m + 1)))),
Q ⊆ F ∧ Q.card = m ∧
(Q : Set (Finset (Sym2 (Fin (2 * m + 1))))).Pairwise Disjoint ∧ e ∉ Q.biUnion id) ∧
(∀ e ∈ G.edgeSet, 2 ≤ (F.filter (fun t => e ∈ t)).card ∧
(F.filter (fun t => e ∈ t)).card ≤ 4) ∧
(∀ R : Finset (Fin (2 * m + 1)), R.card ≤ 2 → (G.induce {v | v ∉ R}).Connected) ∧
M ⊆ U ∧ (∀ p ∈ P, (M ∩ p).card = 1) ∧
(((F.filter (fun t => (t ∩ U).card = 1)).biUnion id) ∩ U) ⊆ M ∧
∃ f : Fin m → Sym2 (Fin (2 * m + 1)), Function.Injective f ∧
(∀ i, f i ∈ U \ M) ∧
(∀ i : Fin m, ∃ j : Fin m, j.val = (i.val + 1) % m ∧
∃ t ∈ F, f i ∈ t ∧ f j ∈ t ∧ ¬ t ⊆ U)simple_graph_stable_packing_unforced_conflict_odd_cycleIn LeanGraph Theory & Graph Algorithms
A stable seven-vertex graph has a maximum triangle packing and one marked edge per packed triangle, containing every singly forced edge, whose unmarked conflict graph has a five-cycle.
theorem simple_graph_stable_packing_unforced_conflict_odd_cycle :
∃ (G : SimpleGraph (Fin 7)) (P : Finset (Finset (Fin 7)))
(M : Finset (Sym2 (Fin 7))) (a b c d e : Sym2 (Fin 7)),
simple_graph_triangle_packing_number G = 4 ∧
(∀ g ∈ G.edgeSet, simple_graph_triangle_packing_number (G.deleteEdges {g}) =
simple_graph_triangle_packing_number G) ∧
P.card = 4 ∧ (∀ p ∈ P, G.IsNClique 3 p) ∧
(P : Set (Finset (Fin 7))).Pairwise (fun x y => (x ∩ y).card ≤ 1) ∧
M ⊆ (P.image finite_vertex_set_edge_encoding).biUnion id ∧
(∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ M).card = 1) ∧
(∀ t : Finset (Fin 7), G.IsNClique 3 t →
∀ g : Sym2 (Fin 7),
finite_vertex_set_edge_encoding t ∩ ((P.image finite_vertex_set_edge_encoding).biUnion id) = {g} → g ∈ M) ∧
({a,b,c,d,e} : Finset (Sym2 (Fin 7))).card = 5 ∧
(∀ g ∈ ({a,b,c,d,e} : Finset (Sym2 (Fin 7))),
g ∈ (P.image finite_vertex_set_edge_encoding).biUnion id \ M) ∧
(∀ q ∈ ({(a,b),(b,c),(c,d),(d,e),(e,a)} : Finset (Sym2 (Fin 7) × Sym2 (Fin 7))),
∃ t : Finset (Fin 7), G.IsNClique 3 t ∧
finite_vertex_set_edge_encoding t ∩ ((P.image finite_vertex_set_edge_encoding).biUnion id) = {q.1,q.2})simple_graph_stable_point_irreducible_forced_exchange_barrier_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a stable six-connected ten-vertex graph with triangle codegree at least three and no one-point triangle-family split, with a maximum packing from which every packing reachable by single-triangle exchanges has a fully singleton-forced triangle, although another maximum packing has none.
theorem simple_graph_stable_point_irreducible_forced_exchange_barrier_counterexample :
∃ (G : SimpleGraph (Fin 10)) (E : Finset (Sym2 (Fin 10)))
(P Q : Finset (Finset (Sym2 (Fin 10)))),
let F := simple_graph_triangle_edge_family G
let Adj := fun A B : Finset (Finset (Sym2 (Fin 10))) =>
B ⊆ F ∧ B.card = 10 ∧ (B : Set (Finset (Sym2 (Fin 10)))).Pairwise Disjoint ∧
(A ∩ B).card = 9
(↑E : Set (Sym2 (Fin 10))) = G.edgeSet ∧ E.card = 35 ∧
(∀ R : Finset (Fin 10), R.card ≤ 5 → (G.induce {v | v ∉ R}).Connected) ∧
(∀ e ∈ G.edgeSet, 3 ≤ (F.filter (fun t => e ∈ t)).card) ∧
(∀ e ∈ G.edgeSet, ∀ a ∈ F, ∀ b ∈ F,
Relation.ReflTransGen (fun x y : Finset (Sym2 (Fin 10)) =>
x ∈ F ∧ y ∈ F ∧ ∃ f ∈ x, f ∈ y ∧ f ≠ e) a b) ∧
(∀ R : Finset (Finset (Sym2 (Fin 10))), R ⊆ F →
(R : Set (Finset (Sym2 (Fin 10)))).Pairwise Disjoint → R.card ≤ 10) ∧
(∀ e ∈ G.edgeSet, ∃ R : Finset (Finset (Sym2 (Fin 10))),
R ⊆ F ∧ R.card = 10 ∧
(R : Set (Finset (Sym2 (Fin 10)))).Pairwise Disjoint ∧ e ∉ R.biUnion id) ∧
P ⊆ F ∧ P.card = 10 ∧ (P : Set (Finset (Sym2 (Fin 10)))).Pairwise Disjoint ∧
(∀ R, Relation.ReflTransGen Adj P R →
∃ r ∈ R, r ⊆ ((F.filter (fun t => (t ∩ R.biUnion id).card = 1)).biUnion id)) ∧
Q ⊆ F ∧ Q.card = 10 ∧ (Q : Set (Finset (Sym2 (Fin 10)))).Pairwise Disjoint ∧
∀ q ∈ Q, ¬ q ⊆ ((F.filter (fun t => (t ∩ Q.biUnion id).card = 1)).biUnion id)simple_graph_stable_point_irreducible_forced_local_minimum_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a three-connected nine-vertex graph with 26 edges, minimum triangle codegree two and no one-point triangle-family split, in which every edge is avoided by a maximum triangle packing, and one maximum seven-packing has a fully singleton-forced triangle that no one-triangle exchange can eliminate, although a different maximum packing has no such triangle.
theorem simple_graph_stable_point_irreducible_forced_local_minimum_counterexample :
∃ (G : SimpleGraph (Fin 9)) (E : Finset (Sym2 (Fin 9)))
(P Q : Finset (Finset (Sym2 (Fin 9)))),
let F := simple_graph_triangle_edge_family G
(↑E : Set (Sym2 (Fin 9))) = G.edgeSet ∧ E.card = 26 ∧
(∀ R : Finset (Fin 9), R.card ≤ 2 → (G.induce {v | v ∉ R}).Connected) ∧
(∀ e ∈ G.edgeSet, 2 ≤ (F.filter (fun t => e ∈ t)).card) ∧
(∀ e ∈ G.edgeSet, ∀ a ∈ F, ∀ b ∈ F,
Relation.ReflTransGen (fun x y : Finset (Sym2 (Fin 9)) =>
x ∈ F ∧ y ∈ F ∧ ∃ f ∈ x, f ∈ y ∧ f ≠ e) a b) ∧
(∀ R : Finset (Finset (Sym2 (Fin 9))), R ⊆ F →
(R : Set (Finset (Sym2 (Fin 9)))).Pairwise Disjoint → R.card ≤ 7) ∧
(∀ e ∈ G.edgeSet, ∃ R : Finset (Finset (Sym2 (Fin 9))),
R ⊆ F ∧ R.card = 7 ∧
(R : Set (Finset (Sym2 (Fin 9)))).Pairwise Disjoint ∧ e ∉ R.biUnion id) ∧
P ⊆ F ∧ P.card = 7 ∧ (P : Set (Finset (Sym2 (Fin 9)))).Pairwise Disjoint ∧
(∃ p ∈ P, p ⊆ ((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)) ∧
(∀ R : Finset (Finset (Sym2 (Fin 9))), R ⊆ F → R.card = 7 →
(R : Set (Finset (Sym2 (Fin 9)))).Pairwise Disjoint → (P ∩ R).card = 6 →
∃ r ∈ R, r ⊆ ((F.filter (fun t => (t ∩ R.biUnion id).card = 1)).biUnion id)) ∧
Q ⊆ F ∧ Q.card = 7 ∧ (Q : Set (Finset (Sym2 (Fin 9)))).Pairwise Disjoint ∧
∀ q ∈ Q, ¬ q ⊆ ((F.filter (fun t => (t ∩ Q.biUnion id).card = 1)).biUnion id)simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_codegreeIn LeanGraph Theory & Graph Algorithms
Every edge of the witness graph lies in at least two triangles.
theorem simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_codegree : ∀ e ∈ simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_graph.edgeSet, 2 ≤ ((simple_graph_triangle_edge_family simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_graph).filter (fun t => e ∈ t)).card
simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_familyIn LeanGraph Theory & Graph Algorithms
The triangle edge family of the witness graph is exactly the listed 35 three-edge sets.
theorem simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_family : simple_graph_triangle_edge_family simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_graph = simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_triangles
simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_packing_P_exchangeIn LeanGraph Theory & Graph Algorithms
Every maximum seven-packing that differs from P in exactly one triangle still has a fully singleton-forced triangle.
theorem simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_packing_P_exchange : let F := simple_graph_triangle_edge_family simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_graph; let P := simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_packing_P; ∀ R : Finset (Finset (Sym2 (Fin 9))), R ⊆ F → R.card = 7 → (R : Set (Finset (Sym2 (Fin 9)))).Pairwise Disjoint → (P ∩ R).card = 6 → ∃ r ∈ R, r ⊆ ((F.filter (fun t => (t ∩ R.biUnion id).card = 1)).biUnion id)
simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_packing_P_okIn LeanGraph Theory & Graph Algorithms
P is a maximum seven-triangle packing and contains a fully singleton-forced triangle, namely 236.
theorem simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_packing_P_ok : let F := simple_graph_triangle_edge_family simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_graph; let P := simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_packing_P; P ⊆ F ∧ P.card = 7 ∧ (P : Set (Finset (Sym2 (Fin 9)))).Pairwise Disjoint ∧ (∃ p ∈ P, p ⊆ ((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id))
simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_packing_Q_okIn LeanGraph Theory & Graph Algorithms
Q is a maximum seven-triangle packing in which no triangle is fully forced.
theorem simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_packing_Q_ok : let F := simple_graph_triangle_edge_family simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_graph; let Q := simple_graph_stable_point_irreducible_forced_local_minimum_counterexample_packing_Q; Q ⊆ F ∧ Q.card = 7 ∧ (Q : Set (Finset (Sym2 (Fin 9)))).Pairwise Disjoint ∧ ∀ q ∈ Q, ¬ q ⊆ ((F.filter (fun t => (t ∩ Q.biUnion id).card = 1)).biUnion id)
simple_graph_subgraphs_inclusion_exclusionIn LeanGraph Theory & Graph Algorithms
For any two subgraphs of a finite graph on n vertices with equal vertex cardinality, the number of vertices in their intersection is at least 2L - n.
theorem simple_graph_subgraphs_inclusion_exclusion {V : Type*} [Fintype V] (G : SimpleGraph V) (C D : G.Subgraph) (h_eq : C.verts.ncard = D.verts.ncard) : 2 * (C.verts.ncard : ℤ) - (Fintype.card V : ℤ) ≤ ((C.verts ∩ D.verts).ncard : ℤ)simple_graph_sum_degrees_subsetIn LeanGraph Theory & Graph Algorithms
The sum of degrees of vertices in a subset F equals twice the number of edges in G[F] plus the number of edges between F and Fᶜ.
theorem simple_graph_sum_degrees_subset {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (F : Finset V) :
∑ v ∈ F, G.degree v = 2 * (G.induce (F : Set V)).edgeFinset.card +
∑ u ∈ Fᶜ, (F.filter (fun v => G.Adj u v)).cardsimple_graph_sunflower_forced_edge_is_petal_baseIn LeanGraph Theory & Graph Algorithms
A forced packed edge avoiding the root is the base edge (petal minus root) of some packed petal.
theorem simple_graph_sunflower_forced_edge_is_petal_base (n : ℕ) (G : SimpleGraph (Fin n)) (P : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hroot : ∀ t ∈ P, r ∈ t) (hFsub : ∀ e ∈ F, e ∈ P.biUnion finite_vertex_set_edge_encoding) (hFr : ∀ e ∈ F, r ∉ e.toFinset) : ∀ e ∈ F, ∃ p ∈ P, e.toFinset = p.erase r
simple_graph_sunflower_forced_set_eq_petal_basesIn LeanGraph Theory & Graph Algorithms
A packed edge is forced (and avoids the root) if and only if it is the base edge, petal minus root, of a retained petal of Q.
theorem simple_graph_sunflower_forced_set_eq_petal_bases (n : ℕ) (G : SimpleGraph (Fin n)) (P Q : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (hQ : Q = P.filter (fun p => ∃ e ∈ F, e ∈ finite_vertex_set_edge_encoding p)) : ∀ e : Sym2 (Fin n), e ∈ F ↔ ∃ q ∈ Q, e.toFinset = q.erase r
simple_graph_sunflower_kernel_forced_set_subsetIn LeanGraph Theory & Graph Algorithms
Every retained packed edge that is forced again inside the kernel graph is one of the forced bases, i.e. lies in F.
theorem simple_graph_sunflower_kernel_forced_set_subset (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P Q : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) (hgood : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (hQ : Q = P.filter (fun p => ∃ e ∈ F, e ∈ finite_vertex_set_edge_encoding p)) : (Q.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family (simple_graph_sunflower_packing_kernel_graph n G P r Q)).filter (fun t => (t ∩ Q.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)) ⊆ F
simple_graph_sunflower_kernel_forced_set_supersetIn LeanGraph Theory & Graph Algorithms
Each forced base edge is a retained packed edge and is forced again inside the kernel graph.
theorem simple_graph_sunflower_kernel_forced_set_superset (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P Q : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) (hgood : ∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (hQ : Q = P.filter (fun p => ∃ e ∈ F, e ∈ finite_vertex_set_edge_encoding p)) : F ⊆ (Q.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family (simple_graph_sunflower_packing_kernel_graph n G P r Q)).filter (fun t => (t ∩ Q.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id))
simple_graph_sunflower_kernel_graph_agree_on_supportIn LeanGraph Theory & Graph Algorithms
On the endpoints of the petals of Q, the kernel graph has exactly the edges of G.
theorem simple_graph_sunflower_kernel_graph_agree_on_support (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P Q : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (hQ : Q = P.filter (fun p => ∃ e ∈ F, e ∈ finite_vertex_set_edge_encoding p)) : ∀ u ∈ Q.biUnion id, ∀ v ∈ Q.biUnion id, (simple_graph_sunflower_packing_kernel_graph n G P r Q).Adj u v ↔ G.Adj u v
simple_graph_sunflower_kernel_graph_leIn LeanGraph Theory & Graph Algorithms
The kernel graph is a subgraph of G.
theorem simple_graph_sunflower_kernel_graph_le (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P Q : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (hQ : Q = P.filter (fun p => ∃ e ∈ F, e ∈ finite_vertex_set_edge_encoding p)) : simple_graph_sunflower_packing_kernel_graph n G P r Q ≤ G
simple_graph_sunflower_kernel_graph_outside_petals_edge_freeIn LeanGraph Theory & Graph Algorithms
For a packed petal p outside the subpacking Q, no edge of the kernel graph has both endpoints in p.
theorem simple_graph_sunflower_kernel_graph_outside_petals_edge_free (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P Q : Finset (Finset (Fin n))) (r : Fin n) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) : ∀ p ∈ P, p ∉ Q → ∀ u ∈ p, ∀ v ∈ p, ¬ (simple_graph_sunflower_packing_kernel_graph n G P r Q).Adj u v
simple_graph_sunflower_kernel_graph_packed_edgesIn LeanGraph Theory & Graph Algorithms
For a packed edge e, e is an edge of the kernel graph if and only if e is spanned by one of the retained petals of Q.
theorem simple_graph_sunflower_kernel_graph_packed_edges (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P Q : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (hQ : Q = P.filter (fun p => ∃ e ∈ F, e ∈ finite_vertex_set_edge_encoding p)) : ∀ e ∈ P.biUnion finite_vertex_set_edge_encoding, e ∈ (simple_graph_sunflower_packing_kernel_graph n G P r Q).edgeSet ↔ e ∈ Q.biUnion finite_vertex_set_edge_encoding
simple_graph_sunflower_kernel_packing_number_geIn LeanGraph Theory & Graph Algorithms
The retained petals Q are |Q| edge-disjoint triangles of the kernel graph, so its triangle packing number is at least |Q|.
theorem simple_graph_sunflower_kernel_packing_number_ge (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P Q : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (hQ : Q = P.filter (fun p => ∃ e ∈ F, e ∈ finite_vertex_set_edge_encoding p)) : Q.card ≤ simple_graph_triangle_packing_number (simple_graph_sunflower_packing_kernel_graph n G P r Q)
simple_graph_sunflower_kernel_packing_number_leIn LeanGraph Theory & Graph Algorithms
The kernel graph has no more than |Q| edge-disjoint triangles, since any family of them together with the discarded packed petals P \ Q is a packing of G of size |T| + |P \ Q| ≤ ν(G) = |P|.
theorem simple_graph_sunflower_kernel_packing_number_le (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P Q : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hroot : ∀ t ∈ P, r ∈ t) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (hQ : Q = P.filter (fun p => ∃ e ∈ F, e ∈ finite_vertex_set_edge_encoding p)) : simple_graph_triangle_packing_number (simple_graph_sunflower_packing_kernel_graph n G P r Q) ≤ Q.card
simple_graph_sunflower_kernel_vertices_boundIn LeanGraph Theory & Graph Algorithms
The vertex set W contains all endpoints of the petals of Q and all endpoints of the kernel graph, and has at most three vertices per petal of Q plus one.
theorem simple_graph_sunflower_kernel_vertices_bound (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P Q : Finset (Finset (Fin n))) (r : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) : Q.biUnion id ⊆ simple_graph_sunflower_packing_kernel_vertices n G P r Q ∧ (∀ u v, (simple_graph_sunflower_packing_kernel_graph n G P r Q).Adj u v → u ∈ simple_graph_sunflower_packing_kernel_vertices n G P r Q ∧ v ∈ simple_graph_sunflower_packing_kernel_vertices n G P r Q) ∧ (simple_graph_sunflower_packing_kernel_vertices n G P r Q).card ≤ 3 * Q.card + 1
simple_graph_sunflower_packing_witness_specIn LeanGraph Theory & Graph Algorithms
For every petal q of the subpacking Q, the witness vertex lies outside q, q minus the root together with the witness is a triangle, and that triangle meets the packed edge union in exactly one edge.
theorem simple_graph_sunflower_packing_witness_spec (n : ℕ) (G : SimpleGraph (Fin n)) (P Q : Finset (Finset (Fin n))) (r : Fin n) (F : Finset (Sym2 (Fin n))) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) (hF : F = ((P.biUnion finite_vertex_set_edge_encoding ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).filter (fun e => r ∉ e.toFinset))) (hQ : Q = P.filter (fun p => ∃ e ∈ F, e ∈ finite_vertex_set_edge_encoding p)) : ∀ q ∈ Q, simple_graph_sunflower_packing_witness n G P r q ∉ q ∧ G.IsNClique 3 (insert (simple_graph_sunflower_packing_witness n G P r q) (q.erase r)) ∧ (finite_vertex_set_edge_encoding (insert (simple_graph_sunflower_packing_witness n G P r q) (q.erase r)) ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1
simple_graph_sunflower_petal_eq_of_common_nonroot_vertexIn LeanGraph Theory & Graph Algorithms
If a vertex a other than the root lies in a packed petal p and in a petal q of the subpacking, then p = q.
theorem simple_graph_sunflower_petal_eq_of_common_nonroot_vertex (n : ℕ) (G : SimpleGraph (Fin n)) (P Q : Finset (Finset (Fin n))) (r : Fin n) (hQP : Q ⊆ P) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) : ∀ p ∈ P, ∀ q ∈ Q, ∀ a : Fin n, a ∈ p → a ∈ q → a ≠ r → p = q
simple_graph_sunflower_petals_intersect_rootIn LeanGraph Theory & Graph Algorithms
Two distinct packed petals that both contain the common vertex r intersect exactly in {r}.
theorem simple_graph_sunflower_petals_intersect_root (n : ℕ) (G : SimpleGraph (Fin n)) (P : Finset (Finset (Fin n))) (r : Fin n) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hroot : ∀ t ∈ P, r ∈ t) : ∀ p ∈ P, ∀ q ∈ P, p ≠ q → p ∩ q = {r}simple_graph_three_apex_cover_one_baseIn LeanGraph Theory & Graph Algorithms
The join of a three-vertex clique with any finite graph whose triangles can be covered by one edge satisfies the factor-two triangle cover bound.
theorem simple_graph_three_apex_cover_one_base
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(hbase : simple_graph_triangle_cover_number H ≤ 1) :
let G := ((Hᶜ).sum (⊥ : SimpleGraph (Fin 3)))ᶜ
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gsimple_graph_three_apex_cover_two_baseIn LeanGraph Theory & Graph Algorithms
The join of a three-vertex clique with any finite graph whose triangles can be covered by two edges satisfies the factor-two triangle cover inequality.
theorem simple_graph_three_apex_cover_two_base
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(hbase : simple_graph_triangle_cover_number H ≤ 2) :
let G := ((Hᶜ).sum (⊥ : SimpleGraph (Fin 3)))ᶜ
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gsimple_graph_three_apex_cover_two_base_of_mixed_gapIn LeanGraph Theory & Graph Algorithms
If the three-unit mixed-cover inequality holds for a finite base graph whose triangles can be covered by two edges, then joining that graph to a three-vertex clique satisfies the factor-two triangle-cover bound.
theorem simple_graph_three_apex_cover_two_base_of_mixed_gap
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(hbase : simple_graph_triangle_cover_number H ≤ 2)
(hgap : 3 ≤ H.edgeFinset.card →
∃ (S : Finset (Fin n)) (M : Fin 3 → Finset (Sym2 (Fin n))),
(∀ i, M i ⊆ H.edgeFinset ∧
∀ e ∈ M i, ∀ f ∈ M i, e ≠ f → ∀ v ∈ e, v ∉ f) ∧
(∀ i j : Fin 3, i ≠ j → Disjoint (M i) (M j)) ∧
3 * S.card + (H.edgeFinset.filter (fun e => ∀ v ∈ e, v ∉ S)).card + 3 ≤
2 * ((M 0).card + (M 1).card + (M 2).card)) :
let G := ((Hᶜ).sum (⊥ : SimpleGraph (Fin 3)))ᶜ
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gsimple_graph_three_apex_triangle_cover_number_leIn LeanGraph Theory & Graph Algorithms
In the join of a triangle-free finite graph H and a 3-clique, the triangle cover number is at most three times the size of any vertex set S plus the number of edges outside S plus three.
theorem simple_graph_three_apex_triangle_cover_number_le
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(htri : H.CliqueFree 3)
(S : Finset (Fin n)) :
let G := ((Hᶜ).sum (⊥ : SimpleGraph (Fin 3)))ᶜ
simple_graph_triangle_cover_number G ≤
3 * S.card + (H.edgeFinset.filter (fun e => ∀ v ∈ e, v ∉ S)).card + 3simple_graph_three_apex_triangle_cover_of_mixed_certificateIn LeanGraph Theory & Graph Algorithms
For a triangle-free finite graph with the specified three disjoint matchings and a vertex set whose mixed cover cost is strictly less than twice their combined size, the join of that graph with a three-clique satisfies the factor-two triangle cover inequality.
theorem simple_graph_three_apex_triangle_cover_of_mixed_certificate
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(htri : H.CliqueFree 3)
(S : Finset (Fin n)) (M : Fin 3 → Finset (Sym2 (Fin n)))
(hmatch : ∀ i, M i ⊆ H.edgeFinset ∧
∀ e ∈ M i, ∀ f ∈ M i, e ≠ f → ∀ v ∈ e, v ∉ f)
(hdisj : ∀ i j : Fin 3, i ≠ j → Disjoint (M i) (M j))
(hsize : 3 * S.card + (H.edgeFinset.filter (fun e => ∀ v ∈ e, v ∉ S)).card + 1 ≤
2 * ((M 0).card + (M 1).card + (M 2).card)) :
let G := ((Hᶜ).sum (⊥ : SimpleGraph (Fin 3)))ᶜ
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gsimple_graph_three_apex_triangle_packing_number_geIn LeanGraph Theory & Graph Algorithms
In the join of any finite graph H and a 3-clique, three pairwise disjoint matchings yield an edge-disjoint triangle packing of size 1 + |M 0| + |M 1| + |M 2|.
theorem simple_graph_three_apex_triangle_packing_number_ge
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(M : Fin 3 → Finset (Sym2 (Fin n)))
(hmatch : ∀ i, M i ⊆ H.edgeFinset ∧
∀ e ∈ M i, ∀ f ∈ M i, e ≠ f → ∀ v ∈ e, v ∉ f)
(hdisj : ∀ i j : Fin 3, i ≠ j → Disjoint (M i) (M j)) :
let G := ((Hᶜ).sum (⊥ : SimpleGraph (Fin 3)))ᶜ
1 + (M 0).card + (M 1).card + (M 2).card ≤
simple_graph_triangle_packing_number Gsimple_graph_three_matchings_mixed_cover_boundIn LeanGraph Theory & Graph Algorithms
In every finite simple graph with at least one edge, there are three pairwise edge-disjoint matchings and a vertex set S such that three times |S| plus the number of edges with both endpoints outside S is strictly less than twice the combined size of the matchings.
theorem simple_graph_three_matchings_mixed_cover_bound
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(hne : H.edgeFinset.Nonempty) :
∃ (S : Finset (Fin n)) (M : Fin 3 → Finset (Sym2 (Fin n))),
(∀ i, M i ⊆ H.edgeFinset ∧
∀ e ∈ M i, ∀ f ∈ M i, e ≠ f → ∀ v ∈ e, v ∉ f) ∧
(∀ i j : Fin 3, i ≠ j → Disjoint (M i) (M j)) ∧
3 * S.card + (H.edgeFinset.filter (fun e => ∀ v ∈ e, v ∉ S)).card + 1 ≤
2 * ((M 0).card + (M 1).card + (M 2).card)simple_graph_three_matchings_mixed_cover_gap_threeIn LeanGraph Theory & Graph Algorithms
Every finite simple graph with at least three edges has three edge-disjoint matchings and a vertex set whose three-unit mixed-cover cost is at most twice the combined matching size.
theorem simple_graph_three_matchings_mixed_cover_gap_three
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(hsize : 3 ≤ H.edgeFinset.card) :
∃ (S : Finset (Fin n)) (M : Fin 3 → Finset (Sym2 (Fin n))),
(∀ i, M i ⊆ H.edgeFinset ∧
∀ e ∈ M i, ∀ f ∈ M i, e ≠ f → ∀ v ∈ e, v ∉ f) ∧
(∀ i j : Fin 3, i ≠ j → Disjoint (M i) (M j)) ∧
3 * S.card + (H.edgeFinset.filter (fun e => ∀ v ∈ e, v ∉ S)).card + 3 ≤
2 * ((M 0).card + (M 1).card + (M 2).card)simple_graph_three_matchings_mixed_cover_gap_twoIn LeanGraph Theory & Graph Algorithms
In a finite simple graph with at least two edges, there exist three edge-disjoint matchings and a vertex set S such that three times its size plus the number of edges outside S plus two does not exceed twice the combined matching size.
theorem simple_graph_three_matchings_mixed_cover_gap_two
(n : ℕ) (H : SimpleGraph (Fin n)) [DecidableRel H.Adj]
(hsize : 2 ≤ H.edgeFinset.card) :
∃ (S : Finset (Fin n)) (M : Fin 3 → Finset (Sym2 (Fin n))),
(∀ i, M i ⊆ H.edgeFinset ∧
∀ e ∈ M i, ∀ f ∈ M i, e ≠ f → ∀ v ∈ e, v ∉ f) ∧
(∀ i j : Fin 3, i ≠ j → Disjoint (M i) (M j)) ∧
3 * S.card + (H.edgeFinset.filter (fun e => ∀ v ∈ e, v ∉ S)).card + 2 ≤
2 * ((M 0).card + (M 1).card + (M 2).card)simple_graph_three_separator_common_edge_componentsIn LeanGraph Theory & Graph Algorithms
There exist two simple graphs G1 and G2 on Fin 7 overlapping on the triangle D on {0, 1, 2} such that G1 is supported on {0, 1, 2, 3}, G2 on {0, 1, 2, 4, 5, 6}, their union G is 3-connected, every triangle of G is in G1 or G2, ν(H1) = 0, ν(H2) = 1, ν(G) = 2, τ(G1) ≤ 2, τ(G2) ≤ 2, ν(G1) ≥ 1, ν(G2) ≥ 1, and for each e ∈ D, ν(H1 + e) ≥ 1 and ν(H2 + e) ≥ 1.
theorem simple_graph_three_separator_common_edge_components :
∃ G1 G2 : SimpleGraph (Fin 7),
let D := finite_vertex_set_edge_encoding ({0, 1, 2} : Finset (Fin 7))
let H1 := G1.deleteEdges (↑D : Set (Sym2 (Fin 7)))
let H2 := G2.deleteEdges (↑D : Set (Sym2 (Fin 7)))
let G := G1 ⊔ G2
(∀ a b, G1.Adj a b → a ∈ ({0, 1, 2, 3} : Finset (Fin 7)) ∧
b ∈ ({0, 1, 2, 3} : Finset (Fin 7))) ∧
(∀ a b, G2.Adj a b → a ∈ ({0, 1, 2, 4, 5, 6} : Finset (Fin 7)) ∧
b ∈ ({0, 1, 2, 4, 5, 6} : Finset (Fin 7))) ∧
G1.edgeSet ∩ G2.edgeSet = (↑D : Set (Sym2 (Fin 7))) ∧
(∀ R : Finset (Fin 7), R.card ≤ 2 → (G.induce {v | v ∉ R}).Connected) ∧
(∀ t : Finset (Fin 7), G.IsNClique 3 t → G1.IsNClique 3 t ∨ G2.IsNClique 3 t) ∧
simple_graph_triangle_packing_number H1 = 0 ∧
simple_graph_triangle_packing_number H2 = 1 ∧
simple_graph_triangle_packing_number G = 2 ∧
simple_graph_triangle_cover_number G1 ≤ 2 ∧
simple_graph_triangle_cover_number G2 ≤ 2 ∧
1 ≤ simple_graph_triangle_packing_number G1 ∧
1 ≤ simple_graph_triangle_packing_number G2 ∧
(∀ e ∈ D, 1 ≤ simple_graph_triangle_packing_number (H1 ⊔ SimpleGraph.fromEdgeSet ({e} : Set (Sym2 (Fin 7)))) ∧
1 ≤ simple_graph_triangle_packing_number (H2 ⊔ SimpleGraph.fromEdgeSet ({e} : Set (Sym2 (Fin 7)))))simple_graph_three_separator_common_edge_counterexampleIn LeanGraph Theory & Graph Algorithms
There are two graphs whose union is three-connected and whose common edge set is the triangle on vertices 0, 1, 2, such that each graph satisfies the triangle cover-packing inequality and every union triangle lies in one piece, but the common-edge packing-number equality used in the triangle-separator proof fails for all three separator edges, even in its residual case.
theorem simple_graph_three_separator_common_edge_counterexample :
∃ G1 G2 : SimpleGraph (Fin 7),
let D := finite_vertex_set_edge_encoding ({0, 1, 2} : Finset (Fin 7))
let H1 := G1.deleteEdges (↑D : Set (Sym2 (Fin 7)))
let H2 := G2.deleteEdges (↑D : Set (Sym2 (Fin 7)))
let G := G1 ⊔ G2
(∀ a b, G1.Adj a b → a ∈ ({0, 1, 2, 3} : Finset (Fin 7)) ∧
b ∈ ({0, 1, 2, 3} : Finset (Fin 7))) ∧
(∀ a b, G2.Adj a b → a ∈ ({0, 1, 2, 4, 5, 6} : Finset (Fin 7)) ∧
b ∈ ({0, 1, 2, 4, 5, 6} : Finset (Fin 7))) ∧
G1.edgeSet ∩ G2.edgeSet = (↑D : Set (Sym2 (Fin 7))) ∧
(∀ R : Finset (Fin 7), R.card ≤ 2 → (G.induce {v | v ∉ R}).Connected) ∧
(∀ t : Finset (Fin 7), G.IsNClique 3 t → G1.IsNClique 3 t ∨ G2.IsNClique 3 t) ∧
simple_graph_triangle_cover_number G1 ≤ 2 * simple_graph_triangle_packing_number G1 ∧
simple_graph_triangle_cover_number G2 ≤ 2 * simple_graph_triangle_packing_number G2 ∧
simple_graph_triangle_packing_number G =
simple_graph_triangle_packing_number H1 + simple_graph_triangle_packing_number H2 + 1 ∧
(∀ e ∈ D,
simple_graph_triangle_packing_number G ≠
simple_graph_triangle_packing_number (H1 ⊔ SimpleGraph.fromEdgeSet ({e} : Set (Sym2 (Fin 7)))) +
simple_graph_triangle_packing_number (H2 ⊔ SimpleGraph.fromEdgeSet ({e} : Set (Sym2 (Fin 7)))) + 1)simple_graph_three_vertex_connected_five_classificationIn LeanGraph Theory & Graph Algorithms
Classification: the only 3-vertex-connected simple graphs on 5 vertices other than K5 are, up to isomorphism, K5 minus one edge and the 4-wheel.
theorem simple_graph_three_vertex_connected_five_classification (G : SimpleGraph (Fin 5)) [DecidableRel G.Adj] (h : simple_graph_three_vertex_connected G) (hne : G ≠ ⊤) : Nonempty (G ≃g five_k5_sub_edge) ∨ Nonempty (G ≃g five_wheel_four)
simple_graph_triangle_codegree_eq_common_neighboursIn LeanGraph Theory & Graph Algorithms
For adjacent vertices a and b, the triangles of G containing the edge ab are in bijection with the common neighbours of a and b.
theorem simple_graph_triangle_codegree_eq_common_neighbours {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (a b : V) (hab : G.Adj a b) :
((simple_graph_triangle_edge_family G).filter (fun t => Sym2.mk a b ∈ t)).card =
(G.neighborFinset a ∩ G.neighborFinset b).cardsimple_graph_triangle_cover_iff_edge_family_certificateIn LeanGraph Theory & Graph Algorithms
The triangle packing-cover inequality for a finite graph is equivalent to a factor-two disjoint-packing and point-cover certificate for its triangle edge-set family.
theorem simple_graph_triangle_cover_iff_edge_family_certificate
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) :
(simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number G) ↔
∃ Q : Finset (Finset (Sym2 V)), ∃ C : Finset (Sym2 V),
Q ⊆ simple_graph_triangle_edge_family G ∧
(Q : Set (Finset (Sym2 V))).Pairwise Disjoint ∧
(∀ F ∈ simple_graph_triangle_edge_family G, ¬ Disjoint F C) ∧
C.card ≤ 2 * Q.cardsimple_graph_triangle_cover_mem_of_large_bookIn LeanGraph Theory & Graph Algorithms
If an edge s(u, v) belongs to a book of triangles strictly larger than a cover C, and C covers all of them, then s(u, v) must be in C.
theorem simple_graph_triangle_cover_mem_of_large_book
{V : Type*} [DecidableEq V] (G : SimpleGraph V) (u v : V) (huv : G.Adj u v)
(W : Finset V) (hW : ∀ w ∈ W, G.IsNClique 3 ({u, v, w} : Finset V))
(C : Finset (Sym2 V)) (hC_card : C.card < W.card)
(hC_cov : ∀ w ∈ W, ∃ e ∈ C, ∀ x ∈ e, x ∈ ({u, v, w} : Finset V)) :
s(u, v) ∈ Csimple_graph_triangle_cover_number_le_two_mul_packing_number_of_packing_critical_two_leIn LeanGraph Theory & Graph Algorithms
Packing-critical case of Tuza's conjecture: if deleting any single edge of G leaves the triangle packing number unchanged and 2 ≤ ν(G), then τ(G) ≤ 2ν(G).
theorem simple_graph_triangle_cover_number_le_two_mul_packing_number_of_packing_critical_two_le
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(hν : 2 ≤ simple_graph_triangle_packing_number G)
(h : ∀ e ∈ G.edgeSet,
simple_graph_triangle_packing_number (G.deleteEdges {e}) =
simple_graph_triangle_packing_number G) :
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gsimple_graph_triangle_cover_of_disjoint_trianglesIn LeanGraph Theory & Graph Algorithms
If all triangles of G are contained in A or in B, and cross-side triangles share at most 1 vertex, then the triangle cover-packing bound τ ≤ 2ν transfers from the induced subgraphs G[A] and G[B] to G.
theorem simple_graph_triangle_cover_of_disjoint_triangles
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (A B : Finset V)
(hall : ∀ t : Finset V, G.IsNClique 3 t → t ⊆ A ∨ t ⊆ B)
(hdisj : ∀ t₁ t₂ : Finset V, G.IsNClique 3 t₁ → G.IsNClique 3 t₂ →
t₁ ⊆ A → t₂ ⊆ B → (t₁ ∩ t₂).card ≤ 1)
(hA : simple_graph_triangle_cover_number (G.induce (A : Set V)) ≤
2 * simple_graph_triangle_packing_number (G.induce (A : Set V)))
(hB : simple_graph_triangle_cover_number (G.induce (B : Set V)) ≤
2 * simple_graph_triangle_packing_number (G.induce (B : Set V))) :
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gsimple_graph_triangle_cover_of_near_high_codegree_inductionIn LeanGraph Theory & Graph Algorithms
Given the conjectured inequality for every graph on the same vertices with smaller packing number, it holds for a graph of packing number at least two with an edge of codegree at least twice that number minus one.
theorem simple_graph_triangle_cover_of_near_high_codegree_induction
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hIH : ∀ H : SimpleGraph V,
simple_graph_triangle_packing_number H < simple_graph_triangle_packing_number G →
simple_graph_triangle_cover_number H ≤ 2 * simple_graph_triangle_packing_number H)
(u v : V) (huv : G.Adj u v)
(htwo : 2 ≤ simple_graph_triangle_packing_number G)
(hlarge : 2 * simple_graph_triangle_packing_number G ≤
((Finset.univ : Finset V).filter (fun w => G.Adj u w ∧ G.Adj v w)).card + 1) :
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gsimple_graph_triangle_cover_of_one_edge_gluingIn LeanGraph Theory & Graph Algorithms
If all triangles lie in A or B and triangles across A and B meet only along a single shared edge e, then τ ≤ 2ν holds for G given the factor-two bound on G[A], G[B], (G\e)[A], and (G\e)[B].
theorem simple_graph_triangle_cover_of_one_edge_gluing
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (A B : Finset V)
(e : Sym2 V) (he : e ∈ G.edgeSet)
(hall : ∀ t : Finset V, G.IsNClique 3 t → t ⊆ A ∨ t ⊆ B)
(hshare : ∀ t₁ t₂ : Finset V, G.IsNClique 3 t₁ → G.IsNClique 3 t₂ →
t₁ ⊆ A → t₂ ⊆ B → 2 ≤ (t₁ ∩ t₂).card → ∀ x ∈ e, x ∈ t₁ ∧ x ∈ t₂)
(hA : simple_graph_triangle_cover_number (G.induce (A : Set V)) ≤
2 * simple_graph_triangle_packing_number (G.induce (A : Set V)))
(hB : simple_graph_triangle_cover_number (G.induce (B : Set V)) ≤
2 * simple_graph_triangle_packing_number (G.induce (B : Set V)))
(hA_del : simple_graph_triangle_cover_number ((G.deleteEdges {e}).induce (A : Set V)) ≤
2 * simple_graph_triangle_packing_number ((G.deleteEdges {e}).induce (A : Set V)))
(hB_del : simple_graph_triangle_cover_number ((G.deleteEdges {e}).induce (B : Set V)) ≤
2 * simple_graph_triangle_packing_number ((G.deleteEdges {e}).induce (B : Set V))) :
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gsimple_graph_triangle_cover_of_stable_near_high_codegreeIn LeanGraph Theory & Graph Algorithms
If deleting an edge preserves triangle packing number at least two and its codegree is at least twice that number minus one, the triangle cover number is at most twice the packing number.
theorem simple_graph_triangle_cover_of_stable_near_high_codegree
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(u v : V) (huv : G.Adj u v)
(htwo : 2 ≤ simple_graph_triangle_packing_number G)
(hlarge : 2 * simple_graph_triangle_packing_number G ≤
((Finset.univ : Finset V).filter (fun w => G.Adj u w ∧ G.Adj v w)).card + 1)
(hstable : simple_graph_triangle_packing_number (G.deleteEdges {s(u,v)}) =
simple_graph_triangle_packing_number G) :
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gsimple_graph_triangle_cover_of_two_vertex_separator_inductionIn LeanGraph Theory & Graph Algorithms
If two proper vertex sets cover the graph, meet in at most two vertices, and have no edges between their exclusive parts, then the triangle packing-cover inequality follows from the inequality for all smaller finite graphs.
theorem simple_graph_triangle_cover_of_two_vertex_separator_induction
(V : Type) [Fintype V] [DecidableEq V] (G : SimpleGraph V) (A B : Finset V)
(hcover : A ∪ B = Finset.univ)
(hA : A.card < Fintype.card V) (hB : B.card < Fintype.card V)
(hsep : (A ∩ B).card ≤ 2)
(hcross : ∀ x ∈ A \ B, ∀ y ∈ B \ A, ¬ G.Adj x y)
(hind : ∀ (W : Type) [Fintype W] [DecidableEq W], Fintype.card W < Fintype.card V →
∀ H : SimpleGraph W,
simple_graph_triangle_cover_number H ≤ 2 * simple_graph_triangle_packing_number H) :
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gsimple_graph_triangle_cover_packing_gap_cover_lowerIn LeanGraph Theory & Graph Algorithms
Any set of edges of the witness graph meeting every triangle has at least six elements.
theorem simple_graph_triangle_cover_packing_gap_cover_lower (C : Finset (Sym2 (Fin 7)))
(hsub : ∀ g ∈ C, g ∈ simple_graph_triangle_cover_packing_gap_witness_graph.edgeSet)
(hcov : ∀ t : Finset (Fin 7), simple_graph_triangle_cover_packing_gap_witness_graph.IsNClique 3 t →
∃ g ∈ C, ∀ x ∈ g, x ∈ t) : 6 ≤ C.cardsimple_graph_triangle_cover_packing_gap_cover_meetsIn LeanGraph Theory & Graph Algorithms
A triangle edge cover of the witness graph that avoids both {0,2} and {1,4} has at least seven edges.
theorem simple_graph_triangle_cover_packing_gap_cover_meets (C : Finset (Sym2 (Fin 7)))
(hsub : ∀ g ∈ C, g ∈ simple_graph_triangle_cover_packing_gap_witness_graph.edgeSet)
(hcov : ∀ t : Finset (Fin 7), simple_graph_triangle_cover_packing_gap_witness_graph.IsNClique 3 t →
∃ g ∈ C, ∀ x ∈ g, x ∈ t)
(he : Sym2.mk (0 : Fin 7) 2 ∉ C) (hf : Sym2.mk (1 : Fin 7) 4 ∉ C) : 7 ≤ C.cardsimple_graph_triangle_cover_packing_gap_cover_upper_boundIn LeanGraph Theory & Graph Algorithms
The six edges {0,2}, {0,3}, {2,3}, {4,5}, {4,6}, {5,6} cover every triangle of the witness graph.
theorem simple_graph_triangle_cover_packing_gap_cover_upper_bound :
∃ C : Finset (Sym2 (Fin 7)),
(∀ g ∈ C, g ∈ simple_graph_triangle_cover_packing_gap_witness_graph.edgeSet) ∧
(∀ t : Finset (Fin 7), simple_graph_triangle_cover_packing_gap_witness_graph.IsNClique 3 t →
∃ g ∈ C, ∀ x ∈ g, x ∈ t) ∧ C.card = 6simple_graph_triangle_cover_packing_gap_edge_finset_cardIn LeanGraph Theory & Graph Algorithms
The listed edge family of the witness graph has 17 members.
theorem simple_graph_triangle_cover_packing_gap_edge_finset_card :
simple_graph_triangle_cover_packing_gap_edge_finset.card = 17simple_graph_triangle_cover_packing_gap_edge_set_eqIn LeanGraph Theory & Graph Algorithms
An unordered pair is an edge of the witness graph iff it is one of the 17 listed edges.
theorem simple_graph_triangle_cover_packing_gap_edge_set_eq (e : Sym2 (Fin 7)) :
e ∈ simple_graph_triangle_cover_packing_gap_witness_graph.edgeSet ↔
e ∈ simple_graph_triangle_cover_packing_gap_edge_finsetsimple_graph_triangle_cover_packing_gap_packing_avoidsIn LeanGraph Theory & Graph Algorithms
Every size-five triangle packing of the witness graph avoids both {0,2} and {1,4}.
theorem simple_graph_triangle_cover_packing_gap_packing_avoids (P : Finset (Finset (Fin 7)))
(hcl : ∀ t ∈ P, simple_graph_triangle_cover_packing_gap_witness_graph.IsNClique 3 t)
(hdis : (P : Set (Finset (Fin 7))).Pairwise (fun s t => (s ∩ t).card ≤ 1))
(hcard : P.card = 5) :
∀ t ∈ P, ¬ (∀ x ∈ Sym2.mk (0 : Fin 7) 2, x ∈ t) ∧
¬ (∀ x ∈ Sym2.mk (1 : Fin 7) 4, x ∈ t)simple_graph_triangle_cover_packing_gap_packing_lowerIn LeanGraph Theory & Graph Algorithms
The five triangles {0,3,6}, {0,4,5}, {1,5,6}, {2,3,5}, {2,4,6} form a triangle packing in the witness graph.
theorem simple_graph_triangle_cover_packing_gap_packing_lower :
∃ P : Finset (Finset (Fin 7)),
(∀ t ∈ P, simple_graph_triangle_cover_packing_gap_witness_graph.IsNClique 3 t) ∧
(P : Set (Finset (Fin 7))).Pairwise (fun s t => (s ∩ t).card ≤ 1) ∧ P.card = 5simple_graph_triangle_cover_packing_gap_packing_upperIn LeanGraph Theory & Graph Algorithms
Any set of pairwise edge-disjoint triangles in the witness graph has at most five members.
theorem simple_graph_triangle_cover_packing_gap_packing_upper (P : Finset (Finset (Fin 7)))
(hcl : ∀ t ∈ P, simple_graph_triangle_cover_packing_gap_witness_graph.IsNClique 3 t)
(hdis : (P : Set (Finset (Fin 7))).Pairwise (fun s t => (s ∩ t).card ≤ 1)) :
P.card ≤ 5simple_graph_triangle_cover_packing_gap_special_edges_memIn LeanGraph Theory & Graph Algorithms
Both {0,2} and {1,4} are edges of the witness graph, while {0,1} is not.
theorem simple_graph_triangle_cover_packing_gap_special_edges_mem :
Sym2.mk (0 : Fin 7) 2 ∈ simple_graph_triangle_cover_packing_gap_witness_graph.edgeSet ∧
Sym2.mk (1 : Fin 7) 4 ∈ simple_graph_triangle_cover_packing_gap_witness_graph.edgeSet ∧
Sym2.mk (0 : Fin 7) 1 ∉ simple_graph_triangle_cover_packing_gap_witness_graph.edgeSetsimple_graph_triangle_cover_packing_gap_triangle_set_eqIn LeanGraph Theory & Graph Algorithms
A three-element vertex set is a triangle of the witness graph iff it is one of the 19 listed triangles.
theorem simple_graph_triangle_cover_packing_gap_triangle_set_eq (t : Finset (Fin 7)) :
simple_graph_triangle_cover_packing_gap_witness_graph.IsNClique 3 t ↔
t ∈ simple_graph_triangle_cover_packing_gap_triangle_finsetsimple_graph_triangle_free_full_two_extra_forks_half_independentIn LeanGraph Theory & Graph Algorithms
If a triangle-free graph is exactly the union of one paired fork per vertex pair and two additional paired forks, it has an independent set containing at least half of its vertices.
theorem simple_graph_triangle_free_full_two_extra_forks_half_independent
(m : ℕ) (G : SimpleGraph (Fin m × Fin 2))
(w : Fin m → Fin m × Fin 2) (i₁ i₂ : Fin m)
(z₁ z₂ : Fin m × Fin 2)
(hw : ∀ i, (w i).1 ≠ i) (hz₁ : z₁.1 ≠ i₁) (hz₂ : z₂.1 ≠ i₂)
(hG : ∀ x y, G.Adj x y ↔
(∃ i : Fin m, (x.1 = i ∧ y = w i) ∨ (y.1 = i ∧ x = w i)) ∨
(x.1 = i₁ ∧ y = z₁) ∨ (y.1 = i₁ ∧ x = z₁) ∨
(x.1 = i₂ ∧ y = z₂) ∨ (y.1 = i₂ ∧ x = z₂))
(htriangle : G.CliqueFree 3) :
∃ I : Finset (Fin m × Fin 2), m ≤ I.card ∧ G.IsIndepSet (I : Set (Fin m × Fin 2))simple_graph_triangle_packing_cover_bounded_induced_kernelIn LeanGraph Theory & Graph Algorithms
For every finite simple graph and cover budget q, there is an induced subgraph with at most 3 times the triangle packing number times q+1 vertices, preserving the triangle packing number and whether a cover of size at most q exists.
theorem simple_graph_triangle_packing_cover_bounded_induced_kernel
(n : ℕ) (G : SimpleGraph (Fin n)) (q : ℕ) :
∃ S : Finset (Fin n),
S.card ≤ 3 * simple_graph_triangle_packing_number G * (q + 1) ∧
simple_graph_triangle_packing_number (G.induce (S : Set (Fin n))) = simple_graph_triangle_packing_number G ∧
(simple_graph_triangle_cover_number (G.induce (S : Set (Fin n))) ≤ q ↔
simple_graph_triangle_cover_number G ≤ q)simple_graph_triangle_packing_decreases_of_pair_hitting_triangle_neighborhoodIn LeanGraph Theory & Graph Algorithms
Let t be a triangle in a finite simple graph and let e and f be edges. If every triangle sharing an edge with t contains e or f, deleting e and f strictly decreases the triangle packing number.
theorem simple_graph_triangle_packing_decreases_of_pair_hitting_triangle_neighborhood {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (t : Finset V) (e f : Sym2 V) (he : e ∈ G.edgeSet) (hf : f ∈ G.edgeSet) (ht : G.IsNClique 3 t) (hhit : ∀ s : Finset V, G.IsNClique 3 s → 2 ≤ (s ∩ t).card → (∀ x ∈ e, x ∈ s) ∨ (∀ x ∈ f, x ∈ s)) : simple_graph_triangle_packing_number (G.deleteEdges {e, f}) < simple_graph_triangle_packing_number Gsimple_graph_triangle_packing_neighborhood_type_kernelIn LeanGraph Theory & Graph Algorithms
Retaining a maximum packing support and at most k+2 vertices of each neighborhood type yields an induced subgraph of size at most 3k+(k+2)2^(3k) preserving the packing number, 2-edge deletion packing numbers, and singleton-forcing equivalences.
theorem simple_graph_triangle_packing_neighborhood_type_kernel
(n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] :
∃ W : Finset (Fin n),
W.card ≤ 3 * simple_graph_triangle_packing_number G +
(simple_graph_triangle_packing_number G + 2) * 2 ^ (3 * simple_graph_triangle_packing_number G) ∧
let H := G.induce (W : Set (Fin n));
let emb : Sym2 {x : Fin n // x ∈ W} ↪ Sym2 (Fin n) := (Function.Embedding.subtype (fun x : Fin n => x ∈ W)).sym2Map;
simple_graph_triangle_packing_number H = simple_graph_triangle_packing_number G ∧
(∀ e f : Sym2 {x : Fin n // x ∈ W}, e ∈ H.edgeSet → f ∈ H.edgeSet →
simple_graph_triangle_packing_number (H.deleteEdges {e, f}) =
simple_graph_triangle_packing_number (G.deleteEdges {emb e, emb f})) ∧
(∀ P : Finset (Finset (Sym2 {x : Fin n // x ∈ W})),
P ⊆ simple_graph_triangle_edge_family H →
P.card = simple_graph_triangle_packing_number H →
(P : Set (Finset (Sym2 {x : Fin n // x ∈ W}))).Pairwise Disjoint →
∀ p ∈ P, (p ⊆ (((simple_graph_triangle_edge_family H).filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id) ↔
p.map emb ⊆ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ (P.image (fun q => q.map emb)).biUnion id).card = 1)).biUnion id)))simple_graph_triangle_packing_number_delete_edges_eq_of_avoiding_packingsIn LeanGraph Theory & Graph Algorithms
If every edge of G is avoided by some maximum-size triangle packing of G, then deleting any single edge of G preserves the triangle packing number.
theorem simple_graph_triangle_packing_number_delete_edges_eq_of_avoiding_packings
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V)
(havoid : ∀ e ∈ G.edgeSet, ∃ Q : Finset (Finset V),
(∀ t ∈ Q, G.IsNClique 3 t) ∧
(Q : Set (Finset V)).Pairwise (fun s t => (s ∩ t).card ≤ 1) ∧
Q.card = simple_graph_triangle_packing_number G ∧
∀ t ∈ Q, e ∉ finite_vertex_set_edge_encoding t) :
∀ e ∈ G.edgeSet,
simple_graph_triangle_packing_number (G.deleteEdges {e}) =
simple_graph_triangle_packing_number Gsimple_graph_triangle_packing_number_ge_card_of_packingIn LeanGraph Theory & Graph Algorithms
Any explicit family T of triangles of a finite simple graph G that are pairwise edge-disjoint (any two share at most one vertex) has cardinality at most the triangle packing number ν(G).
theorem simple_graph_triangle_packing_number_ge_card_of_packing {V : Type*} [DecidableEq V] [Fintype V]
(G : SimpleGraph V) (T : Finset (Finset V))
(htri : ∀ t ∈ T, G.IsNClique 3 t)
(hpair : (T : Set (Finset V)).Pairwise (fun s t => (s ∩ t).card ≤ 1)) :
T.card ≤ simple_graph_triangle_packing_number Gsimple_graph_triangle_packing_odd_degree_edge_boundIn LeanGraph Theory & Graph Algorithms
For a finite graph, six times its triangle packing number plus the number of odd-degree vertices is at most twice its number of edges.
theorem simple_graph_triangle_packing_odd_degree_edge_bound (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] : 6 * simple_graph_triangle_packing_number G + (((Finset.univ : Finset (Fin n)).filter (fun v => Odd (G.degree v))).card) ≤ 2 * G.edgeFinset.card
simple_graph_triangle_packing_pair_deletion_forcing_quadratic_kernelIn LeanGraph Theory & Graph Algorithms
Every finite simple graph G of triangle packing number k has an induced subgraph H on at most 3k(k+3) vertices with the same packing number, with the same packing number after deleting any specified pair of H-edges in H and G, and such that each triangle of each maximum H-packing is fully singleton-forced in H if and only if it is fully singleton-forced in G relative to the same packing.
theorem simple_graph_triangle_packing_pair_deletion_forcing_quadratic_kernel (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] : ∃ W : Finset (Fin n), W.card ≤ 3 * simple_graph_triangle_packing_number G * (simple_graph_triangle_packing_number G + 3) ∧ let H := G.induce (W : Set (Fin n)); let emb : Sym2 {x : Fin n // x ∈ W} ↪ Sym2 (Fin n) := (Function.Embedding.subtype (fun x : Fin n => x ∈ W)).sym2Map; simple_graph_triangle_packing_number H = simple_graph_triangle_packing_number G ∧ (∀ e f : Sym2 {x : Fin n // x ∈ W}, e ∈ H.edgeSet → f ∈ H.edgeSet → simple_graph_triangle_packing_number (H.deleteEdges {e, f}) = simple_graph_triangle_packing_number (G.deleteEdges {emb e, emb f})) ∧ (∀ P : Finset (Finset (Sym2 {x : Fin n // x ∈ W})), P ⊆ simple_graph_triangle_edge_family H → P.card = simple_graph_triangle_packing_number H → (P : Set (Finset (Sym2 {x : Fin n // x ∈ W}))).Pairwise Disjoint → ∀ p ∈ P, (p ⊆ (((simple_graph_triangle_edge_family H).filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id) ↔ p.map emb ⊆ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ (P.image (fun q => q.map emb)).biUnion id).card = 1)).biUnion id)))simple_graph_triangle_packing_pair_deletion_forcing_sharp_kernelIn LeanGraph Theory & Graph Algorithms
Every finite simple graph G of triangle packing number k has an induced subgraph H on at most k(k+5) vertices with the same packing number, with the same packing number after deleting any specified pair of H-edges in H and G, and such that each triangle of each maximum H-packing is fully singleton-forced in H if and only if it is fully singleton-forced in G relative to the same packing.
theorem simple_graph_triangle_packing_pair_deletion_forcing_sharp_kernel (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] : ∃ W : Finset (Fin n), W.card ≤ simple_graph_triangle_packing_number G * (simple_graph_triangle_packing_number G + 5) ∧ let H := G.induce (W : Set (Fin n)); let emb : Sym2 {x : Fin n // x ∈ W} ↪ Sym2 (Fin n) := (Function.Embedding.subtype (fun x : Fin n => x ∈ W)).sym2Map; simple_graph_triangle_packing_number H = simple_graph_triangle_packing_number G ∧ (∀ e f : Sym2 {x : Fin n // x ∈ W}, e ∈ H.edgeSet → f ∈ H.edgeSet → simple_graph_triangle_packing_number (H.deleteEdges {e, f}) = simple_graph_triangle_packing_number (G.deleteEdges {emb e, emb f})) ∧ (∀ P : Finset (Finset (Sym2 {x : Fin n // x ∈ W})), P ⊆ simple_graph_triangle_edge_family H → P.card = simple_graph_triangle_packing_number H → (P : Set (Finset (Sym2 {x : Fin n // x ∈ W}))).Pairwise Disjoint → ∀ p ∈ P, (p ⊆ (((simple_graph_triangle_edge_family H).filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id) ↔ p.map emb ⊆ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ (P.image (fun q => q.map emb)).biUnion id).card = 1)).biUnion id)))simple_graph_triangle_packing_remap_into_representativesIn LeanGraph Theory & Graph Algorithms
A triangle packing of size at most k can be remapped into a superset W of its support set S, while avoiding at most two specified edges, provided every omitted triangle has a pair of S-vertices with at least k+2 available common neighbors in W outside S and every original triangle has at most one vertex outside S.
theorem simple_graph_triangle_packing_remap_into_representatives {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (S W : Finset V) (hSW : S ⊆ W) (k : ℕ) (D : Finset (Sym2 V)) (hD : D.card ≤ 2) (R : Finset (Finset V)) (hR : ∀ t ∈ R, G.IsNClique 3 t) (hpair : (R : Set (Finset V)).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hcard : R.card ≤ k) (houtside : ∀ t ∈ R, (t \ S).card ≤ 1) (havoid : ∀ t ∈ R, ∀ a ∈ t, ∀ b ∈ t, a ≠ b → s(a,b) ∉ D) (hbooks : ∀ t ∈ R, ¬ t ⊆ W → ∃ a ∈ S, ∃ b ∈ S, a ≠ b ∧ a ∈ t ∧ b ∈ t ∧ k + 2 ≤ ((W \ S).filter (fun y => G.Adj a y ∧ G.Adj b y)).card) : ∃ R' : Finset (Finset V), R'.card = R.card ∧ (∀ t ∈ R', G.IsNClique 3 t ∧ t ⊆ W ∧ ∀ a ∈ t, ∀ b ∈ t, a ≠ b → s(a,b) ∉ D) ∧ (R' : Set (Finset V)).Pairwise (fun t u => (t ∩ u).card ≤ 1)simple_graph_triangle_singleton_witness_relocateIn LeanGraph Theory & Graph Algorithms
A singleton-forcing triangle outside W can be relocated into W while preserving its exact packed-edge intersection, if it has k+1 retained outside-support common neighbors and the packing uses at most k outside-support vertices.
theorem simple_graph_triangle_singleton_witness_relocate {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (S W : Finset V) (hSW : S ⊆ W) (k : ℕ) (R : Finset (Finset V)) (hcard : R.card ≤ k) (houtside : ∀ t ∈ R, (t \ S).card ≤ 1) (hwithin : R.biUnion id ⊆ W) (a b x : V) (ha : a ∈ S) (hb : b ∈ S) (hab : a ≠ b) (hx : x ∉ W) (htri : G.IsNClique 3 ({a,b,x} : Finset V)) (hsingle : (finite_vertex_set_edge_encoding ({a,b,x} : Finset V) ∩ R.biUnion finite_vertex_set_edge_encoding).card = 1) (hbooks : k + 1 ≤ ((W \ S).filter (fun y => G.Adj a y ∧ G.Adj b y)).card) : ∃ y ∈ W \ S, G.Adj a y ∧ G.Adj b y ∧ finite_vertex_set_edge_encoding ({a,b,y} : Finset V) ∩ R.biUnion finite_vertex_set_edge_encoding = {s(a,b)}simple_graph_two_edge_stable_five_triangle_outside_packing_exampleIn LeanGraph Theory & Graph Algorithms
There is a ten-vertex two-edge-stable graph of triangle packing number eight, with the specified maximum packing avoiding vertex zero, whose neighborhood is exactly vertices one through five and induces a five-cycle. Consequently that outside vertex spans exactly five packed edges and belongs to exactly five triangles.
theorem simple_graph_two_edge_stable_five_triangle_outside_packing_example : let P : Finset (Finset (Fin 10)) := {{1,2,9},{1,5,8},{2,3,7},{2,6,8},{3,4,6},{3,8,9},{4,5,9},{5,6,7}}; ∃ G : SimpleGraph (Fin 10), (∀ t ∈ P, G.IsNClique 3 t) ∧ (P : Set (Finset (Fin 10))).Pairwise (fun t u => (t ∩ u).card ≤ 1) ∧ P.card = 8 ∧ simple_graph_triangle_packing_number G = 8 ∧ (∀ e f : Sym2 (Fin 10), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) ∧ (0 : Fin 10) ∉ P.biUnion id ∧ (∀ v : Fin 10, G.Adj 0 v ↔ v ∈ ({1,2,3,4,5} : Finset (Fin 10))) ∧ (∀ u ∈ ({1,2,3,4,5} : Finset (Fin 10)), ∀ v ∈ ({1,2,3,4,5} : Finset (Fin 10)), G.Adj u v ↔ s(u,v) ∈ ({s(1,2),s(2,3),s(3,4),s(4,5),s(5,1)} : Finset (Sym2 (Fin 10))))simple_graph_two_edge_stable_good_packing_five_triangle_outside_exampleIn LeanGraph Theory & Graph Algorithms
There is a ten-vertex two-edge-stable graph with the displayed good maximum eight-triangle packing avoiding a vertex whose link is exactly a five-cycle. Each packed triangle has at most one singleton-forced packed edge.
theorem simple_graph_two_edge_stable_good_packing_five_triangle_outside_example : let P : Finset (Finset (Fin 10)) := {{1,2,9},{1,5,8},{2,3,7},{2,6,8},{3,4,6},{3,8,9},{4,5,9},{5,6,7}}; ∃ G : SimpleGraph (Fin 10), (∀ t ∈ P, G.IsNClique 3 t) ∧ (P : Set (Finset (Fin 10))).Pairwise (fun t u => (t ∩ u).card ≤ 1) ∧ P.card = 8 ∧ simple_graph_triangle_packing_number G = 8 ∧ (∀ p ∈ P, (finite_vertex_set_edge_encoding p ∩ (((simple_graph_triangle_edge_family G).filter (fun t => (t ∩ P.biUnion finite_vertex_set_edge_encoding).card = 1)).biUnion id)).card ≤ 1) ∧ (∀ e f : Sym2 (Fin 10), e ∈ G.edgeSet → f ∈ G.edgeSet → e ≠ f → simple_graph_triangle_packing_number (G.deleteEdges {e,f}) = simple_graph_triangle_packing_number G) ∧ (0 : Fin 10) ∉ P.biUnion id ∧ (∀ v : Fin 10, G.Adj 0 v ↔ v ∈ ({1,2,3,4,5} : Finset (Fin 10))) ∧ (∀ u ∈ ({1,2,3,4,5} : Finset (Fin 10)), ∀ v ∈ ({1,2,3,4,5} : Finset (Fin 10)), G.Adj u v ↔ s(u,v) ∈ ({s(1,2),s(2,3),s(3,4),s(4,5),s(5,1)} : Finset (Sym2 (Fin 10))))simple_graph_two_edge_stable_single_exchange_trap_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a connected 27-vertex graph with 93 edges, packing number 23, all edge pairs avoidable by maximum packings, at least two triangles per edge, and a vertex of degree at least 20, together with a maximum packing containing a fully forced triangle such that no one-triangle exchange leads to a maximum packing without forced triangles.
theorem simple_graph_two_edge_stable_single_exchange_trap_counterexample :
∃ (G : SimpleGraph (Fin 27)) (E : Finset (Sym2 (Fin 27)))
(P : Finset (Finset (Sym2 (Fin 27)))),
let F := simple_graph_triangle_edge_family G
(↑E : Set (Sym2 (Fin 27))) = G.edgeSet ∧ E.card = 93 ∧
G.Connected ∧
(∀ Q : Finset (Finset (Sym2 (Fin 27))), Q ⊆ F →
(Q : Set (Finset (Sym2 (Fin 27)))).Pairwise Disjoint → Q.card ≤ 23) ∧
P ⊆ F ∧ P.card = 23 ∧
(P : Set (Finset (Sym2 (Fin 27)))).Pairwise Disjoint ∧
(∀ e ∈ G.edgeSet, ∀ f ∈ G.edgeSet, e ≠ f →
∃ Q : Finset (Finset (Sym2 (Fin 27))), Q ⊆ F ∧ Q.card = 23 ∧
(Q : Set (Finset (Sym2 (Fin 27)))).Pairwise Disjoint ∧
e ∉ Q.biUnion id ∧ f ∉ Q.biUnion id) ∧
(∀ e ∈ G.edgeSet, 2 ≤ (F.filter (fun t => e ∈ t)).card) ∧
(∃ v : Fin 27, ∃ N : Finset (Fin 27),
N.card = 20 ∧ ∀ w ∈ N, G.Adj v w) ∧
(∃ p ∈ P, p ⊆ ((F.filter (fun t => (t ∩ P.biUnion id).card = 1)).biUnion id)) ∧
∀ Q : Finset (Finset (Sym2 (Fin 27))), Q ⊆ F → Q.card = 23 →
(Q : Set (Finset (Sym2 (Fin 27)))).Pairwise Disjoint →
(P \ Q).card = 1 →
∃ q ∈ Q, q ⊆ ((F.filter (fun t => (t ∩ Q.biUnion id).card = 1)).biUnion id)simple_graph_two_regular_and_odd_components_of_odd_leap_groupIn LeanGraph Theory & Graph Algorithms
If G admits a hop and its leap group has odd order, then G is 2-regular and every connected component has an odd number of vertices.
theorem simple_graph_two_regular_and_odd_components_of_odd_leap_group {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hG : ∃ h, simple_graph_is_hop G h)
(hc : Odd (Nat.card (simple_graph_leap_group G))) :
(∀ v, G.degree v = 2) ∧ ∀ v, Odd (G.connectedComponentMk v).supp.ncardsimple_graph_two_regular_and_odd_components_of_traversedIn LeanGraph Theory & Graph Algorithms
If a hop of odd order traverses every edge (for every edge uv, h u = v or h v = u), then G is 2-regular and every connected component has an odd number of vertices.
theorem simple_graph_two_regular_and_odd_components_of_traversed {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (h : Equiv.Perm V) (hh : simple_graph_is_hop G h)
(hodd : Odd (orderOf h))
(htrav : ∀ u v, G.Adj u v → h u = v ∨ h v = u) :
(∀ v, G.degree v = 2) ∧ ∀ v, Odd (G.connectedComponentMk v).supp.ncardsimple_graph_two_side_avg_clique_pair_minIn LeanGraph Theory & Graph Algorithms
For a,b ≥ 4, the two-clique pair value is at least the K4|K_{a+b−4} model value, with equality iff a=4 or b=4.
theorem simple_graph_two_side_avg_clique_pair_min (a b : ℕ) (ha : 4 ≤ a) (hb : 4 ≤ b) :
(((32 + (a + b + 24) * 2 ^ (a + b - 5) + (a + b - 5) * 2 ^ (a + b - 3) : ℕ) : ℚ)
/ ((5 * 2 ^ (a + b - 4) + 14 : ℕ) : ℚ))
≤ (((a * 2 ^ (a - 1) + b * 2 ^ (b - 1)
+ 2 ^ (b - 1) * ((a + 1) * 2 ^ (a - 2))
+ 2 ^ (a - 1) * ((b + 1) * 2 ^ (b - 2)) : ℕ) : ℚ)
/ ((2 ^ a - 1 + (2 ^ b - 1) + 2 ^ (a - 1) * 2 ^ (b - 1) : ℕ) : ℚ)) ∧
((((a * 2 ^ (a - 1) + b * 2 ^ (b - 1)
+ 2 ^ (b - 1) * ((a + 1) * 2 ^ (a - 2))
+ 2 ^ (a - 1) * ((b + 1) * 2 ^ (b - 2)) : ℕ) : ℚ)
/ ((2 ^ a - 1 + (2 ^ b - 1) + 2 ^ (a - 1) * 2 ^ (b - 1) : ℕ) : ℚ)) =
(((32 + (a + b + 24) * 2 ^ (a + b - 5) + (a + b - 5) * 2 ^ (a + b - 3) : ℕ) : ℚ)
/ ((5 * 2 ^ (a + b - 4) + 14 : ℕ) : ℚ))
→ a = 4 ∨ b = 4)simple_graph_two_side_avg_commIn LeanGraph Theory & Graph Algorithms
The pair value is symmetric in the two sides: R(G,G',u,v) = R(G',G,v,u).
theorem simple_graph_two_side_avg_comm {V W : Type*} [Fintype V] [Fintype W]
[DecidableEq V] [DecidableEq W]
(G : SimpleGraph V) (G' : SimpleGraph W) (u : V) (v : W) :
simple_graph_two_side_avg G G' u v = simple_graph_two_side_avg G' G v usimple_graph_two_side_avg_ge_topIn LeanGraph Theory & Graph Algorithms
One-sided compression: for a fixed partner H2, replacing one side H1 by the complete graph on the same vertex set does not increase the pair value, and H1 = ⊤ is the unique minimiser.
theorem simple_graph_two_side_avg_ge_top {V W : Type*} [Fintype V] [Fintype W]
[DecidableEq V] [DecidableEq W]
(H₁ : SimpleGraph V) [DecidableRel H₁.Adj] (H₂ : SimpleGraph W) [DecidableRel H₂.Adj]
(u : V) (v : W) (hV : 4 ≤ Fintype.card V) (hW : 4 ≤ Fintype.card W)
(hc₁ : H₁.Connected) (hc₂ : H₂.Connected)
(hd₁ : ∀ x, x ≠ u → 3 ≤ H₁.degree x) (hu₁ : 2 ≤ H₁.degree u)
(hd₂ : ∀ x, x ≠ v → 3 ≤ H₂.degree x) (hu₂ : 2 ≤ H₂.degree v) :
simple_graph_two_side_avg (⊤ : SimpleGraph V) H₂ u v ≤
simple_graph_two_side_avg H₁ H₂ u v ∧
(simple_graph_two_side_avg H₁ H₂ u v = simple_graph_two_side_avg (⊤ : SimpleGraph V) H₂ u v →
H₁ = ⊤)simple_graph_two_side_avg_top_closed_formIn LeanGraph Theory & Graph Algorithms
For complete sides, N = 2^m−1, S = m·2^(m−1), P = 2^(m−1), Q = (m+1)·2^(m−2), giving the stated closed form of R(⊤,⊤,u,v) with m=|V| and m'=|W|.
theorem simple_graph_two_side_avg_top_closed_form {V W : Type*} [Fintype V] [Fintype W]
[DecidableEq V] [DecidableEq W]
(u : V) (v : W) (hV : 2 ≤ Fintype.card V) (hW : 2 ≤ Fintype.card W) :
simple_graph_two_side_avg (⊤ : SimpleGraph V) (⊤ : SimpleGraph W) u v =
(((Fintype.card V * 2 ^ (Fintype.card V - 1) + Fintype.card W * 2 ^ (Fintype.card W - 1)
+ 2 ^ (Fintype.card W - 1) * ((Fintype.card V + 1) * 2 ^ (Fintype.card V - 2))
+ 2 ^ (Fintype.card V - 1) * ((Fintype.card W + 1) * 2 ^ (Fintype.card W - 2)) : ℕ) : ℚ)
/ ((2 ^ Fintype.card V - 1 + (2 ^ Fintype.card W - 1)
+ 2 ^ (Fintype.card V - 1) * 2 ^ (Fintype.card W - 1) : ℕ) : ℚ))simple_graph_two_side_avg_top_geIn LeanGraph Theory & Graph Algorithms
For two complete sides of orders a, b ≥ 4, the pair value is at least A(K4|K_{a+b−4}), and equality forces one side to have order 4. Here a = |V|, b = |W|.
theorem simple_graph_two_side_avg_top_ge {V W : Type*} [Fintype V] [Fintype W]
[DecidableEq V] [DecidableEq W]
(u : V) (v : W) (hV : 4 ≤ Fintype.card V) (hW : 4 ≤ Fintype.card W) :
simple_graph_avg_connected_induced_order
(simple_graph_clique_four_bridge_clique (Fintype.card V + Fintype.card W)) ≤
simple_graph_two_side_avg (⊤ : SimpleGraph V) (⊤ : SimpleGraph W) u v ∧
(simple_graph_two_side_avg (⊤ : SimpleGraph V) (⊤ : SimpleGraph W) u v =
simple_graph_avg_connected_induced_order
(simple_graph_clique_four_bridge_clique (Fintype.card V + Fintype.card W)) →
Fintype.card V = 4 ∨ Fintype.card W = 4)simple_graph_universal_vertex_hamiltonian_of_spanning_pathIn LeanGraph Theory & Graph Algorithms
If u is adjacent to every other vertex of G and the graph obtained by deleting u has a Hamiltonian (spanning) path, then G is Hamiltonian.
theorem simple_graph_universal_vertex_hamiltonian_of_spanning_path {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (u : V) (hu : ∀ w : V, w ≠ u → G.Adj u w) (hV : 3 ≤ Fintype.card V) (a b : {v : V // v ≠ u}) (p : (G.induce {v : V | v ≠ u}).Walk a b) (hp : p.IsHamiltonian) : G.IsHamiltoniansimple_graph_upper_k_star_forming_le_k_independence_number_of_minimal_boundIn LeanGraph Theory & Graph Algorithms
If every minimal k-star-forming vertex set of G has cardinality at most β_k(G), then SF_k(G) ≤ β_k(G).
theorem simple_graph_upper_k_star_forming_le_k_independence_number_of_minimal_bound {V : Type*}
(G : SimpleGraph V) (k : ℕ)
(h : ∀ S : Finset V, simple_graph_is_minimal_k_star_forming G k S →
S.card ≤ simple_graph_k_independence_number G k) :
simple_graph_upper_k_star_forming_number G k ≤ simple_graph_k_independence_number G ksimple_graph_vertex_dominated_of_open_neighborhood_is_coneIn LeanGraph Theory & Graph Algorithms
If the open neighbourhood subgraph $H[N_H(u)]$ of a vertex $u$ in a simple graph $H$ is a cone, then $u$ is dominated by another vertex in $H$.
theorem simple_graph_vertex_dominated_of_open_neighborhood_is_cone {V : Type*} (H : SimpleGraph V) (u : V)
(hcone : simple_graph_is_cone (H.induce (H.neighborSet u))) :
simple_graph_vertex_dominated H usimple_graph_vertex_isolated_packed_k4_decreases_packingIn LeanGraph Theory & Graph Algorithms
If a maximum triangle packing contains abc vertex-disjoint from every other packing triangle, and abcx is a four-clique, then deleting the opposite edges ab and cx decreases the packing number, regardless of whether x belongs to another packing triangle.
theorem simple_graph_vertex_isolated_packed_k4_decreases_packing (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj] (P : Finset (Finset (Fin n))) (a b c x : Fin n) (htri : ∀ t ∈ P, G.IsNClique 3 t) (hdisj : (P : Set (Finset (Fin n))).Pairwise (fun t u => (t ∩ u).card ≤ 1)) (hmax : P.card = simple_graph_triangle_packing_number G) (hp : ({a,b,c} : Finset (Fin n)) ∈ P) (hisolated : ∀ t ∈ P, t ≠ ({a,b,c} : Finset (Fin n)) → Disjoint t ({a,b,c} : Finset (Fin n))) (hk4 : G.IsNClique 4 ({a,b,c,x} : Finset (Fin n))) : simple_graph_triangle_packing_number (G.deleteEdges {s(a,b), s(c,x)}) < simple_graph_triangle_packing_number Gsimple_graph_walk_isPath_appendIn LeanGraph Theory & Graph Algorithms
If p is a path from a to b, q is a path from b to c, and q's support after its first vertex is disjoint from p's support, then p appended to q is a path.
theorem simple_graph_walk_isPath_append {V : Type*} {G : SimpleGraph V} {a b c : V} (p : G.Walk a b) (q : G.Walk b c) (hp : p.IsPath) (hq : q.IsPath) (hdisj : ∀ x ∈ q.support.tail, x ∉ p.support) : (p.append q).IsPathsimple_graph_walk_isPath_extend_endpointIn LeanGraph Theory & Graph Algorithms
A path from a to b can be extended by one step past b to a vertex w off its support: if w is not on the path and is adjacent to b, then there is a path from a to w of length one more than the given path.
theorem simple_graph_walk_isPath_extend_endpoint {V : Type*} {G : SimpleGraph V} {a b w : V} (p : G.Walk a b) (hp : p.IsPath) (hw : w ∉ p.support) (hadj : G.Adj b w) : ∃ q : G.Walk a w, q.IsPath ∧ q.length = p.length + 1simple_graph_walk_isPath_max_length_adj_endpoint_mem_supportIn LeanGraph Theory & Graph Algorithms
On a longest path a ~> b, every neighbour of b already lies on the path.
theorem simple_graph_walk_isPath_max_length_adj_endpoint_mem_support {V : Type*} {G : SimpleGraph V} {a b : V} (p : G.Walk a b) (hp : p.IsPath) (hmax : ∀ (c d : V) (q : G.Walk c d), q.IsPath → q.length ≤ p.length) : ∀ w : V, G.Adj b w → w ∈ p.supportsparse_strong_odd_five_list_coloring_stepIn LeanGraph Theory & Graph Algorithms
If every graph on strictly fewer vertices with maximum average degree below 7/3 is strongly odd 5-list-colourable, then so is any graph G with has_mad_lt G (7/3).
theorem sparse_strong_odd_five_list_coloring_step {V : Type} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hIH : ∀ (W : Type) [Fintype W] [DecidableEq W] (G' : SimpleGraph W) [DecidableRel G'.Adj],
Fintype.card W < Fintype.card V → has_mad_lt G' (7 / 3) → is_strong_odd_list_colorable G' 5)
(hmad : has_mad_lt G (7 / 3)) :
is_strong_odd_list_colorable G 5spectral_extremal_clique_chromatic_one_twoIn LeanGraph Theory & Graph Algorithms
For any real number r ≥ 1, the extremal clique number and chromatic number under adjacency spectral radius constraint r satisfy ω_λ(1, r) = χ_λ(1, r) = 1 + ⌊r⌋ and ω_λ(2, r) = χ_λ(2, r) = 1 + ⌊r²⌋.
theorem spectral_extremal_clique_chromatic_one_two (r : ℝ) (hr : 1 ≤ r) :
spectral_extremal_clique_num 1 r = 1 + ⌊r⌋₊ ∧
spectral_extremal_chromatic_number 1 r = 1 + ⌊r⌋₊ ∧
spectral_extremal_clique_num 2 r = 1 + ⌊r ^ 2⌋₊ ∧
spectral_extremal_chromatic_number 2 r = 1 + ⌊r ^ 2⌋₊spectral_moore_degree_sum_le_of_adj_quadform_leIn LeanGraph Theory & Graph Algorithms
Let θ ≥ 1, d0 a natural number and ε > 0. There is N such that every simple graph F on Fin n with n ≥ N, all degrees at most d0, and x ⬝ᵥ (F.adjMatrix ℝ *ᵥ x) ≤ θ * (x ⬝ᵥ x) for every x : Fin n → ℝ with ∑ x = 0, has degree sum ∑ v, F.degree v ≤ n (1 + θ²/4 + ε); that is, the average degree is eventually at most 1 + θ²/4 + ε.
open Classical SimpleGraph Matrix in
theorem spectral_moore_degree_sum_le_of_adj_quadform_le (θ : ℝ) (hθ : 1 ≤ θ) (d0 : ℕ)
(ε : ℝ) (hε : 0 < ε) :
∃ N : ℕ, ∀ (n : ℕ) (F : SimpleGraph (Fin n)), N ≤ n → (∀ v, F.degree v ≤ d0) →
(∀ x : Fin n → ℝ, ∑ i, x i = 0 → x ⬝ᵥ (F.adjMatrix ℝ *ᵥ x) ≤ θ * (x ⬝ᵥ x)) →
∑ v, (F.degree v : ℝ) ≤ n * (1 + θ ^ 2 / 4 + ε)spectral_moore_exists_seidel_switch_max_degree_leIn LeanGraph Theory & Graph Algorithms
Let θ ≥ 1 and let G be a k-regular finite simple graph on a vertex type V with n = |V| ≥ 2k + 2 vertices and second largest adjacency eigenvalue at most θ. If n > a(a-1)/2 with a = 4θ(θ+1), then some Seidel switching spectral_moore_seidel_switch G X (X : Set V) has every vertex degree at most ⌈θ³ + 3θ²/2 + 3θ/2⌉₊ - 1.
open Classical SimpleGraph in
theorem spectral_moore_exists_seidel_switch_max_degree_le {V : Type*} [Fintype V]
(G : SimpleGraph V) (k : ℕ) (θ : ℝ) (hθ1 : 1 ≤ θ) (hreg : G.IsRegularOfDegree k)
(hθ : spectral_moore_second_eigenvalue_le G θ) (hn : 2 * k + 2 ≤ Fintype.card V)
(hbig : 4 * θ * (θ + 1) * (4 * θ * (θ + 1) - 1) / 2 < Fintype.card V) :
∃ X : Set V, ∀ v, (spectral_moore_seidel_switch G X).degree v ≤
⌈θ ^ 3 + 3 * θ ^ 2 / 2 + 3 * θ / 2⌉₊ - 1spectral_moore_psd_of_second_eigenvalue_leIn LeanGraph Theory & Graph Algorithms
Let θ ≥ 1, let G be a k-regular finite simple graph on V with second largest adjacency eigenvalue at most θ and 2k + 2 ≤ |V|, and let α = 1/(2θ+1). Then the matrix I + α(J − I − 2A_G) is positive semidefinite: every x : V → ℝ satisfies 0 ≤ xᵀ(I + α(J − I − 2A_G))x = (1−α)xᵀx + α(∑x)² − 2α xᵀA_Gx.
open Classical SimpleGraph Matrix in
theorem spectral_moore_psd_of_second_eigenvalue_le {V : Type*} [Fintype V]
(G : SimpleGraph V) (k : ℕ) (θ : ℝ) (hθ : 1 ≤ θ) (hreg : G.IsRegularOfDegree k)
(hlam : spectral_moore_second_eigenvalue_le G θ) (hn : 2 * k + 2 ≤ Fintype.card V)
(x : V → ℝ) :
0 ≤ (1 - (2 * θ + 1)⁻¹) * (x ⬝ᵥ x) + (2 * θ + 1)⁻¹ * (∑ v, x v) ^ 2
- 2 * (2 * θ + 1)⁻¹ * (x ⬝ᵥ (G.adjMatrix ℝ *ᵥ x))spectral_moore_quadform_le_add_degree_termIn LeanGraph Theory & Graph Algorithms
Let θ ≥ 1, let F be a simple graph on Fin n (n > 0) with maximum degree at most d0 whose adjacency form satisfies zᵀA_Fz ≤ θ zᵀz on all vectors with coordinate sum zero. Then for every nonnegative unit vector x : Fin n → ℝ supported in a finite set S, the energy xᵀA_Fx exceeds θ by at most 2·d0·|S|/n.
open Classical SimpleGraph Matrix in
theorem spectral_moore_quadform_le_add_degree_term {n : ℕ} (F : SimpleGraph (Fin n))
(θ : ℝ) (hθ : 1 ≤ θ) (d0 : ℕ) (hdeg : ∀ v, F.degree v ≤ d0)
(hquad : ∀ z : Fin n → ℝ, ∑ i, z i = 0 → z ⬝ᵥ (F.adjMatrix ℝ *ᵥ z) ≤ θ * (z ⬝ᵥ z))
(S : Finset (Fin n)) (x : Fin n → ℝ) (hx0 : ∀ v, 0 ≤ x v) (hx1 : x ⬝ᵥ x = 1)
(hsupp : ∀ v, v ∉ S → x v = 0) (hn : 0 < n) :
x ⬝ᵥ (F.adjMatrix ℝ *ᵥ x) - 2 * (d0 : ℝ) * (S.card : ℝ) / (n : ℝ) ≤ θspectral_radius_eq_nnnorm_toEuclideanCLMIn LeanGraph Theory & Graph Algorithms
The adjacency spectral radius of a finite simple graph G equals the operator norm of the continuous linear map induced by its adjacency matrix on Euclidean space.
attribute [local instance] Classical.propDecidable in
theorem spectral_radius_eq_nnnorm_toEuclideanCLM {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) :
adjacency_spectral_radius G =
‖Matrix.toEuclideanCLM (𝕜 := ℝ) (n := V) (G.adjMatrix ℝ)‖₊spectral_radius_power_two_le_sqIn LeanGraph Theory & Graph Algorithms
The adjacency spectral radius of the square of a finite simple graph G is at most the square of the adjacency spectral radius of G.
theorem spectral_radius_power_two_le_sq {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) :
adjacency_spectral_radius (simple_graph_power G 2) ≤ (adjacency_spectral_radius G) ^ 2spectral_wegner_equality_k_ge_three_le_sqrt_two_add_sqrt_fiveIn LeanGraph Theory & Graph Algorithms
For every natural number k ≥ 3 and real number r such that 1 ≤ r and r ≤ Real.sqrt (2 + Real.sqrt 5), the extremal distance-k clique number spectral_extremal_clique_num k r equals the extremal distance-k chromatic number spectral_extremal_chromatic_number k r.
theorem spectral_wegner_equality_k_ge_three_le_sqrt_two_add_sqrt_five
(k : ℕ) (hk : 3 ≤ k) (r : ℝ) (hr1 : 1 ≤ r) (hr2 : r ≤ Real.sqrt (2 + Real.sqrt 5)) :
spectral_extremal_clique_num k r = spectral_extremal_chromatic_number k rspectral_wegner_equality_k_ge_three_le_three_div_sqrt_twoIn LeanGraph Theory & Graph Algorithms
For every natural number k ≥ 3 and real number r such that 1 ≤ r and r ≤ 3 / Real.sqrt 2, the extremal distance-k clique number spectral_extremal_clique_num k r equals the extremal distance-k chromatic number spectral_extremal_chromatic_number k r.
theorem spectral_wegner_equality_k_ge_three_le_three_div_sqrt_two
(k : ℕ) (hk : 3 ≤ k) (r : ℝ) (hr1 : 1 ≤ r) (hr2 : r ≤ 3 / Real.sqrt 2) :
spectral_extremal_clique_num k r = spectral_extremal_chromatic_number k rspectral_wegner_equality_k_one_le_sqrt_two_add_sqrt_fiveIn LeanGraph Theory & Graph Algorithms
For every real number r such that 1 ≤ r and r ≤ Real.sqrt (2 + Real.sqrt 5), the extremal distance-1 clique number spectral_extremal_clique_num 1 r equals the extremal distance-1 chromatic number spectral_extremal_chromatic_number 1 r.
theorem spectral_wegner_equality_k_one_le_sqrt_two_add_sqrt_five
(r : ℝ) (hr1 : 1 ≤ r) (hr2 : r ≤ Real.sqrt (2 + Real.sqrt 5)) :
spectral_extremal_clique_num 1 r = spectral_extremal_chromatic_number 1 rspectral_wegner_equality_k_two_le_sqrt_two_add_sqrt_fiveIn LeanGraph Theory & Graph Algorithms
For every real number r such that 1 ≤ r and r ≤ Real.sqrt (2 + Real.sqrt 5), the extremal distance-2 clique number spectral_extremal_clique_num 2 r equals the extremal distance-2 chromatic number spectral_extremal_chromatic_number 2 r.
theorem spectral_wegner_equality_k_two_le_sqrt_two_add_sqrt_five
(r : ℝ) (hr1 : 1 ≤ r) (hr2 : r ≤ Real.sqrt (2 + Real.sqrt 5)) :
spectral_extremal_clique_num 2 r = spectral_extremal_chromatic_number 2 rstandardized_laplacian_order_four_im_leIn LeanGraph Theory & Graph Algorithms
For any standardized Laplacian matrix L of order 4, the imaginary part of every complex eigenvalue z of L satisfies |Im(z)| ≤ 1/4.
theorem standardized_laplacian_order_four_im_le (L : Matrix (Fin 4) (Fin 4) ℝ)
(hL : is_standardized_laplacian 4 L)
(z : ℂ) (hz : z ∈ spectrum ℂ (L.map (algebraMap ℝ ℂ))) :
|z.im| ≤ (1 : ℝ) / 4standardized_laplacian_order_four_two_fractional_im_leIn LeanGraph Theory & Graph Algorithms
For an order-4 standardized Laplacian L in which every row has at most two strictly fractional off-diagonal entries, every complex eigenvalue z has |Im z| ≤ 1/4.
theorem standardized_laplacian_order_four_two_fractional_im_le (L : Matrix (Fin 4) (Fin 4) ℝ)
(hL : is_standardized_laplacian_two_fractional 4 L) (z : ℂ)
(hz : z ∈ spectrum ℂ (L.map (algebraMap ℝ ℂ))) :
|z.im| ≤ (1 : ℝ) / 4star_graph_fin_iso_completeBipartiteGraphIn LeanGraph Theory & Graph Algorithms
For n ≥ 2, the star graph centered at any vertex u of Fin n is isomorphic to the complete bipartite graph completeBipartiteGraph (Fin 1) (Fin (n - 1)).
theorem star_graph_fin_iso_completeBipartiteGraph (n : ℕ) (hn : 2 ≤ n) (u : Fin n) : Nonempty (SimpleGraph.starGraph u ≃g completeBipartiteGraph (Fin 1) (Fin (n - 1)))
star_token_graph_perfect_dominating_set_iff_steiner_systemIn LeanGraph Theory & Graph Algorithms
Let k ≥ 2. The k-token graph of SimpleGraph.starGraph (none : Option (Fin (2 * k - 1))) has a perfect dominating set if and only if there exists a Steiner system on Fin (2 * k - 1) with parameters t = k - 2 and r = k - 1. Moreover, for any such Steiner system S, star_token_steiner_dominating_set S is a perfect dominating set of the k-token graph of SimpleGraph.starGraph (none : Option (Fin (2 * k - 1))) with Set.ncard equal to catalan k.
theorem star_token_graph_perfect_dominating_set_iff_steiner_system (k : ℕ) (hk : 2 ≤ k) :
((∃ D : Set { s : Finset (Option (Fin (2 * k - 1))) // s.card = k },
simple_graph_is_perfect_dominating
(token_graph (SimpleGraph.starGraph (none : Option (Fin (2 * k - 1)))) k) D) ↔
(∃ S : Set (Finset (Fin (2 * k - 1))), is_steiner_system (k - 2) (k - 1) S)) ∧
∀ S : Set (Finset (Fin (2 * k - 1))), is_steiner_system (k - 2) (k - 1) S →
simple_graph_is_perfect_dominating
(token_graph (SimpleGraph.starGraph (none : Option (Fin (2 * k - 1)))) k)
(star_token_steiner_dominating_set S) ∧
Set.ncard (star_token_steiner_dominating_set S) = catalan kstar_token_graph_steiner_system_of_perfect_dominatingIn LeanGraph Theory & Graph Algorithms
Let k ≥ 2. If there exists a set D of k-element finsets of Option (Fin (2 * k - 1)) that is a perfect dominating set of the k-token graph of SimpleGraph.starGraph (none : Option (Fin (2 * k - 1))), then there exists a Steiner system S on Fin (2 * k - 1) with parameters t = k - 2 and r = k - 1.
theorem star_token_graph_steiner_system_of_perfect_dominating
(k : ℕ) (hk : 2 ≤ k)
(hD : ∃ D : Set { s : Finset (Option (Fin (2 * k - 1))) // s.card = k },
simple_graph_is_perfect_dominating
(token_graph (SimpleGraph.starGraph (none : Option (Fin (2 * k - 1)))) k) D) :
∃ S : Set (Finset (Fin (2 * k - 1))), is_steiner_system (k - 2) (k - 1) Sstar_token_steiner_dominating_set_is_perfect_dominatingIn LeanGraph Theory & Graph Algorithms
Let k ≥ 2. If S is a Steiner system with parameters t = k - 2 and r = k - 1 on Fin (2 * k - 1), then star_token_steiner_dominating_set S is a perfect dominating set of the k-token graph of SimpleGraph.starGraph (none : Option (Fin (2 * k - 1))), and Set.ncard (star_token_steiner_dominating_set S) = catalan k.
theorem star_token_steiner_dominating_set_is_perfect_dominating
(k : ℕ) (hk : 2 ≤ k) (S : Set (Finset (Fin (2 * k - 1))))
(hS : is_steiner_system (k - 2) (k - 1) S) :
simple_graph_is_perfect_dominating
(token_graph (SimpleGraph.starGraph (none : Option (Fin (2 * k - 1)))) k)
(star_token_steiner_dominating_set S) ∧
Set.ncard (star_token_steiner_dominating_set S) = catalan kstar_zero_forcing_poly_eqIn LeanGraph Theory & Graph Algorithms
For m ≥ 2 the zero forcing polynomial of the star K_{1,m} on the vertex set Unit ⊕ Fin m is m·X^{m-1} + (m+1)·X^m + X^{m+1}.
theorem star_zero_forcing_poly_eq (m : ℕ) (hm : 2 ≤ m) :
zero_forcing_poly (completeBipartiteGraph Unit (Fin m)) =
Polynomial.C m * Polynomial.X ^ (m - 1) + Polynomial.C (m + 1) * Polynomial.X ^ m +
Polynomial.X ^ (m + 1)star_zf_set_iff_leaf_countIn LeanGraph Theory & Graph Algorithms
For m ≥ 2, a set S of vertices of the star K_{1,m} (vertices Unit ⊕ Fin m, centre Sum.inl (), leaves Sum.inr x) is a zero forcing set if and only if S contains all but at most one of the m leaves, i.e. m - 1 ≤ #{x : Fin m | Sum.inr x ∈ S}.
theorem star_zf_set_iff_leaf_count (m : ℕ) (hm : 2 ≤ m) (S : Finset (Unit ⊕ Fin m)) :
is_zero_forcing_set (completeBipartiteGraph Unit (Fin m)) (S : Set (Unit ⊕ Fin m)) ↔
m - 1 ≤ (Finset.univ.filter (fun x : Fin m => (Sum.inr x : Unit ⊕ Fin m) ∈ S)).cardstrong_odd_coloring_extend_leaf_vertexIn LeanGraph Theory & Graph Algorithms
Let g be a strong odd colouring of G - v and let v have at most one neighbour u, with the closed neighbourhood of v using at most 5 colours from a list L v of size at least 5; then some colour of L v can be inserted at v to give a strong odd colouring of G.
theorem strong_odd_coloring_extend_leaf_vertex {V κ : Type} [Fintype V] [DecidableEq V]
[DecidableEq κ] (G : SimpleGraph V) [DecidableRel G.Adj] (v : V) (L : V → Finset κ)
(g : V → κ) (hcard : 5 ≤ (L v).card)
(hout : is_strong_odd_coloring (G.induce {x | x ≠ v}) (fun x => g x.1))
(hdeg : G.degree v ≤ 1)
(hnb : ∀ u ∈ G.neighborFinset v, G.degree u ≤ 4) :
∃ c ∈ L v, is_strong_odd_coloring G (Function.update g v c)strong_odd_list_colorable_of_degree_le_twoIn LeanGraph Theory & Graph Algorithms
If every vertex of a finite simple graph G has degree at most 2, then for every assignment of colour lists of size at least 5, G has a strong odd colouring picking from the lists.
theorem strong_odd_list_colorable_of_degree_le_two {V : Type} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hdeg : ∀ v, G.degree v ≤ 2) :
is_strong_odd_list_colorable G 5strongly_regular_dist_eq_two_of_not_adjIn LeanGraph Theory & Graph Algorithms
In a connected, noncomplete strongly regular graph with parameters (n, k, ℓ, μ), any two distinct nonadjacent vertices are at distance 2.
theorem strongly_regular_dist_eq_two_of_not_adj {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {n k ℓ μ : ℕ}
(hG : G.IsSRGWith n k ℓ μ) (hconn : G.Connected) (hnc : G ≠ ⊤)
{u v : V} (hne : u ≠ v) (hna : ¬ G.Adj u v) :
G.dist u v = 2strongly_regular_geodesic_card_of_not_adjIn LeanGraph Theory & Graph Algorithms
In a connected, noncomplete strongly regular graph with parameters (n, k, ℓ, μ), the number of geodesics between any two distinct nonadjacent vertices is exactly μ.
theorem strongly_regular_geodesic_card_of_not_adj {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {n k ℓ μ : ℕ}
(hG : G.IsSRGWith n k ℓ μ) (hconn : G.Connected) (hnc : G ≠ ⊤)
{u v : V} (hne : u ≠ v) (hna : ¬ G.Adj u v) :
Nat.card {p : G.Walk u v // is_geodesic p} = μstrongly_regular_is_k_geodetic_iffIn LeanGraph Theory & Graph Algorithms
Let G be a connected, noncomplete strongly regular graph with parameters (n, k, ℓ, μ) on a finite vertex set, and let K ≥ 1 be an integer. Then G is K-geodetic if and only if μ ≤ K.
theorem strongly_regular_is_k_geodetic_iff {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {n k ℓ μ : ℕ}
(hG : G.IsSRGWith n k ℓ μ) (hconn : G.Connected) (hnc : G ≠ ⊤)
(K : ℕ) (hK : 1 ≤ K) :
is_k_geodetic G K ↔ μ ≤ Kstrongly_regular_mu_ne_zeroIn LeanGraph Theory & Graph Algorithms
In a connected, noncomplete strongly regular graph with parameters (n, k, ℓ, μ), the parameter μ is nonzero.
theorem strongly_regular_mu_ne_zero {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] {n k ℓ μ : ℕ}
(hG : G.IsSRGWith n k ℓ μ) (hconn : G.Connected) (hnc : G ≠ ⊤) :
μ ≠ 0subcubic_induce_V3_le_two_exists_degree_le_twoIn LeanGraph Theory & Graph Algorithms
A nonempty finite graph of maximum degree at most 3 in which the degree-3 vertices induce a subgraph of maximum degree at most 2 has a vertex of degree at most 2 (in particular it is never 3-regular, since then every vertex would be a degree-3 vertex whose induced degree is 3).
theorem subcubic_induce_V3_le_two_exists_degree_le_two
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hV : Nonempty V)
(hdeg : G.maxDegree ≤ 3)
(h3 : (G.induce (simple_graph_V3 G : Set V)).maxDegree ≤ 2) :
∃ v : V, G.degree v ≤ 2subcubic_max_indep_compl_maxDegree_le_twoIn LeanGraph Theory & Graph Algorithms
In any finite graph of maximum degree at most 3, the induced subgraph on the complement of any maximal independent set has maximum degree at most 2.
open SimpleGraph in
open scoped Classical in
theorem subcubic_max_indep_compl_maxDegree_le_two {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hdeg : G.maxDegree ≤ 3) (L : Finset V) (hL : Maximal G.IsIndepSet (L : Set V)) :
(G.induce (Lᶜ : Set V)).maxDegree ≤ 2subcubic_max_indep_compl_vertex_has_neighbor_inIn LeanGraph Theory & Graph Algorithms
If L is a maximum independent set, every vertex outside L has a neighbour in L.
open SimpleGraph in
theorem subcubic_max_indep_compl_vertex_has_neighbor_in {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (L : Finset V) (hL : G.IsMaximumIndepSet L) :
∀ v : V, v ∉ L → ∃ u ∈ L, G.Adj u vsubcubic_max_indep_compl_vertex_two_outside_neighborsIn LeanGraph Theory & Graph Algorithms
In a subcubic graph, a vertex outside a maximum independent set that is dominated by it has at most two neighbours outside the set.
open SimpleGraph in
theorem subcubic_max_indep_compl_vertex_two_outside_neighbors {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (hdeg : G.maxDegree ≤ 3)
(L : Finset V) (hA : ∀ v : V, v ∉ L → ∃ u ∈ L, G.Adj u v) :
∀ v : V, v ∉ L → (G.neighborFinset v \ L).card ≤ 2subcubic_max_indep_single_swapIn LeanGraph Theory & Graph Algorithms
If a vertex v outside a maximum independent set L has exactly one neighbour u in L, then swapping u for v yields another maximum independent set.
open SimpleGraph in
theorem subcubic_max_indep_single_swap {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(L : Finset V) (hL : G.IsMaximumIndepSet L)
(v : V) (hv : v ∉ L) (u : V) (hu : u ∈ L)
(honly : ∀ u' ∈ L, G.Adj u' v → u' = u) :
G.IsMaximumIndepSet (insert v (L.erase u))subcubic_minDegree_two_induce_V3_le_two_exists_rich_neighbor_five_coloringIn LeanGraph Theory & Graph Algorithms
Every finite simple graph with minimum degree at least 2, maximum degree at most 3, and induced subgraph on the degree-3 vertices of maximum degree at most 2 (Delta(G[V_3]) <= 2) admits a rich-neighbor 5-edge-colouring. In such a graph every cubic vertex has a degree-2 neighbour, so the cubic-cubic edges form disjoint paths and cycles rather than a matching.
theorem subcubic_minDegree_two_induce_V3_le_two_exists_rich_neighbor_five_coloring {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hmin : ∀ v, 2 ≤ G.degree v) (hdeg : G.maxDegree ≤ 3)
(h3 : (G.induce (simple_graph_V3 G : Set V)).maxDegree ≤ 2) :
∃ c : G.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring G csubcubic_odd_girth_seven_max_indep_improveIn LeanGraph Theory & Graph Algorithms
Every maximum independent set L of a finite subcubic graph of odd girth at least 7 that has a complement component of order at least 6 can be replaced by another maximum independent set L' whose complement components have a strictly smaller sum of squares of orders.
open SimpleGraph in
open scoped Classical in
theorem subcubic_odd_girth_seven_max_indep_improve {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hdeg : G.maxDegree ≤ 3) (hog : simple_graph_odd_girth_ge G 7)
(L : Finset V) (hL : G.IsMaximumIndepSet L)
(hbig : ∃ C : (G.induce (Lᶜ : Set V)).ConnectedComponent, 6 ≤ Fintype.card C) :
∃ L' : Finset V, G.IsMaximumIndepSet L' ∧
subcubic_partition_measure G L' < subcubic_partition_measure G Lsubcubic_odd_girth_seven_partition_of_isBipartiteIn LeanGraph Theory & Graph Algorithms
Every finite bipartite simple graph admits a partition into an independent set L and R = Lᶜ such that every connected component of G[R] has order at most 5 (in fact at most 1).
open SimpleGraph in
open scoped Classical in
theorem subcubic_odd_girth_seven_partition_of_isBipartite {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hbip : G.IsBipartite) :
∃ L : Finset V, G.induce (L : Set V) = ⊥ ∧
∀ C : (G.induce (Lᶜ : Set V)).ConnectedComponent, Fintype.card C ≤ 5subcubic_partition_of_improveIn LeanGraph Theory & Graph Algorithms
If every maximum independent set with a complement component of order at least 6 can be improved (strictly decreasing the sum of squares of complement component orders, while staying a maximum independent set), then G admits a partition into an independent set L whose complement components all have order at most 5.
open SimpleGraph in
open scoped Classical in
theorem subcubic_partition_of_improve {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(himprove : ∀ L : Finset V, G.IsMaximumIndepSet L →
(∃ C : (G.induce (Lᶜ : Set V)).ConnectedComponent, 6 ≤ Fintype.card C) →
∃ L' : Finset V, G.IsMaximumIndepSet L' ∧
subcubic_partition_measure G L' < subcubic_partition_measure G L) :
∃ L : Finset V, G.induce (L : Set V) = ⊥ ∧
∀ C : (G.induce (Lᶜ : Set V)).ConnectedComponent, Fintype.card C ≤ 5subcubic_partition_of_improve_le_sixIn LeanGraph Theory & Graph Algorithms
If every maximum independent set with a complement component of order at least 7 can be strictly improved with respect to subcubic_partition_measure, then G admits an independent set L whose complement components all have order at most 6.
open SimpleGraph in
open scoped Classical in
theorem subcubic_partition_of_improve_le_six {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(himprove : ∀ L : Finset V, G.IsMaximumIndepSet L →
(∃ C : (G.induce (Lᶜ : Set V)).ConnectedComponent, 7 ≤ open scoped Classical in Fintype.card C) →
∃ L' : Finset V, G.IsMaximumIndepSet L' ∧
subcubic_partition_measure G L' < subcubic_partition_measure G L) :
∃ L : Finset V, G.induce (L : Set V) = ⊥ ∧
∀ C : (G.induce (Lᶜ : Set V)).ConnectedComponent,
open scoped Classical in Fintype.card C ≤ 6subcubic_rich_neighbor_five_degree_two_cubic_neighbor_extensionIn LeanGraph Theory & Graph Algorithms
Let v have degree 2 in a finite graph of maximum degree at most 3, with distinct neighbours u1, u2 at least one of which has degree 3. If the graph obtained by deleting v admits a rich-neighbor 5-edge-colouring, then so does G.
theorem subcubic_rich_neighbor_five_degree_two_cubic_neighbor_extension
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(v u₁ u₂ : V) (hdeg : G.maxDegree ≤ 3) (hv : G.degree v = 2)
(h₁ : G.Adj v u₁) (h₂ : G.Adj v u₂) (hne : u₁ ≠ u₂)
(hu : G.degree u₁ = 3 ∨ G.degree u₂ = 3)
(hc : ∃ c : (G.induce {w : V | w ≠ v}).lineGraph.Coloring (Fin 5),
simple_graph_is_rich_neighbor_coloring (G.induce {w : V | w ≠ v}) c) :
∃ c : G.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring G csubcubic_rich_neighbor_five_degree_two_low_degree_neighbors_extensionIn LeanGraph Theory & Graph Algorithms
Let v have degree 2 in a finite graph of maximum degree at most 3, with two distinct neighbours u1, u2 both of degree at most 2. If the graph obtained by deleting v admits a rich-neighbor 5-edge-colouring, then so does G.
theorem subcubic_rich_neighbor_five_degree_two_low_degree_neighbors_extension
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(v u₁ u₂ : V) (hdeg : G.maxDegree ≤ 3) (hv : G.degree v = 2)
(h₁ : G.Adj v u₁) (h₂ : G.Adj v u₂) (hne : u₁ ≠ u₂)
(hu₁ : G.degree u₁ ≤ 2) (hu₂ : G.degree u₂ ≤ 2)
(hc : ∃ c : (G.induce {w : V | w ≠ v}).lineGraph.Coloring (Fin 5),
simple_graph_is_rich_neighbor_coloring (G.induce {w : V | w ≠ v}) c) :
∃ c : G.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring G csubcubic_rich_neighbor_five_leaf_cubic_neighbor_extensionIn LeanGraph Theory & Graph Algorithms
Let v be a leaf of a finite graph of maximum degree at most 3 whose unique neighbour u has degree 3. If the graph obtained by deleting v admits a rich-neighbor 5-edge-colouring, then so does G.
theorem subcubic_rich_neighbor_five_leaf_cubic_neighbor_extension
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(v u : V) (hdeg : G.maxDegree ≤ 3) (hvu : G.Adj v u) (hv : G.degree v = 1)
(hu : G.degree u = 3)
(hc : ∃ c : (G.induce {w : V | w ≠ v}).lineGraph.Coloring (Fin 5),
simple_graph_is_rich_neighbor_coloring (G.induce {w : V | w ≠ v}) c) :
∃ c : G.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring G csubcubic_rich_neighbor_five_leaf_edge_extendIn LeanGraph Theory & Graph Algorithms
Let G be a finite simple graph with maximum degree at most 3, let v be a leaf of G with unique neighbour u (G.Adj v u and G.degree v = 1), and suppose that G with the edge uv deleted admits a rich-neighbor 5-edge-colouring. Then G admits one.
theorem subcubic_rich_neighbor_five_leaf_edge_extend {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (v u : V)
(hdeg : G.maxDegree ≤ 3) (hvu : G.Adj v u) (hleaf : G.degree v = 1)
(hc : ∃ c : (G.deleteEdges {s(v, u)}).lineGraph.Coloring (Fin 5),
simple_graph_is_rich_neighbor_coloring (G.deleteEdges {s(v, u)}) c) :
∃ c : G.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring G csubcubic_rich_neighbor_five_leaf_low_degree_neighbor_extensionIn LeanGraph Theory & Graph Algorithms
Let v be a leaf of a finite graph of maximum degree at most 3, with unique neighbour u, and suppose u has degree at most 2. If the graph obtained by deleting v admits a rich-neighbor 5-edge-colouring, then so does G.
theorem subcubic_rich_neighbor_five_leaf_low_degree_neighbor_extension
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(v u : V) (hdeg : G.maxDegree ≤ 3) (hvu : G.Adj v u) (hv : G.degree v = 1)
(hu : G.degree u ≤ 2)
(hc : ∃ c : (G.induce {w : V | w ≠ v}).lineGraph.Coloring (Fin 5),
simple_graph_is_rich_neighbor_coloring (G.induce {w : V | w ≠ v}) c) :
∃ c : G.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring G csubcubic_rich_neighbor_five_of_card_eq_zeroIn LeanGraph Theory & Graph Algorithms
Every finite simple graph on an empty vertex type admits a rich-neighbor 5-edge-coloring.
theorem subcubic_rich_neighbor_five_of_card_eq_zero {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] (h0 : Fintype.card V = 0) :
∃ c : G.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring G csubcubic_rich_neighbor_five_of_vertex_extensionIn LeanGraph Theory & Graph Algorithms
If every finite subcubic graph G with a vertex v of degree at most 2 satisfying: the induced subgraph of G on the vertices other than v admits a rich-neighbor 5-edge-colouring, itself admits one, then every finite graph of maximum degree at most 3 whose degree-3 vertices induce a subgraph of maximum degree at most 2 admits a rich-neighbor 5-edge-colouring.
theorem subcubic_rich_neighbor_five_of_vertex_extension
(h : ∀ {W : Type*} [Fintype W] [DecidableEq W] (H : SimpleGraph W) [DecidableRel H.Adj] (v : W),
H.maxDegree ≤ 3 → H.degree v ≤ 2 →
(∃ c : (H.induce {w : W | w ≠ v}).lineGraph.Coloring (Fin 5),
simple_graph_is_rich_neighbor_coloring (H.induce {w : W | w ≠ v}) c) →
∃ c : H.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring H c) :
∀ {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj],
G.maxDegree ≤ 3 → (G.induce (simple_graph_V3 G : Set V)).maxDegree ≤ 2 →
∃ c : G.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring G csubcubic_rich_neighbor_five_vertex_extensionIn LeanGraph Theory & Graph Algorithms
Let G be a finite graph of maximum degree at most 3 and v a vertex of degree at most 2. If the induced subgraph of G on the vertices other than v admits a rich-neighbor 5-edge-colouring, then so does G.
theorem subcubic_rich_neighbor_five_vertex_extension
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(v : V) (hdeg : G.maxDegree ≤ 3) (hv : G.degree v ≤ 2)
(hc : ∃ c : (G.induce {w : V | w ≠ v}).lineGraph.Coloring (Fin 5),
simple_graph_is_rich_neighbor_coloring (G.induce {w : V | w ≠ v}) c) :
∃ c : G.lineGraph.Coloring (Fin 5), simple_graph_is_rich_neighbor_coloring G csubcubic_triangle_free_max_indep_improveIn LeanGraph Theory & Graph Algorithms
In any subcubic triangle-free finite simple graph, every maximum independent set with a complement component of order at least 7 can be strictly improved to another maximum independent set with strictly smaller sum-of-squares potential.
open SimpleGraph in
open scoped Classical in
theorem subcubic_triangle_free_max_indep_improve {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(hdeg : G.maxDegree ≤ 3) (htri : G.CliqueFree 3)
(L : Finset V) (hL : G.IsMaximumIndepSet L)
(hbig : ∃ C : (G.induce (Lᶜ : Set V)).ConnectedComponent,
7 ≤ open scoped Classical in Fintype.card C) :
∃ L' : Finset V, G.IsMaximumIndepSet L' ∧
subcubic_partition_measure G L' < subcubic_partition_measure G Lsublinear_expansion_arithmetic_boundIn LeanGraph Theory & Graph Algorithms
If e_U = e_S + e_C + b, 2 * e_U = n * d, 2 * e_S ≤ s * (d / log n) * log s, and 2 * e_C ≤ (n - s) * d, then b / s ≥ (d / (2 * log n)) * log (n / s).
theorem sublinear_expansion_arithmetic_bound
(d n s e_U e_S e_C b : ℝ)
(hs : 0 < s) (hsn : s ≤ n) (hlog : 0 < Real.log n)
(he_U : 2 * e_U = n * d)
(h_sum : e_U = e_S + e_C + b)
(he_S : 2 * e_S ≤ s * (d / Real.log n) * Real.log s)
(he_C : 2 * e_C ≤ (n - s) * d) :
b / s ≥ (d / (2 * Real.log n)) * Real.log (n / s)sublinear_expansion_max_avg_degree_log_subgraphIn LeanGraph Theory & Graph Algorithms
Let G be a finite simple graph and let U be a vertex subset with |U| ≥ 2 maximizing d(G[U']) / log |U'| over all vertex subsets U' with |U'| ≥ 2. Then for every nonempty subset S ⊆ U, the edge boundary ∂ S in G[U] satisfies |∂ S| / |S| ≥ (d(G[U]) / (2 log |U|)) * log(|U| / |S|).
open scoped Classical in
theorem sublinear_expansion_max_avg_degree_log_subgraph
{V : Type*} [Fintype V] (G : SimpleGraph V)
(U : Finset V) (hU : 2 ≤ U.card)
(hmax : ∀ U' : Finset V, 2 ≤ U'.card →
graph_average_degree (G.induce (U' : Set V)) / Real.log (U'.card : ℝ) ≤
graph_average_degree (G.induce (U : Set V)) / Real.log (U.card : ℝ))
(S : Finset V) (hS_sub : S ⊆ U) (hS_ne : S.Nonempty) :
((graph_edge_boundary G U S).card : ℝ) / S.card ≥
(graph_average_degree (G.induce (U : Set V)) / (2 * Real.log (U.card : ℝ))) *
Real.log ((U.card : ℝ) / S.card)sum_filter_card_two_eq_sum_ordered_pairsIn LeanGraph Theory & Graph Algorithms
For any finite linear order V and any function f on finite vertex sets, the sum of f over all 2-element subsets equals the sum of f {a,b} over all ordered pairs a < b.
theorem sum_filter_card_two_eq_sum_ordered_pairs {V : Type*} [Fintype V] [LinearOrder V]
(f : Finset V → ℕ) :
(∑ s ∈ (Finset.univ : Finset (Finset V)).filter (fun s : Finset V => s.card = 2), f s)
= ∑ p ∈ (Finset.univ : Finset (V × V)).filter (fun p : V × V => p.1 < p.2),
f {p.1, p.2}sum_fin_pair_lt_sub_eq_sum_choose_twoIn LeanGraph Theory & Graph Algorithms
The sum of b - a over all ordered pairs a < b of vertices of {0,...,n-1} equals the sum of (b+1 choose 2) over b = 0, ..., n-1.
theorem sum_fin_pair_lt_sub_eq_sum_choose_two (n : ℕ) :
(∑ p ∈ (Finset.univ : Finset (Fin n × Fin n)).filter (fun p : Fin n × Fin n => p.1 < p.2),
(p.2.val - p.1.val)) = ∑ b ∈ Finset.range n, (b + 1).choose 2sum_range_sub_eq_choose_twoIn LeanGraph Theory & Graph Algorithms
For every n, the sum of n - i over i = 0, ..., n-1 equals the binomial coefficient (n+1 choose 2).
theorem sum_range_sub_eq_choose_two (n : ℕ) :
(∑ i ∈ Finset.range n, (n - i)) = (n + 1).choose 2sum_range_succ_choose_twoIn LeanGraph Theory & Graph Algorithms
The hockey-stick identity for k = 2: the sum of (b+1 choose 2) over b = 0, ..., n-1 equals (n+1 choose 3).
theorem sum_range_succ_choose_two (n : ℕ) :
(∑ b ∈ Finset.range n, (b + 1).choose 2) = (n + 1).choose 3supertoken_cycle_arrow_chain_blocksIn LeanGraph Theory & Graph Algorithms
Let r ≥ 1 and let t : ℕ → ℕ (departure times) and f : ℕ → ℤ with f j = ±1 for every j < 2r. Suppose that whenever j < 2r and the arrow target j + f j is again in [0, 2r), the departure time strictly decreases, t (j + f j) < t j. Then at least r of the vertices j ∈ [0, 2r) are "bad", i.e. satisfy (j < r and f j = -1) or (r ≤ j and f j = 1).
theorem supertoken_cycle_arrow_chain_blocks (r : ℕ) (hr : 1 ≤ r)
(t : ℕ → ℕ) (f : ℕ → ℤ)
(hf : ∀ j, j < 2 * r → f j = 1 ∨ f j = -1)
(hdec : ∀ j, j < 2 * r → ∀ j', j' < 2 * r → (j' : ℤ) = (j : ℤ) + f j → t j' < t j) :
r ≤ ((Finset.range (2 * r)).filter (fun j => (j < r ∧ f j = -1) ∨ (r ≤ j ∧ f j = 1))).cardsupertoken_cycle_diameter_upper_bound_gtIn LeanGraph Theory & Graph Algorithms
For any natural numbers m ≥ 1, s ≥ 2, and k with 2 * m * s < k and k < (2 * m + 1) * s, the diameter of the supertoken graph supertoken_graph (SimpleGraph.cycleGraph (2 * m + 1)) k s is at most k * m.
theorem supertoken_cycle_diameter_upper_bound_gt (m s k : ℕ)
(hm : 1 ≤ m) (hs : 2 ≤ s) (hk_gt : 2 * m * s < k) (hks : k < (2 * m + 1) * s) :
(supertoken_graph (SimpleGraph.cycleGraph (2 * m + 1)) k s).diam ≤ k * msupertoken_cycle_diameter_upper_bound_leIn LeanGraph Theory & Graph Algorithms
For any natural numbers m ≥ 1, s ≥ 2, and k with 1 ≤ k, k ≤ 2 * m * s, and k < (2 * m + 1) * s, the diameter of the supertoken graph supertoken_graph (SimpleGraph.cycleGraph (2 * m + 1)) k s is at most k * m + k / (2 * s).
theorem supertoken_cycle_diameter_upper_bound_le (m s k : ℕ)
(hm : 1 ≤ m) (hs : 2 ≤ s) (hk : 1 ≤ k) (hk_le : k ≤ 2 * m * s) (hks : k < (2 * m + 1) * s) :
(supertoken_graph (SimpleGraph.cycleGraph (2 * m + 1)) k s).diam ≤ k * m + k / (2 * s)supertoken_cycle_jammed_edist_geIn LeanGraph Theory & Graph Algorithms
Let m ≥ 1, s ≥ 1, and let x, y be k-token configurations on C_{2m+1} with capacity s such that (i) every token is at cycle-distance exactly m from its target, (ii) the vertices 0, …, 2r-1 each carry exactly s tokens in x, (iii) a token at vertex j < r has target (j+m) mod (2m+1) and a token at vertex r ≤ j < 2r has target (j+m+1) mod (2m+1). Then the extended distance from x to y in the supertoken graph is at least k*m + r: no legal sequence of moves from x to y is shorter than k*m + r.
theorem supertoken_cycle_jammed_edist_ge (m s k r : ℕ) (hm : 1 ≤ m) (hs : 1 ≤ s)
(x y : {x : Fin k → Fin (2 * m + 1) //
∀ v : Fin (2 * m + 1), (Finset.univ.filter (fun i => x i = v)).card ≤ s})
(hdist : ∀ i : Fin k, (SimpleGraph.cycleGraph (2 * m + 1)).dist (x.1 i) (y.1 i) = m)
(hfull : ∀ j : ℕ, j < 2 * r → (Finset.univ.filter (fun i => (x.1 i : ℕ) = j)).card = s)
(hup : ∀ i : Fin k, (x.1 i : ℕ) < r → (y.1 i : ℕ) = ((x.1 i : ℕ) + m) % (2 * m + 1))
(hdown : ∀ i : Fin k, r ≤ (x.1 i : ℕ) → (x.1 i : ℕ) < 2 * r →
(y.1 i : ℕ) = ((x.1 i : ℕ) + m + 1) % (2 * m + 1)) :
((k * m + r : ℕ) : ℕ∞) ≤ (supertoken_graph (SimpleGraph.cycleGraph (2 * m + 1)) k s).edist x ysupertoken_cycle_jammed_pair_edist_geIn LeanGraph Theory & Graph Algorithms
For m ≥ 1, s ≥ 2, 1 ≤ k ≤ 2*m*s, there exist two k-token configurations on C_{2m+1} (capacity s) whose distance in the supertoken graph is at least k*m + k/(2s).
theorem supertoken_cycle_jammed_pair_edist_ge (m s k : ℕ)
(hm : 1 ≤ m) (hs : 2 ≤ s) (hk : 1 ≤ k) (hk_le : k ≤ 2 * m * s) :
∃ x y : {x : Fin k → Fin (2 * m + 1) //
∀ v : Fin (2 * m + 1), (Finset.univ.filter (fun i => x i = v)).card ≤ s},
((k * m + k / (2 * s) : ℕ) : ℕ∞) ≤
(supertoken_graph (SimpleGraph.cycleGraph (2 * m + 1)) k s).edist x ysupertoken_cycle_jammed_pair_existsIn LeanGraph Theory & Graph Algorithms
Let m ≥ 1, s ≥ 1, and let r = k / (2s) with k ≤ 2*m*s. Then there are two k-token configurations x, y on the odd cycle C_{2m+1} with capacity s such that: (i) every token is at cycle-distance exactly m from its target; (ii) each of the vertices 0, 1, …, 2r-1 carries exactly s tokens in x; (iii) a token sitting at vertex j < r has target (j + m) mod (2m+1), and a token sitting at vertex j with r ≤ j < 2r has target (j + m + 1) mod (2m+1), which is m steps down from j. Consequently every token in the block I = [0,2r) has its unique distance-decreasing first step into a vertex of I, which is full at time 0.
theorem supertoken_cycle_jammed_pair_exists (m s k r : ℕ)
(hm : 1 ≤ m) (hs : 1 ≤ s) (hr : r = k / (2 * s)) (hk : k ≤ 2 * m * s) :
∃ x y : {x : Fin k → Fin (2 * m + 1) //
∀ v : Fin (2 * m + 1), (Finset.univ.filter (fun i => x i = v)).card ≤ s},
(∀ i : Fin k, (SimpleGraph.cycleGraph (2 * m + 1)).dist (x.1 i) (y.1 i) = m) ∧
(∀ j : ℕ, j < 2 * r → (Finset.univ.filter (fun i => (x.1 i : ℕ) = j)).card = s) ∧
(∀ i : Fin k, (x.1 i : ℕ) < r → (y.1 i : ℕ) = ((x.1 i : ℕ) + m) % (2 * m + 1)) ∧
(∀ i : Fin k, r ≤ (x.1 i : ℕ) → (x.1 i : ℕ) < 2 * r →
(y.1 i : ℕ) = ((x.1 i : ℕ) + m + 1) % (2 * m + 1))supertoken_cycle_three_lower_bound_gtIn LeanGraph Theory & Graph Algorithms
For any natural numbers s ≥ 2 and k with 2 * s < k < 3 * s, the diameter of the supertoken graph supertoken_graph (SimpleGraph.cycleGraph 3) k s on C_3 is at least k.
theorem supertoken_cycle_three_lower_bound_gt (s k : ℕ)
(hs : 2 ≤ s) (hk_gt : 2 * s < k) (hks : k < 3 * s) :
k ≤ (supertoken_graph (SimpleGraph.cycleGraph 3) k s).diamsupertoken_cycle_three_lower_bound_leIn LeanGraph Theory & Graph Algorithms
For any natural numbers s ≥ 2 and k with 1 ≤ k ≤ 2 * s, the diameter of the supertoken graph supertoken_graph (SimpleGraph.cycleGraph 3) k s on C_3 is at least k + k / (2 * s).
theorem supertoken_cycle_three_lower_bound_le (s k : ℕ)
(hs : 2 ≤ s) (hk : 1 ≤ k) (hk_le : k ≤ 2 * s) :
k + k / (2 * s) ≤ (supertoken_graph (SimpleGraph.cycleGraph 3) k s).diamsupertoken_cycle_three_upper_bound_gtIn LeanGraph Theory & Graph Algorithms
For any natural numbers s ≥ 2 and k with 2 * s < k < 3 * s, the diameter of the supertoken graph supertoken_graph (SimpleGraph.cycleGraph 3) k s on C_3 is at most k.
theorem supertoken_cycle_three_upper_bound_gt (s k : ℕ)
(hs : 2 ≤ s) (hk_gt : 2 * s < k) (hks : k < 3 * s) :
(supertoken_graph (SimpleGraph.cycleGraph 3) k s).diam ≤ ksupertoken_cycle_three_upper_bound_leIn LeanGraph Theory & Graph Algorithms
For any natural numbers s ≥ 2 and k with 1 ≤ k ≤ 2 * s and k < 3 * s, the diameter of the supertoken graph supertoken_graph (SimpleGraph.cycleGraph 3) k s on C_3 is at most k + k / (2 * s).
theorem supertoken_cycle_three_upper_bound_le (s k : ℕ)
(hs : 2 ≤ s) (hk : 1 ≤ k) (hk_le : k ≤ 2 * s) (hks : k < 3 * s) :
(supertoken_graph (SimpleGraph.cycleGraph 3) k s).diam ≤ k + k / (2 * s)supertoken_graph_cycle_connectedIn LeanGraph Theory & Graph Algorithms
For m ≥ 1, s ≥ 2 and 1 ≤ k ≤ 2*m*s, the supertoken graph of the cycle C_{2m+1} with k distinguishable tokens and capacity s is connected: any configuration can be transformed into any other by legal moves. (Needed because the diameter of a disconnected graph is 0, so the lower bound would be false without it.)
theorem supertoken_graph_cycle_connected (m s k : ℕ)
(hm : 1 ≤ m) (hs : 2 ≤ s) (hk : 1 ≤ k) (hk_le : k ≤ 2 * m * s) :
(supertoken_graph (SimpleGraph.cycleGraph (2 * m + 1)) k s).Connectedsupertoken_graph_regular_of_degree_nsIn LeanGraph Theory & Graph Algorithms
Let G be a finite simple graph on vertex type V, and let s be a natural number. At maximum capacity k = |V| * s tokens, the supertoken graph supertoken_graph G (|V| * s) s is 0-regular.
open scoped Classical in
theorem supertoken_graph_regular_of_degree_ns {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (s : ℕ) :
(supertoken_graph G (Fintype.card V * s) s).IsRegularOfDegree 0supertoken_graph_regular_of_degree_ns_sub_oneIn LeanGraph Theory & Graph Algorithms
Let G be a finite simple d-regular graph on vertex type V, and let s ≥ 1. For k = |V| * s - 1 tokens, the supertoken graph supertoken_graph G (|V| * s - 1) s is regular of degree s * d.
open scoped Classical in
theorem supertoken_graph_regular_of_degree_ns_sub_one {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (d : ℕ) (hreg : G.IsRegularOfDegree d)
(s : ℕ) (hs : 1 ≤ s) :
(supertoken_graph G (Fintype.card V * s - 1) s).IsRegularOfDegree (s * d)supertoken_graph_regularity_characterizationIn LeanGraph Theory & Graph Algorithms
Let G be a finite simple d-regular graph on a vertex set V of cardinality at least 2, where d ≥ 1. Let s ≥ 2 and 1 ≤ k ≤ |V| * s. Then the supertoken graph supertoken_graph G k s is regular of some degree if and only if k ≤ s or k = |V| * s - 1 or k = |V| * s; furthermore, if k ≤ s then it is regular of degree k * d, if k = |V| * s - 1 then it is regular of degree s * d, and if k = |V| * s then it is regular of degree 0.
open scoped Classical in
theorem supertoken_graph_regularity_characterization {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (d : ℕ) (hd : 1 ≤ d) (hreg : G.IsRegularOfDegree d)
(hn : 2 ≤ Fintype.card V) (s : ℕ) (hs : 2 ≤ s) (k : ℕ) (hk1 : 1 ≤ k)
(hk2 : k ≤ Fintype.card V * s) :
((∃ r : ℕ, (supertoken_graph G k s).IsRegularOfDegree r) ↔
k ≤ s ∨ k = Fintype.card V * s - 1 ∨ k = Fintype.card V * s) ∧
(k ≤ s → (supertoken_graph G k s).IsRegularOfDegree (k * d)) ∧
(k = Fintype.card V * s - 1 → (supertoken_graph G k s).IsRegularOfDegree (s * d)) ∧
(k = Fintype.card V * s → (supertoken_graph G k s).IsRegularOfDegree 0)supertoken_graph_single_token_diamIn LeanGraph Theory & Graph Algorithms
For any simple graph G on vertex type V with decidable equality and any s ≥ 1, the diameter of the supertoken graph supertoken_graph G 1 s with a single token equals the diameter of G.
theorem supertoken_graph_single_token_diam {V : Type*} [DecidableEq V] (G : SimpleGraph V) (s : ℕ) (hs : 1 ≤ s) : (supertoken_graph G 1 s).diam = G.diamsustainable_tree_has_sustainable_predecessor_closer_to_pathIn LeanGraph Theory & Graph Algorithms
Every sustainable tree X on Fin n (n ≥ 1) that is not isomorphic to the path graph pathGraph n has a sustainable generalized-tree-shift predecessor Y whose adjacency spectral radius is strictly smaller: there are vertices u ≠ v and a path p from u to v in Y through degree-2 interior vertices with X = gts_graph Y u v p.penultimate.
theorem sustainable_tree_has_sustainable_predecessor_closer_to_path
(n : ℕ) (hn : 1 ≤ n) (X : SimpleGraph (Fin n))
(hX : is_sustainable_tree X)
(hXp : ¬ Nonempty (X ≃g SimpleGraph.pathGraph n)) :
∃ Y : SimpleGraph (Fin n),
is_sustainable_tree Y ∧ is_generalized_tree_shift Y X ∧
adjacency_spectral_radius Y < adjacency_spectral_radius Xsymmetric_f2_offdiag_clique_peelIn LeanGraph Theory & Graph Algorithms
Peeling one clique off a symmetric F₂-matrix: if M is symmetric of positive rank over ZMod 2, there exist vectors u, d with rank (M + diagonal d + u uᵀ) ≤ rank M − 1. Equivalently: M agrees off the diagonal with (u uᵀ) + a symmetric matrix of strictly smaller rank. (Only off-diagonal entries matter, so the diagonal Matrix.diagonal d is free.)
theorem symmetric_f2_offdiag_clique_peel {V : Type} [Fintype V] [DecidableEq V]
(M : Matrix V V (ZMod 2)) (hM : M.IsSymm) (hpos : 0 < M.rank) :
∃ (u d : V → ZMod 2),
(M + Matrix.diagonal d + Matrix.of (fun x y => u x * u y)).rank ≤ M.rank - 1symmetric_f2_offdiag_gram_le_rank_add_oneIn LeanGraph Theory & Graph Algorithms
For a symmetric matrix M over ZMod 2 of rank r there is a matrix S with at most r + 1 columns whose Gram matrix S Sᵀ agrees with M off the diagonal (diagonal entries of S Sᵀ are unconstrained).
theorem symmetric_f2_offdiag_gram_le_rank_add_one {V : Type} [Fintype V] [DecidableEq V]
(M : Matrix V V (ZMod 2)) (hM : M.IsSymm) :
∃ (t : ℕ) (S : Matrix V (Fin t) (ZMod 2)), t ≤ M.rank + 1 ∧
∀ x y : V, x ≠ y → (S * S.transpose) x y = M x ytemporal_path_explore_n_log_n_of_coverageIn LeanGraph Theory & Graph Algorithms
From the coverage crux it follows that there is a constant C such that every temporal graph on n ≥ 2 vertices with spanning-path snapshots can be explored from any start vertex within C·n·log n steps.
theorem temporal_path_explore_n_log_n_of_coverage
(hcov : ∃ (q B : ℕ), 0 < q ∧ ∀ (n : ℕ), 2 ≤ n → ∀ (G : ℕ → SimpleGraph (Fin n)),
(∀ t, is_spanning_path_graph (G t)) → ∀ (U : Finset (Fin n)), 2 ≤ U.card →
∃ (r : Fin n) (w : ℕ → Fin n) (T : ℕ), w 0 = r ∧ is_temporal_walk G w ∧ T ≤ B * n ∧
∃ S : Finset (Fin n), S ⊆ U ∧ U.card ≤ q * S.card ∧ ∀ u ∈ S, ∃ t ≤ T, w t = u) :
∃ C : ℝ, ∀ n : ℕ, 2 ≤ n → ∀ G : ℕ → SimpleGraph (Fin n), (∀ t, is_spanning_path_graph (G t)) →
∀ s : Fin n, ∃ (w : ℕ → Fin n) (T : ℕ), w 0 = s ∧ is_temporal_walk G w ∧
temporal_walk_explores_by w T ∧ (T : ℝ) ≤ C * n * Real.log ntemporal_path_free_start_target_coverageIn LeanGraph Theory & Graph Algorithms
OPEN CRUX (the halving step). There are absolute constants q, B > 0 such that for every temporal graph on n ≥ 2 vertices with spanning-path snapshots and every target set U with |U| ≥ 2, some freely chosen start vertex admits a temporal walk of at most B·n steps that visits at least |U|/q vertices of U.
theorem temporal_path_free_start_target_coverage :
∃ (q B : ℕ), 0 < q ∧ ∀ (n : ℕ), 2 ≤ n → ∀ (G : ℕ → SimpleGraph (Fin n)),
(∀ t, is_spanning_path_graph (G t)) → ∀ (U : Finset (Fin n)), 2 ≤ U.card →
∃ (r : Fin n) (w : ℕ → Fin n) (T : ℕ), w 0 = r ∧ is_temporal_walk G w ∧ T ≤ B * n ∧
∃ S : Finset (Fin n), S ⊆ U ∧ U.card ≤ q * S.card ∧ ∀ u ∈ S, ∃ t ≤ T, w t = utemporal_path_phase_coverageIn LeanGraph Theory & Graph Algorithms
Given the coverage crux with constants q, B, from any position v at any time t0 a single walk of at most (n−1) + B·n steps visits at least |U|/q vertices of any target set U with |U| ≥ 2.
theorem temporal_path_phase_coverage
(q B : ℕ) (hq : 0 < q)
(hcov : ∀ (n : ℕ), 2 ≤ n → ∀ (G : ℕ → SimpleGraph (Fin n)),
(∀ t, is_spanning_path_graph (G t)) → ∀ (U : Finset (Fin n)), 2 ≤ U.card →
∃ (r : Fin n) (w : ℕ → Fin n) (T : ℕ), w 0 = r ∧ is_temporal_walk G w ∧ T ≤ B * n ∧
∃ S : Finset (Fin n), S ⊆ U ∧ U.card ≤ q * S.card ∧ ∀ u ∈ S, ∃ t ≤ T, w t = u) :
∀ (n : ℕ), 2 ≤ n → ∀ (G : ℕ → SimpleGraph (Fin n)), (∀ t, is_spanning_path_graph (G t)) →
∀ (t0 : ℕ) (v : Fin n) (U : Finset (Fin n)), 2 ≤ U.card →
∃ (y : ℕ → Fin n), y 0 = v ∧
(∀ i : ℕ, y (i + 1) = y i ∨ (G (t0 + i)).Adj (y i) (y (i + 1))) ∧
∃ S : Finset (Fin n), S ⊆ U ∧ U.card ≤ q * S.card ∧
∀ u ∈ S, ∃ t ≤ (n - 1) + B * n, y t = utemporal_path_phase_iterateIn LeanGraph Theory & Graph Algorithms
Given the coverage crux, after k phases of length P = (n−1) + B·n there is a single temporal walk from s and a residual unvisited set U such that every vertex outside U is visited by time k·P and q^k·|U| ≤ n·(q−1)^k.
theorem temporal_path_phase_iterate
(q B : ℕ) (hq : 0 < q)
(hcov : ∀ (n : ℕ), 2 ≤ n → ∀ (G : ℕ → SimpleGraph (Fin n)),
(∀ t, is_spanning_path_graph (G t)) → ∀ (U : Finset (Fin n)), 2 ≤ U.card →
∃ (r : Fin n) (w : ℕ → Fin n) (T : ℕ), w 0 = r ∧ is_temporal_walk G w ∧ T ≤ B * n ∧
∃ S : Finset (Fin n), S ⊆ U ∧ U.card ≤ q * S.card ∧ ∀ u ∈ S, ∃ t ≤ T, w t = u) :
∀ (n : ℕ), 2 ≤ n → ∀ (G : ℕ → SimpleGraph (Fin n)), (∀ t, is_spanning_path_graph (G t)) →
∀ s : Fin n, ∀ k : ℕ,
∃ (w : ℕ → Fin n) (U : Finset (Fin n)), w 0 = s ∧ is_temporal_walk G w ∧
(∀ u : Fin n, u ∉ U → ∃ t ≤ k * ((n - 1) + B * n), w t = u) ∧
q ^ k * U.card ≤ n * (q - 1) ^ ktemporal_path_reach_withinIn LeanGraph Theory & Graph Algorithms
If every snapshot is a spanning path then an agent that is at vertex v at time t0 can reach any prescribed vertex u within n − 1 steps.
theorem temporal_path_reach_within {n : ℕ} (hn : 2 ≤ n) (G : ℕ → SimpleGraph (Fin n))
(hG : ∀ t, is_spanning_path_graph (G t)) (t0 : ℕ) (v u : Fin n) :
∃ w : ℕ → Fin n, w 0 = v ∧
(∀ i : ℕ, w (i + 1) = w i ∨ (G (t0 + i)).Adj (w i) (w (i + 1))) ∧
∃ j ≤ n - 1, w j = utemporal_static_path_free_start_coverageIn LeanGraph Theory & Graph Algorithms
Special case of the coverage crux: if the temporal graph is constant (all snapshots equal to one spanning path) then from a freely chosen start a walk of n − 1 steps visits every vertex, so the crux holds there with q = B = 1.
theorem temporal_static_path_free_start_coverage {n : ℕ} (hn : 2 ≤ n) {H : SimpleGraph (Fin n)}
(hH : is_spanning_path_graph H) (U : Finset (Fin n)) (hU : 2 ≤ U.card) :
∃ (r : Fin n) (w : ℕ → Fin n) (T : ℕ), w 0 = r ∧ is_temporal_walk (fun _ : ℕ => H) w ∧
T ≤ 1 * n ∧ ∃ S : Finset (Fin n), S ⊆ U ∧ U.card ≤ 1 * S.card ∧
∀ u ∈ S, ∃ t ≤ T, w t = utemporal_walk_concatIn LeanGraph Theory & Graph Algorithms
Two temporal walks in the same temporal graph, the second legal from time t0 + a and starting where the first one is at time t0 + a, glue into one temporal walk legal from time t0 that agrees with the second walk from time t0 + a on.
theorem temporal_walk_concat {n : ℕ} (G : ℕ → SimpleGraph (Fin n)) (t0 a : ℕ)
(u : Fin n) (w₁ w₂ : ℕ → Fin n)
(h₁0 : w₁ 0 = u)
(h₁ : ∀ i : ℕ, w₁ (i + 1) = w₁ i ∨ (G (t0 + i)).Adj (w₁ i) (w₁ (i + 1)))
(h₂0 : w₂ 0 = w₁ a)
(h₂ : ∀ i : ℕ, w₂ (i + 1) = w₂ i ∨ (G (t0 + a + i)).Adj (w₂ i) (w₂ (i + 1))) :
∃ w : ℕ → Fin n, w 0 = u ∧
(∀ i : ℕ, w (i + 1) = w i ∨ (G (t0 + i)).Adj (w i) (w (i + 1))) ∧
∀ i : ℕ, w (a + i) = w₂ iten_vertex_exchange_p_trapIn LeanGraph Theory & Graph Algorithms
The displayed P is a ten-packing and every ten-packing reachable from it by single-triangle swaps has a fully singleton-forced triangle.
theorem ten_vertex_exchange_p_trap :
let F := simple_graph_triangle_edge_family ten_vertex_exchange_graph
ten_vertex_exchange_packing_p ⊆ F ∧ ten_vertex_exchange_packing_p.card = 10 ∧ (ten_vertex_exchange_packing_p : Set (Finset (Sym2 (Fin 10)))).Pairwise Disjoint ∧
∀ R, Relation.ReflTransGen (fun A B : Finset (Finset (Sym2 (Fin 10))) => B ⊆ F ∧ B.card = 10 ∧ (B : Set (Finset (Sym2 (Fin 10)))).Pairwise Disjoint ∧ (A ∩ B).card = 9) ten_vertex_exchange_packing_p R →
∃ r ∈ R, r ⊆ ((F.filter (fun t => (t ∩ R.biUnion id).card = 1)).biUnion id)ten_vertex_exchange_q_goodIn LeanGraph Theory & Graph Algorithms
The displayed Q is a good ten-packing in the actual triangle family.
theorem ten_vertex_exchange_q_good :
let F := simple_graph_triangle_edge_family ten_vertex_exchange_graph
ten_vertex_exchange_packing_q ⊆ F ∧ ten_vertex_exchange_packing_q.card = 10 ∧ (ten_vertex_exchange_packing_q : Set (Finset (Sym2 (Fin 10)))).Pairwise Disjoint ∧
∀ q ∈ ten_vertex_exchange_packing_q, ¬ q ⊆ ((F.filter (fun t => (t ∩ ten_vertex_exchange_packing_q.biUnion id).card = 1)).biUnion id)third_principal_specialization_card_four_coeff_ne_zero_implies_degree_threeIn LeanGraph Theory & Graph Algorithms
If the coefficient of q^1 t^2 in the third principal specialization of a 4-vertex tree is nonzero, the tree has a vertex of degree 3.
theorem third_principal_specialization_card_four_coeff_ne_zero_implies_degree_three {V : Type*}
[Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj]
(hT : T.IsTree) (hcard : Fintype.card V = 4) :
MvPolynomial.coeff (Finsupp.single (0 : Fin 2) 1 + Finsupp.single (1 : Fin 2) 2)
(third_principal_specialization T) ≠ 0 → ∃ v : V, T.degree v = 3third_principal_specialization_card_four_degree_three_implies_coeff_ne_zeroIn LeanGraph Theory & Graph Algorithms
If a 4-vertex tree has a vertex of degree 3, then the coefficient of q^1 t^2 in its third principal specialization is nonzero.
theorem third_principal_specialization_card_four_degree_three_implies_coeff_ne_zero {V : Type*}
[Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj]
(hT : T.IsTree) (hcard : Fintype.card V = 4) :
(∃ v : V, T.degree v = 3) →
MvPolynomial.coeff (Finsupp.single (0 : Fin 2) 1 + Finsupp.single (1 : Fin 2) 2)
(third_principal_specialization T) ≠ 0third_principal_specialization_card_four_has_degree_three_iffIn LeanGraph Theory & Graph Algorithms
If two trees on 4 vertices have equal third principal specializations, then one has a vertex of degree 3 if and only if the other does.
theorem third_principal_specialization_card_four_has_degree_three_iff
{V₁ V₂ : Type*} [Fintype V₁] [DecidableEq V₁] [Fintype V₂] [DecidableEq V₂]
(T₁ : SimpleGraph V₁) (T₂ : SimpleGraph V₂)
[DecidableRel T₁.Adj] [DecidableRel T₂.Adj]
(hT₁ : T₁.IsTree) (hT₂ : T₂.IsTree)
(hcard₁ : Fintype.card V₁ = 4) (hcard₂ : Fintype.card V₂ = 4)
(heq : third_principal_specialization T₁ = third_principal_specialization T₂) :
(∃ v : V₁, T₁.degree v = 3) ↔ (∃ v : V₂, T₂.degree v = 3)third_principal_specialization_coeff_q1t2_eqIn LeanGraph Theory & Graph Algorithms
The coefficient of q^1 t^2 in the third principal specialization of a finite graph equals the number of proper 3-colourings whose colour sum is 1 and which use exactly 2 distinct colours.
theorem third_principal_specialization_coeff_q1t2_eq {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj] :
MvPolynomial.coeff (Finsupp.single (0 : Fin 2) 1 + Finsupp.single (1 : Fin 2) 2)
(third_principal_specialization G)
= ∑ c : G.Coloring (Fin 3),
(if (∑ v, ((c v : Fin 3) : ℕ)) = 1 ∧ (Finset.univ.image c).card = 2
then (1 : ℤ) else 0)third_principal_specialization_coeff_q1t2_ne_zero_iff_exists_coloringIn LeanGraph Theory & Graph Algorithms
The coefficient of q^1 t^2 in the third principal specialization of a finite graph is nonzero if and only if the graph has a proper 3-colouring of colour sum 1 using exactly 2 colours.
theorem third_principal_specialization_coeff_q1t2_ne_zero_iff_exists_coloring {V : Type*}
[Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] :
MvPolynomial.coeff (Finsupp.single (0 : Fin 2) 1 + Finsupp.single (1 : Fin 2) 2)
(third_principal_specialization G) ≠ 0
↔ ∃ c : G.Coloring (Fin 3), (∑ v, ((c v : Fin 3) : ℕ)) = 1 ∧
(Finset.univ.image c).card = 2three_connected_plane_eulerian_minimizer_is_alternatingIn LeanGraph Theory & Graph Algorithms
In a 3-vertex-connected simple plane graph G with all degrees even and plane rotation system σ, if an Eulerian orientation D has as many spanning arborescences directed towards r as an alternating orientation D₀, then D is alternating for σ.
theorem three_connected_plane_eulerian_minimizer_is_alternating {n : ℕ}
(G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(h3 : simple_graph_three_vertex_connected G) (heven : ∀ v, Even (G.degree v))
(σ : Equiv.Perm G.Dart) (hσ : simple_graph_is_plane_rotation_system G σ)
(D₀ D : Digraph (Fin n)) [DecidableRel D₀.Adj] [DecidableRel D.Adj]
(hD₀ : digraph_is_alternating_orientation G σ D₀) (hD : digraph_is_eulerian_orientation G D)
(r : Fin n) (heq : digraph_arborescence_count_at D r = digraph_arborescence_count_at D₀ r) :
digraph_is_alternating_orientation G σ Dthree_connected_plane_eulerian_non_alternating_exists_strictly_improvingIn LeanGraph Theory & Graph Algorithms
In a 3-vertex-connected simple plane graph with all degrees even, every Eulerian orientation that is not alternating for the plane rotation system σ admits another Eulerian orientation with strictly fewer spanning arborescences directed towards r.
theorem three_connected_plane_eulerian_non_alternating_exists_strictly_improving {n : ℕ}
(G : SimpleGraph (Fin n)) [DecidableRel G.Adj]
(h3 : simple_graph_three_vertex_connected G) (heven : ∀ v, Even (G.degree v))
(σ : Equiv.Perm G.Dart) (hσ : simple_graph_is_plane_rotation_system G σ)
(D : Digraph (Fin n)) [DecidableRel D.Adj] (r : Fin n)
(hD : digraph_is_eulerian_orientation G D)
(hna : ¬ digraph_is_alternating_orientation G σ D) :
∃ (D' : Digraph (Fin n)) (_ : DecidableRel D'.Adj),
digraph_is_eulerian_orientation G D' ∧
digraph_arborescence_count_at D' r < digraph_arborescence_count_at D rthree_token_k2n_adj_left_card_diffIn LeanGraph Theory & Graph Algorithms
In the 3-token graph of K_{2,n}, adjacent 3-subsets differ in the number of elements taken from the part Fin 2 by exactly one. Consequently two vertices of level 1 (one element in Fin 2) are never adjacent, and no vertex of level 0 (all three elements in Fin n) is adjacent to a vertex of level 2 (both elements of Fin 2 plus one b).
theorem three_token_k2n_adj_left_card_diff (n : ℕ) {X Y : Finset (Fin 2 ⊕ Fin n)}
(hX : X.card = 3) (hY : Y.card = 3)
(hadj : (token_graph (completeBipartiteGraph (Fin 2) (Fin n)) 3).Adj ⟨X, hX⟩ ⟨Y, hY⟩) :
(X.filter (fun x => x.isLeft = true)).card + 1 = (Y.filter (fun x => x.isLeft = true)).card ∨
(Y.filter (fun x => x.isLeft = true)).card + 1 = (X.filter (fun x => x.isLeft = true)).cardthree_token_k2n_adj_level2_iffIn LeanGraph Theory & Graph Algorithms
A level-2 vertex of F_3(K_{2,n}), i.e. a token containing both elements of Fin 2 and one b in Fin n, is adjacent exactly to the level-1 vertices (a, {b, q}) with a in Fin 2 and q ≠ b.
theorem three_token_k2n_adj_level2_iff (n : ℕ) (b : Fin n)
(hb : ({Sum.inl (0 : Fin 2), Sum.inl (1 : Fin 2), Sum.inr b} : Finset (Fin 2 ⊕ Fin n)).card = 3)
{X : Finset (Fin 2 ⊕ Fin n)} (hX : X.card = 3) :
(token_graph (completeBipartiteGraph (Fin 2) (Fin n)) 3).Adj ⟨X, hX⟩ ⟨_, hb⟩ ↔
∃ (a : Fin 2) (q : Fin n), q ≠ b ∧ X = {Sum.inl a, Sum.inr b, Sum.inr q}three_token_k2n_adj_triple_iffIn LeanGraph Theory & Graph Algorithms
A level-0 vertex of F_3(K_{2,n}), i.e. a 3-element subset T of the part Fin n, is adjacent exactly to the six level-1 vertices (a, e) with a in Fin 2 and e a 2-element subset of T.
theorem three_token_k2n_adj_triple_iff (n : ℕ) {T : Finset (Fin n)} (hT : T.card = 3)
(hT' : (T.image Sum.inr).card = 3)
{X : Finset (Fin 2 ⊕ Fin n)} (hX : X.card = 3) :
(token_graph (completeBipartiteGraph (Fin 2) (Fin n)) 3).Adj ⟨X, hX⟩ ⟨T.image Sum.inr, hT'⟩ ↔
∃ (a : Fin 2) (e : Finset (Fin n)), e.card = 2 ∧ e ⊆ T ∧
X = insert (Sum.inl a) (e.image Sum.inr)three_token_k2n_dominating_yields_pair_coverIn LeanGraph Theory & Graph Algorithms
Every dominating set S of F_3(K_{2,n}) (n ≥ 4) yields data (E, dp, U, Z) — the occupied level-1 pairs, the doubly occupied pairs, the occupied level-2 vertices and the occupied B-triples — such that all members of E and of dp are pairs, dp ⊆ E, all members of Z are 3-element sets, (α) every B-triple is in Z or contains a member of E, (β) every b is in U or lies in a member of E, (γ) for every a and every pair e, either (a,e) is in S, or e meets U, or e is contained in a member of Z; and |S| = |E| + |dp| + |U| + |Z|.
theorem three_token_k2n_dominating_yields_pair_cover (n : ℕ) (hn : 4 ≤ n)
(S : Finset {s : Finset (Fin 2 ⊕ Fin n) // s.card = 3})
(hS : simple_graph_is_dominating (token_graph (completeBipartiteGraph (Fin 2) (Fin n)) 3)
(S : Set {s : Finset (Fin 2 ⊕ Fin n) // s.card = 3})) :
∃ (E dp : Finset (Finset (Fin n))) (U : Finset (Fin n)) (Z : Finset (Finset (Fin n))),
(∀ e ∈ E, e.card = 2) ∧ dp ⊆ E ∧ (∀ T ∈ Z, T.card = 3) ∧
(∀ T : Finset (Fin n), T.card = 3 → T ∈ Z ∨ ∃ e ∈ E, e ⊆ T) ∧
(∀ b : Fin n, b ∈ U ∨ ∃ e ∈ E, b ∈ e) ∧
(∀ (a : Fin 2) (e : Finset (Fin n)), e.card = 2 →
(∃ h : (insert (Sum.inl a) (e.image Sum.inr)).card = 3,
(⟨insert (Sum.inl a) (e.image Sum.inr), h⟩ : {s : Finset (Fin 2 ⊕ Fin n) // s.card = 3}) ∈ S) ∨
(∃ b ∈ e, b ∈ U) ∨ (∃ T ∈ Z, e ⊆ T)) ∧
S.card ≥ E.card + dp.card + U.card + Z.cardthree_token_k2n_domination_number_geIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 4, the domination number of the 3-token graph F_3(K_{2,n}) of the complete bipartite graph K_{2,n} is at least (n + 1)^2 / 4 - 2.
theorem three_token_k2n_domination_number_ge (n : ℕ) (hn : 4 ≤ n) :
(n + 1)^2 / 4 - 2 ≤ simple_graph_domination_number (token_graph (completeBipartiteGraph (Fin 2) (Fin n)) 3)three_token_k2n_explicit_family_cardIn LeanGraph Theory & Graph Algorithms
The explicit candidate family has size at most the sum of the two balanced-block pair counts and n minus 2.
theorem three_token_k2n_explicit_family_card (n : ℕ) (hn : 4 ≤ n) : (three_token_k2n_explicit_family n hn).card ≤ (n / 2).choose 2 + (n - n / 2).choose 2 + n - 2
three_token_k2n_explicit_family_layer_0In LeanGraph Theory & Graph Algorithms
Every three-token configuration with 0 vertices in the two-element part lies in or is adjacent to a member of the explicit candidate family.
theorem three_token_k2n_explicit_family_layer_0 (n : ℕ) (hn : 4 ≤ n)
(z : {s : Finset (Fin 2 ⊕ Fin n) // s.card = 3})
(hz : three_token_k2n_left_count z = 0) :
z ∈ three_token_k2n_explicit_family n hn ∨
∃ w ∈ three_token_k2n_explicit_family n hn,
(token_graph (completeBipartiteGraph (Fin 2) (Fin n)) 3).Adj w zthree_token_k2n_explicit_family_layer_1In LeanGraph Theory & Graph Algorithms
Every three-token configuration with 1 vertices in the two-element part lies in or is adjacent to a member of the explicit candidate family.
theorem three_token_k2n_explicit_family_layer_1 (n : ℕ) (hn : 4 ≤ n)
(z : {s : Finset (Fin 2 ⊕ Fin n) // s.card = 3})
(hz : three_token_k2n_left_count z = 1) :
z ∈ three_token_k2n_explicit_family n hn ∨
∃ w ∈ three_token_k2n_explicit_family n hn,
(token_graph (completeBipartiteGraph (Fin 2) (Fin n)) 3).Adj w zthree_token_k2n_explicit_family_layer_2In LeanGraph Theory & Graph Algorithms
Every three-token configuration with 2 vertices in the two-element part lies in or is adjacent to a member of the explicit candidate family.
theorem three_token_k2n_explicit_family_layer_2 (n : ℕ) (hn : 4 ≤ n)
(z : {s : Finset (Fin 2 ⊕ Fin n) // s.card = 3})
(hz : three_token_k2n_left_count z = 2) :
z ∈ three_token_k2n_explicit_family n hn ∨
∃ w ∈ three_token_k2n_explicit_family n hn,
(token_graph (completeBipartiteGraph (Fin 2) (Fin n)) 3).Adj w zthree_token_k2n_four_set_triple_coverIn LeanGraph Theory & Graph Algorithms
If every 2-element subset of a 4-element set Q is contained in some member of a family Z of 3-element sets, then Z has at least three members (two triples cover at most five of the six pairs).
theorem three_token_k2n_four_set_triple_cover (n : ℕ) (Q : Finset (Fin n))
(Z : Finset (Finset (Fin n))) (hQ : Q.card = 4) (hZ : ∀ T ∈ Z, T.card = 3)
(hcov : ∀ e, e ⊆ Q → e.card = 2 → ∃ T ∈ Z, e ⊆ T) : 3 ≤ Z.cardthree_token_k2n_has_dominating_setIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 4, the 3-token graph F_3(K_{2,n}) has a dominating set S of cardinality at most (n / 2).choose 2 + (n - n / 2).choose 2 + n - 2.
theorem three_token_k2n_has_dominating_set (n : ℕ) (hn : 4 ≤ n) :
∃ S : Finset { s : Finset (Fin 2 ⊕ Fin n) // s.card = 3 },
simple_graph_is_dominating (token_graph (completeBipartiteGraph (Fin 2) (Fin n)) 3) (S : Set { s : Finset (Fin 2 ⊕ Fin n) // s.card = 3 }) ∧
S.card ≤ (n / 2).choose 2 + (n - n / 2).choose 2 + n - 2three_token_k2n_pair_cover_arithmeticIn LeanGraph Theory & Graph Algorithms
Numerical core. Let T(n) = C(n,2) - ⌊n²/4⌋. If q ≤ n, k·⌊n/2⌋ + t ≥ T(n)·⌊n/2⌋, 3s + dp ≥ q(q-1)/2, 2k ≥ q, t ≤ s, dp ≤ k, and (q = 4 implies dp > 0 or s ≥ 3), then k + dp + s ≥ T(n) + q - 2.
theorem three_token_k2n_pair_cover_arithmetic (n q k dp s t : ℕ) (hn : 4 ≤ n) (hq : q ≤ n)
(hk : k * (n / 2) + t ≥ (n * (n - 1) / 2 - n ^ 2 / 4) * (n / 2))
(hcover : 3 * s + dp ≥ q * (q - 1) / 2)
(hkq : 2 * k ≥ q) (hts : t ≤ s) (hdpk : dp ≤ k)
(hcorner : q = 4 → 0 < dp ∨ 3 ≤ s) :
k + dp + s ≥ (n * (n - 1) / 2 - n ^ 2 / 4) + q - 2three_token_star_domination_arithIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 3, with s = (n+2)/4 and p = n - 2s, the saving s*(p+1) satisfies Nat.choose n 2 - s * (p + 1) ≤ Nat.choose n 2 - (n + 1)^2 / 8 (in fact s*(p+1) = (n+1)^2 / 8).
theorem three_token_star_domination_arith (n : ℕ) (hn : 3 ≤ n) :
let s := (n + 2) / 4
let p := n - 2 * s
Nat.choose n 2 - s * (p + 1) ≤ Nat.choose n 2 - (n + 1)^2 / 8three_token_star_has_dominating_setIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 3, with s = (n+2)/4 and p = n - 2s, the 3-token graph of the star graph on Option (Fin n) has a dominating set of cardinality at most Nat.choose n 2 - s * (p + 1).
theorem three_token_star_has_dominating_set (n : ℕ) (hn : 3 ≤ n) :
let s := (n + 2) / 4
let p := n - 2 * s
∃ S : Finset { s : Finset (Option (Fin n)) // s.card = 3 },
simple_graph_is_dominating (token_graph (SimpleGraph.starGraph (none : Option (Fin n))) 3) (S : Set _) ∧
S.card ≤ Nat.choose n 2 - s * (p + 1)threshold_sequence_delete_dominatingIn LeanGraph Theory & Graph Algorithms
Deleting a dominating vertex from a threshold degree sequence yields a threshold degree sequence on n vertices with degrees decremented by 1.
theorem threshold_sequence_delete_dominating (n : ℕ) (d : Fin (n + 1) → ℕ) (v : Fin (n + 1)) (hv : d v = n) (h : is_threshold_sequence d) : is_threshold_sequence (fun w => d (v.succAbove w) - 1)
threshold_sequence_delete_isolatedIn LeanGraph Theory & Graph Algorithms
Deleting an isolated vertex from a threshold degree sequence yields a threshold degree sequence on n vertices.
theorem threshold_sequence_delete_isolated (n : ℕ) (d : Fin (n + 1) → ℕ) (v : Fin (n + 1)) (hv : d v = 0) (h : is_threshold_sequence d) : is_threshold_sequence (d ∘ v.succAbove)
threshold_sequence_has_isolated_or_dominatingIn LeanGraph Theory & Graph Algorithms
Every threshold degree sequence on n + 1 vertices has an isolated vertex (degree 0) or a dominating vertex (degree n).
theorem threshold_sequence_has_isolated_or_dominating (n : ℕ) (d : Fin (n + 1) → ℕ) (h : is_threshold_sequence d) : ∃ v : Fin (n + 1), d v = 0 ∨ d v = n
top_isTwoKTwoFreeIn LeanGraph Theory & Graph Algorithms
The complete graph on any vertex type is 2K₂-free.
theorem top_isTwoKTwoFree (V : Type*) : IsTwoKTwoFree (⊤ : SimpleGraph V)
tournament_arborescence_hadamard_boundIn LeanGraph Theory & Graph Algorithms
Every tournament T of order n ≥ 2 with outdegrees d_1, ..., d_n satisfies τ(T) ≤ √(∏_{i=1}^n ((2d_i+1)^2 + n)) / (2^{n-1} √(n(n+1))) ≤ (n(n+1)/4)^{(n-1)/2}.
theorem tournament_arborescence_hadamard_bound (n : ℕ) (hn : 2 ≤ n) (T : Digraph (Fin n)) [DecidableRel T.Adj] (hT : digraph_is_tournament T) : (digraph_arborescence_count T : ℝ) ≤ Real.sqrt (∏ i : Fin n, ((2 * (digraph_out_count T i : ℝ) + 1) ^ 2 + (n : ℝ))) / ((2 : ℝ) ^ (n - 1) * Real.sqrt ((n : ℝ) * ((n : ℝ) + 1))) ∧ Real.sqrt (∏ i : Fin n, ((2 * (digraph_out_count T i : ℝ) + 1) ^ 2 + (n : ℝ))) / ((2 : ℝ) ^ (n - 1) * Real.sqrt ((n : ℝ) * ((n : ℝ) + 1))) ≤ (((n : ℝ) * ((n : ℝ) + 1) / 4)) ^ (((n : ℝ) - 1) / 2)
tournament_arborescence_hadamard_firstIn LeanGraph Theory & Graph Algorithms
Every tournament T on Fin n with n ≥ 2 satisfies τ(T) ≤ √(∏_{i=1}^n ((2d_i+1)² + n)) / (2^{n-1} √(n(n+1))), where d_i are the out-degrees.
theorem tournament_arborescence_hadamard_first (n : ℕ) (hn : 2 ≤ n) (T : Digraph (Fin n)) [DecidableRel T.Adj] (hT : digraph_is_tournament T) : (digraph_arborescence_count T : ℝ) ≤ Real.sqrt (∏ i : Fin n, ((2 * (digraph_out_count T i : ℝ) + 1) ^ 2 + (n : ℝ))) / ((2 : ℝ) ^ (n - 1) * Real.sqrt ((n : ℝ) * ((n : ℝ) + 1)))
tournament_arborescence_hadamard_secondIn LeanGraph Theory & Graph Algorithms
For a tournament T on Fin n with n ≥ 2 and out-degrees d_i, √(∏_{i=1}^n ((2d_i+1)² + n)) / (2^{n-1}√(n(n+1))) ≤ (n(n+1)/4)^{(n-1)/2}.
theorem tournament_arborescence_hadamard_second (n : ℕ) (hn : 2 ≤ n) (T : Digraph (Fin n)) [DecidableRel T.Adj] (hT : digraph_is_tournament T) : Real.sqrt (∏ i : Fin n, ((2 * (digraph_out_count T i : ℝ) + 1) ^ 2 + (n : ℝ))) / ((2 : ℝ) ^ (n - 1) * Real.sqrt ((n : ℝ) * ((n : ℝ) + 1))) ≤ (((n : ℝ) * ((n : ℝ) + 1) / 4)) ^ (((n : ℝ) - 1) / 2)
tournament_dijoin_reverse_inversion_number_leIn LeanGraph Theory & Graph Algorithms
For finite tournaments D₁ and D₂, the inversion number of D₁ → D₂ is at most that of D̄₁ → D̄₂. (Conjecture 4.1 half-reduction).
theorem tournament_dijoin_reverse_inversion_number_le
(V W : Type) [Fintype V] [Fintype W] (D₁ : Digraph V) (D₂ : Digraph W)
(h₁ : digraph_is_tournament D₁) (h₂ : digraph_is_tournament D₂) :
digraph_inversion_number (digraph_dijoin D₁ D₂) ≤
digraph_inversion_number (digraph_dijoin (digraph_reverse D₁) (digraph_reverse D₂))tournament_hom_injectiveIn LeanGraph Theory & Graph Algorithms
Any adjacency-preserving map between tournaments is automatically injective.
theorem tournament_hom_injective {V W : Type*} (D₁ : Digraph V) (D₂ : Digraph W)
(h₁ : digraph_is_tournament D₁) (h₂ : digraph_is_tournament D₂)
(f : V → W) (hf : ∀ u v, D₂.Adj (f u) (f v) ↔ D₁.Adj u v) :
Function.Injective ftournament_inversion_number_le_min_rank_add_oneIn LeanGraph Theory & Graph Algorithms
For a finite tournament D: inv(D) ≤ tmr(D) + 1.
theorem tournament_inversion_number_le_min_rank_add_one (V : Type) [Fintype V] (D : Digraph V)
(h : digraph_is_tournament D) :
digraph_inversion_number D ≤ tournament_min_rank D + 1tournament_is_universal_monoIn LeanGraph Theory & Graph Algorithms
If a tournament T is k-universal and m ≤ k, then T is m-universal.
theorem tournament_is_universal_mono {k m : ℕ} {V : Type*} (T : Digraph V)
(h : tournament_is_universal k T) (hle : m ≤ k) :
tournament_is_universal m Ttournament_is_universal_mono_succIn LeanGraph Theory & Graph Algorithms
Any (k+1)-universal tournament is also k-universal, by extending an arbitrary k-tournament with a universal sink and restricting the embedding.
theorem tournament_is_universal_mono_succ (k : ℕ) {V : Type*} (T : Digraph V) :
tournament_is_universal (k + 1) T → tournament_is_universal k Ttournament_is_universal_of_subtournamentIn LeanGraph Theory & Graph Algorithms
If an induced subtournament is k-universal, then the ambient tournament is also k-universal.
theorem tournament_is_universal_of_subtournament (k : ℕ) {V W : Type*} (T_V : Digraph V) (T_W : Digraph W)
(h_univ : tournament_is_universal k T_V) (g : V ↪ W)
(hg : ∀ u v, T_W.Adj (g u) (g v) ↔ T_V.Adj u v) :
tournament_is_universal k T_Wtournament_not_near_regular_exists_improving_tournamentIn LeanGraph Theory & Graph Algorithms
In any tournament on 2m vertices with m ≥ 2 that is not near-regular, there exists another tournament on the same vertex set with strictly more spanning arborescences.
theorem tournament_not_near_regular_exists_improving_tournament (m : ℕ) (hm : 2 ≤ m)
(T : Digraph (Fin (2 * m))) [DecidableRel T.Adj] (hT : digraph_is_tournament T)
(hnr : ¬ tournament_is_near_regular m T) :
∃ (T' : Digraph (Fin (2 * m))) (_ : DecidableRel T'.Adj),
digraph_is_tournament T' ∧ digraph_arborescence_count T < digraph_arborescence_count T'tournament_reverse_arc_arborescence_count_ltIn LeanGraph Theory & Graph Algorithms
If u → v is an arc of a tournament and the out-degree of u exceeds that of v by at least 2, then reversing that single arc strictly increases the number of spanning arborescences.
theorem tournament_reverse_arc_arborescence_count_lt {n : ℕ} (T : Digraph (Fin n)) [DecidableRel T.Adj]
(hT : digraph_is_tournament T) (u v : Fin n) (huv : T.Adj u v)
(hdeg : digraph_out_count T v + 2 ≤ digraph_out_count T u) :
∃ (T' : Digraph (Fin n)) (_ : DecidableRel T'.Adj),
digraph_is_tournament T' ∧ digraph_arborescence_count T < digraph_arborescence_count T'tournament_reverse_arc_arborescence_count_strict_increaseIn LeanGraph Theory & Graph Algorithms
Reversing an arc u → v with out-degree gap at least 2 in a tournament strictly increases the total number of spanning arborescences.
theorem tournament_reverse_arc_arborescence_count_strict_increase {n : ℕ} (T : Digraph (Fin n))
[DecidableRel T.Adj] (hT : digraph_is_tournament T) (u v : Fin n) (huv : T.Adj u v)
(hdeg : digraph_out_count T v + 2 ≤ digraph_out_count T u) :
digraph_arborescence_count T <
digraph_arborescence_count (digraph_reverse_arc T u v)tournament_reverse_arc_det_laplacian_diff_posIn LeanGraph Theory & Graph Algorithms
In a tournament T with arc u → v satisfying deg^+(v) + 2 ≤ deg^+(u), the determinant of the shifted out-degree Laplacian 2 L_T + J strictly increases upon reversing the arc u → v.
theorem tournament_reverse_arc_det_laplacian_diff_pos {n : ℕ} (T : Digraph (Fin n))
[DecidableRel T.Adj] (hT : digraph_is_tournament T) (u v : Fin n) (huv : T.Adj u v)
(hdeg : digraph_out_count T v + 2 ≤ digraph_out_count T u) :
((2 : ℝ) • digraph_out_laplacian T + Matrix.of (fun _ _ : Fin n => (1 : ℝ))).det <
((2 : ℝ) • digraph_out_laplacian (digraph_reverse_arc T u v) + Matrix.of (fun _ _ : Fin n => (1 : ℝ))).dettournament_reverse_arc_through_count_ltIn LeanGraph Theory & Graph Algorithms
If u → v is an arc of a tournament with out-degree gap at least 2 (deg^+(v) + 2 ≤ deg^+(u)), then the total through-count of the reversed arc v → u in reverse(T, u, v) strictly exceeds the through-count of u → v in T.
theorem tournament_reverse_arc_through_count_lt {n : ℕ} (T : Digraph (Fin n))
[DecidableRel T.Adj] (hT : digraph_is_tournament T) (u v : Fin n) (huv : T.Adj u v)
(hdeg : digraph_out_count T v + 2 ≤ digraph_out_count T u) :
digraph_arborescence_count_through T u v <
digraph_arborescence_count_through (digraph_reverse_arc T u v) v utournament_shifted_laplacian_row_sqIn LeanGraph Theory & Graph Algorithms
For a tournament T on Fin n with n ≥ 1 and out-degrees d_i, the squared Euclidean norm of the i-th row of 2·L_T + √((n+1)/n)·J is (2d_i + 1)² + n.
theorem tournament_shifted_laplacian_row_sq {n : ℕ} (hn : 1 ≤ n) (T : Digraph (Fin n)) [DecidableRel T.Adj] (hT : digraph_is_tournament T) (i : Fin n) : ∑ j : Fin n, (((2 : ℝ) • digraph_out_laplacian T + Real.sqrt (((n : ℝ) + 1) / (n : ℝ)) • Matrix.of (fun _ _ : Fin n => (1 : ℝ))) i j) ^ 2 = (2 * (digraph_out_count T i : ℝ) + 1) ^ 2 + (n : ℝ)tree_card_four_all_edges_incident_of_degree_threeIn LeanGraph Theory & Graph Algorithms
In a tree on 4 vertices, a vertex of degree 3 is incident to every edge.
theorem tree_card_four_all_edges_incident_of_degree_three {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) (hcard : Fintype.card V = 4)
{v : V} (hv : T.degree v = 3) : ∀ x y : V, T.Adj x y → x = v ∨ y = vtree_card_four_degree_eq_three_of_all_edges_incidentIn LeanGraph Theory & Graph Algorithms
In a tree on 4 vertices, if every edge is incident to a fixed vertex v, then v has degree 3.
theorem tree_card_four_degree_eq_three_of_all_edges_incident {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) (hcard : Fintype.card V = 4)
{v : V} (hv : ∀ x y : V, T.Adj x y → x = v ∨ y = v) : T.degree v = 3tree_card_four_iso_of_degree_le_twoIn LeanGraph Theory & Graph Algorithms
Any two trees on 4 vertices with all degrees at most 2 are isomorphic (both are isomorphic to the path P_4).
theorem tree_card_four_iso_of_degree_le_two {V₁ V₂ : Type*} [Fintype V₁] [DecidableEq V₁] [Fintype V₂] [DecidableEq V₂]
(T₁ : SimpleGraph V₁) (T₂ : SimpleGraph V₂) [DecidableRel T₁.Adj] [DecidableRel T₂.Adj]
(hT₁ : T₁.IsTree) (hT₂ : T₂.IsTree) (hcard₁ : Fintype.card V₁ = 4) (hcard₂ : Fintype.card V₂ = 4)
(hdeg₁ : ∀ v : V₁, T₁.degree v ≤ 2) (hdeg₂ : ∀ v : V₂, T₂.degree v ≤ 2) :
Nonempty (T₁ ≃g T₂)tree_diam_ge_three_of_not_starIn LeanGraph Theory & Graph Algorithms
For every finite tree T with at least one edge that is not a star graph, the diameter of T is at least 3.
theorem tree_diam_ge_three_of_not_star {V : Type*} [Fintype V] (T : SimpleGraph V) (hT : T.IsTree) (hm : 1 ≤ Nat.card T.edgeSet) (hstar : ¬ ∃ r : V, T = SimpleGraph.starGraph r) : 3 ≤ T.diamtree_diam_ge_two_of_card_edge_ge_twoIn LeanGraph Theory & Graph Algorithms
For every finite tree T with at least 2 edges, the diameter of T is at least 2.
theorem tree_diam_ge_two_of_card_edge_ge_two {V : Type*} [Fintype V] (T : SimpleGraph V) (hT : T.IsTree) (hm : 2 ≤ Nat.card T.edgeSet) : 2 ≤ T.diamtree_edge_not_incident_principal_vertex_sustainableIn LeanGraph Theory & Graph Algorithms
Let T be a tree on a finite vertex type V and let u be a principal vertex of T. If vw is an edge of T not incident to u (u ≠ v and u ≠ w), then there exists x ∈ {v, w} such that the graph obtained by deleting edge vw and adding edge ux is a tree with strictly greater adjacency spectral radius than T.
theorem tree_edge_not_incident_principal_vertex_sustainable
{V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) (hT : T.IsTree)
(u : V) (hu : is_principal_vertex T u)
(v w : V) (he : T.Adj v w) (huv : u ≠ v) (huw : u ≠ w) :
∃ x : V, (x = v ∨ x = w) ∧
(T.deleteEdges {s(v, w)} ⊔ SimpleGraph.fromEdgeSet {s(u, x)}).IsTree ∧
adjacency_spectral_radius T <
adjacency_spectral_radius (T.deleteEdges {s(v, w)} ⊔ SimpleGraph.fromEdgeSet {s(u, x)})tree_eq_starGraph_of_isUniversalIn LeanGraph Theory & Graph Algorithms
An acyclic graph with a universal vertex r is equal to the star graph centered at r.
theorem tree_eq_starGraph_of_isUniversal {V : Type*} [DecidableEq V]
(T : SimpleGraph V) (hT : T.IsAcyclic) (r : V) (hr : T.IsUniversal r) :
T = SimpleGraph.starGraph rtree_exists_two_leaves_distinct_neighborsIn LeanGraph Theory & Graph Algorithms
Every finite tree T that is not a star graph has at least two distinct vertices of degree one whose neighbors are distinct.
theorem tree_exists_two_leaves_distinct_neighbors {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree)
(h_not_star : ¬ ∃ r : V, T = SimpleGraph.starGraph r) :
∃ u v a b : V, u ≠ v ∧ a ≠ b ∧ T.Adj u a ∧ T.Adj v b ∧ T.degree u = 1 ∧ T.degree v = 1tree_fort_card_leaves_ge_twoIn LeanGraph Theory & Graph Algorithms
Every fort of a finite tree of order at least 3 contains at least two distinct leaves.
theorem tree_fort_card_leaves_ge_two {V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) (hcard : 3 ≤ Fintype.card V) (F : Finset V) (hfort : simple_graph_is_fort T (F : Set V)) : ∃ a b : V, a ∈ F ∧ b ∈ F ∧ a ≠ b ∧ T.degree a = 1 ∧ T.degree b = 1tree_is_starGraph_of_forall_isPath_length_le_twoIn LeanGraph Theory & Graph Algorithms
Every finite tree whose simple paths all have length at most 2 is a star graph.
theorem tree_is_starGraph_of_forall_isPath_length_le_two {V : Type*} [Fintype V] [DecidableEq V]
(T : SimpleGraph V) (hT : T.IsTree)
(h : ∀ (u v : V) (p : T.Walk u v), p.IsPath → p.length ≤ 2) :
∃ r : V, T = SimpleGraph.starGraph rtree_reachable_from_path_by_shiftsIn LeanGraph Theory & Graph Algorithms
Every tree on Fin n is reachable from a path graph isomorphic to pathGraph n by a sequence of generalized tree shifts.
theorem tree_reachable_from_path_by_shifts (n : ℕ) (T : SimpleGraph (Fin n)) (hT : T.IsTree) :
∃ P : SimpleGraph (Fin n), Nonempty (P ≃g SimpleGraph.pathGraph n) ∧
Relation.ReflTransGen is_generalized_tree_shift P Ttree_three_vertex_fort_shape_of_two_leavesIn LeanGraph Theory & Graph Algorithms
In a finite tree, if F = {a, b, p} is a fort with leaves a, b such that {a, b} is not a fort, then p has degree 2, lies on the path between a and b, and has distance at most 2 from each of a and b.
theorem tree_three_vertex_fort_shape_of_two_leaves {V : Type*} [Fintype V] [DecidableEq V] (T : SimpleGraph V) [DecidableRel T.Adj] (hT : T.IsTree) (a b p : V) (hab : a ≠ b) (hap : a ≠ p) (hbp : b ≠ p) (ha : T.degree a = 1) (hb : T.degree b = 1) (hfort : simple_graph_is_fort T ({a, b, p} : Set V)) (hnot : ¬ simple_graph_is_fort T ({a, b} : Set V)) : T.degree p = 2 ∧ T.dist a p ≤ 2 ∧ T.dist p b ≤ 2 ∧ T.dist a p + T.dist p b = T.dist a btree_unexposed_parallel_pair_counterexampleIn LeanGraph Theory & Graph Algorithms
There is a rooted three-vertex path whose unexposed fort-free white sets have permitted singletons a,b,c, but pairs a,b and b,c are excluded while a,c is permitted.
theorem tree_unexposed_parallel_pair_counterexample : ∃ (T : SimpleGraph (Fin 3)) (r a b c : Fin 3), T.IsTree ∧ a ≠ b ∧ b ≠ c ∧ a ≠ c ∧ (let family : Set (Finset (Fin 3)) := {W | is_zero_forcing_set T ((Finset.univ \ W : Finset (Fin 3)) : Set (Fin 3)) ∧ ¬ zero_forcing_root_exposed_fort T r W}; ({a} : Finset (Fin 3)) ∈ family ∧ ({b} : Finset (Fin 3)) ∈ family ∧ ({c} : Finset (Fin 3)) ∈ family ∧ ({a,b} : Finset (Fin 3)) ∉ family ∧ ({b,c} : Finset (Fin 3)) ∉ family ∧ ({a,c} : Finset (Fin 3)) ∈ family)tree_zero_forcing_poly_top_stepIn LeanGraph Theory & Graph Algorithms
For a finite tree T with n ≥ 2 vertices, the coefficient of X^n in the zero forcing polynomial (equal to 1: only the full vertex set) is at most the coefficient of X^{n-1} (equal to n).
theorem tree_zero_forcing_poly_top_step {V : Type*} [Fintype V]
(T : SimpleGraph V) (hT : T.IsTree) (hn : 2 ≤ Fintype.card V) :
(zero_forcing_poly T).coeff (Fintype.card V) ≤ (zero_forcing_poly T).coeff (Fintype.card V - 1)triangle_packing_card_le_simple_graph_triangle_packing_numberIn LeanGraph Theory & Graph Algorithms
Any explicit pairwise edge-disjoint family of triangles of G is a lower bound for the triangle packing number of G.
theorem triangle_packing_card_le_simple_graph_triangle_packing_number
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (T : Finset (Finset V))
(hcl : ∀ t ∈ T, G.IsNClique 3 t)
(hpw : (T : Set (Finset V)).Pairwise (fun s t => (s ∩ t).card ≤ 1)) :
T.card ≤ simple_graph_triangle_packing_number Gtriangle_packing_complement_degree_evenIn LeanGraph Theory & Graph Algorithms
If U is a subset of the edges of G in which every vertex has even degree, and G itself is Eulerian (all degrees even), then deleting U from G yields a graph whose every vertex degree is again even.
theorem triangle_packing_complement_degree_even
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(U : Finset (Sym2 V))
(hsub : U ⊆ G.edgeFinset)
(hUeven : ∀ v, Even (sym2_edge_degree U v))
(hGeven : ∀ v, Even (G.degree v)) :
∀ v, Even ((G.deleteEdges (U : Set (Sym2 V))).degree v)triangle_packing_number_le_four_of_eulerian_seventeenIn LeanGraph Theory & Graph Algorithms
A finite simple graph that is Eulerian (all vertex degrees even) and has exactly 17 edges has triangle packing number at most 4.
theorem triangle_packing_number_le_four_of_eulerian_seventeen
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(hGeven : ∀ v, Even (G.degree v)) (hcard : G.edgeFinset.card = 17) :
simple_graph_triangle_packing_number G ≤ 4triangle_packing_union_propertiesIn LeanGraph Theory & Graph Algorithms
For a pairwise edge-disjoint family of triangles of G, the edge set U obtained as the union of their spanned edge pairs is contained in the edge set of G, has cardinality three times the number of triangles, and every vertex has even U-degree.
theorem triangle_packing_union_properties
{V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj]
(T : Finset (Finset V))
(hcl : ∀ t ∈ T, G.IsNClique 3 t)
(hpw : (T : Set (Finset V)).Pairwise (fun s t => (s ∩ t).card ≤ 1)) :
((T.image finite_vertex_set_edge_encoding).biUnion id : Finset (Sym2 V)) ⊆ G.edgeFinset ∧
((T.image finite_vertex_set_edge_encoding).biUnion id : Finset (Sym2 V)).card = 3 * T.card ∧
(∀ v, Even (sym2_edge_degree ((T.image finite_vertex_set_edge_encoding).biUnion id) v))triangle_plane_completion_checkIn LeanGraph Theory & Graph Algorithms
The finite check that every three listed triples whose three pairwise intersections are distinct singletons contain their opposite triple in the list.
def triangle_plane_completion_check : Bool
triangle_plane_obstructionIn LeanGraph Theory & Graph Algorithms
Seven explicit triples on seven points forming a linear degree-three intersecting system.
def triangle_plane_obstruction : List (Finset (Fin 7))
triangle_plane_obstruction_propertiesIn LeanGraph Theory & Graph Algorithms
The seven distinct triples are 3-uniform and pairwise meet in exactly one point; each point lies in three triples; their four-triple completion check is true; no two points cover them, whereas the displayed three points do. Thus closure and maximum degree three alone do not imply that the cover number is at most twice the packing number.
theorem triangle_plane_obstruction_properties :
triangle_plane_obstruction.Nodup ∧ triangle_plane_obstruction.length = 7 ∧
triangle_plane_obstruction.all (fun e => decide (e.card = 3)) = true ∧
triangle_plane_obstruction.all (fun e => triangle_plane_obstruction.all (fun f =>
decide (e = f ∨ (e ∩ f).card = 1))) = true ∧
(∀ v : Fin 7, (triangle_plane_obstruction.filter fun e => v ∈ e).length = 3) ∧
triangle_plane_completion_check = true ∧
(∀ F : Finset (Fin 7), F.card ≤ 2 →
(triangle_plane_obstruction.any fun e => decide (Disjoint F e)) = true) ∧
(let F : Finset (Fin 7) := {0,1,6}
F.card = 3 ∧ triangle_plane_obstruction.all (fun e => decide (¬ Disjoint F e)) = true)tuza_iff_tuza_of_edge_count_geIn LeanGraph Theory & Graph Algorithms
Tuza's conjecture holds for all finite graphs if and only if, for every c ≥ 0, it holds for all graphs on n ≥ n₀(c) vertices with at least n²/4 − cn edges.
theorem tuza_iff_tuza_of_edge_count_ge :
(∀ (n : ℕ) (G : SimpleGraph (Fin n)),
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number G) ↔
∀ c : ℝ, 0 ≤ c → ∃ n₀ : ℕ, ∀ (n : ℕ) (G : SimpleGraph (Fin n)) [DecidableRel G.Adj],
n₀ ≤ n → (n : ℝ) ^ 2 / 4 - c * n ≤ G.edgeFinset.card →
simple_graph_triangle_cover_number G ≤ 2 * simple_graph_triangle_packing_number Gtwo_connected_indepNum_eq_radius_cycle_card_sub_oneIn LeanGraph Theory & Graph Algorithms
Conjecture: every 2-connected graph on n >= 3 vertices with independence number equal to radius that is not a cycle (some vertex has degree at least 3) contains a cycle of length n-1.
theorem two_connected_indepNum_eq_radius_cycle_card_sub_one {V : Type*} [Fintype V]
(G : SimpleGraph V) (hn : 3 ≤ Fintype.card V) (hconn : G.Connected)
(h2 : ∀ v : V, (G.induce ({v}ᶜ : Set V)).Connected)
(hα : (G.indepNum : ℕ∞) = G.radius)
(hdeg : ∃ v a b c : V, a ≠ b ∧ a ≠ c ∧ b ≠ c ∧ G.Adj v a ∧ G.Adj v b ∧ G.Adj v c) :
∃ (u : V) (p : G.Walk u u), p.IsCycle ∧ p.length + 1 = Fintype.card Vtwo_connected_indepNum_eq_radius_hamiltonianIn LeanGraph Theory & Graph Algorithms
Every 2-connected graph on at least three vertices whose independence number equals its radius is Hamiltonian.
theorem two_connected_indepNum_eq_radius_hamiltonian {V : Type*} [Fintype V] (G : SimpleGraph V)
(hn : 3 ≤ Fintype.card V) (hconn : G.Connected)
(h2 : ∀ v : V, (G.induce ({v}ᶜ : Set V)).Connected)
(hα : (G.indepNum : ℕ∞) = G.radius) :
∃ (u : V) (p : G.Walk u u), p.IsCycle ∧ p.length = Fintype.card Vtwo_fractional_order_four_charpoly_certificate_H_boundIn LeanGraph Theory & Graph Algorithms
For an order-4 two-fractional standardized Laplacian L with characteristic-polynomial coefficients c1, c2, c3, the combination 4 (c3^2 c2^2 - 4 c2^3 - 4 c3^3 c1 - 27 c1^2 + 18 c1 c2 c3) + (c3^2 - 3 c2 + 1/4)^2 is nonnegative.
theorem two_fractional_order_four_charpoly_certificate_H_bound (L : Matrix (Fin 4) (Fin 4) ℝ)
(hL : is_standardized_laplacian_two_fractional 4 L) :
0 ≤ 4 * ((L.charpoly).coeff 3 ^ 2 * (L.charpoly).coeff 2 ^ 2 - 4 * (L.charpoly).coeff 2 ^ 3
- 4 * (L.charpoly).coeff 3 ^ 3 * (L.charpoly).coeff 1 - 27 * (L.charpoly).coeff 1 ^ 2
+ 18 * (L.charpoly).coeff 1 * (L.charpoly).coeff 2 * (L.charpoly).coeff 3)
+ ((L.charpoly).coeff 3 ^ 2 - 3 * (L.charpoly).coeff 2 + 1 / 4) ^ 2two_mul_dist_le_optimal_tourIn LeanGraph Theory & Graph Algorithms
In any finite connected simple graph G on n ≥ 2 vertices with positive edge weights w, the minimum length of a closed walk visiting all vertices is at least twice the shortest-path distance between any two vertices u and v.
theorem two_mul_dist_le_optimal_tour {V : Type*} [Fintype V]
(G : SimpleGraph V) (hG : G.Connected) (hn : 2 ≤ Fintype.card V)
(w : Sym2 V → ℝ) (hw : ∀ e ∈ G.edgeSet, 0 < w e) (u v : V) :
2 * weighted_dist G w u v ≤ optimal_tour_length G wtwo_token_double_star_domination_numberIn LeanGraph Theory & Graph Algorithms
Let 1 ≤ a ≤ b be integers. Then the domination number of the 2-token graph of the double star S_{a,b} is γ(F_2(S_{a,b})) = 2a + b - 1.
theorem two_token_double_star_domination_number (a b : ℕ) (ha : 1 ≤ a) (hab : a ≤ b) :
simple_graph_domination_number (token_graph (double_star_graph a b) 2) = 2 * a + b - 1two_token_double_star_domination_number_geIn LeanGraph Theory & Graph Algorithms
For integers 1 ≤ a ≤ b, the domination number of the 2-token graph of the double star S_{a,b} is at least 2a + b - 1.
theorem two_token_double_star_domination_number_ge (a b : ℕ) (ha : 1 ≤ a) (hab : a ≤ b) :
2 * a + b - 1 ≤ simple_graph_domination_number (token_graph (double_star_graph a b) 2)two_token_double_star_domination_number_leIn LeanGraph Theory & Graph Algorithms
For integers 1 ≤ a ≤ b, the domination number of the 2-token graph of the double star S_{a,b} is at most 2a + b - 1.
theorem two_token_double_star_domination_number_le (a b : ℕ) (ha : 1 ≤ a) (hab : a ≤ b) :
simple_graph_domination_number (token_graph (double_star_graph a b) 2) ≤ 2 * a + b - 1two_token_k2_nminus2_card_ge_componentsIn LeanGraph Theory & Graph Algorithms
The cardinality of D is at least 1 (the LL vertex) + t (the LR vertices covering distinct right elements) + (n - 2 - t).choose 2 (the RR vertices from uncovered right elements).
theorem two_token_k2_nminus2_card_ge_components (n : ℕ) (hn : 4 ≤ n)
(D : Finset { s : Finset (Fin 2 ⊕ Fin (n - 2)) // s.card = 2 })
(hD : simple_graph_is_dominating (token_graph (completeBipartiteGraph (Fin 2) (Fin (n - 2))) 2) (D : Set _))
(hmem : two_token_kmn_ll_vertex (0 : Fin 2) (1 : Fin 2) (by decide) ∈ D) :
1 + (two_token_kmn_cr D).card + ((n - 2) - (two_token_kmn_cr D).card).choose 2 ≤ D.cardtwo_token_k2_nminus2_dominating_set_card_geIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 4, every dominating set D of the 2-token graph F_2(K_{2,n-2}) of the complete bipartite graph K_{2,n-2} has cardinality at least n - 2.
theorem two_token_k2_nminus2_dominating_set_card_ge (n : ℕ) (hn : 4 ≤ n)
(D : Finset { s : Finset (Fin 2 ⊕ Fin (n - 2)) // s.card = 2 })
(hD : simple_graph_is_dominating (token_graph (completeBipartiteGraph (Fin 2) (Fin (n - 2))) 2) (D : Set _)) :
n - 2 ≤ D.cardtwo_token_k2_nminus2_dominating_set_card_ge_of_mem_llIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 4 and every dominating set D of F_2(K_{2,n-2}), if the unique pair of left vertices belongs to D, then D has cardinality at least n - 2.
theorem two_token_k2_nminus2_dominating_set_card_ge_of_mem_ll (n : ℕ) (hn : 4 ≤ n)
(D : Finset { s : Finset (Fin 2 ⊕ Fin (n - 2)) // s.card = 2 })
(hD : simple_graph_is_dominating (token_graph (completeBipartiteGraph (Fin 2) (Fin (n - 2))) 2) (D : Set _))
(hmem : two_token_kmn_ll_vertex (0 : Fin 2) (1 : Fin 2) (by decide) ∈ D) :
n - 2 ≤ D.cardtwo_token_k2_nminus2_dominating_set_card_ge_of_not_mem_llIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 4 and every dominating set D of F_2(K_{2,n-2}), if the unique pair of left vertices does not belong to D, then D has cardinality at least n - 2.
theorem two_token_k2_nminus2_dominating_set_card_ge_of_not_mem_ll (n : ℕ) (hn : 4 ≤ n)
(D : Finset { s : Finset (Fin 2 ⊕ Fin (n - 2)) // s.card = 2 })
(hD : simple_graph_is_dominating (token_graph (completeBipartiteGraph (Fin 2) (Fin (n - 2))) 2) (D : Set _))
(hnot : two_token_kmn_ll_vertex (0 : Fin 2) (1 : Fin 2) (by decide) ∉ D) :
n - 2 ≤ D.cardtwo_token_k2_nminus2_domination_numberIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 4, the domination number of the 2-token graph of the complete bipartite graph K_{2,n-2} is γ(F_2(K_{2,n-2})) = n - 2.
theorem two_token_k2_nminus2_domination_number (n : ℕ) (hn : 4 ≤ n) :
simple_graph_domination_number (token_graph (completeBipartiteGraph (Fin 2) (Fin (n - 2))) 2) = n - 2two_token_k2_nminus2_domination_number_geIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 4, the domination number of the 2-token graph F_2(K_{2,n-2}) of the complete bipartite graph K_{2,n-2} is at least n - 2.
theorem two_token_k2_nminus2_domination_number_ge (n : ℕ) (hn : 4 ≤ n) :
n - 2 ≤ simple_graph_domination_number (token_graph (completeBipartiteGraph (Fin 2) (Fin (n - 2))) 2)two_token_k2_nminus2_domination_number_leIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 4, the domination number of the 2-token graph F_2(K_{2,n-2}) of the complete bipartite graph K_{2,n-2} is at most n - 2.
theorem two_token_k2_nminus2_domination_number_le (n : ℕ) (hn : 4 ≤ n) :
simple_graph_domination_number (token_graph (completeBipartiteGraph (Fin 2) (Fin (n - 2))) 2) ≤ n - 2two_token_k2_nminus2_has_dominating_setIn LeanGraph Theory & Graph Algorithms
For every integer n ≥ 4, there exists a dominating set of the 2-token graph F_2(K_{2,n-2}) of cardinality at most n - 2.
theorem two_token_k2_nminus2_has_dominating_set (n : ℕ) (hn : 4 ≤ n) :
∃ S : Finset { s : Finset (Fin 2 ⊕ Fin (n - 2)) // s.card = 2 },
simple_graph_is_dominating (token_graph (completeBipartiteGraph (Fin 2) (Fin (n - 2))) 2) (S : Set _) ∧
S.card ≤ n - 2two_token_k2_nminus2_rr_adj_lrIn LeanGraph Theory & Graph Algorithms
Any vertex adjacent to the RR vertex {inr j, inr k} in F_2(K_{2, n-2}) is an LR vertex containing either inr j or inr k.
theorem two_token_k2_nminus2_rr_adj_lr (n : ℕ) (hn : 4 ≤ n)
(j k : Fin (n - 2)) (hjk : j ≠ k)
(u : { s : Finset (Fin 2 ⊕ Fin (n - 2)) // s.card = 2 })
(hadj : (token_graph (completeBipartiteGraph (Fin 2) (Fin (n - 2))) 2).Adj
u (two_token_kmn_rr_vertex j k hjk)) :
∃ a : Fin 2, u.val = {Sum.inl a, Sum.inr j} ∨ u.val = {Sum.inl a, Sum.inr k}two_token_k2_nminus2_rr_mem_of_not_mem_crIn LeanGraph Theory & Graph Algorithms
If D is a dominating set of F_2(K_{2, n-2}) and distinct right vertices j, k do not appear in the right-projection of the LR part of D, then the RR vertex {inr j, inr k} must belong to D.
theorem two_token_k2_nminus2_rr_mem_of_not_mem_cr (n : ℕ) (hn : 4 ≤ n)
(D : Finset { s : Finset (Fin 2 ⊕ Fin (n - 2)) // s.card = 2 })
(hD : simple_graph_is_dominating (token_graph (completeBipartiteGraph (Fin 2) (Fin (n - 2))) 2) (D : Set _))
(j k : Fin (n - 2)) (hjk : j ≠ k)
(hj : j ∉ two_token_kmn_cr D) (hk : k ∉ two_token_kmn_cr D) :
two_token_kmn_rr_vertex j k hjk ∈ Dtwo_token_kmn_adj_iffIn LeanGraph Theory & Graph Algorithms
Two vertices x,y of F_2(K_{m,n}) are adjacent iff they differ by exactly one element on each side and those two elements lie on opposite sides, i.e. there are u,v with u left, v right, and symmDiff x y = {u,v}.
theorem two_token_kmn_adj_iff {m n : ℕ} (x y : {s : Finset (Fin m ⊕ Fin n) // s.card = 2}) :
(two_token_kmn m n).Adj x y ↔
∃ u v : Fin m ⊕ Fin n, u.isLeft ∧ v.isRight ∧
symmDiff (x.val : Set (Fin m ⊕ Fin n)) (y.val : Set (Fin m ⊕ Fin n)) = {u, v}two_token_kmn_arithmetic_baseIn LeanGraph Theory & Graph Algorithms
Any parameters satisfying the reduction's inequality system give a+b+c >= n + floor(m/2) - 1.
theorem two_token_kmn_arithmetic_base (m n a b c α β u v : ℕ)
(hm : 2 ≤ m) (hmn : m ≤ n)
(hα : α ≤ m) (hβ : β ≤ n) (hu : u ≤ m) (hv : v ≤ n)
(hAu : m - α ≥ 2 → u ≤ α) (hBv : n - β ≥ 2 → v ≤ β)
(ha1 : a ≥ (m - α) * (m - α - 1) / 2 + (α - u + 1) / 2)
(ha2 : a ≥ (m - u + 1) / 2)
(hb1 : b ≥ (n - β) * (n - β - 1) / 2 + (β - v + 1) / 2)
(hb2 : b ≥ (n - v + 1) / 2)
(hc1 : c ≥ α) (hc2 : c ≥ β)
(hc3 : c ≥ u * v + (α - u))
(hc4 : c ≥ u * v + (β - v)) :
a + b + c ≥ n + m / 2 - 1two_token_kmn_arithmetic_extraIn LeanGraph Theory & Graph Algorithms
When m is odd, m >= 5 and n != m+1, every admissible parameter tuple gives a+b+c >= n + floor(m/2).
theorem two_token_kmn_arithmetic_extra (m n a b c α β u v : ℕ)
(hm : 2 ≤ m) (hmn : m ≤ n)
(hα : α ≤ m) (hβ : β ≤ n) (hu : u ≤ m) (hv : v ≤ n)
(hAu : m - α ≥ 2 → u ≤ α) (hBv : n - β ≥ 2 → v ≤ β)
(ha1 : a ≥ (m - α) * (m - α - 1) / 2 + (α - u + 1) / 2)
(ha2 : a ≥ (m - u + 1) / 2)
(hb1 : b ≥ (n - β) * (n - β - 1) / 2 + (β - v + 1) / 2)
(hb2 : b ≥ (n - v + 1) / 2)
(hc1 : c ≥ α) (hc2 : c ≥ β)
(hc3 : c ≥ u * v + (α - u))
(hc4 : c ≥ u * v + (β - v))
(ho : ¬ Even m) (hm5 : 5 ≤ m) (hne : n ≠ m + 1) :
a + b + c ≥ n + m / 2two_token_kmn_dominating_inequalitiesIn LeanGraph Theory & Graph Algorithms
For any dominating set S of F_2(K_{m,n}) there are naturals a,b,c (counts of LL/RR/LR vertices of S), alpha, beta (numbers of left/right vertices used by the LR part) and u, v (numbers of left/right vertices not covered by the LL/RR part) with |S| = a+b+c and the listed numeric inequalities.
theorem two_token_kmn_dominating_inequalities (m n : ℕ) (hm : 2 ≤ m) (hmn : m ≤ n)
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _)) :
∃ (a b c α β u v : ℕ),
S.card = a + b + c ∧ α ≤ m ∧ β ≤ n ∧ u ≤ m ∧ v ≤ n ∧
(m - α ≥ 2 → u ≤ α) ∧ (n - β ≥ 2 → v ≤ β) ∧
a ≥ (m - α) * (m - α - 1) / 2 + (α - u + 1) / 2 ∧ a ≥ (m - u + 1) / 2 ∧
b ≥ (n - β) * (n - β - 1) / 2 + (β - v + 1) / 2 ∧ b ≥ (n - v + 1) / 2 ∧
c ≥ α ∧ c ≥ β ∧ c ≥ u * v + (α - u) ∧ c ≥ u * v + (β - v)two_token_kmn_domination_numberIn LeanGraph Theory & Graph Algorithms
Let 2 <= m <= n. The domination number of the 2-token graph F_2(K_{m,n}) is m/2 + n - 1 if m is even; (m-1)/2 + n - 1 if m = 3, or if m is odd, m >= 5, and n = m + 1; and (m-1)/2 + n if m is odd, m >= 5, and n >= m + 2 (or n = m).
theorem two_token_kmn_domination_number (m n : ℕ) (hm : 2 ≤ m) (hmn : m ≤ n) :
simple_graph_domination_number (two_token_kmn m n) =
if Even m then m / 2 + n - 1
else if m = 3 ∨ n = m + 1 then (m - 1) / 2 + n - 1
else (m - 1) / 2 + ntwo_token_kmn_domination_number_ge_evenIn LeanGraph Theory & Graph Algorithms
For even m, every dominating set of F_2(K_{m,n}) has at least m/2 + n - 1 vertices.
theorem two_token_kmn_domination_number_ge_even (m n : ℕ) (hm : 2 ≤ m) (hmn : m ≤ n) (h : Even m) :
m / 2 + n - 1 ≤ simple_graph_domination_number (two_token_kmn m n)two_token_kmn_domination_number_ge_oddIn LeanGraph Theory & Graph Algorithms
For odd m, every dominating set has at least (m-1)/2 + n - 1 vertices when m = 3 or n = m+1, and at least (m-1)/2 + n otherwise.
theorem two_token_kmn_domination_number_ge_odd (m n : ℕ) (hm : 2 ≤ m) (hmn : m ≤ n) (h : ¬ Even m) :
(if m = 3 ∨ n = m + 1 then (m - 1) / 2 + n - 1 else (m - 1) / 2 + n) ≤
simple_graph_domination_number (two_token_kmn m n)two_token_kmn_domination_number_le_evenIn LeanGraph Theory & Graph Algorithms
For even m there is a dominating set of F_2(K_{m,n}) with m/2 + n - 1 vertices.
theorem two_token_kmn_domination_number_le_even (m n : ℕ) (hm : 2 ≤ m) (hmn : m ≤ n) (h : Even m) :
simple_graph_domination_number (two_token_kmn m n) ≤ m / 2 + n - 1two_token_kmn_domination_number_le_oddIn LeanGraph Theory & Graph Algorithms
For odd m, F_2(K_{m,n}) has a dominating set of size (m-1)/2 + n - 1 when m = 3 or n = m+1, and of size (m-1)/2 + n otherwise.
theorem two_token_kmn_domination_number_le_odd (m n : ℕ) (hm : 2 ≤ m) (hmn : m ≤ n) (h : ¬ Even m) :
simple_graph_domination_number (two_token_kmn m n) ≤
(if m = 3 ∨ n = m + 1 then (m - 1) / 2 + n - 1 else (m - 1) / 2 + n)two_token_kmn_domination_number_le_odd_otherIn LeanGraph Theory & Graph Algorithms
For odd m >= 5 and n != m+1 with m <= n, there is a dominating set of F_2(K_{m,n}) with (m-1)/2 + n vertices.
theorem two_token_kmn_domination_number_le_odd_other (m n : ℕ) (hm : 5 ≤ m) (hmn : m ≤ n) (ho : ¬ Even m) (hne : n ≠ m + 1) :
simple_graph_domination_number (two_token_kmn m n) ≤ (m - 1) / 2 + ntwo_token_kmn_domination_number_le_odd_succIn LeanGraph Theory & Graph Algorithms
For odd m >= 5 there is a dominating set of F_2(K_{m,m+1}) with (m-1)/2 + m vertices.
theorem two_token_kmn_domination_number_le_odd_succ (m n : ℕ) (hm : 5 ≤ m) (ho : ¬ Even m) (h : n = m + 1) :
simple_graph_domination_number (two_token_kmn m n) ≤ (m - 1) / 2 + n - 1two_token_kmn_domination_number_le_threeIn LeanGraph Theory & Graph Algorithms
For n >= 3 there is a dominating set of F_2(K_{3,n}) with n vertices.
theorem two_token_kmn_domination_number_le_three (n : ℕ) (hn : 3 ≤ n) :
simple_graph_domination_number (two_token_kmn 3 n) ≤ ntwo_token_kmn_domination_number_two_twoIn LeanGraph Theory & Graph Algorithms
The domination number of F_2(K_{2,2}) is 2, in agreement with the general formula.
theorem two_token_kmn_domination_number_two_two :
simple_graph_domination_number (two_token_kmn 2 2) = 2two_token_kmn_ll_card_geIn LeanGraph Theory & Graph Algorithms
If S dominates F_2(K_{m,n}), alpha = #cl S, u = m - #al S, then the number a of LL vertices satisfies a >= C(m-alpha,2) + ceil((alpha-u)/2), provided m - alpha >= 2.
theorem two_token_kmn_ll_card_ge {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _))
(hα : 2 ≤ m - (two_token_kmn_cl S).card) :
(m - (two_token_kmn_cl S).card) * (m - (two_token_kmn_cl S).card - 1) / 2 +
((two_token_kmn_cl S).card - (m - (two_token_kmn_al S).card) + 1) / 2 ≤
(S.filter two_token_kmn_ll).cardtwo_token_kmn_ll_two_mul_card_geIn LeanGraph Theory & Graph Algorithms
Every LL vertex contains exactly two left vertices, so twice the number of LL vertices of S is at least the number m - u of left vertices covered by them: 2a >= m - u.
theorem two_token_kmn_ll_two_mul_card_ge {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2}) :
2 * (S.filter two_token_kmn_ll).card ≥ m - (m - (two_token_kmn_al S).card)two_token_kmn_lr_adj_xorIn LeanGraph Theory & Graph Algorithms
Adjacent vertices of F_2(K_{m,n}) differ in type: x is LR iff y is not LR.
theorem two_token_kmn_lr_adj_xor {m n : ℕ} {x y : {s : Finset (Fin m ⊕ Fin n) // s.card = 2}}
(h : (two_token_kmn m n).Adj x y) : (two_token_kmn_lr x ↔ ¬ two_token_kmn_lr y)two_token_kmn_lr_card_ge_cl_crIn LeanGraph Theory & Graph Algorithms
The LR part of S has at least alpha = #cl vertices and at least beta = #cr vertices, because each LR vertex has exactly one left and one right element.
theorem two_token_kmn_lr_card_ge_cl_cr {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2}) :
(two_token_kmn_cl S).card ≤ (S.filter two_token_kmn_lr).card ∧
(two_token_kmn_cr S).card ≤ (S.filter two_token_kmn_lr).cardtwo_token_kmn_lr_card_ge_colsIn LeanGraph Theory & Graph Algorithms
If the RR part of S does not cover all of Fin n, then the LR part has at least (n - #br)*(m - #al) + (#cl - (m - #al)) >= (n - #br)*(m - #al) vertices.
theorem two_token_kmn_lr_card_ge_cols {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _))
(hv : (two_token_kmn_br S).card < n) :
(n - (two_token_kmn_br S).card) * (m - (two_token_kmn_al S).card) +
((two_token_kmn_cl S).card - (m - (two_token_kmn_al S).card)) ≤
(S.filter two_token_kmn_lr).cardtwo_token_kmn_lr_card_ge_rowsIn LeanGraph Theory & Graph Algorithms
If the LL part of S does not cover all of Fin m, then the LR part has at least (n - #br)*(m - #al) + (#cr - (n - #br)) vertices.
theorem two_token_kmn_lr_card_ge_rows {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _))
(hu : (two_token_kmn_al S).card < m) :
(n - (two_token_kmn_br S).card) * (m - (two_token_kmn_al S).card) +
((two_token_kmn_cr S).card - (n - (two_token_kmn_br S).card)) ≤
(S.filter two_token_kmn_lr).cardtwo_token_kmn_rows_subset_clIn LeanGraph Theory & Graph Algorithms
If S dominates and not every right vertex is covered by the RR part of S, then every left vertex not covered by the LL part belongs to the LR part's left set.
theorem two_token_kmn_rows_subset_cl {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _))
(hv : (two_token_kmn_br S).card < n) :
∀ x : Fin m, x ∉ two_token_kmn_al S → x ∈ two_token_kmn_cl Stwo_token_kmn_rr_card_geIn LeanGraph Theory & Graph Algorithms
If S dominates F_2(K_{m,n}), beta = #cr S and v = n - #br S, then the number b of RR vertices satisfies b >= C(n-beta,2) + ceil((beta-v)/2) provided n - beta >= 2.
theorem two_token_kmn_rr_card_ge {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _))
(hβ : 2 ≤ n - (two_token_kmn_cr S).card) :
(n - (two_token_kmn_cr S).card) * (n - (two_token_kmn_cr S).card - 1) / 2 +
((two_token_kmn_cr S).card - (n - (two_token_kmn_br S).card) + 1) / 2 ≤
(S.filter two_token_kmn_rr).cardtwo_token_kmn_rr_two_mul_card_geIn LeanGraph Theory & Graph Algorithms
Twice the number of RR vertices of S is at least the number n - v of right vertices they cover.
theorem two_token_kmn_rr_two_mul_card_ge {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2}) :
2 * (S.filter two_token_kmn_rr).card ≥ n - (n - (two_token_kmn_br S).card)two_token_kmn_type_card_sumIn LeanGraph Theory & Graph Algorithms
Every 2-token vertex is exactly one of LL, LR, RR; hence for any S the counts a (LL), b (RR), c (LR) sum to |S|.
theorem two_token_kmn_type_card_sum {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2}) :
(S.filter two_token_kmn_ll).card + (S.filter two_token_kmn_rr).card +
(S.filter two_token_kmn_lr).card = S.cardtwo_token_kmn_type_inhabitedIn LeanGraph Theory & Graph Algorithms
For m, n >= 2 there exist vertices of F_2(K_{m,n}) of type LL, RR and LR, and adjacent pairs of each admissible cross type.
theorem two_token_kmn_type_inhabited (m n : ℕ) (hm : 2 ≤ m) (hn : 2 ≤ n) :
(∃ v : {s : Finset (Fin m ⊕ Fin n) // s.card = 2}, two_token_kmn_ll v) ∧
(∃ v : {s : Finset (Fin m ⊕ Fin n) // s.card = 2}, two_token_kmn_rr v) ∧
(∃ v : {s : Finset (Fin m ⊕ Fin n) // s.card = 2}, two_token_kmn_lr v)two_token_kmn_u_le_alphaIn LeanGraph Theory & Graph Algorithms
If m - alpha >= 2 then u <= alpha, i.e. the LL part of a dominating set covers all left vertices outside the LR part's left set.
theorem two_token_kmn_u_le_alpha {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _))
(hα : 2 ≤ m - (two_token_kmn_cl S).card) :
m - (two_token_kmn_al S).card ≤ (two_token_kmn_cl S).cardtwo_token_kmn_uncovered_ll_pair_memIn LeanGraph Theory & Graph Algorithms
If S dominates F_2(K_{m,n}) and neither a nor a' (distinct left vertices) occurs in an LR vertex of S, then {a,a'} itself must belong to S.
theorem two_token_kmn_uncovered_ll_pair_mem {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _))
(a a' : Fin m) (h : a ≠ a')
(ha : a ∉ two_token_kmn_cl S) (ha' : a' ∉ two_token_kmn_cl S) :
two_token_kmn_ll_vertex a a' h ∈ Stwo_token_kmn_uncovered_lr_memIn LeanGraph Theory & Graph Algorithms
If S dominates F_2(K_{m,n}), and x is a left vertex not covered by the LL part of S and y a right vertex not covered by the RR part of S, then the LR vertex {x,y} belongs to S.
theorem two_token_kmn_uncovered_lr_mem {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _))
(x : Fin m) (y : Fin n) (hx : x ∉ two_token_kmn_al S) (hy : y ∉ two_token_kmn_br S) :
two_token_kmn_lr_vertex x y ∈ Stwo_token_kmn_uncovered_rr_pair_memIn LeanGraph Theory & Graph Algorithms
If S dominates F_2(K_{m,n}) and neither b nor b' (distinct right vertices) occurs in an LR vertex of S, then {b,b'} itself must belong to S.
theorem two_token_kmn_uncovered_rr_pair_mem {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _))
(b b' : Fin n) (h : b ≠ b')
(hb : b ∉ two_token_kmn_br S) (hb' : b' ∉ two_token_kmn_br S) :
two_token_kmn_rr_vertex b b' h ∈ Stwo_token_kmn_v_le_betaIn LeanGraph Theory & Graph Algorithms
If n - beta >= 2 then v <= beta, i.e. the RR part of a dominating set covers all right vertices outside the LR part's right set.
theorem two_token_kmn_v_le_beta {m n : ℕ}
(S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2})
(hdom : simple_graph_is_dominating (two_token_kmn m n) (S : Set _))
(hβ : 2 ≤ n - (two_token_kmn_cr S).card) :
n - (two_token_kmn_br S).card ≤ (two_token_kmn_cr S).cardtwo_token_kmn_witness_evenIn LeanGraph Theory & Graph Algorithms
For even m and 2 <= m <= n, the set consisting of the LL vertices {a_{2i-1},a_{2i}} (i = 1..m/2) together with the LR vertices {a_j,b_j} for j = 1..m-1 and {a_m,b_j} for j = m..n-1 is a dominating set of F_2(K_{m,n}) of size m/2 + n - 1.
theorem two_token_kmn_witness_even (m n : ℕ) (hm : 2 ≤ m) (hmn : m ≤ n) (h : Even m) :
∃ S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2},
simple_graph_is_dominating (two_token_kmn m n) (S : Set _) ∧ S.card = m / 2 + n - 1two_token_kmn_witness_odd_otherIn LeanGraph Theory & Graph Algorithms
For odd m >= 5 and m <= n with n != m+1, the set of LL vertices {a_{2j-1},a_{2j}} (j = 1..(m-1)/2), LR vertices {a_h,b_h} (h = 1..m-1) and {a_m,b_i} (i = m..n-1), plus {a_{m-1},a_m}, is a dominating set of F_2(K_{m,n}) with (m-1)/2 + n vertices.
theorem two_token_kmn_witness_odd_other (m n : ℕ) (hm : 5 ≤ m) (hmn : m ≤ n) (ho : ¬ Even m) (hne : n ≠ m + 1) :
∃ S : Finset {s : Finset (Fin m ⊕ Fin n) // s.card = 2},
simple_graph_is_dominating (two_token_kmn m n) (S : Set _) ∧
S.card = (m - 1) / 2 + ntwo_token_kmn_witness_odd_succIn LeanGraph Theory & Graph Algorithms
For odd m >= 5, the set {{a_i,b_i} : i = 1..m-1} ∪ {{b_{2j-1},b_{2j}} : j = 1..(m+1)/2} is a dominating set of F_2(K_{m,m+1}) with (m-1)/2 + m vertices.
theorem two_token_kmn_witness_odd_succ (m : ℕ) (hm : 5 ≤ m) (ho : ¬ Even m) :
∃ S : Finset {s : Finset (Fin m ⊕ Fin (m + 1)) // s.card = 2},
simple_graph_is_dominating (two_token_kmn m (m + 1)) (S : Set _) ∧
S.card = (m - 1) / 2 + (m + 1) - 1two_token_kmn_witness_threeIn LeanGraph Theory & Graph Algorithms
For n >= 3, the set {{a_1,b_i} : i = 1..n-2} ∪ {{a_2,a_3}, {b_{n-1},b_n}} is a dominating set of F_2(K_{3,n}) with n vertices.
theorem two_token_kmn_witness_three (n : ℕ) (hn : 3 ≤ n) :
∃ S : Finset {s : Finset (Fin 3 ⊕ Fin n) // s.card = 2},
simple_graph_is_dominating (two_token_kmn 3 n) (S : Set _) ∧ S.card = ntype_ii_edge_two_neighbourhoods_eqIn LeanGraph Theory & Graph Algorithms
If uv is a type II edge with parameter 2 in a finite simple graph G and both u and v have degree at least 4, then u and v have the same neighbourhood: there is a 3-element set S, disjoint from {u, v}, with N(u) = {v} ∪ S and N(v) = {u} ∪ S.
theorem type_ii_edge_two_neighbourhoods_eq {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) [DecidableRel G.Adj]
(u v : V) (hu : 4 ≤ G.degree u) (hv : 4 ≤ G.degree v) (h : is_type_ii_edge G u v 2) :
∃ S : Finset V, S.card = 3 ∧ u ∉ S ∧ v ∉ S ∧
(∀ w : V, G.Adj u w ↔ w = v ∨ w ∈ S) ∧
(∀ w : V, G.Adj v w ↔ w = u ∨ w ∈ S)unimodal_of_step_monotoneIn LeanGraph Theory & Graph Algorithms
If a polynomial with natural coefficients has weakly increasing consecutive coefficients up to index m and weakly decreasing consecutive coefficients for indices at least m, then it is unimodal.
theorem unimodal_of_step_monotone (p : Polynomial ℕ) (m : ℕ)
(h_inc : ∀ i < m, p.coeff i ≤ p.coeff (i + 1))
(h_dec : ∀ i ≥ m, p.coeff (i + 1) ≤ p.coeff i) :
polynomial_is_unimodal pve_comp_part_adj_iffIn LeanGraph Theory & Graph Algorithms
If x and y are adjacent in G, neither is v, and x lies in a component part of G - v, then so does y (and conversely).
lemma ve_comp_part_adj_iff {V : Type*} (G : SimpleGraph V) (v : V)
(C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent) {x y : V}
(hx : x ≠ v) (hy : y ≠ v) (hxy : G.Adj x y) :
(x ∈ ve_comp_part G v C ↔ y ∈ ve_comp_part G v C)ve_comp_part_subset_complIn LeanGraph Theory & Graph Algorithms
Each component part of G - v is contained in the complement of {v}.
lemma ve_comp_part_subset_compl {V : Type*} (G : SimpleGraph V) (v : V)
(C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent) :
ve_comp_part G v C ⊆ ({v}ᶜ : Set V)ve_comp_part_unique_neighbor_of_unreachableIn LeanGraph Theory & Graph Algorithms
If no two distinct neighbours of v are mutually reachable in G - v, then each component of G - v contains at most one neighbour of v, i.e. the unique-neighbour hypothesis huniq of the pendant dichotomy holds with u = w.
lemma ve_comp_part_unique_neighbor_of_unreachable {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (v : V)
(hunreach : ∀ (u w : V) (hu : G.Adj v u) (hw : G.Adj v w), u ≠ w →
¬ (G.induce ({v}ᶜ : Set V)).Reachable ⟨u, (G.ne_of_adj hu).symm⟩ ⟨w, (G.ne_of_adj hw).symm⟩)
(C : (G.induce ({v}ᶜ : Set V)).ConnectedComponent) {u w : V}
(hu : G.Adj v u) (hw : G.Adj v w) (huC : u ∈ ve_comp_part G v C) (hwC : w ∈ ve_comp_part G v C) :
u = wve_dominates_inside_induce_iffIn LeanGraph Theory & Graph Algorithms
For S contained in A, S ve-dominates the induced subgraph G[A] if and only if S ve-dominates all edges of G with both endpoints in A.
lemma ve_dominates_inside_induce_iff {V : Type*} (G : SimpleGraph V) (A : Set V) (S : Set V)
(hSA : S ⊆ A) :
is_ve_dominating (G.induce A) {x : ↥A | (x : V) ∈ S} ↔ ve_dominates_inside G S Awalk_getVert_dist_eq_indexIn LeanGraph Theory & Graph Algorithms
If p is a walk from x to y whose length equals d(x,y), then every prefix is a geodesic: d(x, p.getVert i) = i for all i ≤ p.length.
theorem walk_getVert_dist_eq_index {V : Type*} (G : SimpleGraph V) {x y : V} (p : G.Walk x y)
(hplen : p.length = G.dist x y) {i : ℕ} (hi : i ≤ p.length) :
G.dist x (p.getVert i) = iwalk_getVert_dist_twoIn LeanGraph Theory & Graph Algorithms
Along a walk whose length equals the distance between its endpoints, vertices at indices i and i+2 are at distance exactly 2.
theorem walk_getVert_dist_two {V : Type*} (G : SimpleGraph V) {x y : V} (p : G.Walk x y)
(hplen : p.length = G.dist x y) {i : ℕ} (hi : i + 2 ≤ p.length) :
G.dist (p.getVert i) (p.getVert (i + 2)) = 2wcp_cartesian_product_four_of_boundsIn LeanGraph Theory & Graph Algorithms
For four complete graphs with sizes 2 ≤ a 0 ≤ a 1 ≤ a 2 ≤ a 3 satisfying 1 + (a 0 - 1) + (a 1 - 1) ≤ a 2 and 1 + (a 0 - 1) + (a 1 - 1) + (a 2 - 1) ≤ a 3, their Cartesian product has the well-covered powers property.
theorem wcp_cartesian_product_four_of_bounds
(a : Fin 4 → ℕ) (h_ge : ∀ i, 2 ≤ a i) (h_mono : Monotone a)
(h2 : 1 + (a 0 - 1) + (a 1 - 1) ≤ a 2)
(h3 : 1 + (a 0 - 1) + (a 1 - 1) + (a 2 - 1) ≤ a 3) :
simple_graph_has_well_covered_powers (cartesian_product_complete_graphs a)wcp_cycle_fourIn LeanGraph Theory & Graph Algorithms
The 4-cycle C_4 = K_{2,2} has the well-covered powers property: C_4 is well-covered (its maximal independent sets are the two bipartition classes, of size 2) and every power d ≥ 2 is the complete graph K_4.
theorem wcp_cycle_four : simple_graph_has_well_covered_powers (SimpleGraph.cycleGraph 4)
wcp_cycle_threeIn LeanGraph Theory & Graph Algorithms
The 3-cycle C_3 = K_3 has the well-covered powers property: every positive power is the complete graph K_3, whose maximal independent sets are the singletons.
theorem wcp_cycle_three : simple_graph_has_well_covered_powers (SimpleGraph.cycleGraph 3)
wiener_bound_of_completeIn LeanGraph Theory & Graph Algorithms
Every finite complete simple graph satisfies 4 * W(G) ≤ L(G) * n * (n - 1), where W(G) is the Wiener index and L(G) is the maximum order of an induced linear forest.
theorem wiener_bound_of_complete {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (hG : G = ⊤) : 4 * wiener_index G ≤ max_induced_linear_forest G * Fintype.card V * (Fintype.card V - 1)wiener_bound_of_max_induced_eq_threeIn LeanGraph Theory & Graph Algorithms
Every finite connected simple graph whose maximum order of an induced linear forest equals 3 satisfies 4 * W(G) ≤ 3 * n * (n - 1).
theorem wiener_bound_of_max_induced_eq_three {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (hconn : G.Connected) (hL : max_induced_linear_forest G = 3) : 4 * wiener_index G ≤ 3 * Fintype.card V * (Fintype.card V - 1)wiener_index_add_edges_twin_independent_set_of_nonemptyIn LeanGraph Theory & Graph Algorithms
Let G and H be simple graphs on a finite vertex type V, where G is connected. Suppose Z and X are subsets of V such that X is nonempty, Z is an independent set in G, every vertex in Z has open neighborhood X in G, G ≤ H, and every edge of H is in G or has both endpoints in Z. Then the Wiener index of G equals the Wiener index of H plus the number of added edges, wiener_index G = wiener_index H + Nat.card ↑(H.edgeSet \ G.edgeSet).
theorem wiener_index_add_edges_twin_independent_set_of_nonempty
{V : Type*} [Fintype V]
(G H : SimpleGraph V) (hGconn : G.Connected)
(Z X : Set V) (hX : X.Nonempty)
(hZindep : ∀ u ∈ Z, ∀ v ∈ Z, ¬G.Adj u v)
(hZneigh : ∀ z ∈ Z, G.neighborSet z = X)
(hGH_le : G ≤ H)
(hGH_edges : ∀ u v, H.Adj u v → G.Adj u v ∨ (u ∈ Z ∧ v ∈ Z)) :
wiener_index G = wiener_index H + Nat.card ↑(H.edgeSet \ G.edgeSet)wiener_index_delete_ge_subIn LeanGraph Theory & Graph Algorithms
For any vertex u in a finite simple graph G with decidable equality on its vertex type, the Wiener index of G.delete u satisfies (wiener_index G : ℤ) - (graph_vertex_dist_sum G u : ℤ) ≤ (wiener_index (G.delete u) : ℤ).
theorem wiener_index_delete_ge_sub {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (u : V) : (wiener_index G : ℤ) - (graph_vertex_dist_sum G u : ℤ) ≤ (wiener_index (G.delete u) : ℤ)wiener_index_diff_invariance_twin_independent_setIn LeanGraph Theory & Graph Algorithms
Let G and H be simple graphs on a finite vertex type V with decidable equality, where G is connected. Suppose Z and X are subsets of V such that 2 ≤ Nat.card X, Z is an independent set in G (∀ u ∈ Z, ∀ v ∈ Z, ¬G.Adj u v), every vertex in Z has open neighborhood X in G (∀ z ∈ Z, G.neighborSet z = X), G ≤ H, and every edge of H is in G or has both endpoints in Z (∀ u v, H.Adj u v → G.Adj u v ∨ (u ∈ Z ∧ v ∈ Z)). Then for every vertex x ∉ Z such that the induced subgraph G.induce {x}ᶜ is connected, the difference in the Wiener index upon removing x satisfies (wiener_index H : ℤ) - wiener_index (H.induce {x}ᶜ) = (wiener_index G : ℤ) - wiener_index (G.induce {x}ᶜ).
theorem wiener_index_diff_invariance_twin_independent_set
{V : Type*} [Fintype V] [DecidableEq V]
(G H : SimpleGraph V) (hGconn : G.Connected)
(Z X : Set V) (hXcard : 2 ≤ Nat.card X)
(hZindep : ∀ u ∈ Z, ∀ v ∈ Z, ¬G.Adj u v)
(hZneigh : ∀ z ∈ Z, G.neighborSet z = X)
(hGH_le : G ≤ H)
(hGH_edges : ∀ u v, H.Adj u v → G.Adj u v ∨ (u ∈ Z ∧ v ∈ Z))
(x : V) (hxZ : x ∉ Z) (hGxconn : (G.induce {x}ᶜ).Connected) :
(wiener_index H : ℤ) - wiener_index (H.induce {x}ᶜ) =
(wiener_index G : ℤ) - wiener_index (G.induce {x}ᶜ)wiener_index_dist_diff_twin_independent_set_of_nonemptyIn LeanGraph Theory & Graph Algorithms
Let G and H be simple graphs on a finite vertex type V, where G is connected. Suppose Z and X are subsets of V such that X is nonempty, Z is an independent set in G, every vertex in Z has open neighborhood X in G, G ≤ H, and every edge of H is in G or has both endpoints in Z. Then for any two vertices u and v, G.dist u v = H.dist u v + 1 if uv is an added edge in H \ G, and G.dist u v = H.dist u v otherwise.
theorem wiener_index_dist_diff_twin_independent_set_of_nonempty
{V : Type*} [Fintype V]
(G H : SimpleGraph V) (hGconn : G.Connected)
(Z X : Set V) (hX : X.Nonempty)
(hZindep : ∀ u ∈ Z, ∀ v ∈ Z, ¬G.Adj u v)
(hZneigh : ∀ z ∈ Z, G.neighborSet z = X)
(hGH_le : G ≤ H)
(hGH_edges : ∀ u v, H.Adj u v → G.Adj u v ∨ (u ∈ Z ∧ v ∈ Z))
(u v : V) :
(H.Adj u v ∧ ¬G.Adj u v → G.dist u v = H.dist u v + 1) ∧
(¬(H.Adj u v ∧ ¬G.Adj u v) → G.dist u v = H.dist u v)wild_color_connecting_no_cut_edges_le_twoIn LeanGraph Theory & Graph Algorithms
In any edge-colored graph with a color-connecting edge set W, if u and v are adjacent and no edge of W crosses between {u, v} and its complement, then the entire vertex set has size at most 2.
theorem wild_color_connecting_no_cut_edges_le_two {V α : Type*} [DecidableEq V]
(G : SimpleGraph V) (c : G.lineGraph.Coloring α)
(W : Set (Sym2 V)) (hW : simple_graph_is_color_connecting G c W)
(u v : V) (huv : G.Adj u v)
(hWcross : ∀ w ∈ W, ∀ x ∈ ({u, v} : Set V), ∀ y ∉ ({u, v} : Set V), w ≠ s(x, y)) :
∀ z : V, z = u ∨ z = vwild_disjoint_support_pair_sum_identityIn LeanGraph Theory & Graph Algorithms
If W = sum mu(T), Q = sum mu(T)^2, R = sum mu(T)^3, and for each T the sum of mu(U) over disjoint U is K - mu(T), then the double sum sum_T sum_{U disjoint T} mu(T)(mu(T)-1)mu(U) equals (K+1)*Q - K*W - R.
theorem wild_disjoint_support_pair_sum_identity {V : Type*} [DecidableEq V]
(S : Finset (Finset V)) (μ : Finset V → ℝ) (W Q R K : ℝ)
(hW : ∑ T ∈ S, μ T = W)
(hQ : ∑ T ∈ S, (μ T)^2 = Q)
(hR : ∑ T ∈ S, (μ T)^3 = R)
(hdisj : ∀ T ∈ S, (∑ U ∈ S.filter (fun U => Disjoint T U), μ U) = K - μ T) :
(∑ T ∈ S, ∑ U ∈ S.filter (fun U => Disjoint T U), (μ T * (μ T - 1)) * μ U) =
(K + 1) * Q - K * W - Rwild_extensions_eq_card_pairsIn LeanGraph Theory & Graph Algorithms
The number of (k+2)-subsets extending a closed subset C of size k equals the number of closed 2-subsets in the complement V \ C.
theorem wild_extensions_eq_card_pairs {α : Type*} [DecidableEq α]
(V C : Finset α) (f : α → α) (hf : Function.Involutive f)
(hC : C ⊆ V) (hC_closed : ∀ x ∈ C, f x ∈ C)
(k : ℕ) (hC_card : C.card = k) :
(((Finset.powersetCard (k + 2) V)).filter fun S => C ⊆ S ∧ ∀ x ∈ S, f x ∈ S).card =
(((Finset.powersetCard 2 (V \ C))).filter fun P => ∀ x ∈ P, f x ∈ P).cardwild_extensions_eq_oneIn LeanGraph Theory & Graph Algorithms
If C is a closed subset of V of size 6, there is a unique 6-element subset containing C and closed under f, namely C itself.
theorem wild_extensions_eq_one {α : Type*} [DecidableEq α]
(V C : Finset α) (f : α → α)
(hC : C ⊆ V) (hC_closed : ∀ x ∈ C, f x ∈ C) (hC_card : C.card = 6) :
(((Finset.powersetCard 6 V)).filter fun S => C ⊆ S ∧ ∀ x ∈ S, f x ∈ S).card = 1wild_involution_closed_six_cardIn LeanGraph Theory & Graph Algorithms
For an involution g of a finite linearly ordered set that maps a finite set W into itself with no fixed point in W, the number of g-closed 6-element subsets of W equals choose(number of orbit representatives, 3).
theorem wild_involution_closed_six_card {α : Type*} [DecidableEq α] [LinearOrder α]
(W : Finset α) (g : α → α) (hg : Function.Involutive g)
(hW : ∀ x ∈ W, g x ∈ W) (hfree : ∀ x ∈ W, g x ≠ x) :
((W.powersetCard 6).filter (fun T => ∀ x ∈ T, g x ∈ T)).card
= (W.filter (fun x => x < g x)).card.choose 3wild_involution_pairs_and_evenIn LeanGraph Theory & Graph Algorithms
For any finite set U and fixed-point-free involution f preserving U, the number of f-closed pairs in U is |U|/2, and |U| is even.
theorem wild_involution_pairs_and_even {α : Type*} [DecidableEq α]
(U : Finset α) (f : α → α) (hf : Function.Involutive f)
(hU : ∀ x ∈ U, f x ∈ U) (hne : ∀ x ∈ U, f x ≠ x) :
(((Finset.powersetCard 2 U)).filter fun P => ∀ x ∈ P, f x ∈ P).card = U.card / 2 ∧ U.card % 2 = 0wild_involution_rep_half_cardIn LeanGraph Theory & Graph Algorithms
For an involution g of a finite linearly ordered set that maps a finite set W into itself with no fixed point in W, twice the number of representatives {x ∈ W : x < g x} equals |W|.
theorem wild_involution_rep_half_card {α : Type*} [DecidableEq α] [LinearOrder α]
(W : Finset α) (g : α → α) (hg : Function.Involutive g)
(hW : ∀ x ∈ W, g x ∈ W) (hfree : ∀ x ∈ W, g x ≠ x) :
2 * (W.filter (fun x => x < g x)).card = W.cardwild_joint_alpha_type_A_eq_oneIn LeanGraph Theory & Graph Algorithms
If the first block is the type-A triple {0,1,2} (contains the isolated vertex 0 and the canonical edge {1,2}), the canonical matching is automatically whole-bad because that block is already a proper closed union of blocks, so the conditional probability is 1.
theorem wild_joint_alpha_type_A_eq_one (q : ℕ) (hq : 3 ≤ q) : wild_joint_alpha q (wild_joint_type_A q hq) = 1
wild_joint_type_weight_one_twoIn LeanGraph Theory & Graph Algorithms
The type-B and type-C weights both equal 3W - Q.
theorem wild_joint_type_weight_one_two (q : ℕ) (A : Fin (3*q) → Fin (3*q) → Fin (3*q)) (hid : ∀ a, A a a = a) (hsym : ∀ a b, A a b = A b a) (hinj : ∀ a, Function.Injective (A a)) : wild_joint_type_weight q A 1 = 3 * wild_joint_witness_mass q - wild_joint_squared_multiplicity q A ∧ wild_joint_type_weight q A 2 = 3 * wild_joint_witness_mass q - wild_joint_squared_multiplicity q A
wild_joint_type_weight_threeIn LeanGraph Theory & Graph Algorithms
The type-D weight equals (n-6)W + Q with n = 3q.
theorem wild_joint_type_weight_three (q : ℕ) (A : Fin (3*q) → Fin (3*q) → Fin (3*q)) (hid : ∀ a, A a a = a) (hsym : ∀ a b, A a b = A b a) (hinj : ∀ a, Function.Injective (A a)) : wild_joint_type_weight q A 3 = ((3*q : ℝ) - 6) * wild_joint_witness_mass q + wild_joint_squared_multiplicity q A
wild_joint_type_weight_zeroIn LeanGraph Theory & Graph Algorithms
The type-A weight equals Q.
theorem wild_joint_type_weight_zero (q : ℕ) (A : Fin (3*q) → Fin (3*q) → Fin (3*q)) (hid : ∀ a, A a a = a) (hsym : ∀ a b, A a b = A b a) (hinj : ∀ a, Function.Injective (A a)) : wild_joint_type_weight q A 0 = wild_joint_squared_multiplicity q A
wild_normalized_array_disjoint_six_seal_mass_boundIn LeanGraph Theory & Graph Algorithms
For a symmetric idempotent row-injective array on n=2m+1 vertices with m>=6 and any fixed six-set S, the total number of pairs (color i, closed six-set T) with T disjoint from S and excluding i is at most n*choose(m-6,3)+21*choose(m-6,2)+21*(m-6)+7. Repeated supports for different colors are counted separately. This is a support incidence bound, not a count of distinct bad colors or a wild-number theorem.
theorem wild_normalized_array_disjoint_six_seal_mass_bound
(m : ℕ) (hm : 6 ≤ m) (A : Fin (2*m+1) → Fin (2*m+1) → Fin (2*m+1))
(hdiag : ∀ x, A x x = x) (hsymm : ∀ x y, A x y = A y x)
(hinj : ∀ x, Function.Injective (A x))
(S : Finset (Fin (2*m+1))) (hS : S.card = 6) :
(∑ i : Fin (2*m+1),
(((univ : Finset (Fin (2*m+1))).powersetCard 6).filter fun T =>
Disjoint S T ∧ i ∉ T ∧
∀ x ∈ T, ∀ y, A x y = i → y ∈ T).card) ≤
(2*m+1) * (m-6).choose 3 + 21 * (m-6).choose 2 + 21 * (m-6) + 7wild_normalized_array_six_seal_triple_completion_countIn LeanGraph Theory & Graph Algorithms
For a normalized symmetric idempotent row-injective array on n>=7 vertices, a triple T and a color i outside T, the number of closed six-sets containing T and excluding i is (n-5)/2 when T contains an i-edge, and1 otherwise. This is an exact support-completion count; it says nothing yet about whole partition probabilities.
theorem wild_normalized_array_six_seal_triple_completion_count
(n : ℕ) (hn : 7 ≤ n) (A : Fin n → Fin n → Fin n)
(hdiag : ∀ x, A x x = x) (hsymm : ∀ x y, A x y = A y x)
(hinj : ∀ x, Function.Injective (A x))
(T : Finset (Fin n)) (hT : T.card = 3) (i : Fin n) (hi : i ∉ T) :
(((univ : Finset (Fin n)).powersetCard 6).filter fun S =>
T ⊆ S ∧ i ∉ S ∧ ∀ x ∈ S, ∀ y, A x y = i → y ∈ S).card =
if ∃ x ∈ T, ∃ y ∈ T, x ≠ y ∧ A x y = i then (n-5)/2 else 1wild_normalized_array_total_multiplicity_sumIn LeanGraph Theory & Graph Algorithms
For any normalized symmetric idempotent row-injective array A on Fin n, the sum over all 3-element subsets T of the number of pairs z.1 < z.2 with support {z.1, z.2, A z.1 z.2} = T equals choose(n, 2).
theorem wild_normalized_array_total_multiplicity_sum
(n : ℕ) (hn : 3 ≤ n) (hodd : n % 2 = 1)
(A : Fin n → Fin n → Fin n)
(hid : ∀ a, A a a = a) (hsym : ∀ a b, A a b = A b a)
(hinj : ∀ a, Function.Injective (A a)) :
(∑ T ∈ (Finset.univ : Finset (Finset (Fin n))).filter (fun T => T.card = 3),
((Finset.univ.filter fun z : Fin n × Fin n =>
z.1 < z.2 ∧ ({z.1, z.2, A z.1 z.2} : Finset (Fin n)) = T).card : ℝ)) =
(n.choose 2 : ℝ)wild_number_color_connecting_quadripartite_ge_two_nIn LeanGraph Theory & Graph Algorithms
Every color-connecting set of edges in K_{n,n,n,n} under a proper (3n)-edge coloring has cardinality at least 2n.
theorem wild_number_color_connecting_quadripartite_ge_two_n (n : ℕ) (hn : 1 ≤ n)
(c : (SimpleGraph.completeEquipartiteGraph 4 n).lineGraph.Coloring (Fin (3 * n)))
(W : Finset (Sym2 (Fin 4 × Fin n)))
(hW : simple_graph_is_color_connecting (SimpleGraph.completeEquipartiteGraph 4 n) c ↑W) :
2 * n ≤ W.cardwild_number_complete_graph_odd_bounded_eqIn LeanGraph Theory & Graph Algorithms
For every odd order 3 ≤ n < 30000001, every minimum proper edge coloring of K_n has wild number floor(4*ceil(n/2)/3).
theorem wild_number_complete_graph_odd_bounded_eq (n k : ℕ) (hn : 3 ≤ n) (hodd : n % 2 = 1) (hlt : n < 30000001)
(hk : (⊤ : SimpleGraph (Fin n)).lineGraph.chromaticNumber = k)
(c : (⊤ : SimpleGraph (Fin n)).lineGraph.Coloring (Fin k)) :
simple_graph_wild_number (⊤ : SimpleGraph (Fin n)) c = 4 * ((n + 1) / 2) / 3wild_odd_complete_normalized_arrayIn LeanGraph Theory & Graph Algorithms
In every minimum proper edge coloring c of an odd complete graph on n >= 3 vertices, taking the missing-vertex equivalence m : Fin k ≃ Fin n and setting A u u = u and A u w = m(c(uw)) for u ≠ w yields a normalized, symmetric, row-injective array.
theorem wild_odd_complete_normalized_array {n k : ℕ} (hn : 3 ≤ n) (hodd : n % 2 = 1)
(hk : (⊤ : SimpleGraph (Fin n)).lineGraph.chromaticNumber = k)
(c : (⊤ : SimpleGraph (Fin n)).lineGraph.Coloring (Fin k)) :
∃ (m : Fin k ≃ Fin n) (A : Fin n → Fin n → Fin n),
(∀ u, A u u = u) ∧
(∀ u w, A u w = A w u) ∧
(∀ u, Function.Injective (A u)) ∧
(∀ u w (h : u ≠ w), A u w = m (c ⟨s(u, w), wild_kn_mem h⟩)) ∧
(∀ (i : Fin k) (v : Fin n), (∀ w (hvw : v ≠ w), c ⟨s(v, w), wild_kn_mem hvw⟩ ≠ i) ↔ v = m i)wild_odd_optimal_partition_exists_boundedIn LeanGraph Theory & Graph Algorithms
Conjecture (optimal partition existence on bounded odd orders): for every odd order 3 ≤ n < 30000001 and every minimum proper edge coloring c of K_n, there exists a rooted partition of Fin n into floor(n/3) blocks of size at least 3 such that every color in c crosses every nontrivial block cut.
theorem wild_odd_optimal_partition_exists_bounded (n k : ℕ) (hn : 3 ≤ n) (hodd : n % 2 = 1) (hlt : n < 30000001)
(hk : (⊤ : SimpleGraph (Fin n)).lineGraph.chromaticNumber = k)
(c : (⊤ : SimpleGraph (Fin n)).lineGraph.Coloring (Fin k)) :
∃ (p : Fin n → Fin (n / 3)) (r : Fin (n / 3) → Fin n),
(∀ t, p (r t) = t) ∧
(∀ t, 3 ≤ ((Finset.univ : Finset (Fin n)).filter fun v => p v = t).card) ∧
(∀ (e : (⊤ : SimpleGraph (Fin n)).edgeSet) (S : Finset (Fin (n / 3))),
S.Nonempty → S ≠ Finset.univ →
∃ (u v : Fin n) (huv : u ≠ v), p u ∈ S ∧ p v ∉ S ∧ c ⟨s(u,v), wild_kn_mem huv⟩ = c e)wild_odd_optimal_partition_exists_ge_sixIn LeanGraph Theory & Graph Algorithms
Conjecture: for odd orders 6 ≤ n < 30000001, every minimum proper edge coloring of K_n admits a rooted seal-free floor(n/3)-block partition with block sizes at least 3.
theorem wild_odd_optimal_partition_exists_ge_six (n k : ℕ) (hn : 6 ≤ n) (hodd : n % 2 = 1) (hlt : n < 30000001)
(hk : (⊤ : SimpleGraph (Fin n)).lineGraph.chromaticNumber = k)
(c : (⊤ : SimpleGraph (Fin n)).lineGraph.Coloring (Fin k)) :
∃ (p : Fin n → Fin (n / 3)) (r : Fin (n / 3) → Fin n),
(∀ t, p (r t) = t) ∧
(∀ t, 3 ≤ ((Finset.univ : Finset (Fin n)).filter fun v => p v = t).card) ∧
(∀ (e : (⊤ : SimpleGraph (Fin n)).edgeSet) (S : Finset (Fin (n / 3))),
S.Nonempty → S ≠ Finset.univ →
∃ (u v : Fin n) (huv : u ≠ v), p u ∈ S ∧ p v ∉ S ∧ c ⟨s(u,v), wild_kn_mem huv⟩ = c e)wild_odd_optimal_partition_exists_n_lt_sixIn LeanGraph Theory & Graph Algorithms
For odd orders n < 6 (n = 3, 5), floor(n/3) = 1, so there are no nontrivial block cuts; any single-block partition into Fin 1 is vacuously seal-free.
theorem wild_odd_optimal_partition_exists_n_lt_six (n k : ℕ) (hn : 3 ≤ n) (hn6 : n < 6)
(hk : (⊤ : SimpleGraph (Fin n)).lineGraph.chromaticNumber = k)
(c : (⊤ : SimpleGraph (Fin n)).lineGraph.Coloring (Fin k)) :
∃ (p : Fin n → Fin (n / 3)) (r : Fin (n / 3) → Fin n),
(∀ t, p (r t) = t) ∧
(∀ t, 3 ≤ ((Finset.univ : Finset (Fin n)).filter fun v => p v = t).card) ∧
(∀ (e : (⊤ : SimpleGraph (Fin n)).edgeSet) (S : Finset (Fin (n / 3))),
S.Nonempty → S ≠ Finset.univ →
∃ (u v : Fin n) (huv : u ≠ v), p u ∈ S ∧ p v ∉ S ∧ c ⟨s(u,v), wild_kn_mem huv⟩ = c e)wild_odd_valid_optimal_partition_existsIn LeanGraph Theory & Graph Algorithms
At every odd order n>=9, any minimum proper complete-graph coloring has a rooted floor(n/3)-block partition with each block of size at least three and every proper three-vertex block valid for every color. This proves only nonemptiness of the triple-valid conditioning family, not seal avoidance or a wild-number bound.
theorem wild_odd_valid_optimal_partition_exists {n k : ℕ} (hn : 9≤n)
(hodd : n%2=1)
(hk : (⊤ : SimpleGraph (Fin n)).lineGraph.chromaticNumber=k)
(c : (⊤ : SimpleGraph (Fin n)).lineGraph.Coloring (Fin k)) :
∃ (p : Fin n → Fin (n/3)) (root : Fin (n/3) → Fin n),
(∀ t,p (root t)=t) ∧
(∀ t,3≤(univ.filter fun v => p v=t).card) ∧
(∀ t,(univ.filter fun v => p v=t).card=3 →
(univ.filter fun v => p v=t)≠univ →
∀ i,¬w279_closed c i (univ.filter fun v => p v=t))wild_odd_valid_reservoir_permutation_existsIn LeanGraph Theory & Graph Algorithms
For any normalized symmetric row-injective array on Fin n with n >= 9 odd, there is a permutation sigma whose first m triples are A-valid, where m = n/3 if 3 | n else n/3 - 1.
theorem wild_odd_valid_reservoir_permutation_exists {n : ℕ} (hn : 9 ≤ n) (hodd : n % 2 = 1)
(A : Fin n → Fin n → Fin n)
(hdiag : ∀ u, A u u = u) (hsym : ∀ u w, A u w = A w u)
(hinj : ∀ u, Function.Injective (A u)) :
let q := n / 3
let m := if n % 3 = 0 then q else q - 1
∃ σ : Equiv.Perm (Fin n), ∀ t : Fin m,
have h0 : 3 * t.val + 0 < n := by
have ht := t.isLt
dsimp [m] at ht
split_ifs at ht with h <;> omega
have h1 : 3 * t.val + 1 < n := by
have ht := t.isLt
dsimp [m] at ht
split_ifs at ht with h <;> omega
have h2 : 3 * t.val + 2 < n := by
have ht := t.isLt
dsimp [m] at ht
split_ifs at ht with h <;> omega
A (σ ⟨3 * t.val + 0, h0⟩) (σ ⟨3 * t.val + 1, h1⟩) ≠ σ ⟨3 * t.val + 2, h2⟩ ∧
A (σ ⟨3 * t.val + 0, h0⟩) (σ ⟨3 * t.val + 2, h2⟩) ≠ σ ⟨3 * t.val + 1, h1⟩ ∧
A (σ ⟨3 * t.val + 1, h1⟩) (σ ⟨3 * t.val + 2, h2⟩) ≠ σ ⟨3 * t.val + 0, h0⟩wild_odd_valid_triple_not_closedIn LeanGraph Theory & Graph Algorithms
If {x, y, z} is a triple with A x y ≠ z, A x z ≠ y, A y z ≠ x where off-diagonal entries of A record the missing vertex of the edge color, then {x, y, z} is not closed under any color i.
theorem wild_odd_valid_triple_not_closed {n k : ℕ} (hn : 3 ≤ n)
(c : (⊤ : SimpleGraph (Fin n)).lineGraph.Coloring (Fin k))
(m : Fin k ≃ Fin n)
(hm : ∀ (i : Fin k) (v : Fin n), (∀ w (hvw : v ≠ w), c ⟨s(v, w), wild_kn_mem hvw⟩ ≠ i) ↔ v = m i)
(A : Fin n → Fin n → Fin n)
(hA : ∀ u w (huw : u ≠ w), A u w = m (c ⟨s(u, w), wild_kn_mem huw⟩))
(x y z : Fin n) (hxy : x ≠ y) (hxz : x ≠ z) (hyz : y ≠ z)
(hval : A x y ≠ z ∧ A x z ≠ y ∧ A y z ≠ x)
(i : Fin k) :
¬ w279_closed c i {x, y, z}wild_one_bad_color_mixed_moment_formula_with_contextIn LeanGraph Theory & Graph Algorithms
For an odd q>=3 and a symmetric idempotent row-injective full array A on n=3q vertices, take the uniform distribution on all vertex permutations and partition consecutive positions into q triples. Let I count colors invalidating a triple block, and D count WHOLE bad colors over all proper block cuts. Put W=n(n-1)/2 and Q=sum of squared unordered witness-support multiplicities (defined as one quarter of the ordered equal-support count). For the fixed matching with isolated vertex0 and pairs(1,2), (3,4),..., let alphaB,alphaC,alphaD be the conditional probabilities of being bad given that the first block is respectively {0,1,3},{1,2,3},{1,3,5}. The proposed exact identity is E[I*D]=q/choose(n,3)*(Q+(3W-Q)*(alphaB+alphaC)+((n-6)*W+Q)*alphaD). The alphas include all bad-color cuts, not just small seals. Their conditioning denominators are explicitly finite cardinalities. This is a statement for agents to prove, not an accepted result.
theorem wild_one_bad_color_mixed_moment_formula_with_context :
∀ (q : ℕ) (hq : 3 ≤ q), q%2 = 1 →
∀ A : Fin (3*q) → Fin (3*q) → Fin (3*q),
(∀ a, A a a = a) → (∀ a b, A a b = A b a) →
(∀ a, Function.Injective (A a)) →
wild_joint_expected_ID q A =
((q : ℝ) / ((3*q).choose 3 : ℝ)) *
(wild_joint_squared_multiplicity q A +
(3*wild_joint_witness_mass q-wild_joint_squared_multiplicity q A) *
(wild_joint_alpha q (wild_joint_type_B q hq) +
wild_joint_alpha q (wild_joint_type_C q hq)) +
(((3*q : ℝ)-6)*wild_joint_witness_mass q+
wild_joint_squared_multiplicity q A) *
wild_joint_alpha q (wild_joint_type_D q hq))wild_profile_third_invalid_moment_formula_with_contextIn LeanGraph Theory & Graph Algorithms
For every odd n>=9, normalized symmetric idempotent row-injective array A on Fin n and profile p with every block size at least3, the exact uniform-permutation third falling-factorial moment of the number I of distinct colors invalidating triple blocks equals p1*(R-3Q+2W)+3*p2*((K+1)*Q-K*W-R)+p3*C. Here W=choose(n,2), K=(n^2-10n+27)/2, Q=sum mu(T)^2, R=sum mu(T)^3, C is the weighted ordered sum over three pairwise disjoint triple supports, h counts triple blocks, and pr=(h falling r)/product_{j=0}^{r-1} choose(n-3j,3). The definitions spell out all finite sums and divisions. This counts invalid-triple colors I, not whole bad colors D.
theorem wild_profile_third_invalid_moment_formula_with_context :
∀ (n q : ℕ), 9 ≤ n → n%2 = 1 →
∀ (A : Fin n → Fin n → Fin n) (p : Fin n → Fin q),
(∀ a, A a a = a) → (∀ a b, A a b = A b a) →
(∀ a, Function.Injective (A a)) →
(∀ b, 3 ≤ (univ.filter fun v => p v = b).card) →
wild_third_expectation A p = wild_third_prediction A pwild_seal_choose3_convolution_boundIn LeanGraph Theory & Graph Algorithms
Binomial convolution bound: for natural numbers u_i ≤ 3 with total 21 over 2m+1 indices, ∑ choose(m−6+u_i, 3) is at most (2m+1)·choose(m−6,3) + 21·choose(m−6,2) + 21·(m−6) + 7.
theorem wild_seal_choose3_convolution_bound (m : ℕ) (hm : 6 ≤ m) (u : Fin (2*m+1) → ℕ)
(hu : ∀ i, u i ≤ 3) (hsum : (∑ i, u i) = 21) :
(∑ i : Fin (2*m+1), (m-6 + u i).choose 3) ≤
(2*m+1) * (m-6).choose 3 + 21 * (m-6).choose 2 + 21 * (m-6) + 7wild_seal_six_orbit_half_cardIn LeanGraph Theory & Graph Algorithms
For an involution g of a finite linearly ordered set with unique fixed point i and a six-set S (with 13 ≤ |α|), twice the number of orbit representatives in univ \ (S ∪ {i} ∪ S.image g) equals |α| − 13 + [i ∈ S] + #{y ∈ S : g y ∈ S}.
theorem wild_seal_six_orbit_half_card {α : Type*} [DecidableEq α] [Fintype α] [LinearOrder α]
(g : α → α) (hg : Function.Involutive g) (S : Finset α) (hS : S.card = 6) (i : α)
(hfix : g i = i) (huniq : ∀ x, g x = x → x = i) (hcard : 13 ≤ Fintype.card α) :
2 * ((Finset.univ \ (S ∪ {i} ∪ S.image g)).filter (fun x => x < g x)).card
= Fintype.card α - 13 + (if i ∈ S then 1 else 0) + (S.filter (fun y => g y ∈ S)).cardwild_seal_six_orbit_smallIn LeanGraph Theory & Graph Algorithms
For an involution with unique fixed point i and a six-set S, the indicator [i ∈ S] plus the number of y ∈ S with g y ∈ S is at most 6.
theorem wild_seal_six_orbit_small {α : Type*} [DecidableEq α]
(g : α → α) (hg : Function.Involutive g) (S : Finset α) (hS : S.card = 6) (i : α)
(hfix : g i = i) (huniq : ∀ x, g x = x → x = i) :
(if i ∈ S then 1 else 0) + (S.filter (fun y => g y ∈ S)).card ≤ 6wild_seal_six_partner_row_sumIn LeanGraph Theory & Graph Algorithms
For a row-injective array and a six-set S, summing over colours i the number of y ∈ S whose i-partner lies in S gives 36 (=6·6).
theorem wild_seal_six_partner_row_sum {N : ℕ} (A : Fin N → Fin N → Fin N)
(hinj : ∀ x, Function.Injective (A x)) (S : Finset (Fin N)) (hS : S.card = 6) :
(∑ i : Fin N, (S.filter (fun y => wild_six_seal_partner A hinj i y ∈ S)).card) = 36wild_seal_six_union_cardIn LeanGraph Theory & Graph Algorithms
For an involution g fixing i and a six-set S, the cardinality of S ∪ {i} ∪ S.image g equals 13 − [i ∈ S] − #{y ∈ S : g y ∈ S}.
theorem wild_seal_six_union_card {α : Type*} [DecidableEq α]
(g : α → α) (hg : Function.Involutive g) (S : Finset α) (hS : S.card = 6) (i : α)
(hfix : g i = i) :
(S ∪ {i} ∪ S.image g).card = 13 - (if i ∈ S then 1 else 0) - (S.filter (fun y => g y ∈ S)).cardwild_single_support_desc_three_sum_identityIn LeanGraph Theory & Graph Algorithms
If W = sum mu(T), Q = sum mu(T)^2, and R = sum mu(T)^3 over a finite set S, then sum mu(T)(mu(T)-1)(mu(T)-2) = R - 3Q + 2W.
theorem wild_single_support_desc_three_sum_identity {α : Type*}
(S : Finset α) (μ : α → ℝ) (W Q R : ℝ)
(hW : ∑ T ∈ S, μ T = W)
(hQ : ∑ T ∈ S, (μ T)^2 = Q)
(hR : ∑ T ∈ S, (μ T)^3 = R) :
(∑ T ∈ S, μ T * (μ T - 1) * (μ T - 2)) = R - 3 * Q + 2 * Wwild_six_seal_partner_propsIn LeanGraph Theory & Graph Algorithms
For a symmetric idempotent row-injective array, the i-partner map x ↦ partner i x satisfies A x (partner i x) = i, is an involution, and has the unique fixed point i (partner i x = x iff x = i).
theorem wild_six_seal_partner_props {N : ℕ} (A : Fin N → Fin N → Fin N)
(hdiag : ∀ x, A x x = x) (hsymm : ∀ x y, A x y = A y x)
(hinj : ∀ x, Function.Injective (A x)) (i : Fin N) :
(∀ x, A x (wild_six_seal_partner A hinj i x) = i) ∧
Function.Involutive (wild_six_seal_partner A hinj i) ∧
(∀ x, wild_six_seal_partner A hinj i x = x ↔ x = i)wild_six_seal_rep_cardIn LeanGraph Theory & Graph Algorithms
For a symmetric idempotent row-injective array on Fin (2m+1), a six-set S and a colour i, twice the number of orbit representatives equals 2m+1 − 13 + [i ∈ S] + #{y ∈ S : the i-partner of y lies in S}.
theorem wild_six_seal_rep_card (m : ℕ) (hm : 6 ≤ m)
(A : Fin (2*m+1) → Fin (2*m+1) → Fin (2*m+1))
(hdiag : ∀ x, A x x = x) (hsymm : ∀ x y, A x y = A y x)
(hinj : ∀ x, Function.Injective (A x))
(S : Finset (Fin (2*m+1))) (hS : S.card = 6) (i : Fin (2*m+1)) :
2 * (wild_six_seal_rep_set A hinj S i).card =
2*m+1 - 13 + (if i ∈ S then 1 else 0)
+ (S.filter (fun y => wild_six_seal_partner A hinj i y ∈ S)).cardwild_six_seal_rep_leIn LeanGraph Theory & Graph Algorithms
For a symmetric idempotent row-injective array on Fin (2m+1) with m≥6, a six-set S and a colour i, the number of orbit representatives is at most m−3.
theorem wild_six_seal_rep_le (m : ℕ) (hm : 6 ≤ m)
(A : Fin (2*m+1) → Fin (2*m+1) → Fin (2*m+1))
(hdiag : ∀ x, A x x = x) (hsymm : ∀ x y, A x y = A y x)
(hinj : ∀ x, Function.Injective (A x))
(S : Finset (Fin (2*m+1))) (hS : S.card = 6) (i : Fin (2*m+1)) :
(wild_six_seal_rep_set A hinj S i).card ≤ m - 3wild_six_seal_summand_eq_chooseIn LeanGraph Theory & Graph Algorithms
For a symmetric idempotent row-injective array, a six-set S and a colour i, the number of 6-sets disjoint from S, excluding i and closed under all i-edges equals choose(|rep_set i|, 3).
theorem wild_six_seal_summand_eq_choose (m : ℕ)
(A : Fin (2*m+1) → Fin (2*m+1) → Fin (2*m+1))
(hdiag : ∀ x, A x x = x) (hsymm : ∀ x y, A x y = A y x)
(hinj : ∀ x, Function.Injective (A x))
(S : Finset (Fin (2*m+1))) (hS : S.card = 6) (i : Fin (2*m+1)) :
(((Finset.univ : Finset (Fin (2*m+1))).powersetCard 6).filter fun T =>
Disjoint S T ∧ i ∉ T ∧ ∀ x ∈ T, ∀ y, A x y = i → y ∈ T).card
= (wild_six_seal_rep_set A hinj S i).card.choose 3wilf_chromatic_le_one_add_induced_avg_degreeIn LeanGraph Theory & Graph Algorithms
If s is a vertex set such that G[s] has the same chromatic number as G and every vertex of G[s] has degree at least χ(G)-1, then χ(G) ≤ 1 + (average degree of G[s]).
attribute [local instance] Classical.propDecidable in
theorem wilf_chromatic_le_one_add_induced_avg_degree {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (s : Set V)
(h : (G.induce s).chromaticNumber = G.chromaticNumber)
(hdeg : ∀ v : s, G.chromaticNumber.toNat ≤ (G.induce s).degree v + 1) :
(G.chromaticNumber : ENNReal) ≤
1 + ENNReal.ofReal ((∑ v : s, ((G.induce s).degree v : ℝ)) / (Fintype.card s : ℝ))wilf_chromatic_number_le_one_add_spectral_radiusIn LeanGraph Theory & Graph Algorithms
Wilf's inequality: for any finite simple graph G, the chromatic number of G is at most 1 plus the adjacency spectral radius of G.
theorem wilf_chromatic_number_le_one_add_spectral_radius {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) :
(G.chromaticNumber : ENNReal) ≤ 1 + adjacency_spectral_radius Gwilf_critical_induced_subgraph_existsIn LeanGraph Theory & Graph Algorithms
Every finite simple graph G has an induced subgraph G[s] with the same chromatic number as G, all of whose vertices have degree at least χ(G) - 1.
attribute [local instance] Classical.propDecidable in
theorem wilf_critical_induced_subgraph_exists {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) :
∃ s : Set V, (G.induce s).chromaticNumber = G.chromaticNumber ∧
∀ v : s, G.chromaticNumber.toNat ≤ (G.induce s).degree v + 1zero_demand_has_integral_multiflowIn LeanGraph Theory & Graph Algorithms
For any directed multigraphs G and H and non-negative capacities u, if all demands are zero then there exists an integral multiflow.
theorem zero_demand_has_integral_multiflow
{V E K : Type*} [Fintype E] [Fintype K] [DecidableEq V]
(G : DirectedMultigraph V E) (H : DirectedMultigraph V K)
(u : E → ℝ) (hu_nonneg : ∀ e, 0 ≤ u e) :
HasIntegralMultiflow G H u (fun _ => 0)zero_forced_isoIn LeanGraph Theory & Graph Algorithms
Under a graph isomorphism e : G ≃g H, a vertex v is in the zero forcing closure of S in G if and only if e(v) is in the zero forcing closure of e '' S in H.
theorem zero_forced_iso {V : Type*} {W : Type*} (G : SimpleGraph V) (H : SimpleGraph W)
(e : G ≃g H) (S : Set V) (v : V) :
ZeroForced G S v ↔ ZeroForced H (e '' S) (e v)zero_forcing_poly_coeff_card_sub_one_eq_cardIn LeanGraph Theory & Graph Algorithms
Let G be a finite graph on n ≥ 2 vertices with no isolated vertex. Then a set of n-1 vertices is a zero forcing set if and only if it is the complement of a single vertex, so there are exactly n zero forcing sets of size n-1 and the coefficient of X^{n-1} in the zero forcing polynomial is n.
theorem zero_forcing_poly_coeff_card_sub_one_eq_card {V : Type*} [Fintype V]
(G : SimpleGraph V) (hn : 2 ≤ Fintype.card V) (hiso : ∀ v, ∃ w, G.Adj v w) :
(zero_forcing_poly G).coeff (Fintype.card V - 1) = Fintype.card Vzero_forcing_poly_isoIn LeanGraph Theory & Graph Algorithms
If two finite simple graphs G and H are isomorphic, then their zero forcing polynomials are equal.
theorem zero_forcing_poly_iso {V : Type*} {W : Type*} [Fintype V] [Fintype W]
(G : SimpleGraph V) (H : SimpleGraph W) (e : G ≃g H) :
zero_forcing_poly G = zero_forcing_poly Hzero_forcing_poly_lower_half_monoIn LeanGraph Theory & Graph Algorithms
For every finite simple graph G on n vertices and every i with 2i+1 ≤ n, the coefficient of X^i in the zero forcing polynomial of G is at most the coefficient of X^{i+1}; equivalently, the number of i-element zero forcing sets is at most the number of (i+1)-element zero forcing sets.
theorem zero_forcing_poly_lower_half_mono {V : Type*} [Fintype V] (G : SimpleGraph V)
(i : ℕ) (hi : 2 * i + 1 ≤ Fintype.card V) :
(zero_forcing_poly G).coeff i ≤ (zero_forcing_poly G).coeff (i + 1)alternating_word_insertion_entropy_formulaIn LeanInformation Theory & Coding
For all natural numbers m ≥ 1 and k ≥ 0, the base-2 Shannon entropy of the posterior distribution on transmitted words x : Fin m → Bool given received alternating word alternating_word (m+k) false under k insertions equals Real.logb 2 (Nat.choose (m+k) k) - (1 / Nat.choose (m+k) k) * sum_{t=0}^{k/2} Nat.choose (m+1) (k-2t) * Nat.choose (m+t) t * Real.logb 2 (Nat.choose (m+t) t).
theorem alternating_word_insertion_entropy_formula (m k : ℕ) (hm : 1 ≤ m) :
shannon_entropy (fun x : Fin m → Bool =>
(((Finset.univ.filter (fun f : Fin m → Fin (m + k) =>
StrictMono f ∧ ∀ i, (alternating_word (m + k) false) (f i) = x i)).card : ℝ) /
((Nat.choose (m + k) k : ℕ) : ℝ))) / Real.log 2 =
Real.logb 2 ((m + k).choose k : ℝ) -
(∑ t ∈ Finset.range (k / 2 + 1),
((m + 1).choose (k - 2 * t) : ℝ) *
(((m + t).choose t : ℝ) * Real.logb 2 ((m + t).choose t : ℝ))) /
((m + k).choose k : ℝ)alternating_word_insertion_histogram_and_entropyIn LeanInformation Theory & Coding
For all natural numbers m ≥ 1 and k ≥ 0, the alternating word of length m + k starting with false satisfies both: (1) for every c > 0, the number of binary words x : Fin m → Bool with exactly c strictly increasing embeddings into the alternating word equals the sum over t from 0 to k / 2 of Nat.choose (m + 1) (k - 2 * t) * (if c = Nat.choose (m + t) t then 1 else 0); and (2) the base-2 Shannon entropy of the posterior distribution on transmitted words x : Fin m → Bool given received alternating word under k insertions equals Real.logb 2 (Nat.choose (m+k) k) - (1 / Nat.choose (m+k) k) * sum_{t=0}^{k/2} Nat.choose (m+1) (k-2t) * Nat.choose (m+t) t * Real.logb 2 (Nat.choose (m+t) t).
theorem alternating_word_insertion_histogram_and_entropy (m k : ℕ) (hm : 1 ≤ m) :
(∀ c : ℕ, 0 < c →
(Finset.univ.filter (fun x : Fin m → Bool =>
(Finset.univ.filter (fun f : Fin m → Fin (m + k) =>
StrictMono f ∧ ∀ i, (alternating_word (m + k) false) (f i) = x i)).card = c)).card =
∑ t ∈ Finset.range (k / 2 + 1),
(m + 1).choose (k - 2 * t) * (if c = (m + t).choose t then 1 else 0)) ∧
shannon_entropy (fun x : Fin m → Bool =>
(((Finset.univ.filter (fun f : Fin m → Fin (m + k) =>
StrictMono f ∧ ∀ i, (alternating_word (m + k) false) (f i) = x i)).card : ℝ) /
((Nat.choose (m + k) k : ℕ) : ℝ))) / Real.log 2 =
Real.logb 2 ((m + k).choose k : ℝ) -
(∑ t ∈ Finset.range (k / 2 + 1),
((m + 1).choose (k - 2 * t) : ℝ) *
(((m + t).choose t : ℝ) * Real.logb 2 ((m + t).choose t : ℝ))) /
((m + k).choose k : ℝ)alternating_word_insertion_positive_histogramIn LeanInformation Theory & Coding
For all natural numbers m ≥ 1 and k ≥ 0, and every positive natural number c > 0, the number of binary words x : Fin m → Bool having exactly c strictly increasing embeddings into the alternating word of length m + k starting with false equals the sum over t from 0 to k / 2 of Nat.choose (m + 1) (k - 2 * t) * (if c = Nat.choose (m + t) t then 1 else 0).
theorem alternating_word_insertion_positive_histogram (m k : ℕ) (hm : 1 ≤ m) (c : ℕ) (hc : 0 < c) :
(Finset.univ.filter (fun x : Fin m → Bool =>
(Finset.univ.filter (fun f : Fin m → Fin (m + k) =>
StrictMono f ∧ ∀ i, (alternating_word (m + k) false) (f i) = x i)).card = c)).card =
∑ t ∈ Finset.range (k / 2 + 1),
(m + 1).choose (k - 2 * t) * (if c = (m + t).choose t then 1 else 0)antipodal_hellinger_cG_necessityIn LeanInformation Theory & Coding
For every ρ with 0 < ρ < 1 and every real c, if c satisfies the dimension-free stability inequality Z_ρ(f) - sqrt(1-ρ²) ≥ c·δ(f) for all n ≥ 1 and all antipodal f, then c ≤ c_G(ρ).
theorem antipodal_hellinger_cG_necessity (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1) (c : ℝ)
(h : ∀ (n : ℕ) (hn : 0 < n) (f : (Fin n → Bool) → ℝ), is_antipodal n f →
hellinger_Z n ρ f - Real.sqrt (1 - ρ ^ 2) ≥ c * dictator_dist n f) :
c ≤ c_G ρantipodal_hellinger_gaussian_majority_limitIn LeanInformation Theory & Coding
For 0 < ρ < 1 and every ε > 0 there are n ≥ 1 and an antipodal f : (Fin n → Bool) → ℝ with positive dictator distance and Hellinger excess at most (c_G(ρ) + ε) times the dictator distance.
theorem antipodal_hellinger_gaussian_majority_limit (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(ε : ℝ) (hε : 0 < ε) :
∃ (n : ℕ) (hn : 0 < n) (f : (Fin n → Bool) → ℝ), is_antipodal n f ∧ 0 < dictator_dist n f ∧
hellinger_Z n ρ f - Real.sqrt (1 - ρ ^ 2) ≤ (c_G ρ + ε) * dictator_dist n fantipodal_hellinger_majority_three_necessityIn LeanInformation Theory & Coding
For every ρ with 0 < ρ < 1 and every real c, if c satisfies the dimension-free stability inequality Z_ρ(f) - sqrt(1-ρ²) ≥ c·δ(f) for all n ≥ 1 and all antipodal f, then c ≤ c_3(ρ).
theorem antipodal_hellinger_majority_three_necessity (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1) (c : ℝ)
(h : ∀ (n : ℕ) (hn : 0 < n) (f : (Fin n → Bool) → ℝ), is_antipodal n f →
hellinger_Z n ρ f - Real.sqrt (1 - ρ ^ 2) ≥ c * dictator_dist n f) :
c ≤ c_3 ρantipodal_hellinger_sharp_stability_bound_c3_regimeIn LeanInformation Theory & Coding
For 0 < ρ < 1 with c_3(ρ) ≤ c_G(ρ), for every n ≥ 1 and every antipodal f : (Fin n → Bool) → ℝ, the Hellinger excess Z_ρ(f) - sqrt(1-ρ²) is at least c_3(ρ) times the dictator distance of f. The extremal case is n = 3 with f = majority_three, where equality holds (excess = c_3(ρ)/4 and δ = 1/4).
theorem antipodal_hellinger_sharp_stability_bound_c3_regime (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(hreg : c_3 ρ ≤ c_G ρ) (n : ℕ) (hn : 0 < n) (f : (Fin n → Bool) → ℝ) (hf : is_antipodal n f) :
hellinger_Z n ρ f - Real.sqrt (1 - ρ ^ 2) ≥ c_3 ρ * dictator_dist n fantipodal_hellinger_sharp_stability_bound_cG_regimeIn LeanInformation Theory & Coding
For 0 < ρ < 1 with c_G(ρ) ≤ c_3(ρ), for every n ≥ 1 and every antipodal f : (Fin n → Bool) → ℝ, the Hellinger excess Z_ρ(f) - sqrt(1-ρ²) is at least c_G(ρ) times the dictator distance of f. The extremal family is majority on n bits with n → ∞.
theorem antipodal_hellinger_sharp_stability_bound_cG_regime (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(hreg : c_G ρ ≤ c_3 ρ) (n : ℕ) (hn : 0 < n) (f : (Fin n → Bool) → ℝ) (hf : is_antipodal n f) :
hellinger_Z n ρ f - Real.sqrt (1 - ρ ^ 2) ≥ c_G ρ * dictator_dist n fantipodal_hellinger_sharp_stability_min_boundIn LeanInformation Theory & Coding
For 0 < ρ < 1, every n ≥ 1 and every antipodal f, the Hellinger excess Z_ρ(f) - sqrt(1-ρ²) is at least min(c_3(ρ), c_G(ρ)) times the dictator distance of f.
theorem antipodal_hellinger_sharp_stability_min_bound (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1) :
∀ (n : ℕ), 0 < n → ∀ f : (Fin n → Bool) → ℝ, is_antipodal n f →
hellinger_Z n ρ f - Real.sqrt (1 - ρ ^ 2) ≥ min (c_3 ρ) (c_G ρ) * dictator_dist n fbiased_bit_zero_advantage_characterizationIn LeanInformation Theory & Coding
Let 1/2 < p < 1 and a = (1 - p) / p. For any probability distribution q on ℤ (with q(s) ≥ 0 for all s and HasSum q 1), the one-guess vulnerability satisfies V_p(q) = p if and only if q(s) ≥ a * q(s - 1) for all s ∈ ℤ, and equivalently, if and only if q is a countable mixture q(s) = ∑_{L ∈ ℤ} w_L * G_L(s) for all s ∈ ℤ with non-negative weights w_L ≥ 0 summing to 1 (HasSum w 1), where G_L is the shifted geometric distribution with parameter a.
theorem biased_bit_zero_advantage_characterization (p : ℝ) (hp : 1 / 2 < p) (hp1 : p < 1)
(q : ℤ → ℝ) (hq_nonneg : ∀ s, 0 ≤ q s) (hq_sum : HasSum q 1) :
let a := (1 - p) / p
(biased_bit_vulnerability p q = p ↔ ∀ s : ℤ, a * q (s - 1) ≤ q s) ∧
(biased_bit_vulnerability p q = p ↔
∃ w : ℤ → ℝ, (∀ L, 0 ≤ w L) ∧ HasSum w 1 ∧
∀ s, q s = ∑' L : ℤ, w L * shifted_geometric_distribution a L s)biased_bit_zero_advantage_iff_ratio_geIn LeanInformation Theory & Coding
Let 1/2 < p < 1 and a = (1 - p) / p. For any probability distribution q on ℤ (with q(s) ≥ 0 for all s and HasSum q 1), the one-guess vulnerability satisfies V_p(q) = p if and only if q(s) ≥ a * q(s - 1) for every s ∈ ℤ.
lemma biased_bit_zero_advantage_iff_ratio_ge (p : ℝ) (hp : 1 / 2 < p) (hp1 : p < 1)
(q : ℤ → ℝ) (hq_nonneg : ∀ s, 0 ≤ q s) (hq_sum : HasSum q 1) :
let a := (1 - p) / p
biased_bit_vulnerability p q = p ↔ ∀ s : ℤ, a * q (s - 1) ≤ q sbinaryEntropy_lt_one_of_lt_halfIn LeanInformation Theory & Coding
The binary entropy is below 1 strictly on [0, 1/2) (its maximum 1 is attained only at 1/2).
theorem binaryEntropy_lt_one_of_lt_half {x : ℝ} (hx0 : 0 ≤ x) (hx : x < 1 / 2) :
binaryEntropy x < 1binaryEntropy_strictMonoOn_halfIn LeanInformation Theory & Coding
The binary entropy is strictly increasing on [0, 1/2] (its derivative log2((1-x)/x) is positive there).
theorem binaryEntropy_strictMonoOn_half {x y : ℝ}
(hx : x ∈ Set.Icc (0 : ℝ) (1 / 2)) (hy : y ∈ Set.Icc (0 : ℝ) (1 / 2)) (hxy : x < y) :
binaryEntropy x < binaryEntropy ybinary_deletion_collision_two_eq_two_insertion_collisionIn LeanInformation Theory & Coding
For any n ≥ 2 and any binary word w of length n, binary_deletion_collision 2 n w equals two_insertion_collision (n - 2) (fun i => w (Fin.cast (Nat.sub_add_cancel hn) i)).
theorem binary_deletion_collision_two_eq_two_insertion_collision (n : ℕ) (hn : 2 ≤ n) (w : Fin n → Bool) :
binary_deletion_collision 2 n w =
two_insertion_collision (n - 2) (fun i => w (Fin.cast (Nat.sub_add_cancel hn) i))binary_subset_mean_coord_mem_IccIn LeanInformation Theory & Coding
For any natural number n, any finite nonempty subset S of {0, 1}^n (viewed in Fin n → ℝ), and any coordinate k : Fin n, the k-th coordinate of the centroid ((S.card : ℝ)⁻¹ • ∑ s ∈ S, s) lies in the closed interval [0, 1].
theorem binary_subset_mean_coord_mem_Icc (n : ℕ) (S : Finset (Fin n → ℝ))
(hS : ∀ s ∈ S, ∀ k : Fin n, s k = 0 ∨ s k = 1) (hne : S.Nonempty) (k : Fin n) :
((S.card : ℝ)⁻¹ • ∑ s ∈ S, s) k ∈ Set.Icc (0 : ℝ) 1binary_subset_mean_mem_convex_hullIn LeanInformation Theory & Coding
For any natural number n and any nonempty finite subset S of Fin n → ℝ, the uniform centroid (S.card : ℝ)⁻¹ • ∑ s ∈ S, s belongs to the convex hull convexHull ℝ (S : Set (Fin n → ℝ)).
theorem binary_subset_mean_mem_convex_hull (n : ℕ) (S : Finset (Fin n → ℝ)) (hne : S.Nonempty) :
((S.card : ℝ)⁻¹ • ∑ s ∈ S, s) ∈ convexHull ℝ (S : Set (Fin n → ℝ))bivariate_poisson_pmf_one_oneIn LeanInformation Theory & Coding
The bivariate Poisson PMF at (1, 1) equals Real.exp (-(3/2)) * (3/4).
theorem bivariate_poisson_pmf_one_one :
bivariate_poisson_pmf 1 1 = Real.exp (-(3 / 2)) * (3 / 4)bivariate_poisson_pmf_zero_rightIn LeanInformation Theory & Coding
For any natural number a, bivariate_poisson_pmf a 0 simplifies to Real.exp (-(3/2)) * (1/2)^a / a!.
theorem bivariate_poisson_pmf_zero_right (a : ℕ) :
bivariate_poisson_pmf a 0 = Real.exp (-(3 / 2)) * (1 / 2) ^ a / a.factorialcliqueNum_categorical_prod_ge_minIn LeanInformation Theory & Coding
The clique number of the categorical product G × H is at least the minimum of the clique numbers of G and H.
theorem cliqueNum_categorical_prod_ge_min {V W : Type*} [Fintype V] [Nonempty V] [Fintype W] [Nonempty W] (G : SimpleGraph V) (H : SimpleGraph W) : min G.cliqueNum H.cliqueNum ≤ (simple_graph_categorical_prod G H).cliqueNumcliqueNum_le_shannon_or_capacityIn LeanInformation Theory & Coding
The clique number of a finite graph is a lower bound for its Shannon OR-capacity (the n = 1 term of the supremum equals the clique number).
theorem cliqueNum_le_shannon_or_capacity {V : Type*} [Fintype V] [Nonempty V] (G : SimpleGraph V) : (G.cliqueNum : ℝ) ≤ shannon_or_capacity Gcode_elimination_projectively_independent_low_weightIn LeanInformation Theory & Coding
Let F be a finite field, and let k, n, d >= 1. Let G be a (k + 1) by n matrix over F. If the set of projective points with codeword Hamming weight at most d - 1 is projectively independent, then there exists a k by (k + 1) matrix U of rank k such that no projective point has codeword Hamming weight at most d - 1 under U * G.
theorem code_elimination_projectively_independent_low_weight
{F : Type*} [Field F] [Fintype F] [DecidableEq F] {k n d : ℕ}
(hk : 1 ≤ k) (hn : 1 ≤ n) (hd : 1 ≤ d)
(G : Matrix (Fin (k + 1)) (Fin n) F)
(hS : Projectivization.Independent
((↑) : { p : Projectivization F (Fin (k + 1) → F) | hammingNorm (Matrix.vecMul p.rep G) ≤ d - 1 } →
Projectivization F (Fin (k + 1) → F))) :
∃ U : Matrix (Fin k) (Fin (k + 1)) F,
U.rank = k ∧
{ p : Projectivization F (Fin k → F) | hammingNorm (Matrix.vecMul p.rep (U * G)) ≤ d - 1 } = ∅collision_embedding_pair_count_four_geIn LeanInformation Theory & Coding
Every binary word of length 6 has at least 31 ordered pairs of strictly increasing maps Fin 4 → Fin 6 inducing equal sub-words: 31 ≤ collision_embedding_pair_count 4 w.
theorem collision_embedding_pair_count_four_ge (w : Fin 6 → Bool) :
31 ≤ collision_embedding_pair_count 4 wcollision_embedding_pair_count_four_witnessIn LeanInformation Theory & Coding
The word 010010 (true exactly at positions 1 and 4) has exactly 31 ordered pairs of strictly increasing maps Fin 4 → Fin 6 inducing equal sub-words: collision_embedding_pair_count 4 (fun i : Fin 6 => i = 1 ∨ i = 4) = 31.
theorem collision_embedding_pair_count_four_witness :
collision_embedding_pair_count 4 (fun i : Fin 6 => (i : ℕ) = 1 ∨ (i : ℕ) = 4) = 31cyclic_orbit_coprime_degree_one_of_scalar_equivIn LeanInformation Theory & Coding
Under the forward hypotheses (r ≥ 2, both minimal polynomial degrees ≥ 2r-1, and the spans of powers of y and x equal up to a nonzero scalar), there exist coprime f, g ∈ B[X] with natDegree ≤ r-1, (aeval y g) ≠ 0, (aeval y f) ≠ 0, x = (aeval y f)/(aeval y g) and max (natDegree f) (natDegree g) = 1.
open Pointwise in
theorem cyclic_orbit_coprime_degree_one_of_scalar_equiv
{B M : Type*} [Field B] [Field M] [Algebra B M] [FiniteDimensional B M]
{r : ℕ} (hr : 2 ≤ r) {x y : M}
(hx : 2 * r - 1 ≤ (minpoly B x).natDegree)
(hy : 2 * r - 1 ≤ (minpoly B y).natDegree)
(h : ∃ α : M, α ≠ 0 ∧ cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r x) :
∃ f g : Polynomial B, IsCoprime f g ∧ f.natDegree ≤ r - 1 ∧ g.natDegree ≤ r - 1 ∧
Polynomial.aeval y f ≠ 0 ∧ Polynomial.aeval y g ≠ 0 ∧
x = Polynomial.aeval y f / Polynomial.aeval y g ∧ max f.natDegree g.natDegree = 1cyclic_orbit_fractional_linear_of_coprime_degree_oneIn LeanInformation Theory & Coding
Let x, y ∈ M (M a field extension of B) and let f, g ∈ B[X] be coprime, of natDegree ≤ 1, with max (natDegree f) (natDegree g) ≥ 1, (aeval y f) ≠ 0, (aeval y g) ≠ 0 and x = (aeval y f)/(aeval y g). If (minpoly B x).natDegree ≥ 2, then y = (a x + b)/(c x + d) for some a, b, c, d ∈ B with a*d - b*c ≠ 0.
theorem cyclic_orbit_fractional_linear_of_coprime_degree_one
{B M : Type*} [Field B] [Field M] [Algebra B M]
{x y : M} {f g : Polynomial B}
(hcop : IsCoprime f g) (hf : f.natDegree ≤ 1) (hg : g.natDegree ≤ 1)
(hmax : 1 ≤ max f.natDegree g.natDegree)
(hfy : Polynomial.aeval y f ≠ 0) (hgy : Polynomial.aeval y g ≠ 0)
(hx : x = Polynomial.aeval y f / Polynomial.aeval y g)
(hx2 : 2 ≤ (minpoly B x).natDegree) :
∃ a b c d : B, a * d - b * c ≠ 0 ∧
y = (algebraMap B M a * x + algebraMap B M b) / (algebraMap B M c * x + algebraMap B M d)cyclic_orbit_fractional_linear_of_scalar_equivIn LeanInformation Theory & Coding
Let r ≥ 2, x, y ∈ M with both minimal polynomial degrees ≥ 2r-1. If cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r x for some α ≠ 0, then there are a, b, c, d ∈ B with a*d - b*c ≠ 0 and y = (ax+b)/(cx+d).
open Pointwise in
theorem cyclic_orbit_fractional_linear_of_scalar_equiv
{B M : Type*} [Field B] [Field M] [Algebra B M] [FiniteDimensional B M]
{r : ℕ} (hr : 2 ≤ r) {x y : M}
(hx : 2 * r - 1 ≤ (minpoly B x).natDegree)
(hy : 2 * r - 1 ≤ (minpoly B y).natDegree)
(h : ∃ α : M, α ≠ 0 ∧ cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r x) :
∃ a b c d : B, a * d - b * c ≠ 0 ∧
y = (algebraMap B M a * x + algebraMap B M b) / (algebraMap B M c * x + algebraMap B M d)cyclic_orbit_fractional_rep_of_scalar_equivIn LeanInformation Theory & Coding
Let r ≥ 2, let M be a finite-dimensional extension of B, and let x, y ∈ M satisfy cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r x for some α ≠ 0. Then there are polynomials f, g over B with natDegree ≤ r-1, coprime, with (aeval y g) ≠ 0 and x = (aeval y f)/(aeval y g).
open Pointwise in
theorem cyclic_orbit_fractional_rep_of_scalar_equiv
{B M : Type*} [Field B] [Field M] [Algebra B M] [FiniteDimensional B M]
{r : ℕ} (hr : 2 ≤ r) {x y : M}
(h : ∃ α : M, α ≠ 0 ∧ cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r x) :
∃ f g : Polynomial B, f.natDegree ≤ r - 1 ∧ g.natDegree ≤ r - 1 ∧ IsCoprime f g ∧
Polynomial.aeval y g ≠ 0 ∧ x = Polynomial.aeval y f / Polynomial.aeval y gcyclic_orbit_poly_subspace_inf_smul_eq_aeval_smulIn LeanInformation Theory & Coding
Let r ≥ 2, y ∈ M with (minpoly B y).natDegree ≥ 2r-1, f, g ∈ B[X] coprime with natDegree ≤ r-1, (aeval y f) ≠ 0, (aeval y g) ≠ 0 and x = (aeval y f)/(aeval y g). Then cyclic_orbit_poly_subspace B r y ⊓ x • cyclic_orbit_poly_subspace B r y = (aeval y f) • cyclic_orbit_poly_subspace B (r - max (natDegree f) (natDegree g)) y.
open Pointwise in
theorem cyclic_orbit_poly_subspace_inf_smul_eq_aeval_smul
{B M : Type*} [Field B] [Field M] [Algebra B M] [FiniteDimensional B M]
{r : ℕ} (hr : 2 ≤ r) {x y : M} (hy : 2 * r - 1 ≤ (minpoly B y).natDegree)
{f g : Polynomial B} (hcop : IsCoprime f g)
(hf : f.natDegree ≤ r - 1) (hg : g.natDegree ≤ r - 1)
(hfy : Polynomial.aeval y f ≠ 0) (hgy : Polynomial.aeval y g ≠ 0)
(hx : x = Polynomial.aeval y f / Polynomial.aeval y g) :
cyclic_orbit_poly_subspace B r y ⊓ x • cyclic_orbit_poly_subspace B r y =
Polynomial.aeval y f • cyclic_orbit_poly_subspace B (r - max f.natDegree g.natDegree) ycyclic_orbit_poly_subspace_inf_smul_finrank_of_scalar_equivIn LeanInformation Theory & Coding
Let r ≥ 2, x, y ∈ M with (minpoly B x).natDegree ≥ 2r-1, and suppose cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r x for some α ≠ 0. Then the B-dimension of cyclic_orbit_poly_subspace B r y ⊓ x • cyclic_orbit_poly_subspace B r y is r-1.
open Pointwise in
theorem cyclic_orbit_poly_subspace_inf_smul_finrank_of_scalar_equiv
{B M : Type*} [Field B] [Field M] [Algebra B M] [FiniteDimensional B M]
{r : ℕ} (hr : 2 ≤ r) {x y : M} (hx : 2 * r - 1 ≤ (minpoly B x).natDegree)
(h : ∃ α : M, α ≠ 0 ∧ cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r x) :
Module.finrank B ↥(cyclic_orbit_poly_subspace B r y ⊓ x • cyclic_orbit_poly_subspace B r y) = r - 1cyclic_orbit_poly_subspace_scalar_equiv_iffIn LeanInformation Theory & Coding
Given a finite field B, a finite extension field M of B (with [FiniteDimensional B M]), a natural number r with 2 ≤ r, and elements x, y ∈ M with (minpoly B x).natDegree ≥ 2 * r - 1 and (minpoly B y).natDegree ≥ 2 * r - 1, there exists α ∈ M with α ≠ 0 such that cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r x if and only if there exist a, b, c, d ∈ B such that a * d - b * c ≠ 0 and y = (algebraMap B M a * x + algebraMap B M b) / (algebraMap B M c * x + algebraMap B M d).
open Pointwise in
theorem cyclic_orbit_poly_subspace_scalar_equiv_iff
{B M : Type*} [Field B] [Finite B] [Field M] [Algebra B M] [FiniteDimensional B M]
{r : ℕ} (hr : 2 ≤ r) {x y : M}
(hx : 2 * r - 1 ≤ (minpoly B x).natDegree)
(hy : 2 * r - 1 ≤ (minpoly B y).natDegree) :
(∃ α : M, α ≠ 0 ∧ cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r x) ↔
∃ a b c d : B, a * d - b * c ≠ 0 ∧
y = (algebraMap B M a * x + algebraMap B M b) / (algebraMap B M c * x + algebraMap B M d)cyclic_orbit_poly_subspace_scalar_equiv_of_fractional_linearIn LeanInformation Theory & Coding
Given a finite-dimensional extension M of B, r ≥ 2, x, y ∈ M with (minpoly B x).natDegree ≥ 2r-1 and (minpoly B y).natDegree ≥ 2r-1, and a fractional linear relation y = (ax+b)/(cx+d) with ad - bc ≠ 0 (a,b,c,d ∈ B), there is α ≠ 0 in M with cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r x.
open Pointwise in
theorem cyclic_orbit_poly_subspace_scalar_equiv_of_fractional_linear
{B M : Type*} [Field B] [Field M] [Algebra B M] [FiniteDimensional B M]
{r : ℕ} (hr : 2 ≤ r) {x y : M}
(hx : 2 * r - 1 ≤ (minpoly B x).natDegree)
(hy : 2 * r - 1 ≤ (minpoly B y).natDegree)
(h : ∃ a b c d : B, a * d - b * c ≠ 0 ∧
y = (algebraMap B M a * x + algebraMap B M b) / (algebraMap B M c * x + algebraMap B M d)) :
∃ α : M, α ≠ 0 ∧ cyclic_orbit_poly_subspace B r y = α • cyclic_orbit_poly_subspace B r xcyclic_orbit_poly_subspace_smul_finrankIn LeanInformation Theory & Coding
If r ≤ (minpoly B x).natDegree and α ≠ 0 in M, then the B-dimension of α • cyclic_orbit_poly_subspace B r x equals r.
open Pointwise in
theorem cyclic_orbit_poly_subspace_smul_finrank
{B M : Type*} [Field B] [Field M] [Algebra B M]
(r : ℕ) {x : M} (h : r ≤ (minpoly B x).natDegree) {α : M} (hα : α ≠ 0) :
Module.finrank B ↥(α • cyclic_orbit_poly_subspace B r x) = rdescending_band_cost_nonnegIn LeanInformation Theory & Coding
For any integer gap d and natural numbers r, L, descending_band_cost d r L is non-negative.
theorem descending_band_cost_nonneg (d : ℤ) (r L : ℕ) : 0 ≤ descending_band_cost d r L
descending_band_points_mem_zero_oneIn LeanInformation Theory & Coding
For any integer d ≥ 3, the pair (0, 1) belongs to descending_band_points d.
theorem descending_band_points_mem_zero_one (d : ℤ) (hd : 3 ≤ d) : ((0 : ℝ), (1 : ℝ)) ∈ descending_band_points d
descending_band_vulnerability_ge_one_thirdIn LeanInformation Theory & Coding
For any integer gap d and valid parameters 1 ≤ r ≤ L, descending_band_vulnerability d r L is at least 1/3.
theorem descending_band_vulnerability_ge_one_third (d : ℤ) (r L : ℕ) (hr : 1 ≤ r) (hrL : r ≤ L) : 1 / 3 ≤ descending_band_vulnerability d r L
dictator_dist_le_half_of_antipodalIn LeanInformation Theory & Coding
For every n ≥ 1 and every antipodal f, the dictator distance of f is at most 1/2.
theorem dictator_dist_le_half_of_antipodal (n : ℕ) (hn : 0 < n) (f : (Fin n → Bool) → ℝ)
(hf : is_antipodal n f) : dictator_dist n f ≤ 1 / 2dictator_dist_nonnegIn LeanInformation Theory & Coding
For every n and every f, the dictator distance of f is nonnegative.
theorem dictator_dist_nonneg (n : ℕ) (f : (Fin n → Bool) → ℝ) : 0 ≤ dictator_dist n f
dictator_dist_odd_majority_signIn LeanInformation Theory & Coding
For every odd n, the dictator distance of the n-bit majority sign is (1/2)^(n-1) times the sum of the binomial coefficients C(n-1,k) for k from (n+1)/2 to n-1; in particular it is positive for n at least 3 and tends to 1/2.
open scoped BigOperators in
theorem dictator_dist_odd_majority_sign (n : ℕ) (hn : Odd n) :
dictator_dist n (odd_majority_sign n) =
(1 / 2 : ℝ) ^ (n - 1) * ∑ k ∈ Finset.Icc ((n + 1) / 2) (n - 1), ((n - 1).choose k : ℝ)dictator_stability_excess_zeroIn LeanInformation Theory & Coding
At a dictator (a 0/1 coordinate indicator) the order-7/8 Tsallis stability excess vanishes identically: E[(T_ρ f)^(7/8)] = h(7/8, ρ). So the target inequality is an equality, not merely an inequality, whenever delta(f) = 0, and any valid constant is automatically <= the (positive) sharp value at non-dictators.
open scoped BigOperators in
theorem dictator_stability_excess_zero (n : ℕ) (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1) (hn : 0 < n)
(i : Fin n) (b : Bool) :
((1 / (2 : ℝ) ^ n) * ∑ y : Fin n → Bool,
(noise_operator n ρ (fun x => if x i = b then (1 : ℝ) else 0) y) ^ (7 / 8 : ℝ))
- tsallis_h (7 / 8) ρ = 0dual_melas_joint_pattern_prob_marginal_eqIn LeanInformation Theory & Coding
The two marginal distributions of the dual Melas joint pattern distribution are identical: for any count m, the sum over the second coordinate equals the sum over the first coordinate.
theorem dual_melas_joint_pattern_prob_marginal_eq
{F : Type*} [Field F] [Algebra (ZMod 2) F] [FiniteDimensional (ZMod 2) F]
(k : ℕ) (hk : 0 < k) (α c : F) (m : ℕ) :
∑ b ∈ Finset.range (2 ^ k), dual_melas_joint_pattern_prob k α c m b =
∑ a ∈ Finset.range (2 ^ k), dual_melas_joint_pattern_prob k α c a mdual_melas_joint_pattern_prob_marginal_sumIn LeanInformation Theory & Coding
Summing the empirical joint pattern probability over the second coordinate b < 2^k yields the empirical single-pattern probability #{w | count(w) = a} / 2^k.
theorem dual_melas_joint_pattern_prob_marginal_sum
{F : Type*} [Field F] [Algebra (ZMod 2) F] [FiniteDimensional (ZMod 2) F]
(k : ℕ) (α c : F) (a : ℕ) :
∑ b ∈ Finset.range (2 ^ k), dual_melas_joint_pattern_prob k α c a b =
((Finset.univ.filter (fun w : Fin k → ZMod 2 =>
dual_melas_pattern_count k α c w = a)).card : ℝ) / (2 : ℝ) ^ kdual_melas_joint_pattern_prob_marginal_sum_fstIn LeanInformation Theory & Coding
Summing the empirical joint pattern probability over the first coordinate a < 2^k yields the rotated-pattern empirical probability #{w | count(cyclic_rotate_left k w) = b} / 2^k.
theorem dual_melas_joint_pattern_prob_marginal_sum_fst
{F : Type*} [Field F] [Algebra (ZMod 2) F] [FiniteDimensional (ZMod 2) F]
(k : ℕ) (α c : F) (b : ℕ) :
∑ a ∈ Finset.range (2 ^ k), dual_melas_joint_pattern_prob k α c a b =
((Finset.univ.filter (fun w : Fin k → ZMod 2 =>
dual_melas_pattern_count k α c (cyclic_rotate_left k w) = b)).card : ℝ) / (2 : ℝ) ^ kdual_melas_pattern_count_cyclic_rotate_left_card_eqIn LeanInformation Theory & Coding
The number of words w of length k whose cyclic rotation has pattern count b equals the number of words whose pattern count is b.
theorem dual_melas_pattern_count_cyclic_rotate_left_card_eq
{F : Type*} [Field F] [Algebra (ZMod 2) F] [FiniteDimensional (ZMod 2) F]
(k : ℕ) (hk : 0 < k) (α c : F) (b : ℕ) :
(Finset.univ.filter (fun w : Fin k → ZMod 2 =>
dual_melas_pattern_count k α c (cyclic_rotate_left k w) = b)).card =
(Finset.univ.filter (fun w : Fin k → ZMod 2 =>
dual_melas_pattern_count k α c w = b)).cardentropy_upper_bound_binary_subsetIn LeanInformation Theory & Coding
For any natural number n and any finite nonempty subset S ⊆ {0, 1}^n (represented as points in Fin n → ℝ with coordinates in {0, 1}), there exists a point z in the convex hull convexHull ℝ (S : Set (Fin n → ℝ)) such that Real.log (S.card : ℝ) ≤ ∑ k : Fin n, Real.binEntropy (z k).
theorem entropy_upper_bound_binary_subset (n : ℕ) (S : Finset (Fin n → ℝ))
(hS : ∀ s ∈ S, ∀ k : Fin n, s k = 0 ∨ s k = 1) (hne : S.Nonempty) :
∃ z ∈ convexHull ℝ (S : Set (Fin n → ℝ)), Real.log (S.card : ℝ) ≤ ∑ k : Fin n, Real.binEntropy (z k)entropy_upper_bound_binary_subset_centroidIn LeanInformation Theory & Coding
For any natural number n and any finite nonempty subset S of {0, 1}^n (viewed in Fin n → ℝ), the natural logarithm of the cardinality of S is bounded above by the sum over k : Fin n of the binary entropies Real.binEntropy of the k-th coordinates of the centroid ((S.card : ℝ)⁻¹ • ∑ s ∈ S, s).
theorem entropy_upper_bound_binary_subset_centroid (n : ℕ) (S : Finset (Fin n → ℝ))
(hS : ∀ s ∈ S, ∀ k : Fin n, s k = 0 ∨ s k = 1) (hne : S.Nonempty) :
Real.log (S.card : ℝ) ≤ ∑ k : Fin n, Real.binEntropy (((S.card : ℝ)⁻¹ • ∑ s ∈ S, s) k)exists_is_square_path_coloringIn LeanInformation Theory & Coding
For every q ≥ 3 and every length n there exists a proper colouring of the square of the path on n vertices with colours in Fin q, namely i ↦ i mod 3.
theorem exists_is_square_path_coloring {q : ℕ} (hq : 3 ≤ q) (n : ℕ) :
∃ y : Fin n → Fin q, is_square_path_coloring yexists_longest_word_runIn LeanInformation Theory & Coding
Every word y : Fin n → α with 1 ≤ n has at least one longest run [a, b).
theorem exists_longest_word_run {n : ℕ} {α : Type*} (y : Fin n → α) (hn : 1 ≤ n) :
∃ a b : ℕ, is_longest_word_run y a bfhs_middle_symbol_next_eq_endsIn LeanInformation Theory & Coding
Any symbol at distance at least (s - 1) / 2 from (s - 1) / 2 in Fin s must be 0 or s - 1 for odd s.
theorem fhs_middle_symbol_next_eq_ends (s : ℕ) (h_odd : Odd s)
(y : Fin s) (hy : ((s - 1) / 2 : ℤ) ≤ |(y : ℤ) - (((s - 1) / 2 : ℕ) : ℤ)|) :
(y : ℕ) = 0 ∨ (y : ℕ) = s - 1fhs_min_gap_leIn LeanInformation Theory & Coding
For any frequency hopping sequence X : Fin v → Fin s and any index j : Fin v, the minimum gap of X is at most the consecutive gap |X(j+1) - X(j)| - 1 at position j.
theorem fhs_min_gap_le {v s : ℕ} [NeZero v] (X : Fin v → Fin s) (j : Fin v) :
fhs_min_gap X ≤ |(X (j + 1) : ℤ) - (X j : ℤ)| - 1fhs_min_gap_le_half_sub_oneIn LeanInformation Theory & Coding
For any uniform frequency hopping sequence of odd alphabet size s, the minimum gap is at most ((s - 1) / 2) - 1.
theorem fhs_min_gap_le_half_sub_one
(k s : ℕ) [NeZero (k * s)] (hk : 1 ≤ k) (hs : 1 ≤ s) (h_odd : Odd s)
(X : Fin (k * s) → Fin s)
(h_unif : is_uniform_fhs k s X) :
fhs_min_gap X ≤ ((s - 1) / 2 : ℤ) - 1fhs_uniform_autocorr_sumIn LeanInformation Theory & Coding
The sum of periodic Hamming autocorrelations over all shifts for a uniform sequence of length k * s over alphabet size s equals k^2 * s.
theorem fhs_uniform_autocorr_sum (k s : ℕ) [NeZero (k * s)]
(X : Fin (k * s) → Fin s) (h_unif : is_uniform_fhs k s X) :
Finset.sum Finset.univ (fun τ : Fin (k * s) => fhs_hamming_autocorr X τ) = k ^ 2 * sfull_reed_solomon_large_list_of_primeIn LeanInformation Theory & Coding
For any natural number $m \ge 2$ with $m \equiv 2 \pmod 3$ and any prime $p$ satisfying $p \equiv 2 \pmod 3$, $p \equiv 1 \pmod m$, and $p \ge 3m + 2$, there exists a received word $y : \mathbb{Z}/p\mathbb{Z} \to \mathbb{Z}/p\mathbb{Z}$ and a finite set $S$ of at least $p$ codewords in the full-length Reed-Solomon code over $\mathbb{Z}/p\mathbb{Z}$ of dimension $2(p+m-1)/(3m)$ such that every codeword in $S$ is at Hamming distance exactly $p - (p-1)/m$ from $y$.
theorem full_reed_solomon_large_list_of_prime (m : ℕ) (hm : 2 ≤ m) (hm3 : m % 3 = 2)
(p : ℕ) [Fact (Nat.Prime p)] (hp3 : p % 3 = 2) (hpm : p % m = 1) (hp_ge : 3 * m + 2 ≤ p) :
∃ (y : ZMod p → ZMod p) (S : Finset (ZMod p → ZMod p)),
p ≤ S.card ∧
(∀ c ∈ S, c ∈ full_reed_solomon_code (ZMod p) (2 * (p + m - 1) / (3 * m))) ∧
∀ c ∈ S, hammingDist c y = p - (p - 1) / mfull_reed_solomon_prime_field_large_listIn LeanInformation Theory & Coding
Let $m \ge 2$ be an integer such that $m \equiv 2 \pmod 3$. Then there exist infinitely many primes $p$ such that the full-length Reed-Solomon code over $\mathbb{F}_p$ of length $n = p$ and dimension $\frac{2(p+m-1)}{3m}$ has a received word $y \in \mathbb{F}_p^n$ at Hamming distance exactly $p - \frac{p-1}{m}$ from at least $n$ distinct codewords.
theorem full_reed_solomon_prime_field_large_list (m : ℕ) (hm : 2 ≤ m) (hm3 : m % 3 = 2) :
{p : ℕ | ∃ hp : Fact (Nat.Prime p),
∃ (y : ZMod p → ZMod p) (S : Finset (ZMod p → ZMod p)),
p ≤ S.card ∧
(∀ c ∈ S, c ∈ full_reed_solomon_code (ZMod p) (2 * (p + m - 1) / (3 * m))) ∧
∀ c ∈ S, hammingDist c y = p - (p - 1) / m}.Infinitegapped_three_point_optimal_vulnerability_ge_lower_convex_envelopeIn LeanInformation Theory & Coding
For any d ≥ 3 and c ≥ 0, lower_convex_envelope (descending_band_points d) c is at most the optimal vulnerability against a uniform secret on {0, 1, d}.
theorem gapped_three_point_optimal_vulnerability_ge_lower_convex_envelope (d : ℤ) (hd : 3 ≤ d) (c : ℝ) (hc : 0 ≤ c) : lower_convex_envelope (descending_band_points d) c ≤ gapped_three_point_optimal_vulnerability d c
gapped_three_point_optimal_vulnerability_le_descending_bandIn LeanInformation Theory & Coding
For any integers d, r, L with 1 ≤ r ≤ L, the optimal vulnerability at budget descending_band_cost d r L is at most descending_band_vulnerability d r L.
theorem gapped_three_point_optimal_vulnerability_le_descending_band (d : ℤ) (r L : ℕ) (hr : 1 ≤ r) (hrL : r ≤ L) : gapped_three_point_optimal_vulnerability d (descending_band_cost d r L) ≤ descending_band_vulnerability d r L
gapped_three_point_optimal_vulnerability_le_lower_convex_envelopeIn LeanInformation Theory & Coding
For any d ≥ 3 and c ≥ 0, the optimal vulnerability against a uniform secret on {0, 1, d} is at most lower_convex_envelope (descending_band_points d) c.
theorem gapped_three_point_optimal_vulnerability_le_lower_convex_envelope (d : ℤ) (hd : 3 ≤ d) (c : ℝ) (hc : 0 ≤ c) : gapped_three_point_optimal_vulnerability d c ≤ lower_convex_envelope (descending_band_points d) c
hammingNorm_vecMul_mk_rep_eqIn LeanInformation Theory & Coding
For any nonzero vector w and matrix G over a finite field F, the Hamming weight of the codeword generated by the canonical projective representative of w equals the Hamming weight of w * G.
theorem hammingNorm_vecMul_mk_rep_eq {F : Type*} [Field F] [Fintype F] [DecidableEq F] {m n : ℕ}
(w : Fin m → F) (hw : w ≠ 0) (G : Matrix (Fin m) (Fin n) F) :
hammingNorm (Matrix.vecMul (Projectivization.mk F w hw).rep G) =
hammingNorm (Matrix.vecMul w G)hellinger_Z_eq_two_sqrt_massesIn LeanInformation Theory & Coding
For rho in (0,1) and an antipodal f on {0,1}^n, the Hellinger affinity equals (1/2^n) sum_y 2 sqrt(p_y q_y), where p_y (resp. q_y) is the total Hellinger-kernel mass K(x,y) = ((1+rho)/2)^(n - d(x,y)) ((1-rho)/2)^(d(x,y)) arriving at y from the level set f = 1 (resp. f = -1).
theorem hellinger_Z_eq_two_sqrt_masses (n : ℕ) (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(f : (Fin n → Bool) → ℝ) (hf : is_antipodal n f) :
hellinger_Z n ρ f =
(1 / 2 ^ n) * ∑ y, 2 * Real.sqrt (
(∑ x, if f x = 1 then ((1 + ρ) / 2) ^ (n - hammingDist x y) * ((1 - ρ) / 2) ^ (hammingDist x y) else 0) *
(∑ x, if f x = -1 then ((1 + ρ) / 2) ^ (n - hammingDist x y) * ((1 - ρ) / 2) ^ (hammingDist x y) else 0))hellinger_Z_ge_nuclear_affinityIn LeanInformation Theory & Coding
For every rho in (0, 1), n >= 1, and antipodal Boolean function f on {0,1}^n, the Hellinger affinity Z_rho(f) is lower bounded by (1 / (2 * 2^n)) * ‖G_h - D_f G_h D_f‖_1 where G_h(x, y) = h^(hammingDist(x, y)) and h = sqrt(1 - rho^2).
theorem hellinger_Z_ge_nuclear_affinity (n : ℕ) (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(f : (Fin n → Bool) → ℝ) (hf : is_antipodal n f) :
hellinger_Z n ρ f ≥
let G : Matrix (Fin n → Bool) (Fin n → Bool) ℝ := fun x y ↦ (Real.sqrt (1 - ρ ^ 2)) ^ (hammingDist x y)
(1 / (2 * (2 : ℝ) ^ n)) *
matrix_nuclear_norm (G - (Matrix.diagonal f) * G * (Matrix.diagonal f))hellinger_commutator_nuclear_leIn LeanInformation Theory & Coding
For rho in (0,1), the hypercube Gram matrix G(x,y) = h^(d(x,y)) with h = sqrt(1 - rho^2) and an antipodal f on {0,1}^n, the nuclear norm of the commutator G - D_f G D_f is at most 4 sum_y sqrt(p_y q_y), where p_y (resp. q_y) is the total Hellinger-kernel mass arriving at y from the level set f = 1 (resp. f = -1).
theorem hellinger_commutator_nuclear_le (n : ℕ) (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(f : (Fin n → Bool) → ℝ) (hf : is_antipodal n f) :
let G : Matrix (Fin n → Bool) (Fin n → Bool) ℝ := fun x y ↦ (Real.sqrt (1 - ρ ^ 2)) ^ (hammingDist x y)
matrix_nuclear_norm (G - (Matrix.diagonal f) * G * (Matrix.diagonal f)) ≤
4 * ∑ y, Real.sqrt (
(∑ x, if f x = 1 then ((1 + ρ) / 2) ^ (n - hammingDist x y) * ((1 - ρ) / 2) ^ (hammingDist x y) else 0) *
(∑ x, if f x = -1 then ((1 + ρ) / 2) ^ (n - hammingDist x y) * ((1 - ρ) / 2) ^ (hammingDist x y) else 0))hellinger_gram_factorizationIn LeanInformation Theory & Coding
For rho in (0,1), h = sqrt(1 - rho^2) and the tensorised Hellinger kernel K(x,z) = ((1+rho)/2)^(n - d(x,z)) * ((1-rho)/2)^(d(x,z)), the hypercube Gram matrix with entries h^(d(x,y)) is the Gram matrix of the square-root densities: h^(d(x,y)) = sum over z of sqrt(K(x,z)) * sqrt(K(y,z)).
theorem hellinger_gram_factorization (n : ℕ) (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(x y : Fin n → Bool) :
(Real.sqrt (1 - ρ ^ 2)) ^ (hammingDist x y) =
∑ z, Real.sqrt (((1 + ρ) / 2) ^ (n - hammingDist x z) * ((1 - ρ) / 2) ^ (hammingDist x z)) *
Real.sqrt (((1 + ρ) / 2) ^ (n - hammingDist y z) * ((1 - ρ) / 2) ^ (hammingDist y z))hellinger_observation_factor_admissibleNeeds helpInformation Theory & Coding
For any natural number m >= 2, the candidate multiplicative constant C_m = ⨆ (k : ℕ) (_ : 2 ≤ k ∧ k ≤ m), hellinger_rare_source_sup k satisfies the m-observation multiplicative subadditivity inequality for Hellinger mutual information.
theorem hellinger_observation_factor_admissible (m : ℕ) (hm : 2 ≤ m) :
hellinger_observation_factor m (⨆ (k : ℕ) (_ : 2 ≤ k ∧ k ≤ m), hellinger_rare_source_sup k)hellinger_observation_factor_ge_rare_source_supIn LeanInformation Theory & Coding
Any k-observation multiplicative factor C for Hellinger mutual information with 2 <= k is lower bounded by hellinger_rare_source_sup k, the supremum of the rare-source ratio over u in Set.Ico 0 1.
theorem hellinger_observation_factor_ge_rare_source_sup (k : ℕ) (hk : 2 ≤ k) {C : ℝ}
(hC : hellinger_observation_factor k C) :
hellinger_rare_source_sup k ≤ Chellinger_observation_factor_monoIn LeanInformation Theory & Coding
An m-observation multiplicative subadditivity factor C for Hellinger mutual information is also a valid k-observation factor for any k <= m, obtained by padding with m - k independent uninformative singleton observations.
theorem hellinger_observation_factor_mono {m k : ℕ} (hmk : k ≤ m) {C : ℝ}
(hC : hellinger_observation_factor m C) :
hellinger_observation_factor k Chellinger_observation_factor_sharpIn LeanInformation Theory & Coding
For any natural number m >= 2 and any real factor C satisfying hellinger_observation_factor m C, C is lower bounded by the supremum over 2 <= k <= m of hellinger_rare_source_sup k.
theorem hellinger_observation_factor_sharp (m : ℕ) (hm : 2 ≤ m) (C : ℝ)
(hC : hellinger_observation_factor m C) :
(⨆ (k : ℕ) (_ : 2 ≤ k ∧ k ≤ m), hellinger_rare_source_sup k) ≤ Chellinger_observation_factor_sharp_of_pointwiseIn LeanInformation Theory & Coding
For any natural number m >= 2 and real C, if hellinger_rare_source_sup k <= C for all k with 2 <= k <= m, then the supremum of hellinger_rare_source_sup k over all 2 <= k <= m is at most C.
theorem hellinger_observation_factor_sharp_of_pointwise (m : ℕ) (hm : 2 ≤ m) (C : ℝ)
(h_pointwise : ∀ k : ℕ, 2 ≤ k ∧ k ≤ m → hellinger_rare_source_sup k ≤ C) :
(⨆ (k : ℕ) (_ : 2 ≤ k ∧ k ≤ m), hellinger_rare_source_sup k) ≤ Chellinger_rare_source_ratio_two_zeroIn LeanInformation Theory & Coding
The rare-source Hellinger ratio function hellinger_rare_source_ratio 2 0 evaluates to 3/4.
theorem hellinger_rare_source_ratio_two_zero : hellinger_rare_source_ratio 2 0 = 3 / 4
hellinger_rare_source_sup_two_posIn LeanInformation Theory & Coding
The rare-source Hellinger ratio supremum for k = 2 is non-negative: 0 <= hellinger_rare_source_sup 2.
theorem hellinger_rare_source_sup_two_pos : 0 ≤ hellinger_rare_source_sup 2
is_square_path_coloring_compIn LeanInformation Theory & Coding
An injective relabelling of the alphabet preserves and reflects the property of being a proper colouring of the square of the path.
theorem is_square_path_coloring_comp {n q : ℕ} (σ : Fin q → Fin q) (hσ : Function.Injective σ)
(y : Fin n → Fin q) :
is_square_path_coloring (fun i => σ (y i)) ↔ is_square_path_coloring yis_square_path_coloring_embedding_fiber_card_eqIn LeanInformation Theory & Coding
For q ≥ 3, n ≥ 2, any two proper colorings y₁ and y₂ of the square of P_n have identical embedding fiber sizes for every k: the number of transmitted words x with exactly k embeddings of y₁ equals the number of transmitted words x with exactly k embeddings of y₂.
theorem is_square_path_coloring_embedding_fiber_card_eq (q : ℕ) (hq : 3 ≤ q) (n : ℕ) (hn : 2 ≤ n)
(y₁ y₂ : Fin n → Fin q) (hy₁ : is_square_path_coloring y₁) (hy₂ : is_square_path_coloring y₂) (k : ℕ) :
(Finset.univ.filter (fun x : Fin (n + 2) → Fin q =>
q_ary_subsequence_num_embeddings q n (n + 2) y₁ x = k)).card =
(Finset.univ.filter (fun x : Fin (n + 2) → Fin q =>
q_ary_subsequence_num_embeddings q n (n + 2) y₂ x = k)).cardis_square_path_coloring_embeddings_le_fourIn LeanInformation Theory & Coding
For q ≥ 3, n ≥ 2, if y is a proper coloring of the square of P_n, then for any word x of length n + 2, the number of subsequence embeddings of y in x is at most 4.
theorem is_square_path_coloring_embeddings_le_four (q : ℕ) (hq : 3 ≤ q) (n : ℕ) (hn : 2 ≤ n)
(y : Fin n → Fin q) (hy : is_square_path_coloring y) (x : Fin (n + 2) → Fin q) :
q_ary_subsequence_num_embeddings q n (n + 2) y x ≤ 4is_t_spaced_word_const_not_spacedIn LeanInformation Theory & Coding
For any t ≥ 1, n ≥ 2, and q ≥ 1, the constant zero word of length n is not t-spaced.
theorem is_t_spaced_word_const_not_spaced (t q n : ℕ) (ht : 1 ≤ t) (hn : 2 ≤ n) (hq : 1 ≤ q) :
¬ is_t_spaced_word t (fun (_ : Fin n) => (⟨0, hq⟩ : Fin q))is_uniform_fhs_symbol_existsIn LeanInformation Theory & Coding
Every symbol in Fin s occurs at least once in a uniform frequency hopping sequence with frequency k ≥ 1.
theorem is_uniform_fhs_symbol_exists (k s : ℕ) (hk : 1 ≤ k) (X : Fin (k * s) → Fin s)
(h_unif : is_uniform_fhs k s X) (f : Fin s) : ∃ j, X j = fis_word_run_nonconstant_ne_wholeIn LeanInformation Theory & Coding
If y is a nonconstant word on Fin n and [a, b) is a run of y, then it is impossible that a = 0 and b = n.
theorem is_word_run_nonconstant_ne_whole {n : ℕ} {α : Type*} (y : Fin n → α)
(hy : ¬ is_constant_word y) (a b : ℕ) (hr : is_word_run y a b) :
¬ (a = 0 ∧ b = n)jensen_shannon_half_generator_convex_smoothIn LeanInformation Theory & Coding
The generator f_{1/2} is convex on (0, ∞), four times continuously differentiable there, and satisfies f_{1/2}(1) = 0.
theorem jensen_shannon_half_generator_convex_smooth :
ConvexOn ℝ (Set.Ioi 0) (jensen_shannon_regularized_generator (1 / 2)) ∧
ContDiffOn ℝ 4 (jensen_shannon_regularized_generator (1 / 2)) (Set.Ioi 0) ∧
jensen_shannon_regularized_generator (1 / 2) 1 = 0jensen_shannon_half_weight_closed_formIn LeanInformation Theory & Coding
For f_{1/2}(x) = f_JS(x) + (1/2) x log x and x > 0, the weight is g(x) = x² f_{1/2}''(x) = x − x²/(2(x+1)) and g'(x) = 1 − (x²+2x)/(2(x+1)²).
theorem jensen_shannon_half_weight_closed_form {x : ℝ} (hx : 0 < x) :
subadditive_f_weight (jensen_shannon_regularized_generator (1 / 2)) x
= x - x ^ 2 / (2 * (x + 1)) ∧
deriv (subadditive_f_weight (jensen_shannon_regularized_generator (1 / 2))) x
= 1 - (x ^ 2 + 2 * x) / (2 * (x + 1) ^ 2)jensen_shannon_half_weight_deriv2_lt_zeroIn LeanInformation Theory & Coding
For all x > 0, the second derivative of the weight function g(x) = x² f_{1/2}''(x) is strictly negative.
theorem jensen_shannon_half_weight_deriv2_lt_zero {x : ℝ} (hx : 0 < x) :
deriv (deriv (subadditive_f_weight (jensen_shannon_regularized_generator (1 / 2)))) x < 0jensen_shannon_half_weight_deriv2_negIn LeanInformation Theory & Coding
For x > 0 the weight g(x) = x² f_{1/2}''(x) has g''(x) = −1/(x+1)³ < 0.
theorem jensen_shannon_half_weight_deriv2_neg {x : ℝ} (hx : 0 < x) :
deriv (deriv (subadditive_f_weight (jensen_shannon_regularized_generator (1 / 2)))) x
= -(1 / (x + 1) ^ 3)jensen_shannon_half_weight_theorem_one_boundIn LeanInformation Theory & Coding
The weight g(x) = x² f_{1/2}''(x) satisfies the Theorem 1 inequality with η = 1/2, ℓ = 1/2: g(x) + 2(g'(x) − 1/2)²/(−g''(x)) ≤ 1 + (x−1)/2 for all x > 0.
theorem jensen_shannon_half_weight_theorem_one_bound {x : ℝ} (hx : 0 < x) :
subadditive_f_weight (jensen_shannon_regularized_generator (1 / 2)) x +
2 * (deriv (subadditive_f_weight (jensen_shannon_regularized_generator (1 / 2))) x - 1 / 2) ^ 2 /
(-deriv (deriv (subadditive_f_weight (jensen_shannon_regularized_generator (1 / 2)))) x)
≤ 2 * (1 / 2) + (x - 1) * (1 / 2)jensen_shannon_regularized_mfi_affineIn LeanInformation Theory & Coding
For every c and every joint law p, Ĩ_{f_c}(p) = Ĩ_{f_JS}(p) + c·Ĩ_g(p) where g(x) = x log x; in particular the subadditivity defect of f_c equals D_0 + c·D_g instancewise.
theorem jensen_shannon_regularized_mfi_affine {X Y : Type*} [Fintype X] [Fintype Y]
(c : ℝ) (p : X → Y → ℝ) :
mutual_f_information (jensen_shannon_regularized_generator c) p =
mutual_f_information jensen_shannon_generator p +
c * mutual_f_information (fun x => x * Real.log x) pjensen_shannon_regularized_subadditive_halfIn LeanInformation Theory & Coding
At regularization parameter c = 1/2 the regularized Jensen-Shannon mutual f-information is subadditive under all finite Markov forks Y ← X → Z.
theorem jensen_shannon_regularized_subadditive_half :
mutual_f_information_subadditive (jensen_shannon_regularized_generator (1 / 2))jensen_shannon_regularized_subadditive_monoIn LeanInformation Theory & Coding
If the regularized Jensen-Shannon information is subadditive at parameter c, it is subadditive at every c' ≥ c (with c' assumed ≥ 0 so the KL defect is only improved).
theorem jensen_shannon_regularized_subadditive_mono (c c' : ℝ) (hcc' : c ≤ c')
(h : mutual_f_information_subadditive (jensen_shannon_regularized_generator c)) :
mutual_f_information_subadditive (jensen_shannon_regularized_generator c')jensen_shannon_regularized_zero_not_subadditiveIn LeanInformation Theory & Coding
The unregularized Jensen-Shannon mutual f-information is not subadditive, so 0 is not in the subadditivity set S.
theorem jensen_shannon_regularized_zero_not_subadditive :
¬ mutual_f_information_subadditive (jensen_shannon_regularized_generator 0)kl_divergence_finset_nonnegIn LeanInformation Theory & Coding
Gibbs' inequality on a finite set: for probability masses p, q on ι with p absolutely continuous w.r.t. q, Σ_i p(i) log(p(i)/q(i)) ≥ 0.
theorem kl_divergence_finset_nonneg {ι : Type*} [Fintype ι] (p q : ι → ℝ)
(hp : ∀ i, 0 ≤ p i) (hq : ∀ i, 0 ≤ q i) (hac : ∀ i, q i = 0 → p i = 0)
(hp1 : ∑ i, p i = 1) (hq1 : ∑ i, q i = 1) :
0 ≤ ∑ i, p i * Real.log (p i / q i)kl_markov_fork_defect_eq_mutual_informationIn LeanInformation Theory & Coding
For g(x) = x log x and any p_X, P_{Y|X}, P_{Z|X} (no positivity needed), the subadditivity defect of the g-information satisfies Ĩ_g(X;YZ) − Ĩ_g(X;Y) − Ĩ_g(X;Z) = − Σ_{y,z} q(y,z) log(q(y,z)/(q_Y(y) q_Z(z))) where q(y,z) = Σ_x p_X(x) P_{Y|X}(y|x) P_{Z|X}(z|x), i.e. minus the g-mutual information of the jointly induced (Y,Z) with Z = z, i.e. = −Ĩ_g(Y;Z) evaluated on the joint law q.
theorem kl_markov_fork_defect_eq_mutual_information {X Y Z : Type*} [Fintype X] [Fintype Y]
[Fintype Z] (pX : X → ℝ) (PY : X → Y → ℝ) (PZ : X → Z → ℝ) :
mutual_f_information (fun x => x * Real.log x)
(fun x (yz : Y × Z) => pX x * PY x yz.1 * PZ x yz.2) -
mutual_f_information (fun x => x * Real.log x) (fun x y => pX x * PY x y) -
mutual_f_information (fun x => x * Real.log x) (fun x z => pX x * PZ x z) =
- mutual_f_information (fun x => x * Real.log x)
(fun y (z : Z) => ∑ x, pX x * PY x y * PZ x z)majority_three_is_antipodalIn LeanInformation Theory & Coding
majority_three takes values in {-1, 1} and satisfies majority_three (not x) = - majority_three x.
theorem majority_three_is_antipodal : is_antipodal 3 majority_three
matrix_eigenvalues0_eq_of_charpoly_eqIn LeanInformation Theory & Coding
Two real symmetric matrices with the same characteristic polynomial have the same ordered eigenvalue sequence eigenvalues₀.
theorem matrix_eigenvalues0_eq_of_charpoly_eq {V : Type*} [Fintype V] [DecidableEq V]
{A B : Matrix V V ℝ} (hA : A.IsHermitian) (hB : B.IsHermitian)
(hc : A.charpoly = B.charpoly) : hA.eigenvalues₀ = hB.eigenvalues₀matrix_eigenvalues0_le_of_smul_one_sub_posSemidefIn LeanInformation Theory & Coding
If A is a real symmetric matrix and c·I - A is positive semidefinite, then every ordered eigenvalue of A is at most c.
theorem matrix_eigenvalues0_le_of_smul_one_sub_posSemidef {V : Type*} [Fintype V] [DecidableEq V]
(A : Matrix V V ℝ) (hA : A.IsHermitian) (c : ℝ)
(h : ((c • (1 : Matrix V V ℝ)) - A).PosSemidef) (j : Fin (Fintype.card V)) :
hA.eigenvalues₀ j ≤ cmatrix_nuclear_norm_add_leIn LeanInformation Theory & Coding
The nuclear norm is subadditive: ||A + B||_1 <= ||A||_1 + ||B||_1 for square real matrices of the same size.
theorem matrix_nuclear_norm_add_le {ι : Type*} [Fintype ι] [DecidableEq ι] (A B : Matrix ι ι ℝ) :
matrix_nuclear_norm (A + B) ≤ matrix_nuclear_norm A + matrix_nuclear_norm Bmatrix_nuclear_norm_outerIn LeanInformation Theory & Coding
The nuclear norm of the rank-one matrix a b^T is the product of the Euclidean norms of a and b: ||a b^T||_1 = ||a||_2 ||b||_2, i.e. sqrt(sum a_i^2) * sqrt(sum b_j^2).
theorem matrix_nuclear_norm_outer {ι : Type*} [Fintype ι] [DecidableEq ι] (a b : ι → ℝ) :
matrix_nuclear_norm (Matrix.of fun i j => a i * b j) =
Real.sqrt (∑ i, a i ^ 2) * Real.sqrt (∑ i, b i ^ 2)min_binary_deletion_collision_two_eq_min_two_insertion_collisionIn LeanInformation Theory & Coding
For any natural number n with 2 ≤ n, min_binary_deletion_collision 2 n = min_two_insertion_collision n.
theorem min_binary_deletion_collision_two_eq_min_two_insertion_collision (n : ℕ) (hn : 2 ≤ n) :
min_binary_deletion_collision 2 n = min_two_insertion_collision nmin_two_insertion_collision_ge_defect_envelopeIn LeanInformation Theory & Coding
For every n ≥ 5 and every binary word w of length n (given as a function on Fin (n-2+2), which is the length two_insertion_collision expects), two_insertion_collision (n-2) w ≥ two_insertion_collision_defect_envelope n. Equivalently min_two_insertion_collision n ≥ two_insertion_collision_defect_envelope n. This is the universal lower bound on the excess over n.choose 2 that any proof of the target limit needs.
theorem min_two_insertion_collision_ge_defect_envelope (n : ℕ) (hn : 5 ≤ n)
(w : Fin (n - 2 + 2) → Bool) :
two_insertion_collision_defect_envelope n ≤ two_insertion_collision (n - 2) wmin_two_insertion_collision_ge_of_forallIn LeanInformation Theory & Coding
For n ≥ 2, if every binary word w of length n has two_insertion_collision (n - 2) w ≥ two_insertion_collision_defect_envelope n, then min_two_insertion_collision n ≥ two_insertion_collision_defect_envelope n.
theorem min_two_insertion_collision_ge_of_forall (n : ℕ) (hn : 2 ≤ n) (h : ∀ w : Fin (n - 2 + 2) → Bool, two_insertion_collision_defect_envelope n ≤ two_insertion_collision (n - 2) w) : two_insertion_collision_defect_envelope n ≤ min_two_insertion_collision n
min_two_insertion_collision_le_defect_envelopeIn LeanInformation Theory & Coding
For every n ≥ 5 the minimum two-insertion collision sum is at most the defect envelope: min_two_insertion_collision n ≤ two_insertion_collision_defect_envelope n. This is the constructive (upper bound) half of the exact formula op_1003: the balanced block word with block length k ≤ (n-2)/3 - 1 witnesses the cost term.
theorem min_two_insertion_collision_le_defect_envelope (n : ℕ) (hn : 5 ≤ n) :
min_two_insertion_collision n ≤ two_insertion_collision_defect_envelope nmin_two_insertion_collision_le_of_wordIn LeanInformation Theory & Coding
For any natural number n ≥ 2 and any binary word w of length n, min_two_insertion_collision n is at most two_insertion_collision (n - 2) w.
theorem min_two_insertion_collision_le_of_word (n : ℕ) (hn : 2 ≤ n) (w : Fin (n - 2 + 2) → Bool) : min_two_insertion_collision n ≤ two_insertion_collision (n - 2) w
minpoly_natDegree_ge_of_finrank_adjoin_geIn LeanInformation Theory & Coding
If k ≤ [B(x):B] then k is at most the degree of the minimal polynomial of x over B.
theorem minpoly_natDegree_ge_of_finrank_adjoin_ge
{B M : Type*} [Field B] [Field M] [Algebra B M] {x : M} {k : ℕ}
(h : k ≤ Module.finrank B ↥(IntermediateField.adjoin B {x})) :
k ≤ (minpoly B x).natDegreemutual_f_information_generator_positive_linearIn LeanInformation Theory & Coding
The mutual f-information is linear in the generator: for constants a, b and generators f, g, Ĩ_{a f + b g}(p) = a Ĩ_f(p) + b Ĩ_g(p) for every joint law p.
theorem mutual_f_information_generator_positive_linear {X Y : Type*} [Fintype X] [Fintype Y]
(a b : ℝ) (f g : ℝ → ℝ) (p : X → Y → ℝ) :
mutual_f_information (fun x => a * f x + b * g x) p =
a * mutual_f_information f p + b * mutual_f_information g pmutual_f_information_mul_log_eq_klIn LeanInformation Theory & Coding
For any joint law p, Ĩ_g(X;Y) with g(x) = x log x equals the sum Σ_{x,y} p(x,y) log(p(x,y)/(p_X(x) p_Y(y))), i.e. the KL divergence of p from the product of its marginals (with the Lean 0/0 := 0 convention).
theorem mutual_f_information_mul_log_eq_kl {X Y : Type*} [Fintype X] [Fintype Y]
(p : X → Y → ℝ) :
mutual_f_information (fun x => x * Real.log x) p =
∑ x, ∑ y, p x y * Real.log (p x y / ((∑ y', p x y') * ∑ x', p x' y))mutual_f_information_mul_log_nonnegIn LeanInformation Theory & Coding
For g(x) = x log x and any nonnegative joint law p summing to 1, Ĩ_g(X;Y) ≥ 0.
theorem mutual_f_information_mul_log_nonneg {X Y : Type*} [Fintype X] [Fintype Y]
(p : X → Y → ℝ) (hp : ∀ x y, 0 ≤ p x y) (hp1 : ∑ x, ∑ y, p x y = 1) :
0 ≤ mutual_f_information (fun x => x * Real.log x) pmutual_f_information_subadditive_full_support_of_theta_concaveIn LeanInformation Theory & Coding
For any generator f with f(1) = 0, if the conditional information functional r ↦ Θ_{p_X, P_{Y|X}}(r) is concave on the open probability simplex for all full-support priors p_X and channels P_Y, then f generates a subadditive mutual f-information on all finite full-support Markov chains Y ← X → Z.
theorem mutual_f_information_subadditive_full_support_of_theta_concave
(f : ℝ → ℝ) (hf1 : f 1 = 0)
(hcc : ∀ (X Y : Type) [Fintype X] [Fintype Y]
(pX : X → ℝ) (PY : X → Y → ℝ),
(∀ x, 0 < pX x) → (∑ x, pX x = 1) →
(∀ x y, 0 < PY x y) → (∀ x, ∑ y, PY x y = 1) →
ConcaveOn ℝ {r : X → ℝ | (∀ x, 0 < r x) ∧ ∑ x, r x = 1} (mutual_f_theta f pX PY)) :
mutual_f_information_subadditive_full_support fmutual_f_information_subadditive_mul_logIn LeanInformation Theory & Coding
The generator g(x) = x log x is subadditive: for every finite Markov fork Y ← X → Z, Ĩ_g(X;YZ) ≤ Ĩ_g(X;Y) + Ĩ_g(X;Z).
theorem mutual_f_information_subadditive_mul_log :
mutual_f_information_subadditive (fun x => x * Real.log x)mutual_f_information_subadditive_of_full_supportIn LeanInformation Theory & Coding
For any continuous generator f, subadditivity on all full-support finite Markov forks implies subadditivity on all finite Markov forks.
theorem mutual_f_information_subadditive_of_full_support (f : ℝ → ℝ)
(hf : ContinuousOn f (Set.Ici 0))
(hfs : mutual_f_information_subadditive_full_support f) :
mutual_f_information_subadditive fmutual_f_information_subadditive_threshold_of_closed_upsetIn LeanInformation Theory & Coding
Let S = {c ≥ 0 : Ĩ_{f_c} subadditive}. Suppose 0 ∉ S, 1/2 ∈ S, S is upward closed in c, and each per-instance defect D_c is affine in c. Then S = [c*, ∞) ∩ [0, ∞) with c* = min S ∈ (0, 1/2]: for every c ≥ 0, subadditivity at c is equivalent to c* ≤ c.
theorem mutual_f_information_subadditive_threshold_of_closed_upset
(hzero : ¬ mutual_f_information_subadditive (jensen_shannon_regularized_generator 0))
(hhalf : mutual_f_information_subadditive (jensen_shannon_regularized_generator (1 / 2)))
(hup : ∀ c c' : ℝ, c ≤ c' →
mutual_f_information_subadditive (jensen_shannon_regularized_generator c) →
mutual_f_information_subadditive (jensen_shannon_regularized_generator c'))
(haff : ∀ (c : ℝ) {X Y : Type} [Fintype X] [Fintype Y] (p : X → Y → ℝ),
mutual_f_information (jensen_shannon_regularized_generator c) p =
mutual_f_information jensen_shannon_generator p +
c * mutual_f_information (fun x => x * Real.log x) p) :
∃ c_star : ℝ, 0 < c_star ∧ c_star ≤ 1 / 2 ∧
∀ c : ℝ, 0 ≤ c →
(mutual_f_information_subadditive (jensen_shannon_regularized_generator c) ↔ c_star ≤ c)mutual_f_theta_power_divergence_eq_sum_rpowIn LeanInformation Theory & Coding
For β ∈ (0,1), a full-support prior p_X with Σ p_X = 1, a full-support channel P(x,y) with unit row sums and r on the simplex, the conditional information functional Θ_{p_X,P_{Y|X}}(r) of arXiv:2610.21231 for the power-divergence generator f_β equals (Σ_y (Σ_x r_x P(x,y))^{1−β} · Σ_x p_X(x)^{1−β} P(x,y)^β r_x^β − Σ_x p_X(x)^{1−β} r_x^β) / (β(β−1)): all nested divisions by r, p_X and the conditional marginals collapse into one expression in real powers of linear forms.
theorem mutual_f_theta_power_divergence_eq_sum_rpow {X Y : Type*} [Fintype X] [Fintype Y]
(β : ℝ) (hβ0 : 0 < β) (hβ1 : β < 1) (pX : X → ℝ) (PY : X → Y → ℝ) (r : X → ℝ)
(hpX : ∀ x, 0 < pX x) (hpX1 : ∑ x, pX x = 1) (hPY : ∀ x y, 0 < PY x y)
(hsY : ∀ x, ∑ y, PY x y = 1) (hr : ∀ x, 0 < r x) (hr1 : ∑ x, r x = 1) :
mutual_f_theta (power_divergence_generator β) pX PY r =
((∑ y, (∑ x, r x * PY x y) ^ (1 - β) *
(∑ x, pX x ^ (1 - β) * PY x y ^ β * r x ^ β)) -
∑ x, pX x ^ (1 - β) * r x ^ β) / (β * (β - 1))mutual_power_divergence_information_eq_add_of_independent_pairIn LeanInformation Theory & Coding
For β ∈ (0,1) and full-support p_X, P(x,y), q(z), if the Markov chain Y ← X → Z has Z independent of X, i.e. the joint law is p(x,y,z) = p_X(x) P(y|x) q(z), then Ĩ_{f_β}(X;YZ) = Ĩ_{f_β}(X;Y) + Ĩ_{f_β}(X;Z), for every β ∈ (0,1). So the subadditivity inequality of the target holds with equality on every channel that does not depend on x.
theorem mutual_power_divergence_information_eq_add_of_independent_pair
{X Y Z : Type*} [Fintype X] [Fintype Y] [Fintype Z]
(β : ℝ) (hβ0 : 0 < β) (hβ1 : β < 1) (pX : X → ℝ) (PY : X → Y → ℝ) (q : Z → ℝ)
(hpX : ∀ x, 0 < pX x) (hpX1 : ∑ x, pX x = 1)
(hPY : ∀ x y, 0 < PY x y) (hsY : ∀ x, ∑ y, PY x y = 1)
(hq : ∀ z, 0 < q z) (hq1 : ∑ z, q z = 1) :
mutual_f_information (power_divergence_generator β)
(fun x (yz : Y × Z) => pX x * PY x yz.1 * q yz.2) =
mutual_f_information (power_divergence_generator β) (fun x y => pX x * PY x y) +
mutual_f_information (power_divergence_generator β) (fun x z => pX x * q z)nat_cast_mul_log_eq_telescopeIn LeanInformation Theory & Coding
For every natural number e, e log e is the telescoping sum over c = 2, …, e of (c log c - (c-1) log(c-1)); in particular it is a positive combination of the indicators of the events e ≥ c.
theorem nat_cast_mul_log_eq_telescope (e : ℕ) :
(e : ℝ) * Real.log (e : ℝ) =
∑ c ∈ Finset.Icc 2 e,
((c : ℝ) * Real.log (c : ℝ) - ((c - 1 : ℕ) : ℝ) * Real.log ((c - 1 : ℕ) : ℝ))noise_operator_coordinate_indicatorIn LeanInformation Theory & Coding
The noise operator applied to the 0/1 coordinate indicator x ↦ [x i = b] is the constant (1+ρ)/2 on the class y i = b and (1-ρ)/2 on the complementary class.
open scoped BigOperators in
theorem noise_operator_coordinate_indicator (n : ℕ) (ρ : ℝ) (i : Fin n) (b : Bool) (y : Fin n → Bool) :
noise_operator n ρ (fun x => if x i = b then (1 : ℝ) else 0) y
= if y i = b then (1 + ρ) / 2 else (1 - ρ) / 2noise_operator_image_unit_intervalIn LeanInformation Theory & Coding
If f is {0,1}-valued and 0 < ρ < 1, then T_ρ f takes values in [0,1] pointwise: it is a convex combination of the values f x with the probability weights of the noisy channel.
open scoped BigOperators in
theorem noise_operator_image_unit_interval (n : ℕ) (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(f : (Fin n → Bool) → ℝ) (hf : ∀ x, f x = 0 ∨ f x = 1) (y : Fin n → Bool) :
0 ≤ noise_operator n ρ f y ∧ noise_operator n ρ f y ≤ 1noise_operator_mean_preservedIn LeanInformation Theory & Coding
For every n, ρ and every f : {0,1}^n → ℝ, the noise operator preserves the mean over the uniform distribution: the average of T_ρ f equals the average of f. Equivalently the rows of the noisy channel form probability distributions.
open scoped BigOperators in
theorem noise_operator_mean_preserved (n : ℕ) (ρ : ℝ) (f : (Fin n → Bool) → ℝ) :
(1 / (2 : ℝ) ^ n) * ∑ y : Fin n → Bool, noise_operator n ρ f y
= (1 / (2 : ℝ) ^ n) * ∑ x : Fin n → Bool, f xnoise_operator_weight_factorIn LeanInformation Theory & Coding
For n, ρ and x, y : {0,1}^n, the noisy-channel weight ((1+ρ)/2)^(n - d) * ((1-ρ)/2)^d, where d = hammingDist x y, equals the product over coordinates k of (1+ρ)/2 where x k = y k and (1-ρ)/2 where x k ≠ y k.
open scoped BigOperators in
theorem noise_operator_weight_factor (n : ℕ) (ρ : ℝ) (x y : Fin n → Bool) :
((1 + ρ) / 2) ^ (n - hammingDist x y) * ((1 - ρ) / 2) ^ hammingDist x y
= ∏ k : Fin n, (if x k = y k then (1 + ρ) / 2 else (1 - ρ) / 2)noise_operator_weight_sumIn LeanInformation Theory & Coding
For n, ρ and any y : {0,1}^n, the noisy-channel transition weights sum to one over all x : {0,1}^n.
open scoped BigOperators in
theorem noise_operator_weight_sum (n : ℕ) (ρ : ℝ) (y : Fin n → Bool) :
(∑ x : Fin n → Bool,
((1 + ρ) / 2) ^ (n - hammingDist x y) * ((1 - ρ) / 2) ^ hammingDist x y) = 1nonconstant_word_exists_longest_run_and_adjacentIn LeanInformation Theory & Coding
For any nonconstant word y : Fin n → α with 2 ≤ n, there exists a longest run [a, b) of y and an adjacent run [a', b') of y (b' = a or b = a') with a < n.
theorem nonconstant_word_exists_longest_run_and_adjacent {n : ℕ} {α : Type*} (y : Fin n → α)
(hn : 2 ≤ n) (hy : ¬ is_constant_word y) :
∃ (a b : ℕ) (hR : is_longest_word_run y a b) (a' b' : ℕ) (hR' : is_word_run y a' b')
(hadj : b' = a ∨ b = a'), a < nnonconstant_word_run_exists_adjacentIn LeanInformation Theory & Coding
For a nonconstant word y : Fin n → α, any run [a, b) of y has an immediately adjacent run [a', b') with b' = a or b = a'.
theorem nonconstant_word_run_exists_adjacent {n : ℕ} {α : Type*} (y : Fin n → α)
(hy : ¬ is_constant_word y) (a b : ℕ) (hr : is_word_run y a b) :
∃ a' b' : ℕ, is_word_run y a' b' ∧ (b' = a ∨ b = a')odd_majority_sign_is_antipodalIn LeanInformation Theory & Coding
For every odd n, the n-bit majority sign is antipodal: it takes values in {-1, 1} and flipping all input bits negates it.
theorem odd_majority_sign_is_antipodal (n : ℕ) (hn : Odd n) :
is_antipodal n (odd_majority_sign n)odd_majority_sign_threeIn LeanInformation Theory & Coding
At n = 3, odd_majority_sign agrees with the already-defined majority_three: both are -1 exactly when at least two of the three bits are true.
theorem odd_majority_sign_three : odd_majority_sign 3 = majority_three
op_1359_lower_bound_ratio_tendstoIn LeanInformation Theory & Coding
For any real constant C, (2√2·n^(3/2) - C·n) / n^(3/2) tends to 2√2 as n tends to infinity.
theorem op_1359_lower_bound_ratio_tendsto (C : ℝ) :
Filter.Tendsto
(fun n : ℕ =>
(2 * Real.sqrt 2 * (n : ℝ) ^ ((3 : ℝ) / 2) - C * (n : ℝ)) /
((n : ℝ) ^ ((3 : ℝ) / 2)))
Filter.atTop
(nhds (2 * Real.sqrt 2))op_1359_min_excess_lower_boundIn LeanInformation Theory & Coding
For any alphabet size q ≥ 2, there is a constant C such that for all large n, the minimum q-ary q-deletion excess is at least 2√2·n^(3/2) - C·n.
theorem op_1359_min_excess_lower_bound (q : ℕ) (hq : 2 ≤ q) :
∃ C : ℝ, ∀ᶠ (n : ℕ) in Filter.atTop,
2 * Real.sqrt 2 * (n : ℝ) ^ ((3 : ℝ) / 2) - C * (n : ℝ) ≤
((min_q_ary_deletion_collision q q n : ℝ) - (Nat.choose n q : ℝ))op_1359_min_le_defect_wordIn LeanInformation Theory & Coding
For all q ≥ 2 and n, the minimum q-ary q-deletion collision sum on length n is bounded above by the deletion collision sum of the explicit defect word.
theorem op_1359_min_le_defect_word (q : ℕ) (hq : 2 ≤ q) (n : ℕ) :
min_q_ary_deletion_collision q q n ≤
qary_deletion_collision q q n (qary_defect_word q (qary_defect_block_size 0 n) n hq)op_1534_hinge_equality_iff_constant_wordIn LeanInformation Theory & Coding
For t ≥ 1, q ≥ 2, n ≥ 1, the t-deletion hinge of y equals that of the all-zero word at every threshold r ≥ 1 if and only if y is constant.
theorem op_1534_hinge_equality_iff_constant_word (t : ℕ) (ht : 1 ≤ t) (q : ℕ) (hq : 2 ≤ q) (n : ℕ) (hn : 1 ≤ n) (y : Fin n → Fin q) : ((∀ r : ℕ, 1 ≤ r → qary_multiple_deletion_hinge t q n r y = qary_multiple_deletion_hinge t q n r (qary_all_zero_word q n (by omega))) ↔ is_constant_word y)
op_1534_hinge_le_zero_wordIn LeanInformation Theory & Coding
For t ≥ 1, q ≥ 2, n ≥ 1 and any q-ary word y of length n, at every threshold r ≥ 1 the t-deletion hinge of y is at most that of the all-zero word. This is open; the t = 1 instance is qary_multiple_deletion_hinge_one_le.
theorem op_1534_hinge_le_zero_word (t : ℕ) (ht : 1 ≤ t) (q : ℕ) (hq : 2 ≤ q) (n : ℕ) (hn : 1 ≤ n) (y : Fin n → Fin q) : ∀ r : ℕ, 1 ≤ r → qary_multiple_deletion_hinge t q n r y ≤ qary_multiple_deletion_hinge t q n r (qary_all_zero_word q n (by omega))
op_1537_one_deletion_run_absorptionIn LeanInformation Theory & Coding
For any q ≥ 2, n ≥ 2, and nonconstant word y : Fin n → Fin q, absorbing an adjacent run into a longest run yields a word y' weakly dominating y in one-deletion hinge sum for all r ≥ 1, with strict inequality for some r ≥ 1.
theorem op_1537_one_deletion_run_absorption (q : ℕ) (hq : 2 ≤ q) (n : ℕ) (hn : 2 ≤ n) (y : Fin n → Fin q) (hy : ¬ is_constant_word y) :
∃ (a b : ℕ) (hR : is_longest_word_run y a b) (a' b' : ℕ) (hR' : is_word_run y a' b')
(hadj : b' = a ∨ b = a') (ha : a < n),
let y' := word_absorb_run y a' b' (y ⟨a, ha⟩);
(∀ r : ℕ, 1 ≤ r → qary_multiple_deletion_hinge 1 q n r y ≤ qary_multiple_deletion_hinge 1 q n r y') ∧
(∃ r : ℕ, 1 ≤ r ∧ qary_multiple_deletion_hinge 1 q n r y < qary_multiple_deletion_hinge 1 q n r y')op_1537_run_absorption_length_twoIn LeanInformation Theory & Coding
For q ≥ 2, t ≥ 1, and any nonconstant word y : Fin 2 → Fin q, absorbing one run into its adjacent longest run produces a constant word y' that satisfies the OP-1537 hinge inequalities.
theorem op_1537_run_absorption_length_two (q : ℕ) (hq : 2 ≤ q) (t : ℕ) (ht : 1 ≤ t) (y : Fin 2 → Fin q) (hy : ¬ is_constant_word y) :
∃ (a b : ℕ) (hR : is_longest_word_run y a b) (a' b' : ℕ) (hR' : is_word_run y a' b')
(hadj : b' = a ∨ b = a') (ha : a < 2),
let y' := word_absorb_run y a' b' (y ⟨a, ha⟩);
(∀ r : ℕ, 1 ≤ r → qary_multiple_deletion_hinge t q 2 r y ≤ qary_multiple_deletion_hinge t q 2 r y') ∧
(∃ r : ℕ, 1 ≤ r ∧ qary_multiple_deletion_hinge t q 2 r y < qary_multiple_deletion_hinge t q 2 r y')op_491_code_card_two_q_minus_two_neIn LeanInformation Theory & Coding
For every natural number $q \\ge 26$, the maximum size of a $q$-ary $\\{2, 4\\}$-code of length $2q - 2$ does not equal $1 + \\binom{2q - 2}{2}$, witnessed by the code construction $D_{q, 2q-2}$ of size $q(2q - 4)$ from Section 6 of arXiv:2610.30613.
theorem op_491_code_card_two_q_minus_two_ne (q : ℕ) (hq : 26 ≤ q) :
two_four_code_max_card q (2 * q - 2) ≠ 1 + Nat.choose (2 * q - 2) 2op_491_stabilizes_ge_two_q_plus_oneIn LeanInformation Theory & Coding
For every natural number $q \\ge 26$ and every length $n \\ge 2q + 1$, the maximum size of a $q$-ary $\\{2, 4\\}$-code of length $n$ equals $1 + \\binom{n}{2}$ (Theorem 1.1 of arXiv:2610.30613).
theorem op_491_stabilizes_ge_two_q_plus_one (q : ℕ) (hq : 26 ≤ q) (n : ℕ) (hn : 2 * q + 1 ≤ n) :
two_four_code_max_card q n = 1 + Nat.choose n 2polynomial_aeval_eq_zero_of_natDegree_lt_minpolyIn LeanInformation Theory & Coding
If a polynomial p over B vanishes at x in M and p.natDegree is smaller than (minpoly B x).natDegree, then p = 0.
theorem polynomial_aeval_eq_zero_of_natDegree_lt_minpoly
{B M : Type*} [Field B] [Field M] [Algebra B M] {x : M} {p : Polynomial B}
(hp : Polynomial.aeval x p = 0) (h : p.natDegree < (minpoly B x).natDegree) : p = 0polynomial_finrank_degreeLEIn LeanInformation Theory & Coding
The polynomials over a field of degree at most n form a vector space of dimension n + 1.
theorem polynomial_finrank_degreeLE
{B : Type*} [Field B] (n : ℕ) :
Module.finrank B ↥(Polynomial.degreeLE B (n : WithBot ℕ)) = n + 1polynomial_subspace_coprime_degree_one_of_scalar_multipleIn LeanInformation Theory & Coding
Let r ≥ 2 and let x, y have minimal polynomial degree at least 2r-1 over B. If U_r(y) = α·U_r(x) for some α ≠ 0, then there are coprime f, g in B[X] with natDegree at most 1, max of the two degrees exactly 1, g(y) ≠ 0, and x = f(y)/g(y).
open Pointwise in
theorem polynomial_subspace_coprime_degree_one_of_scalar_multiple
{B M : Type*} [Field B] [Field M] [Algebra B M]
{r : ℕ} (hr : 2 ≤ r) {x y : M}
(hx : 2 * r - 1 ≤ (minpoly B x).natDegree)
(hy : 2 * r - 1 ≤ (minpoly B y).natDegree)
(h : ∃ α : M, α ≠ 0 ∧ polynomial_subspace B r y = α • polynomial_subspace B r x) :
∃ f g : Polynomial B, IsCoprime f g ∧ f.natDegree ≤ 1 ∧ g.natDegree ≤ 1 ∧
max f.natDegree g.natDegree = 1 ∧ Polynomial.aeval y g ≠ 0 ∧
x = Polynomial.aeval y f / Polynomial.aeval y gpolynomial_subspace_eq_degreeLE_map_aevalIn LeanInformation Theory & Coding
U_k(x) is the image of the polynomials of degree at most k-1 under evaluation at x, for k ≥ 1.
theorem polynomial_subspace_eq_degreeLE_map_aeval
{B M : Type*} [Field B] [Field M] [Algebra B M] {k : ℕ} (hk : 1 ≤ k) (x : M) :
polynomial_subspace B k x =
(Polynomial.degreeLE B ((k - 1 : ℕ) : WithBot ℕ)).map (Polynomial.aeval x).toLinearMappolynomial_subspace_finrank_eq_of_le_minpoly_natDegreeIn LeanInformation Theory & Coding
If r is at most the degree of the minimal polynomial of x over B, then the polynomial subspace U_r(x) has B-dimension exactly r.
theorem polynomial_subspace_finrank_eq_of_le_minpoly_natDegree
{B M : Type*} [Field B] [Field M] [Algebra B M]
{r : ℕ} {x : M} (h : r ≤ (minpoly B x).natDegree) :
Module.finrank B ↥(polynomial_subspace B r x) = rpolynomial_subspace_finrank_inf_smul_selfIn LeanInformation Theory & Coding
If r ≥ 2 and 2r-1 is at most the degree of the minimal polynomial of x over B, then the intersection of U_r(x) with x·U_r(x) has B-dimension r-1.
open Pointwise in
theorem polynomial_subspace_finrank_inf_smul_self
{B M : Type*} [Field B] [Field M] [Algebra B M]
{r : ℕ} (hr : 2 ≤ r) {x : M} (hx : 2 * r - 1 ≤ (minpoly B x).natDegree) :
Module.finrank B ↥(polynomial_subspace B r x ⊓ x • polynomial_subspace B r x) = r - 1polynomial_subspace_fractional_linear_of_coprime_degree_oneIn LeanInformation Theory & Coding
Let f, g in B[X] be coprime with natDegree at most 1 and max of the degrees exactly 1, let g(y) ≠ 0 and x = f(y)/g(y), and suppose the minimal polynomial of x over B has degree at least 2. Then y = (a x + b)/(c x + d) for some a, b, c, d in B with ad - bc ≠ 0.
theorem polynomial_subspace_fractional_linear_of_coprime_degree_one
{B M : Type*} [Field B] [Field M] [Algebra B M]
{x y : M} {f g : Polynomial B}
(hcop : IsCoprime f g) (hf : f.natDegree ≤ 1) (hg : g.natDegree ≤ 1)
(hmax : max f.natDegree g.natDegree = 1)
(hgy : Polynomial.aeval y g ≠ 0)
(hxy : x = Polynomial.aeval y f / Polynomial.aeval y g)
(hx : 2 ≤ (minpoly B x).natDegree) :
∃ a b c d : B, a * d - b * c ≠ 0 ∧
y = (algebraMap B M a * x + algebraMap B M b) / (algebraMap B M c * x + algebraMap B M d)polynomial_subspace_fractional_rep_of_scalar_multipleIn LeanInformation Theory & Coding
If r ≥ 2, 2r-1 ≤ deg minpoly x, and U_r(y) = α·U_r(x) for some α ≠ 0, then there are coprime f, g in B[X] of natDegree at most r-1 with g(y) ≠ 0 and x = f(y)/g(y).
open Pointwise in
theorem polynomial_subspace_fractional_rep_of_scalar_multiple
{B M : Type*} [Field B] [Field M] [Algebra B M]
{r : ℕ} (hr : 2 ≤ r) {x y : M}
(hx : 2 * r - 1 ≤ (minpoly B x).natDegree)
(h : ∃ α : M, α ≠ 0 ∧ polynomial_subspace B r y = α • polynomial_subspace B r x) :
∃ f g : Polynomial B, IsCoprime f g ∧ f.natDegree ≤ r - 1 ∧ g.natDegree ≤ r - 1 ∧
Polynomial.aeval y g ≠ 0 ∧ x = Polynomial.aeval y f / Polynomial.aeval y gpolynomial_subspace_inf_smul_finrank_of_fractional_repIn LeanInformation Theory & Coding
Let r ≥ 2, 2r-1 ≤ deg(minpoly x), and let f ≠ 0, g be coprime polynomials over B of natDegree at most r-1 with g(x) ≠ 0. Then the B-dimension of U_r(x) ∩ (f(x)/g(x))·U_r(x) is r - max(deg f, deg g).
open Pointwise in
theorem polynomial_subspace_inf_smul_finrank_of_fractional_rep
{B M : Type*} [Field B] [Field M] [Algebra B M]
{r : ℕ} (hr : 2 ≤ r) {x : M} (hx : 2 * r - 1 ≤ (minpoly B x).natDegree)
{f g : Polynomial B} (hf0 : f ≠ 0) (hcop : IsCoprime f g)
(hf : f.natDegree ≤ r - 1) (hg : g.natDegree ≤ r - 1)
(hgx : Polynomial.aeval x g ≠ 0) :
Module.finrank B ↥(polynomial_subspace B r x ⊓
(Polynomial.aeval x f / Polynomial.aeval x g) • polynomial_subspace B r x) =
r - max f.natDegree g.natDegreepolynomial_subspace_scalar_multiple_iffIn LeanInformation Theory & Coding
Let B be a field and M an extension field. For r >= 2 and x, y in M with [B(x):B] >= 2r - 1 and [B(y):B] >= 2r - 1, the polynomial subspaces U_r(y) and U_r(x) are scalar multiples of each other if and only if y = (a x + b) / (c x + d) for some a, b, c, d in B with ad - bc != 0.
theorem polynomial_subspace_scalar_multiple_iff
{B M : Type*} [Field B] [Field M] [Algebra B M]
(r : ℕ) (hr : 2 ≤ r) (x y : M)
(hx : 2 * r - 1 ≤ Module.finrank B ↥(IntermediateField.adjoin B {x}))
(hy : 2 * r - 1 ≤ Module.finrank B ↥(IntermediateField.adjoin B {y})) :
(∃ (α : M) (_ : α ≠ 0), polynomial_subspace B r y =
Submodule.map (LinearMap.mulLeft B α) (polynomial_subspace B r x)) ↔
∃ (a b c d : B) (_ : a * d - b * c ≠ 0),
y = (algebraMap B M a * x + algebraMap B M b) /
(algebraMap B M c * x + algebraMap B M d)polynomial_subspace_scalar_multiple_of_fractional_linearIn LeanInformation Theory & Coding
Let r ≥ 2 and let x, y have minimal polynomial degree at least 2r-1 over B. If y = (a x + b)/(c x + d) with ad - bc ≠ 0, then there is α ≠ 0 in M with U_r(y) = α·U_r(x).
theorem polynomial_subspace_scalar_multiple_of_fractional_linear
{B M : Type*} [Field B] [Field M] [Algebra B M]
{r : ℕ} (hr : 2 ≤ r) {x y : M}
(hx : 2 * r - 1 ≤ (minpoly B x).natDegree)
(hy : 2 * r - 1 ≤ (minpoly B y).natDegree)
(h : ∃ a b c d : B, a * d - b * c ≠ 0 ∧
y = (algebraMap B M a * x + algebraMap B M b) / (algebraMap B M c * x + algebraMap B M d)) :
∃ α : M, α ≠ 0 ∧ polynomial_subspace B r y =
Submodule.map (LinearMap.mulLeft B α) (polynomial_subspace B r x)power_divergence_gen_variance_concaveOn_of_golden_ratio_leIn LeanInformation Theory & Coding
For β ∈ [(√5−1)/2, 1), every full-support p_X with Σ p_X = 1 and every u : X → ℝ, the functional q ↦ Σ_x p_X(x)^{1−β} q_x^β (u_x − Σ_x' q_x' u_x')² (the generalized variance Σ_x p_X(x) g(q_x/p_X(x)) (u_x − E_q u)² with g(t) = t^β) is concave on the open probability simplex.
theorem power_divergence_gen_variance_concaveOn_of_golden_ratio_le (β : ℝ) (hβ0 : 0 < β)
(hβ1 : β < 1) (hγ : (Real.sqrt 5 - 1) / 2 ≤ β) :
∀ (X : Type) [Fintype X] (pX u : X → ℝ), (∀ x, 0 < pX x) → (∑ x, pX x = 1) →
ConcaveOn ℝ {q : X → ℝ | (∀ x, 0 < q x) ∧ ∑ x, q x = 1}
(subadditive_gen_variance (fun t : ℝ => t ^ β) pX u)power_divergence_generator_hasDerivAt_factsIn LeanInformation Theory & Coding
For β ∈ (0,1) and u > 0, the power-divergence generator f_β has derivative (u^{β−1} − 1)/(β−1) at u, and that derivative function has derivative u^{β−2} at u. In particular f_β'' = x^{β−2} and x² f_β'' = x^β on (0,∞).
theorem power_divergence_generator_hasDerivAt_facts (β : ℝ) (hβ0 : 0 < β) (hβ1 : β < 1)
(u : ℝ) (hu : 0 < u) :
HasDerivAt (power_divergence_generator β) ((u ^ (β - 1) - 1) / (β - 1)) u ∧
HasDerivAt (fun t : ℝ => (t ^ (β - 1) - 1) / (β - 1)) (u ^ (β - 2)) upower_divergence_subadditive_of_full_supportIn LeanInformation Theory & Coding
For the power-divergence generator f_β with β in (0, 1), subadditivity on full-support Markov chains implies subadditivity on all finite Markov chains by continuity and dense approximation.
theorem power_divergence_subadditive_of_full_support (β : ℝ) (hβ0 : 0 < β) (hβ1 : β < 1)
(hfs : mutual_f_information_subadditive_full_support (power_divergence_generator β)) :
mutual_f_information_subadditive (power_divergence_generator β)power_divergence_theta_D2_eq_gen_varianceIn LeanInformation Theory & Coding
For β ∈ (0,1), full-support p_X and P, r > 0 and v with Σ v = 0, the explicit second-derivative expression D2 of Θ_{p_X,P_{Y|X}} along the direction v (obtained from the perspective computation with f_β'' = x^{β−2}) equals Σ_y Q_y · V(ry y) − V(r), where Q_y = Σ_x r_x P(x,y), ry y = (r_x P(x,y))/Q_y and V(q) = Σ_x p_X(x)^{1−β} q_x^β (u_x − Σ_x' q_x' u_x')² with u_x = v_x/r_x.
theorem power_divergence_theta_D2_eq_gen_variance {X Y : Type*} [Fintype X] [Fintype Y]
(β : ℝ) (hβ0 : 0 < β) (hβ1 : β < 1) (pX : X → ℝ) (PY : X → Y → ℝ) (r v : X → ℝ)
(hpX : ∀ x, 0 < pX x) (hPY : ∀ x y, 0 < PY x y) (hr : ∀ x, 0 < r x)
(hv : ∑ x, v x = 0) :
(∑ y, ∑ x, pX x *
((v x * PY x y / pX x * (∑ x', r x' * PY x' y) -
r x * PY x y / pX x * (∑ x', v x' * PY x' y)) ^ 2 *
(r x * PY x y / pX x / (∑ x', r x' * PY x' y)) ^ (β - 2) /
(∑ x', r x' * PY x' y) ^ 3) -
∑ x, pX x * ((r x / pX x) ^ (β - 2) * (v x / pX x) * (v x / pX x))) =
(∑ y, (∑ x, r x * PY x y) *
subadditive_gen_variance (fun t => t ^ β) pX (fun x => v x / r x)
(fun x => r x * PY x y / (∑ x', r x' * PY x' y))) -
subadditive_gen_variance (fun t => t ^ β) pX (fun x => v x / r x) rpower_divergence_theta_concaveOn_of_channel_constIn LeanInformation Theory & Coding
For every β ∈ (0,1), full-support p_X with Σ p_X = 1 and q with Σ q = 1, the functional r ↦ Θ_{p_X,q}(r) of the power-divergence generator with the x-independent channel P(x,y) = q(y) is identically zero on the open simplex, hence concave there: a special case of the (open) claim that Θ is concave on the simplex when β ≥ (√5−1)/2, valid here for all β and with equality everywhere.
theorem power_divergence_theta_concaveOn_of_channel_const {X Y : Type*} [Fintype X] [Fintype Y]
(β : ℝ) (hβ0 : 0 < β) (hβ1 : β < 1) (pX : X → ℝ) (q : Y → ℝ)
(hpX : ∀ x, 0 < pX x) (hpX1 : ∑ x, pX x = 1) (hq : ∀ y, 0 < q y) (hq1 : ∑ y, q y = 1) :
ConcaveOn ℝ {r : X → ℝ | (∀ x, 0 < r x) ∧ ∑ x, r x = 1}
(mutual_f_theta (power_divergence_generator β) pX (fun _ y => q y))power_divergence_theta_concaveOn_of_gen_variance_concaveIn LeanInformation Theory & Coding
For β ∈ (0,1), suppose that for every full-support p_X and every u the functional q ↦ Σ_x p_X(x) (q_x/p_X(x))^β (u_x − Σ_x' q_x' u_x')² is concave on the open simplex. Then for every finite full-support prior p_X and channel P_{Y|X}, the conditional information functional r ↦ Θ_{p_X,P_{Y|X}}(r) of the power-divergence generator f_β is concave on the open probability simplex.
theorem power_divergence_theta_concaveOn_of_gen_variance_concave (β : ℝ) (hβ0 : 0 < β)
(hβ1 : β < 1)
(hV : ∀ (X : Type) [Fintype X] (pX u : X → ℝ), (∀ x, 0 < pX x) → (∑ x, pX x = 1) →
ConcaveOn ℝ {q : X → ℝ | (∀ x, 0 < q x) ∧ ∑ x, q x = 1}
(subadditive_gen_variance (fun t : ℝ => t ^ β) pX u)) :
∀ (X Y : Type) [Fintype X] [Fintype Y] (pX : X → ℝ) (PY : X → Y → ℝ),
(∀ x, 0 < pX x) → (∑ x, pX x = 1) → (∀ x y, 0 < PY x y) → (∀ x, ∑ y, PY x y = 1) →
ConcaveOn ℝ {r : X → ℝ | (∀ x, 0 < r x) ∧ ∑ x, r x = 1}
(mutual_f_theta (power_divergence_generator β) pX PY)power_divergence_theta_concave_of_golden_ratio_leIn LeanInformation Theory & Coding
For every exponent β in [(√5 - 1)/2, 1), the functional r ↦ Θ_{p_X, P_{Y|X}}(r) for the power-divergence generator f_β is concave on the open probability simplex for all finite full-support distributions.
theorem power_divergence_theta_concave_of_golden_ratio_le (β : ℝ)
(hβ : (Real.sqrt 5 - 1) / 2 ≤ β) (hβ1 : β < 1) :
∀ (X Y : Type) [Fintype X] [Fintype Y]
(pX : X → ℝ) (PY : X → Y → ℝ),
(∀ x, 0 < pX x) → (∑ x, pX x = 1) →
(∀ x y, 0 < PY x y) → (∀ x, ∑ y, PY x y = 1) →
ConcaveOn ℝ {r : X → ℝ | (∀ x, 0 < r x) ∧ ∑ x, r x = 1}
(mutual_f_theta (power_divergence_generator β) pX PY)prm_ghw_dimension_reduction_geNeeds helpInformation Theory & Coding
Let K be a finite field of order q, let e, m ≥ 1, 0 ≤ t ≤ m - 1. For every 1 ≤ r ≤ k_e(m - t), the r-th generalized Hamming weight of PRM_q(e, m - t) is at most the r-th generalized Hamming weight of PRM_q(e + t(q - 1), m).
theorem prm_ghw_dimension_reduction_ge (K : Type*) [Field K] [Fintype K]
(e m t : ℕ) (he : 1 ≤ e) (hm : 1 ≤ m) (ht : t ≤ m - 1)
(r : ℕ) (hr1 : 1 ≤ r) (hr2 : r ≤ prmDim K e (m - t)) :
prmGHW K e (m - t) r ≤ prmGHW K (e + t * (Fintype.card K - 1)) m rq_ary_subsequence_num_embeddings_relabelIn LeanInformation Theory & Coding
Relabelling the letters of both words of a subsequence-embedding count by one injective map does not change the count: for σ : Fin q → Fin q injective, the number of embeddings of σ ∘ u in σ ∘ w equals the number of embeddings of u in w.
theorem q_ary_subsequence_num_embeddings_relabel {q m n : ℕ} (σ : Fin q → Fin q)
(hσ : Function.Injective σ) (u : Fin m → Fin q) (w : Fin n → Fin q) :
q_ary_subsequence_num_embeddings q m n (fun i => σ (u i)) (fun i => σ (w i)) =
q_ary_subsequence_num_embeddings q m n u wq_ary_subsequence_num_embeddings_sumIn LeanInformation Theory & Coding
For a fixed word y of length n over an alphabet of size q > 0, summing the number of embeddings of y in x over all q^(n+2) words x of length n + 2 gives q^2 * C(n+2,2): each strictly monotone map Fin n → Fin (n+2) (there are C(n+2,2) of them) leaves exactly two free positions, hence q^2 words x.
theorem q_ary_subsequence_num_embeddings_sum (q n : ℕ) (hq : 0 < q) (y : Fin n → Fin q) :
∑ x : Fin (n + 2) → Fin q, q_ary_subsequence_num_embeddings q n (n + 2) y x =
q ^ 2 * ((n + 2).choose 2)qary_defect_block_size_tendstoIn LeanInformation Theory & Coding
For every defect gap d, the normalized defect block size (qary_defect_block_size d n : ℝ) / sqrt(n : ℝ) tends to sqrt(2 / (d + 1 : ℝ)) as n tends to infinity.
theorem qary_defect_block_size_tendsto (d : ℕ) :
Filter.Tendsto
(fun n : ℕ => (qary_defect_block_size d n : ℝ) / Real.sqrt (n : ℝ))
Filter.atTop
(nhds (Real.sqrt (2 / (d + 1 : ℝ))))qary_defect_collision_excess_asymptoticIn LeanInformation Theory & Coding
For any alphabet size q ≥ 2 and deletion count k ≥ q with defect d = k - q, and any block size sequence B(n) such that B(n) / sqrt(n) tends to c > 0, the normalized excess collision count of the defect word family tends to (2/c + (d+1)c) / (d+1)!.
theorem qary_defect_collision_excess_asymptotic
(q k : ℕ) (hq : 2 ≤ q) (hk : q ≤ k)
(B : ℕ → ℕ) (c : ℝ) (hc : 0 < c)
(hB : Filter.Tendsto (fun n : ℕ => (B n : ℝ) / Real.sqrt (n : ℝ)) Filter.atTop (nhds c)) :
let d := k - q
Filter.Tendsto
(fun n : ℕ =>
((qary_deletion_collision q k n
(qary_defect_word q (B n) n hq) : ℝ) -
(Nat.choose n k : ℝ)) /
((n : ℝ) ^ ((d : ℝ) + 3 / 2)))
Filter.atTop
(nhds ((2 / c + (d + 1 : ℝ) * c) / ((d + 1).factorial : ℝ)))qary_defect_seq_initialIn LeanInformation Theory & Coding
For every alphabet size q ≥ 2, defect spacing B, and index i in Fin q, the i-th symbol of qary_defect_seq q B hq equals i.
theorem qary_defect_seq_initial (q B : ℕ) (hq : 2 ≤ q) (i : Fin q) : qary_defect_seq q B hq i.1 = i
qary_deletion_collision_ge_chooseIn LeanInformation Theory & Coding
For any alphabet size q, deletion count k ≤ n, and word w of length n over Fin q, the deletion collision sum is bounded below by Nat.choose n k.
theorem qary_deletion_collision_ge_choose (q k n : ℕ) (w : Fin n → Fin q) (hkn : k ≤ n) :
Nat.choose n k ≤ qary_deletion_collision q k n w
qary_hinge_one_threshold_cardIn LeanInformation Theory & Coding
For a single deletion and any threshold k ≥ 2, the number of words x of length n+1 embedding y at least k times equals the number of maximal runs of y of length at least k-1.
theorem qary_hinge_one_threshold_card (q n k : ℕ) (hk : 2 ≤ k) (y : Fin n → Fin q) : ((Finset.univ : Finset (Fin (n + 1) → Fin q)).filter (fun x => k ≤ q_ary_subsequence_num_embeddings q n (n + 1) y x)).card = qary_run_count_ge y (k - 1)
qary_multiple_deletion_hinge_compIn LeanInformation Theory & Coding
Relabelling the alphabet by a bijection σ : Fin q → Fin q does not change any t-deletion hinge sum.
theorem qary_multiple_deletion_hinge_comp (t q n r : ℕ) (σ : Fin q → Fin q) (hσ : Function.Bijective σ) (y : Fin n → Fin q) : qary_multiple_deletion_hinge t q n r (fun i => σ (y i)) = qary_multiple_deletion_hinge t q n r y
qary_multiple_deletion_hinge_const_eq_zero_wordIn LeanInformation Theory & Coding
Every constant word (fun _ => a) has, at every threshold r, the same t-deletion hinge sum as the all-zero word.
theorem qary_multiple_deletion_hinge_const_eq_zero_word (t q n r : ℕ) (hq : 2 ≤ q) (a : Fin q) : qary_multiple_deletion_hinge t q n r (fun _ => a) = qary_multiple_deletion_hinge t q n r (qary_all_zero_word q n (by omega))
qary_multiple_deletion_hinge_eq_sum_tail_cardIn LeanInformation Theory & Coding
The t-deletion hinge equals the sum over thresholds s = r+1, ..., C(n+t,n) of the number of words x of length n+t in which y embeds at least s times.
theorem qary_multiple_deletion_hinge_eq_sum_tail_card (t q n r : ℕ) (y : Fin n → Fin q) : qary_multiple_deletion_hinge t q n r y = ∑ s ∈ Finset.Icc (r + 1) ((n + t).choose n), ((Finset.univ : Finset (Fin (n + t) → Fin q)).filter (fun x => s ≤ q_ary_subsequence_num_embeddings q n (n + t) y x)).card
qary_multiple_deletion_hinge_one_leIn LeanInformation Theory & Coding
For a single deletion, for every q-ary word y of length n and every r ≥ 1, the one-deletion hinge of y is at most the one-deletion hinge of the all-zero word.
theorem qary_multiple_deletion_hinge_one_le (q n r : ℕ) (hq : 2 ≤ q) (hn : 1 ≤ n) (hr : 1 ≤ r) (y : Fin n → Fin q) : qary_multiple_deletion_hinge 1 q n r y ≤ qary_multiple_deletion_hinge 1 q n r (qary_all_zero_word q n (by omega))
qary_multiple_deletion_total_embeddings_eqIn LeanInformation Theory & Coding
For any q-ary word y : Fin n → Fin q, the sum over all words x : Fin (n + t) → Fin q of the number of embeddings of y into x equals (n + t).choose n * q ^ t.
theorem qary_multiple_deletion_total_embeddings_eq (t q n : ℕ) (y : Fin n → Fin q) :
∑ x : Fin (n + t) → Fin q, q_ary_subsequence_num_embeddings q n (n + t) y x = (n + t).choose n * q ^ tqary_strict_mono_map_cardIn LeanInformation Theory & Coding
The number of strictly increasing maps Fin n → Fin N equals the binomial coefficient C(N, n).
theorem qary_strict_mono_map_card (n N : ℕ) : ((Finset.univ : Finset (Fin n → Fin N)).filter (fun f => StrictMono f)).card = N.choose n
qary_subsequence_num_embeddings_lt_choose_of_not_constantIn LeanInformation Theory & Coding
For t ≥ 1 and a non-constant word y, no word x of length n+t embeds y the maximum possible number C(n+t,n) of times.
theorem qary_subsequence_num_embeddings_lt_choose_of_not_constant (t q n : ℕ) (ht : 1 ≤ t) (hq : 1 ≤ q) (y : Fin n → Fin q) (hy : ¬ is_constant_word y) (x : Fin (n + t) → Fin q) : q_ary_subsequence_num_embeddings q n (n + t) y x < (n + t).choose n
qary_two_deletion_coloring_embeddings_le_fourIn LeanInformation Theory & Coding
If z is a proper colouring of the square of the path, then every q-ary word x of length n + 2 has at most 4 embeddings of z as a subsequence.
theorem qary_two_deletion_coloring_embeddings_le_four {q n : ℕ} (z : Fin n → Fin q)
(hz : is_square_path_coloring z) (x : Fin (n + 2) → Fin q) :
q_ary_subsequence_num_embeddings q n (n + 2) z x ≤ 4qary_two_deletion_embeddings_sumIn LeanInformation Theory & Coding
For any q, n, and any received word y of length n, the sum over all words x of length n + 2 of the number of embeddings of y in x equals q^2 * binom(n + 2, 2).
theorem qary_two_deletion_embeddings_sum (q n : ℕ) (y : Fin n → Fin q) :
∑ x : Fin (n + 2) → Fin q, q_ary_subsequence_num_embeddings q n (n + 2) y x =
q ^ 2 * (n + 2).choose 2qary_two_deletion_hinge_shift_gap_expansionIn LeanInformation Theory & Coding
For every q-ary word y of length n and every word x of length n + 2, the number of embeddings of y in x equals the number of pairs 0 ≤ p ≤ m ≤ n of gap positions such that x agrees with y shifted by 0 below position p, by 1 on the block from p + 1 to m, and by 2 from m + 2 on; position p and position m + 1 of x are the two free (deleted-and-reinserted) positions.
theorem qary_two_deletion_hinge_shift_gap_expansion
(q n : ℕ) (y : Fin n → Fin q) (x : Fin (n + 2) → Fin q) :
q_ary_subsequence_num_embeddings q n (n + 2) y x =
((Finset.univ : Finset (Fin (n + 1) × Fin (n + 1))).filter (fun pm =>
pm.1.val ≤ pm.2.val ∧
(∀ i : Fin n, i.val < pm.1.val → x ⟨i.val, by have := i.isLt; omega⟩ = y i) ∧
(∀ i : Fin n, pm.1.val ≤ i.val → i.val < pm.2.val →
x ⟨i.val + 1, by have := i.isLt; have := pm.2.isLt; omega⟩ = y i) ∧
(∀ i : Fin n, pm.2.val ≤ i.val →
x ⟨i.val + 2, by have := i.isLt; have := pm.2.isLt; omega⟩ = y i))).cardqary_two_deletion_hinge_ternary_two_sampleIn LeanInformation Theory & Coding
For the ternary word y = ![0, 1] of length 2, the two-deletion hinge sum qary_two_deletion_hinge 3 2 2 y equals 5 and qary_two_deletion_hinge 3 2 3 y equals 1.
theorem qary_two_deletion_hinge_ternary_two_sample :
qary_two_deletion_hinge 3 2 2 ![(0 : Fin 3), 1] = 5 ∧
qary_two_deletion_hinge 3 2 3 ![(0 : Fin 3), 1] = 1qary_two_deletion_hinge_three_eq_imp_square_path_coloringIn LeanInformation Theory & Coding
For q ≥ 3 and n ≥ 2, if the two-deletion hinge of y at r = 3 equals Nat.choose n 2, then y is a proper colouring of the square of the path. Equivalently, a word with y i = y j for some j = i+1 or j = i+2 has hinge at r = 3 strictly bigger than Nat.choose n 2.
theorem qary_two_deletion_hinge_three_eq_imp_square_path_coloring
(q : ℕ) (hq : 3 ≤ q) (n : ℕ) (hn : 2 ≤ n) (y : Fin n → Fin q)
(h : qary_two_deletion_hinge q n 3 y = Nat.choose n 2) :
is_square_path_coloring yqary_two_deletion_hinge_three_ge_threshold_four_cardIn LeanInformation Theory & Coding
For every q-ary word y of length n, the number of words x of length n + 2 with at least four embeddings of y is at most the two-deletion hinge of y at r = 3.
theorem qary_two_deletion_hinge_three_ge_threshold_four_card (q n : ℕ) (y : Fin n → Fin q) :
((Finset.univ : Finset (Fin (n + 2) → Fin q)).filter (fun x =>
4 ≤ q_ary_subsequence_num_embeddings q n (n + 2) y x)).card ≤
qary_two_deletion_hinge q n 3 yqary_two_deletion_hinge_three_lower_boundIn LeanInformation Theory & Coding
For q ≥ 3 and n ≥ 2, every q-ary word y of length n satisfies qary_two_deletion_hinge q n 3 y ≥ Nat.choose n 2.
theorem qary_two_deletion_hinge_three_lower_bound
(q : ℕ) (hq : 3 ≤ q) (n : ℕ) (hn : 2 ≤ n) (y : Fin n → Fin q) :
Nat.choose n 2 ≤ qary_two_deletion_hinge q n 3 yqary_two_deletion_hinge_two_eq_three_add_threshold_three_cardIn LeanInformation Theory & Coding
For every q-ary word y of length n, the two-deletion hinge at r = 2 equals the hinge at r = 3 plus the number of words x of length n + 2 that embed y at least three times.
theorem qary_two_deletion_hinge_two_eq_three_add_threshold_three_card (q n : ℕ) (y : Fin n → Fin q) :
qary_two_deletion_hinge q n 2 y = qary_two_deletion_hinge q n 3 y +
((Finset.univ : Finset (Fin (n + 2) → Fin q)).filter (fun x =>
3 ≤ q_ary_subsequence_num_embeddings q n (n + 2) y x)).cardqary_two_deletion_hinge_two_lower_boundIn LeanInformation Theory & Coding
For q ≥ 3 and n ≥ 2, every q-ary word y of length n satisfies qary_two_deletion_hinge q n 2 y ≥ n^2 + n - 1.
theorem qary_two_deletion_hinge_two_lower_bound
(q : ℕ) (hq : 3 ≤ q) (n : ℕ) (hn : 2 ≤ n) (y : Fin n → Fin q) :
n ^ 2 + n - 1 ≤ qary_two_deletion_hinge q n 2 yqary_two_deletion_noncoloring_embedding_ge_twoIn LeanInformation Theory & Coding
If y is not a proper colouring of the square of the path, say y i = y j with j = i+1 or j = i+2, then some word x of length n + 2 has at least two embeddings of y that agree in a way impossible for a colouring: concretely, x = y with the letter at i and at j duplicated... (deliberately stated as a two-element 'collision witness').
theorem qary_two_deletion_noncoloring_embedding_ge_two {q n : ℕ} (hn : 2 ≤ n)
(y : Fin n → Fin q) (hy : ¬ is_square_path_coloring y) :
∃ x : Fin (n + 2) → Fin q, 2 ≤ q_ary_subsequence_num_embeddings q n (n + 2) y xqary_two_deletion_noncoloring_entropy_ltIn LeanInformation Theory & Coding
Let q ≥ 3, n ≥ 2. If y is not a proper colouring of the square of the path of length n and z is one, then the two-deletion posterior entropy of y is strictly smaller than that of z.
theorem qary_two_deletion_noncoloring_entropy_lt (q : ℕ) (hq : 3 ≤ q) (n : ℕ) (hn : 2 ≤ n)
{y z : Fin n → Fin q} (hy : ¬ is_square_path_coloring y) (hz : is_square_path_coloring z) :
shannon_entropy (qary_two_deletion_posterior q n y) <
shannon_entropy (qary_two_deletion_posterior q n z)qary_two_deletion_posterior_sum_eq_oneIn LeanInformation Theory & Coding
For q > 0 and every q-ary word y of length n the two-deletion posterior is an honest probability distribution on the q^(n+2) words of length n + 2: the embedding numbers sum to q^2 * C(n+2,2), so the normalised posterior sums to 1.
theorem qary_two_deletion_posterior_sum_eq_one (q n : ℕ) (hq : 0 < q) (y : Fin n → Fin q) :
∑ x : Fin (n + 2) → Fin q, qary_two_deletion_posterior q n y x = 1real_defect_constant_algebraic_identityIn LeanInformation Theory & Coding
For every natural number d, (2 / sqrt(2 / (d + 1)) + (d + 1) * sqrt(2 / (d + 1))) / (d + 1)! = (2 * sqrt(2 * (d + 1))) / (d + 1)!.
theorem real_defect_constant_algebraic_identity (d : ℕ) :
(2 / Real.sqrt (2 / (d + 1 : ℝ)) + (d + 1 : ℝ) * Real.sqrt (2 / (d + 1 : ℝ))) / ((d + 1).factorial : ℝ) =
(2 * Real.sqrt (2 * (d + 1 : ℝ))) / ((d + 1).factorial : ℝ)
real_symmetric_zmatrix_row_sum_nonneg_posSemidefIn LeanInformation Theory & Coding
A real symmetric Z-matrix (nonnegative diagonal, nonpositive off-diagonal entries) all of whose row sums are nonnegative is positive semidefinite.
theorem real_symmetric_zmatrix_row_sum_nonneg_posSemidef {V : Type*} [Fintype V] [DecidableEq V]
(Z : Matrix V V ℝ) (hZsym : Z.IsSymm)
(hdiag : ∀ i, 0 ≤ Z i i) (hoff : ∀ i j, i ≠ j → Z i j ≤ 0)
(hrow : ∀ i, 0 ≤ Z.mulVec (fun _ => (1 : ℝ)) i) :
Z.PosSemidefrs_cube_image_cardIn LeanInformation Theory & Coding
For prime p ≡ 2 (mod 3) and ζ of order t, the set A_a = {(u+a)^3 - a^3 : u ∈ H} has cardinality t.
theorem rs_cube_image_card (p t : ℕ) [Fact (Nat.Prime p)] {ζ : ZMod p} (ht : 0 < t)
(hζ : ζ ^ t = 1) (hζ' : ∀ i, 0 < i → i < t → ζ ^ i ≠ 1) (hp3 : p % 3 = 2) (a : ZMod p) :
(Finset.image (fun u => (u + a) ^ 3 - a ^ 3) (Finset.image (fun i => ζ ^ i) (Finset.range t))).card = trs_cube_injective_zmodIn LeanInformation Theory & Coding
For a prime p ≡ 2 (mod 3), the cube map x ↦ x^3 is injective on ZMod p.
theorem rs_cube_injective_zmod (p : ℕ) [Fact (Nat.Prime p)] (hp3 : p % 3 = 2) :
Function.Injective (fun x : ZMod p => x ^ 3)rs_cube_poly_hammingDistIn LeanInformation Theory & Coding
For prime p ≡ 2 (mod 3) and ζ of order t, with g_a(X) = X^t - ∏_{u∈H}(X - ((u+a)^3 - a^3)) and y(x) = x^t, the codeword x ↦ eval x g_a is at Hamming distance p - t from y.
theorem rs_cube_poly_hammingDist (p t : ℕ) [Fact (Nat.Prime p)] {ζ : ZMod p} (ht : 0 < t)
(hζ : ζ ^ t = 1) (hζ' : ∀ i, 0 < i → i < t → ζ ^ i ≠ 1) (hp3 : p % 3 = 2) (a : ZMod p) :
hammingDist (fun x : ZMod p => Polynomial.eval x (Polynomial.X ^ t - ∏ u ∈ Finset.image (fun i => ζ ^ i) (Finset.range t),
(Polynomial.X - Polynomial.C ((u + a) ^ 3 - a ^ 3)))) (fun x : ZMod p => x ^ t) = p - trs_cube_poly_injectiveIn LeanInformation Theory & Coding
For t ≡ 2 (mod 3), t ≥ 3, and ζ of order t, the map a ↦ ∏_{u∈H}(X - ((u+a)^3 - a^3)) is injective.
theorem rs_cube_poly_injective (p t : ℕ) [Fact (Nat.Prime p)] {ζ : ZMod p} (ht : 3 ≤ t)
(h3 : t % 3 = 2) (hζ : ζ ^ t = 1) (hζ' : ∀ i, 0 < i → i < t → ζ ^ i ≠ 1) :
Function.Injective (fun a : ZMod p =>
∏ u ∈ Finset.image (fun i => ζ ^ i) (Finset.range t), (Polynomial.X - Polynomial.C ((u + a) ^ 3 - a ^ 3)))rs_cube_poly_natDegree_ltIn LeanInformation Theory & Coding
For t ≡ 2 (mod 3), t ≥ 3, and ζ of order t, the polynomial X^t - ∏_{u∈H}(X - ((u+a)^3 - a^3)) has natDegree strictly less than t - (t-2)/3.
theorem rs_cube_poly_natDegree_lt (p t : ℕ) [Fact (Nat.Prime p)] {ζ : ZMod p} (ht : 3 ≤ t)
(h3 : t % 3 = 2) (hζ : ζ ^ t = 1) (hζ' : ∀ i, 0 < i → i < t → ζ ^ i ≠ 1) (a : ZMod p) :
(Polynomial.X ^ t - ∏ u ∈ Finset.image (fun i => ζ ^ i) (Finset.range t),
(Polynomial.X - Polynomial.C ((u + a) ^ 3 - a ^ 3))).natDegree < t - (t - 2) / 3rs_cube_power_sum_topIn LeanInformation Theory & Coding
For t ≡ 2 (mod 3) and t ≥ 3, the ((t-2)/3 + 1)-th power sum of A_a equals t·(t+1)·a.
theorem rs_cube_power_sum_top (p t : ℕ) [Fact (Nat.Prime p)] {ζ : ZMod p} (ht : 3 ≤ t)
(h3 : t % 3 = 2) (hζ : ζ ^ t = 1) (hζ' : ∀ i, 0 < i → i < t → ζ ^ i ≠ 1) (a : ZMod p) :
∑ u ∈ Finset.image (fun i => ζ ^ i) (Finset.range t), ((u + a) ^ 3 - a ^ 3) ^ ((t - 2) / 3 + 1) =
(t : ZMod p) * ((t : ZMod p) + 1) * ars_cube_power_sum_zeroIn LeanInformation Theory & Coding
For 1 ≤ k ≤ (t-2)/3, the k-th power sum of A_a = {(u+a)^3 - a^3 : u ∈ H} vanishes.
theorem rs_cube_power_sum_zero (p t : ℕ) [Fact (Nat.Prime p)] {ζ : ZMod p} (ht : 3 ≤ t)
(hζ : ζ ^ t = 1) (hζ' : ∀ i, 0 < i → i < t → ζ ^ i ≠ 1) (a : ZMod p) {k : ℕ}
(hk : 1 ≤ k) (hkt : k ≤ (t - 2) / 3) :
∑ u ∈ Finset.image (fun i => ζ ^ i) (Finset.range t), ((u + a) ^ 3 - a ^ 3) ^ k = 0rs_esymm_eq_zero_of_power_sum_zeroIn LeanInformation Theory & Coding
Over ZMod p with p prime, for a multiset s with q ≤ card s and q < p, if all power sums p_1,…,p_q vanish, then the elementary symmetric functions e_1,…,e_q vanish.
theorem rs_esymm_eq_zero_of_power_sum_zero (p : ℕ) [Fact (Nat.Prime p)] (s : Multiset (ZMod p))
{q : ℕ} (hqs : q ≤ s.card) (hq : q < p)
(hpower : ∀ j, 1 ≤ j → j ≤ q → (s.map (fun a => a ^ j)).sum = 0) :
∀ j, 1 ≤ j → j ≤ q → s.esymm j = 0rs_exists_primitive_root_of_dvdIn LeanInformation Theory & Coding
If p is prime and t > 0 divides p-1, then ZMod p has an element ζ of multiplicative order exactly t: ζ^t = 1 and ζ^i ≠ 1 for 0 < i < t.
theorem rs_exists_primitive_root_of_dvd (p t : ℕ) [Fact (Nat.Prime p)] (ht : 0 < t) (hdvd : t ∣ p - 1) :
∃ ζ : ZMod p, ζ ^ t = 1 ∧ ∀ i, 0 < i → i < t → ζ ^ i ≠ 1rs_index_arithmeticIn LeanInformation Theory & Coding
With t = (p-1)/m and the parent's hypotheses m ≥ 2, m ≡ 2 (mod 3), p prime, p ≡ 2 (mod 3), p ≡ 1 (mod m), p ≥ 3m+2: m divides p-1, t ≥ 3, t ≡ 2 (mod 3), and t - (t-2)/3 ≤ 2(p+m-1)/(3m).
theorem rs_index_arithmetic (m p : ℕ) [Fact (Nat.Prime p)] (hm : 2 ≤ m) (hm3 : m % 3 = 2)
(hp3 : p % 3 = 2) (hpm : p % m = 1) (hp_ge : 3 * m + 2 ≤ p) :
(p - 1) % m = 0 ∧ 3 ≤ (p - 1) / m ∧ ((p - 1) / m) % 3 = 2 ∧
(p - 1) / m - ((p - 1) / m - 2) / 3 ≤ 2 * (p + m - 1) / (3 * m)rs_shift_power_sumIn LeanInformation Theory & Coding
For t ≥ 2, any a, and n ≤ t+1, the shifted power sum over H = {ζ^i : i < t} equals t·a^n + [t ≤ n]·t·C(n,t)·a^(n-t).
theorem rs_shift_power_sum (p t : ℕ) [Fact (Nat.Prime p)] {ζ : ZMod p} (ht : 2 ≤ t)
(hζ : ζ ^ t = 1) (hζ' : ∀ i, 0 < i → i < t → ζ ^ i ≠ 1) (a : ZMod p) {n : ℕ} (hn : n ≤ t + 1) :
∑ u ∈ Finset.image (fun i => ζ ^ i) (Finset.range t), (u + a) ^ n = (t : ZMod p) * a ^ n +
(if t ≤ n then (t : ZMod p) * (n.choose t : ZMod p) * a ^ (n - t) else 0)rs_subgroup_cardIn LeanInformation Theory & Coding
If ζ has order exactly t (ζ^t = 1 and ζ^i ≠ 1 for 0 < i < t), then the powers ζ^0, …, ζ^(t-1) are pairwise distinct, so the image finset {ζ^i : i < t} has cardinality t.
theorem rs_subgroup_card (p t : ℕ) [Fact (Nat.Prime p)] {ζ : ZMod p} (ht : 0 < t)
(hζ : ζ ^ t = 1) (hζ' : ∀ i, 0 < i → i < t → ζ ^ i ≠ 1) :
(Finset.image (fun i => ζ ^ i) (Finset.range t)).card = trs_subgroup_power_sumIn LeanInformation Theory & Coding
For u ranging over the subgroup H = {ζ^i : i < t} of an element ζ of order t, the k-th power sum ∑ u^k (k ≥ 1) equals t if t divides k and 0 otherwise.
theorem rs_subgroup_power_sum (p t : ℕ) [Fact (Nat.Prime p)] {ζ : ZMod p} (ht : 0 < t)
(hζ : ζ ^ t = 1) (hζ' : ∀ i, 0 < i → i < t → ζ ^ i ≠ 1) (k : ℕ) (hk : 1 ≤ k) :
∑ u ∈ Finset.image (fun i => ζ ^ i) (Finset.range t), u ^ k = if t ∣ k then (t : ZMod p) else 0scalar_quadratic_sampler_integrality_and_smoothnessIn LeanInformation Theory & Coding
Let q ≥ 3 and r ≥ 1 be integers. Let m_j = 1 + (q-1)!(12r(q-1) + j) for 0 ≤ j < q, D = ∏_{j=0}^{q-1} m_j, M = 12r(D/m_0)^2, and S = (12r-1)m_0(D/m_0)^2. For any integer t with 0 ≤ t < M, if A is in [-m_0 t, -m_0 t + S) and B is in [0, D^2) satisfying B ≡ -m_k A (mod m_k^2) for all 0 ≤ k < q, and X_j = t + A/m_j + B/m_j^2: (a) for every 0 ≤ j < q, X_j is an integer in [0, M); and (b) for every 0 ≤ j < q and every integer x with 0 ≤ x < M, the number of values of A in [-m_0 t, -m_0 t + S) yielding X_j = x is at most m_j, and m_j / S ≤ 2 / M.
open scoped Classical in
theorem scalar_quadratic_sampler_integrality_and_smoothness
(q r : ℕ) (hq : 3 ≤ q) (hr : 1 ≤ r)
(t : ℤ) :
let m : ℕ → ℤ := fun j => 1 + (q - 1).factorial * (12 * r * (q - 1) + j)
let D : ℤ := ∏ j ∈ Finset.range q, m j
let M : ℤ := 12 * r * (D / m 0) ^ 2
let S : ℤ := (12 * r - 1) * m 0 * (D / m 0) ^ 2
let allowed_A : Finset ℤ := Finset.Ico (- m 0 * t) (- m 0 * t + S)
let X : ℤ → ℤ → ℕ → ℚ := fun A B j => (t : ℚ) + (A : ℚ) / (m j : ℚ) + (B : ℚ) / ((m j : ℚ)^2)
0 ≤ t ∧ t < M →
(∀ (A B : ℤ), A ∈ allowed_A → 0 ≤ B → B < D^2 →
(∀ k < q, B ≡ - m k * A [ZMOD (m k)^2]) →
∀ j < q, ∃ z : ℤ, X A B j = (z : ℚ) ∧ 0 ≤ z ∧ z < M) ∧
(∀ (j : ℕ), j < q → ∀ (x : ℤ), 0 ≤ x → x < M →
((allowed_A.filter (fun A => ∃ B : ℤ, 0 ≤ B ∧ B < D^2 ∧
(∀ k < q, B ≡ - m k * A [ZMOD (m k)^2]) ∧ X A B j = (x : ℚ))).card ≤ m j ∧
(m j : ℝ) / (S : ℝ) ≤ 2 / (M : ℝ)))scalar_sampler_fiber_boundIn LeanInformation Theory & Coding
For integers q ≥ 3, r ≥ 1, and 0 ≤ t, for any j < q and any integer x in [0, M), the number of values of A in [-m_0 t, -m_0 t + S) yielding X_j = x is at most m_j.
open scoped Classical in
theorem scalar_sampler_fiber_bound
(q r : ℕ) (hq : 3 ≤ q) (hr : 1 ≤ r)
(t : ℤ) (ht : 0 ≤ t) :
let m : ℕ → ℤ := fun j => 1 + (q - 1).factorial * (12 * r * (q - 1) + j)
let D : ℤ := ∏ j ∈ Finset.range q, m j
let M : ℤ := 12 * r * (D / m 0) ^ 2
let S : ℤ := (12 * r - 1) * m 0 * (D / m 0) ^ 2
let allowed_A : Finset ℤ := Finset.Ico (- m 0 * t) (- m 0 * t + S)
let X : ℤ → ℤ → ℕ → ℚ := fun A B j => (t : ℚ) + (A : ℚ) / (m j : ℚ) + (B : ℚ) / ((m j : ℚ)^2)
∀ (j : ℕ), j < q → ∀ (x : ℤ), 0 ≤ x → x < M →
(allowed_A.filter (fun A => ∃ B : ℤ, 0 ≤ B ∧ B < D^2 ∧
(∀ k < q, B ≡ - m k * A [ZMOD (m k)^2]) ∧ X A B j = (x : ℚ))).card ≤ m jscalar_sampler_integrality_and_rangeIn LeanInformation Theory & Coding
For integers q ≥ 3, r ≥ 1, and 0 ≤ t < M, any A in [-m_0 t, -m_0 t + S) and B in [0, D^2) satisfying B ≡ -m_k A (mod m_k^2) for all k < q gives an integer X_j = t + A/m_j + B/m_j^2 in [0, M) for every j < q.
theorem scalar_sampler_integrality_and_range
(q r : ℕ) (hq : 3 ≤ q) (hr : 1 ≤ r)
(t : ℤ) :
let m : ℕ → ℤ := fun j => 1 + (q - 1).factorial * (12 * r * (q - 1) + j)
let D : ℤ := ∏ j ∈ Finset.range q, m j
let M : ℤ := 12 * r * (D / m 0) ^ 2
let S : ℤ := (12 * r - 1) * m 0 * (D / m 0) ^ 2
let allowed_A : Finset ℤ := Finset.Ico (- m 0 * t) (- m 0 * t + S)
let X : ℤ → ℤ → ℕ → ℚ := fun A B j => (t : ℚ) + (A : ℚ) / (m j : ℚ) + (B : ℚ) / ((m j : ℚ)^2)
0 ≤ t → t < M →
∀ (A B : ℤ), A ∈ allowed_A → 0 ≤ B → B < D^2 →
(∀ k < q, B ≡ - m k * A [ZMOD (m k)^2]) →
∀ j < q, ∃ z : ℤ, X A B j = (z : ℚ) ∧ 0 ≤ z ∧ z < Mshannon_entropy_le_iff_embedding_potential_geIn LeanInformation Theory & Coding
For q > 0 and words y, z of length n, the posterior entropy of y is at most that of z if and only if the embedding potential sum_x e_z(x) log e_z(x) is at most the potential of y. Hence maximising entropy is minimising the potential.
theorem shannon_entropy_le_iff_embedding_potential_ge (q n : ℕ) (hq : 0 < q)
(y z : Fin n → Fin q) :
shannon_entropy (qary_two_deletion_posterior q n y) ≤
shannon_entropy (qary_two_deletion_posterior q n z) ↔
(∑ x : Fin (n + 2) → Fin q,
(q_ary_subsequence_num_embeddings q n (n + 2) z x : ℝ) *
Real.log (q_ary_subsequence_num_embeddings q n (n + 2) z x : ℝ)) ≤
∑ x : Fin (n + 2) → Fin q,
(q_ary_subsequence_num_embeddings q n (n + 2) y x : ℝ) *
Real.log (q_ary_subsequence_num_embeddings q n (n + 2) y x : ℝ)shannon_entropy_qary_two_deletion_posterior_eq_log_sub_sumIn LeanInformation Theory & Coding
With D = q^2 * C(n+2,2) and e_x the number of ways to obtain y from x by deleting two positions, the posterior entropy is H(y) = log D - (1/D) * sum_x e_x log e_x.
theorem shannon_entropy_qary_two_deletion_posterior_eq_log_sub_sum (q n : ℕ) (hq : 0 < q)
(y : Fin n → Fin q) :
shannon_entropy (qary_two_deletion_posterior q n y) =
Real.log ((q : ℝ) ^ 2 * ((n + 2).choose 2 : ℝ)) -
((q : ℝ) ^ 2 * ((n + 2).choose 2 : ℝ))⁻¹ *
∑ x : Fin (n + 2) → Fin q,
(q_ary_subsequence_num_embeddings q n (n + 2) y x : ℝ) *
Real.log (q_ary_subsequence_num_embeddings q n (n + 2) y x : ℝ)shannon_entropy_qary_two_deletion_posterior_eq_sum_fiberIn LeanInformation Theory & Coding
For any alphabet size q, length n, and received word y of length n, the Shannon entropy of the posterior distribution qary_two_deletion_posterior q n y equals the sum over positive embedding counts k ∈ [1, binom(n+2, 2)] of the fiber cardinality times negMulLog(k / (q^2 * binom(n+2, 2))).
theorem shannon_entropy_qary_two_deletion_posterior_eq_sum_fiber (q n : ℕ) (y : Fin n → Fin q) :
shannon_entropy (qary_two_deletion_posterior q n y) =
∑ k ∈ Finset.Icc 1 ((n + 2).choose 2),
((Finset.univ.filter (fun x : Fin (n + 2) → Fin q =>
q_ary_subsequence_num_embeddings q n (n + 2) y x = k)).card : ℝ) *
Real.negMulLog ((k : ℝ) / ((q : ℝ) ^ 2 * ((n + 2).choose 2 : ℝ)))shannon_entropy_qary_two_deletion_posterior_relabelIn LeanInformation Theory & Coding
Applying an injective relabelling σ of the alphabet to every letter of y does not change the two-deletion posterior entropy.
theorem shannon_entropy_qary_two_deletion_posterior_relabel {q n : ℕ} (σ : Fin q → Fin q)
(hσ : Function.Injective σ) (y : Fin n → Fin q) :
shannon_entropy (qary_two_deletion_posterior q n (fun i => σ (y i))) =
shannon_entropy (qary_two_deletion_posterior q n y)shannon_or_capacity_categorical_prod_lower_threeIn LeanInformation Theory & Coding
If min(C_OR G, C_OR H) = 3 then the Shannon OR-capacity of the categorical product G × H is at least 3.
theorem shannon_or_capacity_categorical_prod_lower_three {V W : Type*} [Fintype V] [Nonempty V] [Fintype W] [Nonempty W] (G : SimpleGraph V) (H : SimpleGraph W) (h : min (shannon_or_capacity G) (shannon_or_capacity H) = 3) : 3 ≤ shannon_or_capacity (simple_graph_categorical_prod G H)shannon_or_capacity_categorical_prod_three_of_cliqueNum_threeIn LeanInformation Theory & Coding
If both factors contain a triangle, then the categorical product contains a triangle (pair the triangles coordinatewise), so its OR-capacity is at least 3.
theorem shannon_or_capacity_categorical_prod_three_of_cliqueNum_three {V W : Type*} [Fintype V] [Nonempty V] [Fintype W] [Nonempty W] (G : SimpleGraph V) (H : SimpleGraph W) (hG : 3 ≤ G.cliqueNum) (hH : 3 ≤ H.cliqueNum) : 3 ≤ shannon_or_capacity (simple_graph_categorical_prod G H)shannon_or_capacity_extract_or_powerIn LeanInformation Theory & Coding
If C_OR(G) ≥ t then for every eps > 0 there is n ≥ 1 with (t − eps) < omega(G^{∨n})^{1/n}.
theorem shannon_or_capacity_extract_or_power {V : Type*} [Fintype V] [Nonempty V] (G : SimpleGraph V) {t eps : ℝ} (ht : t ≤ shannon_or_capacity G) (heps : 0 < eps) : ∃ n : ℕ, 1 ≤ n ∧ t - eps < ((simple_graph_or_power G n).cliqueNum : ℝ) ^ ((1 : ℝ) / ↑n)signed_coordinate_dist_nonnegIn LeanInformation Theory & Coding
For every n and every f : {0,1}^n → ℝ, the dictator distance delta(f) is nonnegative.
open scoped BigOperators in
theorem signed_coordinate_dist_nonneg (n : ℕ) (f : (Fin n → Bool) → ℝ) :
0 ≤ signed_coordinate_dist n fsimple_graph_or_power_cliqueNum_monoIn LeanInformation Theory & Coding
For m ≤ n, the clique number of G^{∨m} is at most the clique number of G^{∨n}.
theorem simple_graph_or_power_cliqueNum_mono {V : Type*} [Fintype V] [Nonempty V] (G : SimpleGraph V) {m n : ℕ} (hmn : m ≤ n) : (simple_graph_or_power G m).cliqueNum ≤ (simple_graph_or_power G n).cliqueNumsimple_graph_or_power_cliqueNum_mul_leIn LeanInformation Theory & Coding
Supermultiplicativity of OR-power clique numbers: concatenating a clique of G^{∨m} and a clique of G^{∨n} gives a clique of G^{∨(m+n)}.
theorem simple_graph_or_power_cliqueNum_mul_le {V : Type*} [Fintype V] (G : SimpleGraph V) (m n : ℕ) : (simple_graph_or_power G m).cliqueNum * (simple_graph_or_power G n).cliqueNum ≤ (simple_graph_or_power G (m + n)).cliqueNumsimple_graph_or_power_one_cliqueNumIn LeanInformation Theory & Coding
The first OR-power G^{∨1} has the same clique number as G.
theorem simple_graph_or_power_one_cliqueNum {V : Type*} [Fintype V] (G : SimpleGraph V) : (simple_graph_or_power G 1).cliqueNum = G.cliqueNumsingle_slot_binary_linear_coding_advantageIn LeanInformation Theory & Coding
Normal form of OP-90: there exist a finite vertex set, a finite session type, a capacitated network, unicast sessions and a deterministic causal binary linear code on them with exactly one transmission slot (T = 1) whose rate, the number L of message symbols per session, is strictly greater than every rate supported by fractional multicommodity flow on the same instance. This is the residual open content after normalisation, not a step that is easier than the target: read a T-slot code on capacities c as a one-slot code on capacities T*c (T is the only place the slot count occurs, in cap_le, and flow feasibility is homogeneous of degree one in (f, r, c)), so every T-slot witness yields a one-slot witness, and conversely the target follows from this statement in one line with r := (code.L : ℝ).
theorem single_slot_binary_linear_coding_advantage :
∃ (V : Type) (_ : Fintype V) (_ : DecidableEq V)
(K : Type) (_ : Fintype K) (_ : DecidableEq K)
(net : CapacitatedNetwork V) (sess : UnicastSessions V K)
(code : CausalLinearNetworkCode V K (ZMod 2) net sess),
code.T = 1 ∧
∀ r_flow, FlowSupportsRate net sess r_flow → r_flow < (code.L : ℝ)single_slot_witness_certificateIn LeanInformation Theory & Coding
Search target: there are a finite vertex set, a finite session type, a capacitated network, unicast sessions, a one-slot deterministic causal binary linear code on them, and a rational-valued pseudometric d on the vertices (nonnegative, symmetric, zero on the diagonal, triangle-satisfying) whose two finite sums satisfy sum_{u,v} cap{u,v} d(u,v) < 2 L sum_k d(src k, tgt k) with positive total session length, i.e. an explicit dual certificate that every fractional multicommodity flow rate on the instance is strictly below the code's message dimension L.
theorem single_slot_witness_certificate :
∃ (V : Type) (_ : Fintype V) (_ : DecidableEq V)
(K : Type) (_ : Fintype K) (_ : DecidableEq K)
(net : CapacitatedNetwork V) (sess : UnicastSessions V K)
(code : CausalLinearNetworkCode V K (ZMod 2) net sess)
(d : V → V → ℝ),
code.T = 1 ∧
(∀ u v, 0 ≤ d u v) ∧ (∀ u v, d u v = d v u) ∧ (∀ u, d u u = 0) ∧
(∀ u v w, d u v ≤ d u w + d w v) ∧
0 < ∑ k, d (sess.src k) (sess.tgt k) ∧
∑ u, ∑ v, net.cap s(u, v) * d u v <
2 * (code.L : ℝ) * (∑ k, d (sess.src k) (sess.tgt k))square_path_coloring_two_deletion_fiber_four_cardIn LeanInformation Theory & Coding
For q ≥ 3 and n ≥ 2, if y is a proper colouring of the square of the path then exactly Nat.choose n 2 words x of length n + 2 embed y four times, namely the words obtained from y by duplicating two of its letters.
theorem square_path_coloring_two_deletion_fiber_four_card
(q : ℕ) (hq : 3 ≤ q) (n : ℕ) (hn : 2 ≤ n) (y : Fin n → Fin q)
(hy : is_square_path_coloring y) :
((Finset.univ : Finset (Fin (n + 2) → Fin q)).filter
(fun x => q_ary_subsequence_num_embeddings q n (n + 2) y x = 4)).card = Nat.choose n 2square_path_coloring_two_deletion_fiber_three_cardIn LeanInformation Theory & Coding
For q ≥ 3 and n ≥ 2, if y is a proper colouring of the square of the path then exactly 2n - 1 words x of length n + 2 embed y exactly three times: the n words obtained by tripling one letter y_i and the n - 1 words obtained by repeating an adjacent pair y_i y_(i+1) immediately after itself.
theorem square_path_coloring_two_deletion_fiber_three_card
(q : ℕ) (hq : 3 ≤ q) (n : ℕ) (hn : 2 ≤ n) (y : Fin n → Fin q)
(hy : is_square_path_coloring y) :
((Finset.univ : Finset (Fin (n + 2) → Fin q)).filter
(fun x => q_ary_subsequence_num_embeddings q n (n + 2) y x = 3)).card = 2 * n - 1strict_majority_three_is_balancedIn LeanInformation Theory & Coding
The strict majority function on 3 Boolean inputs is a balanced Boolean indicator.
open scoped BigOperators in
theorem strict_majority_three_is_balanced :
is_balanced_indicator 3 (fun x => if strictMajority 3 x then 1 else 0)submodule_pointwise_smul_eq_map_mulLeftIn LeanInformation Theory & Coding
For a scalar α in the extension M and a B-subspace S of M, the pointwise multiple α • S equals the image of S under multiplication by α.
open Pointwise in
theorem submodule_pointwise_smul_eq_map_mulLeft
{B M : Type*} [Field B] [Field M] [Algebra B M] (α : M) (S : Submodule B M) :
α • S = Submodule.map (LinearMap.mulLeft B α) Ssum_nat_mul_log_eq_tail_sumIn LeanInformation Theory & Coding
For any finite type and any multiplicity function f, the sum of f i log f i equals the sum over c ≥ 2 of the tail weight (c log c - (c-1) log(c-1)) times the number of points with f i ≥ c.
theorem sum_nat_mul_log_eq_tail_sum {ι : Type*} [Fintype ι] (f : ι → ℕ) :
∑ i, (f i : ℝ) * Real.log (f i : ℝ) =
∑ c ∈ Finset.Icc 2 (Finset.univ.sup f),
((c : ℝ) * Real.log (c : ℝ) - ((c - 1 : ℕ) : ℝ) * Real.log ((c - 1 : ℕ) : ℝ)) *
((Finset.univ.filter (fun i => c ≤ f i)).card : ℝ)tail_weight_posIn LeanInformation Theory & Coding
The tail weights c log c - (c-1) log(c-1) are strictly positive for every integer c ≥ 2.
theorem tail_weight_pos (c : ℕ) (hc : 2 ≤ c) :
0 < (c : ℝ) * Real.log (c : ℝ) - ((c - 1 : ℕ) : ℝ) * Real.log ((c - 1 : ℕ) : ℝ)three_deletion_alternating_entropy_formulaIn LeanInformation Theory & Coding
For every natural number n with 1 ≤ n, three_deletion_entropy n (alternating_word n false) = Real.logb 2 (8 * ((Nat.choose (n + 3) 3 : ℕ) : ℝ)) - three_deletion_S3 n / (8 * ((Nat.choose (n + 3) 3 : ℕ) : ℝ)).
theorem three_deletion_alternating_entropy_formula (n : ℕ) (hn : 1 ≤ n) :
three_deletion_entropy n (alternating_word n false) =
Real.logb 2 (8 * ((n + 3).choose 3 : ℝ)) - three_deletion_S3 n / (8 * ((n + 3).choose 3 : ℝ))three_deletion_alternating_histogramIn LeanInformation Theory & Coding
For every n ≥ 1 and every k > 0, the number of binary words x of length n + 3 in which the alternating word alternating_word n false has exactly k embeddings is 4 * (if k = 1 then 1 else 0) + 3 * n * (if k = 2 then 1 else 0) + 2 * n * (if k = 3 then 1 else 0) + n ^ 2 * (if k = 4 then 1 else 0) + n * (n - 1) * (if k = 6 then 1 else 0) + Nat.choose n 3 * (if k = 8 then 1 else 0) + n * (if k = 2 * n then 1 else 0) + 2 * (if k = 2 * n + 1 then 1 else 0) + 2 * (if k = n + 1 then 1 else 0).
theorem three_deletion_alternating_histogram (n : ℕ) (hn : 1 ≤ n) (k : ℕ) (hk : 0 < k) :
(Finset.univ.filter (fun x : Fin (n + 3) → Bool => three_deletion_num_embeddings n (alternating_word n false) x = k)).card =
4 * (if k = 1 then 1 else 0) +
3 * n * (if k = 2 then 1 else 0) +
2 * n * (if k = 3 then 1 else 0) +
n ^ 2 * (if k = 4 then 1 else 0) +
n * (n - 1) * (if k = 6 then 1 else 0) +
n.choose 3 * (if k = 8 then 1 else 0) +
n * (if k = 2 * n then 1 else 0) +
2 * (if k = 2 * n + 1 then 1 else 0) +
2 * (if k = n + 1 then 1 else 0)three_deletion_alternating_histogram_and_entropyIn LeanInformation Theory & Coding
For every natural number n with 1 ≤ n, the alternating word alternating_word n false satisfies: (1) for every natural number k with 0 < k, the cardinality of (Finset.univ.filter (fun x : Fin (n + 3) → Bool => three_deletion_num_embeddings n (alternating_word n false) x = k)) equals 4 * (if k = 1 then 1 else 0) + 3 * n * (if k = 2 then 1 else 0) + 2 * n * (if k = 3 then 1 else 0) + n ^ 2 * (if k = 4 then 1 else 0) + n * (n - 1) * (if k = 6 then 1 else 0) + Nat.choose n 3 * (if k = 8 then 1 else 0) + n * (if k = 2 * n then 1 else 0) + 2 * (if k = 2 * n + 1 then 1 else 0) + 2 * (if k = n + 1 then 1 else 0); and (2) three_deletion_entropy n (alternating_word n false) = Real.logb 2 (8 * ((Nat.choose (n + 3) 3 : ℕ) : ℝ)) - three_deletion_S3 n / (8 * ((Nat.choose (n + 3) 3 : ℕ) : ℝ)).
theorem three_deletion_alternating_histogram_and_entropy (n : ℕ) (hn : 1 ≤ n) :
(∀ k : ℕ, 0 < k → (Finset.univ.filter (fun x : Fin (n + 3) → Bool => three_deletion_num_embeddings n (alternating_word n false) x = k)).card =
4 * (if k = 1 then 1 else 0) +
3 * n * (if k = 2 then 1 else 0) +
2 * n * (if k = 3 then 1 else 0) +
n ^ 2 * (if k = 4 then 1 else 0) +
n * (n - 1) * (if k = 6 then 1 else 0) +
n.choose 3 * (if k = 8 then 1 else 0) +
n * (if k = 2 * n then 1 else 0) +
2 * (if k = 2 * n + 1 then 1 else 0) +
2 * (if k = n + 1 then 1 else 0)) ∧
three_deletion_entropy n (alternating_word n false) =
Real.logb 2 (8 * ((n + 3).choose 3 : ℝ)) - three_deletion_S3 n / (8 * ((n + 3).choose 3 : ℝ))tsallis_seven_eighths_sharp_stability_bound_c3_regimeIn LeanInformation Theory & Coding
For 0 < rho < 1 with C_3(rho) <= C_G(rho), natural number n >= 1, and balanced Boolean indicator f, the order-7/8 stability excess is at least C_3(rho) times the dictator distance delta(f).
open scoped BigOperators in
theorem tsallis_seven_eighths_sharp_stability_bound_c3_regime
(ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(hreg : tsallis_c3 ρ ≤ tsallis_cG ρ)
(n : ℕ) (hn : 0 < n) (f : (Fin n → Bool) → ℝ)
(hf : is_balanced_indicator n f) :
((1 / (2 : ℝ) ^ n) * ∑ x : Fin n → Bool, (noise_operator n ρ f x) ^ (7 / 8 : ℝ)) - tsallis_h (7 / 8) ρ ≥
tsallis_c3 ρ * signed_coordinate_dist n ftsallis_seven_eighths_sharp_stability_bound_cG_regimeIn LeanInformation Theory & Coding
For 0 < rho < 1 with C_G(rho) <= C_3(rho), natural number n >= 1, and balanced Boolean indicator f, the order-7/8 stability excess is at least C_G(rho) times the dictator distance delta(f).
open scoped BigOperators in
theorem tsallis_seven_eighths_sharp_stability_bound_cG_regime
(ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(hreg : tsallis_cG ρ ≤ tsallis_c3 ρ)
(n : ℕ) (hn : 0 < n) (f : (Fin n → Bool) → ℝ)
(hf : is_balanced_indicator n f) :
((1 / (2 : ℝ) ^ n) * ∑ x : Fin n → Bool, (noise_operator n ρ f x) ^ (7 / 8 : ℝ)) - tsallis_h (7 / 8) ρ ≥
tsallis_cG ρ * signed_coordinate_dist n ftsallis_seven_eighths_target_n_oneIn LeanInformation Theory & Coding
The target inequality in the smallest dimension n = 1: every balanced {0,1}-valued f on {0,1}^1 is a coordinate indicator, hence signed_coordinate_dist 1 f = 0, and the inequality reduces to the nonnegativity of the excess.
open scoped BigOperators in
theorem tsallis_seven_eighths_target_n_one (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1)
(f : (Fin 1 → Bool) → ℝ) (hf : is_balanced_indicator 1 f) :
((1 / (2 : ℝ) ^ 1) * ∑ y : Fin 1 → Bool, (noise_operator 1 ρ f y) ^ (7 / 8 : ℝ)) -
tsallis_h (7 / 8) ρ ≥
min (tsallis_c3 ρ) (tsallis_cG ρ) * signed_coordinate_dist 1 ftsallis_stability_excess_nonnegIn LeanInformation Theory & Coding
Majority-is-stablest baseline at order 7/8: for every balanced {0,1}-valued f on {0,1}^n and 0 < ρ < 1, the concave stability functional dominates h, i.e. E[(T_ρ f)^(7/8)] ≥ h(7/8, ρ). This is the constant term of the target's linear refinement, obtained from Jensen plus the concavity of t ↦ t^(7/8).
open scoped BigOperators in
theorem tsallis_stability_excess_nonneg (n : ℕ) (ρ : ℝ) (hρ0 : 0 < ρ) (hρ1 : ρ < 1) (hn : 0 < n)
(f : (Fin n → Bool) → ℝ) (hf : is_balanced_indicator n f) :
0 ≤ ((1 / (2 : ℝ) ^ n) * ∑ x : Fin n → Bool, (noise_operator n ρ f x) ^ (7 / 8 : ℝ)) - tsallis_h (7 / 8) ρtwo_deletion_exists_moment_lt_alternating_momentIn LeanInformation Theory & Coding
For every real order α > 1, there exist a natural number n ≥ 2 and a word w : Fin n → Bool such that the α-moment of the two-deletion embedding counts of w is strictly positive and strictly less than that of alternating_word n false.
theorem two_deletion_exists_moment_lt_alternating_moment (α : ℝ) (hα : 1 < α) : ∃ (n : ℕ) (hn : 2 ≤ n) (w : Fin n → Bool), (0 < ∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n w y : ℝ)) ^ α) ∧ (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n w y : ℝ)) ^ α) < (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n (alternating_word n false) y : ℝ)) ^ α)
two_deletion_hinge_values_of_embedding_fibers_le_fourIn LeanInformation Theory & Coding
For q ≥ 3 and n ≥ 2, let y be a q-ary word of length n all of whose embedding counts e(y,x) are at most 4, with exactly Nat.choose n 2 words x having four embeddings and exactly 2n - 1 having three. Then qary_two_deletion_hinge q n 2 y = n^2 + n - 1 and qary_two_deletion_hinge q n 3 y = Nat.choose n 2.
theorem two_deletion_hinge_values_of_embedding_fibers_le_four
(q : ℕ) (n : ℕ) (y : Fin n → Fin q) (hn : 2 ≤ n)
(hle : ∀ x : Fin (n + 2) → Fin q, q_ary_subsequence_num_embeddings q n (n + 2) y x ≤ 4)
(hfour : ((Finset.univ : Finset (Fin (n + 2) → Fin q)).filter
(fun x => q_ary_subsequence_num_embeddings q n (n + 2) y x = 4)).card = Nat.choose n 2)
(hthree : ((Finset.univ : Finset (Fin (n + 2) → Fin q)).filter
(fun x => q_ary_subsequence_num_embeddings q n (n + 2) y x = 3)).card = 2 * n - 1) :
qary_two_deletion_hinge q n 2 y = n ^ 2 + n - 1 ∧
qary_two_deletion_hinge q n 3 y = Nat.choose n 2two_deletion_num_embeddings_alternating_complementIn LeanInformation Theory & Coding
Complementing the transmitted word swaps the two alternating received words: for every y of length n + 2, the number of embeddings of the alternating word starting with true in y equals the number of embeddings of the alternating word starting with false in the bitwise complement of y.
theorem two_deletion_num_embeddings_alternating_complement (n : ℕ) (y : Fin (n + 2) → Bool) : two_deletion_num_embeddings n (alternating_word n true) y = two_deletion_num_embeddings n (alternating_word n false) (fun i => !(y i))
two_deletion_num_embeddings_alternating_histogramIn LeanInformation Theory & Coding
Closed form for the two-deletion embedding histogram of the alternating word: for n ≥ 2 and every k, the number of words y of length n + 2 in which the alternating word starting with false has exactly k embeddings is 3·[k=1] + 2n·[k=2] + n·[k=3] + C(n,2)·[k=4] + [k=n+1]. (The indicators are added, not case-split: the k=3 and k=n+1 terms coincide at n=2 and the k=4 and k=n+1 terms at n=3.)
theorem two_deletion_num_embeddings_alternating_histogram (n : ℕ) (hn : 2 ≤ n) (k : ℕ) : (Finset.univ.filter (fun y : Fin (n + 2) → Bool => two_deletion_num_embeddings n (alternating_word n false) y = k)).card = 3 * (if k = 1 then 1 else 0) + 2 * n * (if k = 2 then 1 else 0) + n * (if k = 3 then 1 else 0) + n.choose 2 * (if k = 4 then 1 else 0) + (if k = n + 1 then 1 else 0)
two_deletion_num_embeddings_rpow_alternating_maxIn LeanInformation Theory & Coding
For 0 < α < 1 and n ≥ 2, the alternating word maximises the α-moment of the two-deletion embedding-count histogram over all words of length n, and equality holds exactly for the two alternating words.
theorem two_deletion_num_embeddings_rpow_alternating_max (α : ℝ) (hα0 : 0 < α) (hα1 : α < 1) (n : ℕ) (hn : 2 ≤ n) (w : Fin n → Bool) : (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n w y : ℝ)) ^ α) ≤ (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n (alternating_word n false) y : ℝ)) ^ α) ∧ (((∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n w y : ℝ)) ^ α) = (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n (alternating_word n false) y : ℝ)) ^ α)) ↔ is_alternating_word w)
two_deletion_num_embeddings_rpow_eq_alternatingIn LeanInformation Theory & Coding
An alternating word has the same α-moment of its two-deletion embedding-count histogram as the alternating word starting with false, for every real α.
theorem two_deletion_num_embeddings_rpow_eq_alternating (α : ℝ) {n : ℕ} (w : Fin n → Bool) (hw : is_alternating_word w) : (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n w y : ℝ)) ^ α) = (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n (alternating_word n false) y : ℝ)) ^ α)two_deletion_num_embeddings_rpow_lt_of_not_alternatingIn LeanInformation Theory & Coding
Sharp strict form of the sub-unit Rényi comparison for two deletions: for 0 < α < 1 and n ≥ 2, every non-alternating word w of length n has strictly smaller α-moment of its two-deletion embedding-count histogram than the alternating word.
theorem two_deletion_num_embeddings_rpow_lt_of_not_alternating (α : ℝ) (hα0 : 0 < α) (hα1 : α < 1) (n : ℕ) (hn : 2 ≤ n) (w : Fin n → Bool) (hw : ¬ is_alternating_word w) : (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n w y : ℝ)) ^ α) < (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n (alternating_word n false) y : ℝ)) ^ α)
two_deletion_num_embeddings_sumIn LeanInformation Theory & Coding
For every word w of length n, the two-deletion embedding counts over all words y of length n + 2 sum to 4·C(n+2,2): each of the C(n+2,2) choices of the two deleted positions contributes exactly the 4 words obtained by filling those positions with the two free bits.
theorem two_deletion_num_embeddings_sum (n : ℕ) (w : Fin n → Bool) : (∑ y : Fin (n + 2) → Bool, two_deletion_num_embeddings n w y) = 4 * (n + 2).choose 2
two_deletion_posterior_renyi_lt_of_moment_ltIn LeanInformation Theory & Coding
For every real order α > 1, length n ≥ 2, and word w of length n, if the α-moment of the two-deletion embedding counts of w is strictly positive and strictly less than that of the alternating word starting with false, then the Rényi entropy of order α of the two-deletion posterior for the alternating word is strictly less than that for w.
theorem two_deletion_posterior_renyi_lt_of_moment_lt (α : ℝ) (hα : 1 < α) (n : ℕ) (hn : 2 ≤ n) (w : Fin n → Bool) (hpos : 0 < ∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n w y : ℝ)) ^ α) (hlt : (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n w y : ℝ)) ^ α) < ∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n (alternating_word n false) y : ℝ)) ^ α) : renyi_entropy α (two_deletion_posterior n (alternating_word n false)) < renyi_entropy α (two_deletion_posterior n w)
two_deletion_posterior_renyi_of_num_embeddings_momentsIn LeanInformation Theory & Coding
Analytic bridge: if the α-moment of the two-deletion embedding-count histogram of w is at most that of the alternating word, with equality exactly for alternating words, then the same two conclusions hold for the Rényi entropies of the corresponding two-deletion posteriors, for every 0 < α < 1.
theorem two_deletion_posterior_renyi_of_num_embeddings_moments (α : ℝ) (hα0 : 0 < α) (hα1 : α < 1) (n : ℕ) (hn : 2 ≤ n) (w : Fin n → Bool) (h : (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n w y : ℝ)) ^ α) ≤ (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n (alternating_word n false) y : ℝ)) ^ α) ∧ (((∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n w y : ℝ)) ^ α) = (∑ y : Fin (n + 2) → Bool, ((two_deletion_num_embeddings n (alternating_word n false) y : ℝ)) ^ α)) ↔ is_alternating_word w)) : renyi_entropy α (two_deletion_posterior n w) ≤ renyi_entropy α (two_deletion_posterior n (alternating_word n false)) ∧ (renyi_entropy α (two_deletion_posterior n w) = renyi_entropy α (two_deletion_posterior n (alternating_word n false)) ↔ is_alternating_word w)
two_deletion_posterior_sumIn LeanInformation Theory & Coding
For every received word w of length n, the two-deletion posterior two_deletion_posterior n w is a probability distribution on words of length n + 2: its values sum to 1.
theorem two_deletion_posterior_sum (n : ℕ) (w : Fin n → Bool) : (∑ y : Fin (n + 2) → Bool, two_deletion_posterior n w y) = 1
two_deletion_rank_gap_le_twoIn LeanInformation Theory & Coding
Let S, T be the two-element sets of positions deleted from a word of length N, and p a position outside both. The rank of p among the complement of S differs from its rank among the complement of T by at most 2 (in absolute value).
theorem two_deletion_rank_gap_le_two {N : ℕ} (S T : Finset (Fin N)) (hS : S.card = 2)
(hT : T.card = 2) (p : Fin N) (hpS : p ∉ S) (hpT : p ∉ T) :
(((Finset.univ \ S).filter (fun q => q < p)).card : ℤ) -
(((Finset.univ \ T).filter (fun q => q < p)).card : ℤ) ≤ 2two_four_code_max_card_ne_of_exists_codeIn LeanInformation Theory & Coding
If there exists a $q$-ary $\{2, 4\}$-code $C$ of length $n$ with $|C| > 1 + \binom{n}{2}$, then $A_q(n, \{2, 4\}) \ne 1 + \binom{n}{2}$.
theorem two_four_code_max_card_ne_of_exists_code (q n : ℕ) (C : Finset (Fin n → Fin q))
(hC_code : is_two_four_code (C : Set (Fin n → Fin q)))
(hC_card : 1 + Nat.choose n 2 < C.card) :
two_four_code_max_card q n ≠ 1 + Nat.choose n 2two_insertion_collision_defect_cost_lower_boundIn LeanInformation Theory & Coding
For n ≥ 20 and every admissible block length k (1 ≤ k ≤ (n-2)/3 - 1), the balanced-block cost is at least 2√2·n^{3/2} - 5n - 15: two_insertion_collision_defect_cost n k + 5n + 15 ≥ 2√2 n^{3/2}. This is the tight direction: the constant 2√2 is exactly the minimum of 2sn + n^2/s over s > 0.
theorem two_insertion_collision_defect_cost_lower_bound (n k : ℕ) (hn : 20 ≤ n) (hk : 1 ≤ k)
(hK : k ≤ (n - 2) / 3 - 1) :
2 * Real.sqrt 2 * (n : ℝ) ^ ((3 : ℝ) / 2) ≤
(two_insertion_collision_defect_cost n k : ℝ) + 5 * (n : ℝ) + 15two_insertion_collision_defect_cost_valuesIn LeanInformation Theory & Coding
Concrete values of the balanced-block cost: two_insertion_collision_defect_cost 5 1 = 10, and at n = 16 the three admissible block lengths give 136 (k = 1), 132 (k = 2), 148 (k = 3), whose minimum yields two_insertion_collision_defect_envelope 16 = 120 + 132 = 252. The value 132 agrees with the exhaustively computed excess min_two_insertion_collision 16 - 16.choose 2 = 132.
theorem two_insertion_collision_defect_cost_values :
two_insertion_collision_defect_cost 5 1 = 10 ∧
two_insertion_collision_defect_cost 16 1 = 136 ∧
two_insertion_collision_defect_cost 16 2 = 132 ∧
two_insertion_collision_defect_cost 16 3 = 148 ∧
two_insertion_collision_defect_envelope 16 = 252two_insertion_collision_defect_cost_witnessIn LeanInformation Theory & Coding
For every n ≥ 20 there is an admissible block length k (2 ≤ k ≤ (n-2)/3 - 1) whose balanced-block cost is at most 2√2·n^{3/2} + 8n; concretely k = Nat.sqrt (n/2) works. Together with two_insertion_collision_defect_cost_lower_bound this pins the minimum of the cost to 2√2 n^{3/2} + O(n).
theorem two_insertion_collision_defect_cost_witness (n : ℕ) (hn : 20 ≤ n) :
∃ k : ℕ, 2 ≤ k ∧ k ≤ (n - 2) / 3 - 1 ∧
(two_insertion_collision_defect_cost n k : ℝ) ≤
2 * Real.sqrt 2 * (n : ℝ) ^ ((3 : ℝ) / 2) + 8 * (n : ℝ)two_insertion_collision_defect_envelope_defect_asymptoticIn LeanInformation Theory & Coding
The excess of the defect envelope over n.choose 2, normalised by n^{3/2}, tends to 2√2: (two_insertion_collision_defect_envelope n - n.choose 2)/n^{3/2} → 2·Real.sqrt 2 as n → ∞. This is the exact analytic form of the target statement, with the minimum over words replaced by the balanced-block envelope.
theorem two_insertion_collision_defect_envelope_defect_asymptotic :
Filter.Tendsto
(fun n : ℕ =>
((two_insertion_collision_defect_envelope n : ℝ) - (n.choose 2 : ℝ)) / (n : ℝ) ^ ((3 : ℝ) / 2))
Filter.atTop (nhds (2 * Real.sqrt 2))two_insertion_collision_defect_envelope_defect_minIn LeanInformation Theory & Coding
For every n, the defect two_insertion_collision_defect_envelope n - n.choose 2 is exactly the minimum of two_insertion_collision_defect_cost n over the admissible block lengths K = {1} ∪ {k : 2 ≤ k ≤ (n-2)/3 - 1}: it is attained at some k ∈ K and is ≤ two_insertion_collision_defect_cost n k for every k ∈ K.
theorem two_insertion_collision_defect_envelope_defect_min (n : ℕ) :
(∃ k ∈ Insert.insert 1 (Finset.Icc 2 ((n - 2) / 3 - 1)),
two_insertion_collision_defect_envelope n - n.choose 2 = two_insertion_collision_defect_cost n k) ∧
(∀ k ∈ Insert.insert 1 (Finset.Icc 2 ((n - 2) / 3 - 1)),
two_insertion_collision_defect_envelope n - n.choose 2 ≤ two_insertion_collision_defect_cost n k)two_insertion_collision_eq_collision_embedding_pair_countIn LeanInformation Theory & Coding
The two-insertion collision sum of w equals the number of ordered pairs of strictly increasing embeddings Fin m → Fin (m+2) that read the same sub-word off w: ∑_u (#embeddings giving u)^2 = #{(f,g) : StrictMono f ∧ StrictMono g ∧ ∀ i, w (f i) = w (g i)}.
theorem two_insertion_collision_eq_collision_embedding_pair_count (m : ℕ) (w : Fin (m + 2) → Bool) :
two_insertion_collision m w = collision_embedding_pair_count m wuniform_distribution_shannon_entropyIn LeanInformation Theory & Coding
For any finite nonempty set S, the sum over s ∈ S of Real.negMulLog ((S.card : ℝ)⁻¹) equals Real.log (S.card : ℝ).
theorem uniform_distribution_shannon_entropy {α : Type*} (S : Finset α) (hne : S.Nonempty) :
∑ _s ∈ S, Real.negMulLog ((S.card : ℝ)⁻¹) = Real.log (S.card : ℝ)wgfhs_min_gap_bound_s5In LeanInformation Theory & Coding
For alphabet size s = 5, every optimal uniform wide-gap frequency hopping sequence satisfies the min gap bound e <= ((5 - 1) / 2) - 2 = 0.
theorem wgfhs_min_gap_bound_s5
(k : ℕ) [NeZero (k * 5)] (hk : 4 ≤ k) (hs_le : 5 ≤ k * (k - 1) - 1)
(X : Fin (k * 5) → Fin 5)
(h_unif : is_uniform_fhs k 5 X)
(h_corr : fhs_autocorr_le X k)
(h_gap : 0 < fhs_min_gap X) :
fhs_min_gap X ≤ ((5 - 1) / 2 : ℤ) - 2spr_full_move_survivalIn LeanComputational Learning Theory
Survival rule under full deletion: after the pointer names an empty cell j and the labeler answers with the full deletable set and sign s, a cell i ≠ j holds a plus iff it held a plus before and i < j, and it holds a minus iff it held a minus before and j < i.
theorem spr_full_move_survival {n : ℕ} (b : Fin n → Option Bool) (j : Fin n) (s : Bool)
(i : Fin n) (hi : i ≠ j) :
(spr_move b j (spr_full_deletable b j) s i = some true ↔ b i = some true ∧ i < j) ∧
(spr_move b j (spr_full_deletable b j) s i = some false ↔ b i = some false ∧ j < i)spr_linear_board_one_two_sharpIn LeanComputational Learning Theory
The k = 1 case of the target: on 1 or 2 cells, spr_opt n t ≤ 1 for all t, and spr_opt n t = 1 iff t ≥ 1.
theorem spr_linear_board_one_two_sharp (n : ℕ) (hn : n = 1 ∨ n = 2)
(hone : spr_opt n 1 = 1) :
(∀ t : ℕ, spr_opt n t ≤ 1) ∧
(∀ t : ℕ, spr_opt n t = 1 ↔ 1 ≤ t)spr_linear_board_three_four_sharpIn LeanComputational Learning Theory
The k = 2 case of the target: on 3 or 4 cells, spr_opt n t ≤ 2 for all t, and spr_opt n t = 2 iff t ≥ 2.
theorem spr_linear_board_three_four_sharp (n : ℕ) (hn : n = 3 ∨ n = 4)
(h1 : spr_opt n 1 = 1) (h2 : spr_opt n 2 = 2) :
(∀ t : ℕ, spr_opt n t ≤ 2) ∧
(∀ t : ℕ, spr_opt n t = 2 ↔ 2 ≤ t)spr_opt_horizon_monoIn LeanComputational Learning Theory
The horizon lift of the target: the optimal value never decreases when the horizon grows by one.
theorem spr_opt_horizon_mono (n t : ℕ) : spr_opt n t ≤ spr_opt n (t + 1)
spr_opt_mono_horizon_leIn LeanComputational Learning Theory
spr_opt n · is monotone in the horizon: for t ≤ u, spr_opt n t ≤ spr_opt n u.
theorem spr_opt_mono_horizon_le (n : ℕ) : ∀ t u : ℕ, t ≤ u → spr_opt n t ≤ spr_opt n u
spr_opt_oneIn LeanComputational Learning Theory
With at least one round and at least one cell the pointer can secure exactly one sign: spr_opt n 1 = 1 for n ≥ 1.
theorem spr_opt_one (n : ℕ) (hn : 1 ≤ n) : spr_opt n 1 = 1
spr_opt_quadratic_lowerIn LeanComputational Learning Theory
At the triangular horizon 1 + k(k-1)/2 the pointer can secure k signs on a board of 2k-1 or 2k cells.
theorem spr_opt_quadratic_lower (k : ℕ) (hk : 1 ≤ k) (n : ℕ)
(hn : n = 2 * k - 1 ∨ n = 2 * k) :
k ≤ spr_opt n (1 + k * (k - 1) / 2)spr_opt_quadratic_upperIn LeanComputational Learning Theory
Sharp horizon upper bound, valid for every board size n: if the horizon is below the m-th triangular threshold, the value is at most m - 1. Equivalently spr_opt n t ≤ max{k : 1 + k(k-1)/2 ≤ t}.
theorem spr_opt_quadratic_upper (m n t : ℕ) (hm : 1 ≤ m) (ht : t < 1 + m * (m - 1) / 2) :
spr_opt n t ≤ m - 1spr_sorted_full_moveIn LeanComputational Learning Theory
Full deletion preserves sortedness: if the board is sorted, then after any pointer move j and the labeler's full-deletion answer with sign s, the board is still sorted (all pluses left of all minuses).
theorem spr_sorted_full_move {n : ℕ} (b : Fin n → Option Bool) (j : Fin n) (s : Bool)
(hb : spr_sorted b) : spr_sorted (spr_move b j (spr_full_deletable b j) s)spr_value_eq_full_deletionIn LeanComputational Learning Theory
Full deletion is an optimal labeler reply: with at least one round left the minimax value is the maximum of the current sign count and the sup over empty cells j of the min over the two signs of the value reached by deleting every deletable sign. Equivalently, the infimum over admissible (R, s) pairs equals the infimum over the two pairs (full deletable set, true) and (full deletable set, false).
theorem spr_value_eq_full_deletion (n r : ℕ) (b : Fin n → Option Bool) :
spr_value n (r + 1) b = max (spr_sign_count b)
((Finset.univ.filter (fun j => b j = none)).sup (fun j =>
(Finset.univ : Finset Bool).inf' Finset.univ_nonempty
(fun s => spr_value n r (spr_move b j (spr_full_deletable b j) s))))op75_compact_network_encoding_boundIn LeanNP-Completeness & Reductions
The length of the binary encoding of the explicit network is at most 2000 times one plus the target encoding length and the sum, over weights, of one plus each weight encoding length.
theorem op75_compact_network_encoding_bound (as : List ℕ) (t : ℕ) : (relu_network3_encode (op75_compact_network as t)).length ≤ 2000 * (1 + (as.map fun a => (relu_encode_nat a).length + 1).sum + (relu_encode_nat t).length)
op75_compact_network_encoding_exactIn LeanNP-Completeness & Reductions
The binary encoding of the explicit network has length 124 plus 511 times the number of weights plus twice the sum of the natural-number encoding lengths of the weights and target.
theorem op75_compact_network_encoding_exact (as : List ℕ) (t : ℕ) : (relu_network3_encode (op75_compact_network as t)).length = 124 + 511 * as.length + 2 * ((as.map fun a => (relu_encode_nat a).length).sum + (relu_encode_nat t).length)
op75_compact_network_lengthIn LeanNP-Completeness & Reductions
The explicit subset-sum network has seven hidden layers per input weight and one final hidden layer.
theorem op75_compact_network_length (as : List ℕ) (t : ℕ) : (op75_compact_network as t).layers.length = 7 * as.length + 1
op75_relu_poly_size_zero_witnessIn LeanNP-Completeness & Reductions
Every rational width-three network that has a real zero on the unit interval has a rational zero whose encoded length is bounded by one polynomial in the network encoding length; this does not by itself construct a polynomial-time verifier.
theorem op75_relu_poly_size_zero_witness : ∃ P : Polynomial ℕ, ∀ net : ReLUNetwork 3, relu_network_has_unit_interval_zero net → ∃ q : ℚ, (q : ℝ) ∈ Set.Icc (0 : ℝ) 1 ∧ evalNetwork net (q : ℝ) = 0 ∧ (relu_encode_rat q).length ≤ P.eval (relu_network3_encode net).length
op75_relu_rational_zero_witnessIn LeanNP-Completeness & Reductions
If a rational-weight feedforward ReLU network has a real zero on the unit interval, it also has a rational zero there. This is an existence lemma only; NP membership additionally requires a polynomial bound on the witness encoding and a polynomial-time verifier.
theorem op75_relu_rational_zero_witness {k : ℕ} (net : ReLUNetwork k) : relu_network_has_unit_interval_zero net → ∃ q : ℚ, (q : ℝ) ∈ Set.Icc (0 : ℝ) 1 ∧ evalNetwork net (q : ℝ) = 0op75_subset_compiler_polynomial_timeIn LeanNP-Completeness & Reductions
The explicit total subset-sum to network compiler is computed by a finite TM2 in polynomial time.
theorem op75_subset_compiler_polynomial_time : Nonempty (Turing.TM2ComputableInPolyTime (id : List Bool → List Bool) (id : List Bool → List Bool) op75_subset_compiler_function)
op75_subset_encoding_lengthIn LeanNP-Completeness & Reductions
The subset-sum source word length is one plus the sum over weights of one plus the length of the weight encoding, plus the target encoding length.
theorem op75_subset_encoding_length (as : List ℕ) (t : ℕ) : (op75_subset_encoding as t).length = 1 + (as.map fun a => (relu_encode_nat a).length + 1).sum + (relu_encode_nat t).length
colors_used_ge_of_color_classes_le_twoIn LeanOnline Algorithms
For any vertex coloring c : Fin n → ℕ, if every color is assigned to at most two vertices, then the number of distinct colors used by c is at least (n : ℝ) / 2.
theorem colors_used_ge_of_color_classes_le_two {n : ℕ} (c : Fin n → ℕ)
(h : ∀ col : ℕ, (Finset.univ.filter (fun v => c v = col)).card ≤ 2) :
(n : ℝ) / 2 ≤ (colorsUsed c : ℝ)cumulative_empirical_transport_cost_le_two_subset_costIn LeanOnline Algorithms
For every metric space X and every server placement s : Fin n → X, the sum of expected empirical transport costs is bounded by twice the sum of expected subset transport costs: ∑_{t=1}^n f_t ≤ 2 * ∑_{k=1}^n g_k.
theorem cumulative_empirical_transport_cost_le_two_subset_cost
{X : Type*} [PseudoMetricSpace X] (n : ℕ) (s : Fin n → X) :
∑ t ∈ Finset.Icc 1 n, empirical_expected_transport_cost n s t ≤
2 * ∑ k ∈ Finset.Icc 1 n, subset_expected_transport_cost n s kcut_requests_sublist_of_circumferenceIn LeanOnline Algorithms
Let V be a type, and let min_cuts_G and min_cuts_H be sets of finite vertex cuts in V satisfying min_cuts_G ⊆ min_cuts_H. Then for every list reqs of cuts whose elements belong to min_cuts_G, every cut in reqs also belongs to min_cuts_H.
theorem cut_requests_sublist_of_circumference {V : Type*}
(min_cuts_G min_cuts_H : Set (Finset V)) (h_circumference : min_cuts_G ⊆ min_cuts_H)
(reqs : List (Finset V)) (hreqs : ∀ c ∈ reqs, c ∈ min_cuts_G) :
∀ c ∈ reqs, c ∈ min_cuts_Hcycle_gap_merge_lengthIn LeanOnline Algorithms
Merging adjacent gaps at index i in a cycle with at least two gaps reduces the number of gaps by 1.
theorem cycle_gap_merge_length (g : List ℕ) (i : ℕ) (hg : 2 ≤ g.length) :
(cycle_gap_merge g i).length = g.length - 1cycle_gap_merge_sumIn LeanOnline Algorithms
Merging adjacent gaps in a cycle preserves the total circumference (the sum of gap lengths).
theorem cycle_gap_merge_sum (g : List ℕ) (i : ℕ) (hg : 2 ≤ g.length) :
(cycle_gap_merge g i).sum = g.sumcycle_greedy_gap_rotation_sumIn LeanOnline Algorithms
Summing any function of the left-hand gap of each boundary over all boundaries of a cyclic gap list gives the same total as summing it over the gaps themselves: ∑_{i < g.length} f (g[(i - 1) mod g.length]) = ∑_{i < g.length} f (g[i]).
theorem cycle_greedy_gap_rotation_sum (g : List ℕ) (f : ℕ → ℚ) :
(∑ i ∈ Finset.range g.length, f (g[(i + g.length - 1) % g.length]?.getD 0)) =
∑ i ∈ Finset.range g.length, f (g[i]?.getD 0)cycle_greedy_mean_defect_recursionIn LeanOnline Algorithms
For a gap configuration of total circumference n with at least two gaps, the mean defect U(g) = 4n·(mean component of the DP at g) - n satisfies U(g) = ∑_i g_i^2 + (1/(2n))·∑_i (g_{i-1} + g_i)·U(merge_i g), where the inner sum runs over the boundaries of the cycle.
theorem cycle_greedy_mean_defect_recursion (n : ℕ) (hn : 0 < n) (g : List ℕ) (hg : 2 ≤ g.length)
(hsum : g.sum = n) :
4 * (n : ℚ) * (cycle_greedy_moments n g).1 - (n : ℚ) =
(∑ i ∈ Finset.range g.length, ((((g[i]?.getD 0 : ℕ)) : ℚ) ^ 2)) +
(1 / (2 * (n : ℚ))) *
∑ i ∈ Finset.range g.length,
((((g[(i + g.length - 1) % g.length]?.getD 0 : ℕ)) : ℚ) +
(((g[i]?.getD 0 : ℕ)) : ℚ)) *
(4 * (n : ℚ) * (cycle_greedy_moments n (cycle_gap_merge g i)).1 - (n : ℚ))cycle_greedy_mean_exactIn LeanOnline Algorithms
For every integer n ≥ 2, the expected total greedy assignment cost on an n-cycle equals (n / 4) * S_n.
theorem cycle_greedy_mean_exact (n : ℕ) (hn : 2 ≤ n) :
cycle_greedy_mean n = (n : ℚ) * cycle_greedy_s n / 4cycle_greedy_mean_step_expansionIn LeanOnline Algorithms
The mean component of the DP, on a configuration with at least two gaps, equals the sum over all boundaries i of the immediate expected cost (l^2 + r^2)/(8n) at that boundary plus the transition probability (l + r)/(2n) times the mean value of the merged configuration, where l = g[i-1] and r = g[i] are the two adjacent gaps.
theorem cycle_greedy_mean_step_expansion (n : ℕ) (g : List ℕ) (hg : 2 ≤ g.length) :
(cycle_greedy_moments n g).1 =
Finset.sum (Finset.range g.length) (fun i =>
((((g[(i + g.length - 1) % g.length]?.getD 0 : ℕ)) : ℚ) ^ 2 +
(((g[i]?.getD 0 : ℕ)) : ℚ) ^ 2) / (8 * (n : ℚ)) +
((((g[(i + g.length - 1) % g.length]?.getD 0 : ℕ)) : ℚ) +
(((g[i]?.getD 0 : ℕ)) : ℚ)) / (2 * (n : ℚ)) *
(cycle_greedy_moments n (cycle_gap_merge g i)).1)cycle_greedy_moment_one_structureIn LeanOnline Algorithms
There exist polynomials P and Q over the rationals with deg P ≤ 1 and deg Q ≤ 0 such that for every integer n ≥ 2, the first raw moment of greedy assignment cost satisfies cycle_greedy_raw_moment 1 n = P(n) + Q(n) * cycle_greedy_known_mean n.
theorem cycle_greedy_moment_one_structure :
∃ (P Q : Polynomial ℚ),
P.degree ≤ ((3 * 1 / 2 : ℕ) : WithBot ℕ) ∧
Q.degree ≤ (((3 * 1 - 3) / 2 : ℕ) : WithBot ℕ) ∧
∀ (n : ℕ), 2 ≤ n →
cycle_greedy_raw_moment 1 n = P.eval (n : ℚ) + Q.eval (n : ℚ) * cycle_greedy_known_mean ncycle_greedy_moment_two_structureIn LeanOnline Algorithms
There exist polynomials P and Q over the rationals with deg P ≤ 3 and deg Q ≤ 1 such that for every integer n ≥ 2, the second raw moment of greedy assignment cost satisfies cycle_greedy_raw_moment 2 n = P(n) + Q(n) * cycle_greedy_known_mean n.
theorem cycle_greedy_moment_two_structure :
∃ (P Q : Polynomial ℚ),
P.degree ≤ ((3 * 2 / 2 : ℕ) : WithBot ℕ) ∧
Q.degree ≤ (((3 * 2 - 3) / 2 : ℕ) : WithBot ℕ) ∧
∀ (n : ℕ), 2 ≤ n →
cycle_greedy_raw_moment 2 n = P.eval (n : ℚ) + Q.eval (n : ℚ) * cycle_greedy_known_mean ncycle_greedy_moments_all_fuel_lengthIn LeanOnline Algorithms
For positive fuel, the all-fuel moment DP returns a list of exactly k_max + 1 entries (slots 0, …, k_max), whatever the circumference and gap configuration.
theorem cycle_greedy_moments_all_fuel_length (fuel k_max n : ℕ) (g : List ℕ) (hf : 1 ≤ fuel) :
(cycle_greedy_moments_all_fuel fuel k_max n g).length = k_max + 1cycle_greedy_moments_all_fuel_one_eq_mean_fuelIn LeanOnline Algorithms
For every fuel, circumference and gap configuration, slot 1 (the first raw moment) of the all-fuel moment DP equals the mean component of the two-tuple moment DP at the same fuel.
theorem cycle_greedy_moments_all_fuel_one_eq_mean_fuel (fuel n : ℕ) (g : List ℕ) :
(cycle_greedy_moments_all_fuel fuel 1 n g).getD 1 0 = (cycle_greedy_moments_fuel fuel n g).1cycle_greedy_moments_all_fuel_zero_slotIn LeanOnline Algorithms
For positive fuel, slot 0 of the all-fuel moment DP — the total probability mass, i.e. the zeroth raw moment — is pinned to 1 for every circumference and gap configuration.
theorem cycle_greedy_moments_all_fuel_zero_slot (fuel k_max n : ℕ) (g : List ℕ) (hf : 1 ≤ fuel) :
(cycle_greedy_moments_all_fuel fuel k_max n g).getD 0 0 = 1cycle_greedy_moments_induction_stepIn LeanOnline Algorithms
For every integer k ≥ 1, assuming all lower raw moments j < k admit rational polynomials P_j, Q_j with deg P_j ≤ ⌊3j/2⌋ and deg Q_j ≤ ⌊(3j-3)/2⌋ satisfying cycle_greedy_raw_moment j n = P_j(n) + Q_j(n) * cycle_greedy_known_mean n for all n ≥ 2, the k-th raw moment also admits polynomials P_k, Q_k with deg P_k ≤ ⌊3k/2⌋ and deg Q_k ≤ ⌊(3k-3)/2⌋ satisfying the same representation.
theorem cycle_greedy_moments_induction_step (k : ℕ) (hk : 1 ≤ k)
(ih : ∀ (j : ℕ), 1 ≤ j → j < k →
∃ (P Q : Polynomial ℚ),
P.degree ≤ ((3 * j / 2 : ℕ) : WithBot ℕ) ∧
Q.degree ≤ (((3 * j - 3) / 2 : ℕ) : WithBot ℕ) ∧
∀ (n : ℕ), 2 ≤ n →
cycle_greedy_raw_moment j n = P.eval (n : ℚ) + Q.eval (n : ℚ) * cycle_greedy_known_mean n) :
∃ (P Q : Polynomial ℚ),
P.degree ≤ ((3 * k / 2 : ℕ) : WithBot ℕ) ∧
Q.degree ≤ (((3 * k - 3) / 2 : ℕ) : WithBot ℕ) ∧
∀ (n : ℕ), 2 ≤ n →
cycle_greedy_raw_moment k n = P.eval (n : ℚ) + Q.eval (n : ℚ) * cycle_greedy_known_mean ncycle_greedy_moments_terminalIn LeanOnline Algorithms
A gap configuration with at most one gap is terminal: its exact expected cost is g.sum / 4 and its exact second moment is g.sum ^ 2 / 12 (evaluated at the given circumference parameter n, which is irrelevant here).
theorem cycle_greedy_moments_terminal (n : ℕ) (g : List ℕ) (h : g.length ≤ 1) :
cycle_greedy_moments n g = ((g.sum : ℚ) / 4, (g.sum : ℚ) ^ 2 / 12)cycle_greedy_moments_two_gapsIn LeanOnline Algorithms
On a cycle of circumference n with exactly two gaps a and b (so a + b = n), the exact expected cost is (a^2 + b^2)/(4n) + n/4 and the exact second moment is (a^3 + b^3)/(12n) + (a^2 + b^2)/8 + n^2/12.
theorem cycle_greedy_moments_two_gaps (n a b : ℕ) (hn : 0 < n) (hab : a + b = n) :
cycle_greedy_moments n [a, b] =
(((a : ℚ) ^ 2 + (b : ℚ) ^ 2) / (4 * (n : ℚ)) + (n : ℚ) / 4,
((a : ℚ) ^ 3 + (b : ℚ) ^ 3) / (12 * (n : ℚ)) + ((a : ℚ) ^ 2 + (b : ℚ) ^ 2) / 8 +
(n : ℚ) ^ 2 / 12)cycle_greedy_moments_unfoldIn LeanOnline Algorithms
One-step unfolding of the moment recursion at fuel equal to the number of gaps: for a gap list of length at least two, cycle_greedy_moments n g is the List.foldl over List.range g.length of the Bellman step in which the recursive value at boundary i is cycle_greedy_moments n (cycle_gap_merge g i) (not a fuel-indexed call).
theorem cycle_greedy_moments_unfold (n : ℕ) (g : List ℕ) (hg : 2 ≤ g.length) :
cycle_greedy_moments n g =
(List.range g.length).foldl
(fun acc i =>
let l : ℚ := ((g[(i + g.length - 1) % g.length]?.getD 0 : ℕ) : ℚ)
let r : ℚ := ((g[i]?.getD 0 : ℕ) : ℚ)
let sub := cycle_greedy_moments n (cycle_gap_merge g i)
let p : ℚ := (l + r) / (2 * (n : ℚ))
let c : ℚ := (l ^ 2 + r ^ 2) / (8 * (n : ℚ))
let d : ℚ := (l ^ 3 + r ^ 3) / (24 * (n : ℚ))
(acc.1 + c + p * sub.1, acc.2 + d + 2 * c * sub.1 + p * sub.2))
(0, 0)cycle_greedy_raw_moment_one_eq_known_meanIn LeanOnline Algorithms
For every integer n ≥ 2, the first raw moment of total greedy assignment cost on an n-cycle satisfies cycle_greedy_raw_moment 1 n = cycle_greedy_known_mean n.
theorem cycle_greedy_raw_moment_one_eq_known_mean (n : ℕ) (hn : 2 ≤ n) :
cycle_greedy_raw_moment 1 n = cycle_greedy_known_mean ncycle_greedy_raw_moment_one_eq_meanIn LeanOnline Algorithms
For every natural n, the first raw moment of total greedy assignment cost on an n-cycle equals the mean value cycle_greedy_mean n of the two-tuple moment DP on the uniform configuration.
theorem cycle_greedy_raw_moment_one_eq_mean (n : ℕ) :
cycle_greedy_raw_moment 1 n = cycle_greedy_mean ncycle_greedy_raw_moment_two_eq_formulaIn LeanOnline Algorithms
For every integer n ≥ 2, the second raw moment of total greedy assignment cost on an n-cycle satisfies cycle_greedy_raw_moment 2 n = (5 * n^3 + n^2) / 48 - n * cycle_greedy_known_mean n / 6.
theorem cycle_greedy_raw_moment_two_eq_formula (n : ℕ) (hn : 2 ≤ n) :
cycle_greedy_raw_moment 2 n =
(5 * (n : ℚ) ^ 3 + (n : ℚ) ^ 2) / 48 - (n : ℚ) * cycle_greedy_known_mean n / 6cycle_greedy_second_moment_fiveIn LeanOnline Algorithms
For n = 5 the exact rational second moment equals the conjectured closed form; both sides are 1639/150.
theorem cycle_greedy_second_moment_five :
cycle_greedy_second_moment 5 = cycle_greedy_second_moment_formula 5cycle_greedy_second_moment_fourIn LeanOnline Algorithms
For n = 4 the exact rational second moment equals the conjectured closed form; both sides are 265/48.
theorem cycle_greedy_second_moment_four :
cycle_greedy_second_moment 4 = cycle_greedy_second_moment_formula 4cycle_greedy_second_moment_from_mean_identitiesIn LeanOnline Algorithms
If the exact mean is n·S_n/4 and the second moment satisfies m2 = (5n^3+n^2)/48 - (n/6)·m1, then the second moment equals the conjectured closed form.
theorem cycle_greedy_second_moment_from_mean_identities (n : ℕ) (hn : 2 ≤ n)
(hmean : cycle_greedy_mean n = (n : ℚ) * cycle_greedy_s n / 4)
(hred : cycle_greedy_second_moment n =
(5 * (n : ℚ) ^ 3 + (n : ℚ) ^ 2) / 48 - (n : ℚ) * cycle_greedy_mean n / 6) :
cycle_greedy_second_moment n = cycle_greedy_second_moment_formula ncycle_greedy_second_moment_reductionIn LeanOnline Algorithms
For every integer n ≥ 2, the exact rational second moment of the greedy online assignment cost on an n-cycle satisfies the reduction to the mean: E[C_n^2] = (5n^3 + n^2)/48 - (n/6) E[C_n].
theorem cycle_greedy_second_moment_reduction (n : ℕ) (hn : 2 ≤ n) :
cycle_greedy_second_moment n = (5 * (n : ℚ) ^ 3 + (n : ℚ) ^ 2) / 48 - (n : ℚ) * cycle_greedy_mean n / 6deterministic_online_coloring_lemma_four_threeIn LeanOnline Algorithms
For every positive integer ℓ and every natural number n ≤ 2 ^ ℓ, and for every deterministic online coloring algorithm A on simple graphs on Fin n that properly colors (2 * ℓ)-colorable graphs, there exists a simple graph G on Fin n with chromatic number at most 2 * ℓ such that A uses at least (n : ℝ) / 2 colors on G.
theorem deterministic_online_coloring_lemma_four_three (ℓ : ℕ) (hℓ : 1 ≤ ℓ)
(n : ℕ) (hn : n ≤ 2 ^ ℓ)
(A : SimpleGraph (Fin n) → (Fin n → ℕ))
(hA : IsOnlineColoringAlg A)
(hproper : ProperlyColorsKColorable (2 * ℓ) A) :
∃ G : SimpleGraph (Fin n),
G.chromaticNumber ≤ ↑(2 * ℓ) ∧
(n : ℝ) / 2 ≤ (colorsUsed (A G) : ℝ)deterministic_online_coloring_lower_boundIn LeanOnline Algorithms
For every natural number n ≥ 2 and every deterministic online coloring algorithm A on simple graphs on Fin n that properly colors (2 * Nat.ceil (Real.log (n : ℝ) / Real.log 2))-colorable graphs, there exists a simple graph G on Fin n whose chromatic number is at most 2 * Nat.ceil (Real.log (n : ℝ) / Real.log 2) such that A uses at least (n : ℝ) / 2 colors on G.
theorem deterministic_online_coloring_lower_bound (n : ℕ) (hn : 2 ≤ n)
(A : SimpleGraph (Fin n) → (Fin n → ℕ))
(hA : IsOnlineColoringAlg A)
(hproper : ProperlyColorsKColorable (2 * Nat.ceil (Real.log (n : ℝ) / Real.log 2)) A) :
∃ G : SimpleGraph (Fin n),
G.chromaticNumber ≤ ↑(2 * Nat.ceil (Real.log (n : ℝ) / Real.log 2)) ∧
(n : ℝ) / 2 ≤ (colorsUsed (A G) : ℝ)dp_suffix_val_zero_telescopingIn LeanOnline Algorithms
Given a measure space (Ω, P), n random variables X : Fin n → Ω → ℝ, and rate r : ℝ, the initial DP value dp_suffix_val P n X r 0 equals r * ∑ i : Fin n, ∫ ω, max (X i ω - dp_threshold P n X r i) 0 ∂P.
open MeasureTheory ProbabilityTheory Finset in
theorem dp_suffix_val_zero_telescoping {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
(n : ℕ) (X : Fin n → Ω → ℝ) (r : ℝ) :
dp_suffix_val P n X r 0 = r * ∑ i : Fin n, ∫ ω, max (X i ω - dp_threshold P n X r i) 0 ∂Pdp_threshold_le_val_zeroIn LeanOnline Algorithms
For any measure space (Ω, P), random variables X : Fin n → Ω → ℝ, rate r with 0 ≤ r, and index i : Fin n, the threshold dp_threshold P n X r i is at most dp_suffix_val P n X r 0.
open MeasureTheory ProbabilityTheory Finset in
theorem dp_threshold_le_val_zero {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
(n : ℕ) (X : Fin n → Ω → ℝ) (r : ℝ) (hr : 0 ≤ r) (i : Fin n) :
dp_threshold P n X r i ≤ dp_suffix_val P n X r 0drf_prop1_instance_existsIn LeanOnline Algorithms
For every parameter m ≥ 1, there exists a two-resource multidimensional scheduling instance I such that the one-shot DRF completion time is at least drf_prop1_alg 2 m and the offline optimum is positive and at most drf_prop1_opt_bound 2 m.
theorem drf_prop1_instance_exists (m : ℕ) (hm : 1 ≤ m) : ∃ I : MultidimInstance2, drf_prop1_alg 2 m ≤ oneshot_drf_total_completion_time2 I ∧ multidim_opt2 I ≤ drf_prop1_opt_bound 2 m ∧ 0 < multidim_opt2 I
electrical_flow_characterization_and_energy_expansionIn LeanOnline Algorithms
Let d be a symmetric matrix of positive resistances on distinct pairs in Fin k. For every zero-sum vector a, the minimum defining electrical energy E(a) is attained by some feasible flow. A feasible flow F for demand a achieves this minimum energy E(a) if and only if there exist real voltages h : Fin k → ℝ such that d i j * F i j = h i - h j for all i ≠ j. Furthermore, for any such feasible flow F satisfying these voltage equations and any zero-sum vector b, E(a + b) = E(a) + 2 * (∑ i, b i * h i) + E(b).
theorem electrical_flow_characterization_and_energy_expansion
{k : ℕ} (d : Fin k → Fin k → ℝ)
(hd_symm : ∀ i j, d i j = d j i)
(hd_pos : ∀ i j, i ≠ j → 0 < d i j) :
(∀ a : Fin k → ℝ, (∑ i, a i = 0) →
∃ F, is_feasible_flow F a ∧ electrical_flow_energy d F = electrical_energy d a) ∧
(∀ (a : Fin k → ℝ) (F : Fin k → Fin k → ℝ),
is_feasible_flow F a →
((electrical_flow_energy d F = electrical_energy d a) ↔
∃ h : Fin k → ℝ, ∀ i j, i ≠ j → d i j * F i j = h i - h j)) ∧
(∀ (a b : Fin k → ℝ) (F : Fin k → Fin k → ℝ) (h : Fin k → ℝ),
(∑ i, a i = 0) → (∑ i, b i = 0) →
is_feasible_flow F a →
(∀ i j, i ≠ j → d i j * F i j = h i - h j) →
electrical_energy d (a + b) =
electrical_energy d a + 2 * (∑ i, b i * h i) + electrical_energy d b)electrical_flow_edge_boundIn LeanOnline Algorithms
For any finite index set Fin k with resistances strictly positive on distinct pairs (d i j > 0 for all i ≠ j), any feasible flow F for divergence a (satisfying is_feasible_flow F a) with voltages h satisfying d i j * F i j = h i - h j for all i ≠ j has edge flows bounded by the total positive excess: |F i j| ≤ ∑ l : Fin k, max (a l) 0 for all i, j.
open Finset in
theorem electrical_flow_edge_bound
{k : ℕ} (d : Fin k → Fin k → ℝ) (F : Fin k → Fin k → ℝ) (h a : Fin k → ℝ)
(hd_pos : ∀ i j, i ≠ j → 0 < d i j)
(hF : is_feasible_flow F a)
(h_volt : ∀ i j, i ≠ j → d i j * F i j = h i - h j)
(i j : Fin k) :
|F i j| ≤ ∑ l : Fin k, max (a l) 0electrical_flow_energy_sum_expansionIn LeanOnline Algorithms
For any skew-symmetric flow F on Fin k satisfying the voltage law d i j * F i j = h i - h j for all i ≠ j and any feasible flow G with divergence b, the electrical energy of F + G equals the energy of F plus 2 * (∑ i, b i * h i) plus the energy of G.
theorem electrical_flow_energy_sum_expansion {k : ℕ} (d : Fin k → Fin k → ℝ)
(F G : Fin k → Fin k → ℝ) (h b : Fin k → ℝ)
(hF_skew : ∀ i j, F i j = -F j i)
(hF_volt : ∀ i j, i ≠ j → d i j * F i j = h i - h j)
(hG : is_feasible_flow G b) :
electrical_flow_energy d (fun i j => F i j + G i j) =
electrical_flow_energy d F + 2 * (∑ i, b i * h i) + electrical_flow_energy d Gelectrical_flow_incident_square_sum_boundIn LeanOnline Algorithms
For any finite index set Fin k with resistances strictly positive on distinct pairs (d i j > 0 for all i ≠ j), any feasible flow F for divergence a (satisfying is_feasible_flow F a) with voltages h satisfying d i j * F i j = h i - h j for all i ≠ j satisfies ∑ j with j ≠ i, (F i j)^2 ≤ 2 * (∑ l : Fin k, max (a l) 0)^2 for every vertex i.
open Finset in
theorem electrical_flow_incident_square_sum_bound
{k : ℕ} (d : Fin k → Fin k → ℝ) (F : Fin k → Fin k → ℝ) (h a : Fin k → ℝ)
(hd_pos : ∀ i j, i ≠ j → 0 < d i j)
(hF : is_feasible_flow F a)
(h_volt : ∀ i j, i ≠ j → d i j * F i j = h i - h j)
(i : Fin k) :
∑ j with j ≠ i, (F i j) ^ 2 ≤ 2 * (∑ l : Fin k, max (a l) 0) ^ 2electrical_flow_positive_edge_voltage_strict_antiIn LeanOnline Algorithms
For any skew-symmetric flow F on Fin k (F i j = -F j i for all i, j) satisfying the voltage law d i j * F i j = h i - h j for all i ≠ j with resistances strictly positive on distinct pairs (d i j > 0 for all i ≠ j), every edge with strictly positive flow F i j > 0 has strictly decreasing voltage h j < h i.
theorem electrical_flow_positive_edge_voltage_strict_anti
{k : ℕ} (d : Fin k → Fin k → ℝ) (F : Fin k → Fin k → ℝ) (h : Fin k → ℝ)
(hF_skew : ∀ i j, F i j = -F j i)
(hd_pos : ∀ i j, i ≠ j → 0 < d i j)
(h_volt : ∀ i j, i ≠ j → d i j * F i j = h i - h j)
(i j : Fin k) (hF_pos : 0 < F i j) :
h j < h ielectrical_flow_voltage_energy_eqIn LeanOnline Algorithms
If resistances d are nonnegative on pairs with i < j, any feasible flow F for demand a satisfying the voltage law d i j * F i j = h i - h j for all i ≠ j achieves the infimum electrical energy E(a), so electrical_flow_energy d F = electrical_energy d a.
theorem electrical_flow_voltage_energy_eq {k : ℕ} (d : Fin k → Fin k → ℝ)
(F : Fin k → Fin k → ℝ) (h a : Fin k → ℝ)
(hd_pos : ∀ i j, i < j → 0 ≤ d i j)
(hF : is_feasible_flow F a)
(hF_volt : ∀ i j, i ≠ j → d i j * F i j = h i - h j) :
electrical_flow_energy d F = electrical_energy d aelectrical_flow_voltage_is_minimizingIn LeanOnline Algorithms
If resistances d are nonnegative on pairs with i < j, any feasible flow F for demand a satisfying the voltage law d i j * F i j = h i - h j for all i ≠ j has electrical energy at most that of any other feasible flow G for demand a.
theorem electrical_flow_voltage_is_minimizing {k : ℕ} (d : Fin k → Fin k → ℝ)
(F G : Fin k → Fin k → ℝ) (h a : Fin k → ℝ)
(hd_pos : ∀ i j, i < j → 0 ≤ d i j)
(hF : is_feasible_flow F a)
(hF_volt : ∀ i j, i ≠ j → d i j * F i j = h i - h j)
(hG : is_feasible_flow G a) :
electrical_flow_energy d F ≤ electrical_flow_energy d Gelectrical_flow_voltage_stability_boundIn LeanOnline Algorithms
Let Y = (y_1, ..., y_k) be pairwise distinct points in a metric space (V, d) (with injective y : Fin k → V), let a : Fin k → ℝ be a zero-sum vector (∑ i : Fin k, a i = 0), and let T = ∑_{l=1}^k max(a_l, 0). If F is a feasible flow for excess vector a (is_feasible_flow F a) minimizing electrical energy with respect to metric resistances dist(y_i, y_j) (electrical_flow_energy (fun i j => dist (y i) (y j)) F = electrical_energy (fun i j => dist (y i) (y j)) a), and h : Fin k → ℝ is a voltage vector satisfying dist(y_i, y_j) * F_ij = h_i - h_j for all i ≠ j, then the voltages satisfy |h_i - h_j| ≤ T * dist(y_i, y_j) for all i, j in Fin k.
open Finset in
theorem electrical_flow_voltage_stability_bound
{V : Type*} [MetricSpace V] {k : ℕ} (y : Fin k → V) (hy : Function.Injective y)
(a : Fin k → ℝ) (ha_sum : ∑ i : Fin k, a i = 0)
(F : Fin k → Fin k → ℝ) (hF : is_feasible_flow F a)
(hF_min : electrical_flow_energy (fun i j => dist (y i) (y j)) F =
electrical_energy (fun i j => dist (y i) (y j)) a)
(h : Fin k → ℝ) (h_volt : ∀ i j, i ≠ j → dist (y i) (y j) * F i j = h i - h j)
(i j : Fin k) :
|h i - h j| ≤ (∑ l : Fin k, max (a l) 0) * dist (y i) (y j)electrical_serving_flow_identityIn LeanOnline Algorithms
For any natural number k, occupancy vector q : Fin k → ℤ, target index s : Fin k, and skew-symmetric flow F : Fin k → Fin k → ℝ with net outflow ∑ j, F i j = (q i : ℝ) + (if i = s then 1 else 0) - (1 + 1/k), the weighted sum ∑_{i ≠ s} q_i F_{is} equals (1 + 1/k) * (∑_{i ≠ s} F_{is}) + ∑_{i ≠ s} F_{is}^2 + ∑_{i < j, i ≠ s, j ≠ s} F_{ij} (F_{is} - F_{js}).
open Finset in
theorem electrical_serving_flow_identity
{k : ℕ} (q : Fin k → ℤ) (s : Fin k)
(F : Fin k → Fin k → ℝ)
(hF_skew : ∀ i j, F i j = -F j i)
(hF_div : ∀ i, ∑ j : Fin k, F i j =
(q i : ℝ) + (if i = s then 1 else 0) - (1 + 1 / (k : ℝ))) :
∑ i with i ≠ s, (q i : ℝ) * F i s =
(1 + 1 / (k : ℝ)) * (∑ i with i ≠ s, F i s) +
∑ i with i ≠ s, (F i s) ^ 2 +
∑ i : Fin k, ∑ j with i < j ∧ i ≠ s ∧ j ≠ s, F i j * (F i s - F j s)electrical_serving_quadratic_boundIn LeanOnline Algorithms
For any real number k ≥ 2 and any real qs with 0 ≤ qs ≤ k, (1 + 1/k) * (1/k - qs) - (1/k - qs)^2 / 2 + k * qs ≥ 1/k.
theorem electrical_serving_quadratic_bound (k : ℝ) (hk : 2 ≤ k) (qs : ℝ)
(hqs0 : 0 ≤ qs) (hqsk : qs ≤ k) :
(1 + 1 / k) * (1 / k - qs) - (1 / k - qs) ^ 2 / 2 + k * qs ≥ 1 / kelectrical_serving_weighted_current_boundIn LeanOnline Algorithms
Let k ≥ 2 and let y : Fin k → V be an injection into a metric space (V, dist) defining k pairwise distinct points Y = (y_1, ..., y_k). Let q : Fin k → ℤ be an occupancy vector with 0 ≤ q i for all i and ∑ i, q i = k, and let s : Fin k. Let F : Fin k → Fin k → ℝ be a feasible flow for excess vector a i = (q i : ℝ) + (if i = s then 1 else 0) - (1 + 1/k) that achieves minimum electrical energy electrical_flow_energy (fun i j => dist (y i) (y j)) F = electrical_energy (fun i j => dist (y i) (y j)) a, and let h : Fin k → ℝ be a voltage vector satisfying dist (y i) (y j) * F i j = h i - h j for all i ≠ j. Then ∑ i with i ≠ s, (q i : ℝ) * F i s + (k : ℝ) * (q s : ℝ) ≥ 1 / (k : ℝ).
open Finset in
theorem electrical_serving_weighted_current_bound
{V : Type*} [MetricSpace V] {k : ℕ} (hk : 2 ≤ k)
(y : Fin k → V) (hy : Function.Injective y)
(q : Fin k → ℤ) (hq_nonneg : ∀ i, 0 ≤ q i) (hq_sum : ∑ i : Fin k, q i = (k : ℤ))
(s : Fin k)
(F : Fin k → Fin k → ℝ)
(hF : is_feasible_flow F (fun i => (q i : ℝ) + (if i = s then 1 else 0) - (1 + 1 / (k : ℝ))))
(hF_min : electrical_flow_energy (fun i j => dist (y i) (y j)) F =
electrical_energy (fun i j => dist (y i) (y j))
(fun i => (q i : ℝ) + (if i = s then 1 else 0) - (1 + 1 / (k : ℝ))))
(h : Fin k → ℝ) (h_volt : ∀ i j, i ≠ j → dist (y i) (y j) * F i j = h i - h j) :
∑ i with i ≠ s, (q i : ℝ) * F i s + (k : ℝ) * (q s : ℝ) ≥ 1 / (k : ℝ)empirical_transport_cost_le_subset_costIn LeanOnline Algorithms
For every server placement s : Fin n → X in a pseudo metric space X and every 1 ≤ t ≤ n, the expected empirical transport cost satisfies f_t ≤ g_t + (1 / t) * ∑_{k = n - t + 1}^n g_k.
theorem empirical_transport_cost_le_subset_cost {X : Type*} [PseudoMetricSpace X]
(n : ℕ) (s : Fin n → X) (t : ℕ) (ht1 : 1 ≤ t) (htn : t ≤ n) :
empirical_expected_transport_cost n s t ≤
subset_expected_transport_cost n s t +
(1 / (t : ℝ)) * ∑ k ∈ Finset.Icc (n - t + 1) n, subset_expected_transport_cost n s kforest_carpool_final_discrepancy_fixed_parityIn LeanOnline Algorithms
For a fixed edge sequence and vertex, the final greedy discrepancy has the same parity for every choice of coins.
theorem forest_carpool_final_discrepancy_fixed_parity (n : ℕ)
(edges : List (Fin n × Fin n)) (v : Fin n)
(r s : Fin edges.length → Bool) :
forest_carpool_final_discrepancy n edges r v % 2 =
forest_carpool_final_discrepancy n edges s v % 2forest_carpool_final_discrepancy_symmetricIn LeanOnline Algorithms
For every fixed edge sequence and vertex, the finite uniform greedy final discrepancy law is symmetric about zero.
theorem forest_carpool_final_discrepancy_symmetric (n : ℕ)
(edges : List (Fin n × Fin n)) (v : Fin n) (z : ℤ) :
(Finset.univ.filter (fun r : Fin edges.length → Bool =>
forest_carpool_final_discrepancy n edges r v = z)).card =
(Finset.univ.filter (fun r : Fin edges.length → Bool =>
forest_carpool_final_discrepancy n edges r v = -z)).cardharmonic_scale_weightIn LeanOnline Algorithms
The harmonic weight sum H(θ) = ∑_{e ∈ E} w_e / down_θ(w_e).
open Classical in
noncomputable def harmonic_scale_weight {α : Type*} (E : Finset α) (w : α → ℝ) (θ : ℝ) : ℝle_of_forall_nat_mul_le_mul_addIn LeanOnline Algorithms
For real numbers C, γ, c, if m * C ≤ m * γ + c holds for all natural numbers m, then C ≤ γ.
theorem le_of_forall_nat_mul_le_mul_add (C γ c : ℝ)
(h : ∀ m : ℕ, (m : ℝ) * C ≤ (m : ℝ) * γ + c) :
C ≤ γlinear_probing_noisy_displacements_measurableIn LeanOnline Algorithms
For positive n, the vector of linear probing displacements plus the noise vector is Borel measurable in the home-slot sequence and the noise vector.
theorem linear_probing_noisy_displacements_measurable (n : ℕ) [NeZero n] : Measurable (linear_probing_noisy_displacements n)
machine_load_le_online_makespanIn LeanOnline Algorithms
For every online assignment policy, every finite list of jobs J, and every machine i in Fin 4, the total load assigned to machine i is at most the online makespan achieved by the policy on J.
theorem machine_load_le_online_makespan (policy : List ℝ → ℝ → Fin 4) (J : List ℝ) (i : Fin 4) :
(∑ k : Fin J.length, if policy (J.take k.1) J[k.1] = i then J[k.1] else 0) ≤
Finset.univ.sup' Finset.univ_nonempty (fun i' : Fin 4 =>
∑ k : Fin J.length, if policy (J.take k.1) J[k.1] = i' then J[k.1] else 0)multidim_feasible_schedule_exists2In LeanOnline Algorithms
Every two-resource multidimensional scheduling instance admits at least one feasible schedule: running every job at the constant rate min(u_j, 1/(2n)) gives it completion time p_j / min(u_j, 1/(2n)), and the resulting allocation uses at most half of the capacity of each of the two resources.
theorem multidim_feasible_schedule_exists2 (I : MultidimInstance2) : ∃ (x : Fin I.n → ℝ → ℝ) (C : Fin I.n → ℝ), multidim_is_feasible_schedule2 I x C
multidim_opt2_posIn LeanOnline Algorithms
The offline optimal total completion time of every two-resource instance is strictly positive: it is at least the sum over jobs of p_j / u_j, and each of these terms is positive.
theorem multidim_opt2_pos (I : MultidimInstance2) : 0 < multidim_opt2 I
nat_ceil_log_two_ge_oneIn LeanOnline Algorithms
For every natural number n ≥ 2, the ceiling of Real.log (n : ℝ) / Real.log 2 is at least 1.
lemma nat_ceil_log_two_ge_one {n : ℕ} (hn : 2 ≤ n) :
1 ≤ Nat.ceil (Real.log (n : ℝ) / Real.log 2)nat_le_two_pow_ceil_log_two_natIn LeanOnline Algorithms
For every natural number n ≥ 2, n is at most 2 ^ (Nat.ceil (Real.log (n : ℝ) / Real.log 2)).
lemma nat_le_two_pow_ceil_log_two_nat {n : ℕ} (hn : 2 ≤ n) :
n ≤ 2 ^ (Nat.ceil (Real.log (n : ℝ) / Real.log 2))ocacag_chain_memIn LeanOnline Algorithms
For k ≥ 2 and v ∈ [1, 2^(k-1)], every cut c in the dyadic chain to v contains v (c.1 ≤ v ≤ c.2).
theorem ocacag_chain_mem (k : ℕ) (hk : 2 ≤ k) (v : ℤ) (hv : 1 ≤ v ∧ v ≤ (2 : ℤ) ^ (k - 1)) : ∀ c ∈ ocacagChain k v, c.1 ≤ v ∧ v ≤ c.2
ocacag_chain_validIn LeanOnline Algorithms
For k ≥ 2 and v ∈ [1, 2^(k-1)], every cut c in the dyadic chain to v is valid: 1 ≤ c.1, c.1 ≤ c.2, and c.2 < 2^k.
theorem ocacag_chain_valid (k : ℕ) (hk : 2 ≤ k) (v : ℤ) (hv : 1 ≤ v ∧ v ≤ (2 : ℤ) ^ (k - 1)) : ∀ c ∈ ocacagChain k v, 1 ≤ c.1 ∧ c.1 ≤ c.2 ∧ c.2 < (2 : ℤ) ^ k
ocacag_dyadic_averageIn LeanOnline Algorithms
For every online monotone feasible fractional algorithm Alg, the total of Alg's weight over the 2^(k-1) dyadic chains to the leaves v ∈ [1, 2^(k-1)] is at least ((k-1)/2)·2^(k-1); equivalently the average chain cost is at least (k-1)/2.
theorem ocacag_dyadic_average
(k : ℕ) (hk : 2 ≤ k) (n : ℕ) (hn : n = 2 ^ k)
(L : Finset (ℤ × ℤ))
(hL : ∀ p, p ∈ L ↔ 0 ≤ p.1 ∧ p.1 < p.2 ∧ p.2 < (n : ℤ))
(Alg : List (ℤ × ℤ) → (ℤ × ℤ → ℝ))
(h_online : (∀ reqs p, p ∈ L → 0 ≤ Alg reqs p) ∧
(∀ reqs r p, p ∈ L → Alg reqs p ≤ Alg (reqs ++ [r]) p))
(h_feasible : ∀ reqs, (∀ c ∈ reqs, 1 ≤ c.1 ∧ c.1 ≤ c.2 ∧ c.2 < (n : ℤ)) →
∀ c ∈ reqs, 1 ≤ ∑ p ∈ L.filter (fun p => (c.1 ≤ p.1 ∧ p.1 ≤ c.2) ↔ ¬(c.1 ≤ p.2 ∧ p.2 ≤ c.2)), Alg reqs p) :
((k : ℝ) - 1) / 2 * (2 : ℝ) ^ (k - 1) ≤
∑ v ∈ Finset.Icc (1 : ℤ) ((2 : ℤ) ^ (k - 1)), ∑ p ∈ L, Alg (ocacagChain k v) poffline_opt_le_scheduleIn LeanOnline Algorithms
For every finite list of jobs J and every offline assignment σ of jobs to 4 machines, the offline optimum makespan is at most the makespan achieved by σ (the maximum machine load under σ).
theorem offline_opt_le_schedule (J : List ℝ) (σ : Fin J.length → Fin 4) :
(Finset.univ.inf' Finset.univ_nonempty (fun σ' : Fin J.length → Fin 4 =>
Finset.univ.sup' Finset.univ_nonempty (fun i : Fin 4 =>
∑ k : Fin J.length, if σ' k = i then J[k.1] else 0))) ≤
(Finset.univ.sup' Finset.univ_nonempty (fun i : Fin 4 =>
∑ k : Fin J.length, if σ k = i then J[k.1] else 0))omsr_deterministic_greedy_existsIn LeanOnline Algorithms
For any resource weights w, there exists a deterministic greedy online policy π that always selects a valid probe sequence and achieves the maximal single-arrival probeValue over all valid probe sequences from available set S.
theorem omsr_deterministic_greedy_exists (n : ℕ) (w : Fin n → ℝ) :
∃ π : OMSRArrival n → Finset (Fin n) → List (Fin n),
(∀ arr S, IsValidProbeSeq arr S (π arr S)) ∧
(∀ arr S L, IsValidProbeSeq arr S L →
probeValue arr w (fun _ => 0) S L ≤ probeValue arr w (fun _ => 0) S (π arr S))omsr_deterministic_policy_embeddingIn LeanOnline Algorithms
For any deterministic policy π valid on all arrivals and states there is a randomized policy R (sample space a point mass) whose expected online value on every arrival list equals the deterministic value of π from the full resource set.
theorem omsr_deterministic_policy_embedding {n : ℕ} (w : Fin n → ℝ) (π : OMSRArrival n → Finset (Fin n) → List (Fin n)) (hπ : ∀ arr S, IsValidProbeSeq arr S (π arr S)) : ∃ R : RandomizedOMSRPolicy n, ∀ arrs : List (OMSRArrival n), expectedOnlineValue w R arrs = onlinePolicyValue w π arrs Finset.univomsr_expectedOnlineValue_finite_mixtureIn LeanOnline Algorithms
Any finite family of deterministic valid online policies, averaged uniformly, is realised by a genuinely randomized policy: there is a RandomizedOMSRPolicy whose expected online value on every arrival list equals the average of the deterministic values of the family.
theorem omsr_expectedOnlineValue_finite_mixture {n : ℕ} (w : Fin n → ℝ)
(ι : Type) [Fintype ι] [Nonempty ι]
(π : ι → OMSRArrival n → Finset (Fin n) → List (Fin n))
(hπ : ∀ j arr S, IsValidProbeSeq arr S (π j arr S)) :
∃ R : RandomizedOMSRPolicy n,
∀ arrs : List (OMSRArrival n),
expectedOnlineValue w R arrs
= (∑ j, onlinePolicyValue w (π j) arrs Finset.univ) / (Fintype.card ι)omsr_expectedOnlineValue_le_sum_weightsIn LeanOnline Algorithms
The expected reward of any randomized online policy is at most the total weight of all resources.
theorem omsr_expectedOnlineValue_le_sum_weights {n : ℕ} (w : Fin n → ℝ) (hw : ∀ i, 0 ≤ w i) (R : RandomizedOMSRPolicy n) (arrs : List (OMSRArrival n)) : expectedOnlineValue w R arrs ≤ ∑ i, w iomsr_expectedOnlineValue_nilIn LeanOnline Algorithms
The expected reward of any randomized online policy on an empty list of arrivals is 0.
theorem omsr_expectedOnlineValue_nil {n : ℕ} (w : Fin n → ℝ) (R : RandomizedOMSRPolicy n) : expectedOnlineValue w R [] = 0omsr_expectedOnlineValue_nonnegIn LeanOnline Algorithms
For non-negative weights, the expected online value of any randomized policy on any arrival list is non-negative.
theorem omsr_expectedOnlineValue_nonneg {n : ℕ} (w : Fin n → ℝ) (hw : ∀ i, 0 ≤ w i) (R : RandomizedOMSRPolicy n) (arrs : List (OMSRArrival n)) : 0 ≤ expectedOnlineValue w R arrsomsr_greedy_half_competitive_of_argmaxIn LeanOnline Algorithms
Any deterministic online policy that achieves maximal single-arrival probeValue on each arrival earns at least half of the offlineOptValue benchmark on every arrival list arrs.
theorem omsr_greedy_half_competitive_of_argmax (n : ℕ) (w : Fin n → ℝ) (hw : ∀ i, 0 ≤ w i)
(π : OMSRArrival n → Finset (Fin n) → List (Fin n))
(hπ_valid : ∀ arr S, IsValidProbeSeq arr S (π arr S))
(hπ_max : ∀ arr S L, IsValidProbeSeq arr S L →
probeValue arr w (fun _ => 0) S L ≤ probeValue arr w (fun _ => 0) S (π arr S))
(arrs : List (OMSRArrival n)) :
offlineOptValue w arrs ≤ 2 * onlinePolicyValue w π arrs Finset.univomsr_offlineOptValue_le_sum_weightsIn LeanOnline Algorithms
offlineOptValue is at most the sum of all weights.
theorem omsr_offlineOptValue_le_sum_weights {n : ℕ} (w : Fin n → ℝ) (hw : ∀ i, 0 ≤ w i) (arrs : List (OMSRArrival n)) : offlineOptValue w arrs ≤ ∑ i, w iomsr_offlineOptValue_nilIn LeanOnline Algorithms
offlineOptValue on the empty arrival list is 0.
theorem omsr_offlineOptValue_nil {n : ℕ} (w : Fin n → ℝ) : offlineOptValue w ([] : List (OMSRArrival n)) = 0omsr_offlineOptValue_nonnegIn LeanOnline Algorithms
offlineOptValue is non-negative, for arbitrary (not necessarily non-negative) weights.
theorem omsr_offlineOptValue_nonneg {n : ℕ} (w : Fin n → ℝ) (arrs : List (OMSRArrival n)) : 0 ≤ offlineOptValue w arrsomsr_onlinePolicyValue_consIn LeanOnline Algorithms
The online value of arr :: rest is the probe value of the policy's probe sequence against the arrival, with continuation the online value of the tail.
theorem omsr_onlinePolicyValue_cons {n : ℕ} (w : Fin n → ℝ) (π : OMSRArrival n → Finset (Fin n) → List (Fin n)) (arr : OMSRArrival n) (rest : List (OMSRArrival n)) (S : Finset (Fin n)) : onlinePolicyValue w π (arr :: rest) S = probeValue arr w (fun S' => onlinePolicyValue w π rest S') S (π arr S)omsr_onlinePolicyValue_le_sum_weightsIn LeanOnline Algorithms
Any deterministic online policy that respects availability and patience on each arrival earns at most the total weight of the currently available resources, on every arrival list.
theorem omsr_onlinePolicyValue_le_sum_weights {n : ℕ} (w : Fin n → ℝ) (hw : ∀ i, 0 ≤ w i) (π : OMSRArrival n → Finset (Fin n) → List (Fin n)) (hπ : ∀ arr S, IsValidProbeSeq arr S (π arr S)) (arrs : List (OMSRArrival n)) (S : Finset (Fin n)) : onlinePolicyValue w π arrs S ≤ ∑ i ∈ S, w iomsr_onlinePolicyValue_nilIn LeanOnline Algorithms
On no arrivals a deterministic online policy earns nothing.
theorem omsr_onlinePolicyValue_nil {n : ℕ} (w : Fin n → ℝ) (π : OMSRArrival n → Finset (Fin n) → List (Fin n)) (S : Finset (Fin n)) : onlinePolicyValue w π [] S = 0omsr_onlinePolicyValue_nonnegIn LeanOnline Algorithms
A deterministic online policy's expected reward is non-negative for non-negative weights.
theorem omsr_onlinePolicyValue_nonneg {n : ℕ} (w : Fin n → ℝ) (hw : ∀ i, 0 ≤ w i) (π : OMSRArrival n → Finset (Fin n) → List (Fin n)) (arrs : List (OMSRArrival n)) (S : Finset (Fin n)) : 0 ≤ onlinePolicyValue w π arrs Somsr_optDP_le_sum_weightsIn LeanOnline Algorithms
For non-negative weights, optDP at any fuel, available set S and arrival state is at most the total weight of S.
theorem omsr_optDP_le_sum_weights {n m : ℕ} (w : Fin n → ℝ) (hw : ∀ i, 0 ≤ w i) (arrs : Fin m → OfflineArrival n) (S : Finset (Fin n)) (fuel : ℕ) : optDP w fuel S arrs ≤ ∑ i ∈ S, w iomsr_optDP_nonnegIn LeanOnline Algorithms
optDP is non-negative for every fuel, available set and arrival state, with no hypothesis on the weights.
theorem omsr_optDP_nonneg {n m : ℕ} (w : Fin n → ℝ) (fuel : ℕ) (S : Finset (Fin n)) (arrs : Fin m → OfflineArrival n) : 0 ≤ optDP w fuel S arrsomsr_probeValue_consIn LeanOnline Algorithms
Probing i :: L succeeds with probability arr.prob i, gaining w i and continuing from S.erase i, and otherwise continues along L.
theorem omsr_probeValue_cons {n : ℕ} (arr : OMSRArrival n) (w : Fin n → ℝ) (V : Finset (Fin n) → ℝ) (S : Finset (Fin n)) (i : Fin n) (L : List (Fin n)) : probeValue arr w V S (i :: L) = arr.prob i * (w i + V (S.erase i)) + (1 - arr.prob i) * probeValue arr w V S Lomsr_probeValue_le_sum_weightsIn LeanOnline Algorithms
If the continuation is bounded by the total weight of the available set and the probe sequence only uses available resources, then probeValue is bounded by the total weight of the available set.
theorem omsr_probeValue_le_sum_weights {n : ℕ} (arr : OMSRArrival n) (w : Fin n → ℝ) (V : Finset (Fin n) → ℝ) (hV : ∀ S, V S ≤ ∑ i ∈ S, w i) (S : Finset (Fin n)) (L : List (Fin n)) (hL : ∀ i ∈ L, i ∈ S) : probeValue arr w V S L ≤ ∑ i ∈ S, w iomsr_probeValue_mono_continuationIn LeanOnline Algorithms
probeValue is monotone in the continuation value function, pointwise.
theorem omsr_probeValue_mono_continuation {n : ℕ} (arr : OMSRArrival n) (w : Fin n → ℝ) (V V' : Finset (Fin n) → ℝ) (h : ∀ S, V S ≤ V' S) (S : Finset (Fin n)) (L : List (Fin n)) : probeValue arr w V S L ≤ probeValue arr w V' S Lomsr_probeValue_nilIn LeanOnline Algorithms
Probing the empty sequence yields the continuation value at the current available set.
theorem omsr_probeValue_nil {n : ℕ} (arr : OMSRArrival n) (w : Fin n → ℝ) (V : Finset (Fin n) → ℝ) (S : Finset (Fin n)) : probeValue arr w V S [] = V Somsr_probeValue_nonnegIn LeanOnline Algorithms
probeValue is non-negative when the weights are non-negative, the probabilities lie in [0,1] and the continuation is non-negative.
theorem omsr_probeValue_nonneg {n : ℕ} (arr : OMSRArrival n) (w : Fin n → ℝ) (hw : ∀ i, 0 ≤ w i) (V : Finset (Fin n) → ℝ) (hV : ∀ S, 0 ≤ V S) (S : Finset (Fin n)) (L : List (Fin n)) : 0 ≤ probeValue arr w V S Loneshot_drf_competitive_ratio2_bdd_aboveIn LeanOnline Algorithms
The set of completion time ratios achieved by one-shot DRF over all two-resource instances is bounded above.
theorem oneshot_drf_competitive_ratio2_bdd_above : BddAbove { ρ | ∃ I : MultidimInstance2, ρ = oneshot_drf_total_completion_time2 I / multidim_opt2 I }online_connectivity_augmentation_reduction_to_cycleIn LeanOnline Algorithms
Let V be a type with decidable equality, L a finite set of candidate links in Sym2 V, w a real cost function on links, and α a real number. Let min_cuts_G and min_cuts_H be sets of cuts (finite subsets of V) satisfying min_cuts_G ⊆ min_cuts_H. If an online algorithm Alg maintaining subsets of L irrevocably (Alg reqs ⊆ L and Alg reqs ⊆ Alg (reqs ++ [r])) is feasible for cut arrivals in min_cuts_H (every cut c in reqs is covered by some e ∈ Alg reqs with ∃ u v, e = s(u, v) ∧ ((u ∈ c ∧ v ∉ c) ∨ (v ∈ c ∧ u ∉ c))) and α-competitive against every offline solution F ⊆ L covering reqs (∑ e ∈ Alg reqs, w e ≤ α * ∑ e ∈ F, w e), then Alg is also an irrevocable online algorithm for cut arrivals in min_cuts_G that is feasible and α-competitive.
open Finset BigOperators in
theorem online_connectivity_augmentation_reduction_to_cycle
{V : Type*} [DecidableEq V]
(L : Finset (Sym2 V)) (w : Sym2 V → ℝ) (α : ℝ)
(min_cuts_G min_cuts_H : Set (Finset V))
(h_circumference : min_cuts_G ⊆ min_cuts_H)
(Alg : List (Finset V) → Finset (Sym2 V))
(h_online : (∀ reqs, Alg reqs ⊆ L) ∧ (∀ reqs r, Alg reqs ⊆ Alg (reqs ++ [r])))
(h_cycle_feas : ∀ reqs, (∀ c ∈ reqs, c ∈ min_cuts_H) →
∀ c ∈ reqs, ∃ e ∈ Alg reqs, ∃ u v, e = s(u, v) ∧ ((u ∈ c ∧ v ∉ c) ∨ (v ∈ c ∧ u ∉ c)))
(h_cycle_comp : ∀ reqs, (∀ c ∈ reqs, c ∈ min_cuts_H) →
∀ F ⊆ L, (∀ c ∈ reqs, ∃ e ∈ F, ∃ u v, e = s(u, v) ∧ ((u ∈ c ∧ v ∉ c) ∨ (v ∈ c ∧ u ∉ c))) →
∑ e ∈ Alg reqs, w e ≤ α * ∑ e ∈ F, w e) :
((∀ reqs, Alg reqs ⊆ L) ∧ (∀ reqs r, Alg reqs ⊆ Alg (reqs ++ [r]))) ∧
(∀ reqs, (∀ c ∈ reqs, c ∈ min_cuts_G) →
∀ c ∈ reqs, ∃ e ∈ Alg reqs, ∃ u v, e = s(u, v) ∧ ((u ∈ c ∧ v ∉ c) ∨ (v ∈ c ∧ u ∉ c))) ∧
∀ reqs, (∀ c ∈ reqs, c ∈ min_cuts_G) →
∀ F ⊆ L, (∀ c ∈ reqs, ∃ e ∈ F, ∃ u v, e = s(u, v) ∧ ((u ∈ c ∧ v ∉ c) ∨ (v ∈ c ∧ u ∉ c))) →
∑ e ∈ Alg reqs, w e ≤ α * ∑ e ∈ F, w eonline_cycle_augmentation_adversary_cost_geIn LeanOnline Algorithms
Let k ≥ 2 be an integer, n = 2^k, and L the set of all pairs (i, j) of integers with 0 ≤ i < j < n. For every online fractional algorithm Alg for Online Cycle Augmentation on an n-vertex cycle with candidate links L (mapping cut sequences to non-negative link weights, non-decreasing under sequence extensions, such that for every valid cut sequence cuts with 1 ≤ c.1 ≤ c.2 < n each cut c ∈ cuts is fractionally covered by at least 1), there exists a valid sequence of cuts cuts and a link p_opt in L crossing every cut in cuts such that the total fractional cost of Alg on cuts is at least (k - 1) / 2.
open Finset Classical in
theorem online_cycle_augmentation_adversary_cost_ge
(k : ℕ) (hk : 2 ≤ k) (n : ℕ) (hn : n = 2 ^ k)
(L : Finset (ℤ × ℤ))
(hL : ∀ p, p ∈ L ↔ 0 ≤ p.1 ∧ p.1 < p.2 ∧ p.2 < (n : ℤ))
(Alg : List (ℤ × ℤ) → (ℤ × ℤ → ℝ))
(h_online : (∀ reqs p, p ∈ L → 0 ≤ Alg reqs p) ∧
(∀ reqs r p, p ∈ L → Alg reqs p ≤ Alg (reqs ++ [r]) p))
(h_feasible : ∀ reqs, (∀ c ∈ reqs, 1 ≤ c.1 ∧ c.1 ≤ c.2 ∧ c.2 < (n : ℤ)) →
∀ c ∈ reqs, 1 ≤ ∑ p ∈ L.filter (fun p => (c.1 ≤ p.1 ∧ p.1 ≤ c.2) ↔ ¬(c.1 ≤ p.2 ∧ p.2 ≤ c.2)), Alg reqs p) :
∃ (cuts : List (ℤ × ℤ)) (p_opt : ℤ × ℤ),
(∀ c ∈ cuts, 1 ≤ c.1 ∧ c.1 ≤ c.2 ∧ c.2 < (n : ℤ)) ∧
p_opt ∈ L ∧
(∀ c ∈ cuts, (c.1 ≤ p_opt.1 ∧ p_opt.1 ≤ c.2) ↔ ¬(c.1 ≤ p_opt.2 ∧ p_opt.2 ≤ c.2)) ∧
((k : ℝ) - 1) / 2 ≤ ∑ p ∈ L, Alg cuts ponline_cycle_augmentation_fractional_lower_boundIn LeanOnline Algorithms
Let k ≥ 2 be an integer, n = 2^k, and L the set of all pairs (i, j) of integers with 0 ≤ i < j < n. In the Online Cycle Augmentation Problem on an n-vertex cycle with candidate links L of unit weights under cut arrivals, if an online fractional algorithm Alg achieves a competitive ratio α against the offline optimum (meaning that for every valid cut sequence cuts with 1 ≤ c.1 ≤ c.2 < n and every offline solution F ⊆ L covering all cuts in cuts, the fractional cost of Alg on cuts is at most α times the cardinality of F), then α is at least (k - 1) / 2 = (1/2) * (log_2 n - 1).
open Finset Classical in
theorem online_cycle_augmentation_fractional_lower_bound
(k : ℕ) (hk : 2 ≤ k) (n : ℕ) (hn : n = 2 ^ k)
(L : Finset (ℤ × ℤ))
(hL : ∀ p, p ∈ L ↔ 0 ≤ p.1 ∧ p.1 < p.2 ∧ p.2 < (n : ℤ))
(Alg : List (ℤ × ℤ) → (ℤ × ℤ → ℝ))
(h_online : (∀ reqs p, p ∈ L → 0 ≤ Alg reqs p) ∧
(∀ reqs r p, p ∈ L → Alg reqs p ≤ Alg (reqs ++ [r]) p))
(h_feasible : ∀ reqs, (∀ c ∈ reqs, 1 ≤ c.1 ∧ c.1 ≤ c.2 ∧ c.2 < (n : ℤ)) →
∀ c ∈ reqs, 1 ≤ ∑ p ∈ L.filter (fun p => (c.1 ≤ p.1 ∧ p.1 ≤ c.2) ↔ ¬(c.1 ≤ p.2 ∧ p.2 ≤ c.2)), Alg reqs p)
(α : ℝ)
(h_comp : ∀ reqs, (∀ c ∈ reqs, 1 ≤ c.1 ∧ c.1 ≤ c.2 ∧ c.2 < (n : ℤ)) →
∀ F ⊆ L, (∀ c ∈ reqs, ∃ p ∈ F, (c.1 ≤ p.1 ∧ p.1 ≤ c.2) ↔ ¬(c.1 ≤ p.2 ∧ p.2 ≤ c.2)) →
∑ p ∈ L, Alg reqs p ≤ α * (F.card : ℝ)) :
((k : ℝ) - 1) / 2 ≤ αonline_makespan_four_machines_lower_boundIn LeanOnline Algorithms
No deterministic online algorithm for makespan minimization on 4 identical machines achieves a competitive ratio smaller than 14350/8283: for every online policy assigning jobs in Fin 4 given history and every real number c, if the policy is c-competitive (its makespan on any finite sequence of jobs with positive sizes is at most c times the offline optimum makespan), then 14350/8283 ≤ c.
theorem online_makespan_four_machines_lower_bound
(policy : List ℝ → ℝ → Fin 4) (c : ℝ)
(hc : ∀ J : List ℝ, (∀ p ∈ J, 0 < p) →
(Finset.univ.sup' Finset.univ_nonempty (fun i : Fin 4 =>
∑ k : Fin J.length, if policy (J.take k.1) J[k.1] = i then J[k.1] else 0)) ≤
c * (Finset.univ.inf' Finset.univ_nonempty (fun σ : Fin J.length → Fin 4 =>
Finset.univ.sup' Finset.univ_nonempty (fun i : Fin 4 =>
∑ k : Fin J.length, if σ k = i then J[k.1] else 0)))) :
(14350 / 8283 : ℝ) ≤ conline_makespan_four_machines_single_branching_lower_boundIn LeanOnline Algorithms
No deterministic online algorithm for makespan minimization on 4 identical machines achieves a competitive ratio smaller than 14383/8304: for every online policy assigning jobs in Fin 4 given history and every real number c, if the policy is c-competitive (its makespan on any finite sequence of jobs with positive sizes is at most c times the offline optimum makespan), then 14383/8304 ≤ c.
theorem online_makespan_four_machines_single_branching_lower_bound
(policy : List ℝ → ℝ → Fin 4) (c : ℝ)
(hc : ∀ J : List ℝ, (∀ p ∈ J, 0 < p) →
(Finset.univ.sup' Finset.univ_nonempty (fun i : Fin 4 =>
∑ k : Fin J.length, if policy (J.take k.1) J[k.1] = i then J[k.1] else 0)) ≤
c * (Finset.univ.inf' Finset.univ_nonempty (fun σ : Fin J.length → Fin 4 =>
Finset.univ.sup' Finset.univ_nonempty (fun i : Fin 4 =>
∑ k : Fin J.length, if σ k = i then J[k.1] else 0)))) :
(14383 / 8304 : ℝ) ≤ cop869_color_set_amplificationIn LeanOnline Algorithms
If P and Q each have at least a elements and X has t elements disjoint from P, then P union Q or Q union X has at least a plus ceil(t/2) elements.
theorem op869_color_set_amplification {α : Type} [DecidableEq α] (P Q X : Finset α) (a t : ℕ) :
a ≤ P.card → a ≤ Q.card → X.card = t → Disjoint X P →
a + (t + 1) / 2 ≤ (P ∪ Q).card ∨ a + (t + 1) / 2 ≤ (Q ∪ X).cardop869_disjoint_reserved_copiesIn LeanOnline Algorithms
If each of q colors occurs in at least qD copies, one can reserve D copies for each color so that reservations for different colors are disjoint.
theorem op869_disjoint_reserved_copies {α : Type} [DecidableEq α] (q D : ℕ) (S : Fin q → Finset α) :
(∀ i, q * D ≤ (S i).card) →
∃ T : Fin q → Finset α, (∀ i, T i ⊆ S i ∧ (T i).card = D) ∧
(∀ i j, i ≠ j → Disjoint (T i) (T j))op869_incidence_degree_countIn LeanOnline Algorithms
For a finite incidence relation in which each element of A is incident with at least d elements of B, and 1 ≤ r ≤ |A|, the incidence count |A|d is at most |B|(r−1) plus (|A|−(r−1)) times the number of elements of B incident with at least r elements of A.
theorem op869_incidence_degree_count {α β : Type} [DecidableEq α] [DecidableEq β] (A : Finset α) (B : Finset β)
(R : α → β → Prop) [DecidableRel R] (d r : ℕ) :
1 ≤ r → r ≤ A.card → (∀ a ∈ A, d ≤ (B.filter (R a)).card) →
A.card * d ≤ B.card * (r - 1) +
(A.card - (r - 1)) * (B.filter (fun b => r ≤ (A.filter (fun a => R a b)).card)).cardop869_integer_fold_schedule_conditionalIn LeanOnline Algorithms
Assuming the stated fold simulation bound with constant C, the integer schedule m, m squared, up to m to the m forces m to the m colors on any sufficiently large n, with explicit budget F to the m squared and post-degree F to the m, where F is C times K cubed times 2 to the C times (m+1), and K=m to the m.
theorem op869_integer_fold_schedule_conditional (C m : ℕ) (hC : 1 ≤ C) (hm : 2 ≤ m) (hsim : ∀ n q t K D : ℕ, 1 ≤ t → t ≤ q → q ≤ K → 1 ≤ D → op869_bounded_adversary_forces 3 q K D n 0 (fun _ : Fin n => ∅) (fun _ : Fin n => ∅) → ∀ n' D' : ℕ, C * K^2 * q * n * D * 2^(C * ((q + t - 1) / t)) ≤ n' → C * K^2 * q * D * 2^(C * ((q + t - 1) / t)) ≤ D' → op869_bounded_adversary_forces 3 t K D' n' 0 (fun _ : Fin n' => ∅) (fun _ : Fin n' => ∅)) : let K := m^m; let F := C * K^3 * 2^(C * (m+1)); ∀ n : ℕ, F^(m^2) ≤ n → op869_bounded_adversary_forces 3 1 K (F^m) n 0 (fun _ : Fin n => ∅) (fun _ : Fin n => ∅)
op869_integer_fold_stage_budgetIn LeanOnline Algorithms
For an integer m-level fold schedule, each simulation stage fits in the next square-exponent vertex budget and the next power post-degree budget.
theorem op869_integer_fold_stage_budget (C m j : ℕ) (hC : 1 ≤ C) (hm : 2 ≤ m) (hj : j < m) : let K := m^m; let F := C*K^3*2^(C*(m+1)); let t := m^(m-(j+1)); let q := m^(m-j); C*K^2*q*F^(j^2)*F^j*2^(C*((q+t-1)/t)) ≤ F^((j+1)^2) ∧ C*K^2*q*F^j*2^(C*((q+t-1)/t)) ≤ F^(j+1)
op869_orient_three_color_blocksIn LeanOnline Algorithms
For each bipartite block with a three-colored owner and at most one three-colored target of a different color, its two sides can be assigned the two colors different from the owner so that the designated side has the target color when a target exists.
theorem op869_orient_three_color_blocks {V B : Type} (φ : V → Fin 3) (owner : B → V)
(target : B → Option V) (selected : B → Bool) :
(∀ b v, target b = some v → φ v ≠ φ (owner b)) →
∃ left right : B → Fin 3, ∀ b,
left b ≠ φ (owner b) ∧ right b ≠ φ (owner b) ∧ left b ≠ right b ∧
∀ v, target b = some v → (if selected b then left b else right b) = φ vop869_repeated_color_incidenceIn LeanOnline Algorithms
Suppose there are KqD copies and fewer than K colors, and every copy contains at least q colors. If 1 ≤ q ≤ K and D ≥ 1, at least q colors occur in at least qD copies each.
theorem op869_repeated_color_incidence {α β : Type} [DecidableEq α] [DecidableEq β] (A : Finset α) (B : Finset β)
(R : α → β → Prop) [DecidableRel R] (K q D : ℕ) :
1 ≤ q → q ≤ K → 1 ≤ D → A.card = K * q * D → B.card < K →
(∀ a ∈ A, q ≤ (B.filter (R a)).card) →
q ≤ (B.filter (fun b => q * D ≤ (A.filter (fun a => R a b)).card)).cardop869_three_colorable_fold_simulationIn LeanOnline Algorithms
There is an absolute positive integer C such that a q-fold three-colorable bounded adversary forcing K colors on n vertices with post-degree at most D can be simulated by a t-fold adversary, for 1 ≤ t ≤ q ≤ K and D ≥ 1, on any sufficiently large n′ with post-degree bound D′, when n′ and D′ dominate the respective explicit bounds in the Lean statement.
theorem op869_three_colorable_fold_simulation : ∃ C : ℕ, 1 ≤ C ∧ ∀ n q t K D : ℕ,
1 ≤ t → t ≤ q → q ≤ K → 1 ≤ D →
op869_bounded_adversary_forces 3 q K D n 0 (fun _ : Fin n => ∅) (fun _ : Fin n => ∅) →
∀ n' D' : ℕ,
C * K^2 * q * n * D * 2^(C * ((q + t - 1) / t)) ≤ n' →
C * K^2 * q * D * 2^(C * ((q + t - 1) / t)) ≤ D' →
op869_bounded_adversary_forces 3 t K D' n' 0 (fun _ : Fin n' => ∅) (fun _ : Fin n' => ∅)
op869_two_sided_colors_by_orientationIn LeanOnline Algorithms
If each marked color occurs in at least two distinct copies, the copies can be oriented so at least half the marked colors occur on both sides.
theorem op869_two_sided_colors_by_orientation {γ : Type} [DecidableEq γ] (m : ℕ) (C : Finset γ)
(R : Fin m → γ → Prop) [DecidableRel R] :
(∀ c ∈ C, ∃ a b : Fin m, a ≠ b ∧ R a c ∧ R b c) →
∃ s : Finset (Fin m), C.card ≤ 2 * (C.filter (fun c =>
(∃ a : Fin m, a ∈ s ∧ R a c) ∧ (∃ b : Fin m, b ∉ s ∧ R b c))).cardop_902_poly_coins_algorithm_tail_boundIn LeanOnline Algorithms
There exists a randomized online carpooling algorithm with a polynomial coin budget num_coins such that for every natural number n ≥ 2, every valid edge sequence on Fin n of length T ≥ 2, and every threshold D ≥ 300, the uniform probability that the maximum discrepancy across all time steps is at least D is at most 12 * T * exp(-(D/40)^3).
theorem op_902_poly_coins_algorithm_tail_bound :
∃ (alg : RandomizedOnlineCarpoolingAlg),
(∃ (p : Polynomial ℕ), ∀ (n T : ℕ), alg.num_coins n T ≤ Polynomial.eval (n + T) p) ∧
∀ (n : ℕ) (hn : 2 ≤ n) (edges : List (Fin n × Fin n))
(hedges : ValidCarpoolEdgeSequence n edges) (hT : 2 ≤ edges.length)
(D : ℕ) (hD : 300 ≤ D),
let T := edges.length
let K := alg.num_coins n T
let high_discrepancy := Finset.univ.filter (fun r : Fin K → Bool =>
D ≤ carpool_max_discrepancy n edges
(online_carpool_orientations n (alg.orient n T) edges r))
((high_discrepancy.card : ℝ) / (2 ^ K : ℝ)) ≤
12 * (T : ℝ) * Real.exp (-(((D : ℝ) / 40) ^ 3))op_902_single_edge_tail_boundIn LeanOnline Algorithms
For any randomized online carpooling algorithm alg, on any valid edge sequence on Fin n (n ≥ 2) of length T = 1 and any threshold D ≥ 300, the uniform probability over coin assignments that the maximum carpooling discrepancy is at least D is at most 12 * T * exp(-(D/40)^3).
theorem op_902_single_edge_tail_bound (alg : RandomizedOnlineCarpoolingAlg)
(n : ℕ) (hn : 2 ≤ n) (edges : List (Fin n × Fin n))
(hedges : ValidCarpoolEdgeSequence n edges) (hT : edges.length = 1)
(D : ℕ) (hD : 300 ≤ D) :
let T := edges.length
let K := alg.num_coins n T
let high_discrepancy := Finset.univ.filter (fun r : Fin K → Bool =>
D ≤ carpool_max_discrepancy n edges
(online_carpool_orientations n (alg.orient n T) edges r))
((high_discrepancy.card : ℝ) / (2 ^ K : ℝ)) ≤
12 * (T : ℝ) * Real.exp (-(((D : ℝ) / 40) ^ 3))optimal_timely_bin_count_step_geIn LeanOnline Algorithms
For a non-empty item set I with uniform sizes s ∈ (0, 1] and valid arrival/deadline windows, optimal_timely_bin_count I ≥ 1 + optimal_timely_bin_count (I \ (thrifty_greedy_step I hI).items).
theorem optimal_timely_bin_count_step_ge (I : Finset TimelyItem) (hI : I.Nonempty)
(h_time : ∀ p ∈ I, p.arrival ≤ p.deadline)
(h_id : ∀ p ∈ I, ∀ q ∈ I, p.id = q.id → p = q)
(s : ℝ) (hs : 0 < s ∧ s ≤ 1) (h_size : ∀ p ∈ I, p.size = s) :
optimal_timely_bin_count I ≥ 1 + optimal_timely_bin_count (I \ (thrifty_greedy_step I hI).items)pairwise_current_interaction_boundIn LeanOnline Algorithms
Let y : Fin k → V be an injection into a metric space (V, dist) defining pairwise distinct points. If F : Fin k → Fin k → ℝ satisfies Ohm's law dist(y i, y j) * F i j = h i - h j for all i ≠ j with some voltage vector h : Fin k → ℝ, then for any target index s : Fin k and any distinct labels i, j with i ≠ s and j ≠ s, F i j * (F i s - F j s) ≥ - F i s * F j s.
open Finset in
theorem pairwise_current_interaction_bound
{V : Type*} [MetricSpace V] {k : ℕ} (y : Fin k → V) (hy : Function.Injective y)
(F : Fin k → Fin k → ℝ)
(h : Fin k → ℝ) (h_volt : ∀ i j, i ≠ j → dist (y i) (y j) * F i j = h i - h j)
(s i j : Fin k) (hi : i ≠ s) (hj : j ≠ s) (hij : i ≠ j) :
F i j * (F i s - F j s) ≥ - F i s * F j srandom_greedy_survival_poly_coeff_succ_nonnegIn LeanOnline Algorithms
Every non-constant coefficient of the random-greedy survival polynomial is non-negative: for every finite simple graph J and vertex subset A, and every n ≥ 1, the coefficient of Y^n in random_greedy_survival_poly J A is at least 0.
theorem random_greedy_survival_poly_coeff_succ_nonneg
{V : Type*} [Fintype V] [DecidableEq V]
(J : SimpleGraph V) [DecidableRel J.Adj] (A : Finset V) :
∀ n : ℕ, 0 ≤ (random_greedy_survival_poly J A).coeff (n + 1)random_greedy_survival_poly_coeff_zero_nonnegIn LeanOnline Algorithms
The constant term of the random-greedy survival polynomial of any finite simple graph J at any vertex subset A is non-negative, equivalently the total mass Σ_{e incident to A} ∫_0^1 P(J-e, A ∪ V(e), s) ds of the recursion is at most 1.
theorem random_greedy_survival_poly_coeff_zero_nonneg
{V : Type*} [Fintype V] [DecidableEq V]
(J : SimpleGraph V) [DecidableRel J.Adj] (A : Finset V) :
0 ≤ (random_greedy_survival_poly J A).coeff 0random_greedy_survival_poly_eval_oneIn LeanOnline Algorithms
For every finite simple graph J and vertex subset A, the random-greedy survival polynomial evaluated at Y = 1 equals 1; equivalently the coefficients of the polynomial sum to 1, i.e. P(J, A, 0) = 1.
theorem random_greedy_survival_poly_eval_one
{V : Type*} [Fintype V] [DecidableEq V]
(J : SimpleGraph V) [DecidableRel J.Adj] (A : Finset V) :
(random_greedy_survival_poly J A).eval 1 = 1random_greedy_survival_prob_convex_combination_powersIn LeanOnline Algorithms
For every finite simple graph J on a finite vertex type V with decidable equality and decidable adjacency, and every vertex subset A : Finset V, there exist non-negative coefficients c_n ≥ 0 for n : ℕ with c_n = 0 for all sufficiently large n and sum_{n} c_n = 1 such that for all t in [0, 1], the survival probability random_greedy_survival_prob J A t equals sum_{n} c_n * (1 - t)^n.
theorem random_greedy_survival_prob_convex_combination_powers
{V : Type*} [Fintype V] [DecidableEq V]
(J : SimpleGraph V) [DecidableRel J.Adj] (A : Finset V) :
∃ (c : ℕ → ℝ), (∀ n, 0 ≤ c n) ∧ (∃ N, ∀ n ≥ N, c n = 0) ∧ (∑' n, c n = 1) ∧
∀ t ∈ Set.Icc (0 : ℝ) 1,
random_greedy_survival_prob J A t = ∑' n, c n * (1 - t) ^ nsubsampled_prophet_inequality_ratio_twoIn LeanOnline Algorithms
For any probability measure P on Ω, independent nonnegative integrable random variables X : Fin n → Ω → ℝ, and subsampling rate r with 0 < r and r ≤ 1, the subsampled prophet benchmark satisfies subsampled_prophet_opt P n X r ≤ 2 * dp_suffix_val P n X r 0.
open MeasureTheory ProbabilityTheory Finset in
theorem subsampled_prophet_inequality_ratio_two {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
[IsProbabilityMeasure P] (n : ℕ) (X : Fin n → Ω → ℝ) (hX_indep : iIndepFun X P)
(hX_nonneg : ∀ i, 0 ≤ X i) (hX_int : ∀ i, Integrable (X i) P) (r : ℝ) (hr0 : 0 < r)
(hr1 : r ≤ 1) :
subsampled_prophet_opt P n X r ≤ 2 * dp_suffix_val P n X r 0subsampled_prophet_opt_le_single_thresholdIn LeanOnline Algorithms
For any probability measure P on Ω, nonnegative integrable random variables X : Fin n → Ω → ℝ, subsampling rate r with 0 < r and r ≤ 1, and threshold t with 0 ≤ t, subsampled_prophet_opt P n X r ≤ t + r * ∑ i : Fin n, ∫ ω, max (X i ω - t) 0 ∂P.
open MeasureTheory ProbabilityTheory Finset in
theorem subsampled_prophet_opt_le_single_threshold {Ω : Type*} [MeasurableSpace Ω] (P : Measure Ω)
[IsProbabilityMeasure P] (n : ℕ) (X : Fin n → Ω → ℝ) (hX_nonneg : ∀ i, 0 ≤ X i)
(hX_int : ∀ i, Integrable (X i) P) (r : ℝ) (hr0 : 0 < r) (hr1 : r ≤ 1) (t : ℝ) (ht : 0 ≤ t) :
subsampled_prophet_opt P n X r ≤ t + r * ∑ i : Fin n, ∫ ω, max (X i ω - t) 0 ∂Psubset_expected_transport_cost_nonnegIn LeanOnline Algorithms
For every server placement s : Fin n → X in a pseudo metric space X and every k, the expected subset transport cost g_k = subset_expected_transport_cost n s k is nonnegative.
theorem subset_expected_transport_cost_nonneg {X : Type*} [PseudoMetricSpace X]
(n : ℕ) (s : Fin n → X) (k : ℕ) :
0 ≤ subset_expected_transport_cost n s ksubset_expected_transport_cost_symmetryIn LeanOnline Algorithms
For every server placement s : Fin n → X in a pseudo metric space X and every 1 ≤ k < n, the expected subset transport costs satisfy the scaling symmetry k * g_k = (n - k) * g_{n - k}.
theorem subset_expected_transport_cost_symmetry {X : Type*} [PseudoMetricSpace X]
(n : ℕ) (s : Fin n → X) (k : ℕ) (hk1 : 1 ≤ k) (hkn : k < n) :
(k : ℝ) * subset_expected_transport_cost n s k =
((n - k : ℕ) : ℝ) * subset_expected_transport_cost n s (n - k)subset_expected_transport_cost_topIn LeanOnline Algorithms
For every server placement s : Fin n → X of n ≥ 1 servers in a pseudo metric space X, the expected subset transport cost for k = n vanishes, g_n = 0.
theorem subset_expected_transport_cost_top {X : Type*} [PseudoMetricSpace X]
(n : ℕ) (s : Fin n → X) (hn : 1 ≤ n) :
subset_expected_transport_cost n s n = 0sum_reciprocal_subset_cost_leIn LeanOnline Algorithms
For any natural number n and any sequence g : ℕ → ℝ with g(k) ≥ 0, g(n) = 0, and symmetry k * g(k) = (n - k) * g(n - k) for 1 ≤ k < n, the double sum ∑_{t=1}^n (1/t) ∑_{k=n-t+1}^n g(k) is bounded above by ∑_{k=1}^n g(k).
theorem sum_reciprocal_subset_cost_le (n : ℕ) (g : ℕ → ℝ)
(hg_nonneg : ∀ k, 0 ≤ g k)
(hgn : g n = 0)
(h_symm : ∀ k, 1 ≤ k → k < n → (k : ℝ) * g k = ((n - k : ℕ) : ℝ) * g (n - k)) :
∑ t ∈ Finset.Icc 1 n, (1 / (t : ℝ)) * ∑ k ∈ Finset.Icc (n - t + 1) n, g k ≤ ∑ k ∈ Finset.Icc 1 n, g kthreshold_schedule_min_boundIn LeanOnline Algorithms
For every horizon T ≥ 2, nonnegative increments a : Fin (T - 1) → NNReal with P runs (P = rent_or_buy_num_runs T a), every positive reset price K and every schedule rstar that is optimal with hindsight, the total cost of the threshold schedule is at most the minimum of twice the cost of rstar and the cost of rstar plus (2P - 1)K.
theorem threshold_schedule_min_bound (T : ℕ) (hT : 2 ≤ T) (a : Fin (T - 1) → NNReal) (K : ℝ) (hK : 0 < K) (rstar : Fin T → Bool) (_hopt : is_optimal_schedule T a K rstar) : rent_or_buy_cost T a K (threshold_schedule T a K) ≤ min (2 * rent_or_buy_cost T a K rstar) (rent_or_buy_cost T a K rstar + (2 * (rent_or_buy_num_runs T a : ℝ) - 1) * K)
threshold_schedule_two_competitiveIn LeanOnline Algorithms
For every horizon T, nonnegative increments a : Fin (T - 1) → NNReal, every positive reset price K, and every schedule r : Fin T → Bool, the total cost of the threshold schedule is at most twice the total cost of r.
theorem threshold_schedule_two_competitive (T : ℕ) (a : Fin (T - 1) → NNReal) (K : ℝ) (hK : 0 < K) (r : Fin T → Bool) : rent_or_buy_cost T a K (threshold_schedule T a K) ≤ 2 * rent_or_buy_cost T a K r
thrifty_greedy_count_stepIn LeanOnline Algorithms
For a non-empty finite set of timely items I, thrifty_greedy_count I = 1 + thrifty_greedy_count (I \ (thrifty_greedy_step I hI).items).
theorem thrifty_greedy_count_step (I : Finset TimelyItem) (hI : I.Nonempty) :
thrifty_greedy_count I = 1 + thrifty_greedy_count (I \ (thrifty_greedy_step I hI).items)thrifty_greedy_is_validIn LeanOnline Algorithms
Under the problem hypotheses (arrival ≤ deadline, uniform sizes s ∈ (0, 1]), the packing produced by Thrifty-Greedy thrifty_greedy I is a valid timely packing is_valid_timely_packing I (thrifty_greedy I).
theorem thrifty_greedy_is_valid (I : Finset TimelyItem)
(h_time : ∀ p ∈ I, p.arrival ≤ p.deadline)
(s : ℝ) (hs : 0 < s ∧ s ≤ 1) (h_size : ∀ p ∈ I, p.size = s) :
is_valid_timely_packing I (thrifty_greedy I)thrifty_greedy_step_items_card_posIn LeanOnline Algorithms
For any non-empty finite set of timely items I, removing the items of the first bin produced by thrifty_greedy_step I hI strictly decreases the cardinality: (I \ (thrifty_greedy_step I hI).items).card < I.card.
theorem thrifty_greedy_step_items_card_pos (I : Finset TimelyItem) (hI : I.Nonempty) :
(I \ (thrifty_greedy_step I hI).items).card < I.cardthrifty_greedy_uniform_size_optimalIn LeanOnline Algorithms
In online timely bin packing, let I : Finset TimelyItem be a finite set of items where every item p ∈ I satisfies p.arrival ≤ p.deadline, items have distinct identifiers (∀ p ∈ I, ∀ q ∈ I, p.id = q.id → p = q), and there exists s : ℝ with 0 < s ∧ s ≤ 1 such that every item p ∈ I has identical size p.size = s. Then Thrifty-Greedy achieves the optimal offline number of bins, that is, thrifty_greedy_count I = optimal_timely_bin_count I.
theorem thrifty_greedy_uniform_size_optimal (I : Finset TimelyItem)
(h_time : ∀ p ∈ I, p.arrival ≤ p.deadline)
(h_id : ∀ p ∈ I, ∀ q ∈ I, p.id = q.id → p = q)
(s : ℝ) (hs : 0 < s ∧ s ≤ 1) (h_size : ∀ p ∈ I, p.size = s) :
thrifty_greedy_count I = optimal_timely_bin_count Iuniform_kserver_det_bool_two_pow_k_competitiveIn LeanOnline Algorithms
There exists a constant C > 0 such that for every k ≥ 1 and initial configuration a on Fin k → Bool, there exists a deterministic online algorithm that is C * 2^k competitive.
theorem uniform_kserver_det_bool_two_pow_k_competitive :
∃ C : ℝ, 0 < C ∧
∀ (k : ℕ) (_hk : 1 ≤ k) (a : Fin k → Bool),
∃ A, uniform_kserver_det_competitive k A a (C * (2 : ℝ)^k)uniform_kserver_det_competitive_monoIn LeanOnline Algorithms
If an online algorithm A is γ-competitive for generalized k-server with initial configuration a, and γ ≤ γ', then A is also γ'-competitive.
theorem uniform_kserver_det_competitive_mono {k : ℕ} {M : Fin k → Type*} [∀ i, DecidableEq (M i)]
(A : List (∀ i, M i) → (∀ i, M i)) (a : ∀ i, M i) {γ γ' : ℝ}
(hγ : γ ≤ γ') (hA : uniform_kserver_det_competitive k A a γ) :
uniform_kserver_det_competitive k A a γ'uniform_kserver_det_lower_bound_multiphaseIn LeanOnline Algorithms
For any deterministic online algorithm A serving requests and any initial configuration a on Fin k → ℕ, and any natural number m, there exists a request sequence ρ such that A incurs deterministic cost at least m * (2^k - 1) while the offline optimum cost is at most m.
theorem uniform_kserver_det_lower_bound_multiphase (k : ℕ) (hk : 1 ≤ k)
(A : List (Fin k → ℕ) → (Fin k → ℕ)) (hA : uniform_kserver_det_alg_serves A)
(a : Fin k → ℕ) (m : ℕ) :
∃ (ρ : List (Fin k → ℕ)),
m * (2^k - 1) ≤ uniform_kserver_det_cost A a ρ ∧
uniform_kserver_opt k a ρ ≤ muniform_kserver_det_lower_bound_phaseIn LeanOnline Algorithms
For any deterministic online algorithm A serving requests and any initial configuration a on Fin k → ℕ, there exists a request sequence ρ such that A incurs movement cost at least 2^k - 1, and there exists an offline configuration x_star at Hamming distance at most 1 from a that serves every request in ρ.
theorem uniform_kserver_det_lower_bound_phase (k : ℕ) (hk : 1 ≤ k)
(A : List (Fin k → ℕ) → (Fin k → ℕ)) (hA : uniform_kserver_det_alg_serves A)
(a : Fin k → ℕ) :
∃ (ρ : List (Fin k → ℕ)) (x_star : Fin k → ℕ),
2^k - 1 ≤ uniform_kserver_offline_cost a (uniform_kserver_det_schedule A ρ) ∧
(Finset.univ.filter (fun i => a i ≠ x_star i)).card ≤ 1 ∧
∀ r ∈ ρ, uniform_kserver_serves x_star runiform_kserver_det_reduction_to_boolIn LeanOnline Algorithms
If an O(2^k) competitive deterministic online algorithm exists for all binary hypercube instances, then an O(2^k) competitive deterministic online algorithm exists for all generalized k-server instances on arbitrary uniform metric spaces.
theorem uniform_kserver_det_reduction_to_bool
(h_bool : ∃ C : ℝ, 0 < C ∧ ∀ (k : ℕ) (_hk : 1 ≤ k) (a : Fin k → Bool),
∃ A, uniform_kserver_det_competitive k A a (C * (2 : ℝ)^k)) :
∃ C : ℝ, 0 < C ∧ ∀ (k : ℕ) (hk : 1 ≤ k) {M : Fin k → Type*} [∀ i, DecidableEq (M i)] (a : ∀ i, M i),
∃ A, uniform_kserver_det_competitive k A a (C * (2 : ℝ)^k)uniform_kserver_expected_cost_le_logIn LeanOnline Algorithms
The total expected cost of the algorithm on ρ is at most (k+1) times the logarithm of the ratio of the initial total weight to the final total weight.
theorem uniform_kserver_expected_cost_le_log (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)] (a : ∀ i, M i) (ρ : List (∀ i, M i)) :
uniform_kserver_expected_cost k a ρ ≤
((k : ℝ) + 1) *
(Real.log (uniform_kserver_total_weight (fun₀ | a => (1:ℝ))) -
Real.log (uniform_kserver_total_weight
(ρ.foldl (fun φ r => uniform_kserver_weight_update k r φ) (fun₀ | a => (1:ℝ)))))uniform_kserver_final_arithIn LeanOnline Algorithms
Elementary real arithmetic: if 0 < P, 1 ≤ (2k)^m · P and E ≤ (k+1)(ln 1 − ln P), then E ≤ (k+1)·ln(2k)·m.
theorem uniform_kserver_final_arith (k m : ℕ) (hk : 1 ≤ k) (E P : ℝ) (hP : 0 < P)
(h1 : E ≤ ((k:ℝ) + 1) * (Real.log 1 - Real.log P))
(h2 : 1 ≤ (2 * (k : ℝ)) ^ m * P) :
E ≤ ((k : ℝ) + 1) * Real.log (2 * (k : ℝ)) * (m : ℝ)uniform_kserver_final_weight_geIn LeanOnline Algorithms
The final total weight is at least (2k) raised to minus the optimal offline cost: (2k)^OPT times the final total weight is at least 1.
theorem uniform_kserver_final_weight_ge (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)] (a : ∀ i, M i) (ρ : List (∀ i, M i)) :
1 ≤ (2 * (k : ℝ)) ^ (uniform_kserver_opt k a ρ) *
uniform_kserver_total_weight
(ρ.foldl (fun φ r => uniform_kserver_weight_update k r φ) (fun₀ | a => (1:ℝ)))uniform_kserver_hamming_update_selfIn LeanOnline Algorithms
If configuration x disagrees with request r at coordinate i, then flipping coordinate i of x to r i changes x by Hamming distance exactly 1.
theorem uniform_kserver_hamming_update_self {k : ℕ} {M : Fin k → Type*} [∀ i, DecidableEq (M i)]
(x r : ∀ i, M i) (i : Fin k) (hi : x i ≠ r i) :
hammingDist x (Function.update x i (r i)) = 1uniform_kserver_lazify_scheduleIn LeanOnline Algorithms
Any valid offline schedule can be replaced by a lazy valid schedule (same length, no larger offline cost) in which every move is necessary: whenever the configuration changes, the new configuration is obtained by flipping a single coordinate of the old one to the request's value, and the old configuration did not already serve the request.
theorem uniform_kserver_lazify_schedule (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)]
(a : ∀ i, M i) (ρ : List (∀ i, M i)) (sched : List (∀ i, M i))
(hs : uniform_kserver_is_schedule ρ sched) :
∃ sched' : List (∀ i, M i), uniform_kserver_is_schedule ρ sched' ∧
uniform_kserver_offline_cost a sched' ≤ uniform_kserver_offline_cost a sched ∧
∀ q ∈ List.zip (List.zip (a :: sched') sched') ρ,
q.1.1 ≠ q.1.2 → (¬ uniform_kserver_serves q.1.1 q.2 ∧ hammingDist q.1.1 q.1.2 = 1)uniform_kserver_lazy_optimal_scheduleIn LeanOnline Algorithms
There is an optimal offline schedule in which every move is necessary: whenever the configuration changes, the old configuration did not serve the request and the new one is a single-coordinate repair of it.
theorem uniform_kserver_lazy_optimal_schedule (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)] (a : ∀ i, M i) (ρ : List (∀ i, M i)) :
∃ sched : List (∀ i, M i), uniform_kserver_is_schedule ρ sched ∧
uniform_kserver_offline_cost a sched = uniform_kserver_opt k a ρ ∧
∀ q ∈ List.zip (List.zip (a :: sched) sched) ρ,
q.1.1 ≠ q.1.2 → (¬ uniform_kserver_serves q.1.1 q.2 ∧ hammingDist q.1.1 q.1.2 = 1)uniform_kserver_opt_attainedIn LeanOnline Algorithms
The optimal offline cost is attained: there is a valid schedule whose offline cost equals uniform_kserver_opt k a ρ.
theorem uniform_kserver_opt_attained (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)] (a : ∀ i, M i) (ρ : List (∀ i, M i)) :
∃ sched, uniform_kserver_is_schedule ρ sched ∧
uniform_kserver_offline_cost a sched = uniform_kserver_opt k a ρuniform_kserver_opt_le_schedule_costIn LeanOnline Algorithms
For any natural number k, family of types M with decidable equality, initial configuration a, request list ρ, and valid schedule sched for ρ, the optimal offline cost uniform_kserver_opt k a ρ is at most the offline movement cost uniform_kserver_offline_cost a sched.
theorem uniform_kserver_opt_le_schedule_cost {k : ℕ} {M : Fin k → Type*} [∀ i, DecidableEq (M i)]
(a : ∀ i, M i) (ρ : List (∀ i, M i)) (sched : List (∀ i, M i))
(hsched : uniform_kserver_is_schedule ρ sched) :
uniform_kserver_opt k a ρ ≤ uniform_kserver_offline_cost a scheduniform_kserver_randomized_competitiveIn LeanOnline Algorithms
Let k be a positive integer, let M be a family of uniform metric spaces indexed by Fin k with decidable equality, and let a be an initial configuration. For every finite request sequence ρ, the expected cost uniform_kserver_expected_cost k a ρ of the randomized online algorithm satisfies uniform_kserver_expected_cost k a ρ ≤ (k + 1) * ln(2k) * uniform_kserver_opt k a ρ.
theorem uniform_kserver_randomized_competitive (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)] (a : ∀ i, M i) (ρ : List (∀ i, M i)) :
uniform_kserver_expected_cost k a ρ ≤
((k : ℝ) + 1) * Real.log (2 * (k : ℝ)) * (uniform_kserver_opt k a ρ : ℝ)uniform_kserver_serves_bool_complIn LeanOnline Algorithms
For the binary family M i = Bool, a configuration x serves a request r if and only if x does not equal the bitwise complement of r.
theorem uniform_kserver_serves_bool_compl {k : ℕ}
(x r : Fin k → Bool) :
uniform_kserver_serves x r ↔ x ≠ fun i => !(r i)uniform_kserver_step_cost_boundIn LeanOnline Algorithms
For a nonnegative weight function φ of positive total weight, the expected movement cost of one algorithm step is at most (k+1) times the decrease in the logarithm of the total weight, 0 ≤ φ and 0 < total φ.
theorem uniform_kserver_step_cost_bound (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)]
(r : ∀ i, M i) (φ : (∀ i, M i) →₀ ℝ) (hφ : ∀ x, 0 ≤ φ x)
(hW : 0 < uniform_kserver_total_weight φ) :
uniform_kserver_step_expected_cost k r
((1 / uniform_kserver_total_weight φ) • φ)
((1 / uniform_kserver_total_weight (uniform_kserver_weight_update k r φ)) •
uniform_kserver_weight_update k r φ)
≤ ((k : ℝ) + 1) * (Real.log (uniform_kserver_total_weight φ)
- Real.log (uniform_kserver_total_weight (uniform_kserver_weight_update k r φ)))uniform_kserver_step_dist_expected_leIn LeanOnline Algorithms
For a probability distribution μ (nonnegative, total mass 1), the expected Hamming distance moved from a configuration x under one algorithm step is 0 if x already serves the request, and at most (k+1)/2 otherwise. (Here ∃ i, x i = r i is uniform_kserver_serves x r unfolded, so the if is decidable.)
theorem uniform_kserver_step_dist_expected_le (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)]
(r : ∀ i, M i) (μ : (∀ i, M i) →₀ ℝ) (hμ0 : ∀ y, 0 ≤ μ y)
(hμ1 : μ.sum (fun _ c => c) = 1) (x : ∀ i, M i) :
(uniform_kserver_step_dist k r μ x).sum (fun y py => py * (hammingDist x y : ℝ))
≤ if (∃ i : Fin k, x i = r i) then 0 else ((k : ℝ) + 1) / 2uniform_kserver_weight_decay_repairIn LeanOnline Algorithms
If every configuration has nonnegative weight, x does not serve the request, and y = Function.update x i (r i) is a repair of x at coordinate i, then y receives at least a 1/(2k) fraction of x's weight. (This is the repaired, correct form of the decay statement: the target must be an actual repair of x, not an arbitrary serving configuration.)
theorem uniform_kserver_weight_decay_repair (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)]
(r : ∀ i, M i) (φ : (∀ i, M i) →₀ ℝ) (hφ : ∀ x, 0 ≤ φ x) (x : ∀ i, M i) (i : Fin k)
(hx : ¬ uniform_kserver_serves x r) :
φ x / (2 * (k:ℝ)) ≤ uniform_kserver_weight_update k r φ (Function.update x i (r i))uniform_kserver_weight_retainIn LeanOnline Algorithms
If every configuration has nonnegative weight and x serves the request, then x keeps at least all of its weight across the update.
theorem uniform_kserver_weight_retain (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)]
(r : ∀ i, M i) (φ : (∀ i, M i) →₀ ℝ) (hφ : ∀ x, 0 ≤ φ x) (x : ∀ i, M i)
(hx : uniform_kserver_serves x r) :
φ x ≤ uniform_kserver_weight_update k r φ xuniform_kserver_weight_update_nonnegIn LeanOnline Algorithms
If every configuration has nonnegative weight, then after a weight update every configuration still has nonnegative weight.
theorem uniform_kserver_weight_update_nonneg (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)] (r : ∀ i, M i) (φ : (∀ i, M i) →₀ ℝ)
(hφ : ∀ x, 0 ≤ φ x) :
∀ y, 0 ≤ uniform_kserver_weight_update k r φ yuniform_kserver_weight_update_totalIn LeanOnline Algorithms
After a weight update, the total weight equals, summed over the old support, the old weight kept in full at configurations that serve the request and halved at configurations that do not. (Here ∃ i, x i = r i is uniform_kserver_serves x r unfolded, written this way so that the if is decidable.)
theorem uniform_kserver_weight_update_total (k : ℕ) (hk : 1 ≤ k)
{M : Fin k → Type*} [∀ i, DecidableEq (M i)] (r : ∀ i, M i) (φ : (∀ i, M i) →₀ ℝ) :
uniform_kserver_total_weight (uniform_kserver_weight_update k r φ)
= ∑ x ∈ φ.support, (if ∃ i : Fin k, x i = r i then φ x else φ x / 2)cnf_incidence_graph_adj_inl_inrIn LeanProof Complexity
A variable x and a clause C of F are adjacent in the incidence graph iff some literal of C has variable x.
theorem cnf_incidence_graph_adj_inl_inr {V : Type*} [DecidableEq V] (F : Finset (Finset (CnfLit V))) (x : ↥(cnf_vars F)) (C : ↥F) : (cnf_incidence_graph F).Adj (Sum.inl x) (Sum.inr C) ↔ ∃ l ∈ (C : Finset (CnfLit V)), cnf_lit_var l = (x : V)cnf_incidence_graph_adj_inr_inlIn LeanProof Complexity
A clause C of F and a variable x are adjacent in the incidence graph iff some literal of C has variable x.
theorem cnf_incidence_graph_adj_inr_inl {V : Type*} [DecidableEq V] (F : Finset (Finset (CnfLit V))) (x : ↥(cnf_vars F)) (C : ↥F) : (cnf_incidence_graph F).Adj (Sum.inr C) (Sum.inl x) ↔ ∃ l ∈ (C : Finset (CnfLit V)), cnf_lit_var l = (x : V)cnf_incidence_treewidth_le_of_clause_subsetIn LeanProof Complexity
If there is an injective map φ from the clauses of F1 to the clauses of F2 such that every clause of F1 is contained in its image and var(F1) ⊆ var(F2), then tw*(F1) <= tw*(F2).
theorem cnf_incidence_treewidth_le_of_clause_subset {V : Type*} [DecidableEq V] {F₁ F₂ : Finset (Finset (CnfLit V))} (φ : ↥F₁ → ↥F₂) (hφ : Function.Injective φ) (hvars : cnf_vars F₁ ⊆ cnf_vars F₂) (hsub : ∀ D : ↥F₁, (D : Finset (CnfLit V)) ⊆ (φ D : Finset (CnfLit V))) : cnf_incidence_treewidth F₁ ≤ cnf_incidence_treewidth F₂cnf_incidence_treewidth_monoIn LeanProof Complexity
If every clause of F1 is a clause of F2 then tw*(F1) <= tw*(F2).
theorem cnf_incidence_treewidth_mono {V : Type*} [DecidableEq V] {F₁ F₂ : Finset (Finset (CnfLit V))} (h : F₁ ⊆ F₂) : cnf_incidence_treewidth F₁ ≤ cnf_incidence_treewidth F₂cnf_incidence_treewidth_pos_of_nonempty_clauseIn LeanProof Complexity
If F contains a nonempty clause then tw*(F) >= 1.
theorem cnf_incidence_treewidth_pos_of_nonempty_clause {V : Type*} [DecidableEq V] (F : Finset (Finset (CnfLit V))) {C : Finset (CnfLit V)} (hC : C ∈ F) (hne : C.Nonempty) : 1 ≤ cnf_incidence_treewidth Fcnf_incidence_treewidth_restrict_leIn LeanProof Complexity
tw*(F|x=b) <= tw*(F) for every variable x and value b.
theorem cnf_incidence_treewidth_restrict_le {V : Type*} [DecidableEq V] (F : Finset (Finset (CnfLit V))) (x : V) (b : Bool) : cnf_incidence_treewidth (cnf_restrict F x b) ≤ cnf_incidence_treewidth Fcnf_restrict_memIn LeanProof Complexity
D is a clause of F|x=b iff D = C.erase l for some clause C of F that does not contain the literal satisfied by x = b, where l is the falsified literal.
theorem cnf_restrict_mem {V : Type*} [DecidableEq V] (F : Finset (Finset (CnfLit V))) (x : V) (b : Bool) (D : Finset (CnfLit V)) : D ∈ cnf_restrict F x b ↔ ∃ C ∈ F, (if b then CnfLit.pos x else CnfLit.neg x) ∉ C ∧ C.erase (if b then CnfLit.neg x else CnfLit.pos x) = Dcnf_restrict_unsatIn LeanProof Complexity
If F is unsatisfiable then so is F|x=b, for either value of b.
theorem cnf_restrict_unsat {V : Type*} [DecidableEq V] (F : Finset (Finset (CnfLit V))) (x : V) (b : Bool) (h : ¬ CnfSatisfiable (F.toList.map Finset.toList)) : ¬ CnfSatisfiable ((cnf_restrict F x b).toList.map Finset.toList)cnf_satisfiable_restrict_impIn LeanProof Complexity
If a truth assignment satisfies F|x=b, then extending it with x = b satisfies every clause of F: clauses containing the literal satisfied by x = b are satisfied at x, while remaining clauses had the falsified literal erased and their satisfaction in F|x=b lifts to F.
theorem cnf_satisfiable_restrict_imp {V : Type*} [DecidableEq V]
(F : Finset (Finset (CnfLit V))) (x : V) (b : Bool)
(h : CnfSatisfiable ((cnf_restrict F x b).toList.map Finset.toList)) :
CnfSatisfiable (F.toList.map Finset.toList)cnf_vars_restrict_subsetIn LeanProof Complexity
Every variable occurring in the restriction F|x=b occurs in F and is different from x.
theorem cnf_vars_restrict_subset {V : Type*} [DecidableEq V] (F : Finset (Finset (CnfLit V))) (x : V) (b : Bool) : cnf_vars (cnf_restrict F x b) ⊆ (cnf_vars F).erase xhas_tree_decomposition_of_width_le_graph_treewidthIn LeanProof Complexity
Every finite graph has a tree decomposition of width exactly its treewidth (the treewidth is attained).
theorem has_tree_decomposition_of_width_le_graph_treewidth {α : Type*} [Fintype α] (G : SimpleGraph α) : has_tree_decomposition_of_width_le G (graph_treewidth G)op_983_bdd_bias_proof_is_weighted_subcube_sumIn LeanProof Complexity
Any bounded-bias depth-three AMC proof of size s at shift ε is a representation of the counting function with ε subtracted as a sum of s nonnegatively weighted subcube indicators: the proof's rank-one summands are exactly nonnegative multiples of subcube indicators, so all bounded-bias lower bounds reduce to lower bounds on weighted subcube sums.
open scoped Classical in
theorem op_983_bdd_bias_proof_is_weighted_subcube_sum (n s : ℕ)
(A : List (List (CnfLit (Fin n)))) (ε : ℝ)
(h : has_depth_three_amc_bounded_bias_proof n A ε s) :
is_weighted_subcube_sum (fun τ : Fin n → Bool =>
((A.filter (fun t => ∀ l ∈ t, match l with
| CnfLit.pos v => τ v = true
| CnfLit.neg v => τ v = false)).length : ℝ) - ε) sop_983_bdd_bias_rank_one_is_weighted_subcubeIn LeanProof Complexity
Every bounded-bias rank-one product on the n-cube is a nonnegative multiple of the indicator of a single subcube: there are a set S of fixed coordinates, a partial assignment a on them, and a weight w ≥ 0 with R τ = w if τ agrees with a on S and R τ = 0 otherwise.
theorem op_983_bdd_bias_rank_one_is_weighted_subcube {n : ℕ} (R : (Fin n → Bool) → ℝ)
(hR : is_bounded_bias_rank_one_product R) :
∃ (S : Finset (Fin n)) (a : Fin n → Bool) (w : ℝ), 0 ≤ w ∧
∀ τ : Fin n → Bool, R τ = if ∀ i ∈ S, τ i = a i then w else 0op_983_exists_asymptotic_separation_witnessIn LeanProof Complexity
There exists a constant shift ε ∈ (0, 1] and an asymptotic family of DNF formulas admitting polynomial depth-three AMC proofs while requiring superpolynomial bounded-bias depth-three AMC proofs.
theorem op_983_exists_asymptotic_separation_witness :
∃ ε : ℝ, 0 < ε ∧ ε ≤ 1 ∧
∃ (v : ℕ → ℕ) (hv : ∀ k, k ≤ v k) (A : (k : ℕ) → List (List (CnfLit (Fin (v k))))),
∃ c : ℕ, ∃ k₀ : ℕ,
(∀ k ≥ k₀, ∃ r ≤ (v k) ^ c + c, has_depth_three_amc_proof (v k) (A k) ε r) ∧
(∀ c' : ℕ, ∃ k₀' : ℕ, ∀ k ≥ k₀', ∀ s : ℕ, has_depth_three_amc_bounded_bias_proof (v k) (A k) ε s → (v k) ^ c' < s)op_983_family_amc_upper_boundIn LeanProof Complexity
The explicit family A_n admits an arbitrary-bias depth-three AMC proof of size 1 at shift ε = 1: the counting function is 2^|τ| + 1 terms satisfied, so the required target function is τ ↦ 2^(number of true coordinates), which is the single nonnegative rank-one product with one-variable factors 2 on true and 1 on false.
open scoped Classical in
theorem op_983_family_amc_upper_bound (n : ℕ) :
has_depth_three_amc_proof n (op_983_dnf_family n) 1 1op_983_family_bdd_bias_lower_boundIn LeanProof Complexity
The lower-bound half of the separation, for the explicit family at shift ε = 1: every bounded-bias depth-three AMC proof of the explicit family A_n has size s ≥ 2^(n-1), because such a proof exactly represents the function τ ↦ 2^(number of true coordinates of τ) as a sum of s nonnegatively weighted subcube indicators.
open scoped Classical in
theorem op_983_family_bdd_bias_lower_bound (n s : ℕ)
(h : has_depth_three_amc_bounded_bias_proof n (op_983_dnf_family n) 1 s) :
2 ^ (n - 1) ≤ sop_983_family_satisfied_termsIn LeanProof Complexity
For the explicit family A_n (all-positive full-subset terms over Fin n, plus one empty term), the number of terms satisfied by a truth assignment τ equals 2^(number of coordinates on which τ is true) + 1: the term for a subset S is satisfied exactly when S is contained in the set of true coordinates of τ, there are 2^|support| such subsets, and the appended empty term is always satisfied.
open scoped Classical in
theorem op_983_family_satisfied_terms (n : ℕ) (τ : Fin n → Bool) :
((op_983_dnf_family n).filter (fun t => ∀ l ∈ t, match l with
| CnfLit.pos v => τ v = true
| CnfLit.neg v => τ v = false)).length
= 2 ^ (Finset.univ.filter (fun i => τ i = true)).card + 1op_983_poly_lt_two_pow_predIn LeanProof Complexity
For every natural number c there is k₀ such that k^c < 2^(k-1) for every k ≥ k₀. This is the elementary asymptotics that turns the exponential bounded-bias lower bound for the family at v k = k into the required superpolynomial statement.
theorem op_983_poly_lt_two_pow_pred (c : ℕ) : ∃ k₀ : ℕ, ∀ k ≥ k₀, k ^ c < 2 ^ (k - 1)
op_983_separation_at_shift_oneIn LeanProof Complexity
The separation is realised concretely at shift ε = 1 with variable count v k = k and the explicit family A k = op_983_dnf_family k: there is a polynomial upper bound on arbitrary-bias depth-three AMC proof size (size 1, hence 1 ≤ k^1 + 1), and every bounded-bias proof of size s satisfies k^c' < s for large k.
theorem op_983_separation_at_shift_one :
∃ (v : ℕ → ℕ) (hv : ∀ k, k ≤ v k) (A : (k : ℕ) → List (List (CnfLit (Fin (v k))))),
(∃ c : ℕ, ∃ k₀ : ℕ, ∀ k ≥ k₀, ∃ r ≤ (v k) ^ c + c,
has_depth_three_amc_proof (v k) (A k) 1 r) ∧
(∀ c' : ℕ, ∃ k₀' : ℕ, ∀ k ≥ k₀', ∀ s : ℕ,
has_depth_three_amc_bounded_bias_proof (v k) (A k) 1 s → (v k) ^ c' < s)op_983_subcube_sum_lower_boundIn LeanProof Complexity
The combinatorial core of the separation at constant shift: the function τ ↦ 2^(number of true coordinates of τ) cannot be written as a sum of s nonnegatively weighted subcube indicators of the n-cube unless s ≥ 2^(n-1). This is the pure statement behind the bounded-bias lower bound for the explicit family at shift ε = 1 (transfer via op_983_bdd_bias_proof_is_weighted_subcube_sum), with the AMC packaging removed.
theorem op_983_subcube_sum_lower_bound (n s : ℕ)
(h : is_weighted_subcube_sum (fun τ : Fin n → Bool =>
(2:ℝ) ^ (Finset.univ.filter (fun i => τ i = true)).card) s) :
2 ^ (n - 1) ≤ sop_983_subcube_sum_lower_bound_positiveIn LeanProof Complexity
Special case of the subcube lower bound, for up-set subcubes only: if 2^(number of true coordinates) is a sum of nonnegatively weighted indicators of subcubes that fix coordinates only to true (i.e. each subcube is the set of τ containing a fixed set S), then at least 2^n terms are needed. This is stronger than the bound 2^(n-1) needed for the separating family, and is proved by induction on n using the facet τ(last) = false and the discrete difference between the two facets.
theorem op_983_subcube_sum_lower_bound_positive {ι : Type*} [Fintype ι]
(n : ℕ) (w : ι → ℝ) (S : ι → Finset (Fin n)) (hw : ∀ j, 0 ≤ w j)
(h : ∀ τ : Fin n → Bool,
(2 : ℝ) ^ (Finset.univ.filter (fun i => τ i = true)).card
= ∑ j, (if ∀ i ∈ S j, τ i = true then w j else 0)) :
2 ^ n ≤ Fintype.card ιop_983_subcube_sum_two_pow_witnessIn LeanProof Complexity
The function τ ↦ 2^(number of true coordinates of τ) is a sum of 2^n nonnegative weighted subcube indicators: index the 2^n assignments y of the n-cube, use the fully fixed subcube {y} with weight 2^(number of true coordinates of y). In particular the class of representable functions is nonempty, and 2^n terms suffice.
theorem op_983_subcube_sum_two_pow_witness (n : ℕ) :
is_weighted_subcube_sum (fun τ : Fin n → Bool =>
(2:ℝ) ^ (Finset.univ.filter (fun i => τ i = true)).card) (2 ^ n)resolution_derivation_restrict_liftIn LeanProof Complexity
If π is a resolution derivation from F|x=b, then there is a resolution derivation from F of length at most |π| + 2|F| whose last clause is the last clause of π with the literal falsified by x = b adjoined.
theorem resolution_derivation_restrict_lift {V : Type*} [DecidableEq V] (F : Finset (Finset (CnfLit V))) (x : V) (b : Bool) (π : List (Finset (CnfLit V))) (h : is_resolution_derivation (cnf_restrict F x b) π) : ∃ π' : List (Finset (CnfLit V)), is_resolution_derivation F π' ∧ π'.getLast? = π.getLast?.map (fun D => D ∪ {(if b then CnfLit.neg x else CnfLit.pos x)}) ∧ π'.length ≤ π.length + 2 * F.cardresolution_derivation_weaken_lastIn LeanProof Complexity
If π is a resolution derivation from F with last clause C and C ⊆ C', then π ++ [C'] is a resolution derivation from F.
theorem resolution_derivation_weaken_last {V : Type*} (F : Finset (Finset (CnfLit V))) (π : List (Finset (CnfLit V))) (C C' : Finset (CnfLit V)) (h : is_resolution_derivation F π) (hl : π.getLast? = some C) (hsub : C ⊆ C') : is_resolution_derivation F (π ++ [C'])resolution_fpt_incidence_treewidth_fixed_kIn LeanProof Complexity
For every k there are constants C, c with c >= 1 such that every unsatisfiable CNF formula F with tw*(F) <= k has a resolution refutation of length at most C*(|var F| + |F|)^c.
theorem resolution_fpt_incidence_treewidth_fixed_k : ∀ k : ℕ, ∃ C c : ℕ, 1 ≤ c ∧ ∀ F : Finset (Finset (CnfLit ℕ)), cnf_incidence_treewidth F ≤ k → ¬ CnfSatisfiable (F.toList.map Finset.toList) → ∃ π, is_resolution_refutation F π ∧ π.length ≤ C * ((cnf_vars F).card + F.card) ^ c
resolution_fpt_incidence_treewidth_of_treewidth_zeroIn LeanProof Complexity
Every unsatisfiable CNF formula of incidence treewidth 0 has a resolution refutation of length 1, so the target holds with g = 1 and c = 1.
theorem resolution_fpt_incidence_treewidth_of_treewidth_zero : ∃ g : ℕ → ℕ, Computable g ∧ ∃ c : ℕ, 1 ≤ c ∧ ∀ F : Finset (Finset (CnfLit ℕ)), cnf_incidence_treewidth F = 0 → ¬ CnfSatisfiable (F.toList.map Finset.toList) → ∃ π, is_resolution_refutation F π ∧ π.length ≤ g (cnf_incidence_treewidth F) * ((cnf_vars F).card + F.card) ^ c
resolution_fpt_two_clauseIn LeanProof Complexity
Every unsatisfiable 2-CNF formula has a resolution refutation of length at most 12*(n+m)^2, so the FPT-in-incidence-treewidth statement holds for 2-CNF with g = 12, c = 2.
theorem resolution_fpt_two_clause : ∃ g : ℕ → ℕ, Computable g ∧ ∃ c : ℕ, 1 ≤ c ∧ ∀ F : Finset (Finset (CnfLit ℕ)), (∀ C ∈ F, C.card ≤ 2) → ¬ CnfSatisfiable (F.toList.map Finset.toList) → ∃ π, is_resolution_refutation F π ∧ π.length ≤ g (cnf_incidence_treewidth F) * ((cnf_vars F).card + F.card) ^ c
resolution_refutation_length_le_two_pow_varsIn LeanProof Complexity
The provable half: every unsatisfiable CNF formula has a resolution refutation of length at most 2^|var F| * (8|F| + 8).
theorem resolution_refutation_length_le_two_pow_vars (F : Finset (Finset (CnfLit ℕ))) (h : ¬ CnfSatisfiable (F.toList.map Finset.toList)) : ∃ π, is_resolution_refutation F π ∧ π.length ≤ 2 ^ (cnf_vars F).card * (8 * F.card + 8)
resolution_refutation_length_two_clauseIn LeanProof Complexity
If every clause of F has at most two literals and F is unsatisfiable, then F has a resolution refutation of length at most 4|var F| + 4|F| + 8.
theorem resolution_refutation_length_two_clause (F : Finset (Finset (CnfLit ℕ))) (h2 : ∀ C ∈ F, C.card ≤ 2) (h : ¬ CnfSatisfiable (F.toList.map Finset.toList)) : ∃ π, is_resolution_refutation F π ∧ π.length ≤ 4 * (cnf_vars F).card + 4 * F.card + 8
resolution_refutation_of_both_restrictionsIn LeanProof Complexity
If both F|x=0 and F|x=1 have resolution refutations of lengths a and b, then F has one of length at most a + b + 2|F| + 1.
theorem resolution_refutation_of_both_restrictions {V : Type*} [DecidableEq V] (F : Finset (Finset (CnfLit V))) (x : V) (π₀ π₁ : List (Finset (CnfLit V))) (h₀ : is_resolution_refutation (cnf_restrict F x false) π₀) (h₁ : is_resolution_refutation (cnf_restrict F x true) π₁) : ∃ π, is_resolution_refutation F π ∧ π.length ≤ π₀.length + π₁.length + 2 * F.card + 1admissible_block_lengths_stabilizer_campbell_howardIn LeanQuantum Computation
For natural numbers s ≥ 4 and n, there exists an s by n binary matrix S with distinct nonzero columns and rank s satisfying the stabilizer-only Campbell-Howard conditions S1, S2, S3 if and only if there exists a codeword c in the Reed-Muller code RM(s - 4, s) such that the nonzero vectors in the support of c span (Fin s → ZMod 2) and n = boolean_weight c - (c 0).val.
open scoped Classical
open Matrix in
theorem admissible_block_lengths_stabilizer_campbell_howard (s n : ℕ) (hs : 4 ≤ s) :
(∃ S : Matrix (Fin s) (Fin n) (ZMod 2),
Function.Injective Sᵀ ∧ (∀ j, Sᵀ j ≠ 0) ∧ S.rank = s ∧ stabilizer_campbell_howard_conditions S) ↔
∃ c ∈ reed_muller_code (s - 4) s,
Submodule.span (ZMod 2) {β : Fin s → ZMod 2 | β ≠ 0 ∧ c β = 1} = ⊤ ∧
n = boolean_weight c - (c 0).valalmost_quantum_box_star_mem_caqIn LeanQuantum Computation
For every integer N ≥ 2, the binary-outcome bipartite box p* with inputs x, y in {1, ..., N} belongs to the set C_AQ of almost-quantum correlations.
theorem almost_quantum_box_star_mem_caq (N : ℕ) (hN : 2 ≤ N) :
is_almost_quantum (almost_quantum_box_star N)almost_quantum_box_star_of_vectorsIn LeanQuantum Computation
Given a real Hilbert space E with a unit state vector psi and vectors a_x, b_y, w_x satisfying the inner product relations of Lemma 3, the bipartite box almost_quantum_box_star N is almost-quantum.
theorem almost_quantum_box_star_of_vectors (N : ℕ)
(E : Type) [NormedAddCommGroup E] [InnerProductSpace ℝ E] [CompleteSpace E]
(psi : E) (hpsi : ‖psi‖ = 1)
(a b w : Fin N → E)
(h_psi_a : ∀ x, inner ℝ psi (a x) = (3 : ℝ) / 17)
(h_a_a : ∀ x, inner ℝ (a x) (a x) = (3 : ℝ) / 17)
(h_psi_b : ∀ x, inner ℝ psi (b x) = (3 : ℝ) / 17)
(h_b_b : ∀ x, inner ℝ (b x) (b x) = (3 : ℝ) / 17)
(h_psi_w : ∀ x, inner ℝ psi (w x) = (1 : ℝ) / 17)
(h_w_w : ∀ x, inner ℝ (w x) (w x) = (1 : ℝ) / 17)
(h_a_w : ∀ x, inner ℝ (a x) (w x) = (1 : ℝ) / 17)
(h_b_w : ∀ x, inner ℝ (b x) (w x) = (1 : ℝ) / 17)
(h_a_b_same : ∀ x, inner ℝ (a x) (b x) = (1 : ℝ) / 17)
(h_a_b_diff : ∀ x y, x ≠ y → inner ℝ (a x) (b y) = 0)
(h_a_w_diff : ∀ x y, x ≠ y → inner ℝ (a x) (w y) = 0)
(h_b_w_diff : ∀ x y, x ≠ y → inner ℝ (b x) (w y) = 0) :
is_almost_quantum (almost_quantum_box_star N)almost_quantum_box_star_vectors_existIn LeanQuantum Computation
For every natural number N, there exists a real Hilbert space E, a unit vector psi, and vector families a, b, w : Fin N -> E satisfying the inner product identities: <psi, a_x> = ||a_x||^2 = 3/17, <psi, b_x> = ||b_x||^2 = 3/17, <psi, w_x> = ||w_x||^2 = <a_x, w_x> = <b_x, w_x> = <a_x, b_x> = 1/17, and for x != y, <a_x, b_y> = <a_x, w_y> = <b_x, w_y> = 0.
theorem almost_quantum_box_star_vectors_exist (N : ℕ) :
∃ (E : Type) (_ : NormedAddCommGroup E) (_ : InnerProductSpace ℝ E) (_ : CompleteSpace E)
(psi : E) (_ : ‖psi‖ = 1)
(a b w : Fin N → E),
(∀ x, inner ℝ psi (a x) = (3 : ℝ) / 17) ∧
(∀ x, inner ℝ (a x) (a x) = (3 : ℝ) / 17) ∧
(∀ x, inner ℝ psi (b x) = (3 : ℝ) / 17) ∧
(∀ x, inner ℝ (b x) (b x) = (3 : ℝ) / 17) ∧
(∀ x, inner ℝ psi (w x) = (1 : ℝ) / 17) ∧
(∀ x, inner ℝ (w x) (w x) = (1 : ℝ) / 17) ∧
(∀ x, inner ℝ (a x) (w x) = (1 : ℝ) / 17) ∧
(∀ x, inner ℝ (b x) (w x) = (1 : ℝ) / 17) ∧
(∀ x, inner ℝ (a x) (b x) = (1 : ℝ) / 17) ∧
(∀ x y, x ≠ y → inner ℝ (a x) (b y) = 0) ∧
(∀ x y, x ≠ y → inner ℝ (a x) (w y) = 0) ∧
(∀ x y, x ≠ y → inner ℝ (b x) (w y) = 0)almost_quantum_zero_error_efficiency_boundIn LeanQuantum Computation
For every integer N ≥ 3, the bipartite box p* belongs to the set of almost-quantum correlations, the optimal zero-error conclusive efficiency η_AQ(N) of one-bit communication for equality satisfies η_AQ(N) ≥ 1/19, and the ratio η_AQ(N) / (1/N) satisfies η_AQ(N) / (1/N) ≥ N/19.
theorem almost_quantum_zero_error_efficiency_bound (N : ℕ) (hN : 3 ≤ N) :
is_almost_quantum (almost_quantum_box_star N) ∧
1 / 19 ≤ almost_quantum_efficiency N ∧
(N : ℝ) / 19 ≤ almost_quantum_efficiency N / (1 / (N : ℝ))apply_clifford_circuit_bijectiveIn LeanQuantum Computation
Every Clifford circuit permutes the 4^k Pauli labels: each of H, S and CNOT is an involution on PauliLabel k, hence bijective, and a fold-left of bijections is bijective.
theorem apply_clifford_circuit_bijective {k : ℕ} (circ : List (CliffordGate k)) : Function.Bijective (apply_clifford_circuit circ)bell_network_lambda_commIn LeanQuantum Computation
For any vectors u, v in R^3, bell_network_lambda u v = bell_network_lambda v u.
theorem bell_network_lambda_comm (u v : Fin 3 → ℝ) : bell_network_lambda u v = bell_network_lambda v u
bell_network_lambda_le_criterionIn LeanQuantum Computation
If |u|^2 + |v|^2 <= 2M and M^2 - M(|u|^2+|v|^2) + (u.v)^2 >= 0, then Lambda(u,v) <= M.
theorem bell_network_lambda_le_criterion (u v : Fin 3 → ℝ) (M : ℝ) (h2M : (u ⬝ᵥ u) + (v ⬝ᵥ v) ≤ 2 * M) (hp : 0 ≤ M ^ 2 - M * ((u ⬝ᵥ u) + (v ⬝ᵥ v)) + (u ⬝ᵥ v) ^ 2) : bell_network_lambda u v ≤ M
bell_network_lambda_le_sIn LeanQuantum Computation
For any vectors u, v in R^3, bell_network_lambda u v <= (u . u) + (v . v).
theorem bell_network_lambda_le_s (u v : Fin 3 → ℝ) : bell_network_lambda u v ≤ (u ⬝ᵥ u) + (v ⬝ᵥ v)
bell_network_lambda_selfIn LeanQuantum Computation
For any vector u in R^3, bell_network_lambda u u equals u . u.
theorem bell_network_lambda_self (u : Fin 3 → ℝ) : bell_network_lambda u u = u ⬝ᵥ u
bell_network_lambda_z_axisIn LeanQuantum Computation
If u and v vanish on coordinates 0 and 1, then bell_network_lambda u v <= max (u . u) (v . v).
theorem bell_network_lambda_z_axis (u v : Fin 3 → ℝ) (hu0 : u 0 = 0) (hu1 : u 1 = 0) (hv0 : v 0 = 0) (hv1 : v 1 = 0) : bell_network_lambda u v ≤ max (u ⬝ᵥ u) (v ⬝ᵥ v)
bipartite_locally_encodable_of_support_le_dim_bIn LeanQuantum Computation
A normalized state ϕ on Fin (dA + dA') × Fin dB with support on {0, ..., dB - 1} × Fin dB is locally encodable if universal local encodability holds on both dA × dB and dA' × dB.
theorem bipartite_locally_encodable_of_support_le_dim_b
(dA dA' dB : ℕ) (hdA : dB ≤ dA) (hdA' : dB ≤ dA')
(hA : bipartite_universally_locally_encodable dA dB)
(hA' : bipartite_universally_locally_encodable dA' dB)
(ϕ : EuclideanSpace ℂ (Fin (dA + dA') × Fin dB))
(hϕ_norm : ‖ϕ‖ = 1)
(hϕ_supp : ∀ (i : Fin (dA + dA')) (j : Fin dB), dB ≤ (i : ℕ) → ϕ (i, j) = 0) :
is_bipartite_locally_encodable ϕbipartite_state_support_le_dim_bIn LeanQuantum Computation
Every bipartite state ψ in Fin M × Fin N can be rotated by a unitary matrix u on Fin M such that (u ⊗ 1) ψ vanishes on all coordinates (i, j) with i ≥ N.
theorem bipartite_state_support_le_dim_b (M N : ℕ)
(ψ : EuclideanSpace ℂ (Fin M × Fin N)) :
∃ u : Matrix.unitaryGroup (Fin M) ℂ,
∀ (i : Fin M) (j : Fin N), N ≤ (i : ℕ) →
(Matrix.toEuclideanLin (Matrix.kronecker u.1 (1 : Matrix (Fin N) (Fin N) ℂ)) ψ) (i, j) = 0bipartite_universal_local_encodability_multipleIn LeanQuantum Computation
Let dA, dB ∈ ℕ with dA ≥ dB ≥ 2. If universal local encodability holds for dA × dB bipartite quantum systems, then for every natural number κ ≥ 1, universal local encodability holds for (κ * dA) × dB bipartite quantum systems.
theorem bipartite_universal_local_encodability_multiple
(dA dB : ℕ) (hdA : dB ≤ dA) (hdB : 2 ≤ dB)
(hA : bipartite_universally_locally_encodable dA dB)
(κ : ℕ) (hκ : 1 ≤ κ) :
bipartite_universally_locally_encodable (κ * dA) dBboolean_function_anf_expansionIn LeanQuantum Computation
Every Boolean function f on (ZMod 2)^s equals the sum over all T of the coefficient of T in its algebraic normal form times the monomial indexed by T.
theorem boolean_function_anf_expansion {s : ℕ} (f : (Fin s → ZMod 2) → ZMod 2) :
f = ∑ T : Finset (Fin s), anf_coeff f T • monomial Tboolean_function_mem_reed_muller_or_shiftIn LeanQuantum Computation
If a Boolean function on (ZMod 2)^s (s at least 4) is orthogonal to every monomial of degree 1 up to 3, then it is a codeword of RM(s-4,s) or the sum of such a codeword with the origin indicator.
theorem boolean_function_mem_reed_muller_or_shift (s : ℕ) (hs : 4 ≤ s)
(f : (Fin s → ZMod 2) → ZMod 2)
(h : ∀ U : Finset (Fin s), 0 < U.card → U.card ≤ 3 → boolean_pairing f (monomial U) = 0) :
∃ c ∈ reed_muller_code (s - 4) s, f = c ∨ f = c + delta_zero sboolean_pairing_anf_expansionIn LeanQuantum Computation
The Boolean inner product of f with the monomial indexed by U is the sum over W contained in U of the coefficient of the complement of W in the algebraic normal form of f.
theorem boolean_pairing_anf_expansion {s : ℕ} (f : (Fin s → ZMod 2) → ZMod 2) (U : Finset (Fin s)) :
boolean_pairing f (monomial U) = ∑ W ∈ U.powerset, anf_coeff f (Wᶜ)boolean_pairing_monomial_monomialIn LeanQuantum Computation
The Boolean inner product of the monomials indexed by T and W is 1 if T union W is everything and 0 otherwise.
theorem boolean_pairing_monomial_monomial {s : ℕ} (T W : Finset (Fin s)) :
boolean_pairing (monomial T) (monomial W) = if T ∪ W = Finset.univ then 1 else 0boolean_pairing_point_delta_monomialIn LeanQuantum Computation
The Boolean inner product of the indicator of a point beta with the monomial indexed by U is the value of that monomial at beta.
theorem boolean_pairing_point_delta_monomial {s : ℕ} (β : Fin s → ZMod 2) (U : Finset (Fin s)) :
boolean_pairing (point_delta β) (monomial U) = monomial U βcard_full_support_paulisIn LeanQuantum Computation
The number of Pauli labels acting non-trivially on every qubit is 3^k, one of three choices (X, Y, Z) per qubit.
theorem card_full_support_paulis (k : ℕ) : (full_support_paulis k).card = 3 ^ k
clifford_circuit_pauli_massIn LeanQuantum Computation
Conservation of Pauli mass: for every Clifford circuit the total weight-enumerated mass over all 4^k Pauli labels is 6^k, independently of the circuit.
theorem clifford_circuit_pauli_mass (k : ℕ) (circ : List (CliffordGate k)) : ∑ p : PauliLabel k, 3 ^ (k - pauli_size (apply_clifford_circuit circ p)) = 6 ^ k
clifford_circuit_score_append_localIn LeanQuantum Computation
If a gate g preserves the Pauli size (in particular any single-qubit H or S), then appending g to a Clifford circuit does not change its score: score (circ ++ [g]) = score circ.
theorem clifford_circuit_score_append_local {k : ℕ} (circ : List (CliffordGate k)) (g : CliffordGate k)
(hg : ∀ p : PauliLabel k, pauli_size (apply_clifford_gate g p) = pauli_size p) :
clifford_circuit_score (circ ++ [g]) = clifford_circuit_score circclifford_circuit_score_eq_layercakeIn LeanQuantum Computation
Compression-profile form of the score: score circ = 3^k + sum over j < k of 2*3^(k-1-j)*M_j, where M_j counts the full-support Paulis whose image under circ has size at most j. Since a circuit is a bijection and the all-identity label is not of full support, M_0 = 0 and the profile is nondecreasing in j.
theorem clifford_circuit_score_eq_layercake (k : ℕ) (circ : List (CliffordGate k)) :
clifford_circuit_score circ = 3 ^ k + ∑ j ∈ Finset.range k, 2 * 3 ^ (k - 1 - j) *
(Finset.univ.filter (fun p : PauliLabel k => pauli_size p = k ∧ pauli_size (apply_clifford_circuit circ p) ≤ j)).cardclifford_circuit_score_le_five_pow_sub_two_powIn LeanQuantum Computation
Counting bound of arXiv:2610.04621 Section III.1: for every k-qubit Clifford circuit with k at least 1 the score is at most 5^k - 2^k. This already fixes the correct exponential base 5^k; it is not tight (the true maximum is about (3/4)*5^k).
theorem clifford_circuit_score_le_five_pow_sub_two_pow (k : ℕ) (hk : 1 ≤ k) (circ : List (CliffordGate k)) : clifford_circuit_score circ ≤ 5 ^ k - 2 ^ k
clifford_circuit_score_le_two_sided_shadow_optimal_scoreIn LeanQuantum Computation
Upper half of arXiv:2610.04621 Theorem 2 (Section III): for every k at least 1 and every k-qubit Clifford circuit, the score is at most the two-sided shadow optimum s_k, which is (3*5^k + 3^k - 6)/4 for odd k and (3*5^k - 3^k + 2)/4 for even k. Together with the published attainment by the dual-axis rotation circuit this says the maximum score is exactly s_k.
theorem clifford_circuit_score_le_two_sided_shadow_optimal_score (k : ℕ) (hk : 1 ≤ k) (circ : List (CliffordGate k)) : clifford_circuit_score circ ≤ two_sided_shadow_optimal_score k
clifford_circuit_score_prepend_localIn LeanQuantum Computation
If a gate g is a bijection on Pauli labels that preserves the Pauli size (in particular any single-qubit H or S), then prepending g to a Clifford circuit does not change its score: score (g :: circ) = score circ.
theorem clifford_circuit_score_prepend_local {k : ℕ} (circ : List (CliffordGate k)) (g : CliffordGate k)
(hbij : Function.Bijective (apply_clifford_gate g))
(hsize : ∀ p : PauliLabel k, pauli_size (apply_clifford_gate g p) = pauli_size p) :
clifford_circuit_score (g :: circ) = clifford_circuit_score circclifford_t_circuit_matrix_appendIn LeanQuantum Computation
The matrix of concatenated Clifford+T circuits is the product of their matrices in reverse order: the gates in gs2 act after gs1.
theorem clifford_t_circuit_matrix_append {N : ℕ} (gs1 gs2 : List (CliffordTGate N)) :
clifford_t_circuit_matrix (gs1 ++ gs2) = clifford_t_circuit_matrix gs2 * clifford_t_circuit_matrix gs1clifford_t_circuit_matrix_consIn LeanQuantum Computation
Prepending a gate g to a circuit gs multiplies the gate matrix of g on the right of the circuit matrix of gs.
theorem clifford_t_circuit_matrix_cons {N : ℕ} (g : CliffordTGate N) (gs : List (CliffordTGate N)) :
clifford_t_circuit_matrix (g :: gs) = clifford_t_circuit_matrix gs * clifford_t_gate_matrix gclifford_t_circuit_matrix_singletonIn LeanQuantum Computation
A single-gate circuit has the matrix of that gate.
theorem clifford_t_circuit_matrix_singleton {N : ℕ} (g : CliffordTGate N) :
clifford_t_circuit_matrix [g] = clifford_t_gate_matrix gclifford_t_circuit_t_count_consIn LeanQuantum Computation
The T-count of g :: gs is the indicator of g being a T gate plus the T-count of gs.
theorem clifford_t_circuit_t_count_cons {N : ℕ} (g : CliffordTGate N) (gs : List (CliffordTGate N)) :
clifford_t_circuit_t_count (g :: gs) =
(match g with | CliffordTGate.t _ => 1 | _ => 0) + clifford_t_circuit_t_count gsclosed_network_classical_n_local_boundIn LeanQuantum Computation
Every n-local correlation of the closed network with n independent sources and central nodes without inputs satisfies |I| ^ (1 / n) + |J| ^ (1 / n) ≤ 1, where I = 2^(-n) ∑_y ⟨f₀ ∏_i b^{(i)}_{y_i}⟩ and J = 2^(-n) ∑_y (-1)^(∑_i y_i) ⟨f₁ ∏_i b^{(i)}_{y_i}⟩ for response functions with |f₀|, |f₁| ≤ 1 and dichotomic outcomes |b^{(i)}_{y_i}| ≤ 1.
theorem closed_network_classical_n_local_bound
(n : ℕ) (hn : 1 ≤ n)
{Ω : Fin n → Type*} [∀ i, MeasurableSpace (Ω i)]
(μ : ∀ i, MeasureTheory.Measure (Ω i)) [∀ i, MeasureTheory.IsProbabilityMeasure (μ i)]
(ϕ₀ ϕ₁ : ((i : Fin n) → Ω i) → ℝ)
(hϕ₀_bound : ∀ ω, |ϕ₀ ω| ≤ 1)
(hϕ₁_bound : ∀ ω, |ϕ₁ ω| ≤ 1)
(hϕ₀_meas : Measurable ϕ₀)
(hϕ₁_meas : Measurable ϕ₁)
(β : (i : Fin n) → Fin 2 → Ω i → ℝ)
(hβ_bound : ∀ i y ω, |β i y ω| ≤ 1)
(hβ_meas : ∀ i y, Measurable (β i y))
(I J : ℝ)
(hI : I = (2 : ℝ) ^ (-(n : ℝ)) * ∑ y : Fin n → Fin 2,
∫ ω, ϕ₀ ω * ∏ i : Fin n, β i (y i) (ω i) ∂(MeasureTheory.Measure.pi μ))
(hJ : J = (2 : ℝ) ^ (-(n : ℝ)) * ∑ y : Fin n → Fin 2,
((-1 : ℝ) ^ (∑ i : Fin n, (y i).val)) *
∫ ω, ϕ₁ ω * ∏ i : Fin n, β i (y i) (ω i) ∂(MeasureTheory.Measure.pi μ)) :
|I| ^ (1 / (n : ℝ)) + |J| ^ (1 / (n : ℝ)) ≤ 1closed_network_integral_prod_piIn LeanQuantum Computation
For any product probability measure μ on Ω = ∏_{i : Fin n} Ω_i and any family of 1D functions f_i : Ω_i → ℝ, the integral of ∏_i f_i(ω_i) with respect to the product measure equals the product ∏_i ∫ f_i dμ_i.
theorem closed_network_integral_prod_pi
(n : ℕ) {Ω : Fin n → Type*} [∀ i, MeasurableSpace (Ω i)]
(μ : ∀ i, MeasureTheory.Measure (Ω i)) [∀ i, MeasureTheory.IsProbabilityMeasure (μ i)]
(f : (i : Fin n) → Ω i → ℝ) :
∫ ω, (∏ i : Fin n, f i (ω i)) ∂(MeasureTheory.Measure.pi μ) = ∏ i : Fin n, ∫ x, f i x ∂(μ i)closed_network_sum_prod_binaryIn LeanQuantum Computation
For any n and any function f : Fin n → Fin 2 → ℝ, the sum over all binary assignments y : Fin n → Fin 2 of ∏_i f(i, y_i) equals ∏_i (f(i, 0) + f(i, 1)).
theorem closed_network_sum_prod_binary
(n : ℕ) (f : Fin n → Fin 2 → ℝ) :
∑ y : Fin n → Fin 2, ∏ i : Fin n, f i (y i) = ∏ i : Fin n, (f i 0 + f i 1)closed_network_sum_prod_binary_parityIn LeanQuantum Computation
For any n and any function f : Fin n → Fin 2 → ℝ, the sum over all binary assignments y : Fin n → Fin 2 of (-1)^(∑_i y_i) ∏_i f(i, y_i) equals ∏_i (f(i, 0) - f(i, 1)).
theorem closed_network_sum_prod_binary_parity
(n : ℕ) (f : Fin n → Fin 2 → ℝ) :
∑ y : Fin n → Fin 2, ((-1 : ℝ) ^ (∑ i : Fin n, (y i).val)) * ∏ i : Fin n, f i (y i) =
∏ i : Fin n, (f i 0 - f i 1)column_indicator_pairing_monomialIn LeanQuantum Computation
The Boolean inner product of the column indicator of S with the monomial indexed by U is the sum over the columns j of the product of the entries S i j for i in U.
theorem column_indicator_pairing_monomial {s n : ℕ} (S : Matrix (Fin s) (Fin n) (ZMod 2))
(h_inj : Function.Injective Sᵀ) (U : Finset (Fin s)) :
boolean_pairing (column_indicator S) (monomial U) = ∑ j, ∏ i ∈ U, S i jcommuting_unitaries_common_eigenbasisIn LeanQuantum Computation
Let U : ι → Matrix.unitaryGroup n ℂ be a finite family of pairwise commuting unitary matrices. Then there is an orthonormal basis ψ of EuclideanSpace ℂ n such that every U i acts on each ψ j as a scalar.
theorem commuting_unitaries_common_eigenbasis {n : Type*} [Fintype n] [DecidableEq n]
{ι : Type*} [Fintype ι] (U : ι → Matrix.unitaryGroup n ℂ)
(hcomm : ∀ i j, U i * U j = U j * U i) :
∃ ψ : OrthonormalBasis n ℂ (EuclideanSpace ℂ n),
∀ i j, ∃ c : ℂ, Matrix.toEuclideanLin (U i : Matrix n n ℂ) (ψ j) = c • ψ jcubic_hypergraph_magic_mean_eq_dependent_triplesIn LeanQuantum Computation
For n ≥ 3, the arithmetic mean over CubicHypergraph n of 2^n * m_2(ψ_H) equals 1 / (2^n)^2 times the cardinality of the set of linearly dependent triples in ((ZMod 2)^n)^3.
open scoped Classical in
theorem cubic_hypergraph_magic_mean_eq_dependent_triples (n : ℕ) (hn : 3 ≤ n) :
(1 / (Fintype.card (CubicHypergraph n) : ℝ)) *
∑ H : CubicHypergraph n, (2 ^ n : ℝ) * pauliLiouvilleMomentTwo n (hypergraphState n (H.image Subtype.val)) =
(1 / ((2 ^ n : ℝ) ^ 2)) *
(((Finset.univ : Finset ((Fin n → ZMod 2) × (Fin n → ZMod 2) × (Fin n → ZMod 2))).filter
(fun ⟨u, y, z⟩ => ¬ LinearIndependent (ZMod 2) ![u, y, z])).card : ℝ)cubic_hypergraph_measure_integralIn LeanQuantum Computation
Integration of any real-valued function on CubicHypergraph n against the cubic hypergraph measure equals the arithmetic mean over all cubic hypergraphs.
theorem cubic_hypergraph_measure_integral (n : ℕ) (f : CubicHypergraph n → ℝ) :
∫ H, f H ∂(cubicHypergraphMeasure n) = (1 / (Fintype.card (CubicHypergraph n) : ℝ)) * ∑ H, f Hcubic_hypergraph_pauli_fourth_moment_integralIn LeanQuantum Computation
For n ≥ 3, the expectation over the uniform hypergraph measure of ∑_p ‖⟨ψ_H|P_p|ψ_H⟩‖⁴ equals (2^n)^{-3} times the number of tuples satisfying the fourth-moment evenness condition.
theorem cubic_hypergraph_pauli_fourth_moment_integral (n : ℕ) (hn : 3 ≤ n) : ∫ H, (∑ p : PauliString n, ‖inner ℂ (hypergraphState n (H.image Subtype.val)) (pauliOp p (hypergraphState n (H.image Subtype.val)))‖ ^ 4) ∂(cubicHypergraphMeasure n) = (((2:ℝ)^n)⁻¹)^3 * (f2CubicConditionCount n : ℝ)
cyclic_cubic_down_upIn LeanQuantum Computation
cyclic_cubic_down n (cyclic_cubic_up A) = A.
theorem cyclic_cubic_down_up {n : ℕ} (A : Finset (Fin n)) : cyclic_cubic_down n (cyclic_cubic_up A) = Acyclic_cubic_family_is_parity_reprIn LeanQuantum Computation
For every n ≥ 6, cyclic_cubic_family n is a parity representation of cyclic_cubic_syndrome n.
theorem cyclic_cubic_family_is_parity_repr (n : ℕ) (hn : 6 ≤ n) : is_parity_repr (cyclic_cubic_family n) (cyclic_cubic_syndrome n)
cyclic_cubic_finite_oldIn LeanQuantum Computation
For T ⊆ {0,...,n-1} of size 1..3, the parity of the number of the eight boundary sets that contain T equals the sum (mod 2) of the syndromes of T at levels n and n+1; the syndrome changes between the two levels exactly for T = {0,n-2,n-1} and T = {0,1,n-1}.
theorem cyclic_cubic_finite_old (n : ℕ) (hn : 6 ≤ n) (T : Finset ℕ) (hT : T ⊆ Finset.range n) (h1 : 1 ≤ T.card) (h3 : T.card ≤ 3) : (∑ S ∈ cyclic_cubic_step_old_sets n, (if T ⊆ S then (1 : ZMod 2) else 0)) = (if cyclic_cubic_synd n T then 1 else 0) + (if cyclic_cubic_synd (n + 1) T then 1 else 0)
cyclic_cubic_finite_topIn LeanQuantum Computation
For T ⊆ {0,...,n-1} of size 1..2, the parity of the number of the five boundary sets containing T equals the sum (mod 2) of the syndromes of insert n T at level n+1 and of T at level n.
theorem cyclic_cubic_finite_top (n : ℕ) (hn : 6 ≤ n) (T : Finset ℕ) (hT : T ⊆ Finset.range n) (h1 : 1 ≤ T.card) (h2 : T.card ≤ 2) : (∑ S ∈ cyclic_cubic_step_top_sets n, (if T ⊆ S then (1 : ZMod 2) else 0)) = (if cyclic_cubic_synd (n + 1) (insert n T) then 1 else 0) + (if cyclic_cubic_synd n T then 1 else 0)
cyclic_cubic_moment_base_sixIn LeanQuantum Computation
At n = 6 the Nat-level family represents the cyclic cubic syndrome: for every T ⊆ {0,...,5} of size 1..3, the number of family members containing T is odd exactly when T is a cyclic triple.
theorem cyclic_cubic_moment_base_six : ∀ T ∈ (Finset.range 6).powerset, 1 ≤ T.card → T.card ≤ 3 → (((cyclic_cubic_nat_moment 6 T : ℕ)) : ZMod 2) = (if cyclic_cubic_synd 6 T then 1 else 0)
cyclic_cubic_moment_card_transferIn LeanQuantum Computation
The number of family members containing A equals the number of Nat-level family members containing cyclic_cubic_up A.
theorem cyclic_cubic_moment_card_transfer (n : ℕ) (hn : 6 ≤ n) (A : Finset (Fin n)) : ((cyclic_cubic_family n).filter (fun y => A ⊆ y)).card = cyclic_cubic_nat_moment n (cyclic_cubic_up A)
cyclic_cubic_moment_step_oldIn LeanQuantum Computation
For T ⊆ {0,...,n-1} of size at most 3 the level-(n+1) count of family members containing T differs mod 2 from the level-n count by exactly the eight boundary indicators.
theorem cyclic_cubic_moment_step_old (n : ℕ) (hn : 6 ≤ n) (T : Finset ℕ) (hT : T ⊆ Finset.range n) (h3 : T.card ≤ 3) : ((cyclic_cubic_nat_moment (n + 1) T + cyclic_cubic_nat_moment n T : ℕ) : ZMod 2) = ∑ S ∈ cyclic_cubic_step_old_sets n, if T ⊆ S then (1 : ZMod 2) else 0
cyclic_cubic_moment_step_topIn LeanQuantum Computation
For T ⊆ {0,...,n-1} with at most 2 elements, the level-(n+1) count of family members containing insert n T differs mod 2 from the level-n count of members containing T by exactly the five boundary indicators.
theorem cyclic_cubic_moment_step_top (n : ℕ) (hn : 6 ≤ n) (T : Finset ℕ) (hT : T ⊆ Finset.range n) (h2 : T.card ≤ 2) : ((cyclic_cubic_nat_moment (n + 1) (insert n T) + cyclic_cubic_nat_moment n T : ℕ) : ZMod 2) = ∑ S ∈ cyclic_cubic_step_top_sets n, if T ⊆ S then (1 : ZMod 2) else 0
cyclic_cubic_nat_moment_group_splitIn LeanQuantum Computation
The number of Nat-level family members containing T is the sum of the numbers of group-A, group-B and group-C members containing T (the three groups are pairwise disjoint for n ≥ 6).
theorem cyclic_cubic_nat_moment_group_split (n : ℕ) (hn : 6 ≤ n) (T : Finset ℕ) : cyclic_cubic_nat_moment n T = ((cyclic_cubic_family_nat_A n).filter (fun Y => T ⊆ Y)).card + ((cyclic_cubic_family_nat_B n).filter (fun Y => T ⊆ Y)).card + ((cyclic_cubic_family_nat_C n).filter (fun Y => T ⊆ Y)).card
cyclic_cubic_natfam_cardIn LeanQuantum Computation
For n ≥ 6 the Nat-level cyclic cubic family has 2n+5 members.
theorem cyclic_cubic_natfam_card (n : ℕ) (hn : 6 ≤ n) : (cyclic_cubic_family_nat n).card = 2 * n + 5
cyclic_cubic_natfam_eq_imageIn LeanQuantum Computation
For every n, cyclic_cubic_family n is the image under cyclic_cubic_down n of cyclic_cubic_family_nat n.
theorem cyclic_cubic_natfam_eq_image (n : ℕ) : cyclic_cubic_family n = (cyclic_cubic_family_nat n).image (cyclic_cubic_down n)
cyclic_cubic_natfam_subset_rangeIn LeanQuantum Computation
For n ≥ 6 every member of cyclic_cubic_family_nat n is a subset of {0,1,...,n-1}.
theorem cyclic_cubic_natfam_subset_range (n : ℕ) (hn : 6 ≤ n) : ∀ Y ∈ cyclic_cubic_family_nat n, Y ⊆ Finset.range n
cyclic_cubic_subset_down_iffIn LeanQuantum Computation
A ⊆ cyclic_cubic_down n Y if and only if cyclic_cubic_up A ⊆ Y.
theorem cyclic_cubic_subset_down_iff {n : ℕ} (A : Finset (Fin n)) (Y : Finset ℕ) : A ⊆ cyclic_cubic_down n Y ↔ cyclic_cubic_up A ⊆ Ycyclic_cubic_synd_card_threeIn LeanQuantum Computation
For n ≥ 6, cyclic_cubic_synd n T can only hold when T has exactly 3 elements; in particular it is false for |T| ≤ 2.
theorem cyclic_cubic_synd_card_three (n : ℕ) (hn : 6 ≤ n) (T : Finset ℕ) (h : cyclic_cubic_synd n T) : T.card = 3
cyclic_cubic_syndrome_eq_syndIn LeanQuantum Computation
For n ≥ 6 and any parity A on n qubits, cyclic_cubic_syndrome n A equals 1 if cyclic_cubic_up A is a cyclic triple and 0 otherwise.
theorem cyclic_cubic_syndrome_eq_synd (n : ℕ) (hn : 6 ≤ n) (A : Finset (Fin n)) : cyclic_cubic_syndrome n A = (if cyclic_cubic_synd n (cyclic_cubic_up A) then 1 else 0)
cyclic_cubic_t_count_lower_boundIn LeanQuantum Computation
For every natural number n ≥ 6, every parity representation S of cyclic_cubic_syndrome n satisfies 2 * n + 5 ≤ S.card.
theorem cyclic_cubic_t_count_lower_bound (n : ℕ) (hn : 6 ≤ n) (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (cyclic_cubic_syndrome n)) : 2 * n + 5 ≤ S.card
cyclic_cubic_t_count_upper_boundIn LeanQuantum Computation
For every natural number n ≥ 6, there exists a parity representation of cyclic_cubic_syndrome n of cardinality 2 * n + 5.
theorem cyclic_cubic_t_count_upper_bound (n : ℕ) (hn : 6 ≤ n) : ∃ S : Finset (Finset (Fin n)), is_parity_repr S (cyclic_cubic_syndrome n) ∧ S.card = 2 * n + 5
cyclic_cubic_up_subset_rangeIn LeanQuantum Computation
For A a parity on n qubits, cyclic_cubic_up A ⊆ {0,...,n-1}.
theorem cyclic_cubic_up_subset_range {n : ℕ} (A : Finset (Fin n)) : cyclic_cubic_up A ⊆ Finset.range ndelta_zero_eq_sum_monomialIn LeanQuantum Computation
The indicator delta_zero s of the origin of (ZMod 2)^s is the sum of all monomials indexed by subsets of Fin s.
theorem delta_zero_eq_sum_monomial (s : ℕ) :
delta_zero s = ∑ T : Finset (Fin s), monomial Tf2_cubic_condition_count_eq_dependent_triplesIn LeanQuantum Computation
For n ≥ 3, the number of tuples satisfying the fourth-moment evenness condition equals 2^n times the number of linearly dependent ordered triples in ((ZMod 2)^n)^3.
open scoped Classical in
theorem f2_cubic_condition_count_eq_dependent_triples (n : ℕ) (hn : 3 ≤ n) : (f2CubicConditionCount n : ℝ) = (2:ℝ)^n * (((Finset.univ : Finset ((Fin n → ZMod 2) × (Fin n → ZMod 2) × (Fin n → ZMod 2))).filter (fun ⟨u, y, z⟩ => ¬ LinearIndependent (ZMod 2) ![u, y, z])).card : ℝ)
f2_linearly_dependent_triples_cardIn LeanQuantum Computation
For n ≥ 3, the number of triples (u, y, z) in ((ZMod 2)^n)^3 that are linearly dependent over ZMod 2 equals 7 * (2^n)^2 - 14 * 2^n + 8.
open scoped Classical in
theorem f2_linearly_dependent_triples_card (n : ℕ) (hn : 3 ≤ n) :
((Finset.univ : Finset ((Fin n → ZMod 2) × (Fin n → ZMod 2) × (Fin n → ZMod 2))).filter
(fun ⟨u, y, z⟩ => ¬ LinearIndependent (ZMod 2) ![u, y, z])).card =
7 * (2 ^ n) ^ 2 - 14 * (2 ^ n) + 8finset_powerset_sums_constantIn LeanQuantum Computation
If a ZMod 2-valued function b on subsets of Fin s has vanishing sum over the powerset of every nonempty set U of size at most 3, then b is constant with value b(empty) on every set of size at most 3.
theorem finset_powerset_sums_constant {s : ℕ} (b : Finset (Fin s) → ZMod 2)
(h : ∀ U : Finset (Fin s), 0 < U.card → U.card ≤ 3 → ∑ W ∈ U.powerset, b W = 0) :
∀ V : Finset (Fin s), V.card ≤ 3 → b V = b ∅gaussBlochA_transportIn LeanQuantum Computation
Under V = ⊗u_p, the first-qubit Bloch vector becomes a' = C(u₀) a, i.e. a'_i = Σ_j C(u₀)_{ij} a_j.
theorem gaussBlochA_transport
(V : Matrix.unitaryGroup (Fin 3 → Fin 2) ℂ) (u : ∀ p : Fin 3, Matrix.unitaryGroup (Fin 2) ℂ)
(hV : V.1 = fun x y => ∏ p, (u p).1 (x p) (y p))
(ψ : EuclideanSpace ℂ (Fin 3 → Fin 2)) :
gaussBlochA (Matrix.toEuclideanLin V.1 ψ) =
fun i => ∑ j, gaussPauliFrame (u 0).1 i j * gaussBlochA ψ jgaussBlochB_transportIn LeanQuantum Computation
Under V = ⊗u_p, the second-qubit Bloch vector becomes b' = C(u₁) b, i.e. b'_i = Σ_j C(u₁)_{ij} b_j.
theorem gaussBlochB_transport
(V : Matrix.unitaryGroup (Fin 3 → Fin 2) ℂ) (u : ∀ p : Fin 3, Matrix.unitaryGroup (Fin 2) ℂ)
(hV : V.1 = fun x y => ∏ p, (u p).1 (x p) (y p))
(ψ : EuclideanSpace ℂ (Fin 3 → Fin 2)) :
gaussBlochB (Matrix.toEuclideanLin V.1 ψ) =
fun i => ∑ j, gaussPauliFrame (u 1).1 i j * gaussBlochB ψ jgaussCorr_transportIn LeanQuantum Computation
Under V = ⊗u_p, A'_{ij} = Σ_{k,l} C(u₀)_{ik} C(u₁)_{jl} A_{kl}.
theorem gaussCorr_transport
(V : Matrix.unitaryGroup (Fin 3 → Fin 2) ℂ) (u : ∀ p : Fin 3, Matrix.unitaryGroup (Fin 2) ℂ)
(hV : V.1 = fun x y => ∏ p, (u p).1 (x p) (y p))
(ψ : EuclideanSpace ℂ (Fin 3 → Fin 2)) :
gaussCorr (Matrix.toEuclideanLin V.1 ψ) =
fun i j => ∑ k, ∑ l, gaussPauliFrame (u 0).1 i k * gaussPauliFrame (u 1).1 j l * gaussCorr ψ k lgaussInvariant_eq_zero_of_realIn LeanQuantum Computation
If all amplitudes of ψ are real, then gaussInvariant ψ = 0.
theorem gaussInvariant_eq_zero_of_real (ψ : EuclideanSpace ℂ (Fin 3 → Fin 2))
(hψ : ∀ x, (ψ x).im = 0) : gaussInvariant ψ = 0gaussInvariant_local_unitary_lawIn LeanQuantum Computation
gaussInvariant(Vψ) = det(C(u₀)) · gaussInvariant(ψ).
theorem gaussInvariant_local_unitary_law
(V : Matrix.unitaryGroup (Fin 3 → Fin 2) ℂ) (u : ∀ p : Fin 3, Matrix.unitaryGroup (Fin 2) ℂ)
(hV : V.1 = fun x y => ∏ p, (u p).1 (x p) (y p))
(ψ : EuclideanSpace ℂ (Fin 3 → Fin 2)) :
gaussInvariant (Matrix.toEuclideanLin V.1 ψ) =
(gaussPauliFrame (u 0).1).det * gaussInvariant ψgaussInvariant_smul_unitIn LeanQuantum Computation
gaussInvariant (c • ψ) = gaussInvariant ψ for any unit phase c (c·c̄ = 1).
theorem gaussInvariant_smul_unit (c : ℂ) (hc : c * star c = 1)
(ψ : EuclideanSpace ℂ (Fin 3 → Fin 2)) :
gaussInvariant (c • ψ) = gaussInvariant ψgaussInvariant_witnessIn LeanQuantum Computation
gaussInvariant three_qubit_gaussian_witness = 1/729.
theorem gaussInvariant_witness : gaussInvariant three_qubit_gaussian_witness = 1/729
gaussInvariant_zero_iff_of_local_unitaryIn LeanQuantum Computation
gaussInvariant(Vψ) = 0 iff gaussInvariant(ψ) = 0 for a product local unitary V.
theorem gaussInvariant_zero_iff_of_local_unitary
(V : Matrix.unitaryGroup (Fin 3 → Fin 2) ℂ) (u : ∀ p : Fin 3, Matrix.unitaryGroup (Fin 2) ℂ)
(hV : V.1 = fun x y => ∏ p, (u p).1 (x p) (y p))
(ψ : EuclideanSpace ℂ (Fin 3 → Fin 2)) :
(gaussInvariant (Matrix.toEuclideanLin V.1 ψ) = 0 ↔ gaussInvariant ψ = 0)gaussKronFam_mulIn LeanQuantum Computation
The entrywise tensor product is multiplicative: (⊗ A_q)(⊗ B_q) = ⊗ (A_q B_q).
theorem gaussKronFam_mul (A B : Fin 3 → Matrix (Fin 2) (Fin 2) ℂ) :
gaussKronFam A * gaussKronFam B = gaussKronFam (fun q => A q * B q)gaussPauliExpect_eq_zero_of_real_of_purelyImagIn LeanQuantum Computation
If ψ is real-valued and every entry of P_p is purely imaginary (zero real part), then ⟨ψ|P_p|ψ⟩ has zero real part.
theorem gaussPauliExpect_eq_zero_of_real_of_purelyImag (ψ : EuclideanSpace ℂ (Fin 3 → Fin 2))
(hψ : ∀ x, (ψ x).im = 0) (p : PauliString 3)
(hp : ∀ s t : Fin 3 → Fin 2, (pauliMatrix p s t).re = 0) :
gaussPauliExpect ψ p = 0gaussPauliExpect_smul_unitIn LeanQuantum Computation
For any unit complex phase c (c·c̄ = 1), the Pauli expectation is unchanged: ⟨cψ|P|cψ⟩ = ⟨ψ|P|ψ⟩.
theorem gaussPauliExpect_smul_unit (c : ℂ) (hc : c * star c = 1)
(ψ : EuclideanSpace ℂ (Fin 3 → Fin 2)) (p : PauliString 3) :
gaussPauliExpect (c • ψ) p = gaussPauliExpect ψ pgaussPauliFrame_orthogonalIn LeanQuantum Computation
Σ_k C(u)_{ik} C(u)_{jk} = δ_{ij}: the Pauli frame of a unitary is a real orthogonal 3x3 matrix.
theorem gaussPauliFrame_orthogonal (u : Matrix.unitaryGroup (Fin 2) ℂ) :
(gaussPauliFrame u.1).transpose * gaussPauliFrame u.1 = 1gaussPauliFrame_reconstructIn LeanQuantum Computation
u^* σ_i u = Σ_j C(u)_{ij} σ_j, where C(u)_{ij} = Re tr(u^* σ_i u σ_j)/2.
theorem gaussPauliFrame_reconstruct (u : Matrix.unitaryGroup (Fin 2) ℂ) (i : Fin 3) :
(u.1).conjTranspose * (gaussAxis i).toMatrix * u.1 =
∑ j, (gaussPauliFrame u.1 i j : ℂ) • (gaussAxis j).toMatrixghz_closed_network_sSup_le_of_pointwiseIn LeanQuantum Computation
If the pointwise bound Lambda(tau_{mu nu}, tau_{mu' nu'}) <= 1 + sin^2(2*alpha) holds for all frames and all setting indices, then the supremum of sqrt(Lambda(tau_{mu nu}, tau_{mu' nu'})) over all frames and setting indices is at most sqrt(1 + sin^2(2*alpha)).
theorem ghz_closed_network_sSup_le_of_pointwise (α : ℝ)
(hpt : ∀ (e f : Matrix (Fin 3) (Fin 3) ℝ), e ∈ Matrix.orthogonalGroup (Fin 3) ℝ →
f ∈ Matrix.orthogonalGroup (Fin 3) ℝ → ∀ (μ ν μ' ν' : Fin 4),
bell_network_lambda (ghz_correlation_vector α e f μ ν) (ghz_correlation_vector α e f μ' ν')
≤ 1 + Real.sin (2 * α) ^ 2) :
sSup { Real.sqrt (bell_network_lambda (ghz_correlation_vector α e f μ ν)
(ghz_correlation_vector α e f μ' ν')) |
(e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (f ∈ Matrix.orthogonalGroup (Fin 3) ℝ)
(μ : Fin 4) (ν : Fin 4) (μ' : Fin 4) (ν' : Fin 4) } ≤ Real.sqrt (1 + Real.sin (2 * α) ^ 2)ghz_closed_network_set_bddAbove_of_pointwiseIn LeanQuantum Computation
If the pointwise bound Lambda(tau_{mu nu}, tau_{mu' nu'}) <= 1 + sin^2(2*alpha) holds for all frames and all setting indices, then the closed-network value set { sqrt(Lambda(tau_{mu nu}, tau_{mu' nu'})) } is bounded above (by sqrt(1 + sin^2(2*alpha))).
theorem ghz_closed_network_set_bddAbove_of_pointwise (α : ℝ)
(hpt : ∀ (e f : Matrix (Fin 3) (Fin 3) ℝ), e ∈ Matrix.orthogonalGroup (Fin 3) ℝ →
f ∈ Matrix.orthogonalGroup (Fin 3) ℝ → ∀ (μ ν μ' ν' : Fin 4),
bell_network_lambda (ghz_correlation_vector α e f μ ν) (ghz_correlation_vector α e f μ' ν')
≤ 1 + Real.sin (2 * α) ^ 2) :
BddAbove { Real.sqrt (bell_network_lambda (ghz_correlation_vector α e f μ ν)
(ghz_correlation_vector α e f μ' ν')) |
(e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (f ∈ Matrix.orthogonalGroup (Fin 3) ℝ)
(μ : Fin 4) (ν : Fin 4) (μ' : Fin 4) (ν' : Fin 4) }ghz_closed_network_value_exact_of_pointwiseIn LeanQuantum Computation
If the pointwise bound Lambda(tau_{mu nu}, tau_{mu' nu'}) <= 1 + sin^2(2*alpha) holds for all frames e, f in O(3) and all setting indices, then the supremum of sqrt(Lambda(tau_{mu nu}, tau_{mu' nu'})) over all frames and setting indices equals sqrt(1 + sin^2(2*alpha)).
theorem ghz_closed_network_value_exact_of_pointwise (α : ℝ)
(hpt : ∀ (e f : Matrix (Fin 3) (Fin 3) ℝ), e ∈ Matrix.orthogonalGroup (Fin 3) ℝ →
f ∈ Matrix.orthogonalGroup (Fin 3) ℝ → ∀ (μ ν μ' ν' : Fin 4),
bell_network_lambda (ghz_correlation_vector α e f μ ν) (ghz_correlation_vector α e f μ' ν')
≤ 1 + Real.sin (2 * α) ^ 2) :
sSup { Real.sqrt (bell_network_lambda (ghz_correlation_vector α e f μ ν)
(ghz_correlation_vector α e f μ' ν')) |
(e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (f ∈ Matrix.orthogonalGroup (Fin 3) ℝ)
(μ : Fin 4) (ν : Fin 4) (μ' : Fin 4) (ν' : Fin 4) } = Real.sqrt (1 + Real.sin (2 * α) ^ 2)ghz_closed_network_value_memIn LeanQuantum Computation
For every parameter alpha, the value sqrt(1 + sin^2(2*alpha)) belongs to the closed-network value set, i.e. it is realized as sqrt(Lambda(tau_{mu nu}, tau_{mu' nu'})) for some orthonormal frames e, f in O(3) and some setting indices.
theorem ghz_closed_network_value_mem (α : ℝ) :
Real.sqrt (1 + Real.sin (2 * α) ^ 2) ∈
{ Real.sqrt (bell_network_lambda (ghz_correlation_vector α e f μ ν)
(ghz_correlation_vector α e f μ' ν')) |
(e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (f ∈ Matrix.orthogonalGroup (Fin 3) ℝ)
(μ : Fin 4) (ν : Fin 4) (μ' : Fin 4) (ν' : Fin 4) }ghz_correlation_vector_coords_zero_of_zeroIn LeanQuantum Computation
If mu = 0 or nu = 0, the 0th and 1st coordinates of ghz_correlation_vector vanish.
theorem ghz_correlation_vector_coords_zero_of_zero (α : ℝ) (e f : Matrix (Fin 3) (Fin 3) ℝ) (μ ν : Fin 4) (h : μ = 0 ∨ ν = 0) : ghz_correlation_vector α e f μ ν 0 = 0 ∧ ghz_correlation_vector α e f μ ν 1 = 0
ghz_correlation_vector_lambda_diagIn LeanQuantum Computation
For any single setting (mu, nu), Lambda(tau_{mu nu}, tau_{mu nu}) is at most 1 + sin^2(2alpha).
theorem ghz_correlation_vector_lambda_diag (α : ℝ) (e f : Matrix (Fin 3) (Fin 3) ℝ) (he : e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (hf : f ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (μ ν : Fin 4) : bell_network_lambda (ghz_correlation_vector α e f μ ν) (ghz_correlation_vector α e f μ ν) ≤ 1 + Real.sin (2 * α) ^ 2
ghz_correlation_vector_lambda_distinct_nonzeroIn LeanQuantum Computation
For distinct nonzero setting pairs, Lambda(tau_{mu nu}, tau_{mu' nu'}) <= 1 + sin^2(2alpha).
theorem ghz_correlation_vector_lambda_distinct_nonzero (α : ℝ) (e f : Matrix (Fin 3) (Fin 3) ℝ) (he : e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (hf : f ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (μ ν μ' ν' : Fin 4) (hμ : μ ≠ 0) (hν : ν ≠ 0) (hμ' : μ' ≠ 0) (hν' : ν' ≠ 0) (hne : μ ≠ μ' ∨ ν ≠ ν') : bell_network_lambda (ghz_correlation_vector α e f μ ν) (ghz_correlation_vector α e f μ' ν') ≤ 1 + Real.sin (2 * α) ^ 2
ghz_correlation_vector_lambda_zero_nnIn LeanQuantum Computation
When mu = 0 or nu = 0 and mu' != 0 and nu' != 0, Lambda(tau_{mu nu}, tau_{mu' nu'}) <= 1 + sin^2(2*alpha).
theorem ghz_correlation_vector_lambda_zero_nn (α : ℝ) (e f : Matrix (Fin 3) (Fin 3) ℝ) (he : e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (hf : f ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (μ ν μ' ν' : Fin 4) (hzero : μ = 0 ∨ ν = 0) (hnn : μ' ≠ 0 ∧ ν' ≠ 0) : bell_network_lambda (ghz_correlation_vector α e f μ ν) (ghz_correlation_vector α e f μ' ν') ≤ 1 + Real.sin (2 * α) ^ 2
ghz_correlation_vector_norm_sqIn LeanQuantum Computation
The squared norm of the correlation vector tau_{mu nu} equals sin^2(2alpha) times (a_1^2+a_2^2)(c_1^2+c_2^2) plus the square of its third component cos(2alpha) a_0 c_0 + a_0 c_3 + a_3 c_0 + cos(2alpha) a_3 c_3, where a = ghz_pauli_coeff e mu and c = ghz_pauli_coeff f nu.
theorem ghz_correlation_vector_norm_sq (α : ℝ) (e f : Matrix (Fin 3) (Fin 3) ℝ) (μ ν : Fin 4) : (ghz_correlation_vector α e f μ ν ⬝ᵥ ghz_correlation_vector α e f μ ν) = Real.sin (2 * α) ^ 2 * ((ghz_pauli_coeff e μ 1) ^ 2 + (ghz_pauli_coeff e μ 2) ^ 2) * ((ghz_pauli_coeff f ν 1) ^ 2 + (ghz_pauli_coeff f ν 2) ^ 2) + (Real.cos (2 * α) * ghz_pauli_coeff e μ 0 * ghz_pauli_coeff f ν 0 + ghz_pauli_coeff e μ 0 * ghz_pauli_coeff f ν 3 + ghz_pauli_coeff e μ 3 * ghz_pauli_coeff f ν 0 + Real.cos (2 * α) * ghz_pauli_coeff e μ 3 * ghz_pauli_coeff f ν 3) ^ 2
ghz_correlation_vector_norm_sq_le_oneIn LeanQuantum Computation
The Euclidean norm squared of ghz_correlation_vector alpha e f mu nu is at most 1 for orthogonal matrices e and f.
theorem ghz_correlation_vector_norm_sq_le_one (α : ℝ) (e f : Matrix (Fin 3) (Fin 3) ℝ) (he : e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (hf : f ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (μ ν : Fin 4) : ghz_correlation_vector α e f μ ν ⬝ᵥ ghz_correlation_vector α e f μ ν ≤ 1
ghz_correlation_vector_norm_sq_of_ne_zeroIn LeanQuantum Computation
If mu and nu are both nonzero, then the squared norm of tau_{mu nu} equals sin^2(2alpha)(1-P)(1-Q) + cos^2(2alpha) P Q, where P = (a_3)^2 and Q = (c_3)^2.
theorem ghz_correlation_vector_norm_sq_of_ne_zero (α : ℝ) (e f : Matrix (Fin 3) (Fin 3) ℝ) (he : e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (hf : f ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (μ ν : Fin 4) (hμ : μ ≠ 0) (hν : ν ≠ 0) : (ghz_correlation_vector α e f μ ν ⬝ᵥ ghz_correlation_vector α e f μ ν) = Real.sin (2 * α) ^ 2 * (1 - (ghz_pauli_coeff e μ 3) ^ 2) * (1 - (ghz_pauli_coeff f ν 3) ^ 2) + Real.cos (2 * α) ^ 2 * (ghz_pauli_coeff e μ 3) ^ 2 * (ghz_pauli_coeff f ν 3) ^ 2
ghz_correlation_vector_sum_sq_le_of_neIn LeanQuantum Computation
For distinct nonzero settings (mu, nu) != (mu', nu'), the sum of squared norms of the correlation vectors is at most 1 + sin^2(2*alpha).
theorem ghz_correlation_vector_sum_sq_le_of_ne (α : ℝ) (e f : Matrix (Fin 3) (Fin 3) ℝ) (he : e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (hf : f ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (μ ν μ' ν' : Fin 4) (hμ : μ ≠ 0) (hν : ν ≠ 0) (hμ' : μ' ≠ 0) (hν' : ν' ≠ 0) (hne : μ ≠ μ' ∨ ν ≠ ν') : ghz_correlation_vector α e f μ ν ⬝ᵥ ghz_correlation_vector α e f μ ν + ghz_correlation_vector α e f μ' ν' ⬝ᵥ ghz_correlation_vector α e f μ' ν' ≤ 1 + Real.sin (2 * α) ^ 2
ghz_correlation_vector_third_coord_sq_le_oneIn LeanQuantum Computation
If mu = 0 or nu = 0, then the square of the third component of tau_{mu nu} is at most 1.
theorem ghz_correlation_vector_third_coord_sq_le_one (α : ℝ) (e f : Matrix (Fin 3) (Fin 3) ℝ) (he : e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (hf : f ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (μ ν : Fin 4) (h : μ = 0 ∨ ν = 0) : (ghz_correlation_vector α e f μ ν 2) ^ 2 ≤ 1
ghz_dim_eight_case_hamiltonianIn LeanQuantum Computation
Let G be a simple graph on 8 vertices with edge colouring c and weights w forming a GHZ graph (is_ghz_graph G c w). Suppose M₀,…,M₃ are perfect matchings of G, each monochromatic with pairwise distinct colours, and suppose SOME pair of them has a union NOT split by any 4-element vertex set (equivalently, that pair's union is an alternating Hamiltonian 8-cycle). Then we reach a contradiction.
theorem ghz_dim_eight_case_hamiltonian {V : Type*} [Fintype V] (G : SimpleGraph V)
(c : Sym2 V → ℕ) (w : Sym2 V → ℂ) (hV : Fintype.card V = 8)
(Ms : Fin 4 → Finset (Sym2 V)) (ks : Fin 4 → ℕ)
(hperf : ∀ i, ghz_is_perfect_matching G (Ms i))
(hmono : ∀ i, ∀ e ∈ Ms i, c e = ks i)
(hinj : Function.Injective ks)
(hham : ∃ i j : Fin 4, i ≠ j ∧ ¬ (∃ A : Finset V, A.card = 4 ∧
∀ e : Sym2 V, (e ∈ Ms i ∨ e ∈ Ms j) →
(∀ v : V, v ∈ e → v ∈ A) ∨ (∀ v : V, v ∈ e → v ∉ A)))
(hw : is_ghz_graph G c w) : Falseghz_dim_eight_case_two_four_cyclesIn LeanQuantum Computation
Let G be a simple graph on 8 vertices with an edge colouring c and edge weights w forming a GHZ graph (is_ghz_graph G c w). Suppose M₀,…,M₃ are perfect matchings of G, each monochromatic with pairwise distinct colours, and suppose additionally that the union of ANY two of them is split by a 4-element vertex set (equivalently, each pairwise union is two disjoint 4-cycles). Then we reach a contradiction.
theorem ghz_dim_eight_case_two_four_cycles {V : Type*} [Fintype V] (G : SimpleGraph V)
(c : Sym2 V → ℕ) (w : Sym2 V → ℂ) (hV : Fintype.card V = 8)
(Ms : Fin 4 → Finset (Sym2 V)) (ks : Fin 4 → ℕ)
(hperf : ∀ i, ghz_is_perfect_matching G (Ms i))
(hmono : ∀ i, ∀ e ∈ Ms i, c e = ks i)
(hinj : Function.Injective ks)
(hsplit : ∀ i j : Fin 4, i ≠ j → ∃ A : Finset V, A.card = 4 ∧
∀ e : Sym2 V, (e ∈ Ms i ∨ e ∈ Ms j) →
(∀ v : V, v ∈ e → v ∈ A) ∨ (∀ v : V, v ∈ e → v ∉ A))
(hw : is_ghz_graph G c w) : Falseghz_dim_eight_no_four_monochromatic_coloursIn LeanQuantum Computation
For a simple graph G on 8 vertices and a GHZ structure is_ghz_graph G c w, there do not exist four perfect matchings M₀,…,M₃ of G, each monochromatic with pairwise distinct colours. Equivalently, at most 3 colours admit a monochromatic perfect matching.
theorem ghz_dim_eight_no_four_monochromatic_colours {V : Type*} [Fintype V]
(G : SimpleGraph V) (hV : Fintype.card V = 8)
(c : Sym2 V → ℕ) (w : Sym2 V → ℂ) (hw : is_ghz_graph G c w) :
¬ ∃ (Ms : Fin 4 → Finset (Sym2 V)) (ks : Fin 4 → ℕ),
(∀ i, ghz_is_perfect_matching G (Ms i)) ∧
(∀ i, ∀ e ∈ Ms i, c e = ks i) ∧ Function.Injective ksghz_dim_six_three_matchings_transversalIn LeanQuantum Computation
For any simple graph on a 6-vertex set and any three pairwise disjoint perfect matchings M1, M2, M3, there exists a transversal edge triple {e1, e2, e3} with e_i ∈ M_i that forms a perfect matching.
theorem ghz_dim_six_three_matchings_transversal {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (hV : Fintype.card V = 6)
(M1 M2 M3 : Finset (Sym2 V))
(hM1 : ghz_is_perfect_matching G M1)
(hM2 : ghz_is_perfect_matching G M2)
(hM3 : ghz_is_perfect_matching G M3)
(h12 : Disjoint M1 M2) (h23 : Disjoint M2 M3) (h13 : Disjoint M1 M3) :
∃ e1 ∈ M1, ∃ e2 ∈ M2, ∃ e3 ∈ M3,
ghz_is_perfect_matching G ({e1, e2, e3} : Finset (Sym2 V))ghz_lambda_one_z_axis_algebraIn LeanQuantum Computation
With sigma^2 + kappa^2 = 1, t^2 <= 1 and P, Q in [0,1]: (1+sigma^2)^2 - (1+sigma^2)(t^2 + sigma^2 (1-P)(1-Q) + kappa^2 PQ) + t^2 kappa^2 P Q >= 0.
theorem ghz_lambda_one_z_axis_algebra (σ κ t P Q : ℝ) (hσκ : σ ^ 2 + κ ^ 2 = 1) (ht : t ^ 2 ≤ 1) (hP : 0 ≤ P) (hP1 : P ≤ 1) (hQ : 0 ≤ Q) (hQ1 : Q ≤ 1) : 0 ≤ (1 + σ ^ 2) ^ 2 - (1 + σ ^ 2) * (t ^ 2 + (σ ^ 2 * (1 - P) * (1 - Q) + κ ^ 2 * P * Q)) + t ^ 2 * (κ ^ 2 * P * Q)
ghz_matching_index_dim_eight_of_colour_boundIn LeanQuantum Computation
For a simple graph G on 8 vertices, if every GHZ colouring/weight structure (is_ghz_graph G c w) has at most 3 colours that admit a monochromatic perfect matching, then the matching index ghz_matching_index G is at most 3.
theorem ghz_matching_index_dim_eight_of_colour_bound {V : Type*} [Fintype V]
(G : SimpleGraph V) (hV : Fintype.card V = 8)
(h : ∀ (c : Sym2 V → ℕ) (w : Sym2 V → ℂ), is_ghz_graph G c w →
Set.ncard {k : ℕ | ∃ M : Finset (Sym2 V), ghz_is_perfect_matching G M ∧ ∀ e ∈ M, c e = k} ≤ 3) :
ghz_matching_index G ≤ 3ghz_pauli_coeff_orthonormalIn LeanQuantum Computation
For an orthonormal frame e of R^3, the four Pauli coefficient vectors ghz_pauli_coeff e mu, mu in {0,1,2,3}, are pairwise orthogonal and each has norm 1: the sum over i of a_i * a'_i is 1 when mu = mu' and 0 otherwise.
theorem ghz_pauli_coeff_orthonormal (e : Matrix (Fin 3) (Fin 3) ℝ) (he : e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (μ μ' : Fin 4) : (∑ i : Fin 4, ghz_pauli_coeff e μ i * ghz_pauli_coeff e μ' i) = if μ = μ' then 1 else 0
ghz_pauli_coeff_third_sq_add_leIn LeanQuantum Computation
For two distinct nonzero setting indices mu, mu' the third Pauli coefficients of the frame e satisfy (a_3)^2 + (a'_3)^2 <= 1.
theorem ghz_pauli_coeff_third_sq_add_le (e : Matrix (Fin 3) (Fin 3) ℝ) (he : e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (μ μ' : Fin 4) (hμ : μ ≠ 0) (hμ' : μ' ≠ 0) (hne : μ ≠ μ') : (ghz_pauli_coeff e μ 3) ^ 2 + (ghz_pauli_coeff e μ' 3) ^ 2 ≤ 1
ghz_simple_graph_dim_eightIn LeanQuantum Computation
For any finite type V with Fintype.card V = 8 and any simple graph G on V, the matching index ghz_matching_index G is at most 3.
theorem ghz_simple_graph_dim_eight {V : Type*} [Fintype V] (G : SimpleGraph V)
(hV : Fintype.card V = 8) : ghz_matching_index G ≤ 3ghz_simple_graph_dim_sixIn LeanQuantum Computation
For any finite type V with Fintype.card V = 6 and any simple graph G on V, the matching index ghz_matching_index G is at most 2.
theorem ghz_simple_graph_dim_six {V : Type*} [Fintype V] (G : SimpleGraph V)
(hV : Fintype.card V = 6) : ghz_matching_index G ≤ 2ghz_simple_graph_dim_six_eightIn LeanQuantum Computation
For any finite type V and any simple graph G on V, if Fintype.card V = 6 then ghz_matching_index G ≤ 2, and if Fintype.card V = 8 then ghz_matching_index G ≤ 3.
theorem ghz_simple_graph_dim_six_eight {V : Type*} [Fintype V] (G : SimpleGraph V) :
(Fintype.card V = 6 → ghz_matching_index G ≤ 2) ∧
(Fintype.card V = 8 → ghz_matching_index G ≤ 3)ghz_three_monochromatic_matchingsIn LeanQuantum Computation
If the number of monochromatic inherited vertex colourings is at least 3, there exist three pairwise disjoint perfect matchings M1, M2, M3 whose edges are uniformly coloured by distinct colours k1, k2, k3.
theorem ghz_three_monochromatic_matchings {V : Type*} [Fintype V] (G : SimpleGraph V)
(hV : Fintype.card V = 6) (c : Sym2 V → ℕ)
(h3 : 3 ≤ Set.ncard { vc : V → ℕ |
(∃ M : Finset (Sym2 V), ghz_is_perfect_matching G M ∧ ∀ e ∈ M, ∀ u : V, u ∈ e → vc u = c e) ∧
(∃ k : ℕ, ∀ u : V, vc u = k) }) :
∃ M1 M2 M3 : Finset (Sym2 V),
ghz_is_perfect_matching G M1 ∧
ghz_is_perfect_matching G M2 ∧
ghz_is_perfect_matching G M3 ∧
Disjoint M1 M2 ∧ Disjoint M2 M3 ∧ Disjoint M1 M3 ∧
∃ k1 k2 k3 : ℕ, k1 ≠ k2 ∧ k2 ≠ k3 ∧ k1 ≠ k3 ∧
(∀ e ∈ M1, c e = k1) ∧ (∀ e ∈ M2, c e = k2) ∧ (∀ e ∈ M3, c e = k3)ghz_transversal_contradictionIn LeanQuantum Computation
In a GHZ graph G, there cannot exist a perfect matching {e1, e2, e3} whose edges have pairwise distinct colours, because its induced non-monochromatic vertex colouring has non-zero weight (as this matching is uniquely compatible).
theorem ghz_transversal_contradiction {V : Type*} [Fintype V] [DecidableEq V]
(G : SimpleGraph V) (c : Sym2 V → ℕ) (w : Sym2 V → ℂ)
(hw : is_ghz_graph G c w)
(e1 e2 e3 : Sym2 V)
(hM : ghz_is_perfect_matching G ({e1, e2, e3} : Finset (Sym2 V)))
(h12 : c e1 ≠ c e2) (h23 : c e2 ≠ c e3) (h13 : c e1 ≠ c e3) :
Falseghz_two_nonzero_constraint_dischargeIn LeanQuantum Computation
For two distinct nonzero setting pairs, the three constraint alternatives needed by the T4-T4 algebraic inequality always hold: either the two e-indices agree and the two f-third-coefficient squares sum to at most 1, or symmetrically, or both sums are at most 1.
theorem ghz_two_nonzero_constraint_discharge (e f : Matrix (Fin 3) (Fin 3) ℝ) (haddE : ∀ μ μ' : Fin 4, μ ≠ 0 → μ' ≠ 0 → μ ≠ μ' → (ghz_pauli_coeff e μ 3) ^ 2 + (ghz_pauli_coeff e μ' 3) ^ 2 ≤ 1) (haddF : ∀ ν ν' : Fin 4, ν ≠ 0 → ν' ≠ 0 → ν ≠ ν' → (ghz_pauli_coeff f ν 3) ^ 2 + (ghz_pauli_coeff f ν' 3) ^ 2 ≤ 1) (μ ν μ' ν' : Fin 4) (hμ : μ ≠ 0) (hν : ν ≠ 0) (hμ' : μ' ≠ 0) (hν' : ν' ≠ 0) (hne : μ ≠ μ' ∨ ν ≠ ν') : ((ghz_pauli_coeff e μ 3) ^ 2 = (ghz_pauli_coeff e μ' 3) ^ 2 ∧ (ghz_pauli_coeff f ν 3) ^ 2 + (ghz_pauli_coeff f ν' 3) ^ 2 ≤ 1) ∨ ((ghz_pauli_coeff f ν 3) ^ 2 = (ghz_pauli_coeff f ν' 3) ^ 2 ∧ (ghz_pauli_coeff e μ 3) ^ 2 + (ghz_pauli_coeff e μ' 3) ^ 2 ≤ 1) ∨ ((ghz_pauli_coeff e μ 3) ^ 2 + (ghz_pauli_coeff e μ' 3) ^ 2 ≤ 1 ∧ (ghz_pauli_coeff f ν 3) ^ 2 + (ghz_pauli_coeff f ν' 3) ^ 2 ≤ 1)
ghz_two_nonzero_sum_sq_algebraIn LeanQuantum Computation
Let a + b = 1 with a, b >= 0 and let P, Q, P', Q' lie in [0,1]. If (P = P' and Q + Q' <= 1) or (Q = Q' and P + P' <= 1) or (P + P' <= 1 and Q + Q' <= 1), then a(1-P)(1-Q) + bPQ + a(1-P')(1-Q') + bP'Q' <= 1 + a.
theorem ghz_two_nonzero_sum_sq_algebra (a b P Q P' Q' : ℝ) (ha : 0 ≤ a) (hb : 0 ≤ b) (hab : a + b = 1) (hP : 0 ≤ P) (hP1 : P ≤ 1) (hQ : 0 ≤ Q) (hQ1 : Q ≤ 1) (hP' : 0 ≤ P') (hP'1 : P' ≤ 1) (hQ' : 0 ≤ Q') (hQ'1 : Q' ≤ 1) (hcase : (P = P' ∧ Q + Q' ≤ 1) ∨ (Q = Q' ∧ P + P' ≤ 1) ∨ (P + P' ≤ 1 ∧ Q + Q' ≤ 1)) : a * (1 - P) * (1 - Q) + b * P * Q + (a * (1 - P') * (1 - Q') + b * P' * Q') ≤ 1 + a
hypergraph_state_pauli_inner_fourthIn LeanQuantum Computation
For a hypergraph state ψ_H = hypergraphState n H and any Pauli string p, ‖⟨ψ_H|P_p|ψ_H⟩‖⁴ = (2^n)^{-4} · (∑_x χ_H(x)·χ_H(x + pauliXSupport p)·(−1)^{∑_i (pauliZSupport p i)·(x i)})⁴.
theorem hypergraph_state_pauli_inner_fourth (n : ℕ) (H : Finset (Finset (Fin n))) (p : PauliString n) : ‖inner ℂ (hypergraphState n H) (pauliOp p (hypergraphState n H))‖ ^ 4 = (((2 : ℝ) ^ n)⁻¹) ^ 4 * (∑ x : Fin n → Fin 2, cubicHypergraphCocycle n H x * cubicHypergraphCocycle n H (x + pauliXSupport p) * (-1 : ℝ) ^ (∑ i : Fin n, (pauliZSupport p i).val * (x i).val)) ^ 4
is_bipartite_locally_encodable_of_local_unitaryIn LeanQuantum Computation
If a bipartite state ψ is locally encodable, then (uA ⊗ uB) ψ is also locally encodable for any unitaries uA and uB.
theorem is_bipartite_locally_encodable_of_local_unitary
{m n : Type*} [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n]
(ψ : EuclideanSpace ℂ (m × n)) (hψ : is_bipartite_locally_encodable ψ)
(uA : Matrix.unitaryGroup m ℂ) (uB : Matrix.unitaryGroup n ℂ) :
is_bipartite_locally_encodable (Matrix.toEuclideanLin (Matrix.kronecker uA.1 uB.1) ψ)is_local_unitary_invIn LeanQuantum Computation
The inverse of a local unitary is again a local unitary: invert each local factor.
theorem is_local_unitary_inv {Parties : Type*} [Fintype Parties] [DecidableEq Parties]
{d : Parties → Type*} [∀ p, Fintype (d p)] [∀ p, DecidableEq (d p)]
{V : Matrix.unitaryGroup ((p : Parties) → d p) ℂ}
(hV : is_local_unitary V) : is_local_unitary V⁻¹is_local_unitary_mulIn LeanQuantum Computation
The product of two local unitaries (tensor products of local unitaries) is again a local unitary: tensor the local factors.
theorem is_local_unitary_mul {Parties : Type*} [Fintype Parties] [DecidableEq Parties]
{d : Parties → Type*} [∀ p, Fintype (d p)] [∀ p, DecidableEq (d p)]
{V W : Matrix.unitaryGroup ((p : Parties) → d p) ℂ}
(hV : is_local_unitary V) (hW : is_local_unitary W) : is_local_unitary (V * W)is_locally_encodable_of_local_unitaryIn LeanQuantum Computation
If a state ψ is locally encodable and V is a local unitary, then Vψ is locally encodable.
theorem is_locally_encodable_of_local_unitary {Parties : Type*} [Fintype Parties] [DecidableEq Parties]
{d : Parties → Type*} [∀ p, Fintype (d p)] [∀ p, DecidableEq (d p)]
{ψ : EuclideanSpace ℂ ((p : Parties) → d p)}
(hψ : is_locally_encodable ψ)
(V : Matrix.unitaryGroup ((p : Parties) → d p) ℂ) (hV : is_local_unitary V) :
is_locally_encodable
(Matrix.toEuclideanLin (V : Matrix ((p : Parties) → d p) ((p : Parties) → d p) ℂ) ψ)krawtchouk_zeros_classification_le_fourIn LeanQuantum Computation
For m ≤ 4, positive integers satisfying k + ℓ = m + n - 2 with m ≤ n, k ≤ ℓ and binary Krawtchouk zero krawtchouk (k + ℓ) (m - 1) k = 0 satisfy k = ℓ or belong to the m = 3 family or one of the two m = 4 infinite families (arXiv:2611.08518 Proposition 2.2).
theorem krawtchouk_zeros_classification_le_four
(m n k ℓ : ℕ)
(hm : 0 < m) (hn : 0 < n) (hk : 0 < k) (hℓ : 0 < ℓ)
(hm4 : m ≤ 4)
(hmn : m ≤ n) (hkℓ : k ≤ ℓ)
(hsum : k + ℓ = m + n - 2)
(hpoly : krawtchouk (k + ℓ) (m - 1) k = 0) :
k = ℓ ∨
(m = 3 ∧ ∃ t ≥ 2, n = t ^ 2 - 1 ∧ k = t * (t - 1) / 2 ∧ ℓ = t * (t + 1) / 2) ∨
(m = 4 ∧ ∃ t ≥ 1, n = 3 * t ^ 2 + 2 * t - 1 ∧ k = (3 * t ^ 2 - t) / 2 ∧ ℓ = (3 * t ^ 2 + 5 * t + 2) / 2) ∨
(m = 4 ∧ ∃ s ≥ 1, n = 3 * s ^ 2 + 4 * s ∧ k = (3 * s ^ 2 + s) / 2 ∧ ℓ = (3 * s ^ 2 + 7 * s + 4) / 2)lifting_lemma_bipartite_universal_local_encodabilityIn LeanQuantum Computation
Let dA, dA', dB ∈ ℕ with dA, dA' ≥ dB ≥ 2. If universal local encodability holds for both dA × dB and dA' × dB bipartite quantum systems, then it also holds for (dA + dA') × dB bipartite quantum systems.
theorem lifting_lemma_bipartite_universal_local_encodability
(dA dA' dB : ℕ) (hdA : dB ≤ dA) (hdA' : dB ≤ dA') (hdB : 2 ≤ dB)
(hA : bipartite_universally_locally_encodable dA dB)
(hA' : bipartite_universally_locally_encodable dA' dB) :
bipartite_universally_locally_encodable (dA + dA') dBlocal_encoding_via_abelian_traceless_groupIn LeanQuantum Computation
For a finite set of parties with finite dimension types d p, let G be an abelian subgroup of the unitary group Matrix.unitaryGroup ((p : Parties) → d p) ℂ of order equal to the total dimension D = Fintype.card ((p : Parties) → d p), such that every element of G is a tensor product of local unitaries and every non-identity element has Matrix.trace equal to 0. Then there exists an orthonormal basis ψ of EuclideanSpace ℂ ((p : Parties) → d p) that is a common eigenbasis for all elements of G, and for every choice of phase angles θ : ((p : Parties) → d p) → ℝ, the maximally coherent state D^{-1/2} ∑_j exp(i θ_j) ψ_j, as well as every state obtained from it by a local unitary, is locally encodable.
theorem local_encoding_via_abelian_traceless_group {Parties : Type*} [Fintype Parties] [DecidableEq Parties] {d : Parties → Type*} [∀ p, Fintype (d p)] [∀ p, DecidableEq (d p)] (G : Subgroup (Matrix.unitaryGroup ((p : Parties) → d p) ℂ)) (h_lu : ∀ g ∈ G, ∃ u : ∀ p, Matrix.unitaryGroup (d p) ℂ, (g : Matrix.unitaryGroup ((p : Parties) → d p) ℂ).1 = fun x y => ∏ p, (u p).1 (x p) (y p)) (h_comm : ∀ g h : G, g * h = h * g) (h_trace : ∀ g : G, g ≠ 1 → Matrix.trace g.1.1 = 0) (h_card : Nat.card G = Fintype.card ((p : Parties) → d p)) : ∃ ψ : OrthonormalBasis ((p : Parties) → d p) ℂ (EuclideanSpace ℂ ((p : Parties) → d p)), (∀ g : G, ∀ j, ∃ c : ℂ, Matrix.toEuclideanLin g.1.1 (ψ j) = c • ψ j) ∧ ∀ θ : ((p : Parties) → d p) → ℝ, let state : EuclideanSpace ℂ ((p : Parties) → d p) := ((1 / Real.sqrt (Fintype.card ((p : Parties) → d p))) : ℂ) • ∑ j, Complex.exp (Complex.I * (θ j : ℂ)) • ψ j; (∃ B : OrthonormalBasis ((p : Parties) → d p) ℂ (EuclideanSpace ℂ ((p : Parties) → d p)), ∀ j, ∃ V : Matrix.unitaryGroup ((p : Parties) → d p) ℂ, (∃ u : ∀ p, Matrix.unitaryGroup (d p) ℂ, V.1 = fun x y => ∏ p, (u p).1 (x p) (y p)) ∧ B j = Matrix.toEuclideanLin V.1 state) ∧ ∀ φ : EuclideanSpace ℂ ((p : Parties) → d p), (∃ V : Matrix.unitaryGroup ((p : Parties) → d p) ℂ, (∃ u : ∀ p, Matrix.unitaryGroup (d p) ℂ, V.1 = fun x y => ∏ p, (u p).1 (x p) (y p)) ∧ φ = Matrix.toEuclideanLin V.1 state) → (∃ B : OrthonormalBasis ((p : Parties) → d p) ℂ (EuclideanSpace ℂ ((p : Parties) → d p)), ∀ j, ∃ V : Matrix.unitaryGroup ((p : Parties) → d p) ℂ, (∃ u : ∀ p, Matrix.unitaryGroup (d p) ℂ, V.1 = fun x y => ∏ p, (u p).1 (x p) (y p)) ∧ B j = Matrix.toEuclideanLin V.1 φ)locally_encodable_of_orthonormal_local_translatesIn LeanQuantum Computation
If v is an orthonormal family of states indexed by a finite type of cardinality equal to the dimension, each v i being a local unitary applied to ψ, then ψ is locally encodable.
theorem locally_encodable_of_orthonormal_local_translates {Parties : Type*} [Fintype Parties]
[DecidableEq Parties] {d : Parties → Type*} [∀ p, Fintype (d p)] [∀ p, DecidableEq (d p)]
(ψ : EuclideanSpace ℂ ((p : Parties) → d p)) (v : ((p : Parties) → d p) → EuclideanSpace ℂ ((p : Parties) → d p))
(hv : Orthonormal ℂ v)
(hcard : Fintype.card ((p : Parties) → d p) = Module.finrank ℂ (EuclideanSpace ℂ ((p : Parties) → d p)))
(hvψ : ∀ i, ∃ V : Matrix.unitaryGroup ((p : Parties) → d p) ℂ,
is_local_unitary V ∧ v i = Matrix.toEuclideanLin (V : Matrix ((p : Parties) → d p) ((p : Parties) → d p) ℂ) ψ) :
is_locally_encodable ψmagic_rectangle_algebraic_sos_identityIn LeanQuantum Computation
Let A be an ℝ-algebra and let D, C, B : Fin 3 → A satisfy D j ^ 2 = C j ^ 2 = B j ^ 2 = 1 for all j, D 0 * D 1 * D 2 = 1, C 0 * C 1 * C 2 = -1, pairwise commutativity within D and within C, and every D and C commuting with every B. Setting X j = D j + C j, Y j = D j - C j, Z j = X j * B j, V j = X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1), W j = Y (j + 1) * B (j + 2) + Y (j + 2) * B (j + 1), S = ∑ j : Fin 3, X j * B j, r = Real.sqrt 6, and q = 2 * r / 3, then (2 * r) • 1 - S = (5 * r / 64) • (∑ j : Fin 3, (Z j - q • 1) ^ 2) + (r / 12) • (∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2) + (r / 192) • (∑ j : Fin 3, (X j + q • B j - q • W j) ^ 2).
theorem magic_rectangle_algebraic_sos_identity
{A : Type*} [Ring A] [Algebra ℝ A]
(D C B : Fin 3 → A)
(hD_sq : ∀ j, D j ^ 2 = 1)
(hC_sq : ∀ j, C j ^ 2 = 1)
(hB_sq : ∀ j, B j ^ 2 = 1)
(hD_prod : D 0 * D 1 * D 2 = 1)
(hC_prod : C 0 * C 1 * C 2 = -1)
(hD_comm : ∀ j k, D j * D k = D k * D j)
(hC_comm : ∀ j k, C j * C k = C k * C j)
(hDB_comm : ∀ j k, D j * B k = B k * D j)
(hCB_comm : ∀ j k, C j * B k = B k * C j) :
let X := fun j => D j + C j
let Y := fun j => D j - C j
let Z := fun j => X j * B j
let V := fun j => X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1)
let W := fun j => Y (j + 1) * B (j + 2) + Y (j + 2) * B (j + 1)
let S := ∑ j : Fin 3, X j * B j
let r : ℝ := Real.sqrt 6
let q : ℝ := 2 * r / 3
(2 * r) • (1 : A) - S =
(5 * r / 64) • (∑ j : Fin 3, (Z j - q • 1) ^ 2) +
(r / 12) • (∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2) +
(r / 192) • (∑ j : Fin 3, (X j + q • B j - q • W j) ^ 2)magic_rectangle_sos_certificateIn LeanQuantum Computation
Let H be a complex Hilbert space and let D, C, B : Fin 3 → (H →L[ℂ] H) be self-adjoint continuous linear operators satisfying D j ^ 2 = 1, C j ^ 2 = 1, and B j ^ 2 = 1 for all j, D 0 * D 1 * D 2 = 1, C 0 * C 1 * C 2 = -1, D j * D k = D k * D j, C j * C k = C k * C j, D j * B k = B k * D j, and C j * B k = B k * C j for all j, k. Setting X j = D j + C j, Y j = D j - C j, Z j = X j * B j, V j = X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1), W j = Y (j + 1) * B (j + 2) + Y (j + 2) * B (j + 1), S = ∑ j : Fin 3, X j * B j, r = Real.sqrt 6, and q = 2 * r / 3, then the exact sum-of-squares certificate identity holds: (2 * r) • 1 - S = (5 * r / 64) • (∑ j : Fin 3, (Z j - q • 1) ^ 2) + (r / 12) • (∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2) + (r / 192) • (∑ j : Fin 3, (X j + q • B j - q • W j) ^ 2).
theorem magic_rectangle_sos_certificate
{H : Type*} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]
(D C B : Fin 3 → (H →L[ℂ] H))
(hD_sa : ∀ j, IsSelfAdjoint (D j))
(hC_sa : ∀ j, IsSelfAdjoint (C j))
(hB_sa : ∀ j, IsSelfAdjoint (B j))
(hD_sq : ∀ j, D j ^ 2 = 1)
(hC_sq : ∀ j, C j ^ 2 = 1)
(hB_sq : ∀ j, B j ^ 2 = 1)
(hD_prod : D 0 * D 1 * D 2 = 1)
(hC_prod : C 0 * C 1 * C 2 = -1)
(hD_comm : ∀ j k, D j * D k = D k * D j)
(hC_comm : ∀ j k, C j * C k = C k * C j)
(hDB_comm : ∀ j k, D j * B k = B k * D j)
(hCB_comm : ∀ j k, C j * B k = B k * C j) :
let X : Fin 3 → (H →L[ℂ] H) := fun j => D j + C j
let Y : Fin 3 → (H →L[ℂ] H) := fun j => D j - C j
let Z : Fin 3 → (H →L[ℂ] H) := fun j => X j * B j
let V : Fin 3 → (H →L[ℂ] H) := fun j => X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1)
let W : Fin 3 → (H →L[ℂ] H) := fun j => Y (j + 1) * B (j + 2) + Y (j + 2) * B (j + 1)
let S : H →L[ℂ] H := ∑ j : Fin 3, X j * B j
let r : ℝ := Real.sqrt 6
let q : ℝ := 2 * r / 3
(2 * r) • (1 : H →L[ℂ] H) - S =
(5 * r / 64) • (∑ j : Fin 3, (Z j - q • 1) ^ 2) +
(r / 12) • (∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2) +
(r / 192) • (∑ j : Fin 3, (X j + q • B j - q • W j) ^ 2)magic_rectangle_sos_term1In LeanQuantum Computation
Let A be an ℝ-algebra and let D, C, B : Fin 3 → A satisfy B j ^ 2 = 1 for all j, and every D and C commuting with every B. Setting X j = D j + C j, Z j = X j * B j, and S = ∑ j : Fin 3, X j * B j, then for any q : ℝ, ∑ j : Fin 3, (Z j - q • 1) ^ 2 = (∑ j : Fin 3, X j ^ 2) - (2 * q) • S + (3 * q ^ 2) • 1.
theorem magic_rectangle_sos_term1
{A : Type*} [Ring A] [Algebra ℝ A]
(D C B : Fin 3 → A)
(hB_sq : ∀ j, B j ^ 2 = 1)
(hDB_comm : ∀ j k, D j * B k = B k * D j)
(hCB_comm : ∀ j k, C j * B k = B k * C j)
(q : ℝ) :
let X := fun j => D j + C j
let Z := fun j => X j * B j
let S := ∑ j : Fin 3, X j * B j
∑ j : Fin 3, (Z j - q • (1 : A)) ^ 2 =
(∑ j : Fin 3, X j ^ 2) - (2 * q) • S + (3 * q ^ 2) • (1 : A)magic_rectangle_sos_term2In LeanQuantum Computation
Let A be an ℝ-algebra and let D, C, B : Fin 3 → A satisfy D j ^ 2 = C j ^ 2 = B j ^ 2 = 1 for all j, D 0 * D 1 * D 2 = 1, C 0 * C 1 * C 2 = -1, pairwise commutativity within D and within C, and every D and C commuting with every B. Setting X j = D j + C j, Y j = D j - C j, V j = X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1), and S = ∑ j : Fin 3, X j * B j, then for any r : ℝ, ∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2 = (∑ j : Fin 3, Y j ^ 2) - (4 / r) • S + ((1 / r) ^ 2) • (∑ j : Fin 3, V j ^ 2).
theorem magic_rectangle_sos_term2
{A : Type*} [Ring A] [Algebra ℝ A]
(D C B : Fin 3 → A)
(hD_sq : ∀ j, D j ^ 2 = 1)
(hC_sq : ∀ j, C j ^ 2 = 1)
(hB_sq : ∀ j, B j ^ 2 = 1)
(hD_prod : D 0 * D 1 * D 2 = 1)
(hC_prod : C 0 * C 1 * C 2 = -1)
(hD_comm : ∀ j k, D j * D k = D k * D j)
(hC_comm : ∀ j k, C j * C k = C k * C j)
(hDB_comm : ∀ j k, D j * B k = B k * D j)
(hCB_comm : ∀ j k, C j * B k = B k * C j)
(r : ℝ) :
let X := fun j => D j + C j
let Y := fun j => D j - C j
let V := fun j => X (j + 1) * B (j + 2) + X (j + 2) * B (j + 1)
let S := ∑ j : Fin 3, X j * B j
∑ j : Fin 3, (Y j - (1 / r) • V j) ^ 2 =
(∑ j : Fin 3, Y j ^ 2) - (4 / r) • S + ((1 / r) ^ 2) • (∑ j : Fin 3, V j ^ 2)magic_rectangle_sos_term3In LeanQuantum Computation
Let A be an ℝ-algebra and let D, C, B : Fin 3 → A satisfy D j ^ 2 = C j ^ 2 = B j ^ 2 = 1 for all j, D 0 * D 1 * D 2 = 1, C 0 * C 1 * C 2 = -1, pairwise commutativity within D and within C, and every D and C commuting with every B. Setting X j = D j + C j, Y j = D j - C j, W j = Y (j + 1) * B (j + 2) + Y (j + 2) * B (j + 1), S = ∑ j : Fin 3, X j * B j, and J = ∑ j : Fin 3, Y j * (B (j + 1) * B (j + 2) + B (j + 2) * B (j + 1)), then for any q : ℝ, ∑ j : Fin 3, (X j + q • B j - q • W j) ^ 2 = (∑ j : Fin 3, X j ^ 2) - (2 * q) • S + (3 * q ^ 2) • 1 - (2 * q ^ 2) • J + (q ^ 2) • (∑ j : Fin 3, W j ^ 2).
theorem magic_rectangle_sos_term3
{A : Type*} [Ring A] [Algebra ℝ A]
(D C B : Fin 3 → A)
(hD_sq : ∀ j, D j ^ 2 = 1)
(hC_sq : ∀ j, C j ^ 2 = 1)
(hB_sq : ∀ j, B j ^ 2 = 1)
(hD_prod : D 0 * D 1 * D 2 = 1)
(hC_prod : C 0 * C 1 * C 2 = -1)
(hD_comm : ∀ j k, D j * D k = D k * D j)
(hC_comm : ∀ j k, C j * C k = C k * C j)
(hDB_comm : ∀ j k, D j * B k = B k * D j)
(hCB_comm : ∀ j k, C j * B k = B k * C j)
(q : ℝ) :
let X := fun j => D j + C j
let Y := fun j => D j - C j
let W := fun j => Y (j + 1) * B (j + 2) + Y (j + 2) * B (j + 1)
let S := ∑ j : Fin 3, X j * B j
let J := ∑ j : Fin 3, Y j * (B (j + 1) * B (j + 2) + B (j + 2) * B (j + 1))
∑ j : Fin 3, (X j + q • B j - q • W j) ^ 2 =
(∑ j : Fin 3, X j ^ 2) - (2 * q) • S + (3 * q ^ 2) • (1 : A) -
(2 * q ^ 2) • J + (q ^ 2) • (∑ j : Fin 3, W j ^ 2)matrix_column_indicator_sumIn LeanQuantum Computation
If the columns of S are distinct then its column indicator is the sum, over the columns, of the indicator of that column.
theorem matrix_column_indicator_sum {s n : ℕ} (S : Matrix (Fin s) (Fin n) (ZMod 2))
(h_inj : Function.Injective Sᵀ) :
column_indicator S = ∑ j, point_delta (Sᵀ j)matrix_trace_eq_sum_eigenIn LeanQuantum Computation
If ψ is an orthonormal basis of EuclideanSpace ℂ ι diagonalizing the operator attached to a complex matrix M with eigenvalues c j (i.e. M · ψ_j = c_j ψ_j), then Matrix.trace M equals the sum of the c j.
theorem matrix_trace_eq_sum_eigen {ι : Type*} [Fintype ι] [DecidableEq ι]
(ψ : OrthonormalBasis ι ℂ (EuclideanSpace ℂ ι)) (M : Matrix ι ι ℂ) (c : ι → ℂ)
(h : ∀ j, Matrix.toEuclideanLin M (ψ j) = c j • ψ j) :
Matrix.trace M = ∑ j, c jnorm_toEuclideanLin_kronecker_unitary_fstIn LeanQuantum Computation
Applying a unitary on the first tensor factor with identity on the second factor preserves the Euclidean norm of a bipartite state.
theorem norm_toEuclideanLin_kronecker_unitary_fst
{m n : Type*} [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n]
(uA : Matrix.unitaryGroup m ℂ) (ψ : EuclideanSpace ℂ (m × n)) :
‖Matrix.toEuclideanLin (Matrix.kronecker uA.1 (1 : Matrix n n ℂ)) ψ‖ = ‖ψ‖op_757_all_to_all_cnot_bound_baseIn LeanQuantum Computation
Base case of the CNOT lower bound of OP-757: for k at least 2 a Clifford circuit whose score equals the optimum cannot be built from single-qubit gates alone, i.e. it has at least one CNOT gate.
theorem op_757_all_to_all_cnot_bound_base (k : ℕ) (hk : 2 ≤ k) (circ : List (CliffordGate k))
(h_opt : clifford_circuit_score circ = two_sided_shadow_optimal_score k) :
1 ≤ clifford_cnot_count circop_757_all_to_all_cnot_lower_bound_threeIn LeanQuantum Computation
The smallest instance of OP-757: every 3-qubit Clifford circuit whose score equals the optimum 99 contains at least 4 = 3*3-5 CNOT gates. Verified by an exhaustive 0-1 BFS over all 1451520 elements of Sp(6,2) (single-qubit gates free, CNOT cost 1): the maximum score with at most 3 CNOTs is 91, and 99 first appears at 4 CNOTs, realised by the explicit circuit already in the knowledge base.
theorem op_757_all_to_all_cnot_lower_bound_three (circ : List (CliffordGate 3))
(h_opt : clifford_circuit_score circ = two_sided_shadow_optimal_score 3) :
dual_axis_cnot_bound 3 ≤ clifford_cnot_count circopen_problem_691In LeanQuantum Computation
For every integer d ≥ 2, there exists a natural number k strictly less than d^2 such that can_certify_noiseless_codes d k holds, meaning that noiseless quantum codes of dimension d can be certified by a family of fewer than d^2 binary measurements.
theorem open_problem_691 (d : ℕ) (hd : 2 ≤ d) : ∃ k < d ^ 2, can_certify_noiseless_codes d k
open_problem_736In LeanQuantum Computation
For every parameter alpha in (0, pi/2), all orthonormal frames e, f in O(3), and all setting indices mu, nu, mu', nu' in {0, 1, 2, 3}, the two-copy closed-network Bell measurement quantity Lambda(tau_{mu nu}, tau_{mu' nu'}) for the generalized GHZ state |GHZ_alpha> is at most 1 + sin^2(2*alpha).
theorem open_problem_736 (α : ℝ) (hα : α ∈ Set.Ioo 0 (Real.pi / 2)) (e f : Matrix (Fin 3) (Fin 3) ℝ) (he : e ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (hf : f ∈ Matrix.orthogonalGroup (Fin 3) ℝ) (μ ν μ' ν' : Fin 4) : bell_network_lambda (ghz_correlation_vector α e f μ ν) (ghz_correlation_vector α e f μ' ν') ≤ 1 + Real.sin (2 * α) ^ 2
orbit_state_orthonormalIn LeanQuantum Computation
Let G be a subgroup of the unitary group on (p : Parties) → d p whose order equals the dimension D, each non-identity element traceless. If ψ is a common orthonormal eigenbasis of G and θ gives phase angles, the states g · D^{-1/2} ∑_j e^{i θ_j} ψ_j for g in G form an orthonormal family.
theorem orbit_state_orthonormal {Parties : Type*} [Fintype Parties] [DecidableEq Parties]
{d : Parties → Type*} [∀ p, Fintype (d p)] [∀ p, DecidableEq (d p)]
(G : Subgroup (Matrix.unitaryGroup ((p : Parties) → d p) ℂ))
(h_trace : ∀ g : G, g ≠ 1 → Matrix.trace (g : Matrix.unitaryGroup ((p : Parties) → d p) ℂ).1 = 0)
(h_card : Nat.card G = Fintype.card ((p : Parties) → d p))
(ψ : OrthonormalBasis ((p : Parties) → d p) ℂ (EuclideanSpace ℂ ((p : Parties) → d p)))
(hψ : ∀ g : G, ∀ j, ∃ c : ℂ,
Matrix.toEuclideanLin (g : Matrix.unitaryGroup ((p : Parties) → d p) ℂ).1 (ψ j) = c • ψ j)
(θ : ((p : Parties) → d p) → ℝ) :
Orthonormal ℂ (fun g : G => Matrix.toEuclideanLin (g : Matrix.unitaryGroup ((p : Parties) → d p) ℂ).1
((((1 / Real.sqrt (Fintype.card ((p : Parties) → d p))) : ℝ) : ℂ) •
∑ j, Complex.exp (Complex.I * (θ j : ℂ)) • ψ j))orthonormalBasis_of_orthonormal_card_eqIn LeanQuantum Computation
Let v be an orthonormal family indexed by a finite type ι in a finite-dimensional complex inner product space E, and suppose the cardinality of ι equals the finrank of E. Then there is an orthonormal basis B with B i = v i for all i.
theorem orthonormalBasis_of_orthonormal_card_eq {ι : Type*} [Fintype ι] [DecidableEq ι]
{E : Type*} [NormedAddCommGroup E] [InnerProductSpace ℂ E] [FiniteDimensional ℂ E]
{v : ι → E} (hv : Orthonormal ℂ v) (hcard : Fintype.card ι = Module.finrank ℂ E) :
∃ B : OrthonormalBasis ι ℂ E, ∀ i, B i = v ipauliMatrix_apply_supportIn LeanQuantum Computation
For a Pauli string p and bit strings i, j : Fin n → Fin 2, the matrix entry (pauliMatrix p) i j equals (∏_k pauliPhase (p k)) · [j = i + pauliXSupport p] · (−1)^{∑_k (pauliZSupport p k)·(i k)}, where [·] is the 0/1 indicator.
theorem pauliMatrix_apply_support (n : ℕ) (p : PauliString n) (i j : Fin n → Fin 2) : (pauliMatrix p) i j = (∏ k, pauliPhase (p k)) * (if j = i + pauliXSupport p then 1 else 0) * ((-1 : ℂ) ^ (∑ k : Fin n, (pauliZSupport p k).val * (i k).val))
pauli_size_apply_clifford_circuit_eq_of_cnot_count_zeroIn LeanQuantum Computation
If a Clifford circuit contains no CNOT gate then every gate in it is single-qubit (H or S), hence preserves the size of every Pauli label.
theorem pauli_size_apply_clifford_circuit_eq_of_cnot_count_zero {k : ℕ} (circ : List (CliffordGate k))
(h : clifford_cnot_count circ = 0) (p : PauliLabel k) :
pauli_size (apply_clifford_circuit circ p) = pauli_size ppauli_size_apply_clifford_circuit_leIn LeanQuantum Computation
Applying a Clifford circuit increases the size of any Pauli label by at most the number of CNOT gates in the circuit.
theorem pauli_size_apply_clifford_circuit_le {k : ℕ} (circ : List (CliffordGate k)) (p : PauliLabel k) : pauli_size (apply_clifford_circuit circ p) ≤ pauli_size p + clifford_cnot_count circppt_qutrit_bell_setting_self_innerIn LeanQuantum Computation
Each of the three projective-setting vectors is normalized: s_j† s_j = 1.
theorem ppt_qutrit_bell_setting_self_inner (j : Fin 3) : star (ppt_qutrit_bell_setting j) ⬝ᵥ ppt_qutrit_bell_setting j = 1
ppt_qutrit_bell_state_posSemidefIn LeanQuantum Computation
The explicit two-qutrit PPT state is positive semidefinite, being a nonnegative combination of the four rank-one projections of its source vectors.
open scoped ComplexOrder in
theorem ppt_qutrit_bell_state_posSemidef : ppt_qutrit_bell_state.PosSemidef
ppt_qutrit_steered_reduced_stateIn LeanQuantum Computation
The reduced state of the explicit PPT two-qutrit state on the second qutrit is the diagonal matrix with entries 3437/6884, 3437/6884, 10/6884.
theorem ppt_qutrit_steered_reduced_state : (fun x y : Fin 3 => ∑ a : Fin 3, ppt_qutrit_bell_state (a, x) (a, y)) = Matrix.diagonal (fun i : Fin 3 => if i = 2 then (10/6884 : ℂ) else (3437/6884 : ℂ))
product_support_fourIn LeanQuantum Computation
For s at least 4 and three pairwise distinct rows l, l', l'' of an s by n binary matrix satisfying S1, S2, S3, the sum over the columns of the product of the three rows is zero.
theorem product_support_four {s n : ℕ} (hs : 4 ≤ s) (S : Matrix (Fin s) (Fin n) (ZMod 2))
(hch : stabilizer_campbell_howard_conditions S)
(l l' l'' : Fin s) (hl : l ≠ l') (hl' : l ≠ l'') (hl'' : l' ≠ l'') :
∑ j, S l j * S l' j * S l'' j = 0qubit_posSemidef_diag_zero_imp_offdiag_zeroIn LeanQuantum Computation
If a 2x2 positive semidefinite matrix over C has a zero diagonal entry, its off-diagonal entry is zero.
theorem qubit_posSemidef_diag_zero_imp_offdiag_zero (A : Matrix (Fin 2) (Fin 2) ℂ)
(hA : open scoped ComplexOrder in A.PosSemidef) (i j : Fin 2) (h : A i i = 0) :
A i j = 0qubit_two_measurements_are_effectsIn LeanQuantum Computation
The matrices !![1, 0; 0, 0] and !![1/2, 1/2; 1/2, 1/2] and their complements are positive semidefinite.
theorem qubit_two_measurements_are_effects :
open scoped ComplexOrder in
(!![(1 : ℂ), 0; 0, 0]).PosSemidef ∧
(1 - !![(1 : ℂ), 0; 0, 0]).PosSemidef ∧
(!![(1/2 : ℂ), 1/2; 1/2, 1/2]).PosSemidef ∧
(1 - !![(1/2 : ℂ), 1/2; 1/2, 1/2]).PosSemidefqubit_two_measurements_incompatibleIn LeanQuantum Computation
The binary measurements M0 = |0><0| and M1 = |+><+| have no joint parent POVM on C^2.
theorem qubit_two_measurements_incompatible :
open scoped ComplexOrder in
¬ ∃ G : (Fin 2 → Bool) → Matrix (Fin 2) (Fin 2) ℂ,
(∀ s, (G s).PosSemidef) ∧
(∑ s, G s = 1) ∧
(∑ s, if s 0 then G s else 0) = !![(1 : ℂ), 0; 0, 0] ∧
(∑ s, if s 1 then G s else 0) = !![(1/2 : ℂ), 1/2; 1/2, 1/2]range_criterion_subspaces_four_family_oneIn LeanQuantum Computation
For t ≥ 1, range criterion subspaces exist for m = 4, n = 3t^2+2t-1, k = (3t^2-t)/2, ℓ = (3t^2+5t+2)/2.
theorem range_criterion_subspaces_four_family_one (t : ℕ) (ht : 1 ≤ t) :
has_range_criterion_subspaces 4 (3 * t ^ 2 + 2 * t - 1) ((3 * t ^ 2 - t) / 2) ((3 * t ^ 2 + 5 * t + 2) / 2)range_criterion_subspaces_four_family_twoIn LeanQuantum Computation
For s ≥ 1, range criterion subspaces exist for m = 4, n = 3s^2+4s, k = (3s^2+s)/2, ℓ = (3s^2+7s+4)/2.
theorem range_criterion_subspaces_four_family_two (s : ℕ) (hs : 1 ≤ s) :
has_range_criterion_subspaces 4 (3 * s ^ 2 + 4 * s) ((3 * s ^ 2 + s) / 2) ((3 * s ^ 2 + 7 * s + 4) / 2)range_criterion_subspaces_symmetricIn LeanQuantum Computation
In the symmetric case k = ℓ with 2k = m + n - 2 and vanishing Krawtchouk polynomial krawtchouk (2k) (m-1) k = 0, range criterion subspaces always exist.
theorem range_criterion_subspaces_symmetric
(m n k : ℕ)
(hm : 0 < m) (hn : 0 < n) (hk : 0 < k)
(hmn : m ≤ n)
(hsum : 2 * k = m + n - 2)
(hpoly : krawtchouk (2 * k) (m - 1) k = 0) :
has_range_criterion_subspaces m n k krank_lt_two_projection_compress_scalarIn LeanQuantum Computation
Any rank < 2 Hermitian projection P on C^2 compresses any effect M to a scalar multiple c • P with 0 <= c <= 1.
theorem rank_lt_two_projection_compress_scalar (P M : Matrix (Fin 2) (Fin 2) ℂ)
(hP : P.IsHermitian ∧ P * P = P ∧ P.rank < 2)
(hM : open scoped ComplexOrder in M.PosSemidef ∧ (1 - M).PosSemidef) :
∃ c : ℝ, 0 ≤ c ∧ c ≤ 1 ∧ P * M * P = (c : ℂ) • Precursive_nae_geometric_split_log_squared_recurrenceIn LeanQuantum Computation
A nonnegative sequence satisfying the displayed recurrence with a fixed factor C at least one and the rounded seven-eighths split is bounded by an exponential of a constant times log squared.
theorem recursive_nae_geometric_split_log_squared_recurrence (u : ℕ → ℝ) (C : ℝ) (hC : 1 ≤ C) (hu : ∀ d, 0 ≤ u d) (hrec : ∀ d : ℕ, 10 ≤ d → u d ≤ C * (d+1 : ℝ) * max 1 (u ((7*d+7)/8))) : ∃ K : ℝ, 0 < K ∧ ∀ d : ℕ, u d ≤ Real.exp (K * (Real.log (d+2 : ℝ))^2)
recursive_nae_paper_composition_recurrenceIn LeanQuantum Computation
There is a universal positive constant C such that, when depth d is split at a positive strictly smaller outer depth k, the exact query complexity is at most C times the sum of the correction cost 2^k 3^(d-k) and the simulation cost k times the exact complexity at depth k times (3/sqrt 2)^(d-k).
theorem recursive_nae_paper_composition_recurrence : ∃ C : ℝ, 0 < C ∧ ∀ d k : ℕ, 1 ≤ k → k < d → (exact_quantum_query_complexity (recursive_nae d) : ℝ) ≤ C * ((2 : ℝ)^k * (3 : ℝ)^(d-k) + (k : ℝ) * (exact_quantum_query_complexity (recursive_nae k) : ℝ) * (3 / Real.sqrt 2)^(d-k))
reed_muller_code_pairing_monomial_zeroIn LeanQuantum Computation
For s at least 4, a codeword of RM(s-4,s) has vanishing Boolean inner product with the monomial indexed by any nonempty set of size at most 3.
theorem reed_muller_code_pairing_monomial_zero (s : ℕ) (hs : 4 ≤ s)
(c : (Fin s → ZMod 2) → ZMod 2) (hc : c ∈ reed_muller_code (s - 4) s)
(U : Finset (Fin s)) (hU1 : 0 < U.card) (hU2 : U.card ≤ 3) :
boolean_pairing c (monomial U) = 0reed_muller_code_sum_memIn LeanQuantum Computation
Any ZMod 2-linear combination of the monomials indexed by sets of size at most r belongs to the Reed-Muller code RM(r, s).
theorem reed_muller_code_sum_mem (r s : ℕ) (c : Finset (Fin s) → ZMod 2) :
(∑ T ∈ Finset.univ.filter (fun T => T.card ≤ r), c T • monomial T) ∈ reed_muller_code r sspin_one_global_compatible_of_leIn LeanQuantum Computation
For any noise parameter t between 0 and sqrt(3)/2, the three noisy Cartesian spin-one measurements admit a joint POVM on C^3.
open scoped ComplexOrder BigOperators Matrix in
theorem spin_one_global_compatible_of_le (t : ℝ) (ht0 : 0 ≤ t) (ht : t ≤ Real.sqrt 3 / 2) :
let J : Fin 3 → Matrix (Fin 3) (Fin 3) ℂ := ![
!![0, 0, 0; 0, 0, -Complex.I; 0, Complex.I, 0],
!![0, 0, Complex.I; 0, 0, 0; -Complex.I, 0, 0],
!![0, -Complex.I, 0; Complex.I, 0, 0; 0, 0, 0]]
let M : Fin 3 → Matrix (Fin 3) (Fin 3) ℂ := fun j => (1/2 : ℝ) • (1 + t • J j)
∃ G : (Fin 3 → Bool) → Matrix (Fin 3) (Fin 3) ℂ,
(∀ s, (G s).PosSemidef) ∧ (∑ s, G s = 1) ∧
∀ j : Fin 3, (∑ s, if s j then G s else 0) = M jspin_one_subspace_compatible_boundIn LeanQuantum Computation
For the noisy Cartesian spin-one measurements on the rank-two subspace P, any joint POVM forces the noise parameter t to be at most sqrt(3)/2.
open scoped ComplexOrder BigOperators Matrix in
theorem spin_one_subspace_compatible_bound (t : ℝ) :
let J : Fin 3 → Matrix (Fin 3) (Fin 3) ℂ := ![
!![0, 0, 0; 0, 0, -Complex.I; 0, Complex.I, 0],
!![0, 0, Complex.I; 0, 0, 0; -Complex.I, 0, 0],
!![0, -Complex.I, 0; Complex.I, 0, 0; 0, 0, 0]]
let M : Fin 3 → Matrix (Fin 3) (Fin 3) ℂ := fun j => (1/2 : ℝ) • (1 + t • J j)
let P : Matrix (Fin 3) (Fin 3) ℂ := !![1/2, Complex.I/2, 0; -Complex.I/2, 1/2, 0; 0, 0, 1]
(∃ G : (Fin 3 → Bool) → Matrix (Fin 3) (Fin 3) ℂ,
(∀ s, (G s).PosSemidef) ∧ (∑ s, G s = P) ∧
∀ j : Fin 3, (∑ s, if s j then G s else 0) = P * M j * P) →
t ≤ Real.sqrt 3 / 2spin_one_symmetric_triple_no_subspace_gapIn LeanQuantum Computation
For the three equally noisy Cartesian spin-one binary measurements with parameter between zero and one, global incompatibility forces incompatibility on the displayed rank-two subspace.
theorem spin_one_symmetric_triple_no_subspace_gap (t : ℝ) (ht0 : 0 ≤ t) (ht1 : t ≤ 1) :
let J : Fin 3 → Matrix (Fin 3) (Fin 3) ℂ := ![
!![0, 0, 0; 0, 0, -Complex.I; 0, Complex.I, 0],
!![0, 0, Complex.I; 0, 0, 0; -Complex.I, 0, 0],
!![0, -Complex.I, 0; Complex.I, 0, 0; 0, 0, 0]]
let M : Fin 3 → Matrix (Fin 3) (Fin 3) ℂ := fun j => (1/2 : ℝ) • (1 + t • J j)
let P : Matrix (Fin 3) (Fin 3) ℂ := !![1/2, Complex.I/2, 0; -Complex.I/2, 1/2, 0; 0, 0, 1]
(¬ ∃ G : (Fin 3 → Bool) → Matrix (Fin 3) (Fin 3) ℂ,
(∀ s, (G s).PosSemidef) ∧ (∑ s, G s = 1) ∧
∀ j : Fin 3, (∑ s, if s j then G s else 0) = M j) →
¬ ∃ G : (Fin 3 → Bool) → Matrix (Fin 3) (Fin 3) ℂ,
(∀ s, (G s).PosSemidef) ∧ (∑ s, G s = P) ∧
∀ j : Fin 3, (∑ s, if s j then G s else 0) = P * M j * Psporadic_krawtchouk_range_criterion_m_ge_fiveIn LeanQuantum Computation
For integers m ≥ 5 and k < ℓ with m ≤ n, k + ℓ = m + n - 2, and krawtchouk (k + ℓ) (m - 1) k = 0, range criterion subspaces exist.
theorem sporadic_krawtchouk_range_criterion_m_ge_five
(m n k ℓ : ℕ)
(hm : 5 ≤ m) (hn : 0 < n) (hk : 0 < k) (hℓ : 0 < ℓ)
(hmn : m ≤ n) (hkℓ : k < ℓ)
(hsum : k + ℓ = m + n - 2)
(hpoly : krawtchouk (k + ℓ) (m - 1) k = 0) :
has_range_criterion_subspaces m n k ℓstabilizer_campbell_howard_annihilationIn LeanQuantum Computation
If S satisfies S1, S2, S3 and has distinct columns then the column indicator of S has vanishing Boolean inner product with every monomial indexed by a nonempty set of size at most 3.
theorem stabilizer_campbell_howard_annihilation {s n : ℕ} (S : Matrix (Fin s) (Fin n) (ZMod 2))
(h_inj : Function.Injective Sᵀ) (hch : stabilizer_campbell_howard_conditions S) :
∀ U : Finset (Fin s), 0 < U.card → U.card ≤ 3 →
boolean_pairing (column_indicator S) (monomial U) = 0stabilizer_campbell_howard_iff_reed_mullerIn LeanQuantum Computation
For natural numbers s ≥ 4 and n, an s by n binary matrix S with distinct nonzero columns satisfies the stabilizer-only Campbell-Howard conditions S1, S2, S3 if and only if its column indicator is equal to c or c + delta_zero s for some c in the Reed-Muller code RM(s - 4, s).
open scoped Classical
open Matrix in
theorem stabilizer_campbell_howard_iff_reed_muller (s n : ℕ) (hs : 4 ≤ s)
(S : Matrix (Fin s) (Fin n) (ZMod 2))
(h_inj : Function.Injective Sᵀ) (h_nz : ∀ j, Sᵀ j ≠ 0) :
stabilizer_campbell_howard_conditions S ↔
∃ c ∈ reed_muller_code (s - 4) s,
column_indicator S = c ∨ column_indicator S = c + delta_zero sstabilizer_campbell_howard_of_reed_muller_shiftIn LeanQuantum Computation
If the column indicator of a matrix S with distinct columns is either a codeword c of RM(s-4,s) or c plus the origin indicator, then S satisfies S1, S2 and S3.
theorem stabilizer_campbell_howard_of_reed_muller_shift (s n : ℕ) (hs : 4 ≤ s)
(S : Matrix (Fin s) (Fin n) (ZMod 2)) (h_inj : Function.Injective Sᵀ)
(h : ∃ c ∈ reed_muller_code (s - 4) s,
column_indicator S = c ∨ column_indicator S = c + delta_zero s) :
stabilizer_campbell_howard_conditions Sstar_core_2k_candidate_classificationIn LeanQuantum Computation
For k >= 3, any valid star-core allocation (b, a) at budget 2k satisfying leaf balance a i <= a j + 1 and center dominance b <= a i is either b = 2 with all a i = 2, or b = 1 with exactly one leaf of size 3 and all others of size 2.
theorem star_core_2k_candidate_classification
(k : ℕ) (hk : 3 ≤ k) (b : ℕ) (a : Fin (k - 1) → ℕ)
(h_alloc : is_star_core_allocation k (2 * k) b a)
(h_bal : ∀ i j : Fin (k - 1), a i ≤ a j + 1)
(h_center : ∀ i : Fin (k - 1), b ≤ a i) :
(b = 2 ∧ ∀ i : Fin (k - 1), a i = 2) ∨
(b = 1 ∧ ∃ i : Fin (k - 1), a i = 3 ∧ ∀ j, j ≠ i → a j = 2)star_core_2k_minimizer_existsIn LeanQuantum Computation
For k >= 3 and n >= 2, there exists a valid allocation (b, a) for budget 2k achieving the minimum star-core exponent among all valid allocations.
theorem star_core_2k_minimizer_exists
(k n : ℕ) (hk : 3 ≤ k) (hn : 2 ≤ n) :
∃ (b : ℕ) (a : Fin (k - 1) → ℕ),
is_star_core_allocation k (2 * k) b a ∧
∀ (b' : ℕ) (a' : Fin (k - 1) → ℕ), is_star_core_allocation k (2 * k) b' a' →
star_core_exponent k n b a ≤ star_core_exponent k n b' a'star_core_center_leaf_exchangeIn LeanQuantum Computation
For k >= 3, Q >= k, n >= 2, and any valid star-core allocation (b, a) having a leaf i with a i < b, there exists an allocation (b', a') with is_star_core_allocation k Q b' a' and star_core_exponent k n b' a' < star_core_exponent k n b a.
theorem star_core_center_leaf_exchange
(k Q n : ℕ) (hk : 3 ≤ k) (hn : 2 ≤ n)
(b : ℕ) (a : Fin (k - 1) → ℕ) (h_alloc : is_star_core_allocation k Q b a)
(i : Fin (k - 1)) (h_lt : a i < b) :
∃ (b' : ℕ) (a' : Fin (k - 1) → ℕ),
is_star_core_allocation k Q b' a' ∧
star_core_exponent k n b' a' < star_core_exponent k n b astar_core_exponent_b1_one_threeIn LeanQuantum Computation
For k >= 3 and leaf configuration a with a i = 3 and a j = 2 for j != i, the star-core exponent with center 1 is (k - 2) * n^(2k - 2) + n^(2k - 3) + (n^3 - n + 1) * (n^2 - n + 1)^(k - 2).
theorem star_core_exponent_b1_one_three
(k n : ℕ) (hk : 3 ≤ k) (i : Fin (k - 1))
(a : Fin (k - 1) → ℕ) (ha_i : a i = 3) (ha_j : ∀ j, j ≠ i → a j = 2) :
star_core_exponent k n 1 a =
(k - 2) * n ^ (2 * k - 2) + n ^ (2 * k - 3) + (n ^ 3 - n + 1) * (n ^ 2 - n + 1) ^ (k - 2)star_core_leaf_exchangeIn LeanQuantum Computation
For k >= 3, Q >= k, n >= 2, and any valid star-core allocation (b, a) having leaves i, j with a j + 2 <= a i, there exists a leaf configuration a' such that (b, a') is valid and star_core_exponent k n b a' < star_core_exponent k n b a.
theorem star_core_leaf_exchange
(k Q n : ℕ) (hk : 3 ≤ k) (hn : 2 ≤ n)
(b : ℕ) (a : Fin (k - 1) → ℕ) (h_alloc : is_star_core_allocation k Q b a)
(i j : Fin (k - 1)) (h_diff : a j + 2 ≤ a i) :
∃ a' : Fin (k - 1) → ℕ,
is_star_core_allocation k Q b a' ∧
star_core_exponent k n b a' < star_core_exponent k n b astar_core_regime_2k_compareIn LeanQuantum Computation
For k >= 3 and n >= 2, the cost comparison between Candidate A and Candidate B is determined strictly by the comparison between n^(2k - 5) and (n^2 - n + 1)^(k - 2).
theorem star_core_regime_2k_compare
(k n : ℕ) (hk : 3 ≤ k) (hn : 2 ≤ n) :
let A := (k - 1) * n ^ (2 * k - 2) + (n ^ 2 - n + 1) ^ (k - 1)
let B := (k - 2) * n ^ (2 * k - 2) + n ^ (2 * k - 3) + (n ^ 3 - n + 1) * (n ^ 2 - n + 1) ^ (k - 2)
(A < B ↔ n ^ (2 * k - 5) < (n ^ 2 - n + 1) ^ (k - 2)) ∧
(B < A ↔ (n ^ 2 - n + 1) ^ (k - 2) < n ^ (2 * k - 5)) ∧
(A = B ↔ n ^ (2 * k - 5) = (n ^ 2 - n + 1) ^ (k - 2))three_qubit_ghz_uniformity_has_positive_local_minimumIn LeanQuantum Computation
For the explicitly displayed three-qubit GHZ-coordinate state, the squared deviation of the eight GHZ probabilities from uniformity has a positive local minimum in the nine-angle local-rotation chart.
theorem three_qubit_ghz_uniformity_has_positive_local_minimum :
∃ t : Fin 9 → ℝ, IsLocalMin GhzMinObjective.objective t ∧
1/100000 < GhzMinObjective.objective tthree_qubit_w_harmonic_probability_identityIn LeanQuantum Computation
For the W state, in right-handed local frames whose three pair correlations vanish, the squared magnitude of the all-raising triple harmonic equals one minus the square of the mean of the three z-components of the axes.
theorem three_qubit_w_harmonic_probability_identity :
let dot := fun (a b : Fin 3 → ℝ) => ∑ i, a i*b i
let cross := fun (a b : Fin 3 → ℝ) =>
![a 1*b 2-a 2*b 1, a 2*b 0-a 0*b 2, a 0*b 1-a 1*b 0]
let frame := fun (x y a : Fin 3 → ℝ) =>
dot x x = 1 ∧ dot y y = 1 ∧ dot a a = 1 ∧
dot x y = 0 ∧ dot x a = 0 ∧ dot y a = 0 ∧ cross x y = a
let pair := fun (a b : Fin 3 → ℝ) => 2*(a 0*b 0+a 1*b 1)-a 2*b 2
let z := fun (x y : Fin 3 → ℝ) (i : Fin 3) => (x i : ℂ) + Complex.I * (y i : ℂ)
let cdot := fun (u v : Fin 3 → ℂ) => ∑ i, u i*v i
let tri := fun (u v w : Fin 3 → ℂ) =>
(2/3:ℂ)*(cdot u v*w 2+cdot u w*v 2+cdot v w*u 2)-3*u 2*v 2*w 2
∀ x y a X Y b u v c : Fin 3 → ℝ,
frame x y a → frame X Y b → frame u v c →
pair a b = 0 → pair a c = 0 → pair b c = 0 →
Complex.normSq (tri (z x y) (z X Y) (z u v)) =
1-((a 2+b 2+c 2)/3)^2three_qubit_w_nonzero_ghz_harmonicIn LeanQuantum Computation
For the W state, any right-handed local frames whose three pair correlations vanish have a nonzero all-raising transverse triple harmonic. This excludes a proposed strengthening of the GHZ-frame construction, not local encodability.
theorem three_qubit_w_nonzero_ghz_harmonic :
let dot := fun (a b : Fin 3 → ℝ) => ∑ i, a i*b i
let cross := fun (a b : Fin 3 → ℝ) =>
![a 1*b 2-a 2*b 1, a 2*b 0-a 0*b 2, a 0*b 1-a 1*b 0]
let frame := fun (x y a : Fin 3 → ℝ) =>
dot x x = 1 ∧ dot y y = 1 ∧ dot a a = 1 ∧
dot x y = 0 ∧ dot x a = 0 ∧ dot y a = 0 ∧ cross x y = a
let pair := fun (a b : Fin 3 → ℝ) => 2*(a 0*b 0+a 1*b 1)-a 2*b 2
let z := fun (x y : Fin 3 → ℝ) (i : Fin 3) => (x i : ℂ) + Complex.I * (y i : ℂ)
let cdot := fun (u v : Fin 3 → ℂ) => ∑ i, u i*v i
let tri := fun (u v w : Fin 3 → ℂ) =>
(2/3:ℂ)*(cdot u v*w 2+cdot u w*v 2+cdot v w*u 2)-3*u 2*v 2*w 2
∀ x y a X Y b u v c : Fin 3 → ℝ,
frame x y a → frame X Y b → frame u v c →
pair a b = 0 → pair a c = 0 → pair b c = 0 →
Complex.normSq (tri (z x y) (z X Y) (z u v)) > 0toEuclideanLin_kronecker_unitary_invIn LeanQuantum Computation
Applying (u* ⊗ 1) after (u ⊗ 1) recovers the original bipartite state.
theorem toEuclideanLin_kronecker_unitary_inv
{m n : Type*} [Fintype m] [DecidableEq m] [Fintype n] [DecidableEq n]
(uA : Matrix.unitaryGroup m ℂ) (ψ : EuclideanSpace ℂ (m × n)) :
Matrix.toEuclideanLin (Matrix.kronecker (star uA.1) (1 : Matrix n n ℂ))
(Matrix.toEuclideanLin (Matrix.kronecker uA.1 (1 : Matrix n n ℂ)) ψ) = ψunit_vecMulVec_sub_one_posSemidefIn LeanQuantum Computation
For a unit vector v, the complement 1 - v v* of the rank-one projection v v* is positive semidefinite.
open scoped ComplexOrder in
theorem unit_vecMulVec_sub_one_posSemidef {n : Type*} [Fintype n] [DecidableEq n] (v : n → ℂ) (hv : star v ⬝ᵥ v = 1) : (1 - Matrix.vecMulVec v (star v) : Matrix n n ℂ).PosSemidefunitary_toEuclideanLin_innerIn LeanQuantum Computation
For a unitary matrix A indexed by a finite type n over ℂ and vectors x, y in EuclideanSpace ℂ n, the inner product of Ax and Ay equals the inner product of x and y.
theorem unitary_toEuclideanLin_inner {n : Type*} [Fintype n] [DecidableEq n]
(A : Matrix.unitaryGroup n ℂ) (x y : EuclideanSpace ℂ n) :
inner ℂ (Matrix.toEuclideanLin (A : Matrix n n ℂ) x) (Matrix.toEuclideanLin (A : Matrix n n ℂ) y)
= inner ℂ x ybinary_rank_bound_partial_binary_matrix_completionIn LeanStreaming & Sublinear Algorithms
Every partial binary matrix P with entries in Option (Fin 2) having q ≥ 1 specified entries has a completion into a total binary matrix H with entries in Fin 2 of binary rank at most 3*q^(2/3) + 1.
theorem binary_rank_bound_partial_binary_matrix_completion {n m : ℕ}
(P : Matrix (Fin n) (Fin m) (Option (Fin 2)))
(q : ℕ)
(hq : ((Finset.univ : Finset (Fin n × Fin m)).filter (fun p => (P p.1 p.2).isSome)).card = q)
(hq1 : 1 ≤ q) :
∃ H : Matrix (Fin n) (Fin m) (Fin 2),
(∀ i j v, P i j = some v → H i j = v) ∧
(binary_rank H : ℝ) ≤ 3 * (q : ℝ) ^ ((2 : ℝ) / 3) + 1binary_rank_completion_arithmetic_boundIn LeanStreaming & Sublinear Algorithms
For any integer q ≥ 1, setting u = ⌈q^(1/3)⌉ yields q/u + 1 + √(u*q) ≤ 3*q^(2/3) + 1.
theorem binary_rank_completion_arithmetic_bound (q : ℕ) (hq : 1 ≤ q) :
let u : ℝ := Nat.ceil ((q : ℝ) ^ ((1 : ℝ) / 3))
(q : ℝ) / u + 1 + Real.sqrt (u * (q : ℝ)) ≤ 3 * (q : ℝ) ^ ((2 : ℝ) / 3) + 1binary_rank_le_of_factorizationIn LeanStreaming & Sublinear Algorithms
If a binary matrix H with entries in Fin 2 factors as H.map (·.val) = A.map (·.val) * B.map (·.val) for binary matrices A and B of inner dimension k, then the binary rank of H is at most k.
theorem binary_rank_le_of_factorization {n m k : ℕ} {H : Matrix (Fin n) (Fin m) (Fin 2)}
(A : Matrix (Fin n) (Fin k) (Fin 2)) (B : Matrix (Fin k) (Fin m) (Fin 2))
(h : H.map (·.val) = A.map (·.val) * B.map (·.val)) :
binary_rank H ≤ kpartial_binary_matrix_completion_of_column_removalIn LeanStreaming & Sublinear Algorithms
Let P be an n × m partial binary matrix with entries in Option (Fin 2) and let C : Finset (Fin m) be a finite set of columns. Then P has a completion H : Matrix (Fin n) (Fin m) (Fin 2) agreeing with P on specified entries such that (binary_rank H : ℝ) ≤ (C.card : ℝ) + 1 + Real.sqrt (2 * ((row_conflict_edges P C).card : ℝ)).
theorem partial_binary_matrix_completion_of_column_removal {n m : ℕ}
(P : Matrix (Fin n) (Fin m) (Option (Fin 2)))
(C : Finset (Fin m)) :
∃ H : Matrix (Fin n) (Fin m) (Fin 2),
(∀ i j v, P i j = some v → H i j = v) ∧
(binary_rank H : ℝ) ≤ (C.card : ℝ) + 1 + Real.sqrt (2 * ((row_conflict_edges P C).card : ℝ))