I have a standard datatype representing formulae of predicate logic. A function representing a natural deduction elimination rule for disjunction might look like:
d_el p q =
if p =: (Dis r s) && q =: (Neg r) then Just s else
if q =: (Dis r s) && p =: (Neg r) then Just s else
Nothing where r,s free
x =: y = (x =:= y) == success
Instead of evaluating to Nothing when unification fails, the function returns no solutions in PACKS
:
logic> d_el (Dis Bot Top) (Not Bot)
Result: Just Top
More Solutions? [Y(es)/n(o)/a(ll)] n
logic> d_el (Dis Bot Top) (Not Top)
No more solutions.
What am I missing, and why doesn't el
evaluate to Nothing
when unification fails?
curry
tag. – Inhumane