Artificial Intelligence I


#1

Hi everybody! I am publishing in the coming time two, maybe three AIs for uLisp.

This is not well-commented yet, but it is in a form that will run under uLisp 2.8c on an Adafruit Metro M4 Grand Central… likely also on standard Metro M4-style boards (perhaps decreasing the knowledge units), but yeah, you WILL need a few myriads of cells to actually run this. And you will need A LOT of patience… I am not kidding: this is supposed to be a STRONGLY simplified implementation of a strong AI theory I once concocted and which I am calling “Logical Triangulation” - just here, the entire triangulation stage is implied in the stage of recognition and a very brief “daydreaming” phase. (Even the best microcontrollers apparently cannot allow for more, but this is already something I am extremely proud of.)

You interact by inputting lists of symbols and you receive lists of symbols as answers, and these answers are, to the best of its efforts, based on what you said before. And yes - it DOES learn from what symbols you tell it all by itself. This, too, is why its answers are not as “polished” as those of Eliza-style systems.

When I find time for more code comments, below I might post also a better commented version. Without further ado…


#2

PART 1

; Computational Agent Tentatively Conjecturing Apprehensions
; by Nino Ivanov, September 2019
; 
; governed by Gnu Affero GPL v.3.0
; https://www.gnu.org/licenses/agpl-3.0.en.html
; 
; SAMPLE RUN - WHAT GENERALLY TO EXPECT (uLisp should do the same):
;
; (run)
; READ----(machine will you be faster now)
; ......
; *******
; ......
; ......
; *******
; 
; (TOP-NEW-KNOWLEDGE (MACHINE (WILL (YOU (BE (FASTER (NOW TRM))))))
;  (WILL (YOU (BE (FASTER (NOW TRM))))) (YOU (BE (FASTER (NOW TRM))))
;  (BE (FASTER (NOW TRM))) (FASTER (NOW TRM)) (NOW TRM) (1 X-Y) (2 X-Y) (3 X-Y)
;  (4 X-Y) (5 X-Y) (6 X-Y) (7 X-Y) (8 X-Y) (9 X-Y) (10 X-Y) (11 X-Y) (12 X-Y)
;  (13 X-Y) (14 X-Y))
; (NEW-HISTORY NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL MACHINE WILL
;  YOU BE FASTER NOW TRM)
; (REPLY--)
; 
; READ----(i see nothing at all)
; ...........
; ...........
; ***
; ...........
; ...........
; ...........
; ...........
; ***
; 
; (TOP-NEW-KNOWLEDGE
;  ((WILL (YOU (BE (FASTER (NOW TRM))))) ((I (SEE (NOTHING (AT ALL)))) TRM))
;  (WILL (YOU (BE (FASTER (NOW TRM))))) (YOU (BE (FASTER (NOW TRM))))
;  (BE (FASTER (NOW TRM))) (FASTER (NOW TRM)) (NOW TRM)
;  ((I (SEE (NOTHING (AT ALL)))) TRM) (I (SEE (NOTHING (AT ALL))))
;  (SEE (NOTHING (AT ALL))) (NOTHING (AT ALL)) (AT ALL)
;  ((MACHINE (WILL (YOU (BE (FASTER (NOW TRM)))))) (I (SEE (NOTHING (AT ALL)))))
;  (MACHINE (WILL (YOU (BE (FASTER (NOW TRM)))))) (1 X-Y) (2 X-Y) (3 X-Y) (4 X-Y)
;  (5 X-Y) (6 X-Y) (7 X-Y))
; (NEW-HISTORY NIL NIL NIL NIL NIL NIL NIL MACHINE WILL YOU BE FASTER NOW TRM I
;  SEE NOTHING AT ALL TRM)
; (REPLY--)
; 
; READ----(but please learn to talk machine)
; ...........
; ...........
; ...........
; *******
; ...........
; ...........
; .........*****
; ...........
; .........
; .......
; ...........
; ...........
; ..........
; ...........
; ...........
; ...........
; **
; ...........
; ...........
; ...........**
; ...........
; ...........
; .........****
; ...........
; .........
; .......
; 
; (TOP-NEW-KNOWLEDGE
;  (SEE
;   ((NOTHING (AT ALL)) ((TRM (BUT PLEASE)) (LEARN (TO (TALK (MACHINE TRM)))))))
;  ((NOTHING (AT ALL)) ((TRM (BUT PLEASE)) (LEARN (TO (TALK (MACHINE TRM))))))
;  (NOTHING (AT ALL)) (AT ALL)
;  ((TRM (BUT PLEASE)) (LEARN (TO (TALK (MACHINE TRM))))) (TRM (BUT PLEASE))
;  (BUT PLEASE) (LEARN (TO (TALK (MACHINE TRM)))) (TO (TALK (MACHINE TRM)))
;  (TALK (MACHINE TRM)) (MACHINE TRM)
;  (((BE FASTER) (NOW (TRM (I (SEE (NOTHING (AT ALL))))))) (TRM (BUT PLEASE)))
;  ((BE FASTER) (NOW (TRM (I (SEE (NOTHING (AT ALL))))))) (BE FASTER)
;  (NOW (TRM (I (SEE (NOTHING (AT ALL)))))) (TRM (I (SEE (NOTHING (AT ALL)))))
;  (I (SEE (NOTHING (AT ALL)))) (SEE (NOTHING (AT ALL)))
;  ((MACHINE WILL) ((YOU (BE FASTER)) (NOW (TRM (I (SEE (NOTHING (AT ALL))))))))
;  ((YOU (BE FASTER)) (NOW (TRM (I (SEE (NOTHING (AT ALL))))))))
; (NEW-HISTORY I SEE NOTHING AT ALL TRM BUT PLEASE LEARN TO TALK MACHINE TRM BUT
;  PLEASE LEARN TO TALK MACHINE TRM)
; (REPLY-- BUT PLEASE LEARN TO TALK MACHINE)
; 
; READ----(this is better before that machine it was sad)
; .........
; ...........
; ...........
; ******
; ...........
; ...........
; ...........***
; ...........
; ...........
; ...........
; ...........
; ...........
; ...........
; .........
; ...........
; ...........
; **
; ..........
; ...........
; ...........**
; ...........
; ...........
; ...........**
; ...........
; ...........
; ...........*****
; ...........
; ...........
; ...........
; 
; (TOP-NEW-KNOWLEDGE
;  (MACHINE
;   (TRM (((THIS IS) (BETTER (BEFORE THAT))) ((MACHINE IT) (WAS (SAD TRM))))))
;  (TRM (((THIS IS) (BETTER (BEFORE THAT))) ((MACHINE IT) (WAS (SAD TRM)))))
;  (((THIS IS) (BETTER (BEFORE THAT))) ((MACHINE IT) (WAS (SAD TRM))))
;  ((THIS IS) (BETTER (BEFORE THAT))) (THIS IS) (BETTER (BEFORE THAT))
;  (BEFORE THAT) ((MACHINE IT) (WAS (SAD TRM))) (MACHINE IT) (WAS (SAD TRM))
;  (SAD TRM)
;  (((BUT PLEASE) (LEARN (TO (TALK (MACHINE TRM)))))
;   ((THIS IS) (BETTER (BEFORE THAT))))
;  ((BUT PLEASE) (LEARN (TO (TALK (MACHINE TRM))))) (BUT PLEASE)
;  (LEARN (TO (TALK (MACHINE TRM)))) (TO (TALK (MACHINE TRM)))
;  (TALK (MACHINE TRM)) (MACHINE TRM)
;  ((TALK (MACHINE TRM))
;   (((BUT PLEASE) (LEARN (TO (TALK (MACHINE TRM))))) (THIS IS)))
;  (((BUT PLEASE) (LEARN (TO (TALK (MACHINE TRM))))) (THIS IS)))
; (NEW-HISTORY TALK MACHINE TRM THIS IS BETTER BEFORE THAT MACHINE IT WAS SAD TRM
;  BUT PLEASE LEARN TO TALK MACHINE TRM)
; (REPLY-- BUT PLEASE LEARN TO TALK MACHINE)
; 
; READ----(indeed this is fine)
; ...........
; ...........
; ...........
; ****
; ...........
; ...........
; ...........****
; ...........
; ...........
; ...........***
; ...........
; ...........
; ...........****
; ...........
; ...........
; ...........*****
; ...........
; ...........
; ...........
; ...........
; ...........
; ...........
; ...........
; ...........
; ...........
; *****
; ...........
; ...........
; ..........***
; ...........
; ...........
; ........
; 
; (TOP-NEW-KNOWLEDGE
;  (((BUT PLEASE) ((LEARN (TO TALK)) MACHINE))
;   ((TRM INDEED) ((THIS IS) (FINE TRM))))
;  ((TRM INDEED) ((THIS IS) (FINE TRM)))
;  ((BUT PLEASE) ((LEARN (TO TALK)) MACHINE)) (BUT PLEASE)
;  ((LEARN (TO TALK)) MACHINE) (LEARN (TO TALK)) (TO TALK) (TRM INDEED)
;  ((THIS IS) (FINE TRM)) (THIS IS) (FINE TRM)
;  (((MACHINE IT) (WAS (SAD TRM)))
;   ((BUT PLEASE) (LEARN (TO (TALK (MACHINE TRM))))))
;  ((MACHINE IT) (WAS (SAD TRM))) (MACHINE IT) (WAS (SAD TRM)) (SAD TRM)
;  ((BUT PLEASE) (LEARN (TO (TALK (MACHINE TRM)))))
;  (LEARN (TO (TALK (MACHINE TRM)))) (TO (TALK (MACHINE TRM)))
;  (TALK (MACHINE TRM)))
; (NEW-HISTORY WAS SAD TRM BUT PLEASE LEARN TO TALK MACHINE TRM INDEED THIS IS
;  FINE TRM INDEED THIS IS FINE TRM)
; (REPLY-- INDEED THIS IS FINE)
; 
; READ----(do not repeat me)
; ..........
; ........
; ..........
; ******
; .........
; .......
; ..........****
; .......
; ..........
; ..........
; .......
; ..........
; ...........
; .........
; .........
; ..........
; ******
; .........
; .......
; ..........***
; .........
; .......
; ..........**
; .......
; ..........
; ..........
; 
; (TOP-NEW-KNOWLEDGE
;  (((FINE TRM) ((INDEED THIS) (IS (FINE TRM))))
;   (DO (NOT
;        (REPEAT (ME TRM)))))
;  ((FINE TRM) ((INDEED THIS) (IS (FINE TRM)))) ((INDEED THIS) (IS (FINE TRM)))
;  (INDEED THIS) (IS (FINE TRM)) (FINE TRM)
;  (DO (NOT
;       (REPEAT (ME TRM))))
;  (NOT (REPEAT (ME TRM))) (REPEAT (ME TRM)) (ME TRM)
;  ((MACHINE ((TRM INDEED) THIS))
;   (((IS (FINE TRM)) (INDEED THIS)) (IS (FINE TRM))))
;  (((IS (FINE TRM)) (INDEED THIS)) (IS (FINE TRM)))
;  ((IS (FINE TRM)) (INDEED THIS)) (MACHINE ((TRM INDEED) THIS))
;  ((TRM INDEED) THIS) (TRM INDEED)
;  ((((LEARN (TO TALK)) MACHINE) ((TRM INDEED) THIS))
;   ((IS FINE) ((TRM INDEED) THIS)))
;  ((IS FINE) ((TRM INDEED) THIS))
;  (((LEARN (TO TALK)) MACHINE) ((TRM INDEED) THIS)) (IS FINE))
; (NEW-HISTORY INDEED THIS IS FINE TRM INDEED THIS IS FINE TRM DO NOT REPEAT ME
;  TRM INDEED THIS IS FINE TRM)
; (REPLY-- INDEED THIS IS FINE)
; 
; READ----(good machine)
; ..........
; ..........
; ...........
; ***
; ..........
; ..........
; ...........
; ...........
; ..........
; ...........
; ..........
; ..........
; ...........
; **
; ..........
; ...........
; ..........**
; ...........
; ..........
; ...........***
; ..........
; ..........
; ...........
; 
; (TOP-NEW-KNOWLEDGE
;  ((NOT ((REPEAT (ME TRM)) ((INDEED THIS) (IS (FINE TRM)))))
;   (GOOD (MACHINE TRM)))
;  (NOT ((REPEAT (ME TRM)) ((INDEED THIS) (IS (FINE TRM)))))
;  ((REPEAT (ME TRM)) ((INDEED THIS) (IS (FINE TRM)))) (REPEAT (ME TRM)) (ME TRM)
;  ((INDEED THIS) (IS (FINE TRM))) (INDEED THIS) (IS (FINE TRM)) (FINE TRM)
;  (GOOD (MACHINE TRM)) (MACHINE TRM)
;  (((THIS IS) (FINE TRM))
;   ((DO ((NOT REPEAT)
;         ME))
;    ((TRM INDEED) (THIS IS))))
;  ((THIS IS) (FINE TRM))
;  ((DO ((NOT REPEAT)
;        ME))
;   ((TRM INDEED) (THIS IS)))
;  (DO ((NOT REPEAT)
;       ME))
;  ((NOT REPEAT) ME) (NOT REPEAT) ((TRM INDEED) (THIS IS)) (TRM INDEED) (THIS IS))
; (NEW-HISTORY ME TRM INDEED THIS IS FINE TRM GOOD MACHINE TRM THIS IS BETTER
;  BEFORE THAT MACHINE IT WAS SAD TRM)
; (REPLY-- THIS IS BETTER BEFORE THAT MACHINE IT WAS-WERE SAD)
; 
; READ----()
; 
; NIL
; 



#3

PART 2: The uncommented code itself (i.e. what to paste into uLisp)

(defun pgs (n sym lis)
  (loop
    (cond ((zerop n) (return lis)))
    (push sym lis)
    (decf n)))

(defun pg2 (n sym lis)
  (loop
    (cond ((zerop n) (return lis)))
    (push (list n sym) lis)
    (decf n)))

(defun g-s (n sym) (pgs n sym '()))

(defvar sl* 12)

(defvar st* 5)

(defvar tr* 'TRM)

(defvar mp* 16)

(defvar ps* 12)

(defvar mh* 20)

(defvar kl* 500)

(defvar k* (pg2 kl* 'X-Y '()))

(defvar h* (g-s mh* '()))

(defvar at* '())

(defun ncr (n lis)
  (loop
    (cond ((null lis) (return '()))
          ((zerop n) (return lis)))
    (pop lis)
    (decf n)))

(defun proto-tkf (n lis res)
  (loop
    (cond ((or (zerop n) (null lis)) (return res)))
          (setq res (append res (list (car lis))))
          (pop lis)
          (decf n)))

(defun tkf (n lis) (proto-tkf n lis '()))

(defun tkl (n lis)
  (loop
    (cond ((null (ncr n lis)) (return lis)))
    (pop lis)))

(defun pbl (lis res)
  (loop
    (cond ((null (cdr lis)) (return res)))
    (setq res (append res (list (car lis))))
    (pop lis)))

(defun b-l (lis) (pbl lis '()))

(defun ek (a b)
  (cond ((eq a b) t)
        ((and (listp a) (listp b))
          (cond ((or (null a) (null b)) '())
                ((not (ek (car a) (car b))) '())
                (t (ek (cdr a) (cdr b)))))
        (t '())))

(defun f-l (lis)
  (loop
    (cond ((null lis) (return '()))
          ((null (cdr lis)) (return (car lis))))
    (pop lis)))

(defun mmb (el lis)
  (loop
    (cond ((null lis) (return '()))
          ((ek el (car lis)) (return lis)))
    (pop lis)))

(defun pfe (el lis frn rs)
  (loop
    (cond ((null lis) (return '()))
          ((null (cdr lis)) (return frn))
          ((ek (car lis) el)
            (progn (setq rs (append frn (cdr lis))) (return rs))))
    (setq frn (append frn (list (car lis))))
    (pop lis)))

(defun f-e (el lis)
  (pfe el lis '() '()))

(defun bub (el lis)
  (cond ((not (listp el)) lis)
        ((null el) lis)
        (t (cons el (f-e el lis)))))

(defun pmp (hp rhp knw)
  (loop
    (cond ((null knw) (return '()))
          ((ek hp (car knw)) (return hp))
          ((ek rhp (car knw)) (return '())))
    (pop knw)))

(defun p2m (rvh knw)
  (loop
    (cond ((null rvh) (return '()))
          ((null (cdr rvh)) (return '()))
          (t (let ((p-m (pmp
                           (list (cadr rvh) (car rvh))
                           (list (car rvh) (cadr rvh))
                           knw)))
            (cond ((not (null p-m)) (return p-m))))))
    (pop rvh)))

(defun e-n (lis)
  (loop
    (cond ((null lis) (return '()))
          ((not (null (car lis))) (return lis)))
  (pop lis)))

(defun p2g (hsy blh rch knw rs)
  (loop
    (cond ((or (null hsy) (null knw)) (return '()))
          ((null (cdr hsy)) (return '()))
          ((mmb (caar knw) blh)
            (progn (setq rs (tkf 2 (mmb (caar knw) hsy)))
                   (return rs)))
          ((mmb (cadar knw) rch)
            (progn
              (setq rs
                    (reverse (tkf 2 (mmb (cadar knw) (reverse hsy)))))
              (return rs))))
    (pop knw)))

(defun pgp (hsy blh rch knw)
  (p2g hsy blh rch (e-n knw) '()))

(defun g-p (hsy knw)
  (cond ((null hsy) '())
        ((null (cdr hsy)) '())
        (t (let ((ges (pgp hsy
                           (b-l hsy)
                           (reverse (cdr hsy))
                            knw)))
          (cond ((null ges)
                  (let ((rev-his (reverse hsy)))
                    (list (cadr rev-his) (car rev-his))))
                (t ges))))))

(defun pmk (hsy knw)
  (cond ((null hsy) '())
        ((null (cdr hsy)) '())
        (t (let ((p-match (p2m (reverse hsy) knw)))
          (cond ((null p-match) (g-p hsy knw))
                (t p-match))))))

(defun mkp (hsy knw)
  (pmk (e-n hsy) knw))

(defun hhp (h-s knw)
  (cond ((null h-s) '())
        ((null (cdr h-s)) h-s)
        (t (mkp h-s knw))))

(defun h-p (h-s knw)
  (hhp (e-n h-s) knw))

(defun hrp (hpa h-s)
  (cond ((null h-s) '())
        ((null (cdr h-s)) h-s)
        ((ek hpa (list (car h-s) (cadr h-s)))
          (cons hpa (hrp hpa (cddr h-s))))
        (t
          (cons (car h-s) (hrp hpa (cdr h-s))))))

(defun hha (h-s knw hpa rs)
  (loop
    (cond ((null h-s) (return (list '() knw)))
          ((null (cdr h-s))
            (progn (setq rs (list (car h-s) (bub (car h-s) knw)))
            (return rs))))
    (setq hpa (h-p h-s knw))

(princ ".")

    (cond ((null hpa)
            (progn (setq rs (list (f-l h-s) (bub (f-l h-s) knw)))
            (return rs)))
          (t (progn
             (setq h-s (hrp hpa h-s))
             (setq knw (bub hpa knw)))))))

(defun has (h-s knw)
  (progn (terpri)

  (hha (e-n h-s) knw '() '()))
)

(defun pch (alh lap knw rs)
  (loop
    (cond ((null alh) (progn (setq rs (list lap knw)) (return rs)))
          (t (let ((h-s (has (car alh) knw)))
             (progn (setq lap (car h-s))
                    (setq knw (cadr h-s))
                    (pop alh)))))))

(defun pms (revlis)
  (cond ((null (ncr (- sl* 1) revlis)) '())
        (t (cons (tkf sl* revlis)
                  (pms (ncr st* revlis))))))

(defun mks (lis)
  (let ((pm (pms (reverse lis))))
    (cond ((null pm) (list lis))
          (t (let ((sgs (mapcar 'reverse (reverse pm)))
                   (srt (tkf sl* lis)))
            (cond ((ek (car sgs) srt) sgs)
                  (t (cons srt sgs))))))))

(defun cch (fhy knw)
  (cond ((null fhy) (list '() knw))
        ((null (cdr fhy)) (list (car fhy) (bub (car fhy) knw)))
        (t (pch (mks fhy) '() knw '()))))

(defun c-h (fhy knw)
  (cch (e-n fhy) knw))

(defun ccs (sym knw rs)
  (loop
    (cond ((null knw) (return '()))
          ((and (null at*) (null (cadar knw)))
            (progn (pop knw)
                   (setq rs (ccs sym knw '()))
                   (return rs)))
          ((and (ek sym (caar knw)) (not (null (cadar knw))))
            (return (cadar knw))))
    (pop knw)))

(defun css (sym knw)

(progn (princ "*")

  (ccs sym (e-n knw) '()))
)

(defun f-c (sym knw)
  (loop
    (let ((con (css sym knw)))
      (cond ((not (null con)) (return con))
            ((and (null con) (or (not (listp sym)) (null sym)))
              (return '()))))
    (setq sym (cadr sym))))

(defun d-h (sym)
  (cond ((null sym) '())
        ((not (listp sym)) (list sym))
        (t (append (d-h (car sym)) (d-h (cadr sym))))))

(defun c-t (lis)
  (loop
    (cond ((null lis) (return '()))
          ((eq tr* (car lis)) (return lis)))
    (pop lis)))

(defun pwt (lis frn)
  (loop
    (cond ((null lis) (return frn))
          ((eq tr* (car lis)) (return frn)))
    (setq frn (append frn (list (car lis))))
    (pop lis)))

(defun uwt (lis)
  (pwt lis '()))

(defun pcp (f-p psy knw pln stp rs)
  (loop
    (cond ((not (null (c-t pln))) (progn (setq rs (uwt pln))
                                         (return rs)))
          ((zerop stp) (return pln))
          ((> (length pln) mp*) (return pln))
          (t (let ((con (d-h (f-c psy knw))))
            (cond ((null con) (return pln))
                  (t (progn
                       (setq f-p (tkl mh* (append f-p con)))
                       (setq psy (car (c-h f-p knw)))
                       (setq pln (append pln con))
                       (decf stp)
                       (setq at* t)))))))))

(defun crp (fhy his knw)
  (progn
    (setq at* '())
    (terpri)
    (pcp fhy his knw '() ps* '())))

(defun pnt (lis frn)
  (loop
    (cond ((null lis) (return frn))
          ((null (cdr lis)) (return (append frn lis)))
          ((not (and (eq tr* (car lis))
                (eq tr* (cadr lis))))
            (setq frn (append frn (list (car lis))))))
  (pop lis)))

(defun n2t (lis)
  (pnt lis '()))

(defun wi (wrd)
    (cond ((eq wrd 'I) 'YOU)
          ((eq wrd 'ME) 'YOU)
          ((eq wrd 'YOU) 'ME)
          ((eq wrd 'AM) 'ARE)
          ((eq wrd 'ARE) 'AM-ARE)
          ((eq wrd 'MINE) 'YOURS)
          ((eq wrd 'YOURS) 'MINE)
          ((eq wrd 'MY) 'YOUR)
          ((eq wrd 'YOUR) 'MY)
          ((eq wrd 'MYSELF) 'YOURSELF)
          ((eq wrd 'YOURSELF) 'MYSELF)
          ((eq wrd 'WAS) 'WAS-WERE)
          (t wrd)))

(defun pai (snt cs)
    (cond ((null snt)
            (reverse cs))
          (t
            (pai
                (cdr snt)
                (cons (wi (car snt)) cs)))))

(defun a-i (snt)
    (pai snt '()))

(defun lop (io knw i-k pla)
  (loop
    (let ((rd (progn (princ 'READ----)  (read))))
      (cond ((null rd)
              (progn (setq h* io) (setq k* knw) (return '())))
            (t (setq io (tkl mh*
                             (append io rd (list tr*)))))))

    (setq i-k (c-h io knw))
    (setq pla (e-n (tkl mh*
      (append io (crp io (car i-k) (cadr i-k))))))

    (setq i-k (c-h pla (cadr i-k)))
    (setq i-k (c-h io (cadr i-k)))

    (setq pla (e-n (crp io (car i-k) (cadr i-k))))

    (setq io (tkl mh*
                  (n2t (append io pla (list tr*)))))
    (setq knw (cadr i-k))
    (progn (terpri)  (terpri) 
           (princ (cons 'TOP-NEW-KNOWLEDGE (tkf 20 knw)))
           (terpri) 
           (princ (cons 'NEW-HISTORY io))
           (terpri) 
           (princ (cons 'REPLY-- (a-i pla)))
           (terpri) 
           (terpri) )))

(defun run () (lop h* k* '() '()))

Then, you just say:

(run)

and begin interaction, until you have had enough, and then simply enter as input:

()

that is, an empty list.


#4

That sounds awesome! :) I had an idea to also build something AI related, but with neurons split across several AVRs communicating by I2C.

Just one comment - can you please put this code in some publically accessible rep, ie github? Easier to use than copy/pasting from web page.


#5

OK, now that I learned what I needed to adjust, here I made a version with a gargantuan, inlined function hha of over 100 lines. This, more than anything else, I include for @johnsondavies so he sees with pride that HIS uLisp CAN indeed handle such a messy, complex, loopy lunacy in practice:


(defun pgs (n sym lis)
  (loop
    (cond ((zerop n) (return lis)))
    (push sym lis)
    (decf n)))

(defun pg2 (n sym lis)
  (loop
    (cond ((zerop n) (return lis)))
    (push (list n sym) lis)
    (decf n)))

(defun g-s (n sym) (pgs n sym '()))

(defvar sl* 12)

(defvar st* 5)

(defvar tr* 'TRM)

(defvar mp* 16)

(defvar ps* 12)

(defvar mh* 20)

(defvar kl* 500)

(defvar k* (pg2 kl* 'X-Y '()))

(defvar h* (g-s mh* '()))

(defvar at* '())

(defun ncr (n lis)
  (loop
    (cond ((null lis) (return '()))
          ((zerop n) (return lis)))
    (pop lis)
    (decf n)))

(defun proto-tkf (n lis res)
  (loop
    (cond ((or (zerop n) (null lis)) (return res)))
          (setq res (append res (list (car lis))))
          (pop lis)
          (decf n)))

(defun tkf (n lis) (proto-tkf n lis '()))

(defun tkl (n lis)
  (loop
    (cond ((null (ncr n lis)) (return lis)))
    (pop lis)))

(defun pbl (lis res)
  (loop
    (cond ((null (cdr lis)) (return res)))
    (setq res (append res (list (car lis))))
    (pop lis)))

(defun b-l (lis) (pbl lis '()))

(defun ek (a b)
  (cond ((eq a b) t)
        ((and (listp a) (listp b))
          (cond ((or (null a) (null b)) '())
                ((not (ek (car a) (car b))) '())
                (t (ek (cdr a) (cdr b)))))
        (t '())))

(defun f-l (lis)
  (loop
    (cond ((null lis) (return '()))
          ((null (cdr lis)) (return (car lis))))
    (pop lis)))

(defun mmb (el lis)
  (loop
    (cond ((null lis) (return '()))
          ((ek el (car lis)) (return lis)))
    (pop lis)))

(defun e-n (lis)
  (loop
    (cond ((null lis) (return '()))
          ((not (null (car lis))) (return lis)))
  (pop lis)))

(defun hrp (hpa h-s)
  (cond ((null h-s) '())
        ((null (cdr h-s)) h-s)
        ((ek hpa (list (car h-s) (cadr h-s)))
          (cons hpa (hrp hpa (cddr h-s))))
        (t
          (cons (car h-s) (hrp hpa (cdr h-s))))))

(defun hha (hsg knw hpr frn rs nh rh nk rsl rsm rsn)
  (loop
    (cond ((null hsg) (return (list '() knw)))
          ((null (cdr hsg))
            (progn
              (setq
                rsl
                (progn (setq frn '())
                  (list
                  (car hsg)
                  (cons
                    (car hsg)
                    (loop
                      (cond ((null knw) (return '()))
                            ((null (cdr knw)) (return frn))
                            ((ek (car knw) (car hsg))
                              (progn (setq rsm (append frn (cdr knw)))
                              (return rsm))))
                      (setq frn (append frn (list (car knw))))
                      (pop knw))))))
              (return rsl))))
    (setq hpr
          (progn
            (setq hsg (e-n hsg))
            (cond ((null hsg) '())
                  ((null (cdr hsg)) hsg) 
                  (t
                    (cond ((null hsg) '())
                          ((null (cdr hsg)) '())
                          (t (let ((p-m
(progn
  (setq rs (reverse hsg))
  (loop
    (cond ((null rs) (return '()))
          ((null (cdr rs)) (return '()))
          (t (let ((p-m 
                    (progn 
                      (setq nh (list (cadr rs) (car rs)))
                      (setq rh (list (car rs) (cadr rs)))
                      (setq nk knw)
                      (loop
                        (cond ((null nk) (return '()))
                              ((ek nh (car nk))
                                (progn
                                  (setq nk '())
                                  (return nh)))
                              ((ek rh (car nk))
                                (progn
                                  (setq nk '())
                                  (return '()))))
                        (pop nk)))))
               (cond ((not (null p-m)) (return p-m))))))
    (pop rs)))))
(cond ((null p-m)
        (cond ((null hsg) '())
              ((null (cdr hsg)) '())
              (t (let ((guess
                        (progn
                          (setq nk knw)
                          (let ((blh (b-l hsg))
                                (rch (reverse (cdr hsg))))
                            (loop
                              (cond
                                ((or (null hsg) (null nk)) (return '()))
                                ((null (cdr hsg)) (return '()))
                                ((mmb (caar nk) blh)
                                  (progn
                                  (setq rsn (tkf 2 (mmb (caar nk) hsg)))
                                  (return rsn)))
                                ((mmb (cadar nk) rch)
                                  (progn
                                    (setq
                                      rsn
                                      (reverse
                                        (tkf 2 (mmb (cadar nk)
                                                    (reverse hsg)))))
                                  (return rsn))))
                              (pop nk))))))
                 (progn
                   (setq nk '())
                   (cond ((null guess)
                           (let ((reh (reverse hsg)))
                             (list (cadr reh) (car reh))))
                         (t guess)))))))
      (t p-m)))))))))
    (cond ((null hpr)
            (return
              (progn (setq frn '())
                (list
                  (f-l hsg)
                  (cons
                    (f-l hsg)
                    (loop
                      (cond ((null knw) (return '()))
                            ((null (cdr knw)) (return frn))
                            ((ek (car knw) (f-l hsg))
                              (progn
                                (setq rsn (append frn (cdr knw)))
                              (return rsn))))
                      (setq frn (append frn (list (car knw))))
                      (pop knw)))))))
          (t (progn
             (setq hsg (hrp hpr hsg))
             (setq frn '())
             (setq knw
                     (cons hpr
                       (loop
                        (cond ((null knw) (return frn))
                              ((null (cdr knw)) (return frn))
                             ((ek (car knw) hpr)
                                (progn
                                  (setq rsn (append frn (cdr knw)))
                                (return rsn))))
                        (setq frn (append frn (list (car knw))))
                        (pop knw)))))))))

(defun has (h-s knw)
  (hha (e-n h-s) knw '() '() '() '() '() '() '() '() '()))

(defun pch (alh lap knw rs)
  (loop
    (cond ((null alh) (progn (setq rs (list lap knw)) (return rs)))
          (t (let ((h-s (has (car alh) knw)))
             (progn (setq lap (car h-s))
                    (setq knw (cadr h-s))
                    (pop alh)))))))

(defun pms (revlis)
  (cond ((null (ncr (- sl* 1) revlis)) '())
        (t (cons (tkf sl* revlis)
                  (pms (ncr st* revlis))))))

(defun mks (lis)
  (let ((p-mak (pms (reverse lis))))
    (cond ((null p-mak) (list lis))
          (t (let ((sgs (mapcar 'reverse (reverse p-mak)))
                   (srt (tkf sl* lis)))
            (cond ((ek (car sgs) srt) sgs)
                  (t (cons srt sgs))))))))

(defun cch (fhy knw frn)
  (cond ((null fhy) (list '() knw))
        ((null (cdr fhy))
          (list (car fhy)
                (cons
                  (car fhy)
                  (loop
                    (cond ((null knw) (return '()))
                          ((null (cdr knw)) (return frn))
                          ((ek (car knw) (car fhy))
                            (return (append frn (cdr knw)))))
                    (setq frn (append frn (list (car knw))))
                    (pop knw)))))
        (t (pch (mks fhy) '() knw '()))))

(defun c-h (fhy knw)
  (cch (e-n fhy) knw '()))

(defun ccs (sym knw rs)
  (loop
    (cond ((null knw) (return '()))
          ((and (null at*) (null (cadar knw)))
            (progn (pop knw)
                   (setq rs (ccs sym knw '()))
                   (return rs)))
          ((and (ek sym (caar knw)) (not (null (cadar knw))))
            (return (cadar knw))))
    (pop knw)))


(defun css (sym knw)
  (ccs sym (e-n knw) '()))

(defun f-c (sym knw)
  (loop
    (let ((con (css sym knw)))
      (cond ((not (null con)) (return con))
            ((and (null con) (or (not (listp sym)) (null sym)))
              (return '()))))
    (setq sym (cadr sym))))

(defun d-h (sym)
  (cond ((null sym) '())
        ((not (listp sym)) (list sym))
        (t (append (d-h (car sym)) (d-h (cadr sym))))))

(defun c-t (lis)
  (loop
    (cond ((null lis) (return '()))
          ((eq tr* (car lis)) (return lis)))
    (pop lis)))

(defun pwt (lis frn)
  (loop
    (cond ((null lis) (return frn))
          ((eq tr* (car lis)) (return frn)))
    (setq frn (append frn (list (car lis))))
    (pop lis)))

(defun uwt (lis)
  (pwt lis '()))

(defun pcp (f-p psy knw pln stp rs)
  (loop
    (cond ((not (null (c-t pln))) (progn (setq rs (uwt pln))
                                         (return rs)))
          ((zerop stp) (return pln))
          ((> (length pln) mp*) (return pln))
          (t (let ((con (d-h (f-c psy knw))))
            (cond ((null con) (return pln))
                  (t (progn
                       (setq f-p (tkl mh* (append f-p con)))
                       (setq psy (car (c-h f-p knw)))
                       (setq pln (append pln con))
                       (decf stp)
                       (setq at* t)))))))))

(defun crp (fhy his knw)
  (progn
    (setq at* '())
    (pcp fhy his knw '() ps* '())))

(defun pnt (lis frn)
  (loop
    (cond ((null lis) (return frn))
          ((null (cdr lis)) (return (append frn lis)))
          ((not (and (eq tr* (car lis))
                (eq tr* (cadr lis))))
            (setq frn (append frn (list (car lis))))))
  (pop lis)))

(defun n2t (lis)
  (pnt lis '()))

(defun wi (wrd)
    (cond ((eq wrd 'I) 'YOU)
          ((eq wrd 'ME) 'YOU)
          ((eq wrd 'YOU) 'ME)
          ((eq wrd 'AM) 'ARE)
          ((eq wrd 'ARE) 'AM-ARE)
          ((eq wrd 'MINE) 'YOURS)
          ((eq wrd 'YOURS) 'MINE)
          ((eq wrd 'MY) 'YOUR)
          ((eq wrd 'YOUR) 'MY)
          ((eq wrd 'MYSELF) 'YOURSELF)
          ((eq wrd 'YOURSELF) 'MYSELF)
          ((eq wrd 'WAS) 'WAS-WERE)
          (t wrd)))

(defun pai (snt cs)
    (cond ((null snt)
            (reverse cs))
          (t
            (pai
                (cdr snt)
                (cons (wi (car snt)) cs)))))

(defun a-i (snt)
    (pai snt '()))

(defun lop (io knw i-k pla)
  (loop
    (let ((rd (progn (princ 'READ----)  (read))))
      (cond ((null rd)
              (progn (setq h* io) (setq k* knw) (return '())))
            (t (setq io (tkl mh*
                             (append io rd (list tr*)))))))

    (setq i-k (c-h io knw))
    (setq pla (e-n (tkl mh*
      (append io (crp io (car i-k) (cadr i-k))))))

    (setq i-k (c-h pla (cadr i-k)))
    (setq i-k (c-h io (cadr i-k)))

    (setq pla (e-n (crp io (car i-k) (cadr i-k))))

    (setq io (tkl mh*
                  (n2t (append io pla (list tr*)))))
    (setq knw (cadr i-k))
    (progn (terpri)  (terpri) 
           (princ (cons 'TOP-NEW-KNOWLEDGE (tkf 20 knw)))
           (terpri) 
           (princ (cons 'NEW-HISTORY io))
           (terpri) 
           (princ (cons 'REPLY-- (a-i pla)))
           (terpri) 
           (terpri) )))

(defun run () (lop h* k* '() '()))

And, dear @rsm , I am highly ingratiated to you for your profiling suggestion, I did not know where to start. - I made this inlined thing exactly due to advice I found following your proposal to look into (profile …).

I will, eventually, place these codes on my Github page, too, yet the Forum of uLisp is indeed a place where I would easily share THEM and ALSO uLisp itself. :)

Your neuronal idea sounds interesting, and if you want a little motivation… check out computers like RAYDEC, SWAC, SEAC, or, for the British flair (who were in the beginning partially more advanced than the Americans), Turing’s Automatic Computing Engine - people were doing “real work” on stuff about as powerful as an Arduino UNO. :)


#6

Hi @Aeneas, can I just confirm that you have found a workaround that solves the problem in your earlier post Wrong function result, and that the version of your program here works identically on Common Lisp and uLisp?


#7

@johnsondavies — I confirm so. The work-around, specifically, is:

instead of

(return (function arguments))

do

(progn (setq temporary (function arguments)) (return temporary))

This seems to work inside nested loops, too. — If you cannot solve it, you might place it in the language reference… :)


#8

Thanks @Aenas. I also have a couple of comments about the implications of the different styles of programming in the different versions of your AI program.

Long symbol names

In all but the minimal versions of uLisp you can have long symbol names of more than three characters, and containing special characters. The only overhead in using a long symbol name, such as proto-gen-sym, rather than a short one, such as pgs, is that it takes up space in the symbol table.

Looking at the long versions of the function names in the first version of your program:

> (length "proto-gen-sym gen-sym *seglen* *stepsize* *terminator* *max-plan-range*
*max-plan-steps* *max-history-length* *max-knowledge-length* *knowledge* *history*
*allow-terminator* nth-cdr proto-take-first take-first take-last proto-but-last
but-last ek final memb eat-nils hier-pair h-hierarchise-all-segment
hierarchise-all-segment")
326

So these would take up 326 bytes, or less than a third of the 1024 bytes available on the Adafruit Grand Central M4 symbol table. Apart from using space in the symbol table, long symbol names are just as efficient as short ones, as they are converted to a pointer when you read the program in, so there shouldn’t be any difference in program execution speed.

I would therefore recommend keeping long symbol names, especially for the main functions, as it makes the program much easier to understand and debug.

If you do run out of space in the symbol table you’ll get the error message no room for long symbols. In this case you can increase the size of the symbol table by changing the line:

#define SYMBOLTABLESIZE 1024

in the ADAFRUIT_GRAND_CENTRAL_M4 section.

Inlining functions

I would also recommend adopting the style of the version of your program where you have kept the main routine hha short, with calls to separate functions to perform the steps within hha.

I would not expect the last version, with an “inlined function hha of over 100 lines”, to be any more efficient, although I am definitely pleased that uLisp runs it without problems! The only overhead is the need to create a function name for each module. If modules are called more than once you’ll actually save code space.

The advantage of breaking out the component functions as separate modules is that it will be easier to understand the structure of your program. There’s the additional advantage that you can test each of the modules separately with sample data.


#9

@johnsondavies:

Dear David,

Thank you so much for taking the time for explaining to me these things in-depth. One question I have is: how does SYMBOLTABLESIZE relate to the count of cells? I.e. if I were to set it to 4096 or 8192, would I need to decrease cell count? Do I correctly assume that long symbols within lists are stored within it, too, i.e. if I had a list like (THIS CONTAINS RATHER LONG SYMBOLS)? - I am presently working on the next AI and I will soon port it over after experimenting a little more with it under ECL…


#10

how does SYMBOLTABLESIZE relate to the count of cells

Both SYMBOLTABLESIZE and WORKSPACESIZE require static RAM, but SYMBOLTABLESIZE is in bytes, and WORKSPACESIZE (on the ARM version) is in 8-byte objects. So if you increase SYMBOLTABLESIZE by 1024 you’ll need to decrease WORKSPACESIZE by 128.

Do I correctly assume that long symbols within lists are stored within it

Yes, the symbol table stores all long symbols, in lists too. However, it isn’t used for strings.


#11

Thank you so much for letting me know!

And now to the system’s general description, the “brief full version”.

All the world that exists in a mind is the world of (i) things perceived and (ii) things thought out. How things ARE in the outside world does not MATTER. What matters is only how you SEE them.

Now, let us ASSUME (! - and it is merely an assumption) that the “inner world of thought” is full of symbols. Then these symbols can have two basic relations - either they are “rather seen together” or “rather seen alternatively”. Like, when I give you A and B, you can say, “I see A rather WITH B” or “I see A rather INSTEAD OF B” (i.e. you see either A, or B, but not both). Seeing things together I call a “vicinitary” or “vic-connection”, seeing thins alternatively I call an abstract “analogy” or “ana-connection”. Examples: sugar and coffee typically have a vic-connection between them, as you drink coffee WITH sugar. They are not really “alternatives” as I cannot offer you a cup of sugar instead of a cup of coffee. - On the other hand, tea and coffee are typically ana-connected, as you typically drink either a cup of tea or a cup of coffee, but you do not mix them. (However, such a drink exists, even if rare - it is just not the TYPICAL state of affairs.) - These two possibilities of connection are opposites - if A and B are typically observed instead of each other (“ana”), they likely will not be observed together (“vic”) and vice versa. I denote a vic-connection thus: A-B and an ana-connection thus: A=B. HOW any two symbols are connected is fundamentally “ephemeral”, you try to figure it out by PERCEPTION of the outside world, but it is not a thing that is “fixed”. - (This dependency on PERCEPTION for figuring out relations distinguishes my system from many others which need pre-set knowledge: mine doesn’t.)

There is a variation to this: whether or not vic-connections are “directional”, i.e. whether A-B is to be seen as the same as B-A. Both systems are imaginable; CATCA is directional, so A->B is not the same as B->A - in fact, they are treated as opposite.

OK, what IS actually this “connection between A and B”, what does it MEAN? - Well, it itself can be given a symbol, say, X. X is a “hierarchical” or “super”-symbol, while A and B are elementary symbols. Now, X ITSELF can participate in interactions with other symbols, it can form relations like X-Y or Z-X or whatever, indeed also A-X (it is not limited to its “level”). This way, ARBITRARY amounts of symbols can be structured.

Now, “what’s the point” regarding vic and ana is that they allow to actually FORM HITHERTO UNKNOWN connections. You can CONCLUDE relations. These concluded relations can then themselves help generate further conclusions, and so forth, in large cascades or “chain reactions” of conclusions. This is one mechanism that makes these systems intelligent and creative.

The rules for this are simple:

A vic- and an ana-connection with one symbol in common allow for the conclusion of another vic-connection. That is, A-B and C=B allow concluding A-C. (If you drink coffee with sugar (vic), and coffee is like tea (ana), then you may conclude that you can drink tea with sugar (vic).)

A vic- and a vic-connection with one symbol in common allow for the conclusion of another ana-connection. That is, K-L and K-M allow concluding L=M. (If you drink coffee with sugar (vic), and you drink tea with sugar (vic), then you may conclude that coffee and tea are in some form alternatives or analoga.)

Two ana-connections allow you, as you already are used to, concluding a third one. If a coffee is like cocoa, and cocoa is like tea, then coffee must be like tea, i.e. ana and ana give ana.

The second mechanism that makes these systems creative is to re-evaluate triplets of connections which consist out of three symbols. (Like, A-B, A-C and B=C.) Some of these connections may be further “strengthened”, others may be “weakened”, depending on whether they are “consistent” or not. If you know three things where each is confirmed by the other two, you believe them more strongly. If you know three things where each is contradicted by the other two, you doubt them all.

Thus, the results of hypothesis conclusion are surely positive, that is, “A-B, A-C and B=C” as well as “A=B, A=C and B=C” which I already mentioned above. These are “strengthened”. And then there are the variants you tend to believe less, namely “A-B, A-C and B-C” (“if you drink coffee with sugar, and drink tea with sugar, then you must drink tea with coffee” - is evidently nonsense), and “A-B, A=C, B=C” (“if you drink tea with sugar, then tea is like coffee and sugar is like coffee” - is evidently nonsense, too, unless you crave to drink a cup of sugar).

This weakening of relations may continue until a relation is “flipped” and vic becomes ana, and ana becomes vic. “If tea is not drunk WITH coffee, then maybe tea is drunk INSTEAD OF coffee” and “if sugar is not drunk INSTEAD OF coffee, then maybe you can drink coffee WITH sugar” are two such example “flippings”.

This way, this process of putting three relations together - what I name “logical triangulation” - may serve to increase congruency and cohesion of knowledge, “forgetting” some “wrong” knowledge and “learning” from hypotheses. As any single symbol may participate in hundreds or thousands of correlations with other symbols, e.g. A-B, A-P, A-R, A=K, A=O …, a lot of these relations can “measure each other” and increase the “regularity” of the response, i.e. that the system estimates the structure of the world in an increasingly regular way.

But where do “the first” relations come from? - From observation of input, i.e. from “sensors from the outer world”. E.g. you tell the system (A B C D A B C D A B C D), then surely some things are observed several times, like A B or B C or C D or D A, whereas other things are not observed at all, e.g. B D or C A. The system will simply TRY and GUESS that one of those repetitions is a good vic-connection, e.g. it may try with C-D or with A-B or thelike. Any time the system “guesses” a new relation, it adds it to its knowledge. Any time the system “recognises” a connection, it is given priority within the knowledge and comes to the front of the knowledge, to be used in the future with priority. - At first, it will fill itself with such mere GUESSES, but if these guesses are observed multiple times and if they are confirmed through internal logical triangulation with OTHER guesses, then they are “stable” and “trustworthy”, and it begins to rely on that knowledge. If, on the other hand, other relations begin to indicate that some prior knowledge is incorrect, the system will decrease its priority and even at some point “flip” its relation - from vic to ana or from ana to vic - in order to increase correctness again.

So this is what happens with a “challenge”, i.e. the substrate of information that is presently analysed: the system tries to “accumulate” it into “higher symbols”.

Assume the following notation: (A B) means “the symbol that denotes the vic-connection between the elementary symbols A and B”. That may be some “X”, but I just don’t even bother calling it “X”, I call it instead “(A B)”. If some symbol C were connected by a vic-connection to that X, let us say, we do not bother writing C-X, but we write (C (A B)). And so forth.

Using this notation, the system may thus “recognise” (A B C D A B C D A B C D) in some such pair-wise structure, e.g. ((((A B) (C D)) (((A B) (C D)) ((A B) (C D))))) or perhaps ((((A ((B C) D)) (A ((B C) D))) (A ((B C) D)))). When this has happened, this process of “hierarchisation” - connection symbols by vic-connections - will have terminated and the input to the system will have been “understood”, i.e. clustered. Note the fundamental question: when you are having three symbols in a line, … A B C …, you will have to decide will you recognise them as … (A B) C … or as … A (B C) … . This DOES matter in how you will understand the world. And if your system has for instance learned that A=B, i.e. that they are rather seen ALTERNATIVELY than JOINTLY, or if it has ALREADY learned that B-C is often seen, it will not group … (A B) C …, but will prefer … A (B C) … . (Even if it forms later (A (B C)) that is totally OK: (B C) is a DIFFERENT symbol than B, so A may freely attach to it even if A has an issue like A=B and prefers not to associate with B. But (B C) simply is an own symbol and treated entirely on its own.)

And how is a reply formed? - “Planning” presently is simplistic - the system tries to continue the last symbol of the input. If the input is (((P Q) (R ((S T) (U V))))), i.e. a list of the “higher” symbol (((P Q) (R ((S T) (U V))))) alone, it will look for a higher symbol whose LEFT side begins with the “last known present”, which, originally, is the ENTIRE high symbol (((P Q) (R ((S T) (U V))))), for instance, (((P Q) (R ((S T) (U V)))) WHATEVER), and if such is found, it will return WHATEVER. If not, the system will re-try: it will first de-compose the present and then take its RIGHT side as new “main” symbol, in this case, (R ((S T) (U V))) - and forget about (P Q). If it finds ((R ((S T) (U V))) (((W X) Y) Z)), then it will reply with (((W X) Y) Z). If not, it will re-try with ((S T) (U V)). If not, it will retry with (U V). If not, it will just try to continue V. And if it still finds nothing, it will terminate without giving any answer as none is known. Whatever reply it finds, is “flattened”, e.g. (((W X) Y) Z) is given out as (W X Y Z).

(It actually constructs longer replies by trying to find a “reply to the reply”, and so forth, until a specific pre-set “termiantion sign” is found and it knows then to shut up. In CATCA, this is TRM (or sometimes SIG-TERM) which is automatically appended to anything you tell the system.)

OK, so until now, you have all the essentials: how the system initially “guesses” relations, how it “correlates” relations and valuates which are “more sensible”, how it discovers “new” connections, and how it generates replies.

What does CATCA do? - CATCA has no separate triangulation stage, nor does CATCA have an own hypothesis-generation stage! CATCA does not even recognise “ana”-relations as stable knowledge and reduces everything to vic-connections only! So how the hell does it work?!

Well, CATCA simply IMPLIES all these perception and understanding related processes in its RECOGNITION stage. If CATCA has learned some A-B (or, in the other notation, (A B)), then CATCA tries to recognise THAT in the input, like usually. But if it CANNOT… then CATCA still tries to recognise in the input some OTHER combination that STARTS with A or ENDS with B. In other words, if it sees (X Q A R Z T), it will “recognise” (X Q (A R) Z T), and if it sees some (D C O B I M L H), it will recognise (D C (O B) I M L H). THIS process of “deliberate recognition” is SUFFICIENT for logical triangulation, hypothesis generation as well as “chain reactions” of connections. The idea that (A B) causes a search for “(A …” implies the ana-relation “B=…”, and thus the newly found combination - (A R) above - is in a way the result of such “implied triangulation”, which really already contains a hypothetical element in “assuming” (A R) to be a “good” possible relation. “Chain reaction” are implied as well, as (A R) and (O B) will cause also some search for (… R) and (O …). - These chain reactions can even operate akin to “ephemeral ana-relations” in a NEGATIVE sense, too - we said above, A=B is opposed to A-B and would prevent its “recognition” in the given input: well, if (A B) helps the system conclude (A R), then if the system is presented with some (K L M B R P), then the system will rather conclude (M B) - assuming M is “neutral” - than (B R) where B would “wrongly” be on the left place than on the “right”. So simply by “deliberate recognition”, CATCA performs, in a way, “implied logical triangulation”.

(For purposes of practicability and speed, CATCA does not, however, operate with all input at once, but only with a “sliding window” of input. The principal evaluation remains the same, and knowledge improves throughout each recongition. Only in the end, plans are just made in continuation of the last sliding window only.)

A final “daydreaming” stage actually improves these effects: By trying to “reply to one’s own replies” and “reconsidering one’s own considerations” actually MORE “chain effects” in the style of “(A B) proposes (A… ) and (… B)” are generated.

Plan generation in CATCA follows the procedure above.