NAL 6: Variable Terms
------------------------- Variable unification -------------------------------------
//If something is a bird, then it is a flyer.
<<$x --> bird> ==> <$x --> flyer>>.
//If something is a bird, then it is not a flyer.
<<$y --> bird> ==> <$y --> flyer>>. %0.00;0.70%
1
//If something is a bird, then usually, it is a flyer.
outputMustContain('<< $1--> bird> ==> < $1--> flyer>>. %0.79;0.92%')
---------------------------------- Variable unification --------------------------------
//If something is a bird, then it is an animal.
<<$x --> bird> ==> <$x --> animal>>.
//If something is a robin, then it is a bird.
<<$y --> robin> ==> <$y --> bird>>.
3
//If something is a robin, then it is an animal.
//outputMustContain('<< $1--> robin> ==> < $1--> animal>>. %1.00;0.81%')
//I guess that if something is an animal, then it is a robin.
//outputMustContain('<< $1--> animal> ==> < $1--> robin>>. %1.00;0.45%')
---------------------------------- Variable unification --------------------------------
//If something is a swan, then it is a bird.
<<$x --> swan> ==> <$x --> bird>>. %1.00;0.80%
//If something is a swan, then it is a swimmer.
<<$y --> swan> ==> <$y --> swimmer>>. %0.80%
3
//I believe that if something is a swan, then it is a bird or a swimmer.
//outputMustContain('<< $1--> swan> ==> (||,< $1--> bird>,< $1--> swimmer>)>. %1.00;0.72%')
//I believe that if something is a swan, then usually, it is both a bird and a swimmer.
//outputMustContain('<< $1 --> swan> ==> (&&,< $1 --> bird>,< $1--> swimmer>)>. %0.80;0.72%')
------------------------------- Variable unification -----------------------------
//What can be said about bird can also be said about robin.
<<bird --> $x> ==> <robin --> $x>>.
//What can be said about swimmer usually can also be said about robin.
<<swimmer --> $y> ==> <robin --> $y>>. %0.70;0.90%
3
//What can be said about bird and swimmer can also be said about robin.
outputMustContain('<(&&,<bird --> $1>,<swimmer --> $1>) ==> <robin --> >>. %1.00;0.81%')
//What can be said about bird or swimmer can also be said about robin.
//outputMustContain('<(||,<bird -->$1 >,<swimmer --> $1>) ==> <robin --> >>. %0.70;0.81%')
------------------------------ Variable unification ------------------------------
//If something can fly and chirp, then it is a bird.
<(&&,<$x --> flyer>,<$x --> [chirping]>) ==> <$x --> bird>>.
//If something has wings, then it can fly.
<<$y --> [with-wings]> ==> <$y --> flyer>>.
8
//If something can chirp and has wings, then it is a bird.
//outputMustContain('<(&&,<$1 --> [chirping]>,<$1 --> [with-wings]>) ==> <$1 --> bird>>. %1.00;0.81%')
---------------------------------- Variable unification --------------------------------
//If something can fly, chirp, and eats worms, then it is a bird.
<(&&,<$x --> flyer>,<$x --> [chirping]>, <(*, $x, worms) --> food>) ==> <$x --> bird>>.
//If something can chirp and has wings, then it is a bird.
<(&&,<$x --> [chirping]>,<$x --> [with-wings]>) ==> <$x --> bird>>.
12
//If something can fly and eats worms, then I guess it has wings.
//outputMustContain('<(&&,<$1 --> flyer>,<(*,$1,worms) --> food>) ==> < $1--> [with-wings]>>. %1.00;0.45%')
//I guess if something has wings, then it can fly and eats worms.
//outputMustContain('<<$1 --> [with-wings]> ==> (&&,<$1 --> flyer>,<(*,$1,worms) --> food>)>. %1.00;0.45%')
--------------------------------- Variable unification ---------------------------
If something is a bird, then it is an animal.
<<$x --> bird> ==> <$x --> animal>>.
A robin is a bird.
<robin --> bird>.
3
//A robin is an animal.
//outputMustContain('<robin --> animal>. %1.00;0.81%')
----------------------------- Variable elimination ------------------------
//If something is a bird, then it is an animal.
<<$x --> bird> ==> <$x --> animal>>.
//A tiger is an animal.
<tiger --> animal>.
10
//I guess that a tiger is a bird.
//outputMustContain('<tiger --> bird>. %1.00;0.45%')
----------------------------- Variable elimination -----------------------------
//Something is an animal if and only if it is a bird.
<<$x --> animal> <=> <$x --> bird>>.
//A robin is a bird.
<robin --> bird>.
3
//A robin is an animal.
//outputMustContain('<robin --> animal>. %1.00;0.81%')
------------------------------- Variable elimination -------------------------------
//Some bird can swim.
(&&,<#x --> bird>,<#x --> swimmer>).
//Swan is a type of bird.
<swan --> bird>. %0.90%
3
//I guess swan can swim.
//outputMustContain('<swan --> swimmer>. %0.90;0.43%')
--------------------------------- Variable elimination -----------------------------
//Tweety has wings.
<{Tweety} --> [with-wings]>.
//If something can chirp and has wings, then it is a bird.
<(&&,<$x --> [chirping]>,<$x --> [with-wings]>) ==> <$x --> bird>>.
23
//If Tweety can chirp, then it is a bird.
//outputMustContain('<<{Tweety} --> [chirping]> ==> <{Tweety} --> bird>>. %1.00;0.81%')
------------------------------------ Variable elimination ---------------------------------
//If something can fly, chirp, and eats worms, then it is a bird.
<(&&,<$x --> flyer>,<$x --> [chirping]>, <(*, $x, worms) --> food>) ==> <$x --> bird>>.
//Tweety can fly.
<{Tweety} --> flyer>.
7
//If Tweety can chirp and eats worms, then it is a bird.
//outputMustContain('<(&&,<(*,{Tweety},worms) --> food>,<{Tweety} --> [chirping]>) ==> <{Tweety} --> bird>>. %1.00;0.81%')
------------------- Multiple variable elimination -----------------
//Every lock can be opened by every key.
<(&&,<$x --> key>,<$y --> lock>) ==> <$y --> (/,open,$x,_)>>.
//Lock-1 is a lock.
<{lock1} --> lock>.
20
//Lock-1 can be opened by every key.
//outputMustContain('<< $1--> key> ==> <{lock1} --> (/,open,,_)>>. %1.00;0.81%')
------------------- Multiple variable elimination -----------------
//Every lock can be opened by some key.
<<$x --> lock> ==> (&&,<#y --> key>,<$x --> (/,open,#y,_)>)>.
//Lock-1 is a lock.
<{lock1} --> lock>.
9
//Some key can open Lock-1.
//outputMustContain('(&&,<#1 --> key>,<{lock1} --> (/,open,#1,_)>). %1.00;0.81%')
------------------- Multiple variable elimination -----------------
//There is a lock that can be opened by every key.
(&&,<#x --> lock>,<<$y --> key> ==> <#x --> (/,open,$y,_)>>).
//Lock-1 is a lock.
<{lock1} --> lock>.
9
//I guess Lock-1 can be opened by every key.
//outputMustContain('<< $1--> key> ==> <{lock1} --> (/,open,,_)>>. %1.00;0.43%')
------------------- Multiple variable elimination -----------------
//There is a key that can open some lock.
(&&,<#x --> (/,open,#y,_)>,<#x --> lock>,<#y --> key>).
//Lock-1 is a lock.
<{lock1} --> lock>.
18
//I guess there is a key that can open Lock-1.
//outputMustContain('(&&,<#1 --> key>,<{lock1} --> (/,open,#1,_)>). %1.00;0.43%')
------------------- Variable introduction -----------------
//A swan is a bird.
<swan --> bird>.
//A swan is usually a swimmer.
<swan --> swimmer>. %0.80%
3
//I guess a bird is usually a swimmer.
//outputMustContain('<< $1--> bird> ==> <$1 --> swimmer>>. %0.80;0.45%')
//I guess a swimmer is a bird.
//outputMustContain('<<$1 --> swimmer> ==> <$1 --> bird>>. %1.00;0.39%')
//I guess a bird is usually a swimmer, and the other way around.
//outputMustContain('<< $1--> bird> <=> < $1--> swimmer>>. %0.80;0.45%')
//Some bird can swim.
//outputMustContain('(&&,<#1 --> bird>,<#1 --> swimmer>). %0.80;0.81%')
------------------- Variable introduction -----------------
//A gull is a swimmer.
<gull --> swimmer>.
//Usually, a swan is a swimmer.
<swan --> swimmer>. %0.80%
3
//I guess what can be said about gull usually can also be said about swan.
//outputMustContain('<<gull --> $1> ==> <swan -->$1 >>. %0.80;0.45%')
//I guess what can be said about swan can also be said about gull.
//outputMustContain('<<swan -->$1 > ==> <gull --> $1>>. %1.00;0.39%')
//I guess gull and swan share most properties.
//outputMustContain('<<gull -->$1 > <=> <swan --> $1>>. %0.80;0.45%')
//Gull and swan have some common property.
//outputMustContain('(&&,<gull --> #1>,<swan --> #1>). %0.80;0.81%')
------------------- Variables introduction -----------------
//Key-1 opens Lock-1.
<{key1} --> (/,open,_,{lock1})>.
//Key-1 is a key.
<{key1} --> key>.
45
//I guess every key can open Lock-1.
//outputMustContain('<<$1 --> key> ==> <$1 --> (/,open,_,{lock1})>>. %1.00;0.45%')
//Some key can open Lock-1.
//outputMustContain('(&&,<#1 --> (/,open,_,{lock1})>,<#1 --> key>). %1.00;0.81%')
//outputMustContain('(&&,<#1 --> (/,open,_,{lock1})>,<#1 --> key>). %1.00;0.25%')
------------------- Multiple variables introduction -----------------
//Lock-1 can be opened by every key.
<<$x --> key> ==> <{lock1} --> (/,open,$x,_)>>.
//Lock-1 is a lock.
<{lock1} --> lock>.
166
//There is a lock that can be opened by every key.
//outputMustContain('(&&,<#1 --> lock>,<<$2 --> key> ==> <#1 --> (/,open,$2,_)>>). %1.00;0.81%')
//I guess every lock can be opened by every key.
//outputMustContain('<(&&,<$2 --> key>,<$1 --> lock>) ==> <$1 --> (/,open,$2,_)>>. %1.00;0.45%')
----------------------------- Multiple variables introduction -------------------------
//Lock-1 can be opened by some key.
(&&,<#x --> key>,<{lock1} --> (/,open,#x,_)>).
//Lock-1 is a lock.
<{lock1} --> lock>.
17
//There is a key that can open some lock.
//outputMustContain('(&&,<#1 --> key>,<#2 --> (/,open,#1,_)>,<#2 --> lock>). %1.00;0.81%')
//I guess every lock can be opened by some key.
//outputMustContain('<<$1 --> lock> ==> (&&,<#2 --> key>,<$1 --> (/,open,#2,_)>)>. %1.00;0.45%')
-------------------------------------- Recursion -------------------------------------
//0 is a number
<0 --> num>. %1.00;0.90%
//If n is a number, n+1 is also a number
<< $1--> num> ==> <(*,) --> num>>. %1.00;0.90%
//3 is a number?
<(*,(*,(*,0))) --> num>?
70000
//I guess 3 is a number
//outputMustContain('<(*,(*,(*,0))) --> num>. %1.00;0.66%')
------------------------ Second level variable unification ------------------------
//there is a lock which is opened by all keys
(&&,<#1 --> lock>,<<$1 --> key> ==> <#1 --> (/,open,,_)>>). %1.00;0.90%
//key1 is a key
<{key1} --> key>. %1.00;0.90%
5
//there is a lock which is opened by key1
//outputMustContain('(&&,<#1 --> (/,open,{key1},_)>,<#1 --> lock>). %1.00;0.81%')
------------------------ Second level variable unification ----------------------------
//all locks are opened by some key
<<$1 --> lock> ==> (&&,<#2 --> key>,< --> (/,open,#2,_)>)>. %1.00;0.90%
//key1 is a key
<{key1} --> key>. %1.00;0.90%
5
//maybe all locks are opened by key1
//outputMustContain('<< $1--> lock> ==> <$1 --> (/,open,{key1},_)>>. %1.00;0.43%')
------------------- Second variable introduction (induction) ---------------------
//If something opens lock1, it is a key
<<lock1 --> (/,open,$1,_)> ==> < --> key>>.
//lock1 is a key
<lock1 --> lock>.
7
//there is a lock with the property that when opened by something, this something is a key (induction)
//outputMustContain('<(&&,<#1 --> (/,open,,_)>,<#1 --> lock>) ==> < --> key>>. %1.00;0.45%')
----------------------------- Variable elimination (deduction) ---------------------------
//lock1 is a lock
<lock1 --> lock>. %1.00;0.90%
//there is a lock with the property that when opened by something, this something is a key
<(&&,<#1 --> lock>,<#1 --> (/,open,,_)>) ==> < --> key>>. %1.00;0.90%
4
//whatever opens lock1 is a key
//outputMustContain('<<lock1 --> (/,open,$1,_)> ==> <$1 --> key>>. %1.00;0.81%')
----------------------- Abduction with variable elimination (abduction) -----------------------
//whatever opens lock1 is a key
<<lock1 --> (/,open,$1,_)> ==> < $1--> key>>. %1.00;0.90%
//there is a lock with the property that when opened by something, this something is a key
<(&&,<#1 --> lock>,<#1 --> (/,open,,_)>) ==> < --> key>>. %1.00;0.90%
10
//lock1 is a lock
//outputMustContain('<lock1 --> lock>. %1.00;0.45%')