The key discovery by Whitehead and Russell in their work on "The Principles of Mathematics" was that the idea of type could be used to avoid paradoxes as long as it was a syntactic concept. This means that each type defines those expressions that are valid or meaningful as well as what meaning can be attached. The Type system outlaws from the logic any discussions of expressions that involve contradictions in terms and paradoxes like the Russell Set. Thus any theory of types is a metalinguistic activity and taks place in yet another universe of discourse.
Simply put: Each type is linked to a set of expressions and a set of meanings and connects them together. And each type does this in its own way. Types are the main way that MATHS is extended.
All types must define a non-empty set of objects -- a valid universe of discourse -- so that we can use the predicate calculus to reason about objects of that type.
Standard Types
The following are common descriptions of types
(Alphabets):
(@):
(Char):
(Documents):
(Events):
(Numbers):
(Dimensions):
(Sets):
(Times):
(Types):
Basic Types
In real systems we work with universes of discouses like: Employees,
Products, Animals, Telephones,... Michael Jackson notes that we need to
be able to designate individuals in these domains. Terry Halpin has noted
that the individuals/elements/objects/"values" can be described by a definite
description like this
the Employee with SSN 123-45-6789
the[e:Employee](e.SSN="123-45-6789")
It seems wise to introduce -- as a partly-baked idea -- a standard way to dessignate objects of a type:
Employee("123-45-6789")
Here is a possible formalization:
So we might define, as an example,
By further defining functions, predictaes, sets, relations, etc. we can easily model the types of objects in the real world. This conceptual model is an excellent guide to designing data bases, a natural ontology for the domain, and a source of ideas for classes in object-oriented programming.
A Type is defined to have two key attributes attributes:
Notice that a type T is not a member of a type.
Syntax
Partly Baked Idea
Discriminated unions are useful for decribing data bases and partial
tples. A possible semantics is found in the theory of co-products
in Category Theory(CATEGORY).
If D is a list of declarations then \/{D} is a discriminated union or co-product:
Semantics.
As a rule the description is a string that describes the objects in the
following way:
Hence
As a generallity the type of an expression can always be determined (sometimes relative to certain assumed types), from the type of the parts and the operators that make it up. Even so a modicum of overloading is allowed - an symbols can be defined to carry out different operations, (and return different types, depending on the context. Such a definition is written: term::context=expression For example, here are three different views of an assignment:
Standard examples of overloading:
(casts):
As a rule: An overloading can not take an existing valid meaning in the given context. So (|) is given a meaning for all sets and so can not be extended to operate on sets as well.
Polymorphic and generic terms have definitions written like this:
where t(T) is some formula that contains T as a free variable. If the symbol T appears in the expression then it is interpreted as the universal set of a generic type T. In general T can be any list of symbolic variables. Completely generic terms ( "macros") can be defined but are rare. If v1,v2,v3,... are previously undeclared variables then
creates a function that applies to all types of operands and is short for
. . . . . . . . . ( end of section Introduction to Types) <<Contents | End>>
Note. If T is this type then x in T.objects iff x has type T.
Symbols for types have two meanings, one of these is in a normal part of an expression where it represents the set of objects or an identity map from objects to objects depending on the context.
The other meaning is when the description identifies the type in a declaration.
EXPRESSION uses infixes(T) to define expressions(T).
Used in EXPRESSION.
Used in Proposition Calculus.
See Also Expressions. [ Expressions ]
(syntax_symbolizes_semantics): For all T:Types, e:T.elements, symbol(e.syntax, T, e.semantics).
(descriptions_symbolise_types): For all T:Types, symbol(T.description, Types, T).
(different_types_do_not_overlap): For all T1, T2:Types, T1=T2 iff some (T1.objects&T2.objects).
(parallels): For T:Types, P:T.parallels, PARALLEL(expressions(@), T.expressions, P.syntax, P.semantics).
(serials): For T:Types, s:T.serial, SERIAL(T.expressions, T.expressions, s, T.infix_pairs(s)).
Examples of theoretical types
(Example_PC):Types::=
or even
. . . . . . . . . ( end of section Theory of Types) <<Contents | End>>
The definition of the type '@' in terms of type theory is an interesting test case of the system, and is rather like attempting to build the foundation of a building on its roof. The inabillity to this suggests limits to the system. The successful construction of a model of logic, on a theory of types, expressed in terms of that logic, establishes the power but not the consistency of the system.
| representation | Type | meaning |
|---|---|---|
| not | @->@ | true+>false|false+>true, |
| and | @><@->@ | (true,true)+>true |+> false, |
| or | @><@->@ | (false,false)+>false |+> true, |
| iff | @><@->@ | {(true,true),(false,false)}+>true |+> false, |
| if_then_ | @><@->@ | (true,false)+>false |+> true, |
| in | T><@T->@ | map x,X(x.X), |
| = | T><T->@ | map x,y((x,y).(equality(T))), |
| all | @^T->@ | map F:@^T(img(F)=true), |
| ==> | (@^T)><(@^T)->@ | map [A,B] (all(map x(if x.A then x.B))). |
| ... |
Consistency and Non-empty types
Types must always define a non-empty set of objects. And a simple
way to prove this is give a finite example.
Consistency is demonstrated by exhibitting a finite model.
Another techniqu is to use the simplest (non-recursive) constructions.
Avoiding paradoxes
Notice that sets are defined by a formula
We can prove that the set of data types leads to a consistent theory by constructing a model in terms of naive set theory and n-tples. The data types are those generated from @ and Nat by operations of fnite Products and coproducts. The proof of relative consistency is done by using Codd normalizations. Model each type as a set of n-tpls of elementary object. Replace T2^T1 by (T1><T2). The result is the Third Normal Form Model.
When defining new types recursion must not be combined with power and subset
operators because these lead to paradoxes. Cantor Russell...
[click here
if you can fill this hole]
Care also needs to be taken with using generic operators (defined with an implicit type for convenence) in a way that the actual types involved are made explicit. This is the problem as found in C++ templates. In MATHS one example was the original definition of the function that returns the cardinality or size of a set:
So, this is true
The following expression
. . . . . . . . . ( end of section Meta-theory of types) <<Contents | End>>
Products
[ Notation $Net{a:T1, b:T2 ...} ]
Quotient types
If there is a map from one type to another then there is an easy way to
generate a new type - by grouping the elements of the second type according
to their values under the mapping - this is called the quotient type with
respect to the mapping.
Given f:T1^T2 we can always derive a new type (symbolized T2/f) isomorphic to a sub-set of @T2 where
Given a R:@(T1><T1) which is reflexive, transitive and symmetric (an equivalence relation) then there is a subset of @T1, symbolised T1/R, defined by T1/R::={X:@T1||for all x,y:X( x R y)}. Then there is a map (T1/R)^T1 from x:T1 to x/R:T1/R
We can define a relation equivalence modulo f x = y wrt f ::= f(x)=f(y) which leads to the same "quotient type".
Example Quotient Type
Constructing Q (the rational numbers) from Z (the integers).
[ Notation] .
. . . . . . . . . ( end of section Deriving New types) <<Contents | End>>
We start be defining the set of fully parenthesized expressions(p_expressions) of a given type and then state circumstances under which parentheses can be removed without change of meaning.
[ Math.64 Standard Forms.Standard Forms in Programming Languages.Macros ]
The above defines fully parenthesized expressions.
Example: "1+(2*3*4)+5" parenthesis_removal "1+2*3*4+5" and not "(1+2)*3" parenthesis_removal "1+2*3".
The semantics of MATHS expressions are trivial when formalized in MATHS. The correct meaning of a MATHS expression looks (in MATHS) like itself . Spivey has remarked on a similar phenomena in the attempt to define Z in terms of set theory and set theory using Z. The denotation (map from syntax into semantics) is the identity mapping. Such a circular definition can be shown to be useless for ignorant readers because ignorance is a trivial fixed point[Spivey 88]. Luckily, complete definition is not essential for a human being to learn a language.
Future research can establish the semantics in terms of other languages - such as Z, Larch, .... The syntax and a prossibly feasible way to parse expressions is a notational problem. [ Notation.12 Expressions ]
}=::EXPRESSIONS
. . . . . . . . . ( end of section Typed Expressions) <<Contents | End>>
paths, prime_links, links::(names(D))^( names(D)><names(D)). For T1,T2, prime_links(names(T1), names(T2)=names(F(T1,T2))| { "("! l1 ! ! ")"||for some C:#D, f:F(T1,T2), l:#char(l=names o f and T2= ><C)}.
For T1,T2, links(names(T1), names(T2))=prime_links(T1,T2)|prime_links(T2,T1)
For n1,n2:names(D), paths(n1,n2)=links(n1,n2) |{ l!".."!p || for some n3:names(D), l:links(n1,n3), p:paths(n3,n2)}.
??|-paths(T1,T2) in regular_expression(|(links)).?
For T2,
It is easy to set up a map from paths into relations.
if rationalized then conceptual_model in DAG.
Relationships with a key
Suppose we have a network
The above is sometimes called a functional dependency. These are worth noticing since they indicate the logical structure that underlies the original design.
The process starts with a set S:@N and finding a k and d such that
Data
For D1,D2:documentation, a:Arrow,
For two lists of declarations D1, D2, Data{D1. D2}::=Net{D1}->Net{D2}.
Since D1 and D2 have no definitions or wffs then
If we are discussing fixed set of variables and types with unique identifiers then this is abreviated further - suppose we have a DICTIONARY; DICTIONARY=Net{ v1:T1, ...} and let type(v[i])=t[i], then Data{ k1,k2,...,k[n]. d1,d2,..., d[m]} ::=@DICTIONARY(k1,k2,...,k[n])->(d1,d2,...,d[m]).
Data Base Notation
If D is a list of declarations then \/{D} is a discriminated union and so a natural model for a data base. The components of D are the different types of data/entities.
Open Example Data Base -- University
{ student(123-45-6789, "John Doe", ...),
. . . . . . . . . ( end of section Example Data Base -- University) <<Contents | End>>
Purpose
The aim of normalization is to document all the structure in some given
data in terms of simple sets and mappings. Or, in McCathy's terminology,
the purpose is to derive the abstract syntax from the concrete syntax. A
third view is that we wish to discover and name all the implicit
relationships. Finally we can say that normalization derives a standard
semantic domain to model what is known about some data. The effect is a
repeated partioning of an initially homogeneous set of n-tuples into
different classes and types.
Normalization is an analytical tool more than a design tool. The goal is to model part of the problem not to work out detailed solutions. Design has to be concerned with performance, physical limitations, and ways to encode the necessary data. Relational data is a starting place for design and a useful user interface. They are simple to understand and use but tend to not use machinary efficiently. The relational retrieval systems are also limmitted in power[]. However they are a high powered analytical tool separating an area into many simple relations. These relations are a canonical basis for design work.
0NF, 1NF, 2NF, and 3NF
First, second, and third normalization steps operate on a set of sets of
simple types by repeatedly replacing one type by two or more types with the
subsets of the variables. The names of the variables are unique and their
domains don't change. Often the domains are strings. Hence the domains
are omitted.
One starts with samples, displays, or existing data structures. Abstraction starts by naming component data and their domains. Then a plausible key is postulated and the result normalized until all functional dependencies are represented by key->data relationships. The 3 step process goes thru an easy to recall pattern : the key, the whole key, and nothing key.
. . . . . . . . . ( end of section Formal model) <<Contents | End>>
Notation
The data on the list are
Now select a key: product_name samples>-- \/{
}
Here is the analysis of a receipt from a cashier at a local supermarket:
Extract repeated group of line items at the store.
data_base{
.Reference Wu 92, Margeret S. Wu, The Practical Need for a Fourth Normal Form, 23rd SIGCSE Tech Symp on CSEd 92, SIGCSE Bull V24n1(Mar 92)pp19-23
Example -- Hospital
Physicians work at a location and are members of groups. The following is in 3NF (BCNF):
Let R be a subset of type T with maps x, y, and z into x:T->X, y:T->Y, and z:T->Z. A multivalued dependency MVD(x,y,z) occurs iff there is a value of x where whenever two different tuples have the same x and different y and z values then there are two more tuples in R.
For Types T, R:@T,x,y,z:#variables(T),
An MVD(x,y,z) is trivial if y is subset of x (|y==>|x) or x and y form a complete set of variables of T (|(x!y)=variables(T)).
A set of relations in BCNF is in 4NF iff all MVDs are trivial.
. . . . . . . . . ( end of section Normalisation of data) <<Contents | End>>
Quantification and Verification ...
...
. . . . . . . . . ( end of section Types as a Data Model) <<Contents | End>>
Types as Object-oriented objects
. . . . . . . . . ( end of section Types as Object-oriented objects) <<Contents | End>>
Notes on MATHS Notation
Special characters are defined in
[ intro_characters.html ]
that also outlines the syntax of expressions and a document.
Proofs follow a natural deduction style that start with assumptions ("Let") and continue to a consequence ("Close Let") and then discard the assumptions and deduce a conclusion. Look here [ Block Structure in logic_25_Proofs ] for more on the structure and rules.
The notation also allows you to create a new network of variables and constraints. A "Net" has a number of variables (including none) and a number of properties (including none) that connect variables. You can give them a name and then reuse them. The schema, formal system, or an elementary piece of documentation starts with "Net" and finishes "End of Net". For more, see [ notn_13_Docn_Syntax.html ] for these ways of defining and reusing pieces of logic and algebra in your documents. A quick example: a circle = Net{radius:Positive Real, center:Point}.
For a complete listing of pages in this part of my site by topic see [ home.html ]
Notes on the Underlying Logic of MATHS
The notation used here is a formal language with syntax
and a semantics described using traditional formal logic
[ logic_0_Intro.html ]
plus sets, functions, relations, and other mathematical extensions.
For a more rigorous description of the standard notations see