ProgTutorial/Package/Ind_Intro.thy
author Christian Urban <urbanc@in.tum.de>
Fri, 27 Mar 2009 18:19:42 +0000
changeset 212 ac01ddb285f6
parent 189 069d525f8f1d
child 217 75154f4d4e2f
permissions -rw-r--r--
polishing
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     1
theory Ind_Intro
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
     2
imports Main 
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     3
begin
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     4
152
8084c353d196 added material to the endless story of the simplifier
Christian Urban <urbanc@in.tum.de>
parents: 127
diff changeset
     5
chapter {* How to Write a Definitional Package\label{chp:package} (TBD) *}
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     6
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     7
text {*
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
     8
  \begin{flushright}
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     9
  {\em
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    10
  ``My thesis is that programming is not at the bottom of the intellectual \\
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    11
  pyramid, but at the top. It's creative design of the highest order. It \\
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    12
  isn't monkey or donkey work; rather, as Edsger Dijkstra famously \\
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    13
  claimed, it's amongst the hardest intellectual tasks ever attempted.''} \\[1ex]
116
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    14
  Richard Bornat, In Defence of Programming \cite{Bornat-lecture}
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    15
  \end{flushright}
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    16
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    17
  \medskip
113
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    18
  HOL is based on just a few primitive constants, like equality and
116
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    19
  implication, whose properties are described by axioms. All other concepts,
120
c39f83d8daeb some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents: 116
diff changeset
    20
  such as inductive predicates, datatypes, or recursive functions have to be defined
116
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    21
  in terms of those constants, and the desired properties, for example
120
c39f83d8daeb some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents: 116
diff changeset
    22
  induction theorems, or recursion equations have to be derived from the definitions
116
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    23
  by a formal proof. Since it would be very tedious for a user to define
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    24
  complex inductive predicates or datatypes ``by hand'' just using the
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    25
  primitive operators of higher order logic, \emph{definitional packages} have
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    26
  been implemented automating such work. Thanks to those packages, the user
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    27
  can give a high-level specification, for example a list of introduction
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    28
  rules or constructors, and the package then does all the low-level
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    29
  definitions and proofs behind the scenes. In this chapter we explain how
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    30
  such a package can be implemented.
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    31
113
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    32
  As a running example, we have chosen a rather simple package for defining
127
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 121
diff changeset
    33
  inductive predicates. To keep things really simple, we will not use the
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 121
diff changeset
    34
  general Knaster-Tarski fixpoint theorem on complete lattices, which forms
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 121
diff changeset
    35
  the basis of Isabelle's standard inductive definition package.  Instead, we
212
ac01ddb285f6 polishing
Christian Urban <urbanc@in.tum.de>
parents: 189
diff changeset
    36
  will describe a simpler \emph{impredicative} (i.e.\ involving quantification on
127
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 121
diff changeset
    37
  predicate variables) encoding of inductive predicates. Due to its
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 121
diff changeset
    38
  simplicity, this package will necessarily have a reduced functionality. It
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 121
diff changeset
    39
  does neither support introduction rules involving arbitrary monotone
212
ac01ddb285f6 polishing
Christian Urban <urbanc@in.tum.de>
parents: 189
diff changeset
    40
  operators, nor does it prove case analysis rules (also called inversion rules). 
ac01ddb285f6 polishing
Christian Urban <urbanc@in.tum.de>
parents: 189
diff changeset
    41
  Moreover, it only proves a weaker form of the induction principle for inductive
127
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 121
diff changeset
    42
  predicates.
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    43
*}
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    44
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    45
end