Theorem: KVChain.rklex_mergeWith_right (Algdata/Data/KVChain/MergeWith.lean)

State before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs ys zs : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
x✝¹ x✝ : KVChain r fun a => β a
⊢ KVChain.rklex s x✝¹ x✝ →
    KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) x✝¹ KVChain.nil)
      (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) x✝ KVChain.nil)
Tactic:
rw [mergeWith_nil]
State after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs ys zs : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
x✝¹ x✝ : KVChain r fun a => β a
⊢ KVChain.rklex s x✝¹ x✝ → KVChain.rklex s x✝¹ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) x✝ KVChain.nil)

State before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs ys zs : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
x✝¹ x✝ : KVChain r fun a => β a
⊢ KVChain.rklex s x✝¹ x✝ → KVChain.rklex s x✝¹ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) x✝ KVChain.nil)
Tactic:
exact id
State after:
no goals

State before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) KVChain.nil (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
have h_ind_zs := h_ind_zs KVChain.nil
State after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) KVChain.nil zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) KVChain.nil (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) KVChain.nil zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) KVChain.nil (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
dsimp at *
State after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) KVChain.nil zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) KVChain.nil (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) KVChain.nil zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) KVChain.nil (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [nil_mergeWith] at *
State after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
apply dite (r a z₁) <;> intro haz₁
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : r a z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : r a z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
. rw [cons_mergeWith_cons_rel haz₁]
  exact KVChain.rklex.headFst haz₁
State after:
case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
apply dite (r z₁ a) <;> intro hz₁a
State after:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
. rw [cons_mergeWith_cons_flip hz₁a]
  exact KVChain.rklex.tail (h_ind_zs _ KVChain.rklex.nil)
State after:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
have : a = z₁ := Trichotomous.eq_of_incomp ⟨haz₁, hz₁a⟩
State after:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
this : a = z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
this : a = z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
cases this
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
ys : KVChain r fun a => β a
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
b : β z₁
hays : boundLeft z₁ ys
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
ys : KVChain r fun a => β a
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
b : β z₁
hays : boundLeft z₁ ys
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rfl]
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
ys : KVChain r fun a => β a
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
b : β z₁
hays : boundLeft z₁ ys
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (Option.casesOn (some (f z₁ b z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
ys : KVChain r fun a => β a
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
b : β z₁
hays : boundLeft z₁ ys
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (Option.casesOn (some (f z₁ b z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))
Tactic:
exact KVChain.rklex.headSnd $ hsf_right _ _ _
State after:
no goals

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : r a z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rel haz₁]
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : r a z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (KVChain.cons a b (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : r a z₁
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (KVChain.cons a b (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
exact KVChain.rklex.headFst haz₁
State after:
no goals

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_flip hz₁a]
State after:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) zs)))

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs✝ :
  ∀ (xs ys : KVChain r fun a => β a),
    KVChain.rklex s xs ys →
      KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
xs ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs ys✝
a : α
b : β a
ys : KVChain r fun a => β a
hays : boundLeft a ys
h_ind_zs :
  ∀ (ys : KVChain r fun a => β a),
    KVChain.rklex s KVChain.nil ys → KVChain.rklex s zs (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (KVChain.cons z₁ z₂ zs hzs)
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) zs)))
Tactic:
exact KVChain.rklex.tail (h_ind_zs _ KVChain.rklex.nil)
State after:
no goals

State before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
apply dite (r z₁ a₂) <;> intro hz₁a₂
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
. rw [cons_mergeWith_cons_flip hz₁a₂]
  rw [cons_mergeWith_cons_flip (trans hz₁a₂ ha₂a₁)]
  apply KVChain.rklex.tail
  exact h_ind_zs _ _ (KVChain.rklex.headFst ha₂a₁)
State after:
case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
apply dite (r a₂ z₁) <;> intro ha₂z₁
State after:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : ¬r a₂ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : ¬r a₂ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
. rw [cons_mergeWith_cons_rel ha₂z₁]
  apply dite (r z₁ a₁) <;> intro hz₁a₁
  . rw [cons_mergeWith_cons_flip hz₁a₁]
    exact KVChain.rklex.headFst ha₂z₁
  apply dite (r a₁ z₁) <;> intro ha₁z₁
  . rw [cons_mergeWith_cons_rel ha₁z₁]
    exact KVChain.rklex.headFst ha₂a₁
  have : z₁ = a₁ := Trichotomous.eq_of_incomp ⟨hz₁a₁, ha₁z₁⟩
  cases this
  rw [cons_mergeWith_cons_rfl]
  exact KVChain.rklex.headFst ha₂a₁
State after:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : ¬r a₂ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : ¬r a₂ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
have : z₁ = a₂ := Trichotomous.eq_of_incomp ⟨hz₁a₂, ha₂z₁⟩
State after:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : ¬r a₂ z₁
this : z₁ = a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : ¬r a₂ z₁
this : z₁ = a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
cases this
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ : α
b₁ : β a₁
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
b₂ : β z₁
hays : boundLeft z₁ ys
ha₂a₁ : r z₁ a₁
hz₁a₂ ha₂z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ : α
b₁ : β a₁
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
b₂ : β z₁
hays : boundLeft z₁ ys
ha₂a₁ : r z₁ a₁
hz₁a₂ ha₂z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rfl]
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ : α
b₁ : β a₁
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
b₂ : β z₁
hays : boundLeft z₁ ys
ha₂a₁ : r z₁ a₁
hz₁a₂ ha₂z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (Option.casesOn (some (f z₁ b₂ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ : α
b₁ : β a₁
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
b₂ : β z₁
hays : boundLeft z₁ ys
ha₂a₁ : r z₁ a₁
hz₁a₂ ha₂z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (Option.casesOn (some (f z₁ b₂ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))
Tactic:
rw [cons_mergeWith_cons_flip ha₂a₁]
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ : α
b₁ : β a₁
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
b₂ : β z₁
hays : boundLeft z₁ ys
ha₂a₁ : r z₁ a₁
hz₁a₂ ha₂z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)))
    (Option.casesOn (some (f z₁ b₂ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ : α
b₁ : β a₁
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
b₂ : β z₁
hays : boundLeft z₁ ys
ha₂a₁ : r z₁ a₁
hz₁a₂ ha₂z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)))
    (Option.casesOn (some (f z₁ b₂ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))
Tactic:
dsimp
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ : α
b₁ : β a₁
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
b₂ : β z₁
hays : boundLeft z₁ ys
ha₂a₁ : r z₁ a₁
hz₁a₂ ha₂z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)))
    (KVChain.cons z₁ (f z₁ b₂ z₂) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ : α
b₁ : β a₁
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
b₂ : β z₁
hays : boundLeft z₁ ys
ha₂a₁ : r z₁ a₁
hz₁a₂ ha₂z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)))
    (KVChain.cons z₁ (f z₁ b₂ z₂) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))
Tactic:
exact KVChain.rklex.headSnd $ hsf_right _ _ _
State after:
no goals

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_flip hz₁a₂]
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) zs)))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) zs)))
Tactic:
rw [cons_mergeWith_cons_flip (trans hz₁a₂ ha₂a₁)]
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : r z₁ a₂
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)))
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) zs)))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : r z₁ a₂
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)))
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) zs)))
Tactic:
apply KVChain.rklex.tail
State after:
case t.a
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) zs)

State before:
case t.a
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : r z₁ a₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) zs)
Tactic:
exact h_ind_zs _ _ (KVChain.rklex.headFst ha₂a₁)
State after:
no goals

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₂ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rel ha₂z₁]
State after:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
apply dite (r z₁ a₁) <;> intro hz₁a₁
State after:
case e.t.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : r z₁ a₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

case e.t.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case e.t.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : r z₁ a₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

case e.t.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
. rw [cons_mergeWith_cons_flip hz₁a₁]
  exact KVChain.rklex.headFst ha₂z₁
State after:
case e.t.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case e.t.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
apply dite (r a₁ z₁) <;> intro ha₁z₁
State after:
case e.t.e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : r a₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

case e.t.e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : ¬r a₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case e.t.e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : r a₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

case e.t.e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : ¬r a₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
. rw [cons_mergeWith_cons_rel ha₁z₁]
  exact KVChain.rklex.headFst ha₂a₁
State after:
case e.t.e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : ¬r a₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case e.t.e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : ¬r a₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
have : z₁ = a₁ := Trichotomous.eq_of_incomp ⟨hz₁a₁, ha₁z₁⟩
State after:
case e.t.e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : ¬r a₁ z₁
this : z₁ = a₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case e.t.e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : ¬r a₁ z₁
this : z₁ = a₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
cases this
State after:
case e.t.e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₂ : α
b₂ : β a₂
xs ys : KVChain r fun a => β a
hays : boundLeft a₂ ys
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
b₁ : β z₁
haxs : boundLeft z₁ xs
ha₂a₁ : r a₂ z₁
hz₁a₁ ha₁z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case e.t.e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₂ : α
b₂ : β a₂
xs ys : KVChain r fun a => β a
hays : boundLeft a₂ ys
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
b₁ : β z₁
haxs : boundLeft z₁ xs
ha₂a₁ : r a₂ z₁
hz₁a₁ ha₁z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
rw [cons_mergeWith_cons_rfl]
State after:
case e.t.e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₂ : α
b₂ : β a₂
xs ys : KVChain r fun a => β a
hays : boundLeft a₂ ys
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
b₁ : β z₁
haxs : boundLeft z₁ xs
ha₂a₁ : r a₂ z₁
hz₁a₁ ha₁z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s
    (Option.casesOn (some (f z₁ b₁ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case e.t.e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₂ : α
b₂ : β a₂
xs ys : KVChain r fun a => β a
hays : boundLeft a₂ ys
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
b₁ : β z₁
haxs : boundLeft z₁ xs
ha₂a₁ : r a₂ z₁
hz₁a₁ ha₁z₁ : ¬r z₁ z₁
⊢ KVChain.rklex s
    (Option.casesOn (some (f z₁ b₁ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
exact KVChain.rklex.headFst ha₂a₁
State after:
no goals

State before:
case e.t.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : r z₁ a₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
rw [cons_mergeWith_cons_flip hz₁a₁]
State after:
case e.t.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : r z₁ a₁
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case e.t.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : r z₁ a₁
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) zs)))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
exact KVChain.rklex.headFst ha₂z₁
State after:
no goals

State before:
case e.t.e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : r a₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
rw [cons_mergeWith_cons_rel ha₁z₁]
State after:
case e.t.e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : r a₁ z₁
⊢ KVChain.rklex s
    (KVChain.cons a₁ b₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case e.t.e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a₁ a₂ : α
b₁ : β a₁
b₂ : β a₂
xs ys : KVChain r fun a => β a
haxs : boundLeft a₁ xs
hays : boundLeft a₂ ys
ha₂a₁ : r a₂ a₁
hz₁a₂ : ¬r z₁ a₂
ha₂z₁ : r a₂ z₁
hz₁a₁ : ¬r z₁ a₁
ha₁z₁ : r a₁ z₁
⊢ KVChain.rklex s
    (KVChain.cons a₁ b₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))))
    (KVChain.cons a₂ b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
exact KVChain.rklex.headFst ha₂a₁
State after:
no goals

State before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
apply dite (r a z₁) <;> intro haz₁
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
. rw [cons_mergeWith_cons_rel haz₁]
  rw [cons_mergeWith_cons_rel haz₁]
  exact KVChain.rklex.headSnd hb₁b₂
State after:
case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
apply dite (r z₁ a) <;> intro hz₁a
State after:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
. rw [cons_mergeWith_cons_flip hz₁a]
  rw [cons_mergeWith_cons_flip hz₁a]
  apply KVChain.rklex.tail (h_ind_zs _ _ $ KVChain.rklex.headSnd hb₁b₂)
State after:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
have : a = z₁ := Trichotomous.eq_of_incomp ⟨haz₁, hz₁a⟩
State after:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
this : a = z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
this : a = z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
cases this
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
b₁ b₂ : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
hb₁b₂ : s z₁ b₁ b₂
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
b₁ b₂ : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
hb₁b₂ : s z₁ b₁ b₂
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rfl]
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
b₁ b₂ : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
hb₁b₂ : s z₁ b₁ b₂
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s
    (Option.casesOn (some (f z₁ b₁ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
b₁ b₂ : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
hb₁b₂ : s z₁ b₁ b₂
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s
    (Option.casesOn (some (f z₁ b₁ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rfl]
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
b₁ b₂ : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
hb₁b₂ : s z₁ b₁ b₂
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s
    (Option.casesOn (some (f z₁ b₁ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (Option.casesOn (some (f z₁ b₂ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
b₁ b₂ : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
hb₁b₂ : s z₁ b₁ b₂
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s
    (Option.casesOn (some (f z₁ b₁ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (Option.casesOn (some (f z₁ b₂ z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))
Tactic:
dsimp
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
b₁ b₂ : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
hb₁b₂ : s z₁ b₁ b₂
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s
    (KVChain.cons z₁ (f z₁ b₁ z₂) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (KVChain.cons z₁ (f z₁ b₂ z₂) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
b₁ b₂ : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
hb₁b₂ : s z₁ b₁ b₂
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s
    (KVChain.cons z₁ (f z₁ b₁ z₂) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (KVChain.cons z₁ (f z₁ b₂ z₂) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))
Tactic:
exact KVChain.rklex.headSnd $ hsf_stab _ _ _ _ hb₁b₂
State after:
no goals

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rel haz₁]
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : r a z₁
⊢ KVChain.rklex s
    (KVChain.cons a b₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : r a z₁
⊢ KVChain.rklex s
    (KVChain.cons a b₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rel haz₁]
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : r a z₁
⊢ KVChain.rklex s
    (KVChain.cons a b₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))))
    (KVChain.cons a b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : r a z₁
⊢ KVChain.rklex s
    (KVChain.cons a b₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))))
    (KVChain.cons a b₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
exact KVChain.rklex.headSnd hb₁b₂
State after:
no goals

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_flip hz₁a]
State after:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) zs)))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) zs)))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_flip hz₁a]
State after:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) zs)))
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) zs)))

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b₁ b₂ : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
hb₁b₂ : s a b₁ b₂
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₁ xs haxs) zs)))
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b₂ ys hays) zs)))
Tactic:
apply KVChain.rklex.tail (h_ind_zs _ _ $ KVChain.rklex.headSnd hb₁b₂)
State after:
no goals

State before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
apply dite (r a z₁) <;> intro haz₁
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
. rw [cons_mergeWith_cons_rel haz₁]
  rw [cons_mergeWith_cons_rel haz₁]
  exact KVChain.rklex.tail h_ind
State after:
case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
apply dite (r z₁ a) <;> intro hz₁a
State after:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
. rw [cons_mergeWith_cons_flip hz₁a]
  rw [cons_mergeWith_cons_flip hz₁a]
  exact KVChain.rklex.tail (h_ind_zs _ _ $ KVChain.rklex.tail htail)
State after:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
have : a = z₁ := Trichotomous.eq_of_incomp ⟨haz₁, hz₁a⟩
State after:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
this : a = z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : ¬r z₁ a
this : a = z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
cases this
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
b : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
b : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rfl]
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
b : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s
    (Option.casesOn (some (f z₁ b z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
b : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s
    (Option.casesOn (some (f z₁ b z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons z₁ b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rfl]
State after:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
b : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s
    (Option.casesOn (some (f z₁ b z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (Option.casesOn (some (f z₁ b z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))

State before:
case e.e.refl
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
xs ys : KVChain r fun a => β a
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
b : β z₁
haxs : boundLeft z₁ xs
hays : boundLeft z₁ ys
haz₁ hz₁a : ¬r z₁ z₁
⊢ KVChain.rklex s
    (Option.casesOn (some (f z₁ b z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)))
    (Option.casesOn (some (f z₁ b z₂)) (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs) fun bf =>
      KVChain.cons z₁ bf (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)
        (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs)))
Tactic:
exact KVChain.rklex.tail (h_ind_zs _ _ htail)
State after:
no goals

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : r a z₁
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rel haz₁]
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : r a z₁
⊢ KVChain.rklex s
    (KVChain.cons a b (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : r a z₁
⊢ KVChain.rklex s
    (KVChain.cons a b (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_rel haz₁]
State after:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : r a z₁
⊢ KVChain.rklex s
    (KVChain.cons a b (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))))
    (KVChain.cons a b (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))

State before:
case t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : r a z₁
⊢ KVChain.rklex s
    (KVChain.cons a b (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))))
    (KVChain.cons a b (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
      (_ : boundLeft a (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))))
Tactic:
exact KVChain.rklex.tail h_ind
State after:
no goals

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_flip hz₁a]
State after:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) zs)))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) zs)))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) (KVChain.cons z₁ z₂ zs hzs))
Tactic:
rw [cons_mergeWith_cons_flip hz₁a]
State after:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) zs)))
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) zs)))

State before:
case e.t
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f✝ : (a : α) → β a → β a → Option (β a)
s : (a : α) → β a → β a → Prop
f : (a : α) → β a → β a → β a
xs✝¹ ys✝¹ zs✝ : KVChain r β
hsf_right : ∀ (a : α) (b₁ b : β a), s a b₁ (f a b b₁)
hsf_stab : ∀ (a : α) (b₁ b₂ b : β a), s a b₁ b₂ → s a (f a b₁ b) (f a b₂ b)
z₁ : α
z₂ : β z₁
zs : KVChain r fun a => β a
hzs : boundLeft z₁ zs
h_ind_zs :
  (fun zs =>
      ∀ (xs ys : KVChain r fun a => β a),
        KVChain.rklex s xs ys →
          KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs zs)
            (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys zs))
    zs
xs✝ ys✝ : KVChain r fun a => β a
h : KVChain.rklex s xs✝ ys✝
a : α
b : β a
xs ys : KVChain r fun a => β a
haxs : boundLeft a xs
hays : boundLeft a ys
htail : KVChain.rklex s xs ys
h_ind :
  KVChain.rklex s (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) xs (KVChain.cons z₁ z₂ zs hzs))
    (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) ys (KVChain.cons z₁ z₂ zs hzs))
haz₁ : ¬r a z₁
hz₁a : r z₁ a
⊢ KVChain.rklex s
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b xs haxs) zs)))
    (KVChain.cons z₁ z₂ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) zs)
      (_ : boundLeft z₁ (mergeWith (fun a b₁ b₂ => some (f a b₁ b₂)) (KVChain.cons a b ys hays) zs)))
Tactic:
exact KVChain.rklex.tail (h_ind_zs _ _ $ KVChain.rklex.tail htail)
State after:
no goals