CookBook/Package/Ind_General_Scheme.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 04 Mar 2009 13:50:47 +0000
changeset 158 d7944bdf7b3f
parent 127 74846cb0fff9
permissions -rw-r--r--
removed infix_conv and moved function no_vars into the FirstSteps chapter
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_General_Scheme
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     2
imports Main
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
section{* The General Construction Principle \label{sec:ind-general-method} *}
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 {*
127
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 120
diff changeset
     8
  
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 120
diff changeset
     9
  The point of these examples is to get a feeling what the automatic proofs 
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 120
diff changeset
    10
  should do in order to solve all inductive definitions we throw at them. For this 
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 120
diff changeset
    11
  it is instructive to look at the general construction principle 
74846cb0fff9 updated and added two tentative recipes
Christian Urban <urbanc@in.tum.de>
parents: 120
diff changeset
    12
  of inductive definitions, which we shall do in the next section.
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    13
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    14
  Before we start with the implementation, it is useful to describe the general
120
c39f83d8daeb some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents: 116
diff changeset
    15
  form of inductive definitions that our package should accept.
c39f83d8daeb some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents: 116
diff changeset
    16
  Suppose $R_1,\ldots,R_n$ be mutually inductive predicates and $\vec{p}$ be
c39f83d8daeb some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents: 116
diff changeset
    17
  some fixed parameters. Then the introduction rules for $R_1,\ldots,R_n$ may have
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    18
  the form
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    19
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    20
  \[
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    21
  \bigwedge\vec{x}_i.~\vec{A}_i \Longrightarrow \left(\bigwedge\vec{y}_{ij}.~\vec{B}_{ij} \Longrightarrow
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    22
  R_{k_{ij}}~\vec{p}~\vec{s}_{ij}\right)_{j=1,\ldots,m_i} \Longrightarrow R_{l_i}~\vec{p}~\vec{t}_i
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    23
  \qquad \mbox{for\ } i=1,\ldots,r
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    24
  \]
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    25
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    26
  where $\vec{A}_i$ and $\vec{B}_{ij}$ are formulae not containing $R_1,\ldots,R_n$.
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    27
  Note that by disallowing the inductive predicates to occur in $\vec{B}_{ij}$ we make sure
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    28
  that all occurrences of the predicates in the premises of the introduction rules are
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    29
  \emph{strictly positive}. This condition guarantees the existence of predicates
120
c39f83d8daeb some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents: 116
diff changeset
    30
  that are closed under the introduction rules shown above. Then the definitions of the 
c39f83d8daeb some polishing; split up the file External Solver into two
Christian Urban <urbanc@in.tum.de>
parents: 116
diff changeset
    31
  inductive predicates $R_1,\ldots,R_n$ is:
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    32
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    33
  \[
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    34
  \begin{array}{l@ {\qquad}l}
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    35
  R_i \equiv \lambda\vec{p}~\vec{z}_i.~\forall P_1 \ldots P_n.~K_1 \longrightarrow \cdots \longrightarrow K_r \longrightarrow P_i~\vec{z}_i &
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    36
  \mbox{for\ } i=1,\ldots,n \\[1.5ex]
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    37
  \mbox{where} \\
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    38
  K_i \equiv \forall\vec{x}_i.~\vec{A}_i \longrightarrow \left(\forall\vec{y}_{ij}.~\vec{B}_{ij} \longrightarrow
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    39
  P_{k_{ij}}~\vec{s}_{ij}\right)_{j=1,\ldots,m_i} \longrightarrow P_{l_i}~\vec{t}_i &
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    40
  \mbox{for\ } i=1,\ldots,r
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    41
  \end{array}
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    42
  \]
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    43
116
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 88
diff changeset
    44
  The induction principles for the inductive predicates $R_1,\ldots,R_n$ are
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    45
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    46
  \[
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    47
  \begin{array}{l@ {\qquad}l}
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    48
  R_i~\vec{p}~\vec{z}_i \Longrightarrow I_1 \Longrightarrow \cdots \Longrightarrow I_r \Longrightarrow P_i~\vec{z}_i &
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    49
  \mbox{for\ } i=1,\ldots,n \\[1.5ex]
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    50
  \mbox{where} \\
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    51
  I_i \equiv \bigwedge\vec{x}_i.~\vec{A}_i \Longrightarrow \left(\bigwedge\vec{y}_{ij}.~\vec{B}_{ij} \Longrightarrow
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    52
  P_{k_{ij}}~\vec{s}_{ij}\right)_{j=1,\ldots,m_i} \Longrightarrow P_{l_i}~\vec{t}_i &
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    53
  \mbox{for\ } i=1,\ldots,r
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    54
  \end{array}
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    55
  \]
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    56
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    57
  Since $K_i$ and $I_i$ are equivalent modulo conversion between meta-level and object-level
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    58
  connectives, it is clear that the proof of the induction theorem is straightforward. We will
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    59
  therefore focus on the proof of the introduction rules. When proving the introduction rule
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    60
  shown above, we start by unfolding the definition of $R_1,\ldots,R_n$, which yields
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    61
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    62
  \[
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    63
  \bigwedge\vec{x}_i.~\vec{A}_i \Longrightarrow \left(\bigwedge\vec{y}_{ij}.~\vec{B}_{ij} \Longrightarrow
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    64
  \forall P_1 \ldots P_n.~\vec{K} \longrightarrow P_{k_{ij}}~\vec{s}_{ij}\right)_{j=1,\ldots,m_i} \Longrightarrow \forall P_1 \ldots P_n.~\vec{K} \longrightarrow P_{l_i}~\vec{t}_i
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    65
  \]
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    66
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    67
  where $\vec{K}$ abbreviates $K_1,\ldots,K_r$. Applying the introduction rules for
116
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 88
diff changeset
    68
  $\forall$ and $\longrightarrow$ yields a goal state in which we have to prove $P_{l_i}~\vec{t}_i$
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 88
diff changeset
    69
  from the additional assumptions $\vec{K}$. When using $K_{l_i}$ (converted to the meta-logic format)
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    70
  to prove $P_{l_i}~\vec{t}_i$, we get subgoals $\vec{A}_i$ that are trivially solvable by assumption,
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    71
  as well as subgoals of the form
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    72
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    73
  \[
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    74
  \bigwedge\vec{y}_{ij}.~\vec{B}_{ij} \Longrightarrow P_{k_{ij}}~\vec{s}_{ij} \qquad \mbox{for\ } j=1,\ldots,m_i
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    75
  \]
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    76
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    77
  that can be solved using the assumptions
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    78
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    79
  \[
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    80
  \bigwedge\vec{y}_{ij}.~\vec{B}_{ij} \Longrightarrow
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    81
  \forall P_1 \ldots P_n.~\vec{K} \longrightarrow P_{k_{ij}}~\vec{s}_{ij} \qquad \mbox{and} \qquad \vec{K}
88
ebbd0dd008c8 adaptation of the package chapter to fit the rest
Christian Urban <urbanc@in.tum.de>
parents: 32
diff changeset
    82
  \]
116
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 88
diff changeset
    83
c9ff326e3ce5 more changes to the package chapter
Christian Urban <urbanc@in.tum.de>
parents: 88
diff changeset
    84
  What remains is to implement these proofs generically.
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    85
*}
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    86
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    87
end