l3lab/ntp-mathlib huggingface dataset:
/-- Given a multilinear map `f` on `n` variables (parameterized by `Fin n`) and a subset `s` of `k`
of these variables, one gets a new multilinear map on `Fin k` by varying these variables, and fixing
the other ones equal to a given value `z`. It is denoted by `f.restr s hk z`, where `hk` is a
proof that the cardinality of `s` is `k`. The implicit identification between `Fin k` and `s` that
we use is the canonical (increasing) bijection. -/
def restr {k n : ℕ} (f : MultilinearMap R (fun _ : Fin n => M') M₂) (s : Finset (Fin n))
    (hk : s.card = k) (z : M') : MultilinearMap R (fun _ : Fin k => M') M₂ where
  toFun v := f fun j => if h : j ∈ s then v ((FunLike.coe (s.orderIsoOfFin hk).symm) ⟨j, h⟩) else z
  /- Porting note: The proofs of the following two lemmas used to only use `erw` followed by `simp`,
  but it seems `erw` no longer unfolds or unifies well enough to work without more help. -/
  map_add' v i x y := by
    have : FunLike.coe (s.orderIsoOfFin hk).symm = (s.orderIsoOfFin hk).toEquiv.symm := rfl
    simp only [this]
    erw [dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv,
      dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv,
      dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv]
    simp
  map_smul' v i c x := by
    have : FunLike.coe (s.orderIsoOfFin hk).symm = (s.orderIsoOfFin hk).toEquiv.symm := rfl
    

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n✝ : ℕ
M : Fin (Nat.succ n✝) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹¹ : Semiring R
inst✝¹⁰ : (i : Fin (Nat.succ n✝)) → AddCommMonoid (M i)
inst✝⁹ : (i : ι) → AddCommMonoid (M₁ i)
inst✝⁸ : AddCommMonoid M₂
inst✝⁷ : AddCommMonoid M₃
inst✝⁶ : AddCommMonoid M'
inst✝⁵ : (i : Fin (Nat.succ n✝)) → Module R (M i)
inst✝⁴ : (i : ι) → Module R (M₁ i)
inst✝³ : Module R M₂
inst✝² : Module R M₃
inst✝¹ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
k n : ℕ
f : MultilinearMap R (fun x => M') M₂
s : Finset (Fin n)
hk : Finset.card s = k
z : M'
inst✝ : DecidableEq (Fin k)
v : Fin k → M'
i : Fin k
c : R
x : M'
this : ⇑(OrderIso.symm (Finset.orderIsoOfFin s hk)) = ⇑(Finset.orderIsoOfFin s hk).symm
⊢ (fun v =>
        f fun j => if h : j ∈ s then v ((OrderIso.symm (Finset.orderIsoOfFin s hk)) { val := j, property := h }) else z)
      (update v i (c • x)) =
    c •
      (fun v =>
          f fun j =>
            if h : j ∈ s then v ((OrderIso.symm (Finset.orderIsoOfFin s hk)) { val := j, property := h }) else z)
        (update v i x)

Next tactic:
simp only [this]
/-- Given a multilinear map `f` on `n` variables (parameterized by `Fin n`) and a subset `s` of `k`
of these variables, one gets a new multilinear map on `Fin k` by varying these variables, and fixing
the other ones equal to a given value `z`. It is denoted by `f.restr s hk z`, where `hk` is a
proof that the cardinality of `s` is `k`. The implicit identification between `Fin k` and `s` that
we use is the canonical (increasing) bijection. -/
def restr {k n : ℕ} (f : MultilinearMap R (fun _ : Fin n => M') M₂) (s : Finset (Fin n))
    (hk : s.card = k) (z : M') : MultilinearMap R (fun _ : Fin k => M') M₂ where
  toFun v := f fun j => if h : j ∈ s then v ((FunLike.coe (s.orderIsoOfFin hk).symm) ⟨j, h⟩) else z
  /- Porting note: The proofs of the following two lemmas used to only use `erw` followed by `simp`,
  but it seems `erw` no longer unfolds or unifies well enough to work without more help. -/
  map_add' v i x y := by
    have : FunLike.coe (s.orderIsoOfFin hk).symm = (s.orderIsoOfFin hk).toEquiv.symm := rfl
    simp only [this]
    erw [dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv,
      dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv,
      dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv]
    simp
  map_smul' v i c x := by
    have : FunLike.coe (s.orderIsoOfFin hk).symm = (s.orderIsoOfFin hk).toEquiv.symm := rfl
    simp only [this]
    

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n✝ : ℕ
M : Fin (Nat.succ n✝) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹¹ : Semiring R
inst✝¹⁰ : (i : Fin (Nat.succ n✝)) → AddCommMonoid (M i)
inst✝⁹ : (i : ι) → AddCommMonoid (M₁ i)
inst✝⁸ : AddCommMonoid M₂
inst✝⁷ : AddCommMonoid M₃
inst✝⁶ : AddCommMonoid M'
inst✝⁵ : (i : Fin (Nat.succ n✝)) → Module R (M i)
inst✝⁴ : (i : ι) → Module R (M₁ i)
inst✝³ : Module R M₂
inst✝² : Module R M₃
inst✝¹ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
k n : ℕ
f : MultilinearMap R (fun x => M') M₂
s : Finset (Fin n)
hk : Finset.card s = k
z : M'
inst✝ : DecidableEq (Fin k)
v : Fin k → M'
i : Fin k
c : R
x : M'
this : ⇑(OrderIso.symm (Finset.orderIsoOfFin s hk)) = ⇑(Finset.orderIsoOfFin s hk).symm
⊢ (f fun j =>
      if h : j ∈ s then update v i (c • x) ((OrderIso.symm (Finset.orderIsoOfFin s hk)) { val := j, property := h })
      else z) =
    c •
      f fun j =>
        if h : j ∈ s then update v i x ((OrderIso.symm (Finset.orderIsoOfFin s hk)) { val := j, property := h }) else z

Next tactic:
erw [dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv,
      dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv]
/-- Given a multilinear map `f` on `n` variables (parameterized by `Fin n`) and a subset `s` of `k`
of these variables, one gets a new multilinear map on `Fin k` by varying these variables, and fixing
the other ones equal to a given value `z`. It is denoted by `f.restr s hk z`, where `hk` is a
proof that the cardinality of `s` is `k`. The implicit identification between `Fin k` and `s` that
we use is the canonical (increasing) bijection. -/
def restr {k n : ℕ} (f : MultilinearMap R (fun _ : Fin n => M') M₂) (s : Finset (Fin n))
    (hk : s.card = k) (z : M') : MultilinearMap R (fun _ : Fin k => M') M₂ where
  toFun v := f fun j => if h : j ∈ s then v ((FunLike.coe (s.orderIsoOfFin hk).symm) ⟨j, h⟩) else z
  /- Porting note: The proofs of the following two lemmas used to only use `erw` followed by `simp`,
  but it seems `erw` no longer unfolds or unifies well enough to work without more help. -/
  map_add' v i x y := by
    have : FunLike.coe (s.orderIsoOfFin hk).symm = (s.orderIsoOfFin hk).toEquiv.symm := rfl
    simp only [this]
    erw [dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv,
      dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv,
      dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv]
    simp
  map_smul' v i c x := by
    have : FunLike.coe (s.orderIsoOfFin hk).symm = (s.orderIsoOfFin hk).toEquiv.symm := rfl
    simp only [this]
    erw [dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv,
      dite_comp_equiv_update (s.orderIsoOfFin hk).toEquiv]
    

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n✝ : ℕ
M : Fin (Nat.succ n✝) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹¹ : Semiring R
inst✝¹⁰ : (i : Fin (Nat.succ n✝)) → AddCommMonoid (M i)
inst✝⁹ : (i : ι) → AddCommMonoid (M₁ i)
inst✝⁸ : AddCommMonoid M₂
inst✝⁷ : AddCommMonoid M₃
inst✝⁶ : AddCommMonoid M'
inst✝⁵ : (i : Fin (Nat.succ n✝)) → Module R (M i)
inst✝⁴ : (i : ι) → Module R (M₁ i)
inst✝³ : Module R M₂
inst✝² : Module R M₃
inst✝¹ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
k n : ℕ
f : MultilinearMap R (fun x => M') M₂
s : Finset (Fin n)
hk : Finset.card s = k
z : M'
inst✝ : DecidableEq (Fin k)
v : Fin k → M'
i : Fin k
c : R
x : M'
this : ⇑(OrderIso.symm (Finset.orderIsoOfFin s hk)) = ⇑(Finset.orderIsoOfFin s hk).symm
⊢ f
      (update (fun i => if h : i ∈ s then v ((Finset.orderIsoOfFin s hk).symm { val := i, property := h }) else z)
        (↑((Finset.orderIsoOfFin s hk).toEquiv i)) (c • x)) =
    c •
      f
        (update (fun i => if h : i ∈ s then v ((Finset.orderIsoOfFin s hk).symm { val := i, property := h }) else z)
          (↑((Finset.orderIsoOfFin s hk).toEquiv i)) x)

Next tactic:
simp
/-- In the specific case of multilinear maps on spaces indexed by `Fin (n+1)`, where one can build
an element of `∀ (i : Fin (n+1)), M i` using `cons`, one can express directly the additivity of a
multilinear map along the first variable. -/
theorem cons_add (f : MultilinearMap R M M₂) (m : ∀ i : Fin n, M i.succ) (x y : M 0) :
    f (cons (x + y) m) = f (cons x m) + f (cons y m) := by
  

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁰ : Semiring R
inst✝⁹ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝⁸ : (i : ι) → AddCommMonoid (M₁ i)
inst✝⁷ : AddCommMonoid M₂
inst✝⁶ : AddCommMonoid M₃
inst✝⁵ : AddCommMonoid M'
inst✝⁴ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝³ : (i : ι) → Module R (M₁ i)
inst✝² : Module R M₂
inst✝¹ : Module R M₃
inst✝ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
f : MultilinearMap R M M₂
m : (i : Fin n) → M (succ i)
x y : M 0
⊢ f (cons (x + y) m) = f (cons x m) + f (cons y m)

Next tactic:
simp_rw [← update_cons_zero x m (x + y), f.map_add, update_cons_zero]
/-- In the specific case of multilinear maps on spaces indexed by `Fin (n+1)`, where one can build
an element of `∀ (i : Fin (n+1)), M i` using `cons`, one can express directly the multiplicativity
of a multilinear map along the first variable. -/
theorem cons_smul (f : MultilinearMap R M M₂) (m : ∀ i : Fin n, M i.succ) (c : R) (x : M 0) :
    f (cons (c • x) m) = c • f (cons x m) := by
  

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁰ : Semiring R
inst✝⁹ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝⁸ : (i : ι) → AddCommMonoid (M₁ i)
inst✝⁷ : AddCommMonoid M₂
inst✝⁶ : AddCommMonoid M₃
inst✝⁵ : AddCommMonoid M'
inst✝⁴ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝³ : (i : ι) → Module R (M₁ i)
inst✝² : Module R M₂
inst✝¹ : Module R M₃
inst✝ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
f : MultilinearMap R M M₂
m : (i : Fin n) → M (succ i)
c : R
x : M 0
⊢ f (cons (c • x) m) = c • f (cons x m)

Next tactic:
simp_rw [← update_cons_zero x m (c • x), f.map_smul, update_cons_zero]
/-- In the specific case of multilinear maps on spaces indexed by `Fin (n+1)`, where one can build
an element of `∀ (i : Fin (n+1)), M i` using `snoc`, one can express directly the additivity of a
multilinear map along the first variable. -/
theorem snoc_add (f : MultilinearMap R M M₂)
    (m : ∀ i : Fin n, M (castSucc i)) (x y : M (last n)) :
    f (snoc m (x + y)) = f (snoc m x) + f (snoc m y) := by
  

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁰ : Semiring R
inst✝⁹ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝⁸ : (i : ι) → AddCommMonoid (M₁ i)
inst✝⁷ : AddCommMonoid M₂
inst✝⁶ : AddCommMonoid M₃
inst✝⁵ : AddCommMonoid M'
inst✝⁴ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝³ : (i : ι) → Module R (M₁ i)
inst✝² : Module R M₂
inst✝¹ : Module R M₃
inst✝ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
f : MultilinearMap R M M₂
m : (i : Fin n) → M (castSucc i)
x y : M (last n)
⊢ f (snoc m (x + y)) = f (snoc m x) + f (snoc m y)

Next tactic:
simp_rw [← update_snoc_last x m (x + y), f.map_add, update_snoc_last]
/-- In the specific case of multilinear maps on spaces indexed by `Fin (n+1)`, where one can build
an element of `∀ (i : Fin (n+1)), M i` using `cons`, one can express directly the multiplicativity
of a multilinear map along the first variable. -/
theorem snoc_smul (f : MultilinearMap R M M₂) (m : ∀ i : Fin n, M (castSucc i)) (c : R)
    (x : M (last n)) : f (snoc m (c • x)) = c • f (snoc m x) := by
  

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁰ : Semiring R
inst✝⁹ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝⁸ : (i : ι) → AddCommMonoid (M₁ i)
inst✝⁷ : AddCommMonoid M₂
inst✝⁶ : AddCommMonoid M₃
inst✝⁵ : AddCommMonoid M'
inst✝⁴ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝³ : (i : ι) → Module R (M₁ i)
inst✝² : Module R M₂
inst✝¹ : Module R M₃
inst✝ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
f : MultilinearMap R M M₂
m : (i : Fin n) → M (castSucc i)
c : R
x : M (last n)
⊢ f (snoc m (c • x)) = c • f (snoc m x)

Next tactic:
simp_rw [← update_snoc_last x m (c • x), f.map_smul, update_snoc_last]
/-- If `g` is a multilinear map and `f` is a collection of linear maps,
then `g (f₁ m₁, ..., fₙ mₙ)` is again a multilinear map, that we call
`g.compLinearMap f`. -/
def compLinearMap (g : MultilinearMap R M₁' M₂) (f : ∀ i, M₁ i →ₗ[R] M₁' i) : MultilinearMap R M₁ M₂
    where
  toFun m := g fun i => f i (m i)
  map_add' m i x y := by
    

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁵ : Semiring R
inst✝¹⁴ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝¹³ : (i : ι) → AddCommMonoid (M₁ i)
inst✝¹² : AddCommMonoid M₂
inst✝¹¹ : AddCommMonoid M₃
inst✝¹⁰ : AddCommMonoid M'
inst✝⁹ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝⁸ : (i : ι) → Module R (M₁ i)
inst✝⁷ : Module R M₂
inst✝⁶ : Module R M₃
inst✝⁵ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
M₁' : ι → Type u_1
inst✝⁴ : (i : ι) → AddCommMonoid (M₁' i)
inst✝³ : (i : ι) → Module R (M₁' i)
M₁'' : ι → Type u_2
inst✝² : (i : ι) → AddCommMonoid (M₁'' i)
inst✝¹ : (i : ι) → Module R (M₁'' i)
g : MultilinearMap R M₁' M₂
f : (i : ι) → M₁ i →ₗ[R] M₁' i
inst✝ : DecidableEq ι
m : (i : ι) → M₁ i
i : ι
x y : M₁ i
⊢ (fun m => g fun i => (f i) (m i)) (update m i (x + y)) =
    (fun m => g fun i => (f i) (m i)) (update m i x) + (fun m => g fun i => (f i) (m i)) (update m i y)

Next tactic:
have : ∀ j z, f j (update m i z j) = update (fun k => f k (m k)) i (f i z) j := fun j z =>
      Function.apply_update (fun k => f k) _ _ _ _
/-- If `g` is a multilinear map and `f` is a collection of linear maps,
then `g (f₁ m₁, ..., fₙ mₙ)` is again a multilinear map, that we call
`g.compLinearMap f`. -/
def compLinearMap (g : MultilinearMap R M₁' M₂) (f : ∀ i, M₁ i →ₗ[R] M₁' i) : MultilinearMap R M₁ M₂
    where
  toFun m := g fun i => f i (m i)
  map_add' m i x y := by
    have : ∀ j z, f j (update m i z j) = update (fun k => f k (m k)) i (f i z) j := fun j z =>
      Function.apply_update (fun k => f k) _ _ _ _
    

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁵ : Semiring R
inst✝¹⁴ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝¹³ : (i : ι) → AddCommMonoid (M₁ i)
inst✝¹² : AddCommMonoid M₂
inst✝¹¹ : AddCommMonoid M₃
inst✝¹⁰ : AddCommMonoid M'
inst✝⁹ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝⁸ : (i : ι) → Module R (M₁ i)
inst✝⁷ : Module R M₂
inst✝⁶ : Module R M₃
inst✝⁵ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
M₁' : ι → Type u_1
inst✝⁴ : (i : ι) → AddCommMonoid (M₁' i)
inst✝³ : (i : ι) → Module R (M₁' i)
M₁'' : ι → Type u_2
inst✝² : (i : ι) → AddCommMonoid (M₁'' i)
inst✝¹ : (i : ι) → Module R (M₁'' i)
g : MultilinearMap R M₁' M₂
f : (i : ι) → M₁ i →ₗ[R] M₁' i
inst✝ : DecidableEq ι
m : (i : ι) → M₁ i
i : ι
x y : M₁ i
this : ∀ (j : ι) (z : M₁ i), (f j) (update m i z j) = update (fun k => (f k) (m k)) i ((f i) z) j
⊢ (fun m => g fun i => (f i) (m i)) (update m i (x + y)) =
    (fun m => g fun i => (f i) (m i)) (update m i x) + (fun m => g fun i => (f i) (m i)) (update m i y)

Next tactic:
simp [this]
/-- If `g` is a multilinear map and `f` is a collection of linear maps,
then `g (f₁ m₁, ..., fₙ mₙ)` is again a multilinear map, that we call
`g.compLinearMap f`. -/
def compLinearMap (g : MultilinearMap R M₁' M₂) (f : ∀ i, M₁ i →ₗ[R] M₁' i) : MultilinearMap R M₁ M₂
    where
  toFun m := g fun i => f i (m i)
  map_add' m i x y := by
    have : ∀ j z, f j (update m i z j) = update (fun k => f k (m k)) i (f i z) j := fun j z =>
      Function.apply_update (fun k => f k) _ _ _ _
    simp [this]
  map_smul' m i c x := by
    

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁵ : Semiring R
inst✝¹⁴ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝¹³ : (i : ι) → AddCommMonoid (M₁ i)
inst✝¹² : AddCommMonoid M₂
inst✝¹¹ : AddCommMonoid M₃
inst✝¹⁰ : AddCommMonoid M'
inst✝⁹ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝⁸ : (i : ι) → Module R (M₁ i)
inst✝⁷ : Module R M₂
inst✝⁶ : Module R M₃
inst✝⁵ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
M₁' : ι → Type u_1
inst✝⁴ : (i : ι) → AddCommMonoid (M₁' i)
inst✝³ : (i : ι) → Module R (M₁' i)
M₁'' : ι → Type u_2
inst✝² : (i : ι) → AddCommMonoid (M₁'' i)
inst✝¹ : (i : ι) → Module R (M₁'' i)
g : MultilinearMap R M₁' M₂
f : (i : ι) → M₁ i →ₗ[R] M₁' i
inst✝ : DecidableEq ι
m : (i : ι) → M₁ i
i : ι
c : R
x : M₁ i
⊢ (fun m => g fun i => (f i) (m i)) (update m i (c • x)) = c • (fun m => g fun i => (f i) (m i)) (update m i x)

Next tactic:
have : ∀ j z, f j (update m i z j) = update (fun k => f k (m k)) i (f i z) j := fun j z =>
      Function.apply_update (fun k => f k) _ _ _ _
/-- If `g` is a multilinear map and `f` is a collection of linear maps,
then `g (f₁ m₁, ..., fₙ mₙ)` is again a multilinear map, that we call
`g.compLinearMap f`. -/
def compLinearMap (g : MultilinearMap R M₁' M₂) (f : ∀ i, M₁ i →ₗ[R] M₁' i) : MultilinearMap R M₁ M₂
    where
  toFun m := g fun i => f i (m i)
  map_add' m i x y := by
    have : ∀ j z, f j (update m i z j) = update (fun k => f k (m k)) i (f i z) j := fun j z =>
      Function.apply_update (fun k => f k) _ _ _ _
    simp [this]
  map_smul' m i c x := by
    have : ∀ j z, f j (update m i z j) = update (fun k => f k (m k)) i (f i z) j := fun j z =>
      Function.apply_update (fun k => f k) _ _ _ _
    

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁵ : Semiring R
inst✝¹⁴ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝¹³ : (i : ι) → AddCommMonoid (M₁ i)
inst✝¹² : AddCommMonoid M₂
inst✝¹¹ : AddCommMonoid M₃
inst✝¹⁰ : AddCommMonoid M'
inst✝⁹ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝⁸ : (i : ι) → Module R (M₁ i)
inst✝⁷ : Module R M₂
inst✝⁶ : Module R M₃
inst✝⁵ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
M₁' : ι → Type u_1
inst✝⁴ : (i : ι) → AddCommMonoid (M₁' i)
inst✝³ : (i : ι) → Module R (M₁' i)
M₁'' : ι → Type u_2
inst✝² : (i : ι) → AddCommMonoid (M₁'' i)
inst✝¹ : (i : ι) → Module R (M₁'' i)
g : MultilinearMap R M₁' M₂
f : (i : ι) → M₁ i →ₗ[R] M₁' i
inst✝ : DecidableEq ι
m : (i : ι) → M₁ i
i : ι
c : R
x : M₁ i
this : ∀ (j : ι) (z : M₁ i), (f j) (update m i z j) = update (fun k => (f k) (m k)) i ((f i) z) j
⊢ (fun m => g fun i => (f i) (m i)) (update m i (c • x)) = c • (fun m => g fun i => (f i) (m i)) (update m i x)

Next tactic:
simp [this]
/-- Composing with a family of surjective linear maps is injective. -/
theorem compLinearMap_injective (f : ∀ i, M₁ i →ₗ[R] M₁' i) (hf : ∀ i, Surjective (f i)) :
    Injective fun g : MultilinearMap R M₁' M₂ => g.compLinearMap f := fun g₁ g₂ h =>
  ext fun x => by
    

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁴ : Semiring R
inst✝¹³ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝¹² : (i : ι) → AddCommMonoid (M₁ i)
inst✝¹¹ : AddCommMonoid M₂
inst✝¹⁰ : AddCommMonoid M₃
inst✝⁹ : AddCommMonoid M'
inst✝⁸ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝⁷ : (i : ι) → Module R (M₁ i)
inst✝⁶ : Module R M₂
inst✝⁵ : Module R M₃
inst✝⁴ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
M₁' : ι → Type u_1
inst✝³ : (i : ι) → AddCommMonoid (M₁' i)
inst✝² : (i : ι) → Module R (M₁' i)
M₁'' : ι → Type u_2
inst✝¹ : (i : ι) → AddCommMonoid (M₁'' i)
inst✝ : (i : ι) → Module R (M₁'' i)
f : (i : ι) → M₁ i →ₗ[R] M₁' i
hf : ∀ (i : ι), Surjective ⇑(f i)
g₁ g₂ : MultilinearMap R M₁' M₂
h : (fun g => compLinearMap g f) g₁ = (fun g => compLinearMap g f) g₂
x : (i : ι) → M₁' i
⊢ g₁ x = g₂ x

Next tactic:
simpa [fun i => surjInv_eq (hf i)] using ext_iff.mp h fun i => surjInv (hf i) (x i)
/-- Composing a multilinear map with a linear equiv on each argument gives the zero map
if and only if the multilinear map is the zero map. -/
@[simp]
theorem comp_linearEquiv_eq_zero_iff (g : MultilinearMap R M₁' M₂) (f : ∀ i, M₁ i ≃ₗ[R] M₁' i) :
    (g.compLinearMap fun i => (f i : M₁ i →ₗ[R] M₁' i)) = 0 ↔ g = 0 := by
  

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁴ : Semiring R
inst✝¹³ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝¹² : (i : ι) → AddCommMonoid (M₁ i)
inst✝¹¹ : AddCommMonoid M₂
inst✝¹⁰ : AddCommMonoid M₃
inst✝⁹ : AddCommMonoid M'
inst✝⁸ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝⁷ : (i : ι) → Module R (M₁ i)
inst✝⁶ : Module R M₂
inst✝⁵ : Module R M₃
inst✝⁴ : Module R M'
f✝ f' : MultilinearMap R M₁ M₂
M₁' : ι → Type u_1
inst✝³ : (i : ι) → AddCommMonoid (M₁' i)
inst✝² : (i : ι) → Module R (M₁' i)
M₁'' : ι → Type u_2
inst✝¹ : (i : ι) → AddCommMonoid (M₁'' i)
inst✝ : (i : ι) → Module R (M₁'' i)
g : MultilinearMap R M₁' M₂
f : (i : ι) → M₁ i ≃ₗ[R] M₁' i
⊢ (compLinearMap g fun i => ↑(f i)) = 0 ↔ g = 0

Next tactic:
set f' := fun i => (f i : M₁ i →ₗ[R] M₁' i)
/-- Composing a multilinear map with a linear equiv on each argument gives the zero map
if and only if the multilinear map is the zero map. -/
@[simp]
theorem comp_linearEquiv_eq_zero_iff (g : MultilinearMap R M₁' M₂) (f : ∀ i, M₁ i ≃ₗ[R] M₁' i) :
    (g.compLinearMap fun i => (f i : M₁ i →ₗ[R] M₁' i)) = 0 ↔ g = 0 := by
  set f' := fun i => (f i : M₁ i →ₗ[R] M₁' i)
  

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹⁴ : Semiring R
inst✝¹³ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝¹² : (i : ι) → AddCommMonoid (M₁ i)
inst✝¹¹ : AddCommMonoid M₂
inst✝¹⁰ : AddCommMonoid M₃
inst✝⁹ : AddCommMonoid M'
inst✝⁸ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝⁷ : (i : ι) → Module R (M₁ i)
inst✝⁶ : Module R M₂
inst✝⁵ : Module R M₃
inst✝⁴ : Module R M'
f✝ f'✝ : MultilinearMap R M₁ M₂
M₁' : ι → Type u_1
inst✝³ : (i : ι) → AddCommMonoid (M₁' i)
inst✝² : (i : ι) → Module R (M₁' i)
M₁'' : ι → Type u_2
inst✝¹ : (i : ι) → AddCommMonoid (M₁'' i)
inst✝ : (i : ι) → Module R (M₁'' i)
g : MultilinearMap R M₁' M₂
f : (i : ι) → M₁ i ≃ₗ[R] M₁' i
f' : (i : ι) → M₁ i →ₗ[R] M₁' i := fun i => ↑(f i)
⊢ compLinearMap g f' = 0 ↔ g = 0

Next tactic:
rw [← zero_compLinearMap f', compLinearMap_inj f' fun i => (f i).surjective]
/-- If one adds to a vector `m'` another vector `m`, but only for coordinates in a finset `t`, then
the image under a multilinear map `f` is the sum of `f (s.piecewise m m')` along all subsets `s` of
`t`. This is mainly an auxiliary statement to prove the result when `t = univ`, given in
`map_add_univ`, although it can be useful in its own right as it does not require the index set `ι`
to be finite.-/
theorem map_piecewise_add [DecidableEq ι] (m m' : ∀ i, M₁ i) (t : Finset ι) :
    f (t.piecewise (m + m') m') = ∑ s in t.powerset, f (s.piecewise m m') := by
  

Proof state:
R : Type uR
S : Type uS
ι : Type uι
n : ℕ
M : Fin (Nat.succ n) → Type v
M₁ : ι → Type v₁
M₂ : Type v₂
M₃ : Type v₃
M' : Type v'
inst✝¹¹ : Semiring R
inst✝¹⁰ : (i : Fin (Nat.succ n)) → AddCommMonoid (M i)
inst✝⁹ : (i : ι) → AddCommMonoid (M₁ i)
inst✝⁸ : AddCommMonoid M₂
inst✝⁷ : AddCommMonoid M₃
inst✝⁶ : AddCommMonoid M'
inst✝⁵ : (i : Fin (Nat.succ n)) → Module R (M i)
inst✝⁴ : (i : ι) → Module R (M₁ i)
inst✝³ : Module R M₂
inst✝² : Module R M₃
inst✝¹ : Module R M'
f f' : MultilinearMap R M₁ M₂
inst✝ : DecidableEq ι
m m' : (i : ι) → M₁ i
t : Finset ι
⊢ f (Finset.piecewise t (m + m') m') = ∑ s in Finset.powerset t, f (Finset.piecewise s m m')

Next tactic:
revert m'