Theorem: Vector.naturality
File: Mathlib/Data/Vector/Basic.lean

tactic: induction' x with n x xs ih
state_before: n : ℕ
F G : Type u → Type u
inst✝³ : Applicative F
inst✝² : Applicative G
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α✝ β✝ γ : Type u
η : ApplicativeTransformation F G
α β : Type u
f : α → F β
x : Vector α n
⊢ (fun {α} => η.app α) (Vector.traverse f x) = Vector.traverse ((fun {α} => η.app α) ∘ f) x
state_after: case nil
n : ℕ
F G : Type u → Type u
inst✝³ : Applicative F
inst✝² : Applicative G
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α✝ β✝ γ : Type u
η : ApplicativeTransformation F G
α β : Type u
f : α → F β
⊢ (fun {α} => η.app α) (Vector.traverse f nil) = Vector.traverse ((fun {α} => η.app α) ∘ f) nil

case cons
n✝ : ℕ
F G : Type u → Type u
inst✝³ : Applicative F
inst✝² : Applicative G
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α✝ β✝ γ : Type u
η : ApplicativeTransformation F G
α β : Type u
f : α → F β
n : ℕ
x : α
xs : Vector α n
ih : (fun {α} => η.app α) (Vector.traverse f xs) = Vector.traverse ((fun {α} => η.app α) ∘ f) xs
⊢ (fun {α} => η.app α) (Vector.traverse f (x ::ᵥ xs)) = Vector.traverse ((fun {α} => η.app α) ∘ f) (x ::ᵥ xs)

tactic: simp! [functor_norm, cast, η.preserves_pure]
state_before: case nil
n : ℕ
F G : Type u → Type u
inst✝³ : Applicative F
inst✝² : Applicative G
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α✝ β✝ γ : Type u
η : ApplicativeTransformation F G
α β : Type u
f : α → F β
⊢ (fun {α} => η.app α) (Vector.traverse f nil) = Vector.traverse ((fun {α} => η.app α) ∘ f) nil
state_after: no goals

tactic: rw [Vector.traverse_def, Vector.traverse_def, ← ih, η.preserves_seq, η.preserves_map]
state_before: case cons
n✝ : ℕ
F G : Type u → Type u
inst✝³ : Applicative F
inst✝² : Applicative G
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α✝ β✝ γ : Type u
η : ApplicativeTransformation F G
α β : Type u
f : α → F β
n : ℕ
x : α
xs : Vector α n
ih : (fun {α} => η.app α) (Vector.traverse f xs) = Vector.traverse ((fun {α} => η.app α) ∘ f) xs
⊢ (fun {α} => η.app α) (Vector.traverse f (x ::ᵥ xs)) = Vector.traverse ((fun {α} => η.app α) ∘ f) (x ::ᵥ xs)
state_after: case cons
n✝ : ℕ
F G : Type u → Type u
inst✝³ : Applicative F
inst✝² : Applicative G
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α✝ β✝ γ : Type u
η : ApplicativeTransformation F G
α β : Type u
f : α → F β
n : ℕ
x : α
xs : Vector α n
ih : (fun {α} => η.app α) (Vector.traverse f xs) = Vector.traverse ((fun {α} => η.app α) ∘ f) xs
⊢ (Seq.seq (cons <$> (fun {α} => η.app α) (f x)) fun x => (fun {α} => η.app α) (Vector.traverse f xs)) =
    Seq.seq (cons <$> ((fun {α} => η.app α) ∘ f) x) fun x => (fun {α} => η.app α) (Vector.traverse f xs)

tactic: rfl
state_before: case cons
n✝ : ℕ
F G : Type u → Type u
inst✝³ : Applicative F
inst✝² : Applicative G
inst✝¹ : LawfulApplicative F
inst✝ : LawfulApplicative G
α✝ β✝ γ : Type u
η : ApplicativeTransformation F G
α β : Type u
f : α → F β
n : ℕ
x : α
xs : Vector α n
ih : (fun {α} => η.app α) (Vector.traverse f xs) = Vector.traverse ((fun {α} => η.app α) ∘ f) xs
⊢ (Seq.seq (cons <$> (fun {α} => η.app α) (f x)) fun x => (fun {α} => η.app α) (Vector.traverse f xs)) =
    Seq.seq (cons <$> ((fun {α} => η.app α) ∘ f) x) fun x => (fun {α} => η.app α) (Vector.traverse f xs)
state_after: no goals