equal
deleted
inserted
replaced
7 level of classes and the results will be applicable to all types in a class, |
7 level of classes and the results will be applicable to all types in a class, |
8 just as in axiomatic mathematics. These ideas are demonstrated by means of |
8 just as in axiomatic mathematics. These ideas are demonstrated by means of |
9 our above ordering relations. |
9 our above ordering relations. |
10 *} |
10 *} |
11 |
11 |
12 subsubsection{*Partial orders*} |
12 subsubsection{*Partial Orders*} |
13 |
13 |
14 text{* |
14 text{* |
15 A \emph{partial order} is a subclass of @{text ordrel} |
15 A \emph{partial order} is a subclass of @{text ordrel} |
16 where certain axioms need to hold: |
16 where certain axioms need to hold: |
17 *} |
17 *} |
25 text{*\noindent |
25 text{*\noindent |
26 The first three axioms are the familiar ones, and the final one |
26 The first three axioms are the familiar ones, and the final one |
27 requires that @{text"<<"} and @{text"<<="} are related as expected. |
27 requires that @{text"<<"} and @{text"<<="} are related as expected. |
28 Note that behind the scenes, Isabelle has restricted the axioms to class |
28 Note that behind the scenes, Isabelle has restricted the axioms to class |
29 @{text parord}. For example, this is what @{thm[source]refl} really looks like: |
29 @{text parord}. For example, this is what @{thm[source]refl} really looks like: |
30 @{thm[show_types]refl}. |
30 @{thm[show_sorts]refl}. |
31 |
31 |
32 We have not made @{thm[source]less_le} a global definition because it would |
32 We have not made @{thm[source]less_le} a global definition because it would |
33 fix once and for all that @{text"<<"} is defined in terms of @{text"<<="}. |
33 fix once and for all that @{text"<<"} is defined in terms of @{text"<<="}. |
34 There are however situations where it is the other way around, which such a |
34 There are however situations where it is the other way around, which such a |
35 definition would complicate. The slight drawback of the above class is that |
35 definition would complicate. The slight drawback of the above class is that |
82 |
82 |
83 lemma "(P::bool) << Q \<Longrightarrow> \<not>(Q << P)"; |
83 lemma "(P::bool) << Q \<Longrightarrow> \<not>(Q << P)"; |
84 by simp; |
84 by simp; |
85 |
85 |
86 text{*\noindent |
86 text{*\noindent |
87 The effect is not stunning but demonstrates the principle. It also shows |
87 The effect is not stunning, but it demonstrates the principle. It also shows |
88 that tools like the simplifier can deal with generic rules as well. Moreover, |
88 that tools like the simplifier can deal with generic rules as well. Moreover, |
89 it should be clear that the main advantage of the axiomatic method is that |
89 it should be clear that the main advantage of the axiomatic method is that |
90 theorems can be proved in the abstract and one does not need to repeat the |
90 theorems can be proved in the abstract and one does not need to repeat the |
91 proof for each instance. |
91 proof for each instance. |
92 *} |
92 *} |
93 |
93 |
94 subsubsection{*Linear orders*} |
94 subsubsection{*Linear Orders*} |
95 |
95 |
96 text{* If any two elements of a partial order are comparable it is a |
96 text{* If any two elements of a partial order are comparable it is a |
97 \emph{linear} or \emph{total} order: *} |
97 \emph{linear} or \emph{total} order: *} |
98 |
98 |
99 axclass linord < parord |
99 axclass linord < parord |
116 common case. It is also possible to prove additional subclass relationships |
116 common case. It is also possible to prove additional subclass relationships |
117 later on, i.e.\ subclassing by proof. This is the topic of the following |
117 later on, i.e.\ subclassing by proof. This is the topic of the following |
118 paragraph. |
118 paragraph. |
119 *} |
119 *} |
120 |
120 |
121 subsubsection{*Strict orders*} |
121 subsubsection{*Strict Orders*} |
122 |
122 |
123 text{* |
123 text{* |
124 An alternative axiomatization of partial orders takes @{text"<<"} rather than |
124 An alternative axiomatization of partial orders takes @{text"<<"} rather than |
125 @{text"<<="} as the primary concept. The result is a \emph{strict} order: |
125 @{text"<<="} as the primary concept. The result is a \emph{strict} order: |
126 *} |
126 *} |
160 apply blast;apply blast; |
160 apply blast;apply blast; |
161 apply(blast intro: irrefl[THEN notE]); |
161 apply(blast intro: irrefl[THEN notE]); |
162 done |
162 done |
163 *) |
163 *) |
164 |
164 |
165 subsubsection{*Multiple inheritance and sorts*} |
165 subsubsection{*Multiple Inheritance and Sorts*} |
166 |
166 |
167 text{* |
167 text{* |
168 A class may inherit from more than one direct superclass. This is called |
168 A class may inherit from more than one direct superclass. This is called |
169 multiple inheritance and is certainly permitted. For example we could define |
169 multiple inheritance and is certainly permitted. For example we could define |
170 the classes of well-founded orderings and well-orderings: |
170 the classes of well-founded orderings and well-orderings: |
194 \isa{linord} & & & & \isa{wford} \\ |
194 \isa{linord} & & & & \isa{wford} \\ |
195 & \backslash & & / \\ |
195 & \backslash & & / \\ |
196 & & \isa{wellord} |
196 & & \isa{wellord} |
197 \end{array} |
197 \end{array} |
198 \] |
198 \] |
199 \caption{Subclass diagramm} |
199 \caption{Subclass Diagram} |
200 \label{fig:subclass} |
200 \label{fig:subclass} |
201 \end{figure} |
201 \end{figure} |
202 |
202 |
203 Since class @{text wellord} does not introduce any new axioms, it can simply |
203 Since class @{text wellord} does not introduce any new axioms, it can simply |
204 be viewed as the intersection of the two classes @{text linord} and @{text |
204 be viewed as the intersection of the two classes @{text linord} and @{text |