chars
int64
40
24k
content_type
stringclasses
9 values
id
stringlengths
13
64
source
stringclasses
5 values
subset
stringclasses
31 values
text
stringlengths
40
24k
283
leanexplore_declaration
leanexplore:386068
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma indepNum_pos [Finite V] [Nonempty V] : 0 < α(G) := by cases nonempty_fintype V obtain ⟨v⟩ := ‹Nonempty V› rw [← Nat.add_one_le_iff] exact le_csSup ⟨Nat.card V, by simp [mem_upperBounds, isNIndepSet_iff, Finset.card_le_univ]⟩ ⟨{v}, by simp [isNIndepSet_iff]⟩
120
leanexplore_declaration
leanexplore:386069
leanexplore_sqlite
leanexplore_declarations
@[simp] lemma indepNum_of_isEmpty [IsEmpty V] : α(G) = 0 := by simp [indepNum, isNIndepSet_iff, Subsingleton.elim _ ∅]
119
leanexplore_declaration
leanexplore:386070
leanexplore_sqlite
leanexplore_declarations
@[inherit_doc] scoped notation "α(" G ")" => indepNum G @[simp] lemma indepNum_of_isEmpty [IsEmpty V] : α(G) = 0 := by
267
leanexplore_declaration
leanexplore:386071
leanexplore_sqlite
leanexplore_declarations
/-- The anti-Ramsey number $\mathrm{AR}(n, H)$: maximum colors to edge-color $K_n$ without rainbow $H$. -/ noncomputable def antiRamseyNum {α : Type*} [Fintype α] (H : SimpleGraph α) (n : ℕ) : ℕ := sSup {k | ∃ c : Sym2 (Fin n) → Fin k, ∀ f : H →g ⊤, ¬IsRainbow f c}
261
leanexplore_declaration
leanexplore:386072
leanexplore_sqlite
leanexplore_declarations
/-- A homomorphism is rainbow if it maps distinct edges to distinct colors. -/ def IsRainbow {α V : Type*} {H : SimpleGraph α} {G : SimpleGraph V} (f : H →g G) {C : Type*} (c : Sym2 V → C) : Prop := Function.Injective fun e : H.edgeSet => c (Sym2.map f e)
363
leanexplore_declaration
leanexplore:386073
leanexplore_sqlite
leanexplore_declarations
/-- A finite graph is CDS-colorable if it has a proper coloring by natural numbers such that for all `k > 0`, the number of vertices with color `< k` equals the maximum size of the union of `k` independent sets. -/ def CDSColorable [Fintype α] {G : SimpleGraph α} : Prop := ∃ (C : G.Coloring Nat), ∀ k : Nat, ∑ i ...
212
leanexplore_declaration
leanexplore:386074
leanexplore_sqlite
leanexplore_declarations
/-- The maximum size of the union of k finite independent sets. -/ noncomputable def indepNumK (G : SimpleGraph V) (k : ℕ) : ℕ := sSup {n | ∃ f : Fin k → Set V, (∀ i, G.IsIndepSet (f i)) ∧ (⋃ i, f i).ncard = n}
462
leanexplore_declaration
leanexplore:386075
leanexplore_sqlite
leanexplore_declarations
/-- The chromatic cardinal is the minimal number of colors need to color it. In contrast to `chromaticNumber`, which assigns `⊤ : ℕ∞` to all non-finitely colorable graphs, this definition returns a `Cardinal` and can therefore distinguish between different infinite chromatic numbers. -/ noncomputable def chromaticCardi...
358
leanexplore_declaration
leanexplore:386076
leanexplore_sqlite
leanexplore_declarations
/-- The chromatic number of a graph is the minimal number of colors needed to color it. This is `⊤` (infinity) iff `G` isn't colorable with finitely many colors. If `G` is colorable, then `ENat.toNat G.chromaticNumber` is the `ℕ`-valued chromatic number. -/ noncomputable def cochromaticNumber (G : SimpleGraph V) : ℕ∞ ...
154
leanexplore_declaration
leanexplore:386077
leanexplore_sqlite
leanexplore_declarations
def Cocolorable (G : SimpleGraph V) (n : ℕ) : Prop := ∃ coloring : V → Fin n, ∀ i, G.induce {v | coloring v = i} = ⊥ ∨ G.induce {v | coloring v = i} = ⊤
404
leanexplore_declaration
leanexplore:386078
leanexplore_sqlite
leanexplore_declarations
theorem colorable_iff_induce_eq_bot (G : SimpleGraph V) (n : ℕ) : G.Colorable n ↔ ∃ coloring : V → Fin n, ∀ i, G.induce {v | coloring v = i} = ⊥ := by refine ⟨fun ⟨a, h⟩ ↦ ⟨a, by aesop⟩, fun ⟨w, h⟩ ↦ ⟨w, @fun a b h_adj ↦ ?_⟩⟩ specialize h (w a) contrapose h intro hG have : ¬ ((SimpleGraph.induce {v | w v ...
246
leanexplore_declaration
leanexplore:386079
leanexplore_sqlite
leanexplore_declarations
theorem not_isCritical_of_fintype_lt [Fintype V] (k : ℕ) (hk : Fintype.card V < k) : ¬G.IsCritical k := by simp [IsCritical] intro h have := h ▸ SimpleGraph.chromaticNumber_le_iff_colorable.2 G.colorable_of_fintype simp at this grind
246
leanexplore_declaration
leanexplore:386080
leanexplore_sqlite
leanexplore_declarations
/-- A graph `G` is `k`-critical (or vertex-critical) if its chromatic number is `k`, and deleting any single vertex reduces the chromatic number. -/ def IsCritical (k : ℕ) : Prop := G.chromaticNumber = k ∧ ∀ v, (⊤ : G.Subgraph).IsCriticalVertex v
161
leanexplore_declaration
leanexplore:386081
leanexplore_sqlite
leanexplore_declarations
/-- A vertex is critical if deleting it reduces the chromatic number. -/ def Subgraph.IsCriticalVertex (v : V) (G' : G.Subgraph) : Prop := G'.IsCriticalVerts {v}
226
leanexplore_declaration
leanexplore:386082
leanexplore_sqlite
leanexplore_declarations
/-- A set of vertices is critical if deleting them reduces the chromatic number. -/ def Subgraph.IsCriticalVerts (verts : Set V) (G' : G.Subgraph) : Prop := (G'.deleteVerts verts).coe.chromaticNumber < G'.coe.chromaticNumber
152
leanexplore_declaration
leanexplore:386083
leanexplore_sqlite
leanexplore_declarations
/-- An edge is critical if deleting it reduces the chromatic number. -/ def IsCriticalEdge (e : Sym2 V) : Prop := G.IsCriticalEdges ({e} : Set (Sym2 V))
193
leanexplore_declaration
leanexplore:386084
leanexplore_sqlite
leanexplore_declarations
/-- A set of edges is critical if deleting them reduces the chromatic number. -/ def IsCriticalEdges (edges : Set (Sym2 V)) : Prop := (G.deleteEdges edges).chromaticNumber < G.chromaticNumber
83
leanexplore_declaration
leanexplore:386085
leanexplore_sqlite
leanexplore_declarations
instance (f : ι → V) : Std.Symm fun i j ↦ G.Adj (f i) (f j) where symm _ _ := .symm
634
leanexplore_declaration
leanexplore:386086
leanexplore_sqlite
leanexplore_declarations
lemma card_div_indepNum_le_chromaticNumber : ⌈(Nat.card V / α(G) : ℚ≥0)⌉₊ ≤ G.chromaticNumber := by cases finite_or_infinite V swap; · simp cases nonempty_fintype V simp only [Nat.card_eq_fintype_card, le_chromaticNumber_iff_coloring, Nat.ceil_le] refine fun m c ↦ div_le_of_le_mul₀ (by simp) (by simp) ?_ no...
196
leanexplore_declaration
leanexplore:386087
leanexplore_sqlite
leanexplore_declarations
lemma le_chromaticNumber_iff_not_colorable (hn : n ≠ 0) : n ≤ G.chromaticNumber ↔ ¬ G.Colorable (n - 1) := by let n + 1 := n; simp [ENat.add_one_le_iff, lt_chromaticNumber_iff_not_colorable]
140
leanexplore_declaration
leanexplore:386088
leanexplore_sqlite
leanexplore_declarations
lemma lt_chromaticNumber_iff_not_colorable : n < G.chromaticNumber ↔ ¬ G.Colorable n := by rw [← chromaticNumber_le_iff_colorable, not_le]
161
leanexplore_declaration
leanexplore:386089
leanexplore_sqlite
leanexplore_declarations
@[inherit_doc] scoped notation "χ(" G ")" => chromaticNumber G lemma le_chromaticNumber_iff_colorable : n ≤ G.chromaticNumber ↔ ∀ m, G.Colorable m → n ≤ m := by
124
leanexplore_declaration
leanexplore:386090
leanexplore_sqlite
leanexplore_declarations
lemma nontrivial_of_diam_ne_zero' (h : G.diam ≠ 0) : Nontrivial α := by contrapose! h exact diam_eq_zero_of_subsingleton
255
leanexplore_declaration
leanexplore:386091
leanexplore_sqlite
leanexplore_declarations
/-- The diameter is the greatest distance between any two vertices. If the graph is disconnected, this will be `0`. -/ lemma diam_eq_zero_of_subsingleton [Subsingleton α] : G.diam = 0 := by simp [diam, ediam_eq_zero_iff_subsingleton.mpr (by assumption)]
107
leanexplore_declaration
leanexplore:386092
leanexplore_sqlite
leanexplore_declarations
noncomputable def ecliqueNum {V : Type} (G : SimpleGraph V) : ℕ∞ := ⨆ (s : Finset V) (_ : G.IsClique s), #s
85
leanexplore_declaration
leanexplore:386093
leanexplore_sqlite
leanexplore_declarations
noncomputable def emaxDegree {V : Type*} (G : SimpleGraph V) : ℕ∞ := ⨆ v, G.edegree v
291
leanexplore_declaration
leanexplore:386094
leanexplore_sqlite
leanexplore_declarations
/-- Infinite graphs: definitions for max degree and clique number so that the maximum degree (resp. clique number) of a graph with unbounded degree (resp. clique size) is `∞` rather than 0. -/ noncomputable def edegree {V : Type*} (G : SimpleGraph V) (v : V) : ℕ∞ := (G.neighborSet v).encard
400
leanexplore_declaration
leanexplore:386095
leanexplore_sqlite
leanexplore_declarations
/-- We say a graph is infinitely connected if any two vertices are connected by infinitely many pairwise disjoint paths. Note that graphs with at most one vertex are not classed as infinitely connected. -/ def InfinitelyConnected {V : Type*} (G : SimpleGraph V) : Prop := Nontrivial V ∧ Pairwise fun u v ↦ ∃ P : Set (G...
270
leanexplore_declaration
leanexplore:386096
leanexplore_sqlite
leanexplore_declarations
/-- Two walks are internally disjoint if they share no vertices other than their endpoints. -/ def InternallyDisjoint {V : Type*} {G : SimpleGraph V} {u v x y : V} (p : G.Walk u v) (q : G.Walk x y) : Prop := Disjoint p.support.tail.dropLast q.support.tail.dropLast
353
leanexplore_declaration
leanexplore:386097
leanexplore_sqlite
leanexplore_declarations
/-- A unit distance graph in ℝ²: A graph where the vertices V are a collection of points in ℝ² and there is an edge between two points if and only if the distance between them is 1. -/ def UnitDistancePlaneGraph (V : Set (EuclideanSpace ℝ (Fin 2))) : SimpleGraph V where Adj x y := Dist.dist x y = 1 symm x y := by s...
185
leanexplore_declaration
leanexplore:386098
leanexplore_sqlite
leanexplore_declarations
/-- Average of `indepNeighbors` over all vertices. -/ noncomputable def averageIndepNeighbors (G : SimpleGraph α) : ℝ := (∑ v ∈ Finset.univ, indepNeighbors G v) / (Fintype.card α : ℝ)
141
leanexplore_declaration
leanexplore:386099
leanexplore_sqlite
leanexplore_declarations
/-- The same quantity as a real number. -/ noncomputable def indepNeighbors (G : SimpleGraph α) (v : α) : ℝ := (indepNeighborsCard G v : ℝ)
167
leanexplore_declaration
leanexplore:386100
leanexplore_sqlite
leanexplore_declarations
/-- Independence number of the neighbourhood of `v`. -/ noncomputable def indepNeighborsCard (G : SimpleGraph α) (v : α) : ℕ := (G.induce (G.neighborSet v)).indepNum
206
leanexplore_declaration
leanexplore:386101
leanexplore_sqlite
leanexplore_declarations
/-- `b G` is the number of vertices of a largest induced bipartite subgraph of `G`. Returned as a real number. -/ noncomputable def b (G : SimpleGraph α) : ℝ := (largestInducedBipartiteSubgraphSize G : ℝ)
256
leanexplore_declaration
leanexplore:386102
leanexplore_sqlite
leanexplore_declarations
/-- `largestInducedBipartiteSubgraphSize G` is the size of a largest induced bipartite subgraph of `G`. -/ noncomputable def largestInducedBipartiteSubgraphSize (G : SimpleGraph α) : ℕ := sSup { n | ∃ s : Finset α, (G.induce s).IsBipartite ∧ s.card = n }
264
leanexplore_declaration
leanexplore:386103
leanexplore_sqlite
leanexplore_declarations
/-- The maximum number of occurrences of any term of the degree sequence of `G`. -/ noncomputable def degreeSequenceMultiplicity (G : SimpleGraph α) [DecidableRel G.Adj] : ℕ := letI degs := degreeSequence G (List.max? (degs.map (fun d => degs.count d))).getD 0
216
leanexplore_declaration
leanexplore:386104
leanexplore_sqlite
leanexplore_declarations
/-- The degree sequence of a graph, sorted in nondecreasing order. -/ noncomputable def degreeSequence (G : SimpleGraph α) [DecidableRel G.Adj] : List ℕ := (Finset.univ.val.map fun v : α => G.degree v).sort (· ≤ ·)
220
leanexplore_declaration
leanexplore:386105
leanexplore_sqlite
leanexplore_declarations
/-- `largestInducedForestSize G` is the size of a largest induced forest of `G`. -/ noncomputable def largestInducedForestSize (G : SimpleGraph α) : ℕ := sSup { n | ∃ s : Finset α, (G.induce s).IsAcyclic ∧ s.card = n }
637
leanexplore_declaration
leanexplore:386106
leanexplore_sqlite
leanexplore_declarations
/-- The maximum cardinality among all independent sets `s` that maximize the quantity `|s| - |N(s)|`, where `N(s)` is the neighborhood of the set `s`. -/ noncomputable def aprime (G : SimpleGraph α) [DecidableRel G.Adj] : ℝ := letI indep_sets : Finset (Finset α) := univ.powerset.filter (fun s => G.IsIndepSet ...
245
leanexplore_declaration
leanexplore:386107
leanexplore_sqlite
leanexplore_declarations
/-- `m G` is the size of a maximum matching of `G`. -/ noncomputable def m (G : SimpleGraph α) [DecidableRel G.Adj] : ℝ := let matchings := { M : Subgraph G | M.IsMatching } sSup (Set.image (fun M => (M.edgeSet.toFinset.card : ℝ)) matchings)
125
leanexplore_declaration
leanexplore:386108
leanexplore_sqlite
leanexplore_declarations
/-- `n G` is the number of vertices of `G` as a real number. -/ noncomputable def n (_ : SimpleGraph α) : ℝ := Fintype.card α
471
leanexplore_declaration
leanexplore:386109
leanexplore_sqlite
leanexplore_declarations
/-- `Ls G` is the maximum number of leaves over all spanning trees of `G`. It is defined to be `0` when `G` is not connected. -/ noncomputable def Ls (G : SimpleGraph α) [DecidableRel G.Adj] : ℝ := letI spanningTrees := { T : Subgraph G | T.IsSpanning ∧ IsTree T.coe } letI leaves (T : Subgraph G) := T.verts.toFinse...
128
leanexplore_declaration
leanexplore:386110
leanexplore_sqlite
leanexplore_declarations
noncomputable def edgeDominationNumber (G : SimpleGraph α) : ℕ := sInf {n | ∃ M : Finset (Sym2 α), G.IsNEdgeDominatingSet n M}
52
leanexplore_declaration
leanexplore:386112
leanexplore_sqlite
leanexplore_declarations
isDominating : G.IsEdgeDominating (M : Set (Sym2 α))
228
leanexplore_declaration
leanexplore:386113
leanexplore_sqlite
leanexplore_declarations
@[mk_iff] structure IsNEdgeDominatingSet (n : ℕ) (M : Finset (Sym2 α)) : Prop where isDominating : G.IsEdgeDominating (M : Set (Sym2 α)) card_eq : M.card = n noncomputable def edgeDominationNumber (G : SimpleGraph α) : ℕ :=
131
leanexplore_declaration
leanexplore:386115
leanexplore_sqlite
leanexplore_declarations
def IsEdgeDominating (G : SimpleGraph α) (M : Set (Sym2 α)) : Prop := ∀ ⦃e⦄, e ∈ G.edgeSet → e ∈ M ∨ ∃ e' ∈ M, edgesAdjacent e e'
63
leanexplore_declaration
leanexplore:386116
leanexplore_sqlite
leanexplore_declarations
def edgesAdjacent (e e' : Sym2 α) : Prop := ∃ v, v ∈ e ∧ v ∈ e'
187
leanexplore_declaration
leanexplore:386117
leanexplore_sqlite
leanexplore_declarations
/-- The minimum edge cover number of `G`. -/ noncomputable def edgeCoverNumber (G : SimpleGraph α) : ℕ := sInf {n | ∃ M : Finset (Sym2 α), G.IsEdgeCover (M : Set (Sym2 α)) ∧ M.card = n}
189
leanexplore_declaration
leanexplore:386118
leanexplore_sqlite
leanexplore_declarations
/-- A set of edges is an edge cover if every vertex is incident to some edge in it. -/ def IsEdgeCover (G : SimpleGraph α) (M : Set (Sym2 α)) : Prop := M ⊆ G.edgeSet ∧ ∀ v, ∃ e ∈ M, v ∈ e
123
leanexplore_declaration
leanexplore:386119
leanexplore_sqlite
leanexplore_declarations
noncomputable def indepDominationNumber (G : SimpleGraph α) : ℕ := sInf {n | ∃ D : Finset α, G.IsNIndepDominatingSet n D}
229
leanexplore_declaration
leanexplore:386123
leanexplore_sqlite
leanexplore_declarations
@[mk_iff] structure IsNIndepDominatingSet (n : ℕ) (D : Finset α) : Prop where isIndep : G.IsIndepSet D isDominating : G.IsDominating D card_eq : D.card = n noncomputable def indepDominationNumber (G : SimpleGraph α) : ℕ :=
99
leanexplore_declaration
leanexplore:386125
leanexplore_sqlite
leanexplore_declarations
def IsIndepDominating (G : SimpleGraph α) (D : Set α) : Prop := G.IsIndepSet D ∧ G.IsDominating D
195
leanexplore_declaration
leanexplore:386126
leanexplore_sqlite
leanexplore_declarations
/-- The connected domination number of `G`. -/ noncomputable def connectedDominationNumber (G : SimpleGraph α) : ℕ := sInf {n | ∃ D : Finset α, G.IsConnectedDominating (D : Set α) ∧ D.card = n}
208
leanexplore_declaration
leanexplore:386127
leanexplore_sqlite
leanexplore_declarations
/-- A set is a connected dominating set if it is dominating and induces a connected subgraph. -/ def IsConnectedDominating (G : SimpleGraph α) (D : Set α) : Prop := G.IsDominating D ∧ (G.induce D).Connected
166
leanexplore_declaration
leanexplore:386128
leanexplore_sqlite
leanexplore_declarations
/-- The total domination number of `G`. -/ noncomputable def totalDominationNumber (G : SimpleGraph α) : ℕ := sInf {n | ∃ D : Finset α, G.IsTotalNDominatingSet n D}
41
leanexplore_declaration
leanexplore:386130
leanexplore_sqlite
leanexplore_declarations
isTotalDominating : G.IsTotalDominating D
255
leanexplore_declaration
leanexplore:386131
leanexplore_sqlite
leanexplore_declarations
@[mk_iff] structure IsTotalNDominatingSet (n : ℕ) (D : Finset α) : Prop where isTotalDominating : G.IsTotalDominating D card_eq : D.card = n /-- The total domination number of `G`. -/ noncomputable def totalDominationNumber (G : SimpleGraph α) : ℕ :=
224
leanexplore_declaration
leanexplore:386132
leanexplore_sqlite
leanexplore_declarations
/-- An `n`-total dominating set is a total dominating set with `n` vertices. -/ @[mk_iff] structure IsTotalNDominatingSet (n : ℕ) (D : Finset α) : Prop where isTotalDominating : G.IsTotalDominating D card_eq : D.card = n
180
leanexplore_declaration
leanexplore:386133
leanexplore_sqlite
leanexplore_declarations
/-- A set `D` is a total dominating set if every vertex is adjacent to a vertex in `D`. -/ def IsTotalDominating (G : SimpleGraph α) (D : Set α) : Prop := ∀ v, ∃ w ∈ D, G.Adj v w
234
leanexplore_declaration
leanexplore:386134
leanexplore_sqlite
leanexplore_declarations
/-- The domination number of a graph `G` is the minimum size of a dominating set. It is `0` if there are no vertices. -/ noncomputable def dominationNumber (G : SimpleGraph α) : ℕ := sInf {n | ∃ D : Finset α, G.IsNDominatingSet n D}
343
leanexplore_declaration
leanexplore:386137
leanexplore_sqlite
leanexplore_declarations
@[mk_iff] structure IsNDominatingSet (n : ℕ) (D : Finset α) : Prop where isDominating : G.IsDominating D card_eq : D.card = n /-! ### Domination number -/ /-- The domination number of a graph `G` is the minimum size of a dominating set. It is `0` if there are no vertices. -/ noncomputable def dominationNumber (G ...
197
leanexplore_declaration
leanexplore:386138
leanexplore_sqlite
leanexplore_declarations
/-- An `n`-dominating set is a dominating set with `n` vertices. -/ @[mk_iff] structure IsNDominatingSet (n : ℕ) (D : Finset α) : Prop where isDominating : G.IsDominating D card_eq : D.card = n
209
leanexplore_declaration
leanexplore:386139
leanexplore_sqlite
leanexplore_declarations
/-- A set `D` is a dominating set for `G` if every vertex of `G` is either in `D` or adjacent to a vertex of `D`. -/ def IsDominating (G : SimpleGraph α) (D : Set α) : Prop := ∀ v, v ∈ D ∨ ∃ w ∈ D, G.Adj v w
722
leanexplore_declaration
leanexplore:386140
leanexplore_sqlite
leanexplore_declarations
/-- Given a simple graph `G` with adjacency matrix `A`, this is the number `n₀ + min n₊ n₋` where: - `n₀` is the multiplicity of zero as an eigenvalue of `A` - `n₊` is the number of positive eigenvalues of `A` (counting multiplicities) - `n₋` is the number of negative eigenvalues of `A` (counting multiplicities) -/ non...
599
leanexplore_declaration
leanexplore:386141
leanexplore_sqlite
leanexplore_declarations
/-- Lovász Theta Function (ϑ(G)) The Lovász theta function is defined as: ϑ(G) = min λ_max(A) where the minimum is taken over all symmetric matrices A such that: A_ij = 1 for all i = j (diagonal entries are 1) A_ij = 0 for all {i,j} ∈ E (entries corresponding to edges are 0) A is positive semidefinite Here λ_max(A) d...
376
leanexplore_declaration
leanexplore:386142
leanexplore_sqlite
leanexplore_declarations
/-- Fractional alpha. This is defined as $$ \max_x \sum_{v \in V} x_v $$ subject to $0 \le x_v \le 1$ for all $v \in V$ and $x_u + x_v \le 1$ whenever $(u, v)$ are connected by an edge. -/ noncomputable def fractionalAlpha (G : SimpleGraph α) [DecidableRel G.Adj] : ℝ := sSup {(∑ i, x i) | (x : α → ℝ) (_ : ∀ v, x v ∈ ...
495
leanexplore_declaration
leanexplore:386143
leanexplore_sqlite
leanexplore_declarations
/-- Computes the residue of a graph G, ,i.e. the number of zeros remaining after iteratively applying the Havel-Hakimi algorithm to the degree sequence until all remaining degrees are zero. Starts with the descending degree sequence and applies the Havel-Hakimi process. -/ noncomputable def residue (G : SimpleGraph α) ...
408
leanexplore_declaration
leanexplore:386144
leanexplore_sqlite
leanexplore_declarations
/-- Auxiliary function to calculate the residue recursively. Applies Havel-Hakimi steps until the sequence consists only of zeros or is empty. -/ partial def residueAux : List ℕ → ℕ | [] => 0 -- Empty sequence, residue is 0. | 0 :: s => 1 + s.length -- If the largest degree is 0 (and the list is sorted), all...
816
leanexplore_declaration
leanexplore:386145
leanexplore_sqlite
leanexplore_declarations
/-- Helper function: Performs one step of the Havel-Hakimi reduction on a degree sequence. Assumes the input list `s` is sorted descending. Removes the first element `d`, decrements the next `d` elements by 1, and re-sorts the list descending. Note: when `s` is the list of vertices arising from a simple graph, if the ...
1,153
leanexplore_declaration
leanexplore:386146
leanexplore_sqlite
leanexplore_declarations
/-- Computes the annihilation number of a graph G. It calculates the degree sequence, sorts it ascendingly, and finds the largest prefix length 'k' (where `0 ≤ k ≤ |V(G)|`) such that the sum of the prefix is less than or equal to the sum of the corresponding suffix. -/ noncomputable def annihilationNumber' (G : Simple...
527
leanexplore_declaration
leanexplore:386147
leanexplore_sqlite
leanexplore_declarations
/-- The annihilation number of a graph. This is the largest number of degrees that can be added together without going over the total number of edges of that graph. -/ def annihilationNumber (G : SimpleGraph α) [DecidableRel G.Adj] : ℕ := -- Calculate the limit: The number of edges (Sum of degrees / 2) letI limit :...
160
leanexplore_declaration
leanexplore:386148
leanexplore_sqlite
leanexplore_declarations
/-- The multiset of degrees of a graph. -/ def degreeMultiset (G : SimpleGraph α) [DecidableRel G.Adj] : Multiset ℕ := Finset.univ.val.map fun v => G.degree v
163
leanexplore_declaration
leanexplore:386149
leanexplore_sqlite
leanexplore_declarations
/-- The average degree of `G`. -/ noncomputable def averageDegree (G : SimpleGraph α) [DecidableRel G.Adj] : ℚ := (∑ v, (G.degree v : ℚ)) / (Fintype.card α : ℚ)
340
leanexplore_declaration
leanexplore:386150
leanexplore_sqlite
leanexplore_declarations
/-- The Szeged index of `G`. This is define as the sum `∑_{uv ∈ E(G)} n_u(u,v) * n_v(u,v)` where `n_u(uv)` is the number of vertices closer to `u` than `v`. -/ noncomputable def szegedIndex (G : SimpleGraph α) [DecidableRel G.Adj] : ℕ := ∑ e ∈ G.edgeFinset, e.lift ⟨fun u v => szeged_aux G u v * szeged_aux G v u,...
210
leanexplore_declaration
leanexplore:386151
leanexplore_sqlite
leanexplore_declarations
/-- Auxiliary function for Szeged index: counts vertices closer to u than v. -/ noncomputable def szeged_aux (G : SimpleGraph α) (u v : α) : ℕ := (Finset.univ.filter (fun w => G.edist w u < G.edist w v)).card
218
leanexplore_declaration
leanexplore:386152
leanexplore_sqlite
leanexplore_declarations
/-- The Wiener index of `G`, which is the sum of distances between all pairs of vertices. -/ noncomputable def wienerIndex (G : SimpleGraph α) : ℕ := ∑ uv : Sym2 α, uv.lift ⟨fun u v ↦ G.dist u v, by simp [dist_comm]⟩
113
leanexplore_declaration
leanexplore:386153
leanexplore_sqlite
leanexplore_declarations
/-- The same quantity as a real number. -/ noncomputable def p (G : SimpleGraph α) : ℝ := (pathCoverNumber G : ℝ)
173
leanexplore_declaration
leanexplore:386154
leanexplore_sqlite
leanexplore_declarations
/-- Minimum size of a path cover of `G`. -/ noncomputable def pathCoverNumber (G : SimpleGraph α) : ℕ := sInf { k | ∃ P : Finset (Finset α), P.card = k ∧ IsPathCover G P }
295
leanexplore_declaration
leanexplore:386155
leanexplore_sqlite
leanexplore_declarations
/-- A family of paths covering all vertices without overlaps. -/ def IsPathCover (G : SimpleGraph α) (P : Finset (Finset α)) : Prop := (∀ s1 ∈ P, ∀ s2 ∈ P, s1 ≠ s2 → Disjoint s1 s2) ∧ (Finset.univ ⊆ P.biUnion id) ∧ (∀ s ∈ P, ∃ (u v : α) (p : G.Walk u v), p.IsPath ∧ s = p.support.toFinset)
234
leanexplore_declaration
leanexplore:386156
leanexplore_sqlite
leanexplore_declarations
/-- Average distance from all vertices to a given set. -/ noncomputable def distavg (G : SimpleGraph α) (S : Set α) : ℝ := if Fintype.card α > 0 then (∑ v ∈ Finset.univ, (distToSet G v S : ℝ)) / (Fintype.card α : ℝ) else 0
285
leanexplore_declaration
leanexplore:386157
leanexplore_sqlite
leanexplore_declarations
/-- Auxiliary quantity `ecc` used in conjecture 34. -/ noncomputable def ecc (G : SimpleGraph α) (S : Set α) : ℕ := let s_comp := Finset.univ.filter (fun v => v ∉ S) if h : s_comp.Nonempty then (s_comp.image (fun v => distToSet G v S)).max' (Finset.Nonempty.image h _) else 0
167
leanexplore_declaration
leanexplore:386158
leanexplore_sqlite
leanexplore_declarations
/-- The floor of the average distance of `G`. -/ noncomputable def path (G : SimpleGraph α) : ℕ := if G.Connected then Nat.floor (averageDistance G) else 0
255
leanexplore_declaration
leanexplore:386159
leanexplore_sqlite
leanexplore_declarations
/-- Average distance of `G`. -/ noncomputable def averageDistance (G : SimpleGraph α) : ℝ := if Fintype.card α > 1 then (∑ u ∈ Finset.univ, ∑ v ∈ Finset.univ, (G.dist u v : ℝ)) / ((Fintype.card α : ℝ) * ((Fintype.card α : ℝ) - 1)) else 0
242
leanexplore_declaration
leanexplore:386160
leanexplore_sqlite
leanexplore_declarations
/-- Distance from a vertex to a finite set. -/ noncomputable def distToSet (G : SimpleGraph α) (v : α) (S : Set α) : ℕ := if h : S.toFinset.Nonempty then (S.toFinset.image (fun s => G.dist v s)).min' (Finset.Nonempty.image h _) else 0
173
leanexplore_declaration
leanexplore:386161
leanexplore_sqlite
leanexplore_declarations
/-- The set of vertices of maximum eccentricity. -/ noncomputable def maxEccentricityVertices (G : SimpleGraph α) : Set α := {v : α | eccentricity G v = maxEccentricity G}
149
leanexplore_declaration
leanexplore:386162
leanexplore_sqlite
leanexplore_declarations
/-- The maximum eccentricity among all vertices. -/ noncomputable def maxEccentricity (G : SimpleGraph α) : ℕ∞ := sSup (Set.range (eccentricity G))
161
leanexplore_declaration
leanexplore:386163
leanexplore_sqlite
leanexplore_declarations
/-- The set of vertices of minimum eccentricity. -/ noncomputable def graphCenter (G : SimpleGraph α) : Set α := {v : α | eccentricity G v = minEccentricity G}
149
leanexplore_declaration
leanexplore:386164
leanexplore_sqlite
leanexplore_declarations
/-- The minimum eccentricity among all vertices. -/ noncomputable def minEccentricity (G : SimpleGraph α) : ℕ∞ := sInf (Set.range (eccentricity G))
130
leanexplore_declaration
leanexplore:386165
leanexplore_sqlite
leanexplore_declarations
/-- Eccentricity of a vertex. -/ noncomputable def eccentricity (G : SimpleGraph α) (v : α) : ℕ∞ := sSup (Set.range (G.edist v))
96
leanexplore_declaration
leanexplore:386166
leanexplore_sqlite
leanexplore_declarations
/-- The largest integer less than or equal to `x`. -/ noncomputable def FLOOR (x : ℝ) : ℝ := ⌊x⌋
144
leanexplore_declaration
leanexplore:386167
leanexplore_sqlite
leanexplore_declarations
/-- Local eccentricity of a vertex. -/ noncomputable def local_eccentricity (G : SimpleGraph α) (v : α) : ENat := sSup (Set.range (G.edist v))
352
leanexplore_declaration
leanexplore:386168
leanexplore_sqlite
leanexplore_declarations
/-- Size of a largest induced forest of `G` expressed as a real number. -/ noncomputable def S (G : SimpleGraph α) : ℝ := let card := Fintype.card α if card < 2 then 0 else let degrees := Multiset.ofList (List.map (fun v => G.degree v) Finset.univ.toList) let sorted_degrees := degrees.sort (· ≤ ·) ↑((so...
363
leanexplore_declaration
leanexplore:386169
leanexplore_sqlite
leanexplore_declarations
/-- Minimum size of the neighbourhood of a non-edge of `G`. -/ noncomputable def NG (G : SimpleGraph α) [DecidableRel G.Adj] : ℝ := let non_edges := (compl G).edgeFinset if h : non_edges.Nonempty then let neighbor_sizes := non_edges.image (non_edge_neighborhood_card G) (neighbor_sizes.min' (Finset.Nonempty....
296
leanexplore_declaration
leanexplore:386170
leanexplore_sqlite
leanexplore_declarations
/-- Cardinality of the union of the neighbourhoods of the ends of the non-edge `e`. -/ def non_edge_neighborhood_card (G : SimpleGraph α) [DecidableRel G.Adj] (e : Sym2 α) : ℕ := Sym2.lift ⟨fun u v => (G.neighborFinset u ∪ G.neighborFinset v).card, fun u v => by simp [Finset.union_comm]⟩ e
250
leanexplore_declaration
leanexplore:386171
leanexplore_sqlite
leanexplore_declarations
/-- Maximum of `temp_v` over all vertices. -/ noncomputable def MaxTemp (G : SimpleGraph α) [DecidableRel G.Adj] [Fintype α] [Nonempty α] : ℝ := let temps := Finset.univ.image (temp_v G) temps.max' (Finset.image_nonempty.mpr Finset.univ_nonempty)
235
leanexplore_declaration
leanexplore:386172
leanexplore_sqlite
leanexplore_declarations
/-- `temp_v G v = deg(v)/(n(G) - deg(v))`. -/ noncomputable def temp_v (G : SimpleGraph α) [DecidableRel G.Adj] (v : α) : ℝ := let n := Fintype.card α let deg := G.degree v if n = deg then 0 else (deg : ℝ) / ((n : ℝ) - (deg : ℝ))
116
leanexplore_declaration
leanexplore:386173
leanexplore_sqlite
leanexplore_declarations
/-- Independent domination number of `G`. -/ noncomputable def gi (G : SimpleGraph α) : ℕ := G.indepDominationNumber
152
leanexplore_declaration
leanexplore:386174
leanexplore_sqlite
leanexplore_declarations
/-- The same quantity under a different name, used in some conjectures. -/ noncomputable abbrev l_avg (G : SimpleGraph α) : ℝ := averageIndepNeighbors G
151
leanexplore_declaration
leanexplore:386175
leanexplore_sqlite
leanexplore_declarations
/-- Abbreviation for the average independence number of the neighborhoods. -/ noncomputable abbrev l (G : SimpleGraph α) : ℝ := averageIndepNeighbors G
196
leanexplore_declaration
leanexplore:386176
leanexplore_sqlite
leanexplore_declarations
noncomputable def Matrix.IsHermitian.maxEigenvalue {𝕜 : Type*} [Field 𝕜] [RCLike 𝕜] {n : Type*} [Fintype n] [DecidableEq n] {A : Matrix n n 𝕜} (hA : A.IsHermitian) : ℝ := iSup hA.eigenvalues