author | wenzelm |

Thu Oct 14 01:07:24 1999 +0200 (1999-10-14) | |

changeset 7860 | 7819547df4d8 |

parent 7859 | c67eb6ed6a87 |

child 7861 | 8d5d3163fd81 |

improved presentation;

1.1 --- a/src/HOL/Isar_examples/BasicLogic.thy Wed Oct 13 19:44:33 1999 +0200 1.2 +++ b/src/HOL/Isar_examples/BasicLogic.thy Thu Oct 14 01:07:24 1999 +0200 1.3 @@ -69,8 +69,10 @@ 1.4 1.5 text {* 1.6 In fact, concluding any (sub-)proof already involves solving any 1.7 - remaining goals by assumption. Thus we may skip the rather vacuous 1.8 - body of the above proof as well. 1.9 + remaining goals by assumption\footnote{This is not a completely 1.10 + trivial operation. As usual in Isabelle, proof by assumption 1.11 + involves full higher-order unification.}. Thus we may skip the 1.12 + rather vacuous body of the above proof as well. 1.13 *}; 1.14 1.15 lemma "A --> A"; 1.16 @@ -96,8 +98,8 @@ 1.17 1.18 text {* 1.19 Thus we have arrived at an adequate representation of the proof of a 1.20 - tautology that holds by a single standard rule.\footnote{Here the 1.21 - rule is implication introduction.} 1.22 + tautology that holds by a single standard rule.\footnote{Apparently, 1.23 + the rule is implication introduction.} 1.24 *}; 1.25 1.26 text {* 1.27 @@ -130,13 +132,13 @@ 1.28 rule application, this may go too far in iteration. Thus in 1.29 practice, $\idt{intro}$ and $\idt{elim}$ would be typically 1.30 restricted to certain structures by giving a few rules only, e.g.\ 1.31 - $(\idt{intro}~\name{impI}~\name{allI})$ to strip implications and 1.32 - universal quantifiers. 1.33 + \isacommand{proof}~($\idt{intro}$~\name{impI}~\name{allI}) to strip 1.34 + implications and universal quantifiers. 1.35 1.36 Such well-tuned iterated decomposition of certain structure is the 1.37 - prime application of $\idt{intro}$~/ $\idt{elim}$. In general, 1.38 + prime application of $\idt{intro}$ and $\idt{elim}$. In general, 1.39 terminal steps that solve a goal completely are typically performed 1.40 - by actual automated proof methods (e.g.\ 1.41 + by actual automated proof methods (such as 1.42 \isacommand{by}~$\idt{blast}$). 1.43 *}; 1.44 1.45 @@ -309,7 +311,7 @@ 1.46 assumptions. The corresponding proof text typically mimics this by 1.47 establishing results in appropriate contexts, separated by blocks. 1.48 1.49 - In order to avoid too much explicit bracketing, the Isar system 1.50 + In order to avoid too much explicit parentheses, the Isar system 1.51 implicitly opens an additional block for any new goal, the 1.52 \isacommand{next} statement then closes one block level, opening a 1.53 new one. The resulting behavior is what one might expect from 1.54 @@ -336,9 +338,9 @@ 1.55 1.56 text {* 1.57 Again, the rather vacuous body of the proof may be collapsed. Thus 1.58 - the case analysis degenerates into two assumption steps, which 1.59 - are implicitly performed when concluding the single rule step of the 1.60 - double-dot proof below. 1.61 + the case analysis degenerates into two assumption steps, which are 1.62 + implicitly performed when concluding the single rule step of the 1.63 + double-dot proof as follows. 1.64 *}; 1.65 1.66 lemma "P | P --> P"; 1.67 @@ -379,7 +381,7 @@ 1.68 1.69 text {* 1.70 While explicit rule instantiation may occasionally help to improve 1.71 - the readability of certain aspects of reasoning it is usually quite 1.72 + the readability of certain aspects of reasoning, it is usually quite 1.73 redundant. Above, the basic proof outline gives already enough 1.74 structural clues for the system to infer both the rules and their 1.75 instances (by higher-order unification). Thus we may as well prune 1.76 @@ -402,12 +404,8 @@ 1.77 1.78 text {* 1.79 We derive the conjunction elimination rule from the projections. The 1.80 - proof below follows is quite straight-forward, since Isabelle/Isar 1.81 - supports non-atomic goals and assumptions fully transparently. Note 1.82 - that this is in contrast to classic Isabelle: the corresponding 1.83 - tactic script given in \cite{isabelle-intro} depends on the primitive 1.84 - goal command to decompose the rule into premises and conclusion, with 1.85 - the result emerging by discharging the context again later. 1.86 + proof is quite straight-forward, since Isabelle/Isar supports 1.87 + non-atomic goals and assumptions fully transparently. 1.88 *}; 1.89 1.90 theorem conjE: "A & B ==> (A ==> B ==> C) ==> C"; 1.91 @@ -421,4 +419,13 @@ 1.92 qed; 1.93 qed; 1.94 1.95 +text {* 1.96 + Note that classic Isabelle handles higher rules in a slightly 1.97 + different way. The tactic script as given in \cite{isabelle-intro} 1.98 + for the same example of \name{conjE} depends on the primitive 1.99 + \texttt{goal} command to decompose the rule into premises and 1.100 + conclusion. The proper result would then emerge by discharging of 1.101 + the context at \texttt{qed} time. 1.102 +*}; 1.103 + 1.104 end;

2.1 --- a/src/HOL/Isar_examples/Cantor.thy Wed Oct 13 19:44:33 1999 +0200 2.2 +++ b/src/HOL/Isar_examples/Cantor.thy Thu Oct 14 01:07:24 1999 +0200 2.3 @@ -19,12 +19,11 @@ 2.4 Viewing types as sets, $\alpha \To \idt{bool}$ represents the 2.5 powerset of $\alpha$. This version of the theorem states that for 2.6 every function from $\alpha$ to its powerset, some subset is outside 2.7 - its range. The Isabelle/Isar proofs below use HOL's set theory, with 2.8 - the type $\alpha \ap \idt{set}$ and the operator $\idt{range}$. 2.9 + its range. The Isabelle/Isar proofs below uses HOL's set theory, 2.10 + with the type $\alpha \ap \idt{set}$ and the operator $\idt{range}$. 2.11 2.12 - \bigskip We first consider a rather verbose version of the proof, 2.13 - with the reasoning expressed quite naively. We only make use of the 2.14 - pure core of the Isar proof language. 2.15 + \bigskip We first consider a slightly awkward version of the proof, 2.16 + with the reasoning expressed quite naively. 2.17 *}; 2.18 2.19 theorem "EX S. S ~: range(f :: 'a => 'a set)"; 2.20 @@ -33,21 +32,21 @@ 2.21 show "?S ~: range f"; 2.22 proof; 2.23 assume "?S : range f"; 2.24 - then; show False; 2.25 + thus False; 2.26 proof; 2.27 fix y; 2.28 assume "?S = f y"; 2.29 - then; show ?thesis; 2.30 + thus ?thesis; 2.31 proof (rule equalityCE); 2.32 - assume y_in_S: "y : ?S"; 2.33 - assume y_in_fy: "y : f y"; 2.34 - from y_in_S; have y_notin_fy: "y ~: f y"; ..; 2.35 - from y_notin_fy y_in_fy; show ?thesis; by contradiction; 2.36 + assume in_S: "y : ?S"; 2.37 + assume in_fy: "y : f y"; 2.38 + from in_S; have notin_fy: "y ~: f y"; ..; 2.39 + from notin_fy in_fy; show ?thesis; by contradiction; 2.40 next; 2.41 - assume y_notin_S: "y ~: ?S"; 2.42 - assume y_notin_fy: "y ~: f y"; 2.43 - from y_notin_S; have y_in_fy: "y : f y"; ..; 2.44 - from y_notin_fy y_in_fy; show ?thesis; by contradiction; 2.45 + assume notin_S: "y ~: ?S"; 2.46 + assume notin_fy: "y ~: f y"; 2.47 + from notin_S; have in_fy: "y : f y"; ..; 2.48 + from notin_fy in_fy; show ?thesis; by contradiction; 2.49 qed; 2.50 qed; 2.51 qed; 2.52 @@ -55,8 +54,15 @@ 2.53 2.54 text {* 2.55 The following version of the proof essentially does the same 2.56 - reasoning, only that it is expressed more neatly, with some derived 2.57 - Isar language elements involved. 2.58 + reasoning, only that it is expressed more neatly. In particular, we 2.59 + change the order of assumptions introduced in the two cases of rule 2.60 + \name{equalityCE}, streamlining the flow of intermediate facts and 2.61 + avoiding explicit naming.\footnote{In general, neither the order of 2.62 + assumptions as introduced \isacommand{assume}, nor the order of goals 2.63 + as solved by \isacommand{show} matters. The basic logical structure 2.64 + has to be left intact, though. In particular, assumptions 2.65 + ``belonging'' to some goal have to be introduced \emph{before} its 2.66 + corresponding \isacommand{show}.} 2.67 *}; 2.68 2.69 theorem "EX S. S ~: range(f :: 'a => 'a set)"; 2.70 @@ -85,11 +91,12 @@ 2.71 2.72 text {* 2.73 How much creativity is required? As it happens, Isabelle can prove 2.74 - this theorem automatically. The default classical set contains rules 2.75 - for most of the constructs of HOL's set theory. We must augment it 2.76 - with \name{equalityCE} to break up set equalities, and then apply 2.77 - best-first search. Depth-first search would diverge, but best-first 2.78 - search successfully navigates through the large search space. 2.79 + this theorem automatically. The default context of the classical 2.80 + proof tools contains rules for most of the constructs of HOL's set 2.81 + theory. We must augment it with \name{equalityCE} to break up set 2.82 + equalities, and then apply best-first search. Depth-first search 2.83 + would diverge, but best-first search successfully navigates through 2.84 + the large search space. 2.85 *}; 2.86 2.87 theorem "EX S. S ~: range(f :: 'a => 'a set)"; 2.88 @@ -100,7 +107,7 @@ 2.89 idea of how the proof actually works. There is currently no way to 2.90 transform internal system-level representations of Isabelle proofs 2.91 back into Isar documents. Writing proof documents really is a 2.92 - creative process. 2.93 + creative process, after all. 2.94 *}; 2.95 2.96 end;

3.1 --- a/src/HOL/Isar_examples/KnasterTarski.thy Wed Oct 13 19:44:33 1999 +0200 3.2 +++ b/src/HOL/Isar_examples/KnasterTarski.thy Thu Oct 14 01:07:24 1999 +0200 3.3 @@ -15,7 +15,7 @@ 3.4 text {* 3.5 According to the book ``Introduction to Lattices and Order'' 3.6 \cite[pages 93--94]{davey-priestley}, the Knaster-Tarski fixpoint 3.7 - theorem is as follows.\footnote{We have dualized their argument, and 3.8 + theorem is as follows.\footnote{We have dualized the argument, and 3.9 tuned the notation a little bit.} 3.10 3.11 \medskip \textbf{The Knaster-Tarski Fixpoint Theorem.} Let $L$ be a

4.1 --- a/src/HOL/Isar_examples/Peirce.thy Wed Oct 13 19:44:33 1999 +0200 4.2 +++ b/src/HOL/Isar_examples/Peirce.thy Thu Oct 14 01:07:24 1999 +0200 4.3 @@ -3,10 +3,23 @@ 4.4 Author: Markus Wenzel, TU Muenchen 4.5 *) 4.6 4.7 -header {* Examples of classical proof: Peirce's Law *}; 4.8 +header {* Peirce's Law *}; 4.9 4.10 theory Peirce = Main:; 4.11 4.12 +text {* 4.13 + We consider Peirce's Law: $((A \impl B) \impl A) \impl A$. This is 4.14 + an inherently non-intuitionistic statement, so its proof will 4.15 + certainly involve some form of classical contradiction. 4.16 + 4.17 + The first proof is again a well-balanced combination of plain 4.18 + backward and forward reasoning. The actual classical reasoning step 4.19 + is where the negated goal is introduced as additional assumption. 4.20 + This eventually leads to a contradiction.\footnote{The rule involved 4.21 + here is negation elimination; it holds in intuitionistic logic as 4.22 + well.} 4.23 +*}; 4.24 + 4.25 theorem "((A --> B) --> A) --> A"; 4.26 proof; 4.27 assume aba: "(A --> B) --> A"; 4.28 @@ -22,6 +35,21 @@ 4.29 qed; 4.30 qed; 4.31 4.32 +text {* 4.33 + The subsequent version rearranges the reasoning by means of ``weak 4.34 + assumptions'' (as introduced by \isacommand{presume}). Before 4.35 + assuming the negated goal $\neg A$, its intended consequence $A \impl 4.36 + B$ is put into place in order to solve the main problem. 4.37 + Nevertheless, we do not get anything for free, but have to establish 4.38 + $A \impl B$ later on. The overall effect is that of a \emph{cut}. 4.39 + 4.40 + Technically speaking, whenever some goal is solved by 4.41 + \isacommand{show} in the context of weak assumptions then the latter 4.42 + give rise to new subgoals, which may be established separately. In 4.43 + contrast, strong assumptions (as introduced by \isacommand{assume}) 4.44 + are solved immediately. 4.45 +*}; 4.46 + 4.47 theorem "((A --> B) --> A) --> A"; 4.48 proof; 4.49 assume aba: "(A --> B) --> A"; 4.50 @@ -39,4 +67,23 @@ 4.51 qed; 4.52 qed; 4.53 4.54 +text {* 4.55 + Note that the goals stemming from weak assumptions may be even left 4.56 + until qed time, where they get eventually solved ``by assumption'' as 4.57 + well. In that case there is really no big difference between the two 4.58 + kinds of assumptions, apart from the order of reducing the individual 4.59 + parts of the proof configuration. 4.60 + 4.61 + Nevertheless, the ``strong'' mode of plain assumptions is quite 4.62 + important in practice to achieve robustness of proof document 4.63 + interpretation. By forcing both the conclusion \emph{and} the 4.64 + assumptions to unify with any pending goal to be solved, goal 4.65 + selection becomes quite deterministic. For example, typical 4.66 + ``case-analysis'' rules give rise to several goals that only differ 4.67 + in there local contexts. With strong assumptions these may be still 4.68 + solved in any order in a predictable way, while weak ones would 4.69 + quickly lead to great confusion, eventually demanding even some 4.70 + backtracking. 4.71 +*}; 4.72 + 4.73 end;