-- Module: Mathlib.Combinatorics.Matroid.Sum
Goal:
α : Type u
β : Type v
M : Matroid α
N : Matroid β
I X : Set (α ⊕ β)
⊢ M.IsBasis
        (image (α := bif false then ULift.{u, v} β else ULift.{v, u} α)
          (fun (a : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦ a.down)
          (preimage (β := (i : Bool) × bif i then ULift.{u, v} β else ULift.{v, u} α)
              (Sigma.mk (β := fun (i : Bool) ↦ bif i then ULift.{u, v} β else ULift.{v, u} α) false)
              ((fun (s : ULift.{v, u} α ⊕ ULift.{u, v} β) ↦
                  Sum.elim
                    (fun (x : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) false x)
                    (fun (x : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) true x)
                    s) ''
                (fun (a : α ⊕ β) ↦
                    Sum.map
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : α) → ULift.{v, u} α)
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : β) → ULift.{u, v} β)
                      a) ''
                  I) :
            Set (bif false then ULift.{u, v} β else ULift.{v, u} α)))
        (image (α := bif false then ULift.{u, v} β else ULift.{v, u} α)
          (fun (a : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦ a.down)
          (preimage (β := (i : Bool) × bif i then ULift.{u, v} β else ULift.{v, u} α)
              (Sigma.mk (β := fun (i : Bool) ↦ bif i then ULift.{u, v} β else ULift.{v, u} α) false)
              ((fun (s : ULift.{v, u} α ⊕ ULift.{u, v} β) ↦
                  Sum.elim
                    (fun (x : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) false x)
                    (fun (x : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) true x)
                    s) ''
                (fun (a : α ⊕ β) ↦
                    Sum.map
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : α) → ULift.{v, u} α)
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : β) → ULift.{u, v} β)
                      a) ''
                  X) :
            Set (bif false then ULift.{u, v} β else ULift.{v, u} α))) ∧
      N.IsBasis
        (image (α := bif true then ULift.{u, v} β else ULift.{v, u} α)
          (fun (a : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦ a.down)
          (preimage (β := (i : Bool) × bif i then ULift.{u, v} β else ULift.{v, u} α)
              (Sigma.mk (β := fun (i : Bool) ↦ bif i then ULift.{u, v} β else ULift.{v, u} α) true)
              ((fun (s : ULift.{v, u} α ⊕ ULift.{u, v} β) ↦
                  Sum.elim
                    (fun (x : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) false x)
                    (fun (x : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) true x)
                    s) ''
                (fun (a : α ⊕ β) ↦
                    Sum.map
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : α) → ULift.{v, u} α)
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : β) → ULift.{u, v} β)
                      a) ''
                  I) :
            Set (bif true then ULift.{u, v} β else ULift.{v, u} α)))
        (image (α := bif true then ULift.{u, v} β else ULift.{v, u} α)
          (fun (a : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦ a.down)
          (preimage (β := (i : Bool) × bif i then ULift.{u, v} β else ULift.{v, u} α)
              (Sigma.mk (β := fun (i : Bool) ↦ bif i then ULift.{u, v} β else ULift.{v, u} α) true)
              ((fun (s : ULift.{v, u} α ⊕ ULift.{u, v} β) ↦
                  Sum.elim
                    (fun (x : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) false x)
                    (fun (x : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) true x)
                    s) ''
                (fun (a : α ⊕ β) ↦
                    Sum.map
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : α) → ULift.{v, u} α)
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : β) → ULift.{u, v} β)
                      a) ''
                  X) :
            Set (bif true then ULift.{u, v} β else ULift.{v, u} α))) ↔
    M.IsBasis
        (image (α := bif false then ULift.{u, v} β else ULift.{v, u} α)
          (fun (a : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦ a.down)
          (preimage (β := (i : Bool) × bif i then ULift.{u, v} β else ULift.{v, u} α)
              (Sigma.mk (β := fun (i : Bool) ↦ bif i then ULift.{u, v} β else ULift.{v, u} α) false)
              ((fun (s : ULift.{v, u} α ⊕ ULift.{u, v} β) ↦
                  Sum.elim
                    (fun (x : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) false x)
                    (fun (x : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) true x)
                    s) ''
                (fun (a : α ⊕ β) ↦
                    Sum.map
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : α) → ULift.{v, u} α)
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : β) → ULift.{u, v} β)
                      a) ''
                  I) :
            Set (bif false then ULift.{u, v} β else ULift.{v, u} α)))
        (image (α := bif false then ULift.{u, v} β else ULift.{v, u} α)
          (fun (a : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦ a.down)
          (preimage (β := (i : Bool) × bif i then ULift.{u, v} β else ULift.{v, u} α)
              (Sigma.mk (β := fun (i : Bool) ↦ bif i then ULift.{u, v} β else ULift.{v, u} α) false)
              ((fun (s : ULift.{v, u} α ⊕ ULift.{u, v} β) ↦
                  Sum.elim
                    (fun (x : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) false x)
                    (fun (x : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) true x)
                    s) ''
                (fun (a : α ⊕ β) ↦
                    Sum.map
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : α) → ULift.{v, u} α)
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : β) → ULift.{u, v} β)
                      a) ''
                  X) :
            Set (bif false then ULift.{u, v} β else ULift.{v, u} α))) ∧
      N.IsBasis
        (image (α := bif true then ULift.{u, v} β else ULift.{v, u} α)
          (fun (a : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦ a.down)
          (preimage (β := (i : Bool) × bif i then ULift.{u, v} β else ULift.{v, u} α)
              (Sigma.mk (β := fun (i : Bool) ↦ bif i then ULift.{u, v} β else ULift.{v, u} α) true)
              ((fun (s : ULift.{v, u} α ⊕ ULift.{u, v} β) ↦
                  Sum.elim
                    (fun (x : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) false x)
                    (fun (x : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) true x)
                    s) ''
                (fun (a : α ⊕ β) ↦
                    Sum.map
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : α) → ULift.{v, u} α)
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : β) → ULift.{u, v} β)
                      a) ''
                  I) :
            Set (bif true then ULift.{u, v} β else ULift.{v, u} α)))
        (image (α := bif true then ULift.{u, v} β else ULift.{v, u} α)
          (fun (a : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦ a.down)
          (preimage (β := (i : Bool) × bif i then ULift.{u, v} β else ULift.{v, u} α)
              (Sigma.mk (β := fun (i : Bool) ↦ bif i then ULift.{u, v} β else ULift.{v, u} α) true)
              ((fun (s : ULift.{v, u} α ⊕ ULift.{u, v} β) ↦
                  Sum.elim
                    (fun (x : bif false then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) false x)
                    (fun (x : bif true then ULift.{u, v} β else ULift.{v, u} α) ↦
                      Sigma.mk (β := fun (b : Bool) ↦ bif b then ULift.{u, v} β else ULift.{v, u} α) true x)
                    s) ''
                (fun (a : α ⊕ β) ↦
                    Sum.map
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : α) → ULift.{v, u} α)
                      (⇑(Equiv.symm { toFun := ULift.down, invFun := ULift.up, left_inv := ⋯, right_inv := ⋯ }) :
                        (a : β) → ULift.{u, v} β)
                      a) ''
                  X) :
            Set (bif true then ULift.{u, v} β else ULift.{v, u} α)))

Tactic:
Iff.rfl

Premises used: Iff.rfl