internlm/Lean-Github huggingface dataset:
Theorem: KVChain.boundLeft_mergeWith
Proof state before:
case a
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
d : α
ys✝ : KVChain r β
a₂ : α
b₂ : β a₂
ys : KVChain r fun a => β a
ha₂ys : boundLeft a₂ ys
xs✝ : KVChain r fun a => β a
hda₂ : boundLeft d (KVChain.cons a₂ b₂ ys ha₂ys)
xs : KVChain r fun a => β a
a✝ :
  (∀ (xs₁ : KVChain r fun a => β a), boundLeft d xs₁ → boundLeft d ys → boundLeft d (mergeWith f xs₁ ys)) →
    boundLeft d xs → boundLeft d (mergeWith f xs (KVChain.cons a₂ b₂ ys ha₂ys))
h_ind_ys : ∀ (xs₁ : KVChain r fun a => β a), boundLeft d xs₁ → boundLeft d ys → boundLeft d (mergeWith f xs₁ ys)
b₁ : β a₂
ha₁xs : boundLeft a₂ xs
hda₁ : boundLeft d (KVChain.cons a₂ b₁ xs ha₁xs)
ha₁a₂ ha₂a₁ : ¬r a₂ a₂
⊢ boundLeft d xs
Tactic:
exact boundLeft_descend (λ _=> trans hda₂) ha₁xs
Proof state after:
no goals
Theorem: KVChain.boundLeft_mergeWith
Proof state before:
case a
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
d : α
ys✝ : KVChain r β
a₂ : α
b₂ : β a₂
ys : KVChain r fun a => β a
ha₂ys : boundLeft a₂ ys
xs✝ : KVChain r fun a => β a
hda₂ : boundLeft d (KVChain.cons a₂ b₂ ys ha₂ys)
xs : KVChain r fun a => β a
a✝ :
  (∀ (xs₁ : KVChain r fun a => β a), boundLeft d xs₁ → boundLeft d ys → boundLeft d (mergeWith f xs₁ ys)) →
    boundLeft d xs → boundLeft d (mergeWith f xs (KVChain.cons a₂ b₂ ys ha₂ys))
h_ind_ys : ∀ (xs₁ : KVChain r fun a => β a), boundLeft d xs₁ → boundLeft d ys → boundLeft d (mergeWith f xs₁ ys)
b₁ : β a₂
ha₁xs : boundLeft a₂ xs
hda₁ : boundLeft d (KVChain.cons a₂ b₁ xs ha₁xs)
ha₁a₂ ha₂a₁ : ¬r a₂ a₂
⊢ boundLeft d ys
Tactic:
exact boundLeft_descend (λ _=> trans hda₁) ha₂ys
Proof state after:
no goals
Theorem: KVChain.boundLeft_mergeWith
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
d : α
ys✝ : KVChain r β
a₂ : α
b₂ : β a₂
ys : KVChain r fun a => β a
ha₂ys : boundLeft a₂ ys
xs✝ : KVChain r fun a => β a
hda₂ : boundLeft d (KVChain.cons a₂ b₂ ys ha₂ys)
xs : KVChain r fun a => β a
a✝ :
  (∀ (xs₁ : KVChain r fun a => β a), boundLeft d xs₁ → boundLeft d ys → boundLeft d (mergeWith f xs₁ ys)) →
    boundLeft d xs → boundLeft d (mergeWith f xs (KVChain.cons a₂ b₂ ys ha₂ys))
h_ind_ys : ∀ (xs₁ : KVChain r fun a => β a), boundLeft d xs₁ → boundLeft d ys → boundLeft d (mergeWith f xs₁ ys)
b₁ : β a₂
ha₁xs : boundLeft a₂ xs
hda₁ : boundLeft d (KVChain.cons a₂ b₁ xs ha₁xs)
ha₁a₂ ha₂a₁ : ¬r a₂ a₂
bf : β a₂
⊢ List.predHead (r d ∘ Sigma.fst)
    ({ fst := a₂, snd := bf } ::
      (mergeWith f xs { toList := ys.toList, ascend := (_ : List.Ascending (Sigma.relOnFst r) ys.toList) }).toList)
Tactic:
dsimp [List.reverseAux, List.predHead]
Proof state after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
d : α
ys✝ : KVChain r β
a₂ : α
b₂ : β a₂
ys : KVChain r fun a => β a
ha₂ys : boundLeft a₂ ys
xs✝ : KVChain r fun a => β a
hda₂ : boundLeft d (KVChain.cons a₂ b₂ ys ha₂ys)
xs : KVChain r fun a => β a
a✝ :
  (∀ (xs₁ : KVChain r fun a => β a), boundLeft d xs₁ → boundLeft d ys → boundLeft d (mergeWith f xs₁ ys)) →
    boundLeft d xs → boundLeft d (mergeWith f xs (KVChain.cons a₂ b₂ ys ha₂ys))
h_ind_ys : ∀ (xs₁ : KVChain r fun a => β a), boundLeft d xs₁ → boundLeft d ys → boundLeft d (mergeWith f xs₁ ys)
b₁ : β a₂
ha₁xs : boundLeft a₂ xs
hda₁ : boundLeft d (KVChain.cons a₂ b₁ xs ha₁xs)
ha₁a₂ ha₂a₁ : ¬r a₂ a₂
bf : β a₂
⊢ r d a₂
Theorem: KVChain.boundLeft_mergeWith
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
d : α
ys✝ : KVChain r β
a₂ : α
b₂ : β a₂
ys : KVChain r fun a => β a
ha₂ys : boundLeft a₂ ys
xs✝ : KVChain r fun a => β a
hda₂ : boundLeft d (KVChain.cons a₂ b₂ ys ha₂ys)
xs : KVChain r fun a => β a
a✝ :
  (∀ (xs₁ : KVChain r fun a => β a), boundLeft d xs₁ → boundLeft d ys → boundLeft d (mergeWith f xs₁ ys)) →
    boundLeft d xs → boundLeft d (mergeWith f xs (KVChain.cons a₂ b₂ ys ha₂ys))
h_ind_ys : ∀ (xs₁ : KVChain r fun a => β a), boundLeft d xs₁ → boundLeft d ys → boundLeft d (mergeWith f xs₁ ys)
b₁ : β a₂
ha₁xs : boundLeft a₂ xs
hda₁ : boundLeft d (KVChain.cons a₂ b₁ xs ha₁xs)
ha₁a₂ ha₂a₁ : ¬r a₂ a₂
bf : β a₂
⊢ r d a₂
Tactic:
exact hda₂
Proof state after:
no goals
Theorem: KVChain.toList_mergeWith_cons_right
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ (mergeWith f xs (KVChain.cons a b ys hays)).toList =
    List.reverseAux (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.fst.toList
      (mergeWith f (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.snd ys).toList
Tactic:
apply xs.recOnList (motive:=λ xs=>(mergeWith f xs (ys.cons a b hays)).toList=List.reverseAux (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.fst.toList (mergeWith f (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.snd ys).toList)
Proof state after:
case nil
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ (mergeWith f KVChain.nil (KVChain.cons a b ys hays)).toList =
    List.reverseAux (insertWithAux f KVChain.nil KVChain.nil True.intro a b True.intro).val.fst.toList
      (mergeWith f (insertWithAux f KVChain.nil KVChain.nil True.intro a b True.intro).val.snd ys).toList

case cons
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ ∀ (a_1 : α) (b_1 : β a_1) (xs : KVChain r fun a => β a) (haxs : boundLeft a_1 xs),
    (fun xs =>
          (mergeWith f xs (KVChain.cons a b ys hays)).toList =
            List.reverseAux (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.fst.toList
              (mergeWith f (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.snd ys).toList)
        xs →
      (fun xs =>
          (mergeWith f xs (KVChain.cons a b ys hays)).toList =
            List.reverseAux (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.fst.toList
              (mergeWith f (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.snd ys).toList)
        (KVChain.cons a_1 b_1 xs haxs)
Theorem: KVChain.toList_mergeWith_cons_right
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ (mergeWith f KVChain.nil (KVChain.cons a b ys hays)).toList =
    List.reverseAux (insertWithAux f KVChain.nil KVChain.nil True.intro a b True.intro).val.fst.toList
      (mergeWith f (insertWithAux f KVChain.nil KVChain.nil True.intro a b True.intro).val.snd ys).toList
Tactic:
case nil =>
  rw [nil_mergeWith]
  dsimp [List.reverseAux]
  rw [nil_mergeWith]
Proof state after:
no goals
Theorem: KVChain.toList_mergeWith_cons_right
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ ∀ (a_1 : α) (b_1 : β a_1) (xs : KVChain r fun a => β a) (haxs : boundLeft a_1 xs),
    (fun xs =>
          (mergeWith f xs (KVChain.cons a b ys hays)).toList =
            List.reverseAux (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.fst.toList
              (mergeWith f (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.snd ys).toList)
        xs →
      (fun xs =>
          (mergeWith f xs (KVChain.cons a b ys hays)).toList =
            List.reverseAux (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.fst.toList
              (mergeWith f (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.snd ys).toList)
        (KVChain.cons a_1 b_1 xs haxs)
Tactic:
case cons =>
  intro a x hax hpa _
  conv =>
    lhs
    unfold mergeWith; unfold mergeWith.loop
    simp
  rw [toList_mergeWith_loop_eq_reverseAux]
Proof state after:
no goals
Theorem: KVChain.toList_mergeWith_cons_right
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ (mergeWith f KVChain.nil (KVChain.cons a b ys hays)).toList =
    List.reverseAux (insertWithAux f KVChain.nil KVChain.nil True.intro a b True.intro).val.fst.toList
      (mergeWith f (insertWithAux f KVChain.nil KVChain.nil True.intro a b True.intro).val.snd ys).toList
Tactic:
rw [nil_mergeWith]
Proof state after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ (KVChain.cons a b ys hays).toList =
    List.reverseAux (insertWithAux f KVChain.nil KVChain.nil True.intro a b True.intro).val.fst.toList
      (mergeWith f (insertWithAux f KVChain.nil KVChain.nil True.intro a b True.intro).val.snd ys).toList
Theorem: KVChain.toList_mergeWith_cons_right
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ (KVChain.cons a b ys hays).toList =
    List.reverseAux (insertWithAux f KVChain.nil KVChain.nil True.intro a b True.intro).val.fst.toList
      (mergeWith f (insertWithAux f KVChain.nil KVChain.nil True.intro a b True.intro).val.snd ys).toList
Tactic:
dsimp [List.reverseAux]
Proof state after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ { fst := a, snd := b } :: ys.toList = { fst := a, snd := b } :: (mergeWith f KVChain.nil ys).toList
Theorem: KVChain.toList_mergeWith_cons_right
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ { fst := a, snd := b } :: ys.toList = { fst := a, snd := b } :: (mergeWith f KVChain.nil ys).toList
Tactic:
rw [nil_mergeWith]
Proof state after:
no goals
Theorem: KVChain.toList_mergeWith_cons_right
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a : α
b : β a
ys : KVChain r β
hays : boundLeft a ys
⊢ ∀ (a_1 : α) (b_1 : β a_1) (xs : KVChain r fun a => β a) (haxs : boundLeft a_1 xs),
    (fun xs =>
          (mergeWith f xs (KVChain.cons a b ys hays)).toList =
            List.reverseAux (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.fst.toList
              (mergeWith f (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.snd ys).toList)
        xs →
      (fun xs =>
          (mergeWith f xs (KVChain.cons a b ys hays)).toList =
            List.reverseAux (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.fst.toList
              (mergeWith f (insertWithAux f KVChain.nil xs True.intro a b True.intro).val.snd ys).toList)
        (KVChain.cons a_1 b_1 xs haxs)
Tactic:
intro a x hax hpa _
Proof state after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a✝¹ : α
b : β a✝¹
ys : KVChain r β
hays : boundLeft a✝¹ ys
a : α
x : β a
hax : KVChain r fun a => β a
hpa : boundLeft a hax
a✝ :
  (mergeWith f hax (KVChain.cons a✝¹ b ys hays)).toList =
    List.reverseAux (insertWithAux f KVChain.nil hax True.intro a✝¹ b True.intro).val.fst.toList
      (mergeWith f (insertWithAux f KVChain.nil hax True.intro a✝¹ b True.intro).val.snd ys).toList
⊢ (mergeWith f (KVChain.cons a x hax hpa) (KVChain.cons a✝¹ b ys hays)).toList =
    List.reverseAux (insertWithAux f KVChain.nil (KVChain.cons a x hax hpa) True.intro a✝¹ b True.intro).val.fst.toList
      (mergeWith f (insertWithAux f KVChain.nil (KVChain.cons a x hax hpa) True.intro a✝¹ b True.intro).val.snd
          ys).toList
Theorem: KVChain.toList_mergeWith_cons_right
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
xs : KVChain r β
a✝¹ : α
b : β a✝¹
ys : KVChain r β
hays : boundLeft a✝¹ ys
a : α
x : β a
hax : KVChain r fun a => β a
hpa : boundLeft a hax
a✝ :
  (mergeWith f hax (KVChain.cons a✝¹ b ys hays)).toList =
    List.reverseAux (insertWithAux f KVChain.nil hax True.intro a✝¹ b True.intro).val.fst.toList
      (mergeWith f (insertWithAux f KVChain.nil hax True.intro a✝¹ b True.intro).val.snd ys).toList
⊢ (mergeWith.loop f
        (insertWithAux f KVChain.nil (KVChain.cons a x hax hpa) True.intro { fst := a✝¹, snd := b }.fst b
              (_ :
                List.predHead ((fun a => boundLeft a KVChain.nil) ∘ Sigma.fst)
                  (KVChain.cons a✝¹ b ys hays).toList)).1.fst
        (insertWithAux f KVChain.nil (KVChain.cons a x hax hpa) True.intro { fst := a✝¹, snd := b }.fst b
              (_ :
                List.predHead ((fun a => boundLeft a KVChain.nil) ∘ Sigma.fst)
                  (KVChain.cons a✝¹ b ys hays).toList)).1.snd
        (_ :
          hingeable
            (insertWithAux f KVChain.nil (KVChain.cons a x hax hpa) True.intro { fst := a✝¹, snd := b }.fst
                  { fst := a✝¹, snd := b }.snd
                  (_ :
                    List.predHead ((fun a => boundLeft a KVChain.nil) ∘ Sigma.fst)
                      (KVChain.cons a✝¹ b ys hays).toList)).val.fst
            (insertWithAux f KVChain.nil (KVChain.cons a x hax hpa) True.intro { fst := a✝¹, snd := b }.fst
                  { fst := a✝¹, snd := b }.snd
                  (_ :
                    List.predHead ((fun a => boundLeft a KVChain.nil) ∘ Sigma.fst)
                      (KVChain.cons a✝¹ b ys hays).toList)).val.snd)
        ys.toList (_ : List.Ascending (Sigma.relOnFst r) ys.toList)
        (_ :
          List.predHead
            ((fun a_1 =>
                boundLeft a_1
                  (insertWithAux f KVChain.nil (KVChain.cons a x hax hpa) True.intro { fst := a✝¹, snd := b }.fst
                        { fst := a✝¹, snd := b }.snd
                        (_ :
                          List.predHead ((fun a => boundLeft a KVChain.nil) ∘ Sigma.fst)
                            (KVChain.cons a✝¹ b ys hays).toList)).1.fst) ∘
              Sigma.fst)
            ys.toList)).toList =
    List.reverseAux (insertWithAux f KVChain.nil (KVChain.cons a x hax hpa) True.intro a✝¹ b True.intro).val.fst.toList
      (mergeWith f (insertWithAux f KVChain.nil (KVChain.cons a x hax hpa) True.intro a✝¹ b True.intro).val.snd
          ys).toList
Tactic:
rw [toList_mergeWith_loop_eq_reverseAux]
Proof state after:
no goals
Theorem: KVChain.cons_mergeWith_rel
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
⊢ ∀ {a : α} {b : β a} {xs : KVChain r β} {haxs : boundLeft a xs} {ys : KVChain r β} (hays : boundLeft a ys),
    mergeWith f (KVChain.cons a b xs haxs) ys =
      KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys))
Tactic:
intro a b xs haxs ys
Proof state after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
xs : KVChain r β
haxs : boundLeft a xs
ys : KVChain r β
⊢ ∀ (hays : boundLeft a ys),
    mergeWith f (KVChain.cons a b xs haxs) ys =
      KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys))
Theorem: KVChain.cons_mergeWith_rel
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
xs : KVChain r β
haxs : boundLeft a xs
ys : KVChain r β
⊢ ∀ (hays : boundLeft a ys),
    mergeWith f (KVChain.cons a b xs haxs) ys =
      KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys))
Tactic:
revert xs
Proof state after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
ys : KVChain r β
⊢ ∀ {xs : KVChain r β} {haxs : boundLeft a xs} (hays : boundLeft a ys),
    mergeWith f (KVChain.cons a b xs haxs) ys =
      KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys))
Theorem: KVChain.cons_mergeWith_rel
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
ys : KVChain r β
⊢ ∀ {xs : KVChain r β} {haxs : boundLeft a xs} (hays : boundLeft a ys),
    mergeWith f (KVChain.cons a b xs haxs) ys =
      KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys))
Tactic:
apply ys.recOnList (motive:=λ ys => ∀ xs haxs hays, mergeWith f (xs.cons a b haxs) ys = (mergeWith f xs ys).cons a b (boundLeft_mergeWith a haxs hays))
Proof state after:
case nil
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
ys : KVChain r β
⊢ ∀ (xs : KVChain r fun a => β a) (haxs : boundLeft a xs) (hays : boundLeft a KVChain.nil),
    mergeWith f (KVChain.cons a b xs haxs) KVChain.nil =
      KVChain.cons a b (mergeWith f xs KVChain.nil) (_ : boundLeft a (mergeWith f xs KVChain.nil))

case cons
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
ys : KVChain r β
⊢ ∀ (a_1 : α) (b_1 : β a_1) (xs : KVChain r fun a => β a) (haxs : boundLeft a_1 xs),
    (fun ys =>
          ∀ (xs : KVChain r fun a => β a) (haxs : boundLeft a xs) (hays : boundLeft a ys),
            mergeWith f (KVChain.cons a b xs haxs) ys =
              KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys)))
        xs →
      (fun ys =>
          ∀ (xs : KVChain r fun a => β a) (haxs : boundLeft a xs) (hays : boundLeft a ys),
            mergeWith f (KVChain.cons a b xs haxs) ys =
              KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys)))
        (KVChain.cons a_1 b_1 xs haxs)
Theorem: KVChain.cons_mergeWith_rel
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
ys : KVChain r β
⊢ ∀ (xs : KVChain r fun a => β a) (haxs : boundLeft a xs) (hays : boundLeft a KVChain.nil),
    mergeWith f (KVChain.cons a b xs haxs) KVChain.nil =
      KVChain.cons a b (mergeWith f xs KVChain.nil) (_ : boundLeft a (mergeWith f xs KVChain.nil))
Tactic:
case nil=> intros; rfl
Proof state after:
no goals
Theorem: KVChain.cons_mergeWith_rel
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
ys : KVChain r β
⊢ ∀ (a_1 : α) (b_1 : β a_1) (xs : KVChain r fun a => β a) (haxs : boundLeft a_1 xs),
    (fun ys =>
          ∀ (xs : KVChain r fun a => β a) (haxs : boundLeft a xs) (hays : boundLeft a ys),
            mergeWith f (KVChain.cons a b xs haxs) ys =
              KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys)))
        xs →
      (fun ys =>
          ∀ (xs : KVChain r fun a => β a) (haxs : boundLeft a xs) (hays : boundLeft a ys),
            mergeWith f (KVChain.cons a b xs haxs) ys =
              KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys)))
        (KVChain.cons a_1 b_1 xs haxs)
Tactic:
case cons =>
  intro b y hby hpb _ x hax hab
  apply KVChain.eq_of_toList_eq
  rw [toList_mergeWith_cons_right]
  rw [KVChain.toList_cons]
  rw [toList_mergeWith_cons_right]
  conv =>
    lhs
    rw [insertWithAux_cons_rel hab]
    rw [toList_fst_insertWithAux_eq_append]
    rw [toList_snd_insertWithAux_inv]
    rw [List.reverseAux_append_left]
Proof state after:
no goals
Theorem: KVChain.cons_mergeWith_rel
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
ys : KVChain r β
⊢ ∀ (xs : KVChain r fun a => β a) (haxs : boundLeft a xs) (hays : boundLeft a KVChain.nil),
    mergeWith f (KVChain.cons a b xs haxs) KVChain.nil =
      KVChain.cons a b (mergeWith f xs KVChain.nil) (_ : boundLeft a (mergeWith f xs KVChain.nil))
Tactic:
intros
Proof state after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
ys : KVChain r β
xs✝ : KVChain r fun a => β a
haxs✝ : boundLeft a xs✝
hays✝ : boundLeft a KVChain.nil
⊢ mergeWith f (KVChain.cons a b xs✝ haxs✝) KVChain.nil =
    KVChain.cons a b (mergeWith f xs✝ KVChain.nil) (_ : boundLeft a (mergeWith f xs✝ KVChain.nil))
Theorem: KVChain.cons_mergeWith_rel
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
ys : KVChain r β
xs✝ : KVChain r fun a => β a
haxs✝ : boundLeft a xs✝
hays✝ : boundLeft a KVChain.nil
⊢ mergeWith f (KVChain.cons a b xs✝ haxs✝) KVChain.nil =
    KVChain.cons a b (mergeWith f xs✝ KVChain.nil) (_ : boundLeft a (mergeWith f xs✝ KVChain.nil))
Tactic:
rfl
Proof state after:
no goals
Theorem: KVChain.cons_mergeWith_rel
Proof state before:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b : β a
ys : KVChain r β
⊢ ∀ (a_1 : α) (b_1 : β a_1) (xs : KVChain r fun a => β a) (haxs : boundLeft a_1 xs),
    (fun ys =>
          ∀ (xs : KVChain r fun a => β a) (haxs : boundLeft a xs) (hays : boundLeft a ys),
            mergeWith f (KVChain.cons a b xs haxs) ys =
              KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys)))
        xs →
      (fun ys =>
          ∀ (xs : KVChain r fun a => β a) (haxs : boundLeft a xs) (hays : boundLeft a ys),
            mergeWith f (KVChain.cons a b xs haxs) ys =
              KVChain.cons a b (mergeWith f xs ys) (_ : boundLeft a (mergeWith f xs ys)))
        (KVChain.cons a_1 b_1 xs haxs)
Tactic:
intro b y hby hpb _ x hax hab
Proof state after:
α : Type u
r : α → α → Prop
inst✝¹ : StrictLinearOrder r
inst✝ : DecidableRel r
β : α → Type v
f : (a : α) → β a → β a → Option (β a)
a : α
b✝ : β a
ys : KVChain r β
b : α
y : β b
hby : KVChain r fun a => β a
hpb : boundLeft b hby
a✝ :
  ∀ (xs : KVChain r fun a => β a) (haxs : boundLeft a xs) (hays : boundLeft a hby),
    mergeWith f (KVChain.cons a b✝ xs haxs) hby =
      KVChain.cons a b✝ (mergeWith f xs hby) (_ : boundLeft a (mergeWith f xs hby))
x : KVChain r fun a => β a
hax : boundLeft a x
hab : boundLeft a (KVChain.cons b y hby hpb)
⊢ mergeWith f (KVChain.cons a b✝ x hax) (KVChain.cons b y hby hpb) =
    KVChain.cons a b✝ (mergeWith f x (KVChain.cons b y hby hpb))
      (_ : boundLeft a (mergeWith f x (KVChain.cons b y hby hpb)))