case cons.refl
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
⊢ realSize (cons r a c s) =
    realSize
        (merge le (HeapNode.toHeap (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).node)
          (FindMin.before (findMin le (cons r a c) s { before := id, val := a, node := c, next := s })
            (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).next)) +
      1
α : Type u_1
le : α → α → Bool
a : α
s' s : Heap α
eq : deleteMin le s = some (a, s')
⊢ realSize s = realSize s' + 1
cases s with cases eq | cons r a c s => ?_
case cons.refl
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
this :
  Std.BinomialHeapImp.FindMin.HasSize (findMin le (cons r a c) s { before := id, val := a, node := c, next := s })
    (HeapNode.realSize c + realSize s + 1)
⊢ realSize (cons r a c s) =
    realSize
        (merge le (HeapNode.toHeap (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).node)
          (FindMin.before (findMin le (cons r a c) s { before := id, val := a, node := c, next := s })
            (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).next)) +
      1
case cons.refl
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
⊢ realSize (cons r a c s) =
    realSize
        (merge le (HeapNode.toHeap (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).node)
          (FindMin.before (findMin le (cons r a c) s { before := id, val := a, node := c, next := s })
            (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).next)) +
      1
have : (s.findMin le (cons r a c) ⟨id, a, c, s⟩).HasSize (c.realSize + s.realSize + 1) :=
  Heap.realSize_findMin (c.realSize + 1) (by simp) (Nat.add_right_comm ..) ⟨0, by simp⟩
case cons.refl
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
⊢ Std.BinomialHeapImp.FindMin.HasSize (findMin le (cons r a c) s { before := id, val := a, node := c, next := s })
      (HeapNode.realSize c + realSize s + 1) →
    realSize (cons r a c s) =
      realSize
          (merge le (HeapNode.toHeap (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).node)
            (FindMin.before (findMin le (cons r a c) s { before := id, val := a, node := c, next := s })
              (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).next)) +
        1
case cons.refl
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
this :
  Std.BinomialHeapImp.FindMin.HasSize (findMin le (cons r a c) s { before := id, val := a, node := c, next := s })
    (HeapNode.realSize c + realSize s + 1)
⊢ realSize (cons r a c s) =
    realSize
        (merge le (HeapNode.toHeap (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).node)
          (FindMin.before (findMin le (cons r a c) s { before := id, val := a, node := c, next := s })
            (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).next)) +
      1
revert this
no goals
case cons.refl
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
⊢ Std.BinomialHeapImp.FindMin.HasSize (findMin le (cons r a c) s { before := id, val := a, node := c, next := s })
      (HeapNode.realSize c + realSize s + 1) →
    realSize (cons r a c s) =
      realSize
          (merge le (HeapNode.toHeap (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).node)
            (FindMin.before (findMin le (cons r a c) s { before := id, val := a, node := c, next := s })
              (findMin le (cons r a c) s { before := id, val := a, node := c, next := s }).next)) +
        1
match s.findMin le (cons r a c) ⟨id, a, c, s⟩ with
| { before, val, node, next } =>
  intro ⟨m, ih₁, ih₂⟩; dsimp only at ih₁ ih₂
  rw [realSize, Nat.add_right_comm, ih₂]
  simp only [realSize_merge, HeapNode.realSize_toHeap, ih₁, Nat.add_assoc, Nat.add_left_comm]
no goals
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
⊢ ∀ (s : Heap α), realSize (cons r a c s) = HeapNode.realSize c + 1 + realSize s
simp
no goals
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
⊢ (∀ (s_1 : Heap α),
      realSize (FindMin.before { before := id, val := a, node := c, next := s } s_1) = 0 + realSize s_1) ∧
    HeapNode.realSize c + realSize s + 1 =
      0 + HeapNode.realSize { before := id, val := a, node := c, next := s }.node +
          realSize { before := id, val := a, node := c, next := s }.next +
        1
simp
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
before : Heap α → Heap α
val : α
node : HeapNode α
next : Heap α
m : Nat
ih₁ :
  ∀ (s : Heap α),
    realSize (FindMin.before { before := before, val := val, node := node, next := next } s) = m + realSize s
ih₂ :
  HeapNode.realSize c + realSize s + 1 =
    m + HeapNode.realSize { before := before, val := val, node := node, next := next }.node +
        realSize { before := before, val := val, node := node, next := next }.next +
      1
⊢ realSize (cons r a c s) =
    realSize
        (merge le (HeapNode.toHeap { before := before, val := val, node := node, next := next }.node)
          (FindMin.before { before := before, val := val, node := node, next := next }
            { before := before, val := val, node := node, next := next }.next)) +
      1
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
before : Heap α → Heap α
val : α
node : HeapNode α
next : Heap α
⊢ Std.BinomialHeapImp.FindMin.HasSize { before := before, val := val, node := node, next := next }
      (HeapNode.realSize c + realSize s + 1) →
    realSize (cons r a c s) =
      realSize
          (merge le (HeapNode.toHeap { before := before, val := val, node := node, next := next }.node)
            (FindMin.before { before := before, val := val, node := node, next := next }
              { before := before, val := val, node := node, next := next }.next)) +
        1
intro ⟨m, ih₁, ih₂⟩
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
before : Heap α → Heap α
val : α
node : HeapNode α
next : Heap α
m : Nat
ih₁ : ∀ (s : Heap α), realSize (before s) = m + realSize s
ih₂ : HeapNode.realSize c + realSize s + 1 = m + HeapNode.realSize node + realSize next + 1
⊢ realSize (cons r a c s) =
    realSize
        (merge le (HeapNode.toHeap { before := before, val := val, node := node, next := next }.node)
          (FindMin.before { before := before, val := val, node := node, next := next }
            { before := before, val := val, node := node, next := next }.next)) +
      1
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
before : Heap α → Heap α
val : α
node : HeapNode α
next : Heap α
m : Nat
ih₁ :
  ∀ (s : Heap α),
    realSize (FindMin.before { before := before, val := val, node := node, next := next } s) = m + realSize s
ih₂ :
  HeapNode.realSize c + realSize s + 1 =
    m + HeapNode.realSize { before := before, val := val, node := node, next := next }.node +
        realSize { before := before, val := val, node := node, next := next }.next +
      1
⊢ realSize (cons r a c s) =
    realSize
        (merge le (HeapNode.toHeap { before := before, val := val, node := node, next := next }.node)
          (FindMin.before { before := before, val := val, node := node, next := next }
            { before := before, val := val, node := node, next := next }.next)) +
      1
dsimp only at ih₁ ih₂
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
before : Heap α → Heap α
val : α
node : HeapNode α
next : Heap α
m : Nat
ih₁ : ∀ (s : Heap α), realSize (before s) = m + realSize s
ih₂ : HeapNode.realSize c + realSize s + 1 = m + HeapNode.realSize node + realSize next + 1
⊢ m + HeapNode.realSize node + realSize next + 1 =
    realSize
        (merge le (HeapNode.toHeap { before := before, val := val, node := node, next := next }.node)
          (FindMin.before { before := before, val := val, node := node, next := next }
            { before := before, val := val, node := node, next := next }.next)) +
      1
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
before : Heap α → Heap α
val : α
node : HeapNode α
next : Heap α
m : Nat
ih₁ : ∀ (s : Heap α), realSize (before s) = m + realSize s
ih₂ : HeapNode.realSize c + realSize s + 1 = m + HeapNode.realSize node + realSize next + 1
⊢ realSize (cons r a c s) =
    realSize
        (merge le (HeapNode.toHeap { before := before, val := val, node := node, next := next }.node)
          (FindMin.before { before := before, val := val, node := node, next := next }
            { before := before, val := val, node := node, next := next }.next)) +
      1
rw [realSize, Nat.add_right_comm, ih₂]
no goals
α : Type u_1
le : α → α → Bool
r : Nat
a : α
c : HeapNode α
s : Heap α
before : Heap α → Heap α
val : α
node : HeapNode α
next : Heap α
m : Nat
ih₁ : ∀ (s : Heap α), realSize (before s) = m + realSize s
ih₂ : HeapNode.realSize c + realSize s + 1 = m + HeapNode.realSize node + realSize next + 1
⊢ m + HeapNode.realSize node + realSize next + 1 =
    realSize
        (merge le (HeapNode.toHeap { before := before, val := val, node := node, next := next }.node)
          (FindMin.before { before := before, val := val, node := node, next := next }
            { before := before, val := val, node := node, next := next }.next)) +
      1
simp only [realSize_merge, HeapNode.realSize_toHeap, ih₁, Nat.add_assoc, Nat.add_left_comm]