Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogicList type needed #1

Open
acfoltzer opened this issue Jan 29, 2012 · 3 comments
Open

LogicList type needed #1

acfoltzer opened this issue Jan 29, 2012 · 3 comments

Comments

@acfoltzer
Copy link
Owner

Like in previous incarnations of this system, we need an alternative to the built-in list type:

data [a] = [] | a : [a]

This isn't suitable for our purposes, since we don't necessarily have a tail that's actually a list, but the : constructor requires one. Instead, we need a list that's more like this:

data [a] = [] | a : (LogicVar [a])

This type would rule out improper lists, since the ground value for the tail, if any, is another list. However, we can't yet overload the []/: syntax, so it'll probably have to be something awkward like:

data LogicList a = Nil | Cons a (LogicVar (LogicList a))

Does this type sound good? Once we decide on it, we should provide an alternative Data.List module, although it remains to be seen how higher-order combinators might behave in this setting.

@dfried00
Copy link
Collaborator

I think it is a reasonable first attempt, but what will it do with Oleg
Numbers and
reification in general.

... Dan

On Sun, Jan 29, 2012 at 3:13 PM, Adam Foltzer <
[email protected]

wrote:

Like in previous incarnations of this system, we need an alternative to
the built-in list type:

data [a] = [] | a : [a]

This isn't suitable for our purposes, since we don't necessarily have a
tail that's actually a list, but the : constructor requires one. Instead,
we need a list that's more like this:

data [a] = [] | a : (LogicVar [a])

This type would rule out improper lists, since the ground value for the
tail, if any, is another list. However, we can't yet overload the []/:
syntax, so it'll probably have to be something awkward like:

data LogicList a = Nil | Cons a (LogicVar (LogicList a))

Does this type sound good? Once we decide on it, we should provide an
alternative Data.List module, although it remains to be seen how
higher-order combinators might behave in this setting.


Reply to this email directly or view it on GitHub:
https://github.com/acfoltzer/typed-logic-programming/issues/1

@acfoltzer
Copy link
Owner Author

Well, Oleg Numbers are isomorphic to LogicList Bool, so if we can do one, we should have the other.

Reification (and unification) are a pain to define right now with lots of boilerplate, but there are generic programming techniques to address this. Now that we've escaped from the tyranny of the all-encompassing sum type for values, though, it should be mostly straightforward, although there will be interesting problems with recursively-defined types.

@dfried00
Copy link
Collaborator

There is a paper called "Typed Logic Variables" that you should look at.
If you can't find it, the author's last name is Classen or Claussen.

... Dan

On Sun, Jan 29, 2012 at 3:25 PM, Adam Foltzer <
[email protected]

wrote:

Well, Oleg Numbers are isomorphic to LogicList Bool, so if we can do
one, we should have the other.

Reification (and unification) are a pain to define right now with lots of
boilerplate, but there are generic programming techniques to address this.
Now that we've escaped from the tyranny of the all-encompassing sum type
for values, though, it should be mostly straightforward, although there
will be interesting problems with recursively-defined types.


Reply to this email directly or view it on GitHub:

https://github.com/acfoltzer/typed-logic-programming/issues/1#issuecomment-3710936

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants