CookBook/Package/Ind_Intro.thy
author Christian Urban <urbanc@in.tum.de>
Fri, 13 Feb 2009 14:15:28 +0000
changeset 115 039845fc96bd
parent 113 9b6c9d172378
child 116 c9ff326e3ce5
permissions -rw-r--r--
some update of the package introduction
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
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
     5
chapter {* How to Write a Definitional Package *}
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]
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    14
  Richard Bornat, In defence of programming \cite{Bornat-lecture}
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
115
039845fc96bd some update of the package introduction
Christian Urban <urbanc@in.tum.de>
parents: 113
diff changeset
    19
  implication, whose properties are described by axioms. All other
113
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    20
  concepts, such as inductive predicates, datatypes, or recursive functions
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    21
  are defined in terms of those constants, and the desired properties, for
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    22
  example induction theorems, or recursion equations are derived from the
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    23
  definitions by a formal proof. Since it would be very tedious for a user to
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    24
  define complex inductive predicates or datatypes ``by hand'' just using the
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    25
  primitive operators of higher order logic, packages have been implemented
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    26
  automating such work. Thanks to those packages, the user can give a
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    27
  high-level specification, like a list of introduction rules or constructors,
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    28
  and the package then does all the low-level definitions and proofs behind
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    29
  the scenes. In this chapter we explain how such a package can be
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    30
  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
115
039845fc96bd some update of the package introduction
Christian Urban <urbanc@in.tum.de>
parents: 113
diff changeset
    33
  inductive predicates. To keep things really simple, we will not use the general
113
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    34
  Knaster-Tarski fixpoint theorem on complete lattices, which forms the basis
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    35
  of Isabelle's standard inductive definition package.  Instead, we will use a
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    36
  simpler \emph{impredicative} (i.e.\ involving quantification on predicate
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    37
  variables) encoding of inductive predicates suggested by Melham
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    38
  \cite{Melham:1992:PIR}. Due to its simplicity, this package will necessarily
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    39
  have a reduced functionality. It does neither support introduction rules
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    40
  involving arbitrary monotone operators, nor does it prove case analysis (or
115
039845fc96bd some update of the package introduction
Christian Urban <urbanc@in.tum.de>
parents: 113
diff changeset
    41
  inversion) rules. Moreover, it only proves a weaker form of the
113
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    42
  induction theorem.
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