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

tactic: simp only [LiftRelO, drop, Nat.add_eq, add_zero, destruct_tail, tail.aux]
state_before: α : Type u
β : Type v
γ : Type w
R : α → β → Prop
s : WSeq α
t : WSeq β
H : LiftRel R s t
n : ℕ
⊢ Computation.LiftRel (LiftRelO R (LiftRel R)) (destruct (drop s (n + 1))) (destruct (drop t (n + 1)))

tactic: apply liftRel_bind
state_before: α : Type u
β : Type v
γ : Type w
R : α → β → Prop
s : WSeq α
t : WSeq β
H : LiftRel R s t
n : ℕ
⊢ Computation.LiftRel
    (fun x x_1 =>
      match x, x_1 with
      | none, none => True
      | some (a, s), some (b, t) => R a b ∧ LiftRel R s t
      | x, x_2 => False)
    (do
      let x ← destruct (drop s n)
      match x with
        | none => Computation.pure none
        | some (fst, s) => destruct s)
    do
    let x ← destruct (drop t n)
    match x with
      | none => Computation.pure none
      | some (fst, s) => destruct s

tactic: apply liftRel_dropn_destruct H n
state_before: case h1
α : Type u
β : Type v
γ : Type w
R : α → β → Prop
s : WSeq α
t : WSeq β
H : LiftRel R s t
n : ℕ
⊢ Computation.LiftRel ?R (destruct (drop s n)) (destruct (drop t n))

case h2
α : Type u
β : Type v
γ : Type w
R : α → β → Prop
s : WSeq α
t : WSeq β
H : LiftRel R s t
n : ℕ
⊢ ∀ {a : Option (α × WSeq α)} {b : Option (β × WSeq β)},
    ?R a b →
      Computation.LiftRel
        (fun x x_1 =>
          match x, x_1 with
          | none, none => True
          | some (a, s), some (b, t) => R a b ∧ LiftRel R s t
          | x, x_2 => False)
        (match a with
        | none => Computation.pure none
        | some (fst, s) => destruct s)
        (match b with
        | none => Computation.pure none
        | some (fst, s) => destruct s)

case R
α : Type u
β : Type v
γ : Type w
R : α → β → Prop
s : WSeq α
t : WSeq β
H : LiftRel R s t
n : ℕ
⊢ Option (α × WSeq α) → Option (β × WSeq β) → Prop

tactic: exact fun {a b} o =>
  match a, b, o with
  | none, none, _ => by
    simp [-liftRel_pure_left, -liftRel_pure_right]
  | some (a, s), some (b, t), ⟨_, h2⟩ => by simp [tail.aux]; apply liftRel_destruct h2
state_before: case h2
α : Type u
β : Type v
γ : Type w
R : α → β → Prop
s : WSeq α
t : WSeq β
H : LiftRel R s t
n : ℕ
⊢ ∀ {a : Option (α × WSeq α)} {b : Option (β × WSeq β)},
    LiftRelO R (LiftRel R) a b →
      Computation.LiftRel
        (fun x x_1 =>
          match x, x_1 with
          | none, none => True
          | some (a, s), some (b, t) => R a b ∧ LiftRel R s t
          | x, x_2 => False)
        (match a with
        | none => Computation.pure none
        | some (fst, s) => destruct s)
        (match b with
        | none => Computation.pure none
        | some (fst, s) => destruct s)

tactic: simp [-liftRel_pure_left, -liftRel_pure_right]
state_before: α : Type u
β : Type v
γ : Type w
R : α → β → Prop
s : WSeq α
t : WSeq β
H : LiftRel R s t
n : ℕ
a : Option (α × WSeq α)
b : Option (β × WSeq β)
o : LiftRelO R (LiftRel R) a b
x✝ : LiftRelO R (LiftRel R) none none
⊢ Computation.LiftRel
    (fun x x_1 =>
      match x, x_1 with
      | none, none => True
      | some (a, s), some (b, t) => R a b ∧ LiftRel R s t
      | x, x_2 => False)
    (match none with
    | none => Computation.pure none
    | some (fst, s) => destruct s)
    (match none with
    | none => Computation.pure none
    | some (fst, s) => destruct s)

tactic: simp [tail.aux]
state_before: α : Type u
β : Type v
γ : Type w
R : α → β → Prop
s✝ : WSeq α
t✝ : WSeq β
H : LiftRel R s✝ t✝
n : ℕ
a✝ : Option (α × WSeq α)
b✝ : Option (β × WSeq β)
o : LiftRelO R (LiftRel R) a✝ b✝
a : α
s : WSeq α
b : β
t : WSeq β
left✝ : R a b
h2 : LiftRel R s t
⊢ Computation.LiftRel
    (fun x x_1 =>
      match x, x_1 with
      | none, none => True
      | some (a, s), some (b, t) => R a b ∧ LiftRel R s t
      | x, x_2 => False)
    (match some (a, s) with
    | none => Computation.pure none
    | some (fst, s) => destruct s)
    (match some (b, t) with
    | none => Computation.pure none
    | some (fst, s) => destruct s)

tactic: apply liftRel_destruct h2
state_before: α : Type u
β : Type v
γ : Type w
R : α → β → Prop
s✝ : WSeq α
t✝ : WSeq β
H : LiftRel R s✝ t✝
n : ℕ
a✝ : Option (α × WSeq α)
b✝ : Option (β × WSeq β)
o : LiftRelO R (LiftRel R) a✝ b✝
a : α
s : WSeq α
b : β
t : WSeq β
left✝ : R a b
h2 : LiftRel R s t
⊢ Computation.LiftRel
    (fun x x_1 =>
      match x, x_1 with
      | none, none => True
      | some (a, s), some (b, t) => R a b ∧ LiftRel R s t
      | x, x_2 => False)
    (destruct s) (destruct t)