AFTD Auto-Formalizing Theoretical Domains

matroid_bipartite_neighbor_query_not_linear

theoremverifiedoriginal

There is no constant C for which all finite bipartite graphs admit a deterministic connectedness decision tree using at most C times the number of vertices single-right-vertex neighborhood-intersection queries.

Statement

theorem matroid_bipartite_neighbor_query_not_linear : ¬ matroid_bipartite_neighbor_query_linear
Related work
Proposed restriction-model lower bound related to OP-1998 and https://arxiv.org/abs/2611.23624; finite certificate experiments 44194, 44197 and 44199.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 5
  • matroid_bipartite_neighbor_query_linearThere is a constant C such that, on every finite labeled bipartite graph with r left and m right vertices, one fixed adaptive Boolean…
  • MatroidIndepQueryTree.depthThe depth (height) of an independence-query decision tree on a ground set α, a natural number defined by recursion on the tree: a leaf…
  • MatroidIndepQueryTreeA deterministic independence-query algorithm on a ground set α, as a rooted binary decision tree: a leaf leaf b outputs the Boolean b;…
  • MatroidIndepQueryTree.evalThe Boolean output of an independence-query decision tree T on a ground set α when the queries are answered by an oracle o : Finset α →…
  • Arena.Reachable.transReachability is transitive.

Read back from the Lean

The declaration matroid_bipartite_neighbor_query_not_linear asserts the negation of matroid_bipartite_neighbor_query_linear. That is, it asserts that there does NOT exist a constant $C \in \mathbb{N}$ such that for all natural numbers $r$ and $m$, there exists a query tree $T$ (with queries in $\mathrm{Fin}(r) \oplus \mathrm{Fin}(m)$) satisfying: 1. The depth of $T$ is at most $C \cdot (r + m)$, and 2. For every simple graph $G$ on vertex set $\mathrm{Fin}(r) \oplus \mathrm{Fin}(m)$ and every oracle $o : \mathrm{Finset}(\mathrm{Fin}(r) \oplus \mathrm{Fin}(m)) \to \mathrm{Bool}$: - if $G$ has no edges between vertices in $\mathrm{Fin}(r)$ (i.e., the left side is an independent set), - and $G$ has no edges between vertices in $\mathrm{Fin}(m)$ (i.e., the right side is an independent set), - and for all query sets $Q$, $o(Q) = \mathrm{true}$ if and only if $Q$ contains exactly one vertex $e \in \mathrm{Fin}(m)$ and at least one vertex $b \in \mathrm{Fin}(r)$ adjacent to $e$ in $G$, - then evaluating $T$ with oracle $o$ returns $\mathrm{true}$ if and only if $G$ is connected (G.Connected). In other words, connectivity of bipartite graphs cannot be decided in linear query complexity $O(r + m)$ using this bipartite neighbor oracle.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

The theorem states that deterministic decision trees cannot decide connectedness of bipartite graphs using O(|V|) single-right-vertex neighborhood queries. For each function f : Fin m → Fin m, a bipartite graph on (m + 1) + m vertices is constructed such that the graph is connected if and only if f is surjective. Any query tree that correctly decides connectedness must assign distinct leaves to distinct permutations of Fin m, because coordinate updates are oracle mixtures that preserve the path to the leaf. This forces the tree to have at least m! leaves, which contradicts any linear depth bound C(2m + 1) because factorial growth eventually outpaces exponential growth.

  1. For any oracle and query tree, the leaf index computed by rowLeaf is strictly less than 2 raised to the depth of the tree.

    We proceed by structural induction on the tree t. For a leaf, rowLeaf evaluates to 0, which is strictly less than 2^0 = 1. For a query node, the depth of either child is bounded by max(l.depth, r.depth). Taking either branch doubles the child index and adds at most 1, so the result is bounded by 2 * 2^(max(l.depth, r.depth)) = 2^(t.depth) using linear arithmetic.

    lines 7–13

    uses Nat.pow_le_pow_right, le_max_left, le_max_right, pow_add, pow_one

      induction t with
      | leaf b => simp [rowLeaf, MatroidIndepQueryTree.depth]
      | query s l r hl hr =>
        have h₁ : (2 : ℕ) ^ l.depth ≤ 2 ^ max l.depth r.depth := Nat.pow_le_pow_right (by decide) (le_max_left ..)
        have h₂ : (2 : ℕ) ^ r.depth ≤ 2 ^ max l.depth r.depth := Nat.pow_le_pow_right (by decide) (le_max_right ..)
        simp only [rowLeaf, MatroidIndepQueryTree.depth, pow_add, pow_one]
        split <;> omega
  2. If oracles a and b reach the same leaf index in t, any oracle c that pointwise agrees with a or b on every query evaluates to the same boolean on t as a.

    By structural induction on t. A leaf node returns a constant boolean regardless of the oracle. At a query node, because a and b reach the same leaf index, the parity of that index forces a and b to make the same branch choice at this node (otherwise one index would be odd and the other even). Because c pointwise agrees with a or b, it also makes that same branch choice. Applying the induction hypothesis to the chosen child subtree completes the step.

    lines 18–25

      induction t with
      | leaf _ => rfl
      | query s l r hl hr =>
        rcases hm s with hs | hs <;>
          cases ha : a s <;> cases hb : b s <;>
          simp [rowLeaf, ha, hb] at h <;>
          simp [MatroidIndepQueryTree.eval, ha, hb, hs] <;>
          first | apply hl; omega | apply hr; omega | omega
  3. The relation defining rowGraph f is symmetric and loopless, forming a valid simple graph on Fin (m+1) ⊕ Fin m.

    Case analysis on whether vertices belong to the left or right partition confirms that the adjacency condition (x = 0 ∨ x = (f i).succ) is symmetric between the two partitions, and neither partition contains self-loops.

    lines 31–32

      symm := ⟨by intro a b; cases a <;> cases b <;> simp⟩
      loopless := by constructor; intro a; cases a <;> simp
  4. The bipartite graph rowGraph f is connected if and only if f : Fin m → Fin m is surjective.

    If rowGraph f is connected, every left vertex y.succ must have a neighbor in the right partition; because left vertices cannot connect to each other, this neighbor must be a right vertex i with y.succ = (f i).succ, implying f(i) = y, which establishes surjectivity. Conversely, if f is surjective, left vertex 0 is adjacent to all right vertices, and every other left vertex y.succ is adjacent to some preimage i of y, so every vertex is reachable from 0.

    lines 36–56

    uses SimpleGraph.connected_iff_exists_forall_reachable, Fin.cases, SimpleGraph.Reachable.rfl, Fin.succ_ne_zero, False.elim, Or.inl, Or.inr

      constructor
      · intro h y
        have hn := (h (.inl y.succ) (.inl 0)).nonempty_neighborSet_left (by simp)
        obtain ⟨v, hv⟩ := hn
        cases v with
        | inl _ => exact False.elim hv
        | inr i =>
          change y.succ = 0 ∨ y.succ = (f i).succ at hv
          exact ⟨i, (Fin.succ_inj.mp (hv.resolve_left (Fin.succ_ne_zero y))).symm⟩
      · intro h
        rw [SimpleGraph.connected_iff_exists_forall_reachable]
        refine ⟨.inl 0, ?_⟩
        have star (i : Fin m) : (rowGraph f).Adj (.inl 0) (.inr i) := Or.inl rfl
        intro v
        cases v with
        | inr i => exact (star i).reachable
        | inl x =>
          refine Fin.cases SimpleGraph.Reachable.rfl (fun y => ?_) x
          obtain ⟨i, rfl⟩ := h y
          have edge : (rowGraph f).Adj (.inr i) (.inl (f i).succ) := Or.inr rfl
          exact (star i).reachable.trans edge.reachable
  5. The oracle rowOracle f is defined to check whether a query set Q intersects the left-neighborhood of its unique right vertex, or return false if Q does not contain exactly one right vertex.

    A classical case split tests whether Q contains a unique right vertex i. If so, it returns true when either left vertex 0 or left vertex (f i).succ is in Q; otherwise it returns false.

    lines 63–66

      classical
      exact if h : ∃ i, onlyRow Q i then
        decide (Sum.inl 0 ∈ Q ∨ Sum.inl (f h.choose).succ ∈ Q)
      else false
  6. rowOracle f Q = true if and only if Q contains a unique right vertex e and at least one left vertex b in Q that is adjacent to e in rowGraph f.

    When Q contains a unique right vertex e, rowOracle f Q evaluates to true precisely when 0 ∈ Q or (f e).succ ∈ Q, which are exactly the neighbors of e in rowGraph f. When Q does not contain a unique right vertex, both sides of the equivalence are false.

    lines 72–89

    uses dif_pos, decide_eq_true_eq, Or.inl, Or.inr, dif_neg, Bool.false_eq_true, false_iff

      classical
      by_cases h : ∃ i, onlyRow Q i
      · simp only [rowOracle, dif_pos h, decide_eq_true_eq]
        constructor
        · intro hx
          refine ⟨h.choose, h.choose_spec, ?_⟩
          rcases hx with h₀ | h₁
          · exact ⟨0, h₀, Or.inl rfl⟩
          · exact ⟨_, h₁, Or.inr rfl⟩
        · rintro ⟨e, he, b, hb, hadj⟩
          have he' : e = h.choose := (h.choose_spec e).mp ((he e).mpr rfl)
          subst e
          rcases hadj with rfl | rfl
          · exact Or.inl hb
          · exact Or.inr hb
      · simp only [rowOracle, dif_neg h, Bool.false_eq_true, false_iff]
        rintro ⟨i, hi, _⟩
        exact h ⟨i, hi⟩
  7. Updating a function at coordinate i with g(i) produces an oracle whose value on any query set Q equals either rowOracle f Q or rowOracle g Q.

    If Q does not contain a unique right vertex, all oracles return false. If Q contains a unique right vertex j, then when j = i the updated function evaluates identically to g, and when j ≠ i it evaluates identically to f.

    lines 95–100

      classical
      by_cases h : ∃ j, onlyRow Q j
      · by_cases hi : h.choose = i
        · right; simp [rowOracle, h, hi]
        · left; simp [rowOracle, h, hi]
      · simp [rowOracle, h]
  8. Any decision tree t correctly deciding surjectivity of f via rowOracle f requires m! ≤ 2^(t.depth).

    Each permutation p of Fin m is encoded as the leaf index reached by rowOracle p in t. If two permutations p and q reach the same leaf index, then for each coordinate i, updating p at i to q(i) is an oracle mixture of p and q, so the tree must evaluate to true on it. By correctness, this update must be surjective, which forces p(i) = q(i) for all i, meaning p = q. The encoding is therefore injective on permutations, giving |Perm(Fin m)| = m! ≤ 2^(t.depth).

    lines 105–119

    uses rowLeaf_lt, congrArg, Fin.val, Equiv.ext, rowLeaf_mix, rowOracle_mix, Function.update_of_ne, Fintype.card_perm, Fintype.card_le_of_injective

      classical
      let code (p : Equiv.Perm (Fin m)) : Fin (2 ^ t.depth) :=
        ⟨rowLeaf (rowOracle p) t, rowLeaf_lt _ _⟩
      have hi : Function.Injective code := by
        intro p q hpq
        have hd : rowLeaf (rowOracle p) t = rowLeaf (rowOracle q) t := congrArg Fin.val hpq
        apply Equiv.ext; intro i
        have hm := rowLeaf_mix _ _ _ (rowOracle_mix p q i) t hd
        have hs := (ht _).mp (hm.trans ((ht p).mpr p.surjective))
        obtain ⟨j, hj⟩ := hs (p i)
        by_cases hji : j = i
        · simpa [hji] using hj.symm
        · have he : p j = p i := by simpa [Function.update_of_ne hji] using hj
          exact (hji (p.injective he)).elim
      simpa [Fintype.card_perm] using Fintype.card_le_of_injective code hi
  9. There is no constant C such that deterministic decision trees can decide connectedness of all bipartite graphs in depth at most C(|V_L| + |V_R|).

    Assuming such a constant C exists, we choose m sufficiently large so that 2^C * (2^(2*C))^m < m!. Taking r = m + 1 left vertices and m right vertices, the hypothesis gives a tree of depth at most C(m + 1 + m) = C + 2*C*m. But the tree must correctly classify connectedness of rowGraph f, so m! ≤ 2^(depth) ≤ 2^(C + 2*C*m) = 2^C * (2^(2*C))^m, contradicting the strict inequality.

    lines 122–133

    uses Nat.eventually_mul_pow_lt_factorial_sub, Nat.sub_zero, rowOracle_spec, rowGraph_connected, rowGraph_count, Nat.pow_le_pow_right, pow_mul, pow_add, Nat.not_lt_of_ge

      rintro ⟨C, H⟩
      obtain ⟨m, hm⟩ := (Nat.eventually_mul_pow_lt_factorial_sub (2^C) (2^(2*C)) 0).exists
      simp only [Nat.sub_zero] at hm
      obtain ⟨t, hd, ht⟩ := H (m+1) m
      have hcorrect (f : Fin m → Fin m) : t.eval (rowOracle f) = true ↔ Function.Surjective f :=
        (ht (rowGraph f) (rowOracle f) (fun _ _ h => h.elim) (fun _ _ h => h.elim)
          (rowOracle_spec f)).trans (rowGraph_connected f)
      have hle := (rowGraph_count t hcorrect).trans (Nat.pow_le_pow_right (by decide : 0 < 2) hd)
      rw [← pow_mul, ← pow_add] at hm
      have hexp : C * (m + 1 + m) = C + 2*C*m := by ring
      rw [hexp] at hle
      exact (Nat.not_lt_of_ge hle) hm
le_max_left
In any linear order, a ≤ max(a, b).
le_max_right
In any linear order, b ≤ max(a, b).
Nat.pow_le_pow_right
If n > 0 and i ≤ j, then n^i ≤ n^j.
pow_add
In any monoid, a^(m + n) = a^m * a^n.
pow_one
In any monoid, a^1 = a.
False.elim
From a contradiction (False), any goal follows.
Fin.succ_ne_zero
The successor of an element in Fin n is never 0 in Fin (n + 1).
SimpleGraph.connected_iff_exists_forall_reachable
A simple graph is connected if and only if there is a vertex from which every vertex is reachable.
SimpleGraph.Reachable.rfl
Every vertex in a graph is reachable from itself.
Fin.cases
Any element of Fin (n + 1) is either 0 or the successor of an element of Fin n.
Or.inl
If a holds, then the disjunction a ∨ b holds.
Or.inr
If b holds, then the disjunction a ∨ b holds.
dif_pos
If the condition c holds, the dependent if-then-else evaluates to the then-branch.
dif_neg
If the condition c does not hold, the dependent if-then-else evaluates to the else-branch.
decide_eq_true_eq
The boolean test decide p equals true if and only if p holds.
Bool.false_eq_true
The equality false = true is logically False.
false_iff
Equivalence with False is equivalent to negation: (False ↔ p) = ¬p.
rowLeaf_lt
The leaf index computed by rowLeaf is strictly less than 2^(tree depth).
congrArg
Applying a function to equal arguments produces equal results.
Fin.val
The projection mapping an element of Fin n to its underlying natural number.
Equiv.ext
Two bijections are equal if they produce the same value on every input.
rowLeaf_mix
If oracle c pointwise agrees with a or b on every query, and a and b reach the same leaf, then the tree evaluates to the same boolean on c as on a.
rowOracle_mix
Updating f at a single coordinate with g(i) yields an oracle whose value on any query set Q matches either that of f or that of g.
Function.update_of_ne
Updating a function at coordinate a' does not change its value at any distinct coordinate a ≠ a'.
Fintype.card_perm
The number of permutations of a finite type of cardinality n is n!.
Fintype.card_le_of_injective
An injection from a finite type α to a finite type β implies |α| ≤ |β|.
Nat.eventually_mul_pow_lt_factorial_sub
For any constants a, c, d, the product a * c^n is eventually strictly less than (n - d)! as n tends to infinity.
Nat.sub_zero
Subtracting zero from a natural number leaves it unchanged: n - 0 = n.
rowOracle_spec
The oracle rowOracle f accurately tests whether a query set contains a neighbor of its unique right vertex in rowGraph f.
rowGraph_connected
The graph rowGraph f is connected if and only if f is surjective.
rowGraph_count
Any query tree correctly deciding surjectivity via rowOracle has depth at least log₂(m!), so m! ≤ 2^(depth).
pow_mul
In any monoid, a^(m * n) = (a^m)^n.
Nat.not_lt_of_ge
If b ≥ a, then b is not strictly less than a.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

private def rowLeaf {α : Type*} (o : Finset α → Bool) : MatroidIndepQueryTree α → ℕ  | .leaf _ => 0  | .query s l r => if o s then 2 * rowLeaf o r + 1 else 2 * rowLeaf o lprivate theorem rowLeaf_lt {α : Type*} (o : Finset α → Bool) (t : MatroidIndepQueryTree α) :    rowLeaf o t < 2 ^ t.depth := by  induction t with  | leaf b => simp [rowLeaf, MatroidIndepQueryTree.depth]  | query s l r hl hr =>    have h₁ : (2 : ℕ) ^ l.depth ≤ 2 ^ max l.depth r.depth := Nat.pow_le_pow_right (by decide) (le_max_left ..)    have h₂ : (2 : ℕ) ^ r.depth ≤ 2 ^ max l.depth r.depth := Nat.pow_le_pow_right (by decide) (le_max_right ..)    simp only [rowLeaf, MatroidIndepQueryTree.depth, pow_add, pow_one]    split <;> omegaprivate theorem rowLeaf_mix {α : Type*} (a b c : Finset α → Bool)    (hm : ∀ s, c s = a s ∨ c s = b s) (t : MatroidIndepQueryTree α)    (h : rowLeaf a t = rowLeaf b t) : t.eval c = t.eval a := by  induction t with  | leaf _ => rfl  | query s l r hl hr =>    rcases hm s with hs | hs <;>      cases ha : a s <;> cases hb : b s <;>      simp [rowLeaf, ha, hb] at h <;>      simp [MatroidIndepQueryTree.eval, ha, hb, hs] <;>      first | apply hl; omega | apply hr; omega | omegaprivate def rowGraph {m : ℕ} (f : Fin m → Fin m) : SimpleGraph (Fin (m+1) ⊕ Fin m) where  Adj    | .inl x, .inr i | .inr i, .inl x => x = 0 ∨ x = (f i).succ    | _, _ => False  symm := ⟨by intro a b; cases a <;> cases b <;> simp⟩  loopless := by constructor; intro a; cases a <;> simpprivate theorem rowGraph_connected {m : ℕ} (f : Fin m → Fin m) :    (rowGraph f).Connected ↔ Function.Surjective f := by  constructor  · intro h y    have hn := (h (.inl y.succ) (.inl 0)).nonempty_neighborSet_left (by simp)    obtain ⟨v, hv⟩ := hn    cases v with    | inl _ => exact False.elim hv    | inr i =>      change y.succ = 0 ∨ y.succ = (f i).succ at hv      exact ⟨i, (Fin.succ_inj.mp (hv.resolve_left (Fin.succ_ne_zero y))).symm⟩  · intro h    rw [SimpleGraph.connected_iff_exists_forall_reachable]    refine ⟨.inl 0, ?_⟩    have star (i : Fin m) : (rowGraph f).Adj (.inl 0) (.inr i) := Or.inl rfl    intro v    cases v with    | inr i => exact (star i).reachable    | inl x =>      refine Fin.cases SimpleGraph.Reachable.rfl (fun y => ?_) x      obtain ⟨i, rfl⟩ := h y      have edge : (rowGraph f).Adj (.inr i) (.inl (f i).succ) := Or.inr rfl      exact (star i).reachable.trans edge.reachableprivate def onlyRow {m : ℕ} (Q : Finset (Fin (m+1) ⊕ Fin m)) (i : Fin m) : Prop :=  ∀ j : Fin m, Sum.inr j ∈ Q ↔ j = iprivate noncomputable def rowOracle {m : ℕ} (f : Fin m → Fin m)    (Q : Finset (Fin (m+1) ⊕ Fin m)) : Bool := by  classical  exact if h : ∃ i, onlyRow Q i then    decide (Sum.inl 0 ∈ Q ∨ Sum.inl (f h.choose).succ ∈ Q)  else falseprivate theorem rowOracle_spec {m : ℕ} (f : Fin m → Fin m)    (Q : Finset (Fin (m+1) ⊕ Fin m)) :    rowOracle f Q = true ↔ ∃ e : Fin m, onlyRow Q e ∧      ∃ b : Fin (m+1), Sum.inl b ∈ Q ∧ (rowGraph f).Adj (.inl b) (.inr e) := by  classical  by_cases h : ∃ i, onlyRow Q i  · simp only [rowOracle, dif_pos h, decide_eq_true_eq]    constructor    · intro hx      refine ⟨h.choose, h.choose_spec, ?_⟩      rcases hx with h₀ | h₁      · exact ⟨0, h₀, Or.inl rfl⟩      · exact ⟨_, h₁, Or.inr rfl⟩    · rintro ⟨e, he, b, hb, hadj⟩      have he' : e = h.choose := (h.choose_spec e).mp ((he e).mpr rfl)      subst e      rcases hadj with rfl | rfl      · exact Or.inl hb      · exact Or.inr hb  · simp only [rowOracle, dif_neg h, Bool.false_eq_true, false_iff]    rintro ⟨i, hi, _⟩    exact h ⟨i, hi⟩private theorem rowOracle_mix {m : ℕ} (f g : Fin m → Fin m) (i : Fin m)    (Q : Finset (Fin (m+1) ⊕ Fin m)) :    rowOracle (Function.update f i (g i)) Q = rowOracle f Q ∨    rowOracle (Function.update f i (g i)) Q = rowOracle g Q := by  classical  by_cases h : ∃ j, onlyRow Q j  · by_cases hi : h.choose = i    · right; simp [rowOracle, h, hi]    · left; simp [rowOracle, h, hi]  · simp [rowOracle, h]private theorem rowGraph_count {m : ℕ} (t : MatroidIndepQueryTree (Fin (m+1) ⊕ Fin m))    (ht : ∀ f : Fin m → Fin m, t.eval (rowOracle f) = true ↔ Function.Surjective f) :    m.factorial ≤ 2 ^ t.depth := by  classical  let code (p : Equiv.Perm (Fin m)) : Fin (2 ^ t.depth) :=    ⟨rowLeaf (rowOracle p) t, rowLeaf_lt _ _⟩  have hi : Function.Injective code := by    intro p q hpq    have hd : rowLeaf (rowOracle p) t = rowLeaf (rowOracle q) t := congrArg Fin.val hpq    apply Equiv.ext; intro i    have hm := rowLeaf_mix _ _ _ (rowOracle_mix p q i) t hd    have hs := (ht _).mp (hm.trans ((ht p).mpr p.surjective))    obtain ⟨j, hj⟩ := hs (p i)    by_cases hji : j = i    · simpa [hji] using hj.symm    · have he : p j = p i := by simpa [Function.update_of_ne hji] using hj      exact (hji (p.injective he)).elim  simpa [Fintype.card_perm] using Fintype.card_le_of_injective code hitheorem matroid_bipartite_neighbor_query_not_linear : ¬ matroid_bipartite_neighbor_query_linear := by  rintro ⟨C, H⟩  obtain ⟨m, hm⟩ := (Nat.eventually_mul_pow_lt_factorial_sub (2^C) (2^(2*C)) 0).exists  simp only [Nat.sub_zero] at hm  obtain ⟨t, hd, ht⟩ := H (m+1) m  have hcorrect (f : Fin m → Fin m) : t.eval (rowOracle f) = true ↔ Function.Surjective f :=    (ht (rowGraph f) (rowOracle f) (fun _ _ h => h.elim) (fun _ _ h => h.elim)      (rowOracle_spec f)).trans (rowGraph_connected f)  have hle := (rowGraph_count t hcorrect).trans (Nat.pow_le_pow_right (by decide : 0 < 2) hd)  rw [← pow_mul, ← pow_add] at hm  have hexp : C * (m + 1 + m) = C + 2*C*m := by ring  rw [hexp] at hle  exact (Nat.not_lt_of_ge hle) hm
See it in the graphDiscuss this resultChallenge it