-- Mathlib/Data/Seq/Seq.lean
theorem map_join' (f : α → β) (S) : Seq.map f (Seq.join S) = Seq.join (Seq.map (map f) S)

Proof state:
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
x : Seq1 α
S : Seq (Seq1 α)
⊢ match (Seq.map f (Seq.cons x S).join).destruct, (Seq.cons (map f x) (Seq.map (map f) S)).join.destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧ ∃ s_1 S, s = s_1.append (Seq.map f S.join) ∧ s' = s_1.append (Seq.map (map f) S).join
  | x, x_1 => False

Tactic:
obtain ⟨a, s⟩ := x

Result:
case mk
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
S : Seq (Seq1 α)
a : α
s : Seq α
⊢ match (Seq.map f (Seq.cons (a, s) S).join).destruct, (Seq.cons (map f (a, s)) (Seq.map (map f) S)).join.destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧ ∃ s_1 S, s = s_1.append (Seq.map f S.join) ∧ s' = s_1.append (Seq.map (map f) S).join
  | x, x_1 => False

Proof state:
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
s : Seq β
S : Seq (Seq1 α)
⊢ BisimO (fun s1 s2 => ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join)
    (s.append (Seq.map f S.join)).destruct (s.append (Seq.map (map f) S).join).destruct

Tactic:
cases s <;> simp

Result:
case nil
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
S : Seq (Seq1 α)
⊢ match (Seq.map f S.join).destruct, (Seq.map (map f) S).join.destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧ ∃ s_1 S, s = s_1.append (Seq.map f S.join) ∧ s' = s_1.append (Seq.map (map f) S).join
  | x, x_1 => False

case cons
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
S : Seq (Seq1 α)
x✝ : β
s✝ : Seq β
⊢ ∃ s S_1,
    s✝.append (Seq.map f S.join) = s.append (Seq.map f S_1.join) ∧
      s✝.append (Seq.map (map f) S).join = s.append (Seq.map (map f) S_1).join

Proof state:
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
S : Seq (Seq1 α)
x✝ : β
s : Seq β
⊢ ∃ s_1 S_1,
    s.append (Seq.map f S.join) = s_1.append (Seq.map f S_1.join) ∧
      s.append (Seq.map (map f) S).join = s_1.append (Seq.map (map f) S_1).join

Tactic:
exact ⟨s, S, rfl, rfl⟩

Result:
no goals

Proof state:
case cons
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
S : Seq (Seq1 α)
x✝ : β
s✝ : Seq β
⊢ ∃ s S_1,
    s✝.append (Seq.map f S.join) = s.append (Seq.map f S_1.join) ∧
      s✝.append (Seq.map (map f) S).join = s.append (Seq.map (map f) S_1).join

Tactic:
case cons _ s => exact ⟨s, S, rfl, rfl⟩

Result:
no goals

Proof state:
case bisim
α : Type u
β : Type v
f : α → β
S : Seq (Seq1 α)
⊢ Seq.IsBisimulation fun s1 s2 => ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join

Tactic:
intro s1 s2 h

Result:
case bisim
α : Type u
β : Type v
f : α → β
S : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
⊢ BisimO (fun s1 s2 => ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join) s1.destruct
    s2.destruct

Proof state:
case cons
α : Type u
β : Type v
f : α → β
S : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
x✝ : Seq1 α
s✝ : Seq (Seq1 α)
⊢ match (Seq.map f (Seq.cons x✝ s✝).join).destruct, (Seq.cons (map f x✝) (Seq.map (map f) s✝)).join.destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧ ∃ s_1 S, s = s_1.append (Seq.map f S.join) ∧ s' = s_1.append (Seq.map (map f) S).join
  | x, x_1 => False

Tactic:
case cons x S =>
  obtain ⟨a, s⟩ := x
  simpa [map] using ⟨_, _, rfl, rfl⟩

Result:
no goals

Proof state:
α : Type u
β : Type v
f : α → β
S : Seq (Seq1 α)
⊢ Seq.map f S.join = (Seq.map (map f) S).join

Tactic:
apply
  Seq.eq_of_bisim fun s1 s2 =>
    ∃ s S,
      s1 = Seq.append s (Seq.map f (Seq.join S)) ∧ s2 = append s (Seq.join (Seq.map (map f) S))

Result:
case bisim
α : Type u
β : Type v
f : α → β
S : Seq (Seq1 α)
⊢ Seq.IsBisimulation fun s1 s2 => ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join

case r
α : Type u
β : Type v
f : α → β
S : Seq (Seq1 α)
⊢ ∃ s S_1,
    Seq.map f S.join = s.append (Seq.map f S_1.join) ∧ (Seq.map (map f) S).join = s.append (Seq.map (map f) S_1).join

Proof state:
case r
α : Type u
β : Type v
f : α → β
S : Seq (Seq1 α)
⊢ ∃ s S_1,
    Seq.map f S.join = s.append (Seq.map f S_1.join) ∧ (Seq.map (map f) S).join = s.append (Seq.map (map f) S_1).join

Tactic:
refine ⟨nil, S, ?_, ?_⟩ <;> simp

Result:
no goals

Proof state:
case nil
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
S : Seq (Seq1 α)
⊢ match (Seq.map f S.join).destruct, (Seq.map (map f) S).join.destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧ ∃ s_1 S, s = s_1.append (Seq.map f S.join) ∧ s' = s_1.append (Seq.map (map f) S).join
  | x, x_1 => False

case cons
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
S : Seq (Seq1 α)
x✝ : β
s✝ : Seq β
⊢ ∃ s S_1,
    s✝.append (Seq.map f S.join) = s.append (Seq.map f S_1.join) ∧
      s✝.append (Seq.map (map f) S).join = s.append (Seq.map (map f) S_1).join

Tactic:
case nil =>
  cases S <;> simp
  case cons x S =>
    obtain ⟨a, s⟩ := x
    simpa [map] using ⟨_, _, rfl, rfl⟩

Result:
case cons
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
S : Seq (Seq1 α)
x✝ : β
s✝ : Seq β
⊢ ∃ s S_1,
    s✝.append (Seq.map f S.join) = s.append (Seq.map f S_1.join) ∧
      s✝.append (Seq.map (map f) S).join = s.append (Seq.map (map f) S_1).join

Proof state:
case bisim
α : Type u
β : Type v
f : α → β
S : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
⊢ BisimO (fun s1 s2 => ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join) s1.destruct
    s2.destruct

Tactic:
exact
  match s1, s2, h with
  | _, _, ⟨s, S, rfl, rfl⟩ => by
    cases s <;> simp
    case nil =>
      cases S <;> simp
      case cons x S =>
        obtain ⟨a, s⟩ := x
        simpa [map] using ⟨_, _, rfl, rfl⟩
    case cons _ s => exact ⟨s, S, rfl, rfl⟩

Result:
no goals

Proof state:
case mk
α : Type u
β : Type v
f : α → β
S✝ : Seq (Seq1 α)
s1 s2 : Seq β
h : ∃ s S, s1 = s.append (Seq.map f S.join) ∧ s2 = s.append (Seq.map (map f) S).join
S : Seq (Seq1 α)
a : α
s : Seq α
⊢ match (Seq.map f (Seq.cons (a, s) S).join).destruct, (Seq.cons (map f (a, s)) (Seq.map (map f) S)).join.destruct with
  | none, none => True
  | some (a, s), some (a', s') =>
    a = a' ∧ ∃ s_1 S, s = s_1.append (Seq.map f S.join) ∧ s' = s_1.append (Seq.map (map f) S).join
  | x, x_1 => False

Tactic:
simpa [map] using ⟨_, _, rfl, rfl⟩

Result:
no goals