AFTD Auto-Formalizing Theoretical Domains

matroid_single_query_connectedness_witness

theoremverified

For every nonempty distinguished subset of a ground type with at least two points, there are connected and disconnected full-ground matroids whose independence answers agree on every other subset. For a proper distinguished set H, a query in the connected witness is independent exactly when it contains at most one point outside H and, if it contains H, it equals H.

Statement

theorem matroid_single_query_connectedness_witness {α : Type*} [Nontrivial α] (H : Set α)
    (hn : H.Nonempty) :
    ∃ M N : Matroid α, M.E = Set.univ ∧ N.E = Set.univ ∧ matroid_connected M ∧
      ¬ matroid_connected N ∧ (∀ I : Set α, I ≠ H → (M.Indep I ↔ N.Indep I)) ∧
      (H ≠ Set.univ → ∀ I : Set α,
        M.Indep I ↔ (I ∩ Hᶜ).Subsingleton ∧ (H ⊆ I → I ⊆ H))
Source
https://arxiv.org/abs/2611.23624, Section 3 and the open deterministic decision question OP-1998. The proper-set construction is stated in the source. The whole-ground case compares a circuit with a free matroid.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 4
  • matroid_full_fiber_oracle_realizationFor a partial coloring that uses each of at least two colors, there is a matroid on the full ground set whose independent sets contain at…
  • matroid_connectedA matroid M on a type α is connected if for all elements e and f of its ground set M.E, either e = f or there is a circuit C of M that…
  • MFor a group $G$, $M$ is the set of elements $s \in G \setminus \{1\}$ such that $c_G(x) \le c_G(s)$ for all $x \in G \setminus \{1\}$.
  • FThe prime field $\mathrm{GF}(p)$, realized as $\mathbb{Z}/p\mathbb{Z}$ via ZMod.
Used by 2

The proof, explained

The proof splits into two cases based on whether the distinguished subset H is the whole universe or a proper subset. When H = univ, the connected witness M is the dual of a rank-1 parallel matroid on univ (where univ is the sole circuit) and the disconnected witness N is the free matroid; both agree that all proper subsets are independent. When H is a proper nonempty subset, M is constructed via a full-fiber oracle realization with fiber H and singleton fibers outside H, while N is the direct sum of the dual parallel matroid on H and the parallel matroid on Hᶜ. Both matroids agree on every subset I ≠ H, but H is independent in M and dependent in N, with M connected and N disconnected across the partition {H, Hᶜ}.

  1. A subset I is independent in pointParallel H if and only if I is a subsingleton contained in H. automation

    By definition, pointParallel H is the pullback to H of the rank-1 free matroid on a singleton. A subset is independent in this pullback if and only if it is contained in H and the constant map is injective on it, which means the subset contains at most one element.

    line 8

      simp [pointParallel, Set.Subsingleton, Set.InjOn]
  2. If I is independent in the dual matroid (pointParallel H)✶ for nonempty H, then I ⊆ H and H ⊈ I.

    By duality (Matroid.dual_indep_iff_exists'), I is independent in the dual if and only if I ⊆ H and I is disjoint from some base B of pointParallel H. Because the projection to the singleton free matroid is surjective, a base B of pointParallel H pulls back to a subset of H mapped bijectively to the unique base of the free matroid (Matroid.comapOn_isBase_iff_of_surjOn), so B contains an element x ∈ H. Since I and B are disjoint, x cannot belong to I, which shows that H cannot be a subset of I.

    lines 12–25

    uses Matroid.dual_indep_iff_exists', and_congr_right, Matroid.comapOn_isBase_iff_of_surjOn

      classical
      have hsur : SurjOn (fun _ : α => ()) H (Matroid.freeOn (Set.univ : Set Unit)).E := by
        rintro ⟨⟩ _
        exact ⟨hn.choose, hn.choose_spec, rfl⟩
      rw [Matroid.dual_indep_iff_exists']
      change (I ⊆ H ∧ _) ↔ _
      apply and_congr_right
      intro _
      constructor
      · rintro ⟨B, hB, hd⟩ hHI
        obtain ⟨hbase, _, hBH⟩ := (Matroid.comapOn_isBase_iff_of_surjOn hsur).mp hB
        have hu : () ∈ (fun _ : α => ()) '' B := Matroid.freeOn_isBase_iff.mp hbase ▸ mem_univ _
        obtain ⟨x, hx, _⟩ := hu
        exact disjoint_left.mp hd (hHI (hBH hx)) hx
  3. Conversely, if I ⊆ H and H ⊈ I, then I is independent in (pointParallel H)✶.

    Since H is not a subset of I, there exists an element x ∈ H with x ∉ I. The singleton {x} pulls back bijectively to the unique base of the free matroid on Unit, making {x} a base of pointParallel H by Matroid.comapOn_isBase_iff_of_surjOn. Since x ∉ I, {x} is disjoint from I, providing the required base disjoint from I.

    lines 26–30

    uses Matroid.comapOn_isBase_iff_of_surjOn

      · intro hn'
        obtain ⟨x, hx, hxi⟩ := Set.not_subset.mp hn'
        exact ⟨{x}, (Matroid.comapOn_isBase_iff_of_surjOn hsur).mpr
          ⟨Matroid.freeOn_isBase_iff.mpr (by ext u; cases u; simp), by simp, by simpa⟩,
          by simpa using hxi⟩
  4. When H is the universal set univ, the dual matroid M = (pointParallel univ)✶ is connected, and its unique dependent set is univ.

    By pointSeries_indep, the independent sets of M are precisely the proper subsets of univ. Therefore, univ is dependent while every strictly smaller subset is independent, which means univ is a circuit of M by Matroid.isCircuit_iff_forall_ssubset. Since univ contains all elements of α, any two elements lie in this common circuit, proving that M is connected.

    lines 35–43

    uses pointSeries_indep, Matroid.isCircuit_iff_forall_ssubset

      let M := (pointParallel (univ : Set α))✶
      let N := Matroid.freeOn (univ : Set α)
      have hi (I : Set α) : M.Indep I ↔ I ≠ univ := by
        simpa using pointSeries_indep (Set.univ_nonempty (α := α)) I
      have hC : M.IsCircuit univ := by
        apply Matroid.isCircuit_iff_forall_ssubset.mpr
        exact ⟨M.dep_of_not_indep (fun h => (hi _).mp h rfl) (subset_refl _),
          fun I h => (hi _).mpr h.ne⟩
      refine ⟨M, N, rfl, rfl, fun x _ y _ => Or.inr ⟨univ, hC, trivial, trivial⟩, ?_, ?_⟩
  5. The free matroid N on univ is not connected, and M and N agree on all queries except univ.

    Because α is nontrivial, there exist distinct elements x ≠ y by exists_pair_ne. If N were connected, x and y would share a circuit, which is impossible because in the free matroid every set is independent (Matroid.freeOn_indep). For any proper subset I ≠ univ, I is independent in both M and N, so their independence answers agree.

    lines 44–50

    uses exists_pair_ne, Matroid.freeOn_indep

      · obtain ⟨x,y,hxy⟩ := exists_pair_ne α
        intro hc
        rcases hc x (by simp [N]) y (by simp [N]) with h | ⟨C, hC', _⟩
        · exact hxy h
        · exact hC'.not_indep (Matroid.freeOn_indep (subset_univ _))
      · intro I hI
        exact iff_of_true ((hi _).mpr hI) (Matroid.freeOn_indep (subset_univ _))
  6. For a nonempty proper subset H, the function hue : α → Option (Hᶜ) colors H as none and each element outside H as its own singleton, with every color realized.

    We set K = Hᶜ. The function hue sends x ∈ H to none and x ∉ H to some ⟨x, hx⟩. By Subtype.ext_iff, hue x = some b if and only if x = b.val. Since H is nonempty, none is in the image, and since every element of K is represented by its underlying point, every value in Option K is achieved.

    lines 56–70

    uses Subtype.ext_iff

      classical
      let K := {x : α // x ∉ H}
      have : Nonempty K := ⟨⟨hk.choose, hk.choose_spec⟩⟩
      let hue (x : α) : Option K := if h : x ∈ H then none else some ⟨x,h⟩
      have big (x : α) : hue x = none ↔ x ∈ H := by simp [hue]
      have little (x : α) (b : K) : hue x = some b ↔ x = b.val := by
        by_cases hx : x ∈ H
        · have hne : x ≠ b.val := fun e => b.property (e ▸ hx)
          simp [hue, hx, hne]
        · simp only [hue, dif_neg hx, Option.some.injEq]
          exact Subtype.ext_iff
      have cover (c : Option K) : ∃ x, some (hue x) = some c := by
        cases c with
        | none => exact ⟨hn.choose, congrArg some ((big _).mpr hn.choose_spec)⟩
        | some b => exact ⟨b.val, congrArg some ((little _ _).mpr rfl)⟩
  7. The matroid M synthesized from hue is connected, has ground univ, and its independent sets are those containing at most one point outside H and not strictly containing H.

    We invoke matroid_full_fiber_oracle_realization on the map x ↦ some (hue x). Because this map always outputs some value, it never equals none, so M is connected. A set I is independent in M if and only if the set F of fiber labels completely contained in I is a subsingleton. The label none belongs to F exactly when H ⊆ I, and some b belongs to F exactly when b ∈ I. Thus F is a subsingleton if and only if I ∩ Hᶜ has at most one element and, whenever H ⊆ I, no elements outside H belong to I (i.e. I ⊆ H).

    lines 71–100

    uses matroid_full_fiber_oracle_realization

      obtain ⟨M, he, hm, hc⟩ := matroid_full_fiber_oracle_realization (fun x => some (hue x)) cover
      have hmat (I : Set α) :
          M.Indep I ↔ (I ∩ Hᶜ).Subsingleton ∧ (H ⊆ I → I ⊆ H) := by
        rw [hm]
        let F := {c : Option K | ∀ x, some (hue x) = some c → x ∈ I}
        have hb : none ∈ F ↔ H ⊆ I := by simp [F, big, Set.subset_def]
        have hs (b : K) : some b ∈ F ↔ b.val ∈ I := by simp [F, little]
        change F.Subsingleton ↔ _
        constructor
        · intro hf
          constructor
          · intro x hx y hy
            let j : K := ⟨x,hx.2⟩
            let k : K := ⟨y,hy.2⟩
            have e := hf ((hs j).mpr hx.1) ((hs k).mpr hy.1)
            exact congrArg Subtype.val (Option.some.inj e)
          · intro hhi x hx
            by_contra h'
            simpa using hf (hb.mpr hhi) ((hs ⟨x,h'⟩).mpr hx)
        · rintro ⟨hss, hh⟩ a ha b hb'
          cases a with
          | none =>
            cases b with
            | none => rfl
            | some j => exact (j.property (hh (hb.mp ha) ((hs j).mp hb'))).elim
          | some i =>
            cases b with
            | none => exact (i.property (hh (hb.mp hb') ((hs i).mp ha))).elim
            | some j => exact congrArg some (Subtype.ext (hss ⟨(hs i).mp ha, i.property⟩
                  ⟨(hs j).mp hb', j.property⟩))
  8. The direct sum N of (pointParallel H)✶ and pointParallel (Hᶜ) has ground univ and independent sets satisfying (I ∩ Hᶜ).Subsingleton ∧ ¬(H ⊆ I).

    Because H and Hᶜ are disjoint (disjoint_compl_right) and partition univ (union_compl_self), the direct sum N has ground univ by Matroid.disjointSum_ground_eq. By Matroid.disjointSum_indep_iff, I is independent in N if and only if I ∩ H is independent in the dual parallel matroid on H (which means ¬(H ⊆ I) by pointSeries_indep) and I ∩ Hᶜ is independent in the parallel matroid on Hᶜ (which means (I ∩ Hᶜ).Subsingleton by pointParallel_indep).

    lines 101–113

    uses disjoint_compl_right, Matroid.disjointSum_ground_eq, union_compl_self, Matroid.disjointSum_indep_iff, pointSeries_indep, pointParallel_indep

      let A := (pointParallel H)✶
      let B := pointParallel Hᶜ
      have hdis : Disjoint A.E B.E := disjoint_compl_right
      let N := A.disjointSum B hdis
      have heN : N.E = univ := by
        change (A.disjointSum B hdis).E = univ
        rw [Matroid.disjointSum_ground_eq]
        exact union_compl_self H
      have hni (I : Set α) : N.Indep I ↔ (I ∩ Hᶜ).Subsingleton ∧ ¬ H ⊆ I := by
        rw [show N.Indep I ↔ _ from Matroid.disjointSum_indep_iff]
        change (A.Indep (I ∩ H) ∧ B.Indep (I ∩ Hᶜ) ∧ I ⊆ H ∪ Hᶜ) ↔ _
        simp [A, B, pointSeries_indep hn, pointParallel_indep, and_comm]
      refine ⟨M, N, he, heN, hc.mpr (by simp), ?_, ?_, hmat⟩
  9. The direct sum N is not connected.

    Take x ∈ H and y ∈ Hᶜ. If N were connected, x and y would lie in a common circuit C. By circuit minimality (Matroid.isCircuit_iff), C cannot contain H because H is already dependent in N, so that would force C = H, excluding y. Nor can C fail to contain H, because then C ∩ Hᶜ would be dependent in N, forcing C to be contained in Hᶜ, excluding x. In either case we reach a contradiction.

    lines 114–129

    uses Matroid.isCircuit_iff

      · intro h
        obtain ⟨x, hx⟩ := hn
        obtain ⟨y, hy⟩ := hk
        rcases h x (heN ▸ trivial) y (heN ▸ trivial) with h' | ⟨C, hC, hxC, hyC⟩
        · subst y; exact hy hx
        obtain ⟨_, hmin⟩ := Matroid.isCircuit_iff.mp hC
        by_cases hHC : H ⊆ C
        · have hdH := N.dep_of_not_indep (fun hI => ((hni H).mp hI).2 (subset_refl _))
              (heN ▸ subset_univ _)
          exact hy ((hmin hdH hHC).symm ▸ hyC)
        · have hbad : ¬ (C ∩ Hᶜ).Subsingleton := fun hs => hC.not_indep ((hni C).mpr ⟨hs,hHC⟩)
          have hdK := N.dep_of_not_indep (D := C ∩ Hᶜ) (fun hI => hbad (by
              simpa [inter_assoc] using ((hni _).mp hI).1)) (heN ▸ subset_univ _)
          have eqC := hmin hdK inter_subset_left
          have hxi : x ∈ C ∩ Hᶜ := eqC.symm ▸ hxC
          exact hxi.2 hx
  10. M and N agree on every query I ≠ H.

    Both independent set conditions require (I ∩ Hᶜ).Subsingleton. They differ only in comparing H ⊆ I → I ⊆ H with ¬(H ⊆ I). If H ⊈ I, both implications hold. If H ⊆ I, the condition for N is false, while the condition for M holds if and only if I ⊆ H, which together with H ⊆ I means I = H by Subset.antisymm. Thus for any I ≠ H, the two conditions are logically equivalent.

    lines 130–133

    uses Subset.antisymm

      · intro I hI
        rw [hmat, hni]
        exact and_congr_right fun _ => ⟨fun h hhi => hI (Subset.antisymm (h hhi) hhi),
          fun h hhi => (h hhi).elim⟩
  11. The main theorem holds for every nonempty distinguished subset H of a ground type with at least two points.

    We perform a case split on whether H = univ. If H = univ, fixedWholeWitness provides the desired connected and disconnected pair. If H ≠ univ, then Hᶜ is nonempty by Set.nonempty_compl, and fixedProperWitness provides the witnesses and the characterization of M.Indep.

    lines 141–147

    uses fixedWholeWitness, fixedProperWitness, Set.nonempty_compl

      classical
      by_cases h : H = univ
      · subst H
        obtain ⟨M,N,he,he',hc,hd,ho⟩ := fixedWholeWitness α
        exact ⟨M,N,he,he',hc,hd,ho,fun hh => (hh rfl).elim⟩
      · obtain ⟨M,N,he,he',hc,hd,ho,hm⟩ := fixedProperWitness H hn (Set.nonempty_compl.mpr h)
        exact ⟨M,N,he,he',hc,hd,ho,fun _ => hm⟩
Matroid.dual_indep_iff_exists'
A set I is independent in the dual matroid M✶ if and only if I is contained in the ground of M and disjoint from some base B of M.
and_congr_right
To prove a conjunction a ∧ b is equivalent to a ∧ c, it suffices to prove that b is equivalent to c under hypothesis a.
Matroid.comapOn_isBase_iff_of_surjOn
When a map f from E to the ground of N is surjective, B is a base of the pullback comapOn E f if and only if f maps B injectively onto a base of N and B ⊆ E.
pointSeries_indep
For a nonempty subset H, a set I is independent in the dual of pointParallel H if and only if I is a proper subset of H (I ⊆ H and H ⊈ I).
Matroid.isCircuit_iff_forall_ssubset
A set C is a circuit of M if and only if C is dependent and every proper subset of C is independent in M.
exists_pair_ne
Every nontrivial type has at least two distinct elements.
Matroid.freeOn_indep
In the free matroid on ground set E, every subset of E is independent.
Subtype.ext_iff
Two elements of a subtype are equal if and only if their underlying values are equal.
matroid_full_fiber_oracle_realization
Given a fiber coloring g : α → Option κ where every element of κ is realized, there exists a matroid on α whose independent sets contain at most one fiber, and which is connected if and only if g never takes the value none.
disjoint_compl_right
A set and its complement are disjoint.
Matroid.disjointSum_ground_eq
The ground set of a disjoint sum of matroids is the union of their ground sets.
union_compl_self
The union of any set with its complement is the universal set.
Matroid.disjointSum_indep_iff
A set is independent in the disjoint sum of two matroids if and only if its restriction to each summand is independent in that summand.
pointParallel_indep
A set I is independent in pointParallel H if and only if I is a subsingleton contained in H.
Matroid.isCircuit_iff
A set C is a circuit if and only if it is dependent and minimal among dependent sets under inclusion.
Subset.antisymm
Two sets are equal if each is a subset of the other.
fixedWholeWitness
On any nontrivial ground type, there exist full-ground connected and disconnected matroids whose independent sets agree on every subset except the universe.
fixedProperWitness
For any nonempty proper subset H, there exist full-ground connected and disconnected matroids that agree on all queries except H, with the given independence characterization for the connected witness.
Set.nonempty_compl
The complement of a set s is nonempty if and only if s is not the universal set.

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

open Setprivate noncomputable def pointParallel {α : Type*} (H : Set α) : Matroid α :=  (Matroid.freeOn (Set.univ : Set Unit)).comapOn H (fun _ => ())private theorem pointParallel_indep {α : Type*} (H I : Set α) :    (pointParallel H).Indep I ↔ I.Subsingleton ∧ I ⊆ H := by  simp [pointParallel, Set.Subsingleton, Set.InjOn]private theorem pointSeries_indep {α : Type*} {H : Set α} (hn : H.Nonempty) (I : Set α) :    (pointParallel H)✶.Indep I ↔ I ⊆ H ∧ ¬ H ⊆ I := by  classical  have hsur : SurjOn (fun _ : α => ()) H (Matroid.freeOn (Set.univ : Set Unit)).E := by    rintro ⟨⟩ _    exact ⟨hn.choose, hn.choose_spec, rfl⟩  rw [Matroid.dual_indep_iff_exists']  change (I ⊆ H ∧ _) ↔ _  apply and_congr_right  intro _  constructor  · rintro ⟨B, hB, hd⟩ hHI    obtain ⟨hbase, _, hBH⟩ := (Matroid.comapOn_isBase_iff_of_surjOn hsur).mp hB    have hu : () ∈ (fun _ : α => ()) '' B := Matroid.freeOn_isBase_iff.mp hbase ▸ mem_univ _    obtain ⟨x, hx, _⟩ := hu    exact disjoint_left.mp hd (hHI (hBH hx)) hx  · intro hn'    obtain ⟨x, hx, hxi⟩ := Set.not_subset.mp hn'    exact ⟨{x}, (Matroid.comapOn_isBase_iff_of_surjOn hsur).mpr      ⟨Matroid.freeOn_isBase_iff.mpr (by ext u; cases u; simp), by simp, by simpa⟩,      by simpa using hxi⟩private theorem fixedWholeWitness (α : Type*) [Nontrivial α] :    ∃ M N : Matroid α, M.E = univ ∧ N.E = univ ∧ matroid_connected M ∧      ¬ matroid_connected N ∧ ∀ I : Set α, I ≠ univ → (M.Indep I ↔ N.Indep I) := by  let M := (pointParallel (univ : Set α))✶  let N := Matroid.freeOn (univ : Set α)  have hi (I : Set α) : M.Indep I ↔ I ≠ univ := by    simpa using pointSeries_indep (Set.univ_nonempty (α := α)) I  have hC : M.IsCircuit univ := by    apply Matroid.isCircuit_iff_forall_ssubset.mpr    exact ⟨M.dep_of_not_indep (fun h => (hi _).mp h rfl) (subset_refl _),      fun I h => (hi _).mpr h.ne⟩  refine ⟨M, N, rfl, rfl, fun x _ y _ => Or.inr ⟨univ, hC, trivial, trivial⟩, ?_, ?_⟩  · obtain ⟨x,y,hxy⟩ := exists_pair_ne α    intro hc    rcases hc x (by simp [N]) y (by simp [N]) with h | ⟨C, hC', _⟩    · exact hxy h    · exact hC'.not_indep (Matroid.freeOn_indep (subset_univ _))  · intro I hI    exact iff_of_true ((hi _).mpr hI) (Matroid.freeOn_indep (subset_univ _))private theorem fixedProperWitness {α : Type*} (H : Set α) (hn : H.Nonempty) (hk : Hᶜ.Nonempty) :    ∃ M N : Matroid α, M.E = univ ∧ N.E = univ ∧ matroid_connected M ∧      ¬ matroid_connected N ∧ (∀ I : Set α, I ≠ H → (M.Indep I ↔ N.Indep I)) ∧      (∀ I : Set α, M.Indep I ↔ (I ∩ Hᶜ).Subsingleton ∧ (H ⊆ I → I ⊆ H)) := by  classical  let K := {x : α // x ∉ H}  have : Nonempty K := ⟨⟨hk.choose, hk.choose_spec⟩⟩  let hue (x : α) : Option K := if h : x ∈ H then none else some ⟨x,h⟩  have big (x : α) : hue x = none ↔ x ∈ H := by simp [hue]  have little (x : α) (b : K) : hue x = some b ↔ x = b.val := by    by_cases hx : x ∈ H    · have hne : x ≠ b.val := fun e => b.property (e ▸ hx)      simp [hue, hx, hne]    · simp only [hue, dif_neg hx, Option.some.injEq]      exact Subtype.ext_iff  have cover (c : Option K) : ∃ x, some (hue x) = some c := by    cases c with    | none => exact ⟨hn.choose, congrArg some ((big _).mpr hn.choose_spec)⟩    | some b => exact ⟨b.val, congrArg some ((little _ _).mpr rfl)⟩  obtain ⟨M, he, hm, hc⟩ := matroid_full_fiber_oracle_realization (fun x => some (hue x)) cover  have hmat (I : Set α) :      M.Indep I ↔ (I ∩ Hᶜ).Subsingleton ∧ (H ⊆ I → I ⊆ H) := by    rw [hm]    let F := {c : Option K | ∀ x, some (hue x) = some c → x ∈ I}    have hb : none ∈ F ↔ H ⊆ I := by simp [F, big, Set.subset_def]    have hs (b : K) : some b ∈ F ↔ b.val ∈ I := by simp [F, little]    change F.Subsingleton ↔ _    constructor    · intro hf      constructor      · intro x hx y hy        let j : K := ⟨x,hx.2⟩        let k : K := ⟨y,hy.2⟩        have e := hf ((hs j).mpr hx.1) ((hs k).mpr hy.1)        exact congrArg Subtype.val (Option.some.inj e)      · intro hhi x hx        by_contra h'        simpa using hf (hb.mpr hhi) ((hs ⟨x,h'⟩).mpr hx)    · rintro ⟨hss, hh⟩ a ha b hb'      cases a with      | none =>        cases b with        | none => rfl        | some j => exact (j.property (hh (hb.mp ha) ((hs j).mp hb'))).elim      | some i =>        cases b with        | none => exact (i.property (hh (hb.mp hb') ((hs i).mp ha))).elim        | some j => exact congrArg some (Subtype.ext (hss ⟨(hs i).mp ha, i.property⟩              ⟨(hs j).mp hb', j.property⟩))  let A := (pointParallel H)✶  let B := pointParallel Hᶜ  have hdis : Disjoint A.E B.E := disjoint_compl_right  let N := A.disjointSum B hdis  have heN : N.E = univ := by    change (A.disjointSum B hdis).E = univ    rw [Matroid.disjointSum_ground_eq]    exact union_compl_self H  have hni (I : Set α) : N.Indep I ↔ (I ∩ Hᶜ).Subsingleton ∧ ¬ H ⊆ I := by    rw [show N.Indep I ↔ _ from Matroid.disjointSum_indep_iff]    change (A.Indep (I ∩ H) ∧ B.Indep (I ∩ Hᶜ) ∧ I ⊆ H ∪ Hᶜ) ↔ _    simp [A, B, pointSeries_indep hn, pointParallel_indep, and_comm]  refine ⟨M, N, he, heN, hc.mpr (by simp), ?_, ?_, hmat⟩  · intro h    obtain ⟨x, hx⟩ := hn    obtain ⟨y, hy⟩ := hk    rcases h x (heN ▸ trivial) y (heN ▸ trivial) with h' | ⟨C, hC, hxC, hyC⟩    · subst y; exact hy hx    obtain ⟨_, hmin⟩ := Matroid.isCircuit_iff.mp hC    by_cases hHC : H ⊆ C    · have hdH := N.dep_of_not_indep (fun hI => ((hni H).mp hI).2 (subset_refl _))          (heN ▸ subset_univ _)      exact hy ((hmin hdH hHC).symm ▸ hyC)    · have hbad : ¬ (C ∩ Hᶜ).Subsingleton := fun hs => hC.not_indep ((hni C).mpr ⟨hs,hHC⟩)      have hdK := N.dep_of_not_indep (D := C ∩ Hᶜ) (fun hI => hbad (by          simpa [inter_assoc] using ((hni _).mp hI).1)) (heN ▸ subset_univ _)      have eqC := hmin hdK inter_subset_left      have hxi : x ∈ C ∩ Hᶜ := eqC.symm ▸ hxC      exact hxi.2 hx  · intro I hI    rw [hmat, hni]    exact and_congr_right fun _ => ⟨fun h hhi => hI (Subset.antisymm (h hhi) hhi),      fun h hhi => (h hhi).elim⟩theorem matroid_single_query_connectedness_witness {α : Type*} [Nontrivial α] (H : Set α)    (hn : H.Nonempty) :    ∃ M N : Matroid α, M.E = Set.univ ∧ N.E = Set.univ ∧ matroid_connected M ∧      ¬ matroid_connected N ∧ (∀ I : Set α, I ≠ H → (M.Indep I ↔ N.Indep I)) ∧      (H ≠ Set.univ → ∀ I : Set α,        M.Indep I ↔ (I ∩ Hᶜ).Subsingleton ∧ (H ⊆ I → I ⊆ H)) := by  classical  by_cases h : H = univ  · subst H    obtain ⟨M,N,he,he',hc,hd,ho⟩ := fixedWholeWitness α    exact ⟨M,N,he,he',hc,hd,ho,fun hh => (hh rfl).elim⟩  · obtain ⟨M,N,he,he',hc,hd,ho,hm⟩ := fixedProperWitness H hn (Set.nonempty_compl.mpr h)    exact ⟨M,N,he,he',hc,hd,ho,fun _ => hm⟩
See it in the graphDiscuss this resultChallenge it