/* * NARS-Examples-SingleStep.txt * Pei Wang [All Rights Reserved] * last modified: August 16, 2006 * * Examples showing conclusions of single-step inference in the Java applet, * listed in the order by which they are introduced into the logic. * * Each example consists of one or more premises followed by one or more * questions, and the (expected) last answer is below "--------------------". * * To run an example, copy the premises and question and paste them into the * Input Window of NARS, click "OK" in the Input Window, then click "Run" in * the NARS Main Window. * * To reset the memory between examples, selecting menu item "Memory/Initialize". */ /* ---------- NAL-1 ---------- */ // revision bird --> swimmer %1; 0.8% bird --> swimmer %0; 0.5% bird --> swimmer -------------------- swimmer> %0.80;0.83% // choice swan --> bird %1; 0.5% penguin --> bird %0.8; 0.9% ?x --> bird -------------------- bird> %0.80;0.90% // deduction bird --> animal %1% robin --> bird %1% robin --> animal -------------------- animal> %1.00;0.81% // induction swan --> swimmer %1% swan --> bird %1% bird --> swimmer -------------------- swimmer> %1.00;0.44% // abduction sport --> competition %1% chess --> competition %1% chess --> sport -------------------- sport> %1.00;0.44% // exemplification bird --> animal %1% robin --> bird %1% animal --> robin -------------------- robin> %1.00;0.44% // conversion bird --> swimmer %0.4% swimmer --> bird -------------------- bird> %1.00;0.26% // question derivation [to see all the results, set "Parameter/Report Silence Level" to 0] bird --> swimmer %1% ?x {-- swimmer -------------------- $0.36;0.28;0.50$ {?1}> $0.81;0.56;1.00$ <{?1} --> bird> $0.90;0.56;1.00$ {?1}> /* ---------- NAL-2 ---------- */ // revision swan <-> robin %1; 0.8% swan <-> robin %0; 0.5% swan <-> robin -------------------- swan> %0.80;0.83% // merge swan --> bird %1% bird --> swan %0.1% swan <-> bird -------------------- swan> %0.10;0.89% // comparison swan --> swimmer %1; 0.8% swan --> bird %1; 0.8% bird <-> swimmer -------------------- swimmer> %1.00;0.39% // analogy swan --> swimmer %1% gull <-> swan %1% gull --> swimmer -------------------- swimmer> %1.00;0.72% // deduction swan <-> robin %1% gull <-> swan %1% gull <-> robin -------------------- robin> %1.00;0.81% // conversion swan <-> bird %0.9% swan --> bird -------------------- bird> %0.90;0.81% swan --> bird %0.9% swan <-> bird -------------------- swan> %0.90;0.47% // instance and property Tweety {-- bird %1% -------------------- <{Tweety} --> bird> %1.00;0.90% raven --] black %1% -------------------- [black]> %1.00;0.90% Tweety {-] yellow %1% -------------------- <{Tweety} --> [yellow]> %1.00;0.90% // set definition {Tweety} --> {Birdie} %1% {Tweety} <-> {Birdie} -------------------- <{Birdie} <-> {Tweety}> %1.00;0.90% [smart] --> [bright] %0.9% [smart] <-> [bright] -------------------- <[bright] <-> [smart]> %0.90;0.90% // structure transformation {Tweety} <-> {Birdie} %1% Tweety <-> Birdie -------------------- Tweety> %1.00;0.90% Tweety <-> Birdie %1% {Tweety} <-> {Birdie} -------------------- <{Birdie} <-> {Tweety}> %1.00;0.80% /* ---------- NAL-3 ---------- */ // compound composition, two premises swan --> swimmer %0.9% swan --> bird %0.8% swan --> (&,bird,swimmer) -------------------- (&,bird,swimmer)> %0.72;0.83% swan --> swimmer %0.9% swan --> bird %0.8% swan --> (|,bird,swimmer) -------------------- (|,bird,swimmer)> %0.98;0.96% swan --> swimmer %0.9% swan --> bird %0.8% swan --> (-,bird,swimmer) -------------------- (-,bird,swimmer)> %0.08;0.90% swan --> swimmer %0.9% swan --> bird %0.8% swan --> (-,swimmer,bird) -------------------- (-,swimmer,bird)> %0.18;0.89% // compound composition, one premise swan --> bird %0.8% swan --> (&,bird,swimmer) -------------------- (&,bird,swimmer)> %0.80;0.47% swan --> bird %0.8% swan --> (|,bird,swimmer) -------------------- (|,bird,swimmer)> %0.80;0.72% swan --> bird %0.8% swan --> (-,bird,swimmer) -------------------- (-,bird,swimmer)> %0.80;0.47% swan --> bird %0.8% swan --> (-,swimmer,bird) -------------------- (-,swimmer,bird)> %0.20;0.72% // compound decomposition, two premises robin --> (&,bird,swimmer) %0% robin --> bird %1% robin --> swimmer -------------------- swimmer> %0.00;0.81% robin --> (|,bird,swimmer) %1% robin --> swimmer %0% robin --> bird -------------------- bird> %1.00;0.81% swan --> (-,bird,swimmer) %0% swan --> bird %1% swan --> swimmer -------------------- swimmer> %1.00;0.81% robin --> (-,bird,swimmer) %0% robin --> swimmer %0% robin --> bird -------------------- bird> %0.00;0.81% // compound decomposition, one premise robin --> (&,bird,swimmer) %1% robin --> swimmer -------------------- swimmer> %1.00;0.90% robin --> (|,bird,swimmer) %0% robin --> bird -------------------- bird> %0.00;0.47% swan --> (-,bird,swimmer) %1% swan --> swimmer -------------------- swimmer> %0.00;0.90% robin --> (-,bird,swimmer) %1% robin --> bird -------------------- bird> %1.00;0.90% // composition on both sides of a statement bird --> animal %1% (&, swimmer, bird) --> (&, swimmer, animal) -------------------- <(&,bird,swimmer) --> (&,animal,swimmer)> %1.00;0.90% // decomposition on both sides of a statement (&, swimmer, bird) --> (&, swimmer, animal) %1% bird --> animal -------------------- animal> %1.00;0.47% // set operations something --> {Venus, Mars, Pluto} %0.9% something --> {Pluto, Saturn} %0.7% something --> {Pluto} -------------------- {Pluto}> %0.63;0.84% something --> {Venus, Mars, Pluto} %0.9% something --> {Pluto, Saturn} %0.7% something --> {Venus, Mars, Pluto, Saturn} -------------------- {Mars,Pluto,Saturn,Venus}> %0.97;0.95% something --> {Venus, Mars, Pluto} %0.9% something --> {Pluto, Saturn} %0.7% something --> {Venus, Mars} -------------------- {Mars,Venus}> %0.27;0.88% /* ---------- NAL-4 ---------- */ // structure transformation (*, acid, base) --> reaction %1% acid --> (/,reaction,_,base) -------------------- (/,reaction,_,base)> %1.00;0.90% acid --> (/,reaction,_,base) %1% base --> (/,reaction,acid,_) -------------------- (/,reaction,acid,_)> %1.00;0.90% base --> (/,reaction,acid,_) %1% (*, acid, base) --> reaction -------------------- <(*,acid,base) --> reaction> %1.00;0.90% key1 {-- (/, open, _, {lock1}) %1% ?x {-- (/, open, {key1}, _) -------------------- <{lock1} --> (/,open,{key1},_)> %1.00;0.90% key1 {-- (/, open, _, {lock1}) %1% (*, ?x, ?y) --> open -------------------- <(*,{key1},{lock1}) --> open> %1.00;0.90% // composition on both sides of a statement bird --> animal %0.9% (*, bird, plant) --> (*, animal, plant) -------------------- <(*,bird,plant) --> (*,animal,plant)> %0.90;0.90% neutralization --> reaction %0.9% (/,neutralization,acid,_) --> (/,reaction,acid,_) -------------------- <(/,neutralization,acid,_) --> (/,reaction,acid,_)> %0.90;0.81% soda --> base %0.9% (/,neutralization,_,base) --> (/,neutralization,_,soda) -------------------- <(/,neutralization,_,base) --> (/,neutralization,_,soda)> %0.90;0.81% // decomposition on both sides of a statement (*, plant, bird) --> (*, plant, animal) %0.9% bird --> animal -------------------- animal> %0.90;0.90% (/,neutralization,acid,_) --> (/,reaction,acid,_) %0.9% neutralization --> reaction -------------------- reaction> %0.90;0.47% (/,neutralization,_,base) --> (/,neutralization,_,soda) %0.9% soda --> base -------------------- base> %0.90;0.47% /* ---------- NAL-5 ---------- */ // revision flyer> ==> bird> %1; 0.8% flyer> ==> bird> %0; 0.5% flyer> ==> bird> -------------------- < flyer> ==> bird>> %0.80;0.83% // choice swimmer> ==> bird> %1; 0.5% flyer> ==> bird> %0.8% ?x ==> bird> -------------------- < flyer> ==> bird>> %0.80;0.90% // deduction bird> ==> animal> %0.9% flyer> ==> bird> %1% flyer> ==> animal> -------------------- < flyer> ==> animal>> %0.90;0.72% bird> <=> animal> %0.9% flyer> <=> bird> %1% flyer> <=> animal> -------------------- < animal> <=> flyer>> %0.90;0.81% bird> ==> animal> %0.9% bird> %1% animal> -------------------- animal> %0.90;0.72% // induction bird> ==> animal> %0.9% bird> ==> flyer> %1% flyer> ==> animal> -------------------- < flyer> ==> animal>> %0.90;0.44% // abduction bird> ==> animal> %0.9% flyer> ==> animal> %1% flyer> ==> bird> -------------------- < flyer> ==> bird>> %1.00;0.42% bird> ==> animal> %0.9% robin --> animal %1% robin --> bird -------------------- bird> %1.00;0.42% // merge flyer> ==> bird> %0.9% bird> ==> flyer> %0.9% flyer> <=> bird> -------------------- < bird> <=> flyer>> %0.81;0.82% // comparison bird> ==> animal> %0.9% flyer> ==> animal> %0.9% flyer> <=> bird> -------------------- < bird> <=> flyer>> %0.81;0.44% // analogy bird> ==> animal> %0.9% flyer> <=> animal> %0.9% bird> ==> flyer> -------------------- < bird> ==> flyer>> %0.81;0.59% // compound composition, two premises bird> ==> animal> %0.9% bird> ==> flyer> %0.9% bird> ==> (&&, animal>, flyer>) -------------------- < bird> ==> (&&, animal>, flyer>)> %0.81;0.82% robin --> bird %0.9% robin --> flyer %0.9% (&&, bird>, flyer>) -------------------- (&&, bird>, flyer>) %0.81;0.82% // compound decomposition, two premises bird> ==> (&&, animal>, flyer>) %0% bird> ==> flyer> %1% bird> ==> animal> -------------------- < bird> ==> animal>> %0.00;0.81% (&&, animal>, flyer>) %0% flyer> %1% animal> -------------------- animal> %0.00;0.81% // negation (--, flyer>) %0.1% flyer> -------------------- flyer> %0.90;0.90% (--, bird>) ==> flyer> %0.1% (--, flyer>) ==> bird> -------------------- <(--, flyer>) ==> bird>> %0.00;0.44% /* ---------- NAL-6 ---------- */ // variable unification <#x --> bird> ==> <#x --> flyer> %1; 0.8% <#y --> bird> ==> <#y --> flyer> %0; 0.5% <#z --> bird> ==> <#z --> flyer> -------------------- <<#1 --> bird> ==> <#1 --> flyer>> %0.80;0.83% (&&, <#x() --> bird>, <#x() --> flyer>) %1; 0.8% (&&, <#x() --> bird>, <#x() --> flyer>) %0; 0.5% (&&, <#x() --> bird>, <#x() --> flyer>) -------------------- (&&,<#1() --> bird>,<#1() --> flyer>) %1.00;0.80% <#x --> bird> ==> <#x --> animal> %1% <#y --> robin> ==> <#y --> bird> %1% <#x --> robin> ==> <#x --> animal> -------------------- <<#1 --> robin> ==> <#1 --> animal>> %1.00;0.81% // variable elimination <#x --> bird> ==> <#x --> animal> %1% robin --> bird %1% robin --> animal -------------------- animal> %1.00;0.81% <#x --> bird> ==> <#x --> animal> %1% bird> ==> ? (&&,<#x() --> bird>,<#x() --> swimmer>) %1% swan --> bird %1% swan --> swimmer -------------------- swimmer> %1.00;0.44% // variable introduction swan --> bird %1% swan --> swimmer %1% <#x --> bird> ==> <#x --> swimmer> -------------------- <<#1 --> bird> ==> <#1 --> swimmer>> %1.00;0.44% swan --> bird %1% swan --> swimmer %1% (&&,<#x() --> bird>,<#x() --> swimmer>) -------------------- (&&,<#1() --> bird>,<#1() --> swimmer>) %1.00;0.81% // multiple variables introduction key1 --> key %1% key1 --> (/, open, _, lock1) %1% <#x --> key> ==> <#x --> (/, open, _, lock1)> -------------------- <<#1 --> key> ==> <#1 --> (/,open,_,lock1)>> %1.00;0.44% key1 --> key %1% key1 --> (/, open, _, lock1) %1% (&&, <#x() --> key>, <#x() --> (/, open, _, lock1)>) -------------------- (&&,<#1() --> (/,open,_,lock1)>,<#1() --> key>) %1.00;0.81% lock1 --> lock %1% <#x --> key> ==> <#x --> (/, open, _, lock1)> %1.00;0.44% (&&, <#x --> key>, <#y --> lock>) ==> <#y --> (/, open, #x, _)> -------------------- <(&&,<#1 --> key>,<#2 --> lock>) ==> <#2 --> (/,open,#1,_)>> %1.00;0.28% lock1 --> lock %1% <#x --> key> ==> <#x --> (/, open, _, lock1)> %1.00;0.44% (&&, <#y() --> lock>, <<#x --> key> ==> <#y() --> (/, open, #x, _)>>) -------------------- (&&,<#1() --> lock>,<<#2 --> key> ==> <#1() --> (/,open,#2,_)>>) %1.00;0.39% lock1 --> lock %1% (&&, <#x() --> key>, <#x() --> (/, open, _, lock1)>) %1.00;0.81% <#y --> lock> ==> (&&, <#x(#y) --> key>, <#y --> (/, open, #x(#y), _)>) -------------------- <<#1 --> lock> ==> (&&,<#1 --> (/,open,#2(#1),_)>,<#2(#1) --> key>)> %1.00;0.42% lock1 --> lock %1% (&&, <#x() --> key>, <#x() --> (/, open, _, lock1)>) %1.00;0.81% (&&, <#x() --> key>, <#y() --> lock>, <#y() --> (/, open, #x(), _)>) -------------------- (&&,<#1() --> (/,open,#2(),_)>,<#2() --> key>,<#1() --> lock>) %1.00;0.72% /* ---------- NAL-7 ---------- */ // temporal inference <(*, #x, room_101) --> enter> =\> <(*, #x, door_101) --> open> %0.9% <(*, #x, door_101) --> open> =\> <(*, #x, key_101) --> hold> %0.8% <(*, #x, room_101) --> enter> =\> <(*, #x, key_101) --> hold> -------------------- <<(*,#1,room_101) --> enter> =\> <(*,#1,key_101) --> hold>> %0.72;0.58% <(*, #x, door_101) --> open> =/> <(*, #x, room_101) --> enter> %0.7% <(*, #x, door_101) --> open> =\> <(*, #x, key_101) --> hold> %0.8% <(*, #x, key_101) --> hold> =/> <(*, #x, room_101) --> enter> -------------------- <<(*,#1,key_101) --> hold> =/> <(*,#1,room_101) --> enter>> %0.70;0.39% <(*, #x, door_101) --> open> =/> <(*, #x, room_101) --> enter> %0.7% <(*, #x, door_101) --> open> =\> <(*, #x, key_101) --> hold> %0.8% <(*, #x, room_101) --> enter> =\> <(*, #x, key_101) --> hold> -------------------- <<(*,#1,room_101) --> enter> =\> <(*,#1,key_101) --> hold>> %0.80;0.36% <(*, #x, door_101) --> open> =/> <(*, #x, room_101) --> enter> %0.95% <(*, #x, room_101) --> enter> <=> <(*, #x, corridor_100) --> leave> %1% <(*, #x, door_101) --> open> =/> <(*, #x, corridor_100) --> leave> -------------------- <<(*,#1,door_101) --> open> =/> <(*,#1,corridor_100) --> leave>> %0.95;0.72% // inference on tense <(*, #x, key_101) --> hold> =/> <(*, #x, room_101) --> enter> %1% (*, John, key_101) --> hold %1% (/>, <(*, John, room_101) --> enter>) -------------------- (/>,<(*,John,room_101) --> enter>) %1.00;0.81% <(*, #x, key_101) --> hold> =/> <(*, #x, room_101) --> enter> %1% (*, John, room_101) --> enter %1% (\>, <(*, John, key_101) --> hold>) -------------------- (\>,<(*,John,key_101) --> hold>) %1.00;0.44% <(*, John, key_101) --> hold> =/> <(*, John, room_101) --> enter> %1% (/>, <(*, John, key_101) --> hold>) %1% (/>, <(*, John, room_101) --> enter>) -------------------- (/>,<(*,John,room_101) --> enter>) %1.00;0.81% <(*, John, key_101) --> hold> =/> <(*, John, room_101) --> enter> %1% (\>, <(*, John, room_101) --> enter>) %1% (\>, <(*, John, key_101) --> hold>) -------------------- (\>,<(*,John,key_101) --> hold>) %1.00;0.44% /* ---------- NAL-8 ---------- */ [to see all the results, set "Parameter/Report Silence Level" to 0] // goal revision John {-- swimmer !1; 0.85! John {-- swimmer !0; 0.60! --------------------------------- <{John} --> swimmer> !0.79;0.87! // goal derivation John {-- swimmer !1! backstroker --> swimmer %1% ---------------- <{John} --> backstroker> !1.00;0.81! John {-- swimmer !1! swimmer --> athlete %1% ---------------- <{John} --> athlete> !1.00;0.40! (*, John, room_101) --> enter !1! <(*, #x, door_101) --> open> =/> <(*, #x, room_101) --> enter>%0.9% --------------------------------- (\>,<(*,John,door_101) --> open>) !0.90;0.72! (*, John, room_101) --> enter !1! <(*, #x, room_101) --> enter> =\> <(*, #x, door_101) --> open> %0.9% --------------------------------- <(*,John,door_101) --> open> !1.00;0.42! // goal decomposition (||, <(*, John, room_101) --> enter>, <(*, John, room_102) --> enter>) !1! --------------------------------- <(*,John,room_101) --> enter> !1.00;0.90! <(*,John,room_102) --> enter> !1.00;0.90! (&&, <(*, John, room_101) --> enter>, <(*, John, room_102) --> enter>) !1! --------------------------------- <(*,John,room_101) --> enter> !1.00;0.47! <(*,John,room_102) --> enter> !1.00;0.47! (&/, <(*, John, room_101) --> enter>, <(*, John, room_102) --> enter>) !1! --------------------------------- <(*,John,room_101) --> enter> !1.00;0.47!