Ontology: Akt-Support-Ontology; Representation Language: ONTOLINGUA; File: basic

This ontology was created by the Advanced Knowledge Technologies (AKT) project. AKT is an Interdisciplinary Research Collaboration (IRC), which is sponsored by the UK Engineering and Physical Sciences Research Council under grant number GR/N15764/01. The AKT IRC comprises the Universities of Aberdeen, Edinburgh, Sheffield, Southampton and the Open University.

;;;Automatically translated from OCML file #P"C:/users/jbd2/code/ocml/library/v5-0/domains/akt-support-ontology/basic.lisp"
(in-package "ONTOLINGUA-USER")

(in-ontology 'akt-support-ontology)


(Define-Relation = (?x ?y) Show the relation = in WebOnto
"True if ?x and ?y do unify")


(Define-Relation == (?x ?y) Show the relation == in WebOnto
"True if ?x and ?y do unify and they also have the same structure.
    This means that either they are both atoms, or they are lists with 
    the same structure")


(Define-Frame LIST  Show the class list in WebOnto

  :own-slots
  (  (Documentation "A  class representing lists.")
  (Subclass-of intangible-thing))

  :axioms
((<=> (or (= ?x nil) (= ?x (?a . ?b))) (list ?x))
))


(Define-Individual NIL (list)
"The empty list"
)


(Define-Relation NULL (?l) Show the relation null in WebOnto
"True if ?l is the empty list"
  :iff-def (= ?l nil))


(Define-Function FIRST (?l) Show the function first in WebOnto
"Takes the first element of a list.  If the list is empty
    the function returns :nothing"
:constraints (list ?l)
:lambda-body (if (== ?l (?a . ?b)) ?a :nothing))


(Define-Function REST (?l) Show the function rest in WebOnto
"Takes a list as argument, say ?l, removes the first element of ?s
    and returns the resulting list.  If ?l = nil, then :nothing is returned"
:constraints (list ?l)
:lambda-body (if (== ?l (?a . ?b)) ?b :nothing))


(Define-Function LIST-OF (@els) Show the function list-of in WebOnto
"This is the primitive list constructor.  It is implemented in terms of
    the underlying LISP list construction primitive, LIST")


(Define-Function APPEND (?l1 @ls) Show the function append in WebOnto
"Appends together a number of lists. I cannot be bothered giving its operational
   spec...so you only get a lisp attachment"
:constraints (and (list ?l1) (every (list-of @ls) list)))


(Define-Function CONS (?el ?l) Show the function cons in WebOnto
"Adds ?el to the beginning of list ?l.  
   Note that this cons is less generic than the lisp function with the same name.
   Here the 2nd argument must be a list (in lisp, it can also be an atom)."
:constraints (list ?l)
:lambda-body (append (list-of ?el) ?l))


(Define-Function LENGTH (?l) Show the function length in WebOnto
"Computes the number of elements in a list"
:constraints (list ?l)
:lambda-body (if (= ?l nil) 0 (if (== ?l (?first . ?rest)) (+ 1 (length ?rest)))))


(Define-Function REMOVE1 (?el ?l) Show the function remove1 in WebOnto
"Removes the first occurrence of ?el in ?l and returns the resulting list.
   If ?el is not a member of ?l then the result is ?l"
:constraints (list ?l)
:lambda-body (if (= ?l nil) ?l (if (== ?l (?el . ?rest)) ?rest (if (== ?l (?first . ?rest)) (cons ?first (remove1 ?el ?rest))))))


(Define-Function REMOVE (?el ?l) Show the function remove in WebOnto
"Removes all occurrences of ?el in ?l and returns the resulting list.
   If ?el is not a member of ?l then the result is ?l"
:constraints (list ?l)
:lambda-body (if (= ?l nil) ?l (if (== ?l (?el . ?rest)) (remove ?el ?rest) (if (== ?l (?first . ?rest)) (cons ?first (remove ?el ?rest))))))


(Define-Relation MEMBER (?el ?list) Show the relation member in WebOnto
"A relation to check whether something is a member of a list"
  :iff-def (or (== ?list (?el . ?rest)) (and (== ?list (?first . ?rest)) (member ?el ?rest)))
  :constraints (list ?list))


(Define-Relation EVERY (?l ?rel) Show the relation every in WebOnto
"True if for each term in ?l, say ?term, (holds ?rel ?term) is true.
   For instance, (every '(1 2 3) 'number) is satisfied, while 
   (every '(1 2 pippo) 'number) is not"
  :iff-def (or (= ?l nil) (and (== ?l (?first . ?rest)) (holds ?rel ?first) (every ?rest ?rel)))
  :constraints (unary-relation ?rel))


(Define-Function BUTLAST (?list) Show the function butlast in WebOnto
"Returns all the element of ?list, except the last one.
    If ?list = NIL, then :nothing is returned.  If ?list has
    length 1, then nil is returned"
:constraints (list ?l)
:lambda-body (cond ((null ?list) :nothing) ((null (rest ?list)) nil) ((true) (cons (first ?list) (butlast (rest ?list))))))


(Define-Function LAST (?list) Show the function last in WebOnto
"Returns the last element of a list.  If ?list is empty
    then :nothing is returned"
:constraints (list ?list)
:lambda-body (cond ((null ?list) :nothing) ((null (rest ?list)) (first ?list)) ((true) (last (rest ?list)))))


(Define-Function MAP (?fun @ls) Show the function map in WebOnto
:constraints (and (function ?fun) (every (list-of @ls) list))
:lambda-body (if (null (first (list-of @ls))) nil (cons (apply ?fun (map1 first (list-of @ls))) (apply map (cons ?fun (map1 rest (list-of @ls)))))))


(Define-Function MAP1 (?fun ?l) Show the function map1 in WebOnto
:constraints (and (function ?fun) (list ?l))
:lambda-body (if (null ?l) ?l (cons (call ?fun (first ?l)) (map1 ?fun (rest ?l)))))


(Define-Frame SET  Show the class set in WebOnto

  :own-slots
  (  (Documentation "A set is something which is not an individual. In cyc sets are distinguished
   from collections.  Here we just use the term generically to refer to 
   something which denotes a collection of elements, whether abstract or
   concrete.
   Functions and relations represent sets. ")
  (Subclass-of intangible-thing)))


(Define-Axiom BASIC-SET-TYPES-ARE-DISJOINT  Show the axiom basic-set-types-are-disjoint in WebOnto
"There are three basic types of sets in our ontology, functions
   relations and enumerated sets and these do not intersect"
:= (subclass-partition set (set-of function relation enumerated-set)))


(Define-Function SET-OF (@args) Show the function set-of in WebOnto
"This is the basic set constructor to create a set by enumerating its elements.
   For instance, (setof 1 2) denotes the set {1 2}.
   We represent such a set as a list whose first item is :set"
:lambda-body (cons :set (list-of @args)))


(Define-Frame ENUMERATED-SET  Show the class enumerated-set in WebOnto

  :own-slots
  (  (Documentation "A set represented as (:set-of el1 el_2...el_n), where no el_i is repeated")
  (Subclass-of set))

  :axioms
((<=> (and (= ?x (:set . ?elements)) (not (exists ?el (and (member ?el ?elements) (member ?el (remove1 ?el ?elements)))))) (enumerated-set ?x))
(=> (enumerated-set ?x) (list ?x))
))


(Define-Relation ELEMENT-OF (?el ?set) Show the relation element-of in WebOnto
"A relation to check whether something is an element of a set.  
   Note that because functions and relations are sets, we can prove
   whether a tuple satisfies a relation or a function using ELEMENT-OF.
   For instance, (element-of '(1 2 3) '+) is satisfied because 
   1+2=3 - see definitions below for an operationalization of this approach")


(Define-Axiom ELEMENT-OF-ENUMERATED-SET  Show the axiom element-of-enumerated-set in WebOnto
  "An operationalization of element-of, which works with sets represented as lists."
  := 
  (=>   (And
   (enumerated-set ?l)
   (member ?el (rest ?l)))
    (element-of ?el ?l)
))


(Define-Axiom ELEMENT-OF-SET-AS-RELATION  Show the axiom element-of-set-as-relation in WebOnto
  "A tuple, say  is an element of relation r iff
   (holds r ti t2 t3) is satisfied"
  := 
  (=>   (And
   (relation ?rel)
   (list ?tuple)
   (sentence-holds (cons ?rel ?tuple)))
    (element-of ?tuple ?rel)
))


(Define-Axiom ELEMENT-OF-SET-AS-FUNCTION  Show the axiom element-of-set-as-function in WebOnto
  "A tuple, say  is an element of function f iff
   (= (apply f ti t2) t3) is satisfied"
  := 
  (=>   (And
   (function ?fun)
   (list ?el)
   (= (last ?el) (apply ?fun (butlast ?el))))
    (element-of ?el ?fun)
))


(Define-Function UNION (@sets) Show the function union in WebOnto
:constraints (every (list-of @sets) set)
:lambda-body (apply set-of (setofall ?x (exists ?set (and (member ?set (list-of @sets)) (element-of ?x ?set))))))


(Define-Function INTERSECTION (@sets) Show the function intersection in WebOnto
:constraints (every (list-of @sets) set)
:lambda-body (in-environment ((?all apply union (list-of @sets))) (apply set-of (setofall ?x (and (element-of ?x ?all) (not (exists ?set (and (member ?set (list-of @sets)) (not (element-of ?x ?set))))))))))


(Define-Frame NUMBER  Show the class number in WebOnto

  :own-slots
  (  (Documentation "The class of all numbers")
  (Subclass-of quantity)))


(Define-Frame REAL-NUMBER  Show the class real-number in WebOnto

  :own-slots
  (
  (Subclass-of number)))


(Define-Frame INTEGER  Show the class integer in WebOnto

  :own-slots
  (
  (Subclass-of real-number)))


(Define-Relation < (?x ?y) Show the relation < in WebOnto
"A predicate to test whether a number is less than another"
  :constraints (and (number ?x) (number ?y)))


(Define-Relation > (?x ?y) Show the relation > in WebOnto
"A predicate to test whether a number is greater than another"
  :constraints (and (number ?x) (number ?y)))


(Define-Frame POSITIVE-NUMBER  Show the class positive-number in WebOnto

  :own-slots
  (
  (Subclass-of number))

  :axioms
((<=> (and (number ?x) (> ?x 0)) (positive-number ?x))
))


(Define-Frame NEGATIVE-NUMBER  Show the class negative-number in WebOnto

  :own-slots
  (
  (Subclass-of number))

  :axioms
((<=> (and (number ?x) (< ?x 0)) (negative-number ?x))
))


(Define-Frame NON-NEGATIVE-NUMBER  Show the class non-negative-number in WebOnto

  :own-slots
  (
  (Subclass-of number))

  :axioms
((<=> (and (number ?x) (not (negative-number ?x))) (non-negative-number ?x))
))


(Define-Axiom POS-NEG-NUMBERS-EXHAUSTIVE-PARTITION  Show the axiom pos-neg-numbers-exhaustive-partition in WebOnto
:= (exhaustive-subclass-partition number (set-of positive-number negative-number)))


(Define-Frame POSITIVE-INTEGER  Show the class positive-integer in WebOnto

  :own-slots
  (
  (Subclass-of integer))

  :axioms
((<=> (and (integer ?x) (> ?x 0)) (positive-integer ?x))
))


(Define-Frame NEGATIVE-INTEGER  Show the class negative-integer in WebOnto

  :own-slots
  (
  (Subclass-of integer))

  :axioms
((<=> (and (integer ?x) (< ?x 0)) (negative-integer ?x))
))


(Define-Frame NON-NEGATIVE-INTEGER  Show the class non-negative-integer in WebOnto

  :own-slots
  (
  (Subclass-of integer))

  :axioms
((<=> (and (integer ?x) (not (negative-integer ?x))) (non-negative-integer ?x))
))


(Define-Function + (?x @y) Show the function + in WebOnto
"Adds numbers"
:constraints (and (number ?x) (number (list-of @y))))


(Define-Function * (?x ?y) Show the function * in WebOnto
"Multiplies numbers"
:constraints (and (number ?x) (number ?y)))


(Define-Function SQUARE (?x) Show the function square in WebOnto
:constraints (number ?x)
:lambda-body (* ?x ?x))


(Define-Function - (?x @y) Show the function - in WebOnto
"Subtracts numbers"
:constraints (and (number ?x) (number (list-of @y))))


(Define-Function / (?x ?y) Show the function / in WebOnto
"Divides numbers"
:constraints (and (number ?x) (number ?y)))


(Define-Function LOG (?number ?base)) Show the function log in WebOnto


(Define-Function ROUND (?number) :-> ?int Show the function round in WebOnto
:def (integer ?int))


(Define-Frame STRING  Show the class string in WebOnto

  :own-slots
  (  (Documentation "A primitive class representing strings")
  (Subclass-of individual)
  (Subclass-of intangible-thing)))


(Define-Frame RELATION  Show the class relation in WebOnto

  :own-slots
  (  (Documentation "The class of defined relations.  We assume fixed arity")
  (Subclass-of set)))


(Define-Frame UNARY-RELATION  Show the class unary-relation in WebOnto

  :own-slots
  (
  (Subclass-of relation))

  :axioms
((<=> (and (relation ?r) (= (arity ?r) 1)) (unary-relation ?r))
))


(Define-Frame BINARY-RELATION  Show the class binary-relation in WebOnto

  :own-slots
  (
  (Subclass-of relation))

  :axioms
((<=> (and (relation ?r) (= (arity ?r) 2)) (binary-relation ?r))
))


(Define-Relation TRUE nil Show the relation true in WebOnto
"This is always satisfied")


(Define-Relation FALSE nil Show the relation false in WebOnto
"This is never satisfied")


(Define-Function ARITY (?x) Show the function arity in WebOnto
"The arity of a function or relation.  If a function or relation
   has variable arity, then we treat the last argument as if it were
   a sequence variable.  For instance the argument list for + is
   (?x &rest ?y).  In this case we say that + has arity 2.
   It is important to note that OCML does not support relations with variable
   arity.  The only exception is HOLDS, which has variable arity and is built in
   the OCML proof system"
:constraints (or (function ?x) (relation ?x))
:lambda-body (in-environment ((?l the-schema ?x) (?n length ?l)) (if (every ?l variable) ?n (- ?n 1))))


(Define-Relation VARIABLE (?x) Show the relation variable in WebOnto
"True of an OCML variable")


(Define-Relation VARIABLE-BOUND (?var) Show the relation variable-bound in WebOnto
"True if ?var is  bound in teh current environment")


(Define-Function THE-SCHEMA (?x) Show the function the-schema in WebOnto
"The schema of a function or relation"
:constraints (or (function ?x) (relation ?x))
:lambda-body (if (relation ?x) (relation-schema ?x) (if (function ?x) (function-schema ?x) :nothing)))


(Define-Function FUNCTION-SCHEMA (?f) Show the function function-schema in WebOnto
:constraints (function ?f))


(Define-Function RELATION-SCHEMA (?rel) Show the function relation-schema in WebOnto
:constraints (relation ?rel))


(Define-Relation HOLDS (?rel &rest ?args) Show the relation holds in WebOnto
"A meta-level relation which is true iff the sentence (?rel . ?args) is true.
   The length of ?args must be consistent with the arity of the relation"
  :constraints (and (relation ?r) (= (arity ?rel) (length ?args))))


(Define-Relation SENTENCE-HOLDS (?sentence) Show the relation sentence-holds in WebOnto
"The same as HOLDS, but takes only one argument, a sentence whose truth
   value is to be checked"
  :constraints (and (== ?sentence (?rel . ?args)) (relation ?rel) (= (arity ?rel) (length ?args))))


(Define-Frame FUNCTION  Show the class function in WebOnto

  :own-slots
  (  (Documentation "The class of all defined functions")
  (Subclass-of set)))


(Define-Function APPLY (?f ?args) Show the function apply in WebOnto
"(apply f (arg1 .....argn)) is the same as 
   (f arg1 ....argn)"
:constraints (and (function ?f) (list ?args)))

Contact Point

Email: John Domingue (j.b.domingue@open.ac.uk)