cases hys with | cons _ _ ht₂ =>
have ih := IsHeap_merge ht₁ ht₂
have min_le : min (hRank t₁) (hRank t₂) ≤ hRank (mergeNodes le t₁ t₂) := by 
  rw[← heq] at ht₂
  apply min_hRank_mergeNodes ht₁ ht₂
by_cases (t₁ = [] ∧ t₂ = [])
. have (And.intro he₁ he₂) := h
  simp[he₁, he₂]
  constructor
. apply IsHeapForest'_strengthen
  . apply ih
  . rw[Nat.min_eq] at min_le
    split at min_le
    . match ht₁ with
      | .nil =>
        rw[empty_heap_merge_left] at *
        match ht₂ with
        | .nil => simp at h
        | .cons (t := bt) hlt _ _ =>
          rw[hrank_of_cons] at *
          rw[← heq] at hlt
          unfold bne at hneq₂
          rw[Nat.not_beq_eq_true_eq] at hneq₂
          have n : h₁.rank + 1 ≤ bt.rank := by
            apply Nat.succ_le_of_lt hlt 
          apply lt_of_le_of_ne <;> assumption
      | .cons (t := t) (ts := ts) hlt _ _ =>
        rw[hrank_of_cons] at *
        have : h₁.rank < hRank (mergeNodes le (t :: ts) t₂) := by
          apply lt_of_lt_of_le <;> assumption
        unfold bne at hneq
        rw[Nat.not_beq_eq_true_eq] at hneq
        have : h₁.rank + 1 ≤ t.rank := by
          apply Nat.succ_le_of_lt hlt
        have : h₁.rank + 1 < t.rank := by
          apply lt_of_le_of_ne <;> assumption
        apply lt_of_lt_of_le <;> assumption
    . match ht₂ with
      | .nil => 
        rw[empty_heap_merge_right] at *
        match ht₁ with
        | .nil =>
          simp at h
        | .cons (t := t) (ts := ts) lt _ _ => 
          rw[hrank_of_cons] at *
          unfold bne at hneq
          rw[Nat.not_beq_eq_true_eq] at hneq
          have : h₁.rank + 1 ≤ t.rank := by
            apply Nat.succ_le_of_lt lt
          apply lt_of_le_of_ne <;> assumption
      | .cons (t := t) (ts := ts) lt _ _ =>
        rw[hrank_of_cons] at *
        rw[← heq] at lt
        have : h₁.rank + 1 ≤ t.rank := by
          apply Nat.succ_le_of_lt lt
        unfold bne at hneq₂
        rw[Nat.not_beq_eq_true_eq] at hneq₂
        have : h₁.rank + 1 < t.rank := by
          apply lt_of_le_of_ne <;> assumption
        apply lt_of_lt_of_le <;> assumption
case inr.inr.inl.inl.a.cons
α : Type u_1
le : α → α → Bool
rx : ℕ
xs : List (BinTree α)
ry : ℕ
ys : List (BinTree α)
h₁ : BinTree α
t₁ : List (BinTree α)
h₂ : BinTree α
t₂ : List (BinTree α)
hys : IsHeapForest' ry (h₂ :: t₂)
hneq : (h₁.rank + 1 != hRank t₁) = true
hneq₂ : (h₁.rank + 1 != hRank t₂) = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
h✝¹ : h₂.rank ≤ h₁.rank
h✝ : h₁.rank ≤ h₂.rank
heq : h₁.rank = h₂.rank
a✝¹ : IsBinTree h₁
a✝ : rx < h₁.rank
ht₁ : IsHeapForest' h₁.rank t₁
⊢ IsHeapForest' (h₁.rank + 1) (mergeNodes le t₁ t₂)
no goals