[ANN] Logic Expressions

Daniel Altman daniel at qkss.com
Wed Nov 26 18:09:19 UTC 2003


This new package models First Order Logic. I added it to SM and it home page
is http://minnow.cc.gatech.edu/squeak/3539

Package Description:

Prerequisites:
- SmaCC Runtime Package
- Smacc Development Package

You can use Logic to express, manipulate and evaluate your formulas.

For example, inspect the following lines to get the expression corresponding
to "(p => q) = (not p or q)":

    | p q |
    p _ LVariable named: 'p'.
    q _ LVariable named: 'q'.
    p => q equiv: (p not orWith: q).

Now, the same formula could be created using:
    LExpression fromString: '{p=>q = not p or q}'

More complex formulas can also be created and evaluated, for example try:
    | exp |
    exp _ LExpression fromString: '{V(x)[x even]}'.
    exp value: exp emptyValuation
          domains: (Dictionary newFrom: {'x' -> #(2 4 6 8 10 12 )}).

See more examples in the tests.

I hope you enjoy it!
Dany

-- 
======================================
Daniel Altman
Buenos Aires, Argentina







More information about the Squeak-dev mailing list