Next: About this document Up: Uncertainty-Valued Horn Clauses Previous: An Application of

The Uncertainty Translator



;Test for an uncertainty fact of the form
;(uc (c...) UC-FACTOR) 
(defun ucfact-t (clause)
  (and (uc-tt clause) (= (length clause) 3)))

;Test for an uncertainty rule of the form
;(uc (c...) (ucfb1...) .. (ucfbM ...) UC-FACTOR)
;the premises being functional and returning
;uncertainty values, normally factors in the interval [0 .. 1].
(defun uc-t (x) (and (consp x) (eq 'uc (car x))))
(defun uc-tt (x) (and (uc-t x) (> (length x) 2)))

;Neither the compiler nor the interpreter can use uc clauses directly,
;so they have to be translated into ordinary footed (ft) clauses.
(defun switch-tag (clause old-tag new-tag)
  (if (eq (car clause) old-tag) 
      (cons new-tag (cdr clause))
      clause))

(defun mk-combfct (combfct body)
  (cons combfct body))

(defun from-uc-to-ft (clause combfct)
  (cond ((ucfact-t clause) (switch-tag clause 'uc 'ft))
	((uc-tt clause) (list 'ft (s-head clause)
			      (mk-combfct combfct (s-premises clause))))))

;Translate a clause (hn & ft clauses stay unmodified)
(defun uncertain-clause  (clause combfct) 
  (cond ((uc-tt clause) (from-uc-to-ft clause combfct))
	(t clause)))

;Translate a database 
(defun uncertain-database (db combfct)
  (mapcar #'(lambda (clause) (uncertain-clause clause combfct)) db))

;Translate and reassign the *rfi-database* (RELFUN database)
(defun uncertain-db (combfct)
  (setq *rfi-database* (uncertain-database *rfi-database* combfct)) t)


Harold Boley & Victoria Hall (hall@dfki.uni-kl.de)