Possible handouts. (Due to an idiosyncracy of the mypage.iu.edu web server, I've renamed Prolog files
*-pl; please fix the names if you download the files.)
Last week we looked at two types of primitive data: characters and numbers.
And did we also notice that boolean (true/false) is a primitive type, conceptually equivalent to a single bit? Everything else, in a sense, can be reduced to these (although it may sometimes be more efficiently to encode it directly as bits?). For example:
Nevertheless, when we combine primitive data, we also need to pay attention to the way it is organized or structured. There are more sophisticated structures than a one-dimensional sequence or a two-dimensional picture.
We'll begin looking at ways of structuring data, first using logic, then set theory, and finally relations, which are sets of a special kind.
Logic deals with what is true or false: usually called propositions or statements. This has a very nice fit to the primitive data type boolean, which is true or false.
We'll begin with the propositional calculus, which considers each proposition as a unit (atom) and looks at how we may combine propositions; and then proceed to the predicate calculus, which considers propositions as having an internal, subject-predicate structure.
See Coursepack, section 5.2.1
See Coursepack, section 5.2.2
See Coursepack, section 5.7.
Logic cannot handle some kinds of knowledge (at least, not without some enhancements):
Nevertheless, logic is an excellent foundation for most information representation, which does not have these special needs.
See Coursepack, section 2.1
If we've got a bunch of facts of the same type, like this—
father(bill, bob, 1950). father(andy, joy, 1960). father(hal, judy, 1970). father(bob, bill, 1980).
—we can boil them down to a table, like this:
If we confine ourselves to tables, we have facts, but more compactly represented; we have nothing to do with rules; we can gain some efficiencies.
See Coursepack, sections 2.2–2.8
The relational algebra is the study of relations and their operations.