Deriving facts using rulesSeptember 11, 2008
The next area of research I'd like to explore is that of deriving facts about the world using rules.
Rules consist of two parts:
1. | A list of conditions that must be met for the rule to apply. |
2. | A conclusion or implication, which says something is true if all of the conditions are true. |
What makes rules useful is that any part of a condition can left undefined and represented by a variable, which is then used in another condition or the conclusion.
For example:
Conditions:1. | A person's first name is $1 |
2. | A person's last name is $2 |
Conclusion:The person's full name is '$1 $2'.
This can notated as follows:
rule: $1 is_a person $1.first_name = $2 $1.last_name = $3 -> $1.full_name = '$1 $2' |
|
Some more examples:
rule: $1 on_top_of $2 -> ! $2 on_top_of $1 |
|
rule: $1 is_a person $1 born_in Canada -> $1 is_a Canadian |
|
rule: $1 is_a person $2 is_a person $1.birth_date > $2.birth_date $1 older_than $2 |
|
etc.
Rules come in very handy when trying to answer questions. For instance, consider the following story:
My first name is Daniel My last name is Bigham What is my full name? |
|
The AI wouldn't know the value of
speaker.full_name implicitly because it was never told its value. But it can derive that value given what it knows.
There are three primary cases where rules can be applied:
1. | When the AI is told something, it can search for rules for which what it was told matches a condition of the rule. Finding these rules, it can then check whether it has all the necessary information to indicate that the conclusion is true, and if it is, it can update its brain state with the derived information in addition to what it was specifically told. |
 | In the example above, an AI could apply speaker.full_name = 'Daniel Bigham' as soon as the second statement was made, long before the question was even posed. |
2. | When the AI is asked something. In other words, when asked for the speaker's full name, the AI could search for rules whose conclusions match the information it is looking for, and then determine whether all of the conditions are met. |
3. | In a sort of recursive scenario, checking to see whether a rule can be applied may involve using other values that are not explictly known. This can trigger a second rule search to see whether that value can be derived, and so on. What you get is a kind of search tree. Obviously you wouldn't want a scenario where the AI goes off and spends 5 minutes exploring a huge search tree, so the depth to which it explores would need to be set to a reasonable number. |
Exercise 11: Drawing IsA treesSeptember 9, 2008
SummaryEnhance the
view details mode of the web application to support drawing graphical IsA trees. Accomplish this by using GraphViz to render a PNG.
SolutionWeb UIClick hereNOTE: The graph drawing component will only work if my home PC is turned on.

Exercise 10: Parsing numbersSeptember 9, 2008
SummaryThis exercise involves introducing yet another transformation type, the numeric transformation, which allows numbers to be added or multiplied. It is to be used to allow numbers, written in long form, to be parsed into their representative integers.
For example, "one thousand one hundred and eleven" is parsed to become 1111.
See
this post for more details.
Test casesClick hereSolutionClick hereWeb UIClick hereolder >>