l3lab/ntp-mathlib huggingface dataset:
/--
The family of linear maps `M₂ → M` parameterised by `f ∈ M₂ → R`, `x ∈ M`, is linear in `f`, `x`.
-/
def smulRightₗ : (M₂ →ₗ[R] R) →ₗ[R] M →ₗ[R] M₂ →ₗ[R] M where
  toFun f :=
    { toFun := LinearMap.smulRight f
      map_add' := fun m m' => by
        

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
k : Type u_5
S : Type u_6
S₃ : Type u_7
T : Type u_8
M : Type u_9
M₁ : Type u_10
M₂ : Type u_11
M₃ : Type u_12
N₁ : Type u_13
N₂ : Type u_14
N₃ : Type u_15
ι : Type u_16
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid M₂
inst✝³ : AddCommMonoid M₃
inst✝² : Module R M
inst✝¹ : Module R M₂
inst✝ : Module R M₃
f✝ g : M →ₗ[R] M₂
f : M₂ →ₗ[R] R
m m' : M
⊢ smulRight f (m + m') = smulRight f m + smulRight f m'

Next tactic:
ext
/--
The family of linear maps `M₂ → M` parameterised by `f ∈ M₂ → R`, `x ∈ M`, is linear in `f`, `x`.
-/
def smulRightₗ : (M₂ →ₗ[R] R) →ₗ[R] M →ₗ[R] M₂ →ₗ[R] M where
  toFun f :=
    { toFun := LinearMap.smulRight f
      map_add' := fun m m' => by
        ext
        

Proof state:
case h
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
k : Type u_5
S : Type u_6
S₃ : Type u_7
T : Type u_8
M : Type u_9
M₁ : Type u_10
M₂ : Type u_11
M₃ : Type u_12
N₁ : Type u_13
N₂ : Type u_14
N₃ : Type u_15
ι : Type u_16
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid M₂
inst✝³ : AddCommMonoid M₃
inst✝² : Module R M
inst✝¹ : Module R M₂
inst✝ : Module R M₃
f✝ g : M →ₗ[R] M₂
f : M₂ →ₗ[R] R
m m' : M
x✝ : M₂
⊢ (smulRight f (m + m')) x✝ = (smulRight f m + smulRight f m') x✝

Next tactic:
apply smul_add
/--
The family of linear maps `M₂ → M` parameterised by `f ∈ M₂ → R`, `x ∈ M`, is linear in `f`, `x`.
-/
def smulRightₗ : (M₂ →ₗ[R] R) →ₗ[R] M →ₗ[R] M₂ →ₗ[R] M where
  toFun f :=
    { toFun := LinearMap.smulRight f
      map_add' := fun m m' => by
        ext
        apply smul_add
      map_smul' := fun c m => by
        

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
k : Type u_5
S : Type u_6
S₃ : Type u_7
T : Type u_8
M : Type u_9
M₁ : Type u_10
M₂ : Type u_11
M₃ : Type u_12
N₁ : Type u_13
N₂ : Type u_14
N₃ : Type u_15
ι : Type u_16
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid M₂
inst✝³ : AddCommMonoid M₃
inst✝² : Module R M
inst✝¹ : Module R M₂
inst✝ : Module R M₃
f✝ g : M →ₗ[R] M₂
f : M₂ →ₗ[R] R
c : R
m : M
⊢ AddHom.toFun
      { toFun := smulRight f, map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') }
      (c • m) =
    (RingHom.id R) c •
      AddHom.toFun
        { toFun := smulRight f, map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') }
        m

Next tactic:
ext
/--
The family of linear maps `M₂ → M` parameterised by `f ∈ M₂ → R`, `x ∈ M`, is linear in `f`, `x`.
-/
def smulRightₗ : (M₂ →ₗ[R] R) →ₗ[R] M →ₗ[R] M₂ →ₗ[R] M where
  toFun f :=
    { toFun := LinearMap.smulRight f
      map_add' := fun m m' => by
        ext
        apply smul_add
      map_smul' := fun c m => by
        ext
        

Proof state:
case h
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
k : Type u_5
S : Type u_6
S₃ : Type u_7
T : Type u_8
M : Type u_9
M₁ : Type u_10
M₂ : Type u_11
M₃ : Type u_12
N₁ : Type u_13
N₂ : Type u_14
N₃ : Type u_15
ι : Type u_16
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid M₂
inst✝³ : AddCommMonoid M₃
inst✝² : Module R M
inst✝¹ : Module R M₂
inst✝ : Module R M₃
f✝ g : M →ₗ[R] M₂
f : M₂ →ₗ[R] R
c : R
m : M
x✝ : M₂
⊢ (AddHom.toFun
        { toFun := smulRight f, map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') }
        (c • m))
      x✝ =
    ((RingHom.id R) c •
        AddHom.toFun
          { toFun := smulRight f,
            map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') }
          m)
      x✝

Next tactic:
apply smul_comm
/--
The family of linear maps `M₂ → M` parameterised by `f ∈ M₂ → R`, `x ∈ M`, is linear in `f`, `x`.
-/
def smulRightₗ : (M₂ →ₗ[R] R) →ₗ[R] M →ₗ[R] M₂ →ₗ[R] M where
  toFun f :=
    { toFun := LinearMap.smulRight f
      map_add' := fun m m' => by
        ext
        apply smul_add
      map_smul' := fun c m => by
        ext
        apply smul_comm }
  map_add' f f' := by
    

Proof state:
R : Type u_1
R₁ : Type u_2
R₂ : Type u_3
R₃ : Type u_4
k : Type u_5
S : Type u_6
S₃ : Type u_7
T : Type u_8
M : Type u_9
M₁ : Type u_10
M₂ : Type u_11
M₃ : Type u_12
N₁ : Type u_13
N₂ : Type u_14
N₃ : Type u_15
ι : Type u_16
inst✝⁶ : CommSemiring R
inst✝⁵ : AddCommMonoid M
inst✝⁴ : AddCommMonoid M₂
inst✝³ : AddCommMonoid M₃
inst✝² : Module R M
inst✝¹ : Module R M₂
inst✝ : Module R M₃
f✝ g : M →ₗ[R] M₂
f f' : M₂ →ₗ[R] R
⊢ (fun f =>
        {
          toAddHom :=
            { toFun := smulRight f,
              map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') },
          map_smul' :=
            (_ :
              ∀ (c : R) (m : M),
                AddHom.toFun
                    { toFun := smulRight f,
                      map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') }
                    (c • m) =
                  (RingHom.id R) c •
                    AddHom.toFun
                      { toFun := smulRight f,
                        map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') }
                      m) })
      (f + f') =
    (fun f =>
          {
            toAddHom :=
              { toFun := smulRight f,
                map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') },
            map_smul' :=
              (_ :
                ∀ (c : R) (m : M),
                  AddHom.toFun
                      { toFun := smulRight f,
                        map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') }
                      (c • m) =
                    (RingHom.id R) c •
                      AddHom.toFun
                        { toFun := smulRight f,
                          map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') }
                        m) })
        f +
      (fun f =>
          {
            toAddHom :=
              { toFun := smulRight f,
                map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') },
            map_smul' :=
              (_ :
                ∀ (c : R) (m : M),
                  AddHom.toFun
                      { toFun := smulRight f,
                        map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') }
                      (c • m) =
                    (RingHom.id R) c •
                      AddHom.toFun
                        { toFun := smulRight f,
                          map_add' := (_ : ∀ (m m' : M), smulRight f (m + m') = smulRight f m + smulRight f m') }
                        m) })
        f'

Next tactic:
ext
theorem permutationsAux2_fst (t : α) (ts : List α) (r : List β) :
    ∀ (ys : List α) (f : List α → β), (permutationsAux2 t ts r ys f).1 = ys ++ ts
  | [], f => rfl
  | y :: ys, f => by 

Proof state:
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List β
y : α
ys : List α
f : List α → β
⊢ (permutationsAux2 t ts r (y :: ys) f).1 = y :: ys ++ ts

Next tactic:
simp [permutationsAux2, permutationsAux2_fst t _ _ ys]
@[simp]
theorem permutationsAux2_snd_cons (t : α) (ts : List α) (r : List β) (y : α) (ys : List α)
    (f : List α → β) :
    (permutationsAux2 t ts r (y :: ys) f).2 =
      f (t :: y :: ys ++ ts) :: (permutationsAux2 t ts r ys fun x : List α => f (y :: x)).2 :=
  by 

Proof state:
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List β
y : α
ys : List α
f : List α → β
⊢ (permutationsAux2 t ts r (y :: ys) f).2 = f (t :: y :: ys ++ ts) :: (permutationsAux2 t ts r ys fun x => f (y :: x)).2

Next tactic:
simp [permutationsAux2, permutationsAux2_fst t _ _ ys]
/-- The `r` argument to `permutationsAux2` is the same as appending. -/
theorem permutationsAux2_append (t : α) (ts : List α) (r : List β) (ys : List α) (f : List α → β) :
    (permutationsAux2 t ts nil ys f).2 ++ r = (permutationsAux2 t ts r ys f).2 := by
  

Proof state:
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List β
ys : List α
f : List α → β
⊢ (permutationsAux2 t ts [] ys f).2 ++ r = (permutationsAux2 t ts r ys f).2

Next tactic:
induction ys generalizing f
/-- The `r` argument to `permutationsAux2` is the same as appending. -/
theorem permutationsAux2_append (t : α) (ts : List α) (r : List β) (ys : List α) (f : List α → β) :
    (permutationsAux2 t ts nil ys f).2 ++ r = (permutationsAux2 t ts r ys f).2 := by
  induction ys generalizing f <;> 

Proof state:
case nil
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List β
f : List α → β
⊢ (permutationsAux2 t ts [] [] f).2 ++ r = (permutationsAux2 t ts r [] f).2

Next tactic:
simp [*]
/-- The `r` argument to `permutationsAux2` is the same as appending. -/
theorem permutationsAux2_append (t : α) (ts : List α) (r : List β) (ys : List α) (f : List α → β) :
    (permutationsAux2 t ts nil ys f).2 ++ r = (permutationsAux2 t ts r ys f).2 := by
  induction ys generalizing f <;> 

Proof state:
case cons
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List β
head✝ : α
tail✝ : List α
tail_ih✝ : ∀ (f : List α → β), (permutationsAux2 t ts [] tail✝ f).2 ++ r = (permutationsAux2 t ts r tail✝ f).2
f : List α → β
⊢ (permutationsAux2 t ts [] (head✝ :: tail✝) f).2 ++ r = (permutationsAux2 t ts r (head✝ :: tail✝) f).2

Next tactic:
simp [*]
/-- The `ts` argument to `permutationsAux2` can be folded into the `f` argument. -/
theorem permutationsAux2_comp_append {t : α} {ts ys : List α} {r : List β} (f : List α → β) :
    ((permutationsAux2 t [] r ys) fun x => f (x ++ ts)).2 = (permutationsAux2 t ts r ys f).2 := by
  

Proof state:
α : Type u_1
β : Type u_2
t : α
ts ys : List α
r : List β
f : List α → β
⊢ (permutationsAux2 t [] r ys fun x => f (x ++ ts)).2 = (permutationsAux2 t ts r ys f).2

Next tactic:
induction' ys with ys_hd _ ys_ih generalizing f
/-- The `ts` argument to `permutationsAux2` can be folded into the `f` argument. -/
theorem permutationsAux2_comp_append {t : α} {ts ys : List α} {r : List β} (f : List α → β) :
    ((permutationsAux2 t [] r ys) fun x => f (x ++ ts)).2 = (permutationsAux2 t ts r ys f).2 := by
  induction' ys with ys_hd _ ys_ih generalizing f
  · 

Proof state:
case nil
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List β
f : List α → β
⊢ (permutationsAux2 t [] r [] fun x => f (x ++ ts)).2 = (permutationsAux2 t ts r [] f).2

Next tactic:
simp
/-- The `ts` argument to `permutationsAux2` can be folded into the `f` argument. -/
theorem permutationsAux2_comp_append {t : α} {ts ys : List α} {r : List β} (f : List α → β) :
    ((permutationsAux2 t [] r ys) fun x => f (x ++ ts)).2 = (permutationsAux2 t ts r ys f).2 := by
  induction' ys with ys_hd _ ys_ih generalizing f
  · simp
  · 

Proof state:
case cons
α : Type u_1
β : Type u_2
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih : ∀ (f : List α → β), (permutationsAux2 t [] r tail✝ fun x => f (x ++ ts)).2 = (permutationsAux2 t ts r tail✝ f).2
f : List α → β
⊢ (permutationsAux2 t [] r (ys_hd :: tail✝) fun x => f (x ++ ts)).2 = (permutationsAux2 t ts r (ys_hd :: tail✝) f).2

Next tactic:
simp [ys_ih fun xs => f (ys_hd :: xs)]
theorem map_permutationsAux2' {α β α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α)
    (r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) :
    map g' (permutationsAux2 t ts r ys f).2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by
  

Proof state:
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts ys : List α
r : List β
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ map g' (permutationsAux2 t ts r ys f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2

Next tactic:
induction' ys with ys_hd _ ys_ih generalizing f f'
theorem map_permutationsAux2' {α β α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α)
    (r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) :
    map g' (permutationsAux2 t ts r ys f).2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by
  induction' ys with ys_hd _ ys_ih generalizing f f'
  · 

Proof state:
case nil
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ map g' (permutationsAux2 t ts r [] f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g []) f').2

Next tactic:
simp
theorem map_permutationsAux2' {α β α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α)
    (r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) :
    map g' (permutationsAux2 t ts r ys f).2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by
  induction' ys with ys_hd _ ys_ih generalizing f f'
  · simp
  · 

Proof state:
case cons
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih :
  ∀ (f : List α → β) (f' : List α' → β'),
    (∀ (a : List α), g' (f a) = f' (map g a)) →
      map g' (permutationsAux2 t ts r tail✝ f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) f').2
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ map g' (permutationsAux2 t ts r (ys_hd :: tail✝) f).2 =
    (permutationsAux2 (g t) (map g ts) (map g' r) (map g (ys_hd :: tail✝)) f').2

Next tactic:
simp only [map, permutationsAux2_snd_cons, cons_append, cons.injEq]
theorem map_permutationsAux2' {α β α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α)
    (r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) :
    map g' (permutationsAux2 t ts r ys f).2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by
  induction' ys with ys_hd _ ys_ih generalizing f f'
  · simp
  · simp only [map, permutationsAux2_snd_cons, cons_append, cons.injEq]
    

Proof state:
case cons
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih :
  ∀ (f : List α → β) (f' : List α' → β'),
    (∀ (a : List α), g' (f a) = f' (map g a)) →
      map g' (permutationsAux2 t ts r tail✝ f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) f').2
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ g' (f (t :: ys_hd :: (permutationsAux2 t ts r tail✝ fun x => f (ys_hd :: x)).1)) =
      f' (g t :: g ys_hd :: (map g tail✝ ++ map g ts)) ∧
    map g' (permutationsAux2 t ts r tail✝ fun x => f (ys_hd :: x)).2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) fun x => f' (g ys_hd :: x)).2

Next tactic:
rw [ys_ih, permutationsAux2_fst]
theorem map_permutationsAux2' {α β α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α)
    (r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) :
    map g' (permutationsAux2 t ts r ys f).2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by
  induction' ys with ys_hd _ ys_ih generalizing f f'
  · simp
  · simp only [map, permutationsAux2_snd_cons, cons_append, cons.injEq]
    rw [ys_ih, permutationsAux2_fst]
    

Proof state:
case cons
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih :
  ∀ (f : List α → β) (f' : List α' → β'),
    (∀ (a : List α), g' (f a) = f' (map g a)) →
      map g' (permutationsAux2 t ts r tail✝ f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) f').2
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ g' (f (t :: ys_hd :: (tail✝ ++ ts))) = f' (g t :: g ys_hd :: (map g tail✝ ++ map g ts)) ∧
    (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) ?cons.f').2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) fun x => f' (g ys_hd :: x)).2
case cons.f'
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih :
  ∀ (f : List α → β) (f' : List α' → β'),
    (∀ (a : List α), g' (f a) = f' (map g a)) →
      map g' (permutationsAux2 t ts r tail✝ f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) f').2
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ List α' → β'
case cons.f'
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih :
  ∀ (f : List α → β) (f' : List α' → β'),
    (∀ (a : List α), g' (f a) = f' (map g a)) →
      map g' (permutationsAux2 t ts r tail✝ f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) f').2
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ List α' → β'
case cons.H
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih :
  ∀ (f : List α → β) (f' : List α' → β'),
    (∀ (a : List α), g' (f a) = f' (map g a)) →
      map g' (permutationsAux2 t ts r tail✝ f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) f').2
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ ∀ (a : List α), g' (f (ys_hd :: a)) = ?cons.f' (map g a)

Next tactic:
refine' ⟨_, rfl⟩
theorem map_permutationsAux2' {α β α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α)
    (r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) :
    map g' (permutationsAux2 t ts r ys f).2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by
  induction' ys with ys_hd _ ys_ih generalizing f f'
  · simp
  · simp only [map, permutationsAux2_snd_cons, cons_append, cons.injEq]
    rw [ys_ih, permutationsAux2_fst]
    refine' ⟨_, rfl⟩
    · 

Proof state:
case cons
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih :
  ∀ (f : List α → β) (f' : List α' → β'),
    (∀ (a : List α), g' (f a) = f' (map g a)) →
      map g' (permutationsAux2 t ts r tail✝ f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) f').2
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ g' (f (t :: ys_hd :: (tail✝ ++ ts))) = f' (g t :: g ys_hd :: (map g tail✝ ++ map g ts))

Next tactic:
simp only [← map_cons, ← map_append]
theorem map_permutationsAux2' {α β α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α)
    (r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) :
    map g' (permutationsAux2 t ts r ys f).2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by
  induction' ys with ys_hd _ ys_ih generalizing f f'
  · simp
  · simp only [map, permutationsAux2_snd_cons, cons_append, cons.injEq]
    rw [ys_ih, permutationsAux2_fst]
    refine' ⟨_, rfl⟩
    · simp only [← map_cons, ← map_append]; 

Proof state:
case cons
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih :
  ∀ (f : List α → β) (f' : List α' → β'),
    (∀ (a : List α), g' (f a) = f' (map g a)) →
      map g' (permutationsAux2 t ts r tail✝ f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) f').2
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ g' (f (t :: ys_hd :: (tail✝ ++ ts))) = f' (map g (t :: ys_hd :: (tail✝ ++ ts)))

Next tactic:
apply H
theorem map_permutationsAux2' {α β α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α)
    (r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) :
    map g' (permutationsAux2 t ts r ys f).2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by
  induction' ys with ys_hd _ ys_ih generalizing f f'
  · simp
  · simp only [map, permutationsAux2_snd_cons, cons_append, cons.injEq]
    rw [ys_ih, permutationsAux2_fst]
    refine' ⟨_, rfl⟩
    · simp only [← map_cons, ← map_append]; apply H
    · 

Proof state:
case cons.H
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih :
  ∀ (f : List α → β) (f' : List α' → β'),
    (∀ (a : List α), g' (f a) = f' (map g a)) →
      map g' (permutationsAux2 t ts r tail✝ f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) f').2
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
⊢ ∀ (a : List α), g' (f (ys_hd :: a)) = f' (g ys_hd :: map g a)

Next tactic:
intro a
theorem map_permutationsAux2' {α β α' β'} (g : α → α') (g' : β → β') (t : α) (ts ys : List α)
    (r : List β) (f : List α → β) (f' : List α' → β') (H : ∀ a, g' (f a) = f' (map g a)) :
    map g' (permutationsAux2 t ts r ys f).2 =
      (permutationsAux2 (g t) (map g ts) (map g' r) (map g ys) f').2 := by
  induction' ys with ys_hd _ ys_ih generalizing f f'
  · simp
  · simp only [map, permutationsAux2_snd_cons, cons_append, cons.injEq]
    rw [ys_ih, permutationsAux2_fst]
    refine' ⟨_, rfl⟩
    · simp only [← map_cons, ← map_append]; apply H
    · intro a; 

Proof state:
case cons.H
α✝ : Type u_1
β✝ : Type u_2
α : Type u_3
β : Type u_4
α' : Type u_5
β' : Type u_6
g : α → α'
g' : β → β'
t : α
ts : List α
r : List β
ys_hd : α
tail✝ : List α
ys_ih :
  ∀ (f : List α → β) (f' : List α' → β'),
    (∀ (a : List α), g' (f a) = f' (map g a)) →
      map g' (permutationsAux2 t ts r tail✝ f).2 = (permutationsAux2 (g t) (map g ts) (map g' r) (map g tail✝) f').2
f : List α → β
f' : List α' → β'
H : ∀ (a : List α), g' (f a) = f' (map g a)
a : List α
⊢ g' (f (ys_hd :: a)) = f' (g ys_hd :: map g a)

Next tactic:
apply H
/-- The `f` argument to `permutationsAux2` when `r = []` can be eliminated. -/
theorem map_permutationsAux2 (t : α) (ts : List α) (ys : List α) (f : List α → β) :
    (permutationsAux2 t ts [] ys id).2.map f = (permutationsAux2 t ts [] ys f).2 := by
  

Proof state:
α : Type u_1
β : Type u_2
t : α
ts ys : List α
f : List α → β
⊢ map f (permutationsAux2 t ts [] ys id).2 = (permutationsAux2 t ts [] ys f).2

Next tactic:
rw [map_permutationsAux2' id, map_id, map_id]
/-- The `f` argument to `permutationsAux2` when `r = []` can be eliminated. -/
theorem map_permutationsAux2 (t : α) (ts : List α) (ys : List α) (f : List α → β) :
    (permutationsAux2 t ts [] ys id).2.map f = (permutationsAux2 t ts [] ys f).2 := by
  rw [map_permutationsAux2' id, map_id, map_id]; 

Proof state:
α : Type u_1
β : Type u_2
t : α
ts ys : List α
f : List α → β
⊢ (permutationsAux2 (id t) ts (map f []) ys ?f').2 = (permutationsAux2 t ts [] ys f).2
case f'
α : Type u_1
β : Type u_2
t : α
ts ys : List α
f : List α → β
⊢ List α → β
case f'
α : Type u_1
β : Type u_2
t : α
ts ys : List α
f : List α → β
⊢ List α → β
case f'
α : Type u_1
β : Type u_2
t : α
ts ys : List α
f : List α → β
⊢ List α → β
case H α : Type u_1 β : Type u_2 t : α ts ys : List α f : List α → β ⊢ ∀ (a : List α), f (id a) = ?f' (map id a)

Next tactic:
rfl
/-- The `f` argument to `permutationsAux2` when `r = []` can be eliminated. -/
theorem map_permutationsAux2 (t : α) (ts : List α) (ys : List α) (f : List α → β) :
    (permutationsAux2 t ts [] ys id).2.map f = (permutationsAux2 t ts [] ys f).2 := by
  rw [map_permutationsAux2' id, map_id, map_id]; rfl
  

Proof state:
case H
α : Type u_1
β : Type u_2
t : α
ts ys : List α
f : List α → β
⊢ ∀ (a : List α), f (id a) = f (map id a)

Next tactic:
simp