Zulip Chat Archive
Stream: new members
Topic: How to state this graph problem
Gareth Ma (May 27 2025 at 12:14):
Me and my friend have been working on formalising a graph theory problem from his bachelor's thesis! Here are the core definitions we have been working with:
- Let be a finite simple undirected graph, write for the adjacency function (so True when they're adjacent), and be the neighbours.
- Now can be any set, so we further consider a labelling , i.e. label each vertex with an integer. Actually we might as well make it a
V \equiv Fin nbut see below. Intuitively we're literally flattening the vertices into a horizontal line preserving the edges ofc. - Fixing such labelling, we define the "previous neighbours" to be , so only the "back edges".
- Finally, we define a function to be minimum such that there exists such that
- Important note: in one of our proofs, we want to construct by induction. More specifically the proof picks (satisfying some properties), sets to be "the maximum element" of
Fin n(or for a large enough one, say ), then combine that with (or toFin (n - 1)).
From my experience, it's usually nicest when the indexing types etc. are made very generalised, so I assume G should be of type SimpleGraph ι with Fintype ι. But I am not sure about the function.
(1) As mentioned, we tried making it l : ι ≃ Fin (Fintype.card ι) or something but that becomes tricky when we do the induction step.
(2) We also tried l : Equiv.Perm ι, but that means we need a LinearOrder on ι directly, which isn't exactly accurate? ( is not ordered). The advantage here is we can use Equiv.Perm.subtypeCongr to construct from .
(3) Finally I'm trying {ι : Type u} [Fintype ι] (α : Type u) [LinearOrder α] (l : ι ↪ α) now, but I again face issues with the induction step, and also how to pick a large element a of α and say "consider the type α - a"
I can give more details and precise Lean statements as well, but didn't want to cluster this long question :)
Shreyas Srinivas (May 27 2025 at 12:31):
are you trying to construct a dfs tree with fronds back-edges?
Gareth Ma (May 27 2025 at 12:38):
As in the final goal? No, it's not about dfs tree
Gareth Ma (May 27 2025 at 12:39):
You can see the exact statement here
Gareth Ma (May 27 2025 at 12:43):
(If , there is a vertex with , then . Proof: we construct the defined above. Set , take that and set something large enough. Then consider , take the from hypothesis, and set an element less than etc.)
Kyle Miller (May 27 2025 at 16:25):
With these functions, just to check, using is irrelevant, right? It would be fine to label using positive natural numbers?
If so, you might consider using ℓ : Finsupp V ℕ and declare "ℓ v > 0 means v is labeled".
Regarding your point (1), I would avoid using an explicit equivalence. Fintype V should be fine. You can do induction on the cardinality of the support of ℓ (docs#Finsupp.support).
Kyle Miller (May 27 2025 at 16:27):
That is, you might start up your induction by doing induction hcard : ℓ.support.card (You may need to make sure you are in a newer version of Lean for this syntax. Worst case you can use generalize hcard : ℓ.support.card = n followed by induction n.)
Gareth Ma (May 27 2025 at 16:28):
So to say the graph is fully labelled I would say \forall v, ℓ v > 0 and also Function.Injective ℓ?
Kyle Miller (May 27 2025 at 17:18):
Yeah, that seems right.
Or, for the first condition, you can say ℓ.support = Finset.univ, which involves a term that appears in the induction (in ℓ.support.card).
Gareth Ma (May 27 2025 at 18:20):
Do you have an example of how the induction would work? If I have
example {ι : Type*} [Fintype ι] : ∃ ℓ : ι →₀ ℕ, ℓ.support = Finset.univ := by
sorry
I can't do induction \ell directly right
Kyle Miller (May 27 2025 at 19:44):
Maybe something like this:
import Mathlib
example {ι : Type*} [Fintype ι] : ∃ ℓ : ι →₀ ℕ, ℓ.support = Finset.univ := by
suffices ∀ n ≤ Fintype.card ι, ∃ ℓ : ι →₀ ℕ, ℓ.support.card = n by
obtain ⟨ℓ, h⟩ := this (Fintype.card ι) le_rfl
use ℓ
rwa [Finset.card_eq_iff_eq_univ] at h
intro n hn
induction n with
| zero =>
use 0
simp
| succ n ih =>
specialize ih (Nat.le_of_succ_le hn)
obtain ⟨ℓ, hℓ⟩ := ih
/-
ι : Type u_1
inst✝ : Fintype ι
n : ℕ
hn : n + 1 ≤ Fintype.card ι
ℓ : ι →₀ ℕ
hℓ : ℓ.support.card = n
⊢ ∃ ℓ, ℓ.support.card = n + 1
-/
Gareth Ma (May 28 2025 at 00:18):
got it! thanks so much
Gareth Ma (May 28 2025 at 00:18):
https://gist.github.com/grhkm21/1438e449e2c2f4cd3aed1773bb23a94f
Gareth Ma (May 28 2025 at 00:18):
Now I wonder how long it would take to explain the approach + all the minor details to my friend :3
I'll probably delete some of the proofs and let him play around + proof himself
Gareth Ma (May 28 2025 at 00:18):
Thanks once again!
Last updated: Dec 20 2025 at 21:32 UTC