open scoped Classical in
/-- The basis on `ι →₀ M` with basis vectors `λ ⟨i, x⟩, single i (b i x)`. -/
protected def basis {φ : ι → Type*} (b : ∀ i, Basis (φ i) R M) : Basis (Σi, φ i) R (ι →₀ M) :=
  Basis.ofRepr
    { toFun := fun g =>
        { toFun := fun ix => (b ix.1).repr (g ix.1) ix.2
          support := g.support.sigma fun i => ((b i).repr (g i)).support
          mem_support_toFun := fun ix => by
            simp only [Finset.mem_sigma, mem_support_iff, and_iff_right_iff_imp, Ne.def]
            intro b hg
            simp [hg] at b }
      invFun := fun g =>
        { toFun := fun i =>
            (b i).repr.symm (g.comapDomain _ (Set.injOn_of_injective sigma_mk_injective _))
          support := g.support.image Sigma.fst
          mem_support_toFun := fun i => by
            rw [Ne.def, ← (b i).repr.injective.eq_iff, (b i).repr.apply_symm_apply, FunLike.ext_iff]
            simp only [exists_prop, LinearEquiv.map_zero, comapDomain_apply, zero_apply,
              exists_and_right, mem_support_iff, exists_eq_right, Sigma.exists, Finset.mem_image,
              not_forall] }
      left_inv := fun g => by
        ext i
        

Proof state:
case h
R : Type u_1
M : Type u_2
ι : Type u_3
inst✝² : Semiring R
inst✝¹ : AddCommMonoid M
inst✝ : Module R M
φ : ι → Type u_4
b : (i : ι) → Basis (φ i) R M
g : ι →₀ M
i : ι
⊢ ((fun g =>
          { support := Finset.image Sigma.fst g.support,
            toFun := fun i =>
              (LinearEquiv.symm (b i).repr)
                (comapDomain (Sigma.mk i) g (_ : InjOn (Sigma.mk i) (Sigma.mk i ⁻¹' ↑g.support))),
            mem_support_toFun :=
              (_ :
                ∀ (i : ι),
                  i ∈ Finset.image Sigma.fst g.support ↔
                    (fun i =>
                          (LinearEquiv.symm (b i).repr)
                            (comapDomain (Sigma.mk i) g (_ : InjOn (Sigma.mk i) (Sigma.mk i ⁻¹' ↑g.support))))
                        i ≠
                      0) })
        (AddHom.toFun
          {
              toAddHom :=
                {
                  toFun := fun g =>
                    { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                      toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                      mem_support_toFun :=
                        (_ :
                          ∀ (ix : (i : ι) × φ i),
                            (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                              (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) },
                  map_add' :=
                    (_ :
                      ∀ (g h : ι →₀ M),
                        (fun g =>
                              { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                                toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                                mem_support_toFun :=
                                  (_ :
                                    ∀ (ix : (i : ι) × φ i),
                                      (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                        (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) })
                            (g + h) =
                          (fun g =>
                                { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                                  toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                                  mem_support_toFun :=
                                    (_ :
                                      ∀ (ix : (i : ι) × φ i),
                                        (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                          (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) })
                              g +
                            (fun g =>
                                { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                                  toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                                  mem_support_toFun :=
                                    (_ :
                                      ∀ (ix : (i : ι) × φ i),
                                        (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                          (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) })
                              h) },
              map_smul' :=
                (_ :
                  ∀ (c : R) (h : ι →₀ M),
                    AddHom.toFun
                        {
                          toFun := fun g =>
                            { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                              toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                              mem_support_toFun :=
                                (_ :
                                  ∀ (ix : (i : ι) × φ i),
                                    (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                      (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) },
                          map_add' :=
                            (_ :
                              ∀ (g h : ι →₀ M),
                                (fun g =>
                                      { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                                        toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                                        mem_support_toFun :=
                                          (_ :
                                            ∀ (ix : (i : ι) × φ i),
                                              (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                                (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) })
                                    (g + h) =
                                  (fun g =>
                                        { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                                          toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                                          mem_support_toFun :=
                                            (_ :
                                              ∀ (ix : (i : ι) × φ i),
                                                (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                                  (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) })
                                      g +
                                    (fun g =>
                                        { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                                          toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                                          mem_support_toFun :=
                                            (_ :
                                              ∀ (ix : (i : ι) × φ i),
                                                (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                                  (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) })
                                      h) }
                        (c • h) =
                      (RingHom.id R) c •
                        AddHom.toFun
                          {
                            toFun := fun g =>
                              { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                                toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                                mem_support_toFun :=
                                  (_ :
                                    ∀ (ix : (i : ι) × φ i),
                                      (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                        (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) },
                            map_add' :=
                              (_ :
                                ∀ (g h : ι →₀ M),
                                  (fun g =>
                                        { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                                          toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                                          mem_support_toFun :=
                                            (_ :
                                              ∀ (ix : (i : ι) × φ i),
                                                (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                                  (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) })
                                      (g + h) =
                                    (fun g =>
                                          { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                                            toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                                            mem_support_toFun :=
                                              (_ :
                                                ∀ (ix : (i : ι) × φ i),
                                                  (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                                    (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) })
                                        g +
                                      (fun g =>
                                          { support := Finset.sigma g.support fun i => ((b i).repr (g i)).support,
                                            toFun := fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd,
                                            mem_support_toFun :=
                                              (_ :
                                                ∀ (ix : (i : ι) × φ i),
                                                  (ix ∈ Finset.sigma g.support fun i => ((b i).repr (g i)).support) ↔
                                                    (fun ix => ((b ix.fst).repr (g ix.fst)) ix.snd) ix ≠ 0) })
                                        h) }
                          h) }.toAddHom
          g))
      i =
    g i

Next tactic:
rw [← (b i).repr.injective.eq_iff]