.Open Classifications and Ontologies Domains have large numbers of terms indicating objects of different sets and types. This are typically organized in several hierarchies. It is useful to have a simple way of expressing such hierarchies. .Open Sets . Enumerations and Finite sets of constants It would be nice to have a notation that introduces a set of values for a variable. This is allowed in Pascal, C, C++, and Ada. Currently a declaration like .As_is traffic_light:{Red, Amber, Green}. would not automatically define the terms `Red`, `Amber`, etc. However .As_is traffic_lights::={Red, Amber, Green}. is short hand for .Box .As_is traffic_lights::Sets, .As_is Red::traffic_lights, .As_is Amber::traffic_lights, .As_is Green::traffic_lights, .As_is |- traffic_lights={Red, Amber, Green}. .Close.Box .See http://www.csci.csusb.edu/dick/maths/logic_30_Sets.html#Enumerating%20Finite%20Sets Notice that no order is implied between the elements listed above. In programming, an enumeration is an linearly ordered set and in MATHS the notation is .As_is enum(intuitive, sensing) .See http://www.csci.csusb.edu/dick/maths/math_77_Enumerations.html . Subsets The simplest classification system for a set of objects is created by using the Subsets. In the MATHS notation the set of all subsets is indicated by the curly "@" sign. This is reminiscient of the curly P used by mathematicians: (set)|- For Set S, @S = { A. A==>S }. .Box For example to make B and C be special kinds of A we write: A:Sets, B:: @A, C:: @A. The above imply the following: ()|- (E1):B ==> A. ()|- (E2):C ==> A. (E1)|- for all b:B, b in A. (E2)|- for all c:C, c in A. They do not assume that every A is either a B or C however. Some A's may be neither. .As_is <-------------------------A-----------------> .As_is <----------B---> .As_is <----C-------------> .Close.Box You need to be careful of the meaning of words indicating subsets in English and other natural languages. For example in the set of `People` we often distinguish `Tall` and `Short` people: .Net People::Sets, Tall::@People, Short:: @People. .Close.Net What we should not assume is that everybody is either Tall or Short. We have people who are neither. So we do not add the assumption People = Tall | Short. Niether can we assume Tall = People ~ Short. Short = People ~ Tall. What we do have is Short ==> People~Tall, Tall ==> People~Short. .As_is <--Short--><------------People~Short-------------------> .As_is <-------People~Tall-----------------><------Tall-------> This is a common pattern when we have and underlying ordering governed by an attribute -- in the above case `height`. There is another trap when you are trying to compare items in different sets... for `large chihuahua` vs `small saint bernard`. . BNF -- unions that cover a set Bachus Naur Form allows one to define one set as the union of other sets: .Box A::= B | C. This implies the following deductions: ()|- for all a:A, a in B or a in B. ()|- for all b:B, b in A. ()|- for all c:C, c in A. However, it is possible for an item in A to be in `both` B and C. .As_is <-------------------------A-----------------> .As_is <----------B---------> .As_is <-------------C-------------> In jargon: A is covered by B and C. See $set_families. .Close.Box . Partitions -- nonoverlapping classification The statement A >== {B, C}, says the same thing as A = B | C and B & C = {}. A partition implies B = A ~ C and C=A~B. In other words that every A is a either a B or a C, and no A is both a B and C. .As_is <-------------------------A-----------------> .As_is <----------B----> .As_is <------------C-------------> In the UML this is a disjoint and complete specialization. For more on the theory of partitions and their relationship to mappings and equivalence relations see $set_families. .Close Sets .Open Nets . Abbreviations The following are introduced to allow the simple and natural expression of simple ideas like a person is either male or female but not both: .As_is Person::=Net{..... Either male or female. .... }. For A, B:word, either A or B::=Net{ A, B:@. A iff not B }, Either A or B::=either A or B. For A, B:word, L:#("," word), (either A L, or B) ::=Net{ A, L, B:@. One(A L, B) }, (Either A L, or B) ::=(either A L, or B). .Close Nets .Open Polymorphism MATHS permits the same identifier to have different meanings in different contexts. A context is determined by the type of thing that fits in that context. A consequence of allowing multiple polymorphic symbols in documentation is that all functions in MATHS should be seen as "multimethods" .See [PuppydogRacoon99]. In the classic problem of "Feeding the Animals" for example, we have two types: Animal and Food. Animals are classified as Wolves and Cows. Foods are classified as Meat and Grass. All Animals eat Food and get energy from it, but Wolves only eat Meat and Cows only eat Grass. A language with multimethods or another form of automaic down casting will invalidate the idea of Cows eating Meat and Wolves eating Grass. .Box FTA::=following .Net Feeding the Animals. Animal::Sets. Food::Sets. |-Animal>== {Wolf, Cow}. |-Food>== {Meat, Grass}. |-Number>== {int, float}. energy::Animal->Number. energy::Wolf->float. energy::Cow->int. energy::Food->Number. energy::Grass->int. energy::Meat->float. eat::Animal>Animal. For all cow:Cows, grass:Grass, eat(cow,grass) ::= the Cow(energy=>energy(cow)+energy(grass)). For all wolf:Wolf, meat:Meat, eat(wolf,meat) ::=the Wolf(energy=>energy(wolf)+energy(meat)). It is now valid to have Cows eat Grass and Wolves eat meat and reason with the consequences but nothing can be deduced about `eat(wolf,grass)` and `eat(cow,meat)`. Further because $Animal and $Food are declared separately as `Sets` they are implictly not in the same type. This means that `eat(grass, wolf)` is illegitimate in this Net. However, if this net was instanciated with two sets (`Animal`, `Food`) in the same hierarchy then an expression like `eats(grass, cow)` is definable and may even provoke thought about the meaning intended for `eat`. Indeed, `eats(wolf, cow)` starts to look meaningful and ominous. .Close.Net .Close.Box . Duck Typing MATHS does allow something like the kind of polymorphism found in Python where a collection of Nets of declare the same attributes, then they define same types of object. This is because in MATHS `types` are universal sets. Thus .See ./notn_14_Docn_Semantics.html the type of a Net is the type of the Net with no axioms, constraints, etc. So, many objects, though they are in different sets, will be of the same `type`. However if two nets have different variables then they will belong in different types. In particular, if one net `ABC` say defines `a:A`, `b:B`, `c:C` then its objects are of a different type to the net `AB` that only defines `a:A` and `b:B`. We would say that `ABC` .Key extends `AB`. We could even define `ABC` as `AB with {c:C}` as an explicit extension. .Close Polymorphism . See Also set::=http://www.csci.csusb.edu/dick/maths/logic_30_Sets.html. set_families::=http://www.csci.csusb.edu/dick/maths/logic_31_Families_of_Sets.html. set_theory::=http://www.csci.csusb.edu/dick/maths/logic_32_Set_Theory.html. enumerations::=http://www.csci.csusb.edu/dick/maths/math_77_Enumerations.html. ontology::=http://www.csci.csusb.edu/dick/samples/index.html#Ontologies. an_Ontology_for_English::=http://www.csci.csusb.edu/dick/maths/logic_8_Natural_Language.html. .Close Classifications and Ontologies