;;; -*- Mode:Lisp; Syntax: Common-lisp; Package:ONTOLINGUA-USER; Syntax:COMMON-LISP; Base:10 -*- 

;;; Basic Units 
;;; (c) 1993 Greg Olsen and Thomas Gruber 


(in-package "ONTOLINGUA-USER") 

(define-theory standard-units (physical-quantities) 

  "This theory defines a set of basic units of measure, a set of 
fundamental dimensions and a few others. Each unit-of-measure is 
defined with its relationship to SI units for the fundamental 
dimensions.  It is intended that this theory represent enough 
information to convert among any pair of units of the same dimension 
that are either defined as basic units here or built up from the basic 
units using the composition operators * and EXPT.") 

(in-theory 'standard-units) 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;; SOME FUNDAMENTAL DIMENSIONS 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 

;; The IDENTITY-DIMENSION is defined in the base theory, PHYSICAL-QUANTITIES. 

(define-instance LENGTH-DIMENSION (physical-dimension)  
  "The fundamental dimension of length, as defined by the SI 
standard.") 

(define-instance MASS-DIMENSION (physical-dimension) 
  "The fundamental dimension of mass, as defined by the SI standard.") 

(define-instance TIME-DIMENSION (physical-dimension) 
  "The fundamental dimension of physical, continuous time,  
as defined by the SI standard.") 

(define-instance ELECTRICAL-CURRENT-DIMENSION (physical-dimension) 
  "The fundamental dimension of electrical current, as defined by the 
SI standard.") 

(define-instance THERMODYNAMIC-TEMPERATURE-DIMENSION (physical-dimension) 
  "The fundamental dimension of temperature, as defined by the SI standard.") 

(define-instance AMOUNT-OF-SUBSTANCE-DIMENSION (physical-dimension) 
  "The fundamental dimension of amount of substance, as defined by the 
SI standard.") 

(define-instance LUMINOUS-INTENSITY-DIMENSION (physical-dimension) 
  "The fundamental dimension of luminous-intensity, as defined by the 
SI standard.") 

(define-instance FORCE-DIMENSION (physical-dimension)  

  "The physical dimension of force is defined as mass times length 
over time squared.  In some systems FORCE-DIMENSION is fundamental and 
MASS-DIMENSION is a derived dimension.  This theory goes with the SI 
standard, but we include the definition of force as a non-fundamental 
built-in dimension." 

  :axiom-def (= FORCE-DIMENSION 
		(* MASS-DIMENSION  
		      (* LENGTH-DIMENSION (expt TIME-DIMENSION -2))))) 

(define-instance ENERGY-DIMENSION (physical-dimension)  

  "The physical dimension of energy is defined as mass times length squared 
over time squared." 

  :axiom-def (= ENERGY-DIMENSION  
		(* MASS-DIMENSION  
		      (* (expt LENGTH-DIMENSION 2) (expt TIME-DIMENSION -2))))) 

(define-instance CURRENCY-DIMENSION (physical-dimension) 
  "The fundamental dimension of currency or money. 
CURRENCY-DIMENSION is to currencies as US-dollar's and ECU's as the 
LENGTH-DIMENSION is to units of length such as meters.") 



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;; SI (Systeme International) units 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 

(define-class SI-unit (?unit) 

  "The class of Systeme International units." 

  :def (unit-of-measure ?unit)                         ;redundant but helpful 

  :axiom-def (and (system-of-units SI-unit) 
                  (= (base-units SI-unit) 
                     (setof meter kilogram second-of-time ampere 
                            degree-kelvin mole candela 
                            identity-unit)))) 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;; BASIC UNITS 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 

;;; The IDENTITY-UNIT is defined in the PHYSICAL-QUANTITIES theory 

(define-instance SECOND-OF-TIME (unit-of-measure) 
  "The SI standard unit of time.  It is not called 'second' to distinguish 
it from the function second (from the KIF-lists ontology) that denotes the 
second element of a sequence." 
  :axiom-def (and (= (quantity.dimension second-of-time) time-dimension) 
                  (SI-unit second-of-time))) 

(define-instance MINUTE (unit-of-measure) 
  "Time unit."    
  := (* second-of-time 60) 
  :axiom-def (= (quantity.dimension minute) time-dimension)) 
   
(define-instance HOUR (unit-of-measure) 
  "Time unit." 
  := (* minute 60) 
  :axiom-def (= (quantity.dimension hour) time-dimension)) 

(define-instance METER (unit-of-measure) 
  "SI length unit.  No conversion function is given 
because this is a standard." 
  :axiom-def (and (= (quantity.dimension meter) length-dimension) 
                  (SI-unit meter))) 

(define-instance KILOMETER (unit-of-measure) 
  "" 
  := (* meter 1000) 
  :axiom-def (= (quantity.dimension kilometer) length-dimension)) 

(define-instance INCH (unit-of-measure) 
  "English length unit." 
  := (/ meter 39.37) 
  :axiom-def (= (quantity.dimension inch) length-dimension)) 

(define-instance FOOT (unit-of-measure) 
  "English length unit of feet." 
  := (* inch 12) 
  :axiom-def (= (quantity.dimension foot) length-dimension)) 

(define-instance MILE (unit-of-measure) 
  "English length unit." 
  := (* foot 5280) 
  :axiom-def (= (quantity.dimension mile) length-dimension)) 

(define-instance ANGSTROM (unit-of-measure) 
  "ang.strom \'a<nj>-str<e>m also '<o.><nj>-\ n (1897) 
 [Anders J. <A^o>ngstr<o:>m] 
    :a unit of length equal to one ten-billionth of a meters -- used esp.  
    for wavelengths of light." 
  := (/ meter (expt 10 10)) 
  :axiom-def (= (quantity.dimension angstrom) length-dimension)) 

(define-instance KILOGRAM (unit-of-measure) 
  "SI mass unit of kilogram." 
  :axiom-def (and (= (quantity.dimension kilogram) mass-dimension) 
                  (SI-unit kilogram))) 


(define-instance POUND-MASS (unit-of-measure) 
  "English pound of mass." 
  :axiom-def (= (quantity.dimension pound-mass) mass-dimension) 
  := (/ kilogram 2.2046)) 

(define-instance SLUG (unit-of-measure) 
  "English mass unit." 
  := (/ pound-mass 1000) 
  :axiom-def (= (quantity.dimension slug) mass-dimension)) 

(define-instance NEWTON (unit-of-measure) 
  "SI force unit." 
  := (* (* kilogram meter) (expt second-of-time -2)) 
  :axiom-def (and (= (quantity.dimension newton) force-dimension) 
                  (SI-unit newton))) 
        
      
(define-instance AMPERE (unit-of-measure) 
  "SI electrical current unit." 
  :axiom-def (and (= (quantity.dimension ampere) 
                     electrical-current-dimension) 
                  (SI-unit ampere))) 

(define-instance POUND-FORCE (unit-of-measure) 
  "English pound of force." 
  :axiom-def (= (quantity.dimension pound-force) force-dimension) 
  := (/ newton 4.448)) 

(define-instance JOULE (unit-of-measure) 
  "SI energy unit." 
  := (* newton meter) 
  :axiom-def (and (SI-unit joule) 
                  (= (quantity.dimension joule) energy-dimension))) 

(define-instance BTU (unit-of-measure) 
  "British thermal unit, a unit of energy." 
  := (* 1055.0 joule) 
  :axiom-def (= (quantity.dimension btu) energy-dimension)) 

(define-instance PASCAL (unit-of-measure) 
  "SI pressure unit." 
  := (* newton (expt meter -2)) 
  :axiom-def (and (SI-unit pascal) 
                  (= (quantity.dimension pascal) 
                               (* force-dimension 
                                  (expt length-dimension -2))))) 

(define-instance DEGREE-KELVIN (unit-of-measure) 

  "A unit of thermodynamic temperature.  The degree-Kelvin  
differs from the Celcius scale ..." 
  :axiom-def (and (= (quantity.dimension degree-kelvin)  
                               thermodynamic-temperature-dimension) 
                  (SI-unit degree-kelvin))) 

(define-instance DEGREE-RANKINE (unit-of-measure) 

  "Being, according to, or relating to an absolute-temperature scale on 
which the unit of measurement equals a Fahrenheit degree and on which 
the freezing point of water is 491.67<^o> and the boiling point 
671.67<^o>. [Webster]"  
  := (* degree-kelvin (/ 5 9)) 
  :axiom-def (= (quantity.dimension degree-rankine) 
                thermodynamic-temperature-dimension)) 

(define-instance RADIAN (unit-of-measure) 
  "Angular measurement unit." 
  := identity-unit 
  :axiom-def (= (quantity.dimension radian) identity-dimension)) 

(define-instance DEGREE (unit-of-measure) 
  "Angular measurement unit." 
  := (* radian (/ pi 180)) 
  :axiom-def (= (quantity.dimension degree) identity-dimension)) 

(define-instance US-DOLLAR (unit-of-measure) 
  "An example currency unit." 
  :axiom-def (= (quantity.dimension us-dollar) currency-dimension)) 

(define-instance US-CENT (unit-of-measure) 
  "Currency measurement unit." 
  := (/ US-DOLLAR 100) 
  :axiom-def (= (quantity.dimension us-cent) currency-dimension)) 

(define-instance MOLE (unit-of-measure) 
  "SI unit for amount of substance.  A mole of a substance is the 
amount of that substance that contains 6.02252 x 10^23 elementary 
entities.  Those entities may be atoms, molecules, ions, electrons, 
other particles, or specified groups of such particles.  One mole 
of carbon atoms (the C^12 isotope) is exactly 12 grams [Halliday 
and Resnick].  In this ontology we say that the specified unit 
is the molecule, so that the MOLE stands by itself as a unit." 

  :axiom-def (and (= (quantity.dimension MOLE) 
                     amount-of-substance-dimension) 
                  (SI-unit MOLE))) 

(define-instance CANDELA (unit-of-measure) 
  "The CANDELA is the SI unit for luminous intensity." 

  :axiom-def (and (= (quantity.dimension CANDELA) 
                     luminous-intensity-dimension) 
                  (SI-unit CANDELA))) 

This Lisp-to-HTML translation was brought to you by
François Gerbaux and Tom Gruber