--> ap/xxxxx

__

alice lisp knowledge mapping and process project

notes here [alice.lisp is based on Peter Norvig's kodiak system]

Anagram software. GNU Emacs, Lisp, Scheme (?): (2007.04.26:1)

For alice project - wonderland (anagram bridge from formalism to metafiction). See also alice_notes for rough alice book template ideas.

Links:

http://linuxgazette.net/issue27/ayers4.html - Fraser McCrossan's agm commandline anagram app

http://wordnet.princeton.edu/ - wordnet lexical database

http://www.accesscom.com/~darius/hacks/anagrams.tar.gz - Darius Bacon's Scheme code

to be coded as macros based on kodiak.lisp - revisit alice.lisp 14:43 (2006.05.26:3 tech_notes#136 alice#15)

also one could imagine a simple data addition and retrieval front-end once we have designed relations such as before/after, timelining, assymmetry of a pair, mirroring and so on as indicated below and in xxxxx paper:

link ripper and lewis carroll

holographic coding of such rabbit holes

ripper knowledge base as lisp lists after Norvig - check out:

time machine

time after time


alice in wonderland (film)

p146 - pkd mother goose



how this is mapped out - embedded frames and environments

frame languages

mapped by relation - major categories - ripper, alice, pink light, trajectory, entropy

ripper->entropy de_quincey->entropy and of embedding

prolog kind of terms - to-left-of, is-mother-of

levels of relational syntax


(ripper lefthanded) what is lefthanded

(lefthanded left assymetry)

(mirror asymmetry)

(alice mirror looking glass)

(alice author lewis carroll)

(carroll dodgson assumed ripper)

or inferred (ripper alice)

**knowledge base a la NORVIG:


1) possible poetic relations in new prolog type language

timeline in prolog relation. later before. but then would need
assymetry operator (backwards, forwards)

2) and also attachment of text chunks

3) possible worlds [ 496+

MRS system, 1985 Stuart Russell

see krep.lisp which has frames and worlds - relations etc.



knowledge representation

fm01/fm01lisp/norvig -> prolog.lisp and prolog.dat (examples):

(nature-of-relation '(pink-light alice ripper))

(pink-light [nature] scenes "exterior orbitting computation")

-- embeds mother goose embeds alice (p146 quote)  (alice looking glass)

(relation nature related)

Programming in Prolog 14:29 (2006.05.26:2 tech_notes#135 alice#14)

One then uses the system by:

quoted from:

http://www.cse.unsw.edu.au/~billw/cs9414/notes/prolog/intro.html

kodiak <-> prolog compiler integration (as exercise within PAIP) 12:43 (2006.05.26:1 tech_notes#134 alice#13)

process model (using continuations) with internal code 12:38 (2006.05.25:2 tech_notes#133 alice#12)

eval


code passed by way of the panel.lisp message board


or time-slice and code walking as a better option (see erunticlab modified creatures to become characters)

alice.lisp is based on Peter Norvig's Kodiak Representation Language 16:20 (2006.05.15:4 alice#11 tech_notes#122)

to quote:

Documentation for the Kodiak Representation Language

1 The Primitives of the Language The Kodiak language admits three types of objects: categories, relations and individuals. A category corresponds to a one-place predicate, a relation to a two-place predicate, and an individual to a zero-place predicate.

Statements in the Kodiak language are in parenthesized prefix form. There are nine primitive operators: dom, rel, ind, val, equ, dif, when, not and and. They have the following form:

(dom sub super) 
(rel relation domain range) 
(ind individual category) 
(val relation individual value) 
(equ category relation relation) 
(dif category relation relation) 
(when form form) 
(not form) 
(and form ...)

The following table gives an example of each primitive, along with
English translations. 

(dom dog animal) Dog is a kind of animal. 

(rel birthday animal date) The birthday relation holds between animals and
dates. Furthermore, every animal has at least one birthday. 

(ind fido dog) The individual Fido is a member of the class of dogs. 

(val birthday fido july-1) The birthday of Fido is July-1. 

(equ suicide killer victim) In a suicide, the killer is the same as the victim. 

(dif above figure ground) In an above relation, the figure and ground are different. 

(when P Q) Whenever P is asserted, assert Q as well. 

(not P ) P is false. 

(and P Q) Both P and Q are true.

for panel make more use of query-bind 16:13 (2006.05.15:3 alice#10 tech_notes#121)

also that (from below documentation) query-bind in words of manual:

The macro query-bind can be used to iterate over all the matches to a query, without consing up a list of the matches. It is designed to resemble Common Lisp's multiple-value-bind. The first argument is a list of variables and the second is a query which will be passed to the retrieval mechanism. Any arguments after the second are treated as a body of code which is executed once for each match, with the variables bound to the values retrieved by the match.

reworking kodiak/alice stuff for possible panel module 15:12 (2006.05.15:1)

more culled (from Norvig) documentation showing syntax for a macro and dom and rel stuff:

#||
Syntax:
  (a category [inst] (rel value)*)

Example:
  (a person (name (a person-name (first Joe) (last Smith))) (age old))
  ==>
  (and (ind person-1 Joe) (val name person-1 person-name-1) 
       (val age person-1 old) (val first person-name-1 Joe)
       (val last person-name-1 Smith))

Syntax:
  (each category [(isa super*)] (rel constraint)*)

Example:
  (each person (isa animal) (name person-name) (age integer))
  ==>
  (and (dom person animal) (rel name person person-name) 
       (rel age person integer))
||#

working on alice.lisp -kodiak in common lisp - cmucl using slime 19:40 (2006.03.10:1)

(uploaded as part of http://1010.co.uk/plenum_tools03.tar.gz)

slime functions to get used to:

1) M-x slime-hyperspec-lookup (with cursor on symbol)

2) C-x C-e to evaluate last s-exp

3) M-x slime-documentation - slime-eval-buffer and also complection ESC-tab

first macro for alice so can sendOSC to speech patch:


(defmacro question (variables query &rest body)
 "wrap up query in osc thing"
 `(query-bind ,variables ,query
	     (progn (sleep 4)
		    (system (concatenate 'string "sendOSC -notypetags -h 127.0.0.1 9999 \"/test, "  ,@body " \"")))))

kodiak 17:59 (2006.03.07:2)

how to formulate or traverse network of relations - embedding:

(?- (a character (name jekyll) (device ?z))) works out

0)but how do we find domains of that?

had to expand out: (?? (a character (name jekyll) (device ?c)))

(?- (dom ?y doubling))

to:

(?- (and (ind ?c character) (val name ?c jekyll) (val device ?c ?y) (dom ?z ?y)))

(?- (and (ind ?c character) (val device ?c ?y) (dom ?z ?y) (val name ?c ?zz) (rel ?zzz ?zz ?y))) usw.

1) how is the equ and dif working out?

equ: rather as in the individual case of x then y equals z (sub-categories/slots))

replace with when:

(add-fact '(when (dom ?X world) (dom ?X symptom)))

2) what is difference between ?- and ?? macros

?-
prints values for each variable in query
??
returns list of answers for query - as lisp list

other print options::


(query-bind (?x ?y) '(dom ?x ?y)
	    (format t "A ~a is a ~a.~%" ?x ?y))

also notions/ideas such as embedding should operate as functions within datasets

"A test of WHEN:"
    "Aristotle's example: a featherless biped is a person."
    "The WHEN demon is installed after the facts for p2, but before p3."
    (add-fact '(and (ind p2 biped) (ind p2 featherless)))
    (add-fact '(when (and (ind ?x featherless) (ind ?x biped))
(ind ?x person)))
    (add-fact '(and (ind p3 featherless) (ind p3 biped)))
    "Both p2 and p3 are identified as persons:"
    (?- (ind ?p person))
    "We can even see what WHEN demons have been set:"
    (?- (when ?p ?q))

working with kodiak to add facts and query 17:27 (2006.03.07:1)

roughly translating paper using basic syntax and simplified syntax of a. each ...

examples from manual:

;;(each murder (agent person) (victim person)) ;; example from norvig - defined sub-relations for murder -> (rel agent murder person)
;;(each suicide (isa murder)) (each symptom (isa revelation))
;;(add-fact '(equ suicide agent victim))
;;(a suicide (victim john-doe))

;;(?- (a suicide (agent ?x) (victim ?y)))

example queries and output:

SWANK> (?- (dom pink-light ?what))
{1.0}  ?WHAT = GNOSTIC;  
{1.0}  ?WHAT = GNOSTICISM;  
; No value
SWANK> (show-worlds)

World   Cur Parents 
=====   === ======= 
W0      T   
W1      NIL W0 
W2      T   W0 
W3      T   W2 
NIL
SWANK> (?- (val ?sx ?y ?z))
{1.0}  ?SX = SYMPTOM;          ?Y = JEKYLL;    ?Z = TEXT;  
{1.0}  ?SX = SYMPTOMATIC;      ?Y = JEKYLL;    ?Z = TEXT;  
{1.0}  ?SX = SYMPTOMATIC;      ?Y = JEKYLL;    ?Z = text goes here;  
{1.0}  ?SX = SYMPTOMATIC;      ?Y = JEKYLL;    ?Z = text goes here;  
{1.0}  ?SX = MEETER;   ?Y = MEET10;    ?Z = JOHN-DOE;  
{1.0}  ?SX = AGENT;    ?Y = SUICIDE8;          ?Z = JOHN-DOE;  
{1.0}  ?SX = VICTIM;   ?Y = SUICIDE8;          ?Z = JOHN-DOE;  
{1.0}  ?SX = LOCATION;         ?Y = BALL1;     ?Z = TABLE;  
{1.0}  ?SX = LOCATION;         ?Y = MONKEY2;   ?Z = CHAIR;  
{1.0}  ?SX = P2;       ?Y = IQ;        ?Z = 100;  
{1.0}  ?SX = P2;       ?Y = AGE;       ?Z = 32;  
{1.0}  ?SX = AGE;      ?Y = GIRL3;     ?Z = 12;  
{1.0}  ?SX = NAME;     ?Y = GIRL3;     ?Z = LEE;  
{1.0}  ?SX = AGE;      ?Y = ELEPHANT2;         ?Z = 12;  
{1.0}  ?SX = NAME;     ?Y = ELEPHANT2;         ?Z = JUMBO;  
{1.0}  ?SX = AGE;      ?Y = MAN1;      ?Z = 32;  
{1.0}  ?SX = NAME;     ?Y = MAN1;      ?Z = FRED;  
; No value
SWANK> (?- (val symptom jekyll ?what))
{1.0}  ?WHAT = TEXT;  
; No value
SWANK> (add-fact '(val symptomatic jekyll "quotation") )
T
SWANK> (?- (val symptom jekyll ?what))
{1.0}  ?WHAT = TEXT;  
; No value
SWANK> (?- (val symptomatic jekyll ?what))
{1.0}  ?WHAT = quotation;  
{1.0}  ?WHAT = TEXT;  
{1.0}  ?WHAT = text goes here;  
{1.0}  ?WHAT = text goes here;  
; No value
SWANK> (?- (dom pink-light ?what))
{1.0}  ?WHAT = GNOSTIC;  
{1.0}  ?WHAT = GNOSTICISM;  
; No value
SWANK> (?- (dom ?what double))
{1.0}  ?WHAT = MIRRORING;  
{1.0}  ?WHAT = CRASH;  
{1.0}  ?WHAT = REVELATION;  
{1.0}  ?WHAT = REFLECTION;  
{1.0}  ?WHAT = MESSAGE;  
; No value
SWANK> (?- (dom ?what double))
{1.0}  ?WHAT = MIRRORING;  
{1.0}  ?WHAT = CRASH;  
{1.0}  ?WHAT = REVELATION;  
{1.0}  ?WHAT = REFLECTION;  
{1.0}  ?WHAT = MESSAGE;  
; No value
SWANK> (?- (ind ?x double))
{1.0}  ?X = text goes here;  
{1.0}  ?X = text goes here;  
{1.0}  ?X = text goes here;  
{1.0}  ?X = text goes here;  
{1.0}  ?X = text goes here;  
{1.0}  ?X = TEXT;  
{1.0}  ?X = quotation;  
{1.0}  ?X = text goes here;  
; No value
SWANK> (?- (ind ?x double))
{1.0}  ?X = text goes here;  
; No value
SWANK> (?- (ind ?x jekyll))
{1.0}  ?X = JEKYLL13;  
; No value
SWANK> (?- (ind ?x character))
{1.0}  ?X = JEKYLL;  
; No value
SWANK> (?- (a jekyll (character ?x)))
{1.0}  ?X = FILM;  
{1.0}  ?X = PLAY;  
; No value
SWANK> (a film (double hyde) (cast character))
T
SWANK> (?- (a jekyll (character ?x)))
{1.0}  ?X = FILM;  
{1.0}  ?X = PLAY;  
; No value
SWANK> (?- (a film (?x character)))
{1.0}  ?X = CAST;  
; No value
SWANK> (?- (a jekyll (character ?x)))
{1.0}  ?X = FILM;  
{1.0}  ?X = PLAY;  
; No value
SWANK> (?- (a jekyll (character ?x)))
{1.0}  ?X = FILM;  
{1.0}  ?X = PLAY;  
; No value
SWANK> (?- (a character (name ?x)))
{1.0}  ?X = JEKYLL;  
; No value
SWANK> (?- (a character (name ?x)))
{1.0}  ?X = ALICE;  
{1.0}  ?X = DEQUINCEY;  
{1.0}  ?X = CARROLL;  
{1.0}  ?X = ROBERT_LEES;  
{1.0}  ?X = STEVENSON;  
{1.0}  ?X = JEKYLL;  
; No value
SWANK> (?- (a character (double ?x)))
{1.0}  ?X = BOOK;  
{1.0}  ?X = SINGLE;  
{1.0}  ?X = DODGSON;  
{1.0}  ?X = PSYCHIC;  
{1.0}  ?X = BURNT;  
{1.0}  ?X = HYDE;  
; No value
SWANK> (?- (a character (?y ?x)))
{1.0}  ?Y = ENTRY;     ?X = RABBIT-HOLE;  
{1.0}  ?Y = DOUBLE;    ?X = BOOK;  
{1.0}  ?Y = NAME;      ?X = ALICE;  
{1.0}  ?Y = DOUBLE;    ?X = SINGLE;  
{1.0}  ?Y = NAME;      ?X = DEQUINCEY;  
{1.0}  ?Y = DOUBLE;    ?X = DODGSON;  
{1.0}  ?Y = NAME;      ?X = CARROLL;  
{1.0}  ?Y = DOUBLE;    ?X = PSYCHIC;  
{1.0}  ?Y = NAME;      ?X = ROBERT_LEES;  
{1.0}  ?Y = APPEND;    ?X = the actor
accused. his staged action is too real. he must be the ripper not
only through artifice - he is the image, he looks like the ripper
but also he must be the ripper to engender such passion provoking
such fear, the equation inside;  
{1.0}  ?Y = DOUBLE;    ?X = BURNT;  
{1.0}  ?Y = NAME;      ?X = STEVENSON;  
{1.0}  ?Y = DOUBLE;    ?X = HYDE;  
{1.0}  ?Y = NAME;      ?X = JEKYLL;  
{1.0}  ?Y = SYMPTOMATIC;       ?X = text goes here;  
; No value
SWANK> (?- (a pink-light (?y ?x)))
{1.0}  ?Y = ENTRY;     ?X = RABBIT-HOLE;  
{1.0}  ?Y = DOUBLE;    ?X = BOOK;  
{1.0}  ?Y = NAME;      ?X = ALICE;  
{1.0}  ?Y = DOUBLE;    ?X = SINGLE;  
{1.0}  ?Y = NAME;      ?X = DEQUINCEY;  
{1.0}  ?Y = DOUBLE;    ?X = DODGSON;  
{1.0}  ?Y = NAME;      ?X = CARROLL;  
{1.0}  ?Y = DOUBLE;    ?X = PSYCHIC;  
{1.0}  ?Y = NAME;      ?X = ROBERT_LEES;  
{1.0}  ?Y = APPEND;    ?X = the actor
accused. his staged action is too real. he must be the ripper not
only through artifice - he is the image, he looks like the ripper
but also he must be the ripper to engender such passion provoking
such fear, the equation inside;  
{1.0}  ?Y = DOUBLE;    ?X = BURNT;  
{1.0}  ?Y = NAME;      ?X = STEVENSON;  
{1.0}  ?Y = MESSAGE;   ?X = ALICE;  
{1.0}  ?Y = DOUBLE;    ?X = HIDDEN;  
{1.0}  ?Y = NAME;      ?X = RIPPER;  
{1.0}  ?Y = DOUBLE;    ?X = HYDE;  
{1.0}  ?Y = NAME;      ?X = JEKYLL;  
{1.0}  ?Y = SYMPTOMATIC;       ?X = text goes here;  
; No value
SWANK> (?- (a pink-light (?x ripper)))
{1.0}  ?X = NAME;  
; No value
SWANK> (?- (a pink-light (?x alice)))
{1.0}  ?X = NAME;  
{1.0}  ?X = MESSAGE;  
; No value
SWANK> (?- (a pink-light (?x hyde)))
{1.0}  ?X = DOUBLE;  
; No value
SWANK> (?- (a pink-light (?x jekyll)))
{1.0}  ?X = NAME;  
; No value
; [GC threshold exceeded with 15,805,464 bytes in use.  Commencing GC.]
; [GC completed with 3,926,144 bytes retained and 11,879,320 bytes freed.]
; [GC will next occur when at least 15,926,144 bytes are in use.]
SWANK> (?- (assymmetry ?x))
; No value
SWANK> (?- (?x assymmetry))
; No value
SWANK> (?- (?x assymetry))
; No value
SWANK> (?- (assymetry ?x))
; No value
SWANK> (?- (dom assymetry ?x))
; No value
SWANK> (?- (dom mirroring ?x))
{1.0}  ?X = MIRRORING;  
{1.0}  ?X = REFLECTION;  
{1.0}  ?X = ASSYMETRY;  
{1.0}  ?X = DOUBLING;  
; No value
; [GC threshold exceeded with 15,937,648 bytes in use.  Commencing GC.]
; [GC completed with 3,960,656 bytes retained and 11,976,992 bytes freed.]
; [GC will next occur when at least 15,960,656 bytes are in use.]
SWANK> (?- (dom mirroring ?x))
{1.0}  ?X = MIRRORING;  
{1.0}  ?X = REFLECTION;  
{1.0}  ?X = ASSYMETRY;  
{1.0}  ?X = DOUBLING;  
; No value
SWANK> (?- (dom time ?x))
{1.0}  ?X = WORLD;  
; No value
SWANK> (?- (dom character ?y))
{1.0}  ?Y = EMBEDDING;  
{1.0}  ?Y = DOUBLING;  
{1.0}  ?Y = FILM;  
; No value
SWANK> (?- (when ?P ?Q))
{1.0}  ?P = (VAL REVERSIBILITY ?X ?Y);         ?Q = (WHEN (IND ?X WORLD)
                                                      (NOT
                                                       (VAL BEGINNING ?X ?Y)));  
{1.0}  ?P = (VAL BEGINNING ?X ?Y);     ?Q = (WHEN (IND ?X WORLD)
                                              (NOT (VAL REVERSIBILITY ?X ?Y)));  
{1.0}  ?P = (VAL REVERSIBILITY ?X ?Y);         ?Q = (WHEN (IND ?X WORLD)
                                                      (NOT
                                                       (VAL ASSYMETRY ?X ?Y)));  
{1.0}  ?P = (VAL ASSYMETRY ?X ?Y);     ?Q = (WHEN (IND ?X WORLD)
                                              (NOT (VAL REVERSIBILITY ?X ?Y)));  
{1.0}  ?P = (IND FILM98 MIRRORING);    ?Q = (VAL CHARACTER FILM98 RIPPER);  
{1.0}  b?P = (IND FILM98 MIRRORING);    ?Q = (VAL CHARACTER FILM98 HGWELLS);  
{1.0}  ?P = (VAL CHARACTER ?X ?Y);     ?Q = (WHEN (IND ?X MIRRORING)
                                              (VAL CHARACTER ?X ?Y));  
{1.0}  ?P = (VAL RIGHT ?X ?Y);         ?Q = (WHEN (IND ?X MIRRORING)
                                              (NOT (VAL LEFT ?X ?Y)));  
{1.0}  ?P = (VAL LEFT ?X ?Y);          ?Q = (WHEN (IND ?X MIRRORING)
                                              (NOT (VAL RIGHT ?X ?Y)));  
{1.0}  ?P = (VAL EXTERIOR ?X ?Y);      ?Q = (WHEN (IND ?X MIRRORING)
                                              (NOT (VAL INTERIOR ?X ?Y)));  
{1.0}  ?P = (VAL INTERIOR ?X ?Y);      ?Q = (WHEN (IND ?X MIRRORING)
                                              (NOT (VAL EXTERIOR ?X ?Y)));  
{1.0}  ?P = (VAL SIGN ?X ?Y);          ?Q = (WHEN (IND ?X REVELATION)
                                              (VAL SYSTEM ?X ?Y));  
{1.0}  ?P = (VAL SYSTEM ?X ?Y);        ?Q = (WHEN (IND ?X REVELATION)
                                              (VAL SIGN ?X ?Y));  
; No value
SWANK> (?? (character ripper ?x))
NIL
(VAL ASSYMETRY ?X ?Y)
SWANK> (?- (rel time ?x ?y))
{1.0}  ?X = BEGINNING;         ?Y = END;  
; No value
SWANK> (?- (rel ?y beginning ?x))
{1.0}  ?Y = TIME;      ?X = END;  
; No value
SWANK> (?? (rel ?y beginning ?x))
((REL TIME BEGINNING END))
SWANK> (?? (rel ?y ?z ?x))
((REL EMBEDDED WORLD OBSERVER) (REL EMBEDDED REVELATION OBSERVER)
 (REL EMBEDDED PINK-LIGHT OBSERVER) (REL EMBEDDED GNOSTICISM OBSERVER)
 (REL EMBEDDED CRASH OBSERVER) (REL EMBEDDED SYMPTOM OBSERVER)
 (REL REVELATION CHARACTER SYMPTOM) (REL TRUTH REVELATION CRASH)
 (REL TRUTH SYMPTOM CRASH) (REL TRUTH CRASH CRASH) (REL TRUTH GNOSTICISM CRASH)
 (REL TRUTH PINK-LIGHT CRASH) (REL DOUBLING REVELATION GNOSTICISM)
 (REL DOUBLING SYMPTOM GNOSTICISM) (REL DOUBLING CRASH GNOSTICISM)
 (REL DOUBLING GNOSTICISM GNOSTICISM) (REL DOUBLING PINK-LIGHT GNOSTICISM)
 (REL SPACE PINK-LIGHT EXTERIOR) (REL SPACE CRASH EXTERIOR)
 (REL EMBEDDED TIME OBSERVER) (REL EMBEDDED TIME-TRAVEL OBSERVER)
 (REL TIME BEGINNING END))
SWANK> (?? (rel ?y crash ?x))
((REL EMBEDDED CRASH OBSERVER) (REL TRUTH CRASH CRASH)
 (REL DOUBLING CRASH GNOSTICISM) (REL SPACE CRASH EXTERIOR))
SWANK> (?? (rel embedded crash ?x))
((REL EMBEDDED CRASH OBSERVER))
SWANK> (?- (rel embedded crash ?x))
{1.0}  ?X = OBSERVER;  
; No value
SWANK> (?- (rel embedded symptom ?x))
{1.0}  ?X = OBSERVER;  
; No value
SWANK> (?- (val character ?x ?y))
{1.0}  ?X = FILM106;   ?Y = RIPPER;  
{1.0}  ?X = FILM106;   ?Y = HGWELLS;  
; No value
SWANK> (?- (val character ?z ?y))
{1.0}  ?Z = FILM114;   ?Y = RIPPER;  
{1.0}  ?Z = FILM114;   ?Y = HGWELLS;  
; No value
SWANK> (?- (ind ?p character))
{1.0}  ?P = CHARACTER113;  
{1.0}  ?P = CHARACTER112;  
{1.0}  ?P = CHARACTER111;  
{1.0}  ?P = CHARACTER110;  
{1.0}  ?P = CHARACTER109;  
{1.0}  ?P = CHARACTER108;  
{1.0}  ?P = CHARACTER107;  
; No value
SWANK> (?? (a character (name ?n)))
((AND (IND CHARACTER107 CHARACTER) (VAL NAME CHARACTER107 JEKYLL))
 (AND (IND CHARACTER108 CHARACTER) (VAL NAME CHARACTER108 RIPPER))
 (AND (IND CHARACTER109 CHARACTER) (VAL NAME CHARACTER109 STEVENSON))
 (AND (IND CHARACTER110 CHARACTER) (VAL NAME CHARACTER110 ROBERT_LEES))
 (AND (IND CHARACTER111 CHARACTER) (VAL NAME CHARACTER111 CARROLL))
 (AND (IND CHARACTER112 CHARACTER) (VAL NAME CHARACTER112 DEQUINCEY))
 (AND (IND CHARACTER113 CHARACTER) (VAL NAME CHARACTER113 ALICE)))
SWANK> (?? (a character (device ?n)))
((AND (IND CHARACTER107 CHARACTER) (VAL DEVICE CHARACTER107 DOUBLING))
 (AND (IND CHARACTER112 CHARACTER) (VAL DEVICE CHARACTER112 OPIUM)))
SWANK> (?? (a character (device ?n) (name ?p)))
((AND (IND CHARACTER107 CHARACTER)
      (VAL DEVICE CHARACTER107 DOUBLING)
      (VAL NAME CHARACTER107 JEKYLL))
 (AND (IND CHARACTER112 CHARACTER)
      (VAL DEVICE CHARACTER112 OPIUM)
      (VAL NAME CHARACTER112 DEQUINCEY)))
SWANK> (?? (a character (device ?n) (name jekyll)))
((AND (IND CHARACTER107 CHARACTER)
      (VAL DEVICE CHARACTER107 DOUBLING)
      (VAL NAME CHARACTER107 JEKYLL)))
SWANK> (?- (dom ?x doubling))
{1.0}  ?X = CHARACTER;  
{1.0}  ?X = FILM;  
{1.0}  ?X = REFLECTION;  
{1.0}  ?X = MIRRORING;  
{1.0}  ?X = DOUBLE;  
; No value
SWANK> (?? (a character (name jekyll)))
	   
((AND (IND CHARACTER107 CHARACTER) (VAL NAME CHARACTER107 JEKYLL)))
SWANK> (?? (a character))
((IND CHARACTER107 CHARACTER) (IND CHARACTER108 CHARACTER)
 (IND CHARACTER109 CHARACTER) (IND CHARACTER110 CHARACTER)
 (IND CHARACTER111 CHARACTER) (IND CHARACTER112 CHARACTER)
 (IND CHARACTER113 CHARACTER))
SWANK> (?? (rel space ?who ?what))
((REL SPACE PINK-LIGHT EXTERIOR) (REL SPACE CRASH EXTERIOR))
SWANK> (?? (dom character ?x)))
Warning:  Ignoring unmatched close parenthesis at file position 24.
((DOM CHARACTER FILM) (DOM CHARACTER DOUBLING) (DOM CHARACTER EMBEDDING))
SWANK> (?? (dom character ?x))
((DOM CHARACTER FILM) (DOM CHARACTER DOUBLING) (DOM CHARACTER EMBEDDING))
SWANK> (?? (dom ?x world))
((DOM REVELATION WORLD) (DOM PINK-LIGHT WORLD) (DOM GNOSTICISM WORLD)
 (DOM CRASH WORLD) (DOM SYMPTOM WORLD) (DOM TIME WORLD) (DOM TIME-TRAVEL WORLD))
SWANK> (?? (dom ?x world))
((DOM REVELATION WORLD) (DOM DOUBLING WORLD) (DOM PINK-LIGHT WORLD)
 (DOM GNOSTICISM WORLD) (DOM CRASH WORLD) (DOM SYMPTOM WORLD)
 (DOM DOUBLE WORLD) (DOM MIRRORING WORLD) (DOM REFLECTION WORLD)
 (DOM FILM WORLD) (DOM CHARACTER WORLD) (DOM TIME WORLD)
 (DOM TIME-TRAVEL WORLD))
SWANK> (a world (character jekyll))
T
SWANK> (?- (a world (device ?x)))
{1.0}  ?X = TIME-TRAVEL;  
{1.0}  ?X = DREAM;  
{1.0}  ?X = OPIUM;  
{1.0}  ?X = DOUBLING;  
; No value
SWANK> (?- ( a beginning (title ?x))
	   )
{1.0}  ?X = Notes Towards A Nervous Background;  
; No value
SWANK> (?- ( a beginning (title ?x))
	   )
{1.0}  ?X = Notes Towards A Nervous Background;  
; No value
SWANK> (?- ( a beginning (title ?x))
	   )
{1.0}  ?X = TITLE;  
{1.0}  ?X = Notes Towards A Nervous Background;  
SWANK> (?- ( a world
	      (title ?x))
	   )
{1.0}  ?X = The English Mail Coach;  
{1.0}  ?X = Notes Towards A Nervous Background;  
; No value
; [GC threshold exceeded with 16,869,096 bytes in use.  Commencing GC.]
; [GC completed with 5,074,672 bytes retained and 11,794,424 bytes freed.]
; [GC will next occur when at least 17,074,672 bytes are in use.]
; [GC threshold exceeded with 17,086,488 bytes in use.  Commencing GC.]
; [GC completed with 5,368,976 bytes retained and 11,717,512 bytes freed.]
; [GC will next occur when at least 17,368,976 bytes are in use.]
SWANK> (?- ( a world
	      (begin ?x)))
{1.0}  ?X = TRAJECTORY;  
; No value
SWANK> (?? ( a world
	      (begin ?x)))
((AND (IND END228 WORLD) (VAL BEGIN END228 TRAJECTORY)))
SWANK> (?? ( a world
	      (begin ?x)))
((AND (IND END243 WORLD) (VAL BEGIN END243 TRAJECTORY)))
SWANK> (?- ( a world
	      (begin ?x)))
{1.0}  ?X = TRAJECTORY;  
; No value
SWANK> (?- (a embedding ?x))
{1.0}  ?X = EMBEDDING245;  
{1.0}  ?X = FILM241;  
{1.0}  ?X = CHARACTER240;  
{1.0}  ?X = CHARACTER239;  
{1.0}  ?X = CHARACTER238;  
{1.0}  ?X = CHARACTER237;  
{1.0}  ?X = CHARACTER236;  
{1.0}  ?X = CHARACTER235;  
{1.0}  ?X = CHARACTER234;  
; No value
SWANK> (?? (a character (device ?n) (name jekyll)))
((AND (IND CHARACTER234 CHARACTER)
      (VAL DEVICE CHARACTER234 DOUBLING)
      (VAL NAME CHARACTER234 JEKYLL)))
SWANK> (?? (a space (device ?n) (name jekyll)))
NIL
SWANK> (?? (a location (attribute ?n)))
((AND (IND LOS_ALAMOS LOCATION) (VAL ATTRIBUTE LOS_ALAMOS ALCHEMICAL)))
SWANK> (?- (a location (attribute ?n)))
{1.0}  ?N = ALCHEMICAL;  
; No value
CL-USER> (?- (a location (attribute ?n)))
{1.0}  ?N = ALCHEMICAL;  
; No value
CL-USER> (?- (a location (attribute ?n)))
{1.0}  ?N = ALCHEMICAL;  
; No value
CL-USER> (?- (a world ?x (attribute ?n)))
{1.0}  ?X = LOS_ALAMOS;        ?N = ALCHEMICAL;  
; No value
CL-USER> (?- (a world ?x (character ?n)))
{1.0}  ?X = FILM260;   ?N = RIPPER;  
{1.0}  ?X = FILM260;   ?N = HGWELLS;  
; No value
CL-USER> (?- (a world (character ?n)))
{1.0}  ?N = RIPPER;  
{1.0}  ?N = HGWELLS;  
; No value
CL-USER> (?- (a world (character ?n) (name ?p)))
{1.0}  ?N = RIPPER;    ?P = TIME-AFTER-TIME;  
{1.0}  ?N = HGWELLS;   ?P = TIME-AFTER-TIME;  
; No value
CL-USER> (?- (a character ?n (name ?p)))
{1.0}  ?N = CHARACTER259;      ?P = ALICE;  
{1.0}  ?N = CHARACTER258;      ?P = DEQUINCEY;  
{1.0}  ?N = CHARACTER257;      ?P = CARROLL;  
{1.0}  ?N = CHARACTER256;      ?P = ROBERT_LEES;  
{1.0}  ?N = CHARACTER255;      ?P = STEVENSON;  
{1.0}  ?N = CHARACTER254;      ?P = RIPPER;  
{1.0}  ?N = CHARACTER253;      ?P = JEKYLL;  
; No value
CL-USER> (?- (a world (character ?n) (name ?p)))
{1.0}  ?N = RIPPER;    ?P = TIME-AFTER-TIME;  
{1.0}  ?N = HGWELLS;   ?P = TIME-AFTER-TIME;  
; No value
CL-USER> (?? (rel ?x ?y ?z))
((REL EMBEDDED WORLD OBSERVER) (REL EMBEDDED DOUBLING OBSERVER)
 (REL EMBEDDED REVELATION OBSERVER) (REL EMBEDDED PINK-LIGHT OBSERVER)
 (REL EMBEDDED GNOSTICISM OBSERVER) (REL EMBEDDED CRASH OBSERVER)
 (REL EMBEDDED SYMPTOM OBSERVER) (REL REVELATION CHARACTER SYMPTOM)
 (REL TRUTH REVELATION CRASH) (REL TRUTH SYMPTOM CRASH) (REL TRUTH CRASH CRASH)
 (REL TRUTH GNOSTICISM CRASH) (REL TRUTH PINK-LIGHT CRASH)
 (REL DOUBLING REVELATION GNOSTICISM) (REL DOUBLING SYMPTOM GNOSTICISM)
 (REL DOUBLING CRASH GNOSTICISM) (REL DOUBLING GNOSTICISM GNOSTICISM)
 (REL DOUBLING PINK-LIGHT GNOSTICISM) (REL EMBEDDED DOUBLE OBSERVER)
 (REL EMBEDDED MIRRORING OBSERVER) (REL EMBEDDED REFLECTION OBSERVER)
 (REL SPACE PINK-LIGHT EXTERIOR) (REL SPACE CRASH EXTERIOR)
 (REL EMBEDDED FILM OBSERVER) (REL EMBEDDED CHARACTER OBSERVER)
 (REL EMBEDDED TIME OBSERVER) (REL EMBEDDED TIME-TRAVEL OBSERVER)
 (REL TIME BEGINNING END) (REL TIME BEGINNING DREAM)
 (REL EMBEDDED DREAM OBSERVER) (REL EMBEDDED BEGINNING OBSERVER)
 (REL EMBEDDED END OBSERVER) (REL TITLE BEGINNING TITLE)
 (REL BECOMES BEGINNING EXPANDED) (REL EMBEDDED SPACE OBSERVER)
 (REL EMBEDDED LOCATION OBSERVER))
CL-USER> (?? (a character (name  ?y)))
; [GC threshold exceeded with 19,982,344 bytes in use.  Commencing GC.]
; [GC completed with 8,286,624 bytes retained and 11,695,720 bytes freed.]
; [GC will next occur when at least 20,286,624 bytes are in use.]
((AND (IND CHARACTER253 CHARACTER) (VAL NAME CHARACTER253 JEKYLL))
 (AND (IND CHARACTER254 CHARACTER) (VAL NAME CHARACTER254 RIPPER))
 (AND (IND CHARACTER255 CHARACTER) (VAL NAME CHARACTER255 STEVENSON))
 (AND (IND CHARACTER256 CHARACTER) (VAL NAME CHARACTER256 ROBERT_LEES))
 (AND (IND CHARACTER257 CHARACTER) (VAL NAME CHARACTER257 CARROLL))
 (AND (IND CHARACTER258 CHARACTER) (VAL NAME CHARACTER258 DEQUINCEY))
 (AND (IND CHARACTER259 CHARACTER) (VAL NAME CHARACTER259 ALICE)))
CL-USER> (?? (a character (name  ?y) (device ?z)))
((AND (IND CHARACTER253 CHARACTER)
      (VAL NAME CHARACTER253 JEKYLL)
      (VAL DEVICE CHARACTER253 DOUBLING))
 (AND (IND CHARACTER258 CHARACTER)
      (VAL NAME CHARACTER258 DEQUINCEY)
      (VAL DEVICE CHARACTER258 OPIUM))
 (AND (IND CHARACTER258 CHARACTER)
      (VAL NAME CHARACTER258 DEQUINCEY)
      (VAL DEVICE CHARACTER258 DREAM)))
CL-USER> (?- (a character (name  ?y) (device ?z)))
{1.0}  ?Y = DEQUINCEY;         ?Z = DREAM;  
{1.0}  ?Y = DEQUINCEY;         ?Z = OPIUM;  
{1.0}  ?Y = JEKYLL;    ?Z = DOUBLING;  
; No value
CL-USER> (?- (dom ?z doubling))
{1.0}  ?Z = DREAM;  
{1.0}  ?Z = CHARACTER;  
{1.0}  ?Z = FILM;  
{1.0}  ?Z = REFLECTION;  
{1.0}  ?Z = MIRRORING;  
{1.0}  ?Z = DOUBLE;  
; No value
CL-USER> (?? (dom ?y doubling))
((DOM DOUBLE DOUBLING) (DOM MIRRORING DOUBLING) (DOM REFLECTION DOUBLING)
 (DOM FILM DOUBLING) (DOM CHARACTER DOUBLING) (DOM DREAM DOUBLING))
CL-USER> (?? (dom ?y doubling))
((DOM DOUBLE DOUBLING) (DOM MIRRORING DOUBLING) (DOM REFLECTION DOUBLING)
 (DOM FILM DOUBLING) (DOM CHARACTER DOUBLING) (DOM DREAM DOUBLING))

/root/xxxxx/alice/paper2.lisp

kodiak representation language. 12:37 (2006.03.07:1)

from Norvig and based on krep knowledge rep seems to work well

http://www.cs.berkeley.edu/~wilensky/cs288/kodiak-man.ps

http://www.cs.berkeley.edu/~wilensky/cs288/kodiak.lisp

The following table gives an example of each primitive, along with English translations.

(dom dog animal) Dog is a kind of animal. 

(rel birthday animal date) The birthday relation holds between animals and
dates.
Furthermore, every animal has at least one birthday. 

(ind fido dog) The individual Fido is a member of the class of dogs. 

(val birthday fido july-1) The birthday of Fido is July-1. 

(equ suicide killer victim) In a suicide, the killer is the same as the victim. 

(dif above figure ground) In an above relation, the figure and ground are different. 

(when P Q) Whenever P is asserted, assert Q as well. 

(not P ) P is false. 

(and P Q) Both P and Q are true.

for prolog/frame language implementation 17:48 (2006.02.12:1)

need to find some way of attaching text/quote (code even) to relationship

slot for this or.... -> to examine Norvig implementation of add-fact

what IS the relation

A frame language 20:12 (2006.02.11:5)

PAIP p493. individuals and categories as frames. relations as slots

allows for compact expression

and also use of Skolem constant

expressiveness problem: 19:57 (2006.02.11:4)

PAIP p485 in relation to representation and Prolog

higher order predications.

1) a restricted language is specified admitting of three types of objects:

categories, relations and individuals

2) statements may have one of five primitive operators:

sub, rel, ind, val and and.

for category, relation, individual within a category, value of a fact/relation, and - both are true.

eg (sub dog animal) (rel birthday animal date) (ind fido dog) (val birthday fido july-1)

(brief search online brings up Norvig's Kodiak representation language:

http://www.cs.berkeley.edu/~wilensky/cs288/kodiak.lisp

and:

http://www.cs.berkeley.edu/~wilensky/cs288/kodiak-man.ps

alice.lisp listing:


(load "/root/kodiak")

(clear-db)

;;1) truth/revelation and crash 

;;domains

(add-fact '(dom revelation world))

(add-fact '(dom doubling world))

;; equ rather as in the individual case of x then y equals z (sub-categories/slots))

;;(add-fact '(equ test world symptom))

;; test

(?? (dom ?x symptom))


;; print options

(query-bind (?x ?y) '(dom ?x ?y)
	    (format t "A ~a is a ~a.~%" ?x ?y))

;;(?- (a test (?x symptom )))

;; rewrite as when

(add-fact '(when (dom ?X world) (dom ?X symptom)))

;; embedded - more....

(add-fact '(rel embedded world observer))

(add-fact '(dom embedded embedding))


(add-fact '(dom pink-light revelation))

(add-fact '(dom gnosticism revelation))

(add-fact '(dom crash pink-light))

(add-fact '(dom symptom gnosticism))

(add-fact '(rel revelation character symptom))

(add-fact '(equ revelation system sign))

(add-fact '(dom sign message))

(add-fact '(rel truth revelation crash))

(add-fact '(rel doubling revelation gnosticism))

;; double doubling and mirroring to be mapped out in space

(add-fact '(dom double doubling))

(add-fact '(dom mirroring doubling))

(add-fact '(dif mirroring interior exterior))

(add-fact '(dif mirroring left right))

(add-fact '(dom mirroring assymetry))

(each mirroring (isa reflection))

(each reflection (isa mirroring))


(add-fact '(equ mirroring character character))

(add-fact '(rel space pink-light exterior))

;; hitting edge of the simulation

;;2) characters and films

;; what is a character. what is a film

(add-fact '(dom character film))
(add-fact '(dom film doubling))
(add-fact '(dom film embedding))

;; cast list

(a character (name jekyll) (double hyde) (device doubling))

(a character (name ripper) (double hidden) (message alice) (text "ill afforded foul carrion carrier"))

(each ripper (double doubling))

(a character (name stevenson) (double burnt) (append "the actor
accused. his staged action is too real. he must be the ripper not
only through artifice - he is the image, he looks like the ripper
but also he must be the ripper to engender such passion provoking
such fear, the equation inside"))

(a character (name Robert_Lees) (double psychic))

(a character (name carroll) (double dodgson))

(a character (name dequincey) (double single) (device opium) (device dream) (trajectory crash))

(a character (name alice) (double book) (entry rabbit-hole))

;; facts about them also . rels are in format above

(a film (name time-after-time) (character (a character (name hgwells) (device time-travel))) (character (a character (name ripper) (device time-travel))))

;; time travel

(add-fact '(dom time-travel assymetry))
(add-fact '(dom time-travel entropy))

(add-fact '(dom time-travel time))
(add-fact '(dom time world))

;; reversibility

(add-fact '(dif world assymetry reversibility))
(add-fact '(dif world beginning reversibility))

;;; beginning and end defined. before after

(add-fact '(dif world beginning end))

(add-fact '(rel time beginning end))

;;the end, the dream function as the beginning and the beginning as the
;;end. open parantheses

(add-fact '(rel time beginning dream))

(add-fact '(equ time end beginning))

(add-fact '(equ time beginning dream))

(add-fact '(dom dream doubling))

(add-fact '(dom beginning time))
(add-fact '(dom end time))

;; use also of this style::

;;(each murder (agent person) (victim person)) ;; example from norvig - defined sub-relations for murder -> (rel agent murder person)
;;(each suicide (isa murder)) (each symptom (isa revelation))
;;(add-fact '(equ suicide agent victim))
;;(a suicide (victim john-doe))

;;(?- (a suicide (agent ?x) (victim ?y)))

;; further examples for when

;;; We can even see what WHEN demons have been set: -? (?- (WHEN ?P ?Q)) -1.0"" ?P = (IND P3 BIPED); ?Q = (IND P3 PERSON); -1.0"" ?P = (IND ?X FEATHERLESS); ?Q = (WHEN (IND ?X BIPED) (IND ?X PERSON)); -1.0"" ?P = (IND P2 BIPED); ?Q = (IND P2 PERSON);

(a beginning (title "Notes Towards A Mental Breakdown") (notate the_index))

(a end (title "The English Mail Coach") (notate dream) (begin trajectory))

(a reconstruction (character jekyll) (device reversibility))

(each beginning (title title) (becomes expanded))


;; marriage and alchemy

(a embedding (first crash) (location Los_Alamos))

(a location Los_Alamos (attribute alchemical))

(add-fact '(rel alchemical doubling marriage))

(each location (isa space))
(each space (isa world))

;;3) alice network

(add-fact '(rel embedding alice mother-goose))

(add-fact '(when (dom ?X pink-light) (dom ?X mother-goose)))

(add-fact '(rel space reversal looking-glass))

(add-fact '(rel symmetry evening painting))

(?- (rel ?x ?y mother-goose))

;;4) ripper network

(each character (isa suspect))
(each suspect (isa possible_murderer))

(add-fact '(when (and (ind ?x possible_murderer) (ind ?x believed_as))
(ind ?x murderer)))

(add-fact '(when (dom ?X murderer) (dom ?X ripper)))

(each murder (murderer character) (victim character))

;; ripper as class and as individual

;; further suspects

;; left and right handed - corkscrew

;; murder and victim relation

;; victims and details

;;x) test queries below

(?? (a character (name jekyll) (device ?c)))

(?- (dom ?y doubling))

;; list subdomains for jekyll

(?- (and (ind ?c character) (val name ?c jekyll) (val device ?c ?y) (dom ?z ?y)))

(?- (and (ind ?c character) (val device ?c ?y) (dom ?y ?z) (val name ?c ?zz)))

;; list subdomains for characters + show relations (rel subdomain character-name device)

;; test

(add-fact '(rel mirroring jekyll doubling ))

(?- (and (ind ?c character) (val device ?c ?y) (dom ?z ?y) (val name ?c ?zz) (rel ?zzz ?zz ?y)))

 (?- (a film ?c (name ?dd)))

;; translate (?- (a film ?c (a character ?dd (name ?c)))) nesting??

;;(?- (and (ind ?c film) (val name ?c ?d)))


;; default to print all relations/permutations

;;(query-bind (?x ?y) '(dom ?x ?y)
	  ;;  (format t "A ~a is a ~a.~%" ?x ?y))


;;(query-bind (?x ?y ?z) '(rel ?x ?y ?z)
	;;    (format t " ~a is nature from ~a to ~a.~%" ?x ?y ?z))

;; tools

(defun system (command-string)
	   (let ((proc (run-program "/bin/sh" (list "-c" command-string)
				    :wait t :input t :output t :error t)))
	     (prog1 (process-exit-code proc) (process-close proc))))

;; way wrap call in system 

;;(query-bind (?x ?y ?z) '(rel ?x ?y ?z)
	;;    (format t " ~a is nature from ~a to ~a.~%" ?x ?y ?z))


;;(query-bind (?x ?y ?z) '(rel ?x ?y ?z)
	;;    (setq mystring (concatenate 'string  (format nil " ~a is nature from ~a to ~a " ?x ?y ?z))))

;;(setq command1 (concatenate 'string "sendOSC -notypetags -h 127.0.0.1 9999 \"/test, " mystring " \""))

;;(system command1)

;;(query-bind (?x ?y ?z) '(rel ?x ?y ?z)
	;;    (progn (sleep 4)
	  ;;  (system (concatenate 'string "sendOSC -notypetags -h 127.0.0.1 9999 \"/test, "  (format nil " ~a is nature from ~a to ~a " ?x ?y ?z) " \""))))

;; so macro should be (question (?x ?y ?z) '(rel ?x ?y ?z) + strings intertwining) and resolve to the above

;;(query-bind (?x ?y) '(dom ?x ?y)
	;;    (format t "A ~a is a ~a.~%" ?x ?y))


;;(print (concatenate 'string "sendOSC -notypetags -h 127.0.0.1 9999 \"/test, "  (?- (and (ind ?c character) (val device ?c ?y) (dom ?z ?y) (val name ?c ?zz) (rel ?zzz ?zz ?y))) " \""))

;;(print (?- (and (ind ?c character) (val device ?c ?y) (dom ?z ?y) (val name ?c ?zz) (rel ?zzz ?zz ?y))))

;;(print  (?- (a film ?c (name ?dd))))

;example

;;(query-bind (?x ?y) '(and (rel revelation ?x ?y ) (dom ?x ?y))
;;      (format t "A ~a is a ~a with REVELATION.~%" ?x ?y))

(defmacro question (variables query &rest body)
 "wrap up query in osc thing"
 `(query-bind ,variables ,query
	     (progn (sleep 4)
		    (system (concatenate 'string "sendOSC -notypetags -h 127.0.0.1 9999 \"/test, "  ,@body " \"")))))


(defmacro test-question (variables query &rest body)
 "wrap up query in osc thing"
 `(query-bind ,variables ,query
	      (print (concatenate 'string "sendOSC -notypetags -h 127.0.0.1 9999 \"/test, "  ,@body " \""))))

;;(question (?x ?y) '(and (rel revelation ?x ?y ) (dom ?x ?y))
;;      (format nil "A ~a is a ~a with REVELATION " ?x ?y))

;; ////////////////////////////THIS IS THE ONE

;;(query-bind (?x ?y) '(dom ?x ?y)
	;;    (progn (sleep 4)
	  ;;  (system (concatenate 'string "sendOSC -notypetags -h 127.0.0.1 9999 \"/test, "  (format nil " ~a is ~a" ?x ?y) " \""))))



(defmacro pd-speak (body)
	      `(system (concatenate 'string "sendOSC -notypetags -h 127.0.0.1 9999 \"/test, "  ,@body " \"")))

planner-multi test - alice 15:21 (2006.05.15:2 tech_notes#120 alice#1)