Anonymous user
Proof/Haskell: Difference between revisions
no edit summary
Underscore (talk | contribs) (I am a math major, hear me roar.) |
No edit summary |
||
Line 88:
subst :: IntExpr -> Equals -> Proof IntExpr
{- A convenience function used internally. -}
subst a (a' :== b)
▲ else failf2 "subst: %s not the same as %s" a a'
{- All the remaining functions are rules of inference, which allow
Line 108 ⟶ 107:
{- If a = A, b = B, ..., z = Z,
then a + b + ... + z = A + B + ... + Z. -}
equalTerms sum@(Sum l) eqs
| otherwise = failf2 "equalTerms: %s and %s have different lengths" l eqs
containsFactor :: IntExpr -> IntExpr -> Proof Divides
{- If p == a*b,
then a | p. -}
expr@(Product l) `containsFactor` x
y `containsFactor` _ = failf "containsFactor: %s not a product" y
|