From Coursera's Introduction to Logic Notes, Chapter 6, Relational Logic:
Propositional Logic does a good job of allowing us to talk about relationships among individual propositions, and it gives us the machinery to derive logical conclusions based on these relationships. Suppose, for example, we believe that, if Jack knows Jill, then Jill knows Jack. Suppose we also believe that Jack knows Jill. From these two facts, we can conclude that Jill knows Jack using a simple application of Modus Ponens.Leaving aside the question of whether "knows" in English is in fact always a reciprocal relation, can logicagent (http://subbot.org/logicagent) handle the above example?
---
C:\logicagent>ruby logicbot.rb Hello I have loaded C:/logicagent/logicagent-api.yaml. C:/logicagent/graph.yaml loaded. > reset graph Okay, I have reset the graph. > if Jack knows Jill, then Jill knows Jack. Okay, if Jack knows Jill, then Jill knows Jack. > Jack knows Jill. Okay, Jack knows Jill. > Does Jill know Jack? I have no knowledge that Jill is know Jack. >---
So, out of the box, no. I have to add a rule to make the program understand the reciprocal nature of "knows".
---
> reset graph Okay, I have reset the graph. > logicbot: if input =~ /if (.*) knows (.*), then (.*) knows (.*)/i then self.send("#{$1} knows #{$2}"); self.send("#{$2} knows #{$1}"); self.send("#{$3} knows #{$4}"); self.send("#{$4} knows #{$3}"); response = "Okay" end Okay [...] > if Jack knows Jill, then Jill knows Jack. Okay > Jack knows Jill. Okay, Jack knows Jill. > Does Jill know Jack? I have no knowledge that Jill is know Jack.---
Now I add a linguistic rule to put "know" and "knows" in an equivalence relation:
---
> know = knows Okay, know = knows. > Does Jill know Jack? Yes, Jill is know Jack.---
Now I add a rule to transform "is know" into "knows":
---
> logicbot: if response =~ / is know /i then response.sub!(/ is know /, ' knows ') end Okay [...] > Does Jill know Jack? Yes, Jill knows Jack.---
So now logicagent can do the example from the passage quoted at the top.
---
The Chapter 6 Notes continue, making the case for Relational Logic:
Unfortunately, when we want to say things more generally, we find that Propositional Logic is inadequate. Suppose, for example, that we wanted to say that, in general, if one person knows a second person, then the second person knows the first. Suppose, as before, that we believe that Jack knows Jill. How do we express the general fact in a way that allows us to conclude that Jill knows Jack? Here, Propositional Logic is inadequate; it gives us no way of encoding this more general belief in a form that captures its full meaning and allows us to derive such conclusions.So, can logicagent handle this more general example?
First I reset the graph to erase the previous example. The rules are not stored in the graph so they remain until I quit the program; but I need to add the "know = knows" relation again.
---
> reset graph Okay, I have reset the graph. > know = knows Okay, know = knows. > if one person knows a second person, then the second person knows the first. Okay > Jack knows Jill. Okay, Jack knows Jill. > Does Jill know Jack? I have no knowledge that Jill knows Jack.---
So now I want to ground the general terms contained in the "if-then" statement:
---
> Jack = one person Okay, Jack = one person. > Jill = a second person Okay, Jill = a second person. > Does Jill know Jack? Yes, Jill knows Jack. >---
Thus logicagent encodes the general belief about the "know" relation in a form that allows us to derive a conclusion from a grounding of the terms.
Here's a further test:
---
> reset graph Okay, I have reset the graph. > if A knows B, then B knows A. Okay > Jack knows Jill. Okay, Jack knows Jill. > Jack = A Okay, Jack = A. > Jill = B Okay, Jill = B. > does Jill know Jack? I have no knowledge that Jill knows Jack. > know = knows Okay, know = knows. > does Jill know Jack? Yes, Jill knows Jack. >---
(I forgot to set "know = knows" until the end. I think I can make such linguistic propositions automatic. Note also that the rules are in the Ruby programming language; eventually I would like to have the program accept rules in natural language and translate them into code automatically.)
---
The course Notes continue with the case for Relational Logic:
Relational Logic is an extension of Propositional Logic that solves this problem. The trick is to augment our language with two new linguistic features, viz. variables and quantifiers. With these new features, we can express information about multiple objects without enumerating those objects; and we can express the existence of objects that satisfy specified conditions without saying which objects they are.It seems to me that you can add quantifiers and general terms to Propositional Logic too; the key difference that Relational Logic introduces is a change in syntax from subject-predicate to function-argument. R(a,b) instead of aRb.
The case for Relational Logic, as made by these Notes, glosses over the syntax change. (Note the claim that Relational Logic introduces "linguistic features", while ignoring the abandonment of the most basic syntactic structure of natural language.) It is precisely the syntax change that I wish to challenge.
---
Another (raw, unedited) dialog with logicagent, showing how it can be made to understand "If Bess likes a girl, Abby also likes her" (from the Sorority World part of the Chapter 6 Notes), is http://subbot.org/intrologic/relational/bessandabby.txt.