ProgTutorial/Package/Ind_Intro.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 19 Aug 2009 09:25:49 +0200
changeset 313 1ca2f41770cc
parent 295 24c68350d059
child 346 0fea8b7a14a1
permissions -rw-r--r--
polished the exercises about constructing terms
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
217
75154f4d4e2f used antiquotations
Christian Urban <urbanc@in.tum.de>
parents: 212
diff changeset
     5
chapter {* How to Write a Definitional Package\label{chp: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 {*
113
9b6c9d172378 slightly updated
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
     8
  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
     9
  implication, whose properties are described by axioms. All other concepts,
243
6e0f56764ff8 slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 219
diff changeset
    10
  such as inductive predicates, datatypes or recursive functions, are defined
6e0f56764ff8 slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 219
diff changeset
    11
  in terms of those primitives, and the desired properties, for example
6e0f56764ff8 slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 219
diff changeset
    12
  induction theorems or recursion equations, are derived from the definitions
116
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    13
  by a formal proof. Since it would be very tedious for a user to define
295
24c68350d059 polished the package chapter used FOCUS to explain the subproofs
Christian Urban <urbanc@in.tum.de>
parents: 243
diff changeset
    14
  inductive predicates or datatypes ``by hand'' just using the
116
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    15
  primitive operators of higher order logic, \emph{definitional packages} have
243
6e0f56764ff8 slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 219
diff changeset
    16
  been implemented to automate such work. Thanks to those packages, the user
116
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 115
diff changeset
    17
  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
    18
  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
    19
  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
    20
  such a package can be implemented.
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    21
219
98d43270024f more work on the simple inductive chapter
Christian Urban <urbanc@in.tum.de>
parents: 217
diff changeset
    22
  As the 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
    23
  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
    24
  general Knaster-Tarski fixpoint theorem on complete lattices, which forms
243
6e0f56764ff8 slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 219
diff changeset
    25
  the basis of Isabelle/HOL's standard inductive definition package.  Instead, we
212
ac01ddb285f6 polishing
Christian Urban <urbanc@in.tum.de>
parents: 189
diff changeset
    26
  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
    27
  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
    28
  simplicity, this package will necessarily have a reduced functionality. It
243
6e0f56764ff8 slight polishing
Christian Urban <urbanc@in.tum.de>
parents: 219
diff changeset
    29
  does neither support introduction rules involving arbitrary monotonic
212
ac01ddb285f6 polishing
Christian Urban <urbanc@in.tum.de>
parents: 189
diff changeset
    30
  operators, nor does it prove case analysis rules (also called inversion rules). 
ac01ddb285f6 polishing
Christian Urban <urbanc@in.tum.de>
parents: 189
diff changeset
    31
  Moreover, it only proves a weaker form of the induction principle for inductive
295
24c68350d059 polished the package chapter used FOCUS to explain the subproofs
Christian Urban <urbanc@in.tum.de>
parents: 243
diff changeset
    32
  predicates. But it illustrates the implementation pf a typical package in
24c68350d059 polished the package chapter used FOCUS to explain the subproofs
Christian Urban <urbanc@in.tum.de>
parents: 243
diff changeset
    33
  Isabelle.
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    34
*}
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    35
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    36
end