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

Difference between forall and implication during inference #391

Open
twitchyliquid64 opened this issue Sep 23, 2024 · 10 comments
Open

Difference between forall and implication during inference #391

twitchyliquid64 opened this issue Sep 23, 2024 · 10 comments

Comments

@twitchyliquid64
Copy link

Hiya, love the project!

I'm working on inference over SUMO for fun and learning. I (eventually) found the spec for the format here, but I'm afraid im having trouble understanding some of the rule operators.

Implication/bi-implication seem easy enough to implement, I just search the knowledgebase for variables for each value which make the predicates true, and then create new entries in the knowledgebase based on the implication and those variable values.

I'm having trouble understanding forall however. The document gives this example for "All farmers like tractors":

(forall (?F ?T)
 (=>
   (and
     (instance ?F Farmer)
     (instance ?T Tractor))
   (likes ?F ?T)))

How is this different to implication? Wouldn't I end up with the same info in the knowledgebase by just doing:

(=>
  (and
    (instance ?F Farmer)
    (instance ?T Tractor))
  (likes ?F ?T)))

Maybe the difference is just intent and not relevant for inference, in which case I don't understand when I would use forall vs implication.

Thanks!
Tom

@arademaker
Copy link
Contributor

In SUO-KIF, variables that were not explicit instantiated are assumed to be universally instantiated. So the two formulas are equivalent. Just the second is a simplied version of the first without the explicit quantifier. Any tool reading the SUO-KIF file need to fill the gaps and add the implicit universal quantifier in all formulas were any free variable can be found.

@apease
Copy link
Contributor

apease commented Sep 23, 2024 via email

@twitchyliquid64
Copy link
Author

Thanks Adam & Alexander!

That makes sense R.E implicit quantification.

I’ve skimmed those YouTube videos, I’ll be sure to take a better look.

Last question while I’m here: I understand the ‘exists’ operator is existential quantification, but in the context of inference is the engine meant to create missing concepts if such a concept doesn’t exist? (As opposed to implications that seem to create relations that don’t exist but never create concepts themselves).

@apease
Copy link
Contributor

apease commented Sep 24, 2024

I think a better way to say this is that an existentially quantified variable denotes a constant term. If I say every horse has a head (=> (instance ?H Horse) (and (instance ?X Head) (part ?X ?H))) I've made a general statement that otherwise would have required explicitly saying "Bessie is a horse and BessiesHead is a part of Bessie", "Secretariat is a horse..." etc. I've made a general statement that doesn't require proliferating named terms such as BessiesHead. I'm not sure what you mean about implications. Any implication is a relationship among all the constant terms that appear within it. If you use a logic beyond first order, as we do with SUMO, you do have the possibility of writing formulas in which an existential quantified variables denotes a relation as in "If John and Stan are 'kin' then there exists a relation between them that is an instance of 'familyRelation'"

@twitchyliquid64
Copy link
Author

Gotcha thanks! A combination of staring at the code I wrote and watching a bunch more of your videos made it clear.

For my question, the thing that I had missed was that relationships (I think yall call them 'functional terms') themselves are just concepts without a name, so an implication in the context of SUMO implication creating a relation is absolutely creating a concept.

The idea that implication is CNF-equivalent (=> a b is the same as or (not a) b) still breaks my brain if i try and think about it outside of the context of unification/search, but hopefully it will get clearer over time.

I have another question about relations in SUMO, but i'll stay on topic and open a different issue.

Thanks again!!

@apease
Copy link
Contributor

apease commented Oct 1, 2024

Hi Tom, a truth table may help - two truth tables that have all the same values are logically equivalent. Even if your intuitions haven't sync'ed up, at least you have proven when two formulas are the same, and that's the case for a->b <-> -a v b

@twitchyliquid64
Copy link
Author

I see how they are equivalent in the context of resolving a sentence to some truth value, but I don't see how the CNF form represents the the modus-ponens knowledge-creation of an implication a; if a then b; therefore b. Or maybe I am conflating two different things.

@apease
Copy link
Contributor

apease commented Oct 1, 2024

if you have a and ~a v b then b must be true - same as modus ponens

@twitchyliquid64
Copy link
Author

twitchyliquid64 commented Oct 2, 2024

Could it be that simple? Any or (not a) b is just an implication in the domain of discourse? During inference/search I can just rewrite that to implication and (if true) keep following that path?

@apease
Copy link
Contributor

apease commented Oct 3, 2024

The resolution rule over CNF formulas does exactly that.

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

3 participants