Theorem: Stream'.Seq.map_append
File: Mathlib/Data/Seq/Seq.lean

tactic: apply
  eq_of_bisim (fun s1 s2 => ∃ s t, s1 = map f (append s t) ∧ s2 = append (map f s) (map f t)) _
    ⟨s, t, rfl, rfl⟩
state_before: α : Type u
β : Type v
γ : Type w
f : α → β
s t : Seq α
⊢ map f (s.append t) = (map f s).append (map f t)
state_after: α : Type u
β : Type v
γ : Type w
f : α → β
s t : Seq α
⊢ IsBisimulation fun s1 s2 => ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)

tactic: intro s1 s2 h
state_before: α : Type u
β : Type v
γ : Type w
f : α → β
s t : Seq α
⊢ IsBisimulation fun s1 s2 => ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
state_after: α : Type u
β : Type v
γ : Type w
f : α → β
s t : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
⊢ BisimO (fun s1 s2 => ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)) s1.destruct s2.destruct

tactic: apply recOn s <;> simp
state_before: α : Type u
β : Type v
γ : Type w
f : α → β
s✝ t✝ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s t : Seq α
⊢ BisimO (fun s1 s2 => ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)) (map f (s.append t)).destruct
    ((map f s).append (map f t)).destruct
state_after: case h1
α : Type u
β : Type v
γ : Type w
f : α → β
s✝ t✝ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s t : Seq α
⊢ match (map f t).destruct, (map f t).destruct with
  | none, none => True
  | some (a, s), some (a', s') => a = a' ∧ ∃ s_1 t, s = map f (s_1.append t) ∧ s' = (map f s_1).append (map f t)
  | x, x_1 => False

case h2
α : Type u
β : Type v
γ : Type w
f : α → β
s✝ t✝ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s t : Seq α
⊢ α →
    ∀ (s : Seq α),
      ∃ s_1 t_1,
        map f (s.append t) = map f (s_1.append t_1) ∧ (map f s).append (map f t) = (map f s_1).append (map f t_1)

tactic: apply recOn t <;> simp
state_before: case h1
α : Type u
β : Type v
γ : Type w
f : α → β
s✝ t✝ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s t : Seq α
⊢ match (map f t).destruct, (map f t).destruct with
  | none, none => True
  | some (a, s), some (a', s') => a = a' ∧ ∃ s_1 t, s = map f (s_1.append t) ∧ s' = (map f s_1).append (map f t)
  | x, x_1 => False
state_after: case h1.h2
α : Type u
β : Type v
γ : Type w
f : α → β
s✝ t✝ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s t : Seq α
⊢ α → ∀ (s : Seq α), ∃ s_1 t, map f s = map f (s_1.append t) ∧ map f s = (map f s_1).append (map f t)

tactic: intro _ t
state_before: case h1.h2
α : Type u
β : Type v
γ : Type w
f : α → β
s✝ t✝ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s t : Seq α
⊢ α → ∀ (s : Seq α), ∃ s_1 t, map f s = map f (s_1.append t) ∧ map f s = (map f s_1).append (map f t)
state_after: case h1.h2
α : Type u
β : Type v
γ : Type w
f : α → β
s✝ t✝¹ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s t✝ : Seq α
x✝ : α
t : Seq α
⊢ ∃ s t_1, map f t = map f (s.append t_1) ∧ map f t = (map f s).append (map f t_1)

tactic: refine ⟨nil, t, ?_, ?_⟩ <;> simp
state_before: case h1.h2
α : Type u
β : Type v
γ : Type w
f : α → β
s✝ t✝¹ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s t✝ : Seq α
x✝ : α
t : Seq α
⊢ ∃ s t_1, map f t = map f (s.append t_1) ∧ map f t = (map f s).append (map f t_1)
state_after: no goals

tactic: intro _ s
state_before: case h2
α : Type u
β : Type v
γ : Type w
f : α → β
s✝ t✝ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s t : Seq α
⊢ α →
    ∀ (s : Seq α),
      ∃ s_1 t_1,
        map f (s.append t) = map f (s_1.append t_1) ∧ (map f s).append (map f t) = (map f s_1).append (map f t_1)
state_after: case h2
α : Type u
β : Type v
γ : Type w
f : α → β
s✝¹ t✝ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s✝ t : Seq α
x✝ : α
s : Seq α
⊢ ∃ s_1 t_1, map f (s.append t) = map f (s_1.append t_1) ∧ (map f s).append (map f t) = (map f s_1).append (map f t_1)

tactic: exact ⟨s, t, rfl, rfl⟩
state_before: case h2
α : Type u
β : Type v
γ : Type w
f : α → β
s✝¹ t✝ : Seq α
s1 s2 : Seq β
h : ∃ s t, s1 = map f (s.append t) ∧ s2 = (map f s).append (map f t)
s✝ t : Seq α
x✝ : α
s : Seq α
⊢ ∃ s_1 t_1, map f (s.append t) = map f (s_1.append t_1) ∧ (map f s).append (map f t) = (map f s_1).append (map f t_1)
state_after: no goals