[ANN] Logic Expressions v2.1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] Logic Expressions v2.1

Daniel Altman
Hi all, after a lot of time, a new version of Logic Expressions is now
available on SqueakMap.


>From the package description:

This is a model of first order logic expressions, allowing you to manipulate
them as objects instead of just strings.

Prerequisites:
    -Refactoring Browser
    -SmaCC Runtime Package
    -SmaCC Development Package

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 | 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 valueDomains: {'x' -> #(2 4 6 8 10 12 )}.

See more examples in the Logic-Tests category.

I hope you enjoy it!
Dany





Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Logic Expressions v2.1

Alexandre Bergel-2
> Hi all, after a lot of time, a new version of Logic Expressions is now
> available on SqueakMap.

How would you write the N-Queens in your Prolog-like language ?
http://www.sics.se/sicstus/docs/3.12.5/html/sicstus/N-Queens.html

Cheers,
Alexandre


>
>
>> From the package description:
>
> This is a model of first order logic expressions, allowing you to  
> manipulate
> them as objects instead of just strings.
>
> Prerequisites:
>     -Refactoring Browser
>     -SmaCC Runtime Package
>     -SmaCC Development Package
>
> 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 | 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 valueDomains: {'x' -> #(2 4 6 8 10 12 )}.
>
> See more examples in the Logic-Tests category.
>
> I hope you enjoy it!
> Dany
>
>
>
>
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.cs.tcd.ie/Alexandre.Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Logic Expressions v2.1

Daniel Altman
Hi Alex, may be I wasn't clear but this package IS NOT a functional
language.
It is just a model of logic expressions that make it posible to use them as
objects instead of strings, evaluating them and operating with them.

More examples:

If you want to see if  "(p => q)" holds for any combination of true/false
values, you can do:

    exp := LExpression fromString: '{p => q}'.
    exp value: {'p' -> true. 'q' -> true}.
    ...
    exp value: {'p' -> false. 'q' -> false}.

Then you can for example combine that expression with "or z" to get a new
expression:

    expOrZ := exp | (LVariable named: #z).

And you will get an object that represents the expression "((p => q) or z)".


Another important feature is the ability to use blocks as predicates of the
expressions, for example:

    expEven := LExpression fromString: '{[x even]}'.
    expEven valueVariable: 2 --> true
    expEven valueVariable: 1 --> false


Hope this clarify things
Dany




"Alexandre Bergel" <[hidden email]> wrote in message
news:[hidden email]...

>> Hi all, after a lot of time, a new version of Logic Expressions is now
>> available on SqueakMap.
>
> How would you write the N-Queens in your Prolog-like language ?
> http://www.sics.se/sicstus/docs/3.12.5/html/sicstus/N-Queens.html
>
> Cheers,
> Alexandre
>
>
>>
>>
>>> From the package description:
>>
>> This is a model of first order logic expressions, allowing you to
>> manipulate
>> them as objects instead of just strings.
>>
>> Prerequisites:
>>     -Refactoring Browser
>>     -SmaCC Runtime Package
>>     -SmaCC Development Package
>>
>> 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 | 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 valueDomains: {'x' -> #(2 4 6 8 10 12 )}.
>>
>> See more examples in the Logic-Tests category.
>>
>> I hope you enjoy it!
>> Dany
>>
>>
>>
>>
>>
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.cs.tcd.ie/Alexandre.Bergel
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>




Reply | Threaded
Open this post in threaded view
|

Re: [ANN] Logic Expressions v2.1

Alexandre Bergel-2
> Hope this clarify things

It did.

Thanks !
Alexandre


> Dany
>
>
>
>
> "Alexandre Bergel" <[hidden email]> wrote in message
> news:[hidden email]...
>>> Hi all, after a lot of time, a new version of Logic Expressions  
>>> is now
>>> available on SqueakMap.
>>
>> How would you write the N-Queens in your Prolog-like language ?
>> http://www.sics.se/sicstus/docs/3.12.5/html/sicstus/N-Queens.html
>>
>> Cheers,
>> Alexandre
>>
>>
>>>
>>>
>>>> From the package description:
>>>
>>> This is a model of first order logic expressions, allowing you to
>>> manipulate
>>> them as objects instead of just strings.
>>>
>>> Prerequisites:
>>>     -Refactoring Browser
>>>     -SmaCC Runtime Package
>>>     -SmaCC Development Package
>>>
>>> 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 | 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 valueDomains: {'x' -> #(2 4 6 8 10 12 )}.
>>>
>>> See more examples in the Logic-Tests category.
>>>
>>> I hope you enjoy it!
>>> Dany
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.cs.tcd.ie/Alexandre.Bergel
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>>
>
>
>
>

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.cs.tcd.ie/Alexandre.Bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.