Theorem: Stream'.WSeq.destruct_ofSeq
File: Mathlib/Data/Seq/WSeq.lean

tactic: simp only [destruct, Seq.destruct, Option.map_eq_map, ofSeq, Computation.corec_eq, rmap,
  Seq.head]
state_before: α : Type u
β : Type v
γ : Type w
s : Seq α
⊢ (↑s).destruct.destruct = Sum.inl (Option.map (fun a => (a, ↑s.tail)) s.head)
state_after: α : Type u
β : Type v
γ : Type w
s : Seq α
⊢ (match
      match Option.map (fun a' => (a', (some <$> s).tail)) ((some <$> s).get? 0) with
      | none => Sum.inl none
      | some (none, s') => Sum.inr s'
      | some (some a, s') => Sum.inl (some (a, s')) with
    | Sum.inl a => Sum.inl a
    | Sum.inr b =>
      Sum.inr
        (Computation.corec
          (fun s =>
            match Option.map (fun a' => (a', Seq.tail s)) (Seq.get? s 0) with
            | none => Sum.inl none
            | some (none, s') => Sum.inr s'
            | some (some a, s') => Sum.inl (some (a, s')))
          b)) =
    Sum.inl (Option.map (fun a => (a, some <$> s.tail)) (s.get? 0))

tactic: rw [show Seq.get? (some <$> s) 0 = some <$> Seq.get? s 0 by apply Seq.map_get?]
state_before: α : Type u
β : Type v
γ : Type w
s : Seq α
⊢ (match
      match Option.map (fun a' => (a', (some <$> s).tail)) ((some <$> s).get? 0) with
      | none => Sum.inl none
      | some (none, s') => Sum.inr s'
      | some (some a, s') => Sum.inl (some (a, s')) with
    | Sum.inl a => Sum.inl a
    | Sum.inr b =>
      Sum.inr
        (Computation.corec
          (fun s =>
            match Option.map (fun a' => (a', Seq.tail s)) (Seq.get? s 0) with
            | none => Sum.inl none
            | some (none, s') => Sum.inr s'
            | some (some a, s') => Sum.inl (some (a, s')))
          b)) =
    Sum.inl (Option.map (fun a => (a, some <$> s.tail)) (s.get? 0))
state_after: α : Type u
β : Type v
γ : Type w
s : Seq α
⊢ (match
      match Option.map (fun a' => (a', (some <$> s).tail)) (some <$> s.get? 0) with
      | none => Sum.inl none
      | some (none, s') => Sum.inr s'
      | some (some a, s') => Sum.inl (some (a, s')) with
    | Sum.inl a => Sum.inl a
    | Sum.inr b =>
      Sum.inr
        (Computation.corec
          (fun s =>
            match Option.map (fun a' => (a', Seq.tail s)) (Seq.get? s 0) with
            | none => Sum.inl none
            | some (none, s') => Sum.inr s'
            | some (some a, s') => Sum.inl (some (a, s')))
          b)) =
    Sum.inl (Option.map (fun a => (a, some <$> s.tail)) (s.get? 0))

tactic: cases' Seq.get? s 0 with a
state_before: α : Type u
β : Type v
γ : Type w
s : Seq α
⊢ (match
      match Option.map (fun a' => (a', (some <$> s).tail)) (some <$> s.get? 0) with
      | none => Sum.inl none
      | some (none, s') => Sum.inr s'
      | some (some a, s') => Sum.inl (some (a, s')) with
    | Sum.inl a => Sum.inl a
    | Sum.inr b =>
      Sum.inr
        (Computation.corec
          (fun s =>
            match Option.map (fun a' => (a', Seq.tail s)) (Seq.get? s 0) with
            | none => Sum.inl none
            | some (none, s') => Sum.inr s'
            | some (some a, s') => Sum.inl (some (a, s')))
          b)) =
    Sum.inl (Option.map (fun a => (a, some <$> s.tail)) (s.get? 0))
state_after: case none
α : Type u
β : Type v
γ : Type w
s : Seq α
⊢ (match
      match Option.map (fun a' => (a', (some <$> s).tail)) (some <$> none) with
      | none => Sum.inl none
      | some (none, s') => Sum.inr s'
      | some (some a, s') => Sum.inl (some (a, s')) with
    | Sum.inl a => Sum.inl a
    | Sum.inr b =>
      Sum.inr
        (Computation.corec
          (fun s =>
            match Option.map (fun a' => (a', Seq.tail s)) (Seq.get? s 0) with
            | none => Sum.inl none
            | some (none, s') => Sum.inr s'
            | some (some a, s') => Sum.inl (some (a, s')))
          b)) =
    Sum.inl (Option.map (fun a => (a, some <$> s.tail)) none)

case some
α : Type u
β : Type v
γ : Type w
s : Seq α
a : α
⊢ (match
      match Option.map (fun a' => (a', (some <$> s).tail)) (some <$> some a) with
      | none => Sum.inl none
      | some (none, s') => Sum.inr s'
      | some (some a, s') => Sum.inl (some (a, s')) with
    | Sum.inl a => Sum.inl a
    | Sum.inr b =>
      Sum.inr
        (Computation.corec
          (fun s =>
            match Option.map (fun a' => (a', Seq.tail s)) (Seq.get? s 0) with
            | none => Sum.inl none
            | some (none, s') => Sum.inr s'
            | some (some a, s') => Sum.inl (some (a, s')))
          b)) =
    Sum.inl (Option.map (fun a => (a, some <$> s.tail)) (some a))

tactic: simp [destruct]
state_before: case some
α : Type u
β : Type v
γ : Type w
s : Seq α
a : α
⊢ (match
      match Option.map (fun a' => (a', (Seq.map some s).tail)) (Option.map some (some a)) with
      | none => Sum.inl none
      | some (none, s') => Sum.inr s'
      | some (some a, s') => Sum.inl (some (a, s')) with
    | Sum.inl a => Sum.inl a
    | Sum.inr b =>
      Sum.inr
        (Computation.corec
          (fun s =>
            match Option.map (fun a' => (a', Seq.tail s)) (Seq.get? s 0) with
            | none => Sum.inl none
            | some (none, s') => Sum.inr s'
            | some (some a, s') => Sum.inl (some (a, s')))
          b)) =
    Sum.inl (Option.map (fun a => (a, Seq.map some s.tail)) (some a))
state_after: no goals

tactic: apply Seq.map_get?
state_before: α : Type u
β : Type v
γ : Type w
s : Seq α
⊢ (some <$> s).get? 0 = some <$> s.get? 0
state_after: no goals

tactic: rfl
state_before: case none
α : Type u
β : Type v
γ : Type w
s : Seq α
⊢ (match
      match Option.map (fun a' => (a', (some <$> s).tail)) (some <$> none) with
      | none => Sum.inl none
      | some (none, s') => Sum.inr s'
      | some (some a, s') => Sum.inl (some (a, s')) with
    | Sum.inl a => Sum.inl a
    | Sum.inr b =>
      Sum.inr
        (Computation.corec
          (fun s =>
            match Option.map (fun a' => (a', Seq.tail s)) (Seq.get? s 0) with
            | none => Sum.inl none
            | some (none, s') => Sum.inr s'
            | some (some a, s') => Sum.inl (some (a, s')))
          b)) =
    Sum.inl (Option.map (fun a => (a, some <$> s.tail)) none)
state_after: no goals