Theorem: project.deleteMin_non_empty (Project/DeleteMin.lean)

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h₁ : IsHeap (Heap.heap [])
h₂ : IsMinHeap le (Heap.heap [])
⊢ deleteMin le (Heap.heap []) = some (y, ys) → IsHeap ys ∧ IsMinHeap le ys
Tactic:
intro eq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h₁ : IsHeap (Heap.heap [])
h₂ : IsMinHeap le (Heap.heap [])
eq : deleteMin le (Heap.heap []) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h₁ : IsHeap (Heap.heap [])
h₂ : IsMinHeap le (Heap.heap [])
eq : deleteMin le (Heap.heap []) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
unfold deleteMin at eq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h₁ : IsHeap (Heap.heap [])
h₂ : IsMinHeap le (Heap.heap [])
eq :
  (match Heap.heap [] with
    | Heap.heap [] => none
    | Heap.heap [h] => some (h.val, h.children)
    | Heap.heap hhs@h_1:(h :: hs) =>
      match findMin le hs 1 (h, 0) with
      | (min, minIdx) =>
        let rest := List.eraseIdx hhs minIdx;
        let tail := merge le (Heap.heap rest) min.children;
        some (min.val, tail)) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h₁ : IsHeap (Heap.heap [])
h₂ : IsMinHeap le (Heap.heap [])
eq :
  (match Heap.heap [] with
    | Heap.heap [] => none
    | Heap.heap [h] => some (h.val, h.children)
    | Heap.heap hhs@h_1:(h :: hs) =>
      match findMin le hs 1 (h, 0) with
      | (min, minIdx) =>
        let rest := List.eraseIdx hhs minIdx;
        let tail := merge le (Heap.heap rest) min.children;
        some (min.val, tail)) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
dsimp at eq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h₁ : IsHeap (Heap.heap [])
h₂ : IsMinHeap le (Heap.heap [])
eq : none = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h₁ : IsHeap (Heap.heap [])
h₂ : IsMinHeap le (Heap.heap [])
eq : none = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
contradiction
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
⊢ deleteMin le (Heap.heap [h]) = some (y, ys) → IsHeap ys ∧ IsMinHeap le ys
Tactic:
intro eq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : deleteMin le (Heap.heap [h]) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : deleteMin le (Heap.heap [h]) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
unfold deleteMin at eq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq :
  (match Heap.heap [h] with
    | Heap.heap [] => none
    | Heap.heap [h] => some (h.val, h.children)
    | Heap.heap hhs@h_1:(h :: hs) =>
      match findMin le hs 1 (h, 0) with
      | (min, minIdx) =>
        let rest := List.eraseIdx hhs minIdx;
        let tail := merge le (Heap.heap rest) min.children;
        some (min.val, tail)) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq :
  (match Heap.heap [h] with
    | Heap.heap [] => none
    | Heap.heap [h] => some (h.val, h.children)
    | Heap.heap hhs@h_1:(h :: hs) =>
      match findMin le hs 1 (h, 0) with
      | (min, minIdx) =>
        let rest := List.eraseIdx hhs minIdx;
        let tail := merge le (Heap.heap rest) min.children;
        some (min.val, tail)) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
dsimp at eq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : some (h.val, h.children) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : some (h.val, h.children) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
rw[Option.some_inj, Prod.eq_iff_fst_eq_snd_eq] at eq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : (h.val, h.children).fst = (y, ys).fst ∧ (h.val, h.children).snd = (y, ys).snd
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : (h.val, h.children).fst = (y, ys).fst ∧ (h.val, h.children).snd = (y, ys).snd
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
simp at eq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : h.val = y ∧ h.children = ys
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : h.val = y ∧ h.children = ys
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
apply And.intro
State after:
case left
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : h.val = y ∧ h.children = ys
⊢ IsHeap ys

case right
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : h.val = y ∧ h.children = ys
⊢ IsMinHeap le ys

State before:
case left
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : h.val = y ∧ h.children = ys
⊢ IsHeap ys

case right
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : h.val = y ∧ h.children = ys
⊢ IsMinHeap le ys
Tactic:
. rw[← eq.right]
  apply children_IsHeap
  assumption
State after:
case right
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : h.val = y ∧ h.children = ys
⊢ IsMinHeap le ys

State before:
case right
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
h₁ : IsHeap (Heap.heap [h])
h₂ : IsMinHeap le (Heap.heap [h])
eq : h.val = y ∧ h.children = ys
⊢ IsMinHeap le ys
Tactic:
. rw[← eq.right]
  apply children_IsMinHeap
  assumption
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
⊢ deleteMin le (Heap.heap (h :: hs)) = some (y, ys) → IsHeap ys ∧ IsMinHeap le ys
Tactic:
intro dmeq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
dmeq : deleteMin le (Heap.heap (h :: hs)) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
dmeq : deleteMin le (Heap.heap (h :: hs)) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
unfold deleteMin at dmeq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
dmeq :
  (match Heap.heap (h :: hs) with
    | Heap.heap [] => none
    | Heap.heap [h] => some (h.val, h.children)
    | Heap.heap hhs@h_1:(h :: hs) =>
      match findMin le hs 1 (h, 0) with
      | (min, minIdx) =>
        let rest := List.eraseIdx hhs minIdx;
        let tail := merge le (Heap.heap rest) min.children;
        some (min.val, tail)) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
dmeq :
  (match Heap.heap (h :: hs) with
    | Heap.heap [] => none
    | Heap.heap [h] => some (h.val, h.children)
    | Heap.heap hhs@h_1:(h :: hs) =>
      match findMin le hs 1 (h, 0) with
      | (min, minIdx) =>
        let rest := List.eraseIdx hhs minIdx;
        let tail := merge le (Heap.heap rest) min.children;
        some (min.val, tail)) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
dsimp at dmeq
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
dmeq :
  (match Heap.heap (h :: hs) with
    | Heap.heap [] => none
    | Heap.heap [h] => some (h.val, h.children)
    | Heap.heap hhs@h_1:(h :: hs) =>
      some
        ((findMin le hs 1 (h, 0)).fst.val,
          merge le (Heap.heap (List.eraseIdx hhs (findMin le hs 1 (h, 0)).snd))
            (findMin le hs 1 (h, 0)).fst.children)) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
dmeq :
  (match Heap.heap (h :: hs) with
    | Heap.heap [] => none
    | Heap.heap [h] => some (h.val, h.children)
    | Heap.heap hhs@h_1:(h :: hs) =>
      some
        ((findMin le hs 1 (h, 0)).fst.val,
          merge le (Heap.heap (List.eraseIdx hhs (findMin le hs 1 (h, 0)).snd))
            (findMin le hs 1 (h, 0)).fst.children)) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
split at dmeq
State after:
case h_1
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝ : Heap α
heq✝ : Heap.heap (h :: hs) = Heap.heap []
dmeq : none = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

case h_2
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝ : Heap α
h✝ : HeapNodeAux α (Heap α)
heq✝ : Heap.heap (h :: hs) = Heap.heap [h✝]
dmeq : some (h✝.val, h✝.children) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

case h_3
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝¹ : Heap α
h✝ : HeapNodeAux α (Heap α)
hs✝ : List (HeapNodeAux α (Heap α))
x✝ : hs✝ = [] → False
heq✝ : Heap.heap (h :: hs) = Heap.heap (h✝ :: hs✝)
dmeq :
  some
      ((findMin le hs✝ 1 (h✝, 0)).fst.val,
        merge le (Heap.heap (List.eraseIdx (h✝ :: hs✝) (findMin le hs✝ 1 (h✝, 0)).snd))
          (findMin le hs✝ 1 (h✝, 0)).fst.children) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
case h_1
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝ : Heap α
heq✝ : Heap.heap (h :: hs) = Heap.heap []
dmeq : none = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

case h_2
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝ : Heap α
h✝ : HeapNodeAux α (Heap α)
heq✝ : Heap.heap (h :: hs) = Heap.heap [h✝]
dmeq : some (h✝.val, h✝.children) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

case h_3
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝¹ : Heap α
h✝ : HeapNodeAux α (Heap α)
hs✝ : List (HeapNodeAux α (Heap α))
x✝ : hs✝ = [] → False
heq✝ : Heap.heap (h :: hs) = Heap.heap (h✝ :: hs✝)
dmeq :
  some
      ((findMin le hs✝ 1 (h✝, 0)).fst.val,
        merge le (Heap.heap (List.eraseIdx (h✝ :: hs✝) (findMin le hs✝ 1 (h✝, 0)).snd))
          (findMin le hs✝ 1 (h✝, 0)).fst.children) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
. contradiction
State after:
case h_2
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝ : Heap α
h✝ : HeapNodeAux α (Heap α)
heq✝ : Heap.heap (h :: hs) = Heap.heap [h✝]
dmeq : some (h✝.val, h✝.children) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

case h_3
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝¹ : Heap α
h✝ : HeapNodeAux α (Heap α)
hs✝ : List (HeapNodeAux α (Heap α))
x✝ : hs✝ = [] → False
heq✝ : Heap.heap (h :: hs) = Heap.heap (h✝ :: hs✝)
dmeq :
  some
      ((findMin le hs✝ 1 (h✝, 0)).fst.val,
        merge le (Heap.heap (List.eraseIdx (h✝ :: hs✝) (findMin le hs✝ 1 (h✝, 0)).snd))
          (findMin le hs✝ 1 (h✝, 0)).fst.children) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
case h_2
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝ : Heap α
h✝ : HeapNodeAux α (Heap α)
heq✝ : Heap.heap (h :: hs) = Heap.heap [h✝]
dmeq : some (h✝.val, h✝.children) = some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

case h_3
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝¹ : Heap α
h✝ : HeapNodeAux α (Heap α)
hs✝ : List (HeapNodeAux α (Heap α))
x✝ : hs✝ = [] → False
heq✝ : Heap.heap (h :: hs) = Heap.heap (h✝ :: hs✝)
dmeq :
  some
      ((findMin le hs✝ 1 (h✝, 0)).fst.val,
        merge le (Heap.heap (List.eraseIdx (h✝ :: hs✝) (findMin le hs✝ 1 (h✝, 0)).snd))
          (findMin le hs✝ 1 (h✝, 0)).fst.children) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
. rename_i heq
  rw[Option.some_inj] at dmeq
  rw[Prod.eq_iff_fst_eq_snd_eq] at dmeq
  simp at *
  rw[←dmeq.right]
  rw[←heq.left]
  apply And.intro
  . apply children_IsHeap
    rw[heq.right] at h₁
    assumption
  . apply children_IsMinHeap
    rw[heq.right] at h₂
    assumption
State after:
case h_3
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝¹ : Heap α
h✝ : HeapNodeAux α (Heap α)
hs✝ : List (HeapNodeAux α (Heap α))
x✝ : hs✝ = [] → False
heq✝ : Heap.heap (h :: hs) = Heap.heap (h✝ :: hs✝)
dmeq :
  some
      ((findMin le hs✝ 1 (h✝, 0)).fst.val,
        merge le (Heap.heap (List.eraseIdx (h✝ :: hs✝) (findMin le hs✝ 1 (h✝, 0)).snd))
          (findMin le hs✝ 1 (h✝, 0)).fst.children) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys

State before:
case h_3
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
x✝¹ : Heap α
h✝ : HeapNodeAux α (Heap α)
hs✝ : List (HeapNodeAux α (Heap α))
x✝ : hs✝ = [] → False
heq✝ : Heap.heap (h :: hs) = Heap.heap (h✝ :: hs✝)
dmeq :
  some
      ((findMin le hs✝ 1 (h✝, 0)).fst.val,
        merge le (Heap.heap (List.eraseIdx (h✝ :: hs✝) (findMin le hs✝ 1 (h✝, 0)).snd))
          (findMin le hs✝ 1 (h✝, 0)).fst.children) =
    some (y, ys)
⊢ IsHeap ys ∧ IsMinHeap le ys
Tactic:
. rename_i xs₂ t₁ ts hne₂ heqh
  rw[Option.some_inj] at dmeq
  unfold findMin at dmeq
  split at dmeq
  . contradiction
  . split at dmeq
    . simp at *
      rename_i ts n btxn bt ts₂ bt₂ n₂ lebt eqeq
      rw[←dmeq.right]
      apply And.intro
      . unfold merge
        split
        rename_i ys₂ xs₃ ts₃ ts₄ heq heq₂
        simp at heq
        unfold List.eraseIdx at heq
        have ihts₃ : IsHeap (.heap ts₃) := by
          split at heq
          . simp_all
          . simp_all
            unfold IsHeap
            simp
            unfold IsHeapForest
            cases h₁
            apply IsHeapForest'_weaken
            . assumption
            . simp_arith
          . rename_i heq₃ _
            rw[← heq]
            apply IsHeap_delete_BinTree
            rw[← heq₃, ← heqh.left, ← heqh.right] 
            assumption
        have ihts₄ : IsHeap (.heap ts₄) := by
          clear heq 
          rw [← heq₂]
          have (And.intro ml mr) := eqeq
          rw [← ml, ← mr] at *; clear eqeq ml mr
          apply children_IsHeap
          constructor
          . have fm : IsBinTree (findMin le ts₂ (1 + 1) (t₁, 0)).fst := by
              apply IsBinTree_findMin
              . cases h₁ with | cons _ _ hf =>
                rw[heqh.right] at hf 
                cases hf
                assumption
              . cases h₁
                simp_all
            apply min_rank_IsBinTree 
            assumption
          . apply IsBinTree_findMin
            . rw[heqh.right] at h₁
              cases h₁ with | cons _ _ hf =>
                cases hf
                assumption
            . unfold IsHeap at h₁
              unfold IsHeapForest at h₁
              cases h₁ with | cons _ ht _ =>
              rw[heqh.left] at ht
              assumption
          . constructor
        unfold IsHeap at *
        unfold IsHeapForest at *
        simp at *
        have min_zero : 0 = min 0 0 := by
          simp
        rw[min_zero]
        apply IsHeap_merge <;> assumption
      . unfold merge
        split
        rename_i ys₂ xs₃ ts₃ ts₄ heq heq₂
        simp at heq
        unfold List.eraseIdx at heq
        have h₁₂ : IsMinHeap le (.heap ts₃) := by
          split at heq
          . rw[← heq]
            constructor
          . rename_i ts₅ heq₃ _
            rw[← heqh.right] at heq₃
            have eq : hs = ts₅ := by
              apply List.tail_eq_of_cons_eq
              assumption
            rw[← heq, ← eq]
            cases h₂
            assumption
          . rename_i heq₃ _
            rw[← heq]
            apply IsMinHeap_delete_BinTree
            rw[← heq₃, ← heqh.left, ← heqh.right]
            assumption                                                           
        have h₁₃ : IsMinHeap le (.heap ts₄) := by
          rw[← heq₂]
          apply children_IsMinHeap
          constructor
          . apply IsSearchTree_findMin
            . rw[heqh.right] at h₂
              cases h₂ with | cons _ mh => 
              cases mh
              assumption
            . rw[← eqeq.left, ← heqh.left]
              cases h₂
              assumption
          . constructor
        apply IsMinHeap_merge
        simp
        repeat assumption
    . simp at dmeq
      have (And.intro _ heq) := dmeq
      clear dmeq
      unfold merge at heq
      split at heq
      rename_i bt ts _ _ _ _ _ _ _ ts₂ ts₃ heq₃ heq₄
      rw[← heq]
      apply And.intro
      . have ihts₂ : IsHeap (.heap ts₂) := by
          rw[← heq₃]
          unfold IsHeap
          unfold IsHeapForest
          apply IsHeapForest'_eraseIdx
          simp at heqh
          constructor
          . apply min_rank_IsBinTree
            rw[← heqh.left]
            cases h₁
            assumption
          . rw[← heqh.left]
            cases h₁
            assumption
          . cases h₁
            rw[← heqh.left, ← heqh.right]
            assumption
        have h₂₄ : IsHeap (.heap ts₃) := by
          rw[← heq₄]
          apply children_IsHeap
          constructor
          . have ibt : IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst := by
              simp at heqh
              rw[heqh.right] at h₁
              apply IsBinTree_findMin <;>
                cases h₁ with | cons _ _ hf =>
                cases hf
                assumption
            apply min_rank_IsBinTree ibt
          . simp at heqh
            rw[heqh.right] at h₁
            apply IsBinTree_findMin <;>
              cases h₁ with | cons _ _ hf =>
              cases hf
              assumption
          . constructor
        unfold IsHeap at *
        unfold IsHeapForest at *
        simp at *
        have min_zero : 0 = min 0 0 := by
          simp
        rw[min_zero]
        apply IsHeap_merge <;> assumption
      . simp at heqh
        have imhts₂ : IsMinHeap le (.heap ts₂) := by
          rw[← heq₃]
          apply IsMinHeap_eraseIdx
          rw[← heqh.left, ← heqh.right]
          assumption
        have imhts₃ : IsMinHeap le (.heap ts₃) := by
          rw[← heq₄]
          apply children_IsMinHeap
          constructor
          . apply IsSearchTree_findMin <;>
            . rw[heqh.right] at h₂
              cases h₂ with | cons _ mh =>
              cases mh
              assumption
          . constructor
        apply IsMinHeap_merge <;> assumption
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
⊢ IsHeap (Heap.heap ts₃)
Tactic:
split at heq
State after:
case h_1
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
heq✝ : t₁ :: bt :: ts₂ = []
heq : [] = ts₃
⊢ IsHeap (Heap.heap ts₃)

case h_2
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
heq✝¹ : t₁ :: bt :: ts₂ = head✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : as✝ = ts₃
⊢ IsHeap (Heap.heap ts₃)

case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsHeap (Heap.heap ts₃)

State before:
case h_1
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
heq✝ : t₁ :: bt :: ts₂ = []
heq : [] = ts₃
⊢ IsHeap (Heap.heap ts₃)

case h_2
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
heq✝¹ : t₁ :: bt :: ts₂ = head✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : as✝ = ts₃
⊢ IsHeap (Heap.heap ts₃)

case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsHeap (Heap.heap ts₃)
Tactic:
. simp_all
State after:
case h_2
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
heq✝¹ : t₁ :: bt :: ts₂ = head✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : as✝ = ts₃
⊢ IsHeap (Heap.heap ts₃)

case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsHeap (Heap.heap ts₃)

State before:
case h_2
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
heq✝¹ : t₁ :: bt :: ts₂ = head✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : as✝ = ts₃
⊢ IsHeap (Heap.heap ts₃)

case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsHeap (Heap.heap ts₃)
Tactic:
. simp_all
  unfold IsHeap
  simp
  unfold IsHeapForest
  cases h₁
  apply IsHeapForest'_weaken
  . assumption
  . simp_arith
State after:
case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsHeap (Heap.heap ts₃)

State before:
case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsHeap (Heap.heap ts₃)
Tactic:
. rename_i heq₃ _
  rw[← heq]
  apply IsHeap_delete_BinTree
  rw[← heq₃, ← heqh.left, ← heqh.right] 
  assumption
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeap (Heap.heap ts₄)
Tactic:
clear heq
State after:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeap (Heap.heap ts₄)

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeap (Heap.heap ts₄)
Tactic:
rw [← heq₂]
State after:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeap (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeap (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children
Tactic:
have (And.intro ml mr) := eqeq
State after:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
ml : t₁ = bt₂
mr : 0 = n₂
⊢ IsHeap (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
ml : t₁ = bt₂
mr : 0 = n₂
⊢ IsHeap (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children
Tactic:
rw [← ml, ← mr] at *
State after:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
ml : t₁ = t₁
mr : 0 = 0
⊢ IsHeap (findMin le ts₂ (1 + 1) (t₁, 0)).fst.children

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
ml : t₁ = t₁
mr : 0 = 0
⊢ IsHeap (findMin le ts₂ (1 + 1) (t₁, 0)).fst.children
Tactic:
clear eqeq ml mr
State after:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeap (findMin le ts₂ (1 + 1) (t₁, 0)).fst.children

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeap (findMin le ts₂ (1 + 1) (t₁, 0)).fst.children
Tactic:
apply children_IsHeap
State after:
case a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeap (Heap.heap [(findMin le ts₂ (1 + 1) (t₁, 0)).fst])

State before:
case a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeap (Heap.heap [(findMin le ts₂ (1 + 1) (t₁, 0)).fst])
Tactic:
constructor
State after:
case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ 0 < (findMin le ts₂ (1 + 1) (t₁, 0)).fst.rank

case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsBinTree (findMin le ts₂ (1 + 1) (t₁, 0)).fst

case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeapForest' (findMin le ts₂ (1 + 1) (t₁, 0)).fst.rank []

State before:
case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ 0 < (findMin le ts₂ (1 + 1) (t₁, 0)).fst.rank

case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsBinTree (findMin le ts₂ (1 + 1) (t₁, 0)).fst

case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeapForest' (findMin le ts₂ (1 + 1) (t₁, 0)).fst.rank []
Tactic:
. have fm : IsBinTree (findMin le ts₂ (1 + 1) (t₁, 0)).fst := by
    apply IsBinTree_findMin
    . cases h₁ with | cons _ _ hf =>
      rw[heqh.right] at hf 
      cases hf
      assumption
    . cases h₁
      simp_all
  apply min_rank_IsBinTree 
  assumption
State after:
case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsBinTree (findMin le ts₂ (1 + 1) (t₁, 0)).fst

case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeapForest' (findMin le ts₂ (1 + 1) (t₁, 0)).fst.rank []

State before:
case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsBinTree (findMin le ts₂ (1 + 1) (t₁, 0)).fst

case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeapForest' (findMin le ts₂ (1 + 1) (t₁, 0)).fst.rank []
Tactic:
. apply IsBinTree_findMin
  . rw[heqh.right] at h₁
    cases h₁ with | cons _ _ hf =>
      cases hf
      assumption
  . unfold IsHeap at h₁
    unfold IsHeapForest at h₁
    cases h₁ with | cons _ ht _ =>
    rw[heqh.left] at ht
    assumption
State after:
case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeapForest' (findMin le ts₂ (1 + 1) (t₁, 0)).fst.rank []

State before:
case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeapForest' (findMin le ts₂ (1 + 1) (t₁, 0)).fst.rank []
Tactic:
. constructor
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsBinTree (findMin le ts₂ (1 + 1) (t₁, 0)).fst
Tactic:
apply IsBinTree_findMin
State after:
case a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeapForest' ?r ts₂

case a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsBinTree t₁

case r
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ ℕ

State before:
case a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsHeapForest' ?r ts₂

case a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsBinTree t₁

case r
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ ℕ
Tactic:
. cases h₁ with | cons _ _ hf =>
  rw[heqh.right] at hf 
  cases hf
  assumption
State after:
case a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsBinTree t₁

State before:
case a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
⊢ IsBinTree t₁
Tactic:
. cases h₁
  simp_all
State after:
no goals

State before:
case a.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
a✝¹ : IsBinTree h
a✝ : 0 < h.rank
hf : IsHeapForest' h.rank hs
⊢ IsHeapForest' (?m.262680 (_ : IsHeapForest' 0 (h :: hs))) ts₂
Tactic:
rw[heqh.right] at hf
State after:
case a.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
a✝¹ : IsBinTree h
a✝ : 0 < h.rank
hf✝ : IsHeapForest' h.rank hs
hf : IsHeapForest' h.rank (bt :: ts₂)
⊢ IsHeapForest' (?m.262680 (_ : IsHeapForest' 0 (h :: hs))) ts₂

State before:
case a.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
a✝¹ : IsBinTree h
a✝ : 0 < h.rank
hf✝ : IsHeapForest' h.rank hs
hf : IsHeapForest' h.rank (bt :: ts₂)
⊢ IsHeapForest' (?m.262680 (_ : IsHeapForest' 0 (h :: hs))) ts₂
Tactic:
cases hf
State after:
case a.cons.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
a✝⁴ : IsBinTree h
a✝³ : 0 < h.rank
hf : IsHeapForest' h.rank hs
a✝² : IsBinTree bt
a✝¹ : h.rank < bt.rank
a✝ : IsHeapForest' bt.rank ts₂
⊢ IsHeapForest' (?m.262680 (_ : IsHeapForest' 0 (h :: hs))) ts₂

State before:
case a.cons.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
a✝⁴ : IsBinTree h
a✝³ : 0 < h.rank
hf : IsHeapForest' h.rank hs
a✝² : IsBinTree bt
a✝¹ : h.rank < bt.rank
a✝ : IsHeapForest' bt.rank ts₂
⊢ IsHeapForest' (?m.262680 (_ : IsHeapForest' 0 (h :: hs))) ts₂
Tactic:
assumption
State after:
no goals

State before:
case a.a.a.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
a✝¹ : IsBinTree h
a✝ : 0 < h.rank
hf : IsHeapForest' h.rank (bt :: ts₂)
⊢ IsHeapForest' (?m.269014 bt₂ n₂ lebt not_le_le hne₂ heqh dmeq ys₂ xs₃ ts₃ ts₄ heq₂ ihts₃) ts₂
Tactic:
cases hf
State after:
case a.a.a.cons.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
a✝⁴ : IsBinTree h
a✝³ : 0 < h.rank
a✝² : IsBinTree bt
a✝¹ : h.rank < bt.rank
a✝ : IsHeapForest' bt.rank ts₂
⊢ IsHeapForest' (?m.269014 bt₂ n₂ lebt not_le_le hne₂ heqh dmeq ys₂ xs₃ ts₃ ts₄ heq₂ ihts₃) ts₂

State before:
case a.a.a.cons.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
a✝⁴ : IsBinTree h
a✝³ : 0 < h.rank
a✝² : IsBinTree bt
a✝¹ : h.rank < bt.rank
a✝ : IsHeapForest' bt.rank ts₂
⊢ IsHeapForest' (?m.269014 bt₂ n₂ lebt not_le_le hne₂ heqh dmeq ys₂ xs₃ ts₃ ts₄ heq₂ ihts₃) ts₂
Tactic:
assumption
State after:
no goals

State before:
case a.a.a.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
ht : IsBinTree h
a✝¹ : 0 < h.rank
a✝ : IsHeapForest' h.rank hs
⊢ IsBinTree t₁
Tactic:
rw[heqh.left] at ht
State after:
case a.a.a.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
ht : IsBinTree t₁
a✝¹ : 0 < h.rank
a✝ : IsHeapForest' h.rank hs
⊢ IsBinTree t₁

State before:
case a.a.a.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
ihts₃ : IsHeap (Heap.heap ts₃)
ht : IsBinTree t₁
a✝¹ : 0 < h.rank
a✝ : IsHeapForest' h.rank hs
⊢ IsBinTree t₁
Tactic:
assumption
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeapForest' 0 (h :: hs)
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
ihts₃ : IsHeapForest' 0 ts₃
ihts₄ : IsHeapForest' 0 ts₄
⊢ 0 = min 0 0
Tactic:
simp
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
⊢ IsMinHeap le (Heap.heap ts₃)
Tactic:
split at heq
State after:
case h_1
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
heq✝ : t₁ :: bt :: ts₂ = []
heq : [] = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)

case h_2
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
heq✝¹ : t₁ :: bt :: ts₂ = head✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : as✝ = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)

case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)

State before:
case h_1
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
heq✝ : t₁ :: bt :: ts₂ = []
heq : [] = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)

case h_2
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
heq✝¹ : t₁ :: bt :: ts₂ = head✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : as✝ = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)

case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)
Tactic:
. rw[← heq]
  constructor
State after:
case h_2
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
heq✝¹ : t₁ :: bt :: ts₂ = head✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : as✝ = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)

case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)

State before:
case h_2
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
heq✝¹ : t₁ :: bt :: ts₂ = head✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : as✝ = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)

case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)
Tactic:
. rename_i ts₅ heq₃ _
  rw[← heqh.right] at heq₃
  have eq : hs = ts₅ := by
    apply List.tail_eq_of_cons_eq
    assumption
  rw[← heq, ← eq]
  cases h₂
  assumption
State after:
case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)

State before:
case h_3
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
a✝ : HeapNodeAux α (Heap α)
as✝ : List (HeapNodeAux α (Heap α))
n✝ : ℕ
heq✝¹ : t₁ :: bt :: ts₂ = a✝ :: as✝
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = Nat.succ n✝
heq : a✝ :: List.eraseIdx as✝ n✝ = ts₃
⊢ IsMinHeap le (Heap.heap ts₃)
Tactic:
. rename_i heq₃ _
  rw[← heq]
  apply IsMinHeap_delete_BinTree
  rw[← heq₃, ← heqh.left, ← heqh.right]
  assumption
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
ts₅ : List (HeapNodeAux α (Heap α))
heq₃ : t₁ :: hs = head✝ :: ts₅
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : ts₅ = ts₃
⊢ hs = ts₅
Tactic:
apply List.tail_eq_of_cons_eq
State after:
case H
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
ts₅ : List (HeapNodeAux α (Heap α))
heq₃ : t₁ :: hs = head✝ :: ts₅
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : ts₅ = ts₃
⊢ ?h₁ :: hs = ?h₂ :: ts₅

case h₁
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
ts₅ : List (HeapNodeAux α (Heap α))
heq₃ : t₁ :: hs = head✝ :: ts₅
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : ts₅ = ts₃
⊢ HeapNodeAux α (Heap α)

case h₂
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
ts₅ : List (HeapNodeAux α (Heap α))
heq₃ : t₁ :: hs = head✝ :: ts₅
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : ts₅ = ts₃
⊢ HeapNodeAux α (Heap α)

State before:
case H
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
ts₅ : List (HeapNodeAux α (Heap α))
heq₃ : t₁ :: hs = head✝ :: ts₅
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : ts₅ = ts₃
⊢ ?h₁ :: hs = ?h₂ :: ts₅

case h₁
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
ts₅ : List (HeapNodeAux α (Heap α))
heq₃ : t₁ :: hs = head✝ :: ts₅
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : ts₅ = ts₃
⊢ HeapNodeAux α (Heap α)

case h₂
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
x✝¹ : List (HeapNodeAux α (Heap α))
x✝ : ℕ
head✝ : HeapNodeAux α (Heap α)
ts₅ : List (HeapNodeAux α (Heap α))
heq₃ : t₁ :: hs = head✝ :: ts₅
heq✝ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd = 0
heq : ts₅ = ts₃
⊢ HeapNodeAux α (Heap α)
Tactic:
assumption
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsMinHeap le (Heap.heap ts₄)
Tactic:
rw[← heq₂]
State after:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsMinHeap le (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsMinHeap le (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children
Tactic:
apply children_IsMinHeap
State after:
case a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsMinHeap le (Heap.heap [(findMin le ts₂ (1 + 1) (bt₂, n₂)).fst])

State before:
case a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsMinHeap le (Heap.heap [(findMin le ts₂ (1 + 1) (bt₂, n₂)).fst])
Tactic:
constructor
State after:
case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsSearchTree le (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst

case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsMinHeap le (Heap.heap [])

State before:
case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsSearchTree le (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst

case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsMinHeap le (Heap.heap [])
Tactic:
. apply IsSearchTree_findMin
  . rw[heqh.right] at h₂
    cases h₂ with | cons _ mh => 
    cases mh
    assumption
  . rw[← eqeq.left, ← heqh.left]
    cases h₂
    assumption
State after:
case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsMinHeap le (Heap.heap [])

State before:
case a.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
⊢ IsMinHeap le (Heap.heap [])
Tactic:
. constructor
State after:
no goals

State before:
case a.a.a.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
a✝ : IsSearchTree le h
mh : IsMinHeap le (Heap.heap (bt :: ts₂))
⊢ IsMinHeap le (Heap.heap ts₂)
Tactic:
cases mh
State after:
case a.a.a.cons.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
a✝² : IsSearchTree le h
a✝¹ : IsSearchTree le bt
a✝ : IsMinHeap le (Heap.heap ts₂)
⊢ IsMinHeap le (Heap.heap ts₂)

State before:
case a.a.a.cons.cons
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
a✝² : IsSearchTree le h
a✝¹ : IsSearchTree le bt
a✝ : IsMinHeap le (Heap.heap ts₂)
⊢ IsMinHeap le (Heap.heap ts₂)
Tactic:
assumption
State after:
no goals

State before:
case h_3.h_2.inl.right.a
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
ts : List (BinTree α)
n : ℕ
btxn : BinTree α × ℕ
bt : BinTree α
ts₂ : List (BinTree α)
bt₂ : BinTree α
n₂ : ℕ
lebt : le bt₂.val bt.val = true
not_le_le : ∀ (x y : α), le x y = false → le y x = true
eqeq : t₁ = bt₂ ∧ 0 = n₂
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts₂
dmeq :
  (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.val = y ∧
    merge le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts₂) (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd))
        (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children =
      ys
ys₂ xs₃ : Heap α
ts₃ ts₄ : List (HeapNodeAux α (Heap α))
heq₂ : (findMin le ts₂ (1 + 1) (bt₂, n₂)).fst.children = Heap.heap ts₄
heq :
  (match t₁ :: bt :: ts₂, (findMin le ts₂ (1 + 1) (bt₂, n₂)).snd with
    | [], x => []
    | head :: as, 0 => as
    | a :: as, Nat.succ n => a :: List.eraseIdx as n) =
    ts₃
h₁₂ : IsMinHeap le (Heap.heap ts₃)
h₁₃ : IsMinHeap le (Heap.heap ts₄)
⊢ IsMinHeap le (Heap.heap ts₄)
Tactic:
assumption
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
⊢ IsHeap (Heap.heap ts₂)
Tactic:
rw[← heq₃]
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
⊢ IsHeap (Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd))

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
⊢ IsHeap (Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd))
Tactic:
unfold IsHeap
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
⊢ IsHeapForest (Heap.nodes (Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd)))

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
⊢ IsHeapForest (Heap.nodes (Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd)))
Tactic:
unfold IsHeapForest
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
⊢ IsHeapForest' 0 (Heap.nodes (Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd)))

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
⊢ IsHeapForest' 0 (Heap.nodes (Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd)))
Tactic:
apply IsHeapForest'_eraseIdx
State after:
case a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
⊢ IsHeapForest' 0 (t₁ :: bt :: ts)

State before:
case a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
⊢ IsHeapForest' 0 (t₁ :: bt :: ts)
Tactic:
simp at heqh
State after:
case a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsHeapForest' 0 (t₁ :: bt :: ts)

State before:
case a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsHeapForest' 0 (t₁ :: bt :: ts)
Tactic:
constructor
State after:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ 0 < t₁.rank

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsBinTree t₁

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsHeapForest' t₁.rank (bt :: ts)

State before:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ 0 < t₁.rank

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsBinTree t₁

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsHeapForest' t₁.rank (bt :: ts)
Tactic:
. apply min_rank_IsBinTree
  rw[← heqh.left]
  cases h₁
  assumption
State after:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsBinTree t₁

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsHeapForest' t₁.rank (bt :: ts)

State before:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsBinTree t₁

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsHeapForest' t₁.rank (bt :: ts)
Tactic:
. rw[← heqh.left]
  cases h₁
  assumption
State after:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsHeapForest' t₁.rank (bt :: ts)

State before:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsHeapForest' t₁.rank (bt :: ts)
Tactic:
. cases h₁
  rw[← heqh.left, ← heqh.right]
  assumption
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeap (Heap.heap ts₃)
Tactic:
rw[← heq₄]
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeap (findMin le ts (1 + 1) (bt, 1)).fst.children

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeap (findMin le ts (1 + 1) (bt, 1)).fst.children
Tactic:
apply children_IsHeap
State after:
case a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeap (Heap.heap [(findMin le ts (1 + 1) (bt, 1)).fst])

State before:
case a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeap (Heap.heap [(findMin le ts (1 + 1) (bt, 1)).fst])
Tactic:
constructor
State after:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ 0 < (findMin le ts (1 + 1) (bt, 1)).fst.rank

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeapForest' (findMin le ts (1 + 1) (bt, 1)).fst.rank []

State before:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ 0 < (findMin le ts (1 + 1) (bt, 1)).fst.rank

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeapForest' (findMin le ts (1 + 1) (bt, 1)).fst.rank []
Tactic:
. have ibt : IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst := by
    simp at heqh
    rw[heqh.right] at h₁
    apply IsBinTree_findMin <;>
      cases h₁ with | cons _ _ hf =>
      cases hf
      assumption
  apply min_rank_IsBinTree ibt
State after:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeapForest' (findMin le ts (1 + 1) (bt, 1)).fst.rank []

State before:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst

case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeapForest' (findMin le ts (1 + 1) (bt, 1)).fst.rank []
Tactic:
. simp at heqh
  rw[heqh.right] at h₁
  apply IsBinTree_findMin <;>
    cases h₁ with | cons _ _ hf =>
    cases hf
    assumption
State after:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeapForest' (findMin le ts (1 + 1) (bt, 1)).fst.rank []

State before:
case a.a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsHeapForest' (findMin le ts (1 + 1) (bt, 1)).fst.rank []
Tactic:
. constructor
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
heqh : Heap.heap (h :: hs) = Heap.heap (t₁ :: bt :: ts)
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
⊢ IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst
Tactic:
simp at heqh
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst
Tactic:
rw[heqh.right] at h₁
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h₁ : IsHeap (Heap.heap (h :: bt :: ts))
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h₁ : IsHeap (Heap.heap (h :: bt :: ts))
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsBinTree (findMin le ts (1 + 1) (bt, 1)).fst
Tactic:
apply IsBinTree_findMin <;>
  cases h₁ with | cons _ _ hf =>
  cases hf
  assumption
State after:
no goals

State before:
case a.cons
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
heqh : h = t₁ ∧ hs = bt :: ts
a✝¹ : IsBinTree h
a✝ : 0 < h.rank
hf : IsHeapForest' h.rank (bt :: ts)
⊢ IsBinTree bt
Tactic:
cases hf
State after:
case a.cons.cons
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
heqh : h = t₁ ∧ hs = bt :: ts
a✝⁴ : IsBinTree h
a✝³ : 0 < h.rank
a✝² : IsBinTree bt
a✝¹ : h.rank < bt.rank
a✝ : IsHeapForest' bt.rank ts
⊢ IsBinTree bt

State before:
case a.cons.cons
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
heqh : h = t₁ ∧ hs = bt :: ts
a✝⁴ : IsBinTree h
a✝³ : 0 < h.rank
a✝² : IsBinTree bt
a✝¹ : h.rank < bt.rank
a✝ : IsHeapForest' bt.rank ts
⊢ IsBinTree bt
Tactic:
assumption
State after:
no goals

State before:
case a.a.a.cons
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
heqh : h = t₁ ∧ hs = bt :: ts
a✝¹ : IsBinTree h
a✝ : 0 < h.rank
hf : IsHeapForest' h.rank (bt :: ts)
⊢ IsBinTree bt
Tactic:
cases hf
State after:
case a.a.a.cons.cons
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
heqh : h = t₁ ∧ hs = bt :: ts
a✝⁴ : IsBinTree h
a✝³ : 0 < h.rank
a✝² : IsBinTree bt
a✝¹ : h.rank < bt.rank
a✝ : IsHeapForest' bt.rank ts
⊢ IsBinTree bt

State before:
case a.a.a.cons.cons
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeap (Heap.heap ts₂)
heqh : h = t₁ ∧ hs = bt :: ts
a✝⁴ : IsBinTree h
a✝³ : 0 < h.rank
a✝² : IsBinTree bt
a✝¹ : h.rank < bt.rank
a✝ : IsHeapForest' bt.rank ts
⊢ IsBinTree bt
Tactic:
assumption
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeapForest' 0 (h :: hs)
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
ihts₂ : IsHeapForest' 0 ts₂
h₂₄ : IsHeapForest' 0 ts₃
not_le_le : ∀ (x y : α), le x y = false → le y x = true
heq✝ : t₁ = h'✝ ∧ 0 = idx'✝
hne₂ : True
heqh : h = t₁ ∧ hs = bt :: ts
h✝ : le h'✝.val bt.val = false
heq₃ : List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd = ts₂
⊢ 0 = min 0 0
Tactic:
simp
State after:
no goals

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsMinHeap le (Heap.heap ts₂)
Tactic:
rw[← heq₃]
State after:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsMinHeap le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd))

State before:
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsMinHeap le (Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd))
Tactic:
apply IsMinHeap_eraseIdx
State after:
case a
α : Type u_1
le : α → α → Bool
not_le_le : ∀ (x y : α), ¬le x y = true → le y x = true
le_trans : ∀ (x y z : α), le x y = true → le y z = true → le x z = true
le_rfl : ∀ (z : α), le z z = true
xs : Heap α
y : α
ys : Heap α
h : HeapNodeAux α (Heap α)
hs : List (HeapNodeAux α (Heap α))
h₁ : IsHeap (Heap.heap (h :: hs))
h₂ : IsMinHeap le (Heap.heap (h :: hs))
xs₂ : Heap α
t₁ : HeapNodeAux α (Heap α)
x✝⁴ : List (BinTree α)
x✝³ : ℕ
x✝² : BinTree α × ℕ
bt : BinTree α
ts : List (BinTree α)
h'✝ : BinTree α
idx'✝ : ℕ
heq✝ : (t₁, 0) = (h'✝, idx'✝)
hne₂ : bt :: ts = [] → False
h✝ : ¬le h'✝.val bt.val = true
left✝ : (findMin le ts (1 + 1) (bt, 1)).fst.val = y
x✝¹ x✝ : Heap α
ts₂ ts₃ : List (HeapNodeAux α (Heap α))
heq₃ : Heap.heap (List.eraseIdx (t₁ :: bt :: ts) (findMin le ts (1 + 1) (bt, 1)).snd) = Heap.heap ts₂
heq₄ : (findMin le ts (1 + 1) (bt, 1)).fst.children = Heap.heap ts₃
heq : Heap.heap (mergeNodes le ts₂ ts₃) = ys
heqh : h = t₁ ∧ hs = bt :: ts
⊢ IsMinHeap le (Heap.heap (t₁ :: bt :: ts))