Theorem: Stream'.Seq1.bind_assoc
File: Mathlib/Data/Seq/Seq.lean

Proof steps:
state_before: α : Type u
β : Type v
γ : Type w
s : Seq1 α
f : α → Seq1 β
g : β → Seq1 γ
⊢ (s.bind f).bind g = s.bind fun x => (f x).bind g
state_after: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
⊢ (bind (a, s) f).bind g = bind (a, s) fun x => (f x).bind g
tactic: cases' s with a s
state_before: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
⊢ (bind (a, s) f).bind g = bind (a, s) fun x => (f x).bind g
state_after: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
⊢ (join (map g (f a), Seq.map (map g) (Seq.map f s))).join =
    join ((map g (f a)).join, Seq.map (fun x => (map g (f x)).join) s)
tactic: simp only [bind, map_pair, map_join]
state_before: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
⊢ (join (map g (f a), Seq.map (map g) (Seq.map f s))).join =
    join ((map g (f a)).join, Seq.map (fun x => (map g (f x)).join) s)
state_after: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
⊢ (join (map g (f a), Seq.map (map g ∘ f) s)).join = join ((map g (f a)).join, Seq.map (fun x => (map g (f x)).join) s)
tactic: rw [← map_comp]
state_before: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
⊢ (join (map g (f a), Seq.map (map g ∘ f) s)).join = join ((map g (f a)).join, Seq.map (fun x => (map g (f x)).join) s)
state_after: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
⊢ (join (map g (f a), Seq.map (map g ∘ f) s)).join = join ((map g (f a)).join, Seq.map (join ∘ map g ∘ f) s)
tactic: simp only [show (fun x => join (map g (f x))) = join ∘ (map g ∘ f) from rfl]
state_before: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
⊢ (join (map g (f a), Seq.map (map g ∘ f) s)).join = join ((map g (f a)).join, Seq.map (join ∘ map g ∘ f) s)
state_after: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
⊢ (join (map g (f a), Seq.map (map g ∘ f) s)).join = join ((map g (f a)).join, Seq.map join (Seq.map (map g ∘ f) s))
tactic: rw [map_comp _ join]
state_before: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
⊢ (join (map g (f a), Seq.map (map g ∘ f) s)).join = join ((map g (f a)).join, Seq.map join (Seq.map (map g ∘ f) s))
state_after: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
SS : Seq (Seq1 (Seq1 γ))
⊢ (join (map g (f a), SS)).join = join ((map g (f a)).join, Seq.map join SS)
tactic: generalize Seq.map (map g ∘ f) s = SS
state_before: case mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a : α
s : Seq α
SS : Seq (Seq1 (Seq1 γ))
⊢ (join (map g (f a), SS)).join = join ((map g (f a)).join, Seq.map join SS)
state_after: case mk.mk.mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a✝ : α
s✝ : Seq α
SS : Seq (Seq1 (Seq1 γ))
S : Seq (Seq1 γ)
a : γ
s : Seq γ
⊢ (join (((a, s), S), SS)).join = join (join ((a, s), S), Seq.map join SS)
tactic: rcases map g (f a) with ⟨⟨a, s⟩, S⟩
state_before: case mk.mk.mk
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a✝ : α
s✝ : Seq α
SS : Seq (Seq1 (Seq1 γ))
S : Seq (Seq1 γ)
a : γ
s : Seq γ
⊢ (join (((a, s), S), SS)).join = join (join ((a, s), S), Seq.map join SS)
state_after: case mk.mk.mk.h1.h2
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a✝ : α
s : Seq α
SS : Seq (Seq1 (Seq1 γ))
a : γ
x_1 : Seq1 γ
s_2 : Seq (Seq1 γ)
⊢ (a, (Seq.cons x_1 (s_2.append SS.join)).join) = join ((a, (Seq.cons x_1 s_2).join), Seq.map join SS)

case mk.mk.mk.h2.h2
α : Type u
β : Type v
γ : Type w
f : α → Seq1 β
g : β → Seq1 γ
a✝ : α
s : Seq α
SS : Seq (Seq1 (Seq1 γ))
a x : γ
s_1 : Seq γ
x_1 : Seq1 γ
s_2 : Seq (Seq1 γ)
⊢ (a, Seq.cons x (s_1.append (Seq.cons x_1 (s_2.append SS.join)).join)) =
    (a, Seq.cons x (s_1.append ((Seq.cons x_1 s_2).join.append (Seq.map join SS).join)))
tactic: induction' s using recOn with x s_1 <;> induction' S using recOn with x_1 s_2 <;> simp