• Image

 

Image

Reasoning from Explicit Statements

03/01/2020

Here we reimagine the Socrates "Simple Logic Problem" from earlier in a way where we just describe general lexical rules for learning.  We write down a few rules and just tell the program "Socrates is a man. All men are mortal. Also, Socrates is dead."  Then we directly query the logic to see what the program thinks of the questions "Is socrates a man?" "Are men mortal?" "Is Socrates dead?"  It learned the rules very well!  Note the last 5 rules at the end were actually generated by what was learned. Neat!

 

Here's how it worked:

 

 

// our initial dictionary of words
socrates:N
is:{V,#be}
a:Art
man:{N,#man}
men:{N,#man}
all:Adj
are:{V,#be}
mortal:{Adj,N}
dead:{Adj,N}
also:Conj

 

// our dictionary of concepts (for conjucations, plural, etc)
{man,men}=>#man
{is,are}=>#be
{mortal}=>#mortal
{dead}=>#dead
{#man}:N
{#be}:V
{#mortal}:{Adj,N}
{#dead}:{Adj,N}

 

// a few rules of grammar
[|Adv] |V [|NP] => |VP
|NP |VP => |S
[|Art] [|Adj] |N => |NP

 

// a concept flattener (Articles, Adjectives and Nouns can hang out together)
[<a>|Art] [<b>|Adj] <c>|N => {<a>,<b>,<c>}

 

// here we actually make a new rule from an general statement concept!
all <b>|N #be <c>|Adj => {|<b> => |<c>}

 

// here we learn <a> #be <b> means <b> is a property of <a>!
<a>|NP #be <b>|NP => <a>:<b>

 

// Then we start bringing in our input with the >> operator.

 

// Here is a definite declaration association with property
>> socrates is a man .

 

// Here is a generic association.
>> all men are mortal .

 

// Then one last idea we can learn.
>> also , socrates is dead .

 


// and then we test:

? socrates|#man
#YES

 

? socrates|#dead
#YES

 

? socrates|#mortal
#YES

 

? #man|#mortal
#YES

 

// Here's what the stream looks like

###dumpstream
{}
1 1 2 ** {_socrates_#be,_socrates_is}
3 1 4 **** {_socrates__#be_#man,_socrates__#be__a_#man,_socrates__#be__a_man,_socrates__#be_man,_socrates__is_#man,_socrates__is__a_#man,_socrates__is__a_man,_socrates__is_man}
0 1 1 * {socrates}
2 2 4 *** {_#be_#man,_#be__a_#man,_#be__a_man,_#be_man,_is_#man,_is__a_#man,_is__a_man,_is_man}
0 2 2 * {#be,is}
1 3 4 ** {#man,_a_#man,_a_man,a,man}
0 3 3 * {a}
0 4 4 * {#man,man}
0 5 5 * {.}
1 6 7 ** {#man,_all_#man,_all_men,all,men}
2 6 8 *** {_#man_are,__all_#man_are,__all_men_are,_men_are}
2 6 9 **** {_#man__#be_#mortal,_#man__#be_mortal,_#man__are_#mortal,_#man__are_mortal,__all_#man__#be_#mortal,__all_#man__#be_mortal,__all_#man__are_#mortal,__all_#man__are_mortal,__all_men__#be_#mortal,__all_men__#be_mortal,__all_men__are_#mortal,__all_men__are_mortal,_men__#be_#mortal,_men__#be_mortal,_men__are_#mortal,_men__are_mortal}
0 6 6 * {all}
1 7 8 ** {_#man_#be,_#man_are,_men_#be,_men_are}
2 7 9 *** {_#man__#be_#mortal,_#man__#be_mortal,_#man__are_#mortal,_#man__are_mortal,_men__#be_#mortal,_men__#be_mortal,_men__are_#mortal,_men__are_mortal}
0 7 7 * {#man,men}
1 8 9 ** {_#be_#mortal,_#be_mortal,_are_#mortal,_are_mortal}
0 8 8 * {#be,are}
0 9 9 * {#mortal,mortal}
0 10 10 * {.}
0 11 11 * {also}
1 12 13 ** {_socrates_#be,_socrates_is}
2 12 14 *** {_socrates__#be_#dead,_socrates__#be_dead,_socrates__is_#dead,_socrates__is_dead}
0 12 12 * {socrates}
1 13 14 ** {_#be_#dead,_#be_dead,_is_#dead,_is_dead}
0 13 13 * {#be,is}
0 14 14 * {#dead,dead}
0 15 15 * {.}

 

 

// Here are the attributed properties:

###dumpsets

// dump_sets
_is_dead:VP
_socrates__#be_dead:S
_socrates__#be__a_#man:S
_socrates__is_#man:S
__all_#man__are_mortal:S
_all_#man:NP
_all_#man:mortal
_all_#man:#mortal
_are_#mortal:VP
_#man__#be_mortal:S
#man:NP
#man:mortal
#man:N
#man:#mortal
#mortal:N
#mortal:Adj
#mortal:NP
_socrates_#be:S
_men__#be_mortal:S
_#man_are:S
_#be__a_man:VP
_#man__#be_#mortal:S
_men_#be:S
#dead:Adj
#dead:NP
#dead:N
__all_#man__#be_#mortal:S
_socrates__#be_#dead:S
_socrates__is_#dead:S
_#be_#dead:VP
_socrates_is:S
_#be_man:VP
_is_man:VP
_socrates__is__a_#man:S
__all_men__are_#mortal:S
dead:N
dead:Adj
dead:NP
_is__a_#man:VP
#be:VP
#be:V
all:Adj
mortal:N
mortal:NP
mortal:Adj
man:mortal
man:NP
man:#mortal
man:N
man:#man
_are_mortal:VP
a:Art
_men__#be_#mortal:S
_#man__are_mortal:S
_#be_mortal:VP
_#be__a_#man:VP
_a_man:NP
__all_#man__#be_mortal:S
is:V
is:VP
is:#be
_#be_#mortal:VP
_is__a_man:VP
_all_men:#mortal
_all_men:mortal
_all_men:NP
__all_men__are_mortal:S
_#man__are_#mortal:S
_#be_#man:VP
__all_men__#be_mortal:S
_#be_dead:VP
_socrates__is__a_man:S
_socrates__#be_man:S
socrates:_a_#man
socrates:#man
socrates:#dead
socrates:N
socrates:#mortal
socrates:NP
socrates:dead
socrates:_a_man
socrates:man
socrates:mortal
_is_#man:VP
__all_#man_are:S
_men_are:S
also:Conj
__all_men__#be_#mortal:S
_#man_#be:S
__all_men_are:S
men:#mortal
men:N
men:#man
men:NP
men:mortal
are:#be
are:V
are:VP
_a_#man:NP
__all_#man__are_#mortal:S
_men__are_#mortal:S
_men__are_mortal:S
_socrates__is_man:S
_socrates__is_dead:S
_is_#dead:VP
_socrates__#be_#man:S
_socrates__#be__a_man:S

 

 

// And the rules once all is said and done:

###dumprules
// dump_rules
{man,men}=>#man
{is,are}=>#be
{mortal}=>#mortal
{dead}=>#dead
[|Adv] |V [|NP]=>|VP
|NP |VP=>|S
[|Art] [|Adj] |N=>|NP
[<a>|Art] [<b>|Adj] <c>|N=>{<a>,<b>,<c>}
(all <b>|N #be <c>|Adj)=>{|<b>=>|<c>}
(<a>|NP #be <b>|NP)=><a>:<b>
|{men,#man}=>|{mortal}
|{men,#man}=>|{mortal,#mortal}
|{#man,men}=>|{#mortal,mortal}
|{men,#man}=>|{#mortal,mortal}
|{#man,men}=>|{mortal,#mortal}