> Proof a -> Theorem a
verify proof =
  let v (UseTheorem t) = t
      v (MP pr pr')    = mp (v pr) (v pr')
  in case assms proof of
    []  -> v proof
    [a] -> v (discharge a proof)
    as  -> error errorMsg
      where errorMsg = "Undischarged assumptions:\n" ++
                       unlines [ "  " ++ show a | a <- as ]

-- | matchMPInst (P → Q) (Γ ⊢ P') inst
-- attempts to match P with P', instantiates any remaining variables with inst, and
-- then applies MP.
matchMPInst :: (Eq a, Ord b, Sh
verify :: (Ord a, Show a) => Proof a -> Theorem a
verify proof =
  let v (UseTheorem t) = t
      v (MP pr pr')    = mp (v pr) (v pr')
  in case assms proof of
    []  -> v proof
    [a] -> v (discharge a proof)
    as  -> error errorMsg
      where errorMsg = "Undischarged assumptions:\n" ++
                       unlines [ "  " ++ show a | a <- as ]

-- | matchMPInst (P → Q) (Γ ⊢ P') inst
-- attempts to match P with P', instantiates any remaining variables with inst, and
-- then applies MP.
verify proof =
  let v (UseTheorem t) = t
      v (MP pr pr')    = mp (v pr) (v pr')
  in case assms proof of
    []  -> v proof
    [a] -> v (discharge a proof)
    as  -> error errorMsg
      where errorMsg = "Undischarged assumptions:\n" ++
                       unlines [ "  " ++ show a | a <- as ]

-- | matchMPInst (P → Q) (Γ ⊢ P') inst
-- attempts to match P with P', instantiates any remaining variables with inst, and
-- then applies MP.