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 G=(V,E)G = (V, E) be a finite simple undirected graph, write e(u,v)e(u, v) for the adjacency function (so True when they're adjacent), and n(u)={vV ⁣:e(u,v)}n(u) = \{v \in V \colon e(u, v)\} be the neighbours.
  • Now VV can be any set, so we further consider a labelling  ⁣:VZ\ell \colon V \hookrightarrow \mathbb{Z}, i.e. label each vertex with an integer. Actually we might as well make it a V \equiv Fin n but 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 n(u)={vn(u) ⁣:(v)<(u)}n_{\ell}(u) = \{v \in n(u) \colon \ell(v) < \ell(u)\}, so only the "back edges".
  • Finally, we define a function F(G)F(G) to be minimum kk such that there exists \ell such that u,n(u)k\forall u, n_{\ell}(u) \leq k
  • Important note: in one of our proofs, we want to construct \ell by induction. More specifically the proof picks vVv \in V (satisfying some properties), sets (v)\ell(v) to be "the maximum element" of Fin n (or for Z\mathbb{Z} a large enough one, say V|V|), then combine that with  ⁣:V{v}Z<(v)\ell' \colon V \setminus \{v\} \hookrightarrow \mathbb{Z}_{< \ell(v)} (or to Fin (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 \ell 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? (VV is not ordered). The advantage here is we can use Equiv.Perm.subtypeCongr to construct \ell from \ell'.
(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 UV\forall \emptyset \neq U \subseteq V, there is a vertex uUu \in U with n(u)Uk|n(u) \cap U| \leq k, then F(G)kF(G) \leq k. Proof: we construct the \ell defined above. Set U=VU = V, take that uu and set (u)=\ell(u) = something large enough. Then consider U=ucU' = {u}^c, take the uUu' \in U' from hypothesis, and set (u)=\ell(u') = an element less than (u)\ell(u) etc.)

Kyle Miller (May 27 2025 at 16:25):

With these \ell functions, just to check, using Z\mathbb{Z} 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