doc-src/IsarImplementation/Thy/document/logic.tex
author wenzelm
Tue, 12 Sep 2006 17:23:34 +0200
changeset 20519 d7ad1217c24a
parent 20514 5ede702cd2ca
child 20520 05fd007bdeb9
permissions -rw-r--r--
more on terms;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     1
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     2
\begin{isabellebody}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     3
\def\isabellecontext{logic}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     4
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     5
\isadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     6
\isanewline
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     7
\isanewline
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     8
\isanewline
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
     9
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    10
\endisadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    11
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    12
\isatagtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    13
\isacommand{theory}\isamarkupfalse%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    14
\ logic\ \isakeyword{imports}\ base\ \isakeyword{begin}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    15
\endisatagtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    16
{\isafoldtheory}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    17
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    18
\isadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    19
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    20
\endisadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    21
%
20471
ffafbd4103c0 updated;
wenzelm
parents: 20451
diff changeset
    22
\isamarkupchapter{Primitive logic \label{ch:logic}%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    23
}
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    24
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    25
%
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    26
\begin{isamarkuptext}%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    27
The logical foundations of Isabelle/Isar are that of the Pure logic,
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    28
  which has been introduced as a natural-deduction framework in
20493
wenzelm
parents: 20491
diff changeset
    29
  \cite{paulson700}.  This is essentially the same logic as ``\isa{{\isasymlambda}HOL}'' in the more abstract setting of Pure Type Systems (PTS)
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    30
  \cite{Barendregt-Geuvers:2001}, although there are some key
20491
wenzelm
parents: 20481
diff changeset
    31
  differences in the specific treatment of simple types in
wenzelm
parents: 20481
diff changeset
    32
  Isabelle/Pure.
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    33
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    34
  Following type-theoretic parlance, the Pure logic consists of three
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    35
  levels of \isa{{\isasymlambda}}-calculus with corresponding arrows: \isa{{\isasymRightarrow}} for syntactic function space (terms depending on terms), \isa{{\isasymAnd}} for universal quantification (proofs depending on terms), and
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    36
  \isa{{\isasymLongrightarrow}} for implication (proofs depending on proofs).
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    37
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    38
  Pure derivations are relative to a logical theory, which declares
20491
wenzelm
parents: 20481
diff changeset
    39
  type constructors, term constants, and axioms.  Theory declarations
wenzelm
parents: 20481
diff changeset
    40
  support schematic polymorphism, which is strictly speaking outside
wenzelm
parents: 20481
diff changeset
    41
  the logic.\footnote{Incidently, this is the main logical reason, why
wenzelm
parents: 20481
diff changeset
    42
  the theory context \isa{{\isasymTheta}} is separate from the context \isa{{\isasymGamma}} of the core calculus.}%
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    43
\end{isamarkuptext}%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    44
\isamarkuptrue%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    45
%
20451
27ea2ba48fa3 misc cleanup;
wenzelm
parents: 20450
diff changeset
    46
\isamarkupsection{Types \label{sec:types}%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    47
}
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    48
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    49
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    50
\begin{isamarkuptext}%
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    51
The language of types is an uninterpreted order-sorted first-order
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    52
  algebra; types are qualified by ordered type classes.
20451
27ea2ba48fa3 misc cleanup;
wenzelm
parents: 20450
diff changeset
    53
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    54
  \medskip A \emph{type class} is an abstract syntactic entity
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    55
  declared in the theory context.  The \emph{subclass relation} \isa{c\isactrlisub {\isadigit{1}}\ {\isasymsubseteq}\ c\isactrlisub {\isadigit{2}}} is specified by stating an acyclic
20491
wenzelm
parents: 20481
diff changeset
    56
  generating relation; the transitive closure is maintained
wenzelm
parents: 20481
diff changeset
    57
  internally.  The resulting relation is an ordering: reflexive,
wenzelm
parents: 20481
diff changeset
    58
  transitive, and antisymmetric.
20451
27ea2ba48fa3 misc cleanup;
wenzelm
parents: 20450
diff changeset
    59
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    60
  A \emph{sort} is a list of type classes written as \isa{{\isacharbraceleft}c\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ c\isactrlisub m{\isacharbraceright}}, which represents symbolic
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    61
  intersection.  Notationally, the curly braces are omitted for
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    62
  singleton intersections, i.e.\ any class \isa{c} may be read as
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    63
  a sort \isa{{\isacharbraceleft}c{\isacharbraceright}}.  The ordering on type classes is extended to
20491
wenzelm
parents: 20481
diff changeset
    64
  sorts according to the meaning of intersections: \isa{{\isacharbraceleft}c\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}\ c\isactrlisub m{\isacharbraceright}\ {\isasymsubseteq}\ {\isacharbraceleft}d\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ d\isactrlisub n{\isacharbraceright}} iff
wenzelm
parents: 20481
diff changeset
    65
  \isa{{\isasymforall}j{\isachardot}\ {\isasymexists}i{\isachardot}\ c\isactrlisub i\ {\isasymsubseteq}\ d\isactrlisub j}.  The empty intersection
wenzelm
parents: 20481
diff changeset
    66
  \isa{{\isacharbraceleft}{\isacharbraceright}} refers to the universal sort, which is the largest
wenzelm
parents: 20481
diff changeset
    67
  element wrt.\ the sort order.  The intersections of all (finitely
wenzelm
parents: 20481
diff changeset
    68
  many) classes declared in the current theory are the minimal
wenzelm
parents: 20481
diff changeset
    69
  elements wrt.\ the sort order.
20451
27ea2ba48fa3 misc cleanup;
wenzelm
parents: 20450
diff changeset
    70
20491
wenzelm
parents: 20481
diff changeset
    71
  \medskip A \emph{fixed type variable} is a pair of a basic name
20493
wenzelm
parents: 20491
diff changeset
    72
  (starting with a \isa{{\isacharprime}} character) and a sort constraint.  For
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    73
  example, \isa{{\isacharparenleft}{\isacharprime}a{\isacharcomma}\ s{\isacharparenright}} which is usually printed as \isa{{\isasymalpha}\isactrlisub s}.  A \emph{schematic type variable} is a pair of an
20491
wenzelm
parents: 20481
diff changeset
    74
  indexname and a sort constraint.  For example, \isa{{\isacharparenleft}{\isacharparenleft}{\isacharprime}a{\isacharcomma}\ {\isadigit{0}}{\isacharparenright}{\isacharcomma}\ s{\isacharparenright}} which is usually printed as \isa{{\isacharquery}{\isasymalpha}\isactrlisub s}.
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    75
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    76
  Note that \emph{all} syntactic components contribute to the identity
20493
wenzelm
parents: 20491
diff changeset
    77
  of type variables, including the sort constraint.  The core logic
wenzelm
parents: 20491
diff changeset
    78
  handles type variables with the same name but different sorts as
wenzelm
parents: 20491
diff changeset
    79
  different, although some outer layers of the system make it hard to
wenzelm
parents: 20491
diff changeset
    80
  produce anything like this.
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
    81
20493
wenzelm
parents: 20491
diff changeset
    82
  A \emph{type constructor} \isa{{\isasymkappa}} is a \isa{k}-ary operator
wenzelm
parents: 20491
diff changeset
    83
  on types declared in the theory.  Type constructor application is
20494
wenzelm
parents: 20493
diff changeset
    84
  usually written postfix as \isa{{\isacharparenleft}{\isasymalpha}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlisub k{\isacharparenright}{\isasymkappa}}.
wenzelm
parents: 20493
diff changeset
    85
  For \isa{k\ {\isacharequal}\ {\isadigit{0}}} the argument tuple is omitted, e.g.\ \isa{prop} instead of \isa{{\isacharparenleft}{\isacharparenright}prop}.  For \isa{k\ {\isacharequal}\ {\isadigit{1}}} the
wenzelm
parents: 20493
diff changeset
    86
  parentheses are omitted, e.g.\ \isa{{\isasymalpha}\ list} instead of \isa{{\isacharparenleft}{\isasymalpha}{\isacharparenright}list}.  Further notation is provided for specific constructors,
wenzelm
parents: 20493
diff changeset
    87
  notably the right-associative infix \isa{{\isasymalpha}\ {\isasymRightarrow}\ {\isasymbeta}} instead of
wenzelm
parents: 20493
diff changeset
    88
  \isa{{\isacharparenleft}{\isasymalpha}{\isacharcomma}\ {\isasymbeta}{\isacharparenright}fun}.
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    89
  
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
    90
  A \emph{type} \isa{{\isasymtau}} is defined inductively over type variables
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
    91
  and type constructors as follows: \isa{{\isasymtau}\ {\isacharequal}\ {\isasymalpha}\isactrlisub s\ {\isacharbar}\ {\isacharquery}{\isasymalpha}\isactrlisub s\ {\isacharbar}\ {\isacharparenleft}{\isasymtau}\isactrlsub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymtau}\isactrlsub k{\isacharparenright}k}.
20451
27ea2ba48fa3 misc cleanup;
wenzelm
parents: 20450
diff changeset
    92
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
    93
  A \emph{type abbreviation} is a syntactic definition \isa{{\isacharparenleft}\isactrlvec {\isasymalpha}{\isacharparenright}{\isasymkappa}\ {\isacharequal}\ {\isasymtau}} of an arbitrary type expression \isa{{\isasymtau}} over
20494
wenzelm
parents: 20493
diff changeset
    94
  variables \isa{\isactrlvec {\isasymalpha}}.  Type abbreviations looks like type
wenzelm
parents: 20493
diff changeset
    95
  constructors at the surface, but are fully expanded before entering
wenzelm
parents: 20493
diff changeset
    96
  the logical core.
20451
27ea2ba48fa3 misc cleanup;
wenzelm
parents: 20450
diff changeset
    97
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
    98
  A \emph{type arity} declares the image behavior of a type
20494
wenzelm
parents: 20493
diff changeset
    99
  constructor wrt.\ the algebra of sorts: \isa{{\isasymkappa}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}s\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ s\isactrlisub k{\isacharparenright}s} means that \isa{{\isacharparenleft}{\isasymtau}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymtau}\isactrlisub k{\isacharparenright}{\isasymkappa}} is
wenzelm
parents: 20493
diff changeset
   100
  of sort \isa{s} if every argument type \isa{{\isasymtau}\isactrlisub i} is
wenzelm
parents: 20493
diff changeset
   101
  of sort \isa{s\isactrlisub i}.  Arity declarations are implicitly
wenzelm
parents: 20493
diff changeset
   102
  completed, i.e.\ \isa{{\isasymkappa}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}\isactrlvec s{\isacharparenright}c} entails \isa{{\isasymkappa}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}\isactrlvec s{\isacharparenright}c{\isacharprime}} for any \isa{c{\isacharprime}\ {\isasymsupseteq}\ c}.
20451
27ea2ba48fa3 misc cleanup;
wenzelm
parents: 20450
diff changeset
   103
20491
wenzelm
parents: 20481
diff changeset
   104
  \medskip The sort algebra is always maintained as \emph{coregular},
wenzelm
parents: 20481
diff changeset
   105
  which means that type arities are consistent with the subclass
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   106
  relation: for each type constructor \isa{{\isasymkappa}} and classes \isa{c\isactrlisub {\isadigit{1}}\ {\isasymsubseteq}\ c\isactrlisub {\isadigit{2}}}, any arity \isa{{\isasymkappa}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}\isactrlvec s\isactrlisub {\isadigit{1}}{\isacharparenright}c\isactrlisub {\isadigit{1}}} has a corresponding arity \isa{{\isasymkappa}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}\isactrlvec s\isactrlisub {\isadigit{2}}{\isacharparenright}c\isactrlisub {\isadigit{2}}} where \isa{\isactrlvec s\isactrlisub {\isadigit{1}}\ {\isasymsubseteq}\ \isactrlvec s\isactrlisub {\isadigit{2}}} holds component-wise.
20491
wenzelm
parents: 20481
diff changeset
   107
wenzelm
parents: 20481
diff changeset
   108
  The key property of a coregular order-sorted algebra is that sort
20494
wenzelm
parents: 20493
diff changeset
   109
  constraints may be always solved in a most general fashion: for each
wenzelm
parents: 20493
diff changeset
   110
  type constructor \isa{{\isasymkappa}} and sort \isa{s} there is a most
wenzelm
parents: 20493
diff changeset
   111
  general vector of argument sorts \isa{{\isacharparenleft}s\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ s\isactrlisub k{\isacharparenright}} such that a type scheme \isa{{\isacharparenleft}{\isasymalpha}\isactrlbsub s\isactrlisub {\isadigit{1}}\isactrlesub {\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymalpha}\isactrlbsub s\isactrlisub k\isactrlesub {\isacharparenright}{\isasymkappa}} is
20491
wenzelm
parents: 20481
diff changeset
   112
  of sort \isa{s}.  Consequently, the unification problem on the
wenzelm
parents: 20481
diff changeset
   113
  algebra of types has most general solutions (modulo renaming and
wenzelm
parents: 20481
diff changeset
   114
  equivalence of sorts).  Moreover, the usual type-inference algorithm
wenzelm
parents: 20481
diff changeset
   115
  will produce primary types as expected \cite{nipkow-prehofer}.%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   116
\end{isamarkuptext}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   117
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   118
%
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   119
\isadelimmlref
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   120
%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   121
\endisadelimmlref
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   122
%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   123
\isatagmlref
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   124
%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   125
\begin{isamarkuptext}%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   126
\begin{mldecls}
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   127
  \indexmltype{class}\verb|type class| \\
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   128
  \indexmltype{sort}\verb|type sort| \\
20494
wenzelm
parents: 20493
diff changeset
   129
  \indexmltype{arity}\verb|type arity| \\
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   130
  \indexmltype{typ}\verb|type typ| \\
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   131
  \indexml{map-atyps}\verb|map_atyps: (typ -> typ) -> typ -> typ| \\
20494
wenzelm
parents: 20493
diff changeset
   132
  \indexml{fold-atyps}\verb|fold_atyps: (typ -> 'a -> 'a) -> typ -> 'a -> 'a| \\
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   133
  \indexml{Sign.subsort}\verb|Sign.subsort: theory -> sort * sort -> bool| \\
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   134
  \indexml{Sign.of-sort}\verb|Sign.of_sort: theory -> typ * sort -> bool| \\
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   135
  \indexml{Sign.add-types}\verb|Sign.add_types: (bstring * int * mixfix) list -> theory -> theory| \\
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   136
  \indexml{Sign.add-tyabbrs-i}\verb|Sign.add_tyabbrs_i: |\isasep\isanewline%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   137
\verb|  (bstring * string list * typ * mixfix) list -> theory -> theory| \\
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   138
  \indexml{Sign.primitive-class}\verb|Sign.primitive_class: string * class list -> theory -> theory| \\
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   139
  \indexml{Sign.primitive-classrel}\verb|Sign.primitive_classrel: class * class -> theory -> theory| \\
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   140
  \indexml{Sign.primitive-arity}\verb|Sign.primitive_arity: arity -> theory -> theory| \\
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   141
  \end{mldecls}
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   142
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   143
  \begin{description}
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   144
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   145
  \item \verb|class| represents type classes; this is an alias for
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   146
  \verb|string|.
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   147
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   148
  \item \verb|sort| represents sorts; this is an alias for
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   149
  \verb|class list|.
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   150
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   151
  \item \verb|arity| represents type arities; this is an alias for
20494
wenzelm
parents: 20493
diff changeset
   152
  triples of the form \isa{{\isacharparenleft}{\isasymkappa}{\isacharcomma}\ \isactrlvec s{\isacharcomma}\ s{\isacharparenright}} for \isa{{\isasymkappa}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}\isactrlvec s{\isacharparenright}s} described above.
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   153
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   154
  \item \verb|typ| represents types; this is a datatype with
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   155
  constructors \verb|TFree|, \verb|TVar|, \verb|Type|.
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   156
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   157
  \item \verb|map_atyps|~\isa{f\ {\isasymtau}} applies mapping \isa{f} to
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   158
  all atomic types (\verb|TFree|, \verb|TVar|) occurring in \isa{{\isasymtau}}.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   159
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   160
  \item \verb|fold_atyps|~\isa{f\ {\isasymtau}} iterates operation \isa{f}
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   161
  over all occurrences of atoms (\verb|TFree|, \verb|TVar|) in \isa{{\isasymtau}}; the type structure is traversed from left to right.
20494
wenzelm
parents: 20493
diff changeset
   162
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   163
  \item \verb|Sign.subsort|~\isa{thy\ {\isacharparenleft}s\isactrlisub {\isadigit{1}}{\isacharcomma}\ s\isactrlisub {\isadigit{2}}{\isacharparenright}}
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   164
  tests the subsort relation \isa{s\isactrlisub {\isadigit{1}}\ {\isasymsubseteq}\ s\isactrlisub {\isadigit{2}}}.
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   165
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   166
  \item \verb|Sign.of_sort|~\isa{thy\ {\isacharparenleft}{\isasymtau}{\isacharcomma}\ s{\isacharparenright}} tests whether a type
20491
wenzelm
parents: 20481
diff changeset
   167
  is of a given sort.
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   168
20494
wenzelm
parents: 20493
diff changeset
   169
  \item \verb|Sign.add_types|~\isa{{\isacharbrackleft}{\isacharparenleft}{\isasymkappa}{\isacharcomma}\ k{\isacharcomma}\ mx{\isacharparenright}{\isacharcomma}\ {\isasymdots}{\isacharbrackright}} declares new
wenzelm
parents: 20493
diff changeset
   170
  type constructors \isa{{\isasymkappa}} with \isa{k} arguments and
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   171
  optional mixfix syntax.
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   172
20494
wenzelm
parents: 20493
diff changeset
   173
  \item \verb|Sign.add_tyabbrs_i|~\isa{{\isacharbrackleft}{\isacharparenleft}{\isasymkappa}{\isacharcomma}\ \isactrlvec {\isasymalpha}{\isacharcomma}\ {\isasymtau}{\isacharcomma}\ mx{\isacharparenright}{\isacharcomma}\ {\isasymdots}{\isacharbrackright}}
wenzelm
parents: 20493
diff changeset
   174
  defines a new type abbreviation \isa{{\isacharparenleft}\isactrlvec {\isasymalpha}{\isacharparenright}{\isasymkappa}\ {\isacharequal}\ {\isasymtau}} with
20491
wenzelm
parents: 20481
diff changeset
   175
  optional mixfix syntax.
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   176
20494
wenzelm
parents: 20493
diff changeset
   177
  \item \verb|Sign.primitive_class|~\isa{{\isacharparenleft}c{\isacharcomma}\ {\isacharbrackleft}c\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ c\isactrlisub n{\isacharbrackright}{\isacharparenright}} declares new class \isa{c}, together with class
wenzelm
parents: 20493
diff changeset
   178
  relations \isa{c\ {\isasymsubseteq}\ c\isactrlisub i}, for \isa{i\ {\isacharequal}\ {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ n}.
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   179
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   180
  \item \verb|Sign.primitive_classrel|~\isa{{\isacharparenleft}c\isactrlisub {\isadigit{1}}{\isacharcomma}\ c\isactrlisub {\isadigit{2}}{\isacharparenright}} declares class relation \isa{c\isactrlisub {\isadigit{1}}\ {\isasymsubseteq}\ c\isactrlisub {\isadigit{2}}}.
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   181
20494
wenzelm
parents: 20493
diff changeset
   182
  \item \verb|Sign.primitive_arity|~\isa{{\isacharparenleft}{\isasymkappa}{\isacharcomma}\ \isactrlvec s{\isacharcomma}\ s{\isacharparenright}} declares
wenzelm
parents: 20493
diff changeset
   183
  arity \isa{{\isasymkappa}\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}\isactrlvec s{\isacharparenright}s}.
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   184
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   185
  \end{description}%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   186
\end{isamarkuptext}%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   187
\isamarkuptrue%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   188
%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   189
\endisatagmlref
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   190
{\isafoldmlref}%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   191
%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   192
\isadelimmlref
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   193
%
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   194
\endisadelimmlref
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   195
%
20451
27ea2ba48fa3 misc cleanup;
wenzelm
parents: 20450
diff changeset
   196
\isamarkupsection{Terms \label{sec:terms}%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   197
}
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   198
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   199
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   200
\begin{isamarkuptext}%
20451
27ea2ba48fa3 misc cleanup;
wenzelm
parents: 20450
diff changeset
   201
\glossary{Term}{FIXME}
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   202
20491
wenzelm
parents: 20481
diff changeset
   203
  The language of terms is that of simply-typed \isa{{\isasymlambda}}-calculus
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   204
  with de-Bruijn indices for bound variables
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   205
  \cite{debruijn72,paulson-ml2}, and named free variables and
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   206
  constants.  Terms with loose bound variables are usually considered
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   207
  malformed.  The types of variables and constants is stored
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   208
  explicitly at each occurrence in the term.
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   209
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   210
  \medskip A \emph{bound variable} is a natural number \isa{b},
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   211
  which refers to the next binder that is \isa{b} steps upwards
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   212
  from the occurrence of \isa{b} (counting from zero).  Bindings
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   213
  may be introduced as abstractions within the term, or as a separate
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   214
  context (an inside-out list).  This associates each bound variable
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   215
  with a type.  A \emph{loose variables} is a bound variable that is
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   216
  outside the current scope of local binders or the context.  For
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   217
  example, the de-Bruijn term \isa{{\isasymlambda}\isactrlisub {\isasymtau}{\isachardot}\ {\isasymlambda}\isactrlisub {\isasymtau}{\isachardot}\ {\isadigit{1}}\ {\isacharplus}\ {\isadigit{0}}}
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   218
  corresponds to \isa{{\isasymlambda}x\isactrlisub {\isasymtau}{\isachardot}\ {\isasymlambda}y\isactrlisub {\isasymtau}{\isachardot}\ x\ {\isacharplus}\ y} in a named
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   219
  representation.  Also note that the very same bound variable may get
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   220
  different numbers at different occurrences.
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   221
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   222
  A \emph{fixed variable} is a pair of a basic name and a type.  For
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   223
  example, \isa{{\isacharparenleft}x{\isacharcomma}\ {\isasymtau}{\isacharparenright}} which is usually printed \isa{x\isactrlisub {\isasymtau}}.  A \emph{schematic variable} is a pair of an
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   224
  indexname and a type.  For example, \isa{{\isacharparenleft}{\isacharparenleft}x{\isacharcomma}\ {\isadigit{0}}{\isacharparenright}{\isacharcomma}\ {\isasymtau}{\isacharparenright}} which is
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   225
  usually printed as \isa{{\isacharquery}x\isactrlisub {\isasymtau}}.
20491
wenzelm
parents: 20481
diff changeset
   226
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   227
  \medskip A \emph{constant} is a atomic terms consisting of a basic
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   228
  name and a type.  Constants are declared in the context as
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   229
  polymorphic families \isa{c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}}, meaning that any \isa{c\isactrlisub {\isasymtau}} is a valid constant for all substitution instances
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   230
  \isa{{\isasymtau}\ {\isasymle}\ {\isasymsigma}}.
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   231
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   232
  The list of \emph{type arguments} of \isa{c\isactrlisub {\isasymtau}} wrt.\ the
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   233
  declaration \isa{c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}} is the codomain of the type matcher
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   234
  presented in canonical order (according to the left-to-right
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   235
  occurrences of type variables in in \isa{{\isasymsigma}}).  Thus \isa{c\isactrlisub {\isasymtau}} can be represented more compactly as \isa{c{\isacharparenleft}{\isasymtau}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymtau}\isactrlisub n{\isacharparenright}}.  For example, the instance \isa{plus\isactrlbsub nat\ {\isasymRightarrow}\ nat\ {\isasymRightarrow}\ nat\isactrlesub } of some \isa{plus\ {\isacharcolon}{\isacharcolon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}} has the singleton list \isa{nat} as type arguments, the
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   236
  constant may be represented as \isa{plus{\isacharparenleft}nat{\isacharparenright}}.
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   237
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   238
  Constant declarations \isa{c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}} may contain sort constraints
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   239
  for type variables in \isa{{\isasymsigma}}.  These are observed by
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   240
  type-inference as expected, but \emph{ignored} by the core logic.
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   241
  This means the primitive logic is able to reason with instances of
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   242
  polymorphic constants that the user-level type-checker would reject.
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   243
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   244
  \medskip A \emph{term} \isa{t} is defined inductively over
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   245
  variables and constants, with abstraction and application as
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   246
  follows: \isa{t\ {\isacharequal}\ b\ {\isacharbar}\ x\isactrlisub {\isasymtau}\ {\isacharbar}\ {\isacharquery}x\isactrlisub {\isasymtau}\ {\isacharbar}\ c\isactrlisub {\isasymtau}\ {\isacharbar}\ {\isasymlambda}\isactrlisub {\isasymtau}{\isachardot}\ t\ {\isacharbar}\ t\isactrlisub {\isadigit{1}}\ t\isactrlisub {\isadigit{2}}}.  Parsing and printing takes
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   247
  care of converting between an external representation with named
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   248
  bound variables.  Subsequently, we shall use the latter notation
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   249
  instead of internal de-Bruijn representation.
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   250
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   251
  The subsequent inductive relation \isa{t\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}} assigns a
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   252
  (unique) type to a term, using the special type constructor \isa{{\isacharparenleft}{\isasymalpha}{\isacharcomma}\ {\isasymbeta}{\isacharparenright}fun}, which is written \isa{{\isasymalpha}\ {\isasymRightarrow}\ {\isasymbeta}}.
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   253
  \[
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   254
  \infer{\isa{a\isactrlisub {\isasymtau}\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}}}{}
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   255
  \qquad
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   256
  \infer{\isa{{\isacharparenleft}{\isasymlambda}x\isactrlsub {\isasymtau}{\isachardot}\ t{\isacharparenright}\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}\ {\isasymRightarrow}\ {\isasymsigma}}}{\isa{t\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}}}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   257
  \qquad
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   258
  \infer{\isa{t\ u\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}}}{\isa{t\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}\ {\isasymRightarrow}\ {\isasymsigma}} & \isa{u\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}}}
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   259
  \]
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   260
  A \emph{well-typed term} is a term that can be typed according to these rules.
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   261
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   262
  Typing information can be omitted: type-inference is able to
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   263
  reconstruct the most general type of a raw term, while assigning
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   264
  most general types to all of its variables and constants.
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   265
  Type-inference depends on a context of type constraints for fixed
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   266
  variables, and declarations for polymorphic constants.
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   267
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   268
  The identity of atomic terms consists both of the name and the type.
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   269
  Thus different entities \isa{c\isactrlbsub {\isasymtau}\isactrlisub {\isadigit{1}}\isactrlesub } and
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   270
  \isa{c\isactrlbsub {\isasymtau}\isactrlisub {\isadigit{2}}\isactrlesub } may well identified by type
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   271
  instantiation, by mapping \isa{{\isasymtau}\isactrlisub {\isadigit{1}}} and \isa{{\isasymtau}\isactrlisub {\isadigit{2}}} to the same \isa{{\isasymtau}}.  Although,
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   272
  different type instances of constants of the same basic name are
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   273
  commonplace, this rarely happens for variables: type-inference
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   274
  always demands ``consistent'' type constraints.
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   275
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   276
  \medskip The \emph{hidden polymorphism} of a term \isa{t\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}}
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   277
  is the set of type variables occurring in \isa{t}, but not in
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   278
  \isa{{\isasymsigma}}.  This means that the term implicitly depends on the
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   279
  values of various type variables that are not visible in the overall
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   280
  type, i.e.\ there are different type instances \isa{t{\isasymvartheta}\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}} and \isa{t{\isasymvartheta}{\isacharprime}\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}} with the same type.  This
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   281
  slightly pathological situation is apt to cause strange effects.
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   282
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   283
  \medskip A \emph{term abbreviation} is a syntactic definition \isa{c\isactrlisub {\isasymsigma}\ {\isasymequiv}\ t} of an arbitrary closed term \isa{t} of type
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   284
  \isa{{\isasymsigma}} without any hidden polymorphism.  A term abbreviation
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   285
  looks like a constant at the surface, but is fully expanded before
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   286
  entering the logical core.  Abbreviations are usually reverted when
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   287
  printing terms, using rules \isa{t\ {\isasymrightarrow}\ c\isactrlisub {\isasymsigma}} has a
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   288
  higher-order term rewrite system.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   289
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   290
  \medskip Canonical operations on \isa{{\isasymlambda}}-terms include \isa{{\isasymalpha}{\isasymbeta}{\isasymeta}}-conversion. \isa{{\isasymalpha}}-conversion refers to capture-free
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   291
  renaming of bound variables; \isa{{\isasymbeta}}-conversion contracts an
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   292
  abstraction applied to some argument term, substituting the argument
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   293
  in the body: \isa{{\isacharparenleft}{\isasymlambda}x{\isachardot}\ b{\isacharparenright}a} becomes \isa{b{\isacharbrackleft}a{\isacharslash}x{\isacharbrackright}}; \isa{{\isasymeta}}-conversion contracts vacuous application-abstraction: \isa{{\isasymlambda}x{\isachardot}\ f\ x} becomes \isa{f}, provided that the bound variable
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   294
  \isa{{\isadigit{0}}} does not occur in \isa{f}.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   295
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   296
  Terms are almost always treated module \isa{{\isasymalpha}}-conversion, which
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   297
  is implicit in the de-Bruijn representation.  The names in
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   298
  abstractions of bound variables are maintained only as a comment for
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   299
  parsing and printing.  Full \isa{{\isasymalpha}{\isasymbeta}{\isasymeta}}-equivalence is usually
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   300
  taken for granted higher rules (\secref{sec:rules}), anything
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   301
  depending on higher-order unification or rewriting.%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   302
\end{isamarkuptext}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   303
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   304
%
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   305
\isadelimmlref
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   306
%
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   307
\endisadelimmlref
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   308
%
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   309
\isatagmlref
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   310
%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   311
\begin{isamarkuptext}%
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   312
\begin{mldecls}
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   313
  \indexmltype{term}\verb|type term| \\
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   314
  \indexml{op aconv}\verb|op aconv: term * term -> bool| \\
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   315
  \indexml{map-term-types}\verb|map_term_types: (typ -> typ) -> term -> term| \\  %FIXME rename map_types
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   316
  \indexml{fold-types}\verb|fold_types: (typ -> 'a -> 'a) -> term -> 'a -> 'a| \\
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   317
  \indexml{map-aterms}\verb|map_aterms: (term -> term) -> term -> term| \\
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   318
  \indexml{fold-aterms}\verb|fold_aterms: (term -> 'a -> 'a) -> term -> 'a -> 'a| \\
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   319
  \indexml{fastype-of}\verb|fastype_of: term -> typ| \\
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   320
  \indexml{lambda}\verb|lambda: term -> term -> term| \\
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   321
  \indexml{betapply}\verb|betapply: term * term -> term| \\
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   322
  \indexml{Sign.add-consts-i}\verb|Sign.add_consts_i: (bstring * typ * mixfix) list -> theory -> theory| \\
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   323
  \indexml{Sign.add-abbrevs}\verb|Sign.add_abbrevs: string * bool ->|\isasep\isanewline%
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   324
\verb|  ((bstring * mixfix) * term) list -> theory -> theory| \\
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   325
  \indexml{Sign.const-typargs}\verb|Sign.const_typargs: theory -> string * typ -> typ list| \\
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   326
  \indexml{Sign.const-instance}\verb|Sign.const_instance: theory -> string * typ list -> typ| \\
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   327
  \end{mldecls}
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   328
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   329
  \begin{description}
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   330
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   331
  \item \verb|term| represents de-Bruijn terms with comments in
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   332
  abstractions for bound variable names.  This is a datatype with
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   333
  constructors \verb|Bound|, \verb|Free|, \verb|Var|, \verb|Const|, \verb|Abs|, \verb|op $|.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   334
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   335
  \item \isa{t}~\verb|aconv|~\isa{u} checks \isa{{\isasymalpha}}-equivalence of two terms.  This is the basic equality relation
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   336
  on type \verb|term|; raw datatype equality should only be used
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   337
  for operations related to parsing or printing!
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   338
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   339
  \item \verb|map_term_types|~\isa{f\ t} applies mapping \isa{f}
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   340
  to all types occurring in \isa{t}.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   341
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   342
  \item \verb|fold_types|~\isa{f\ t} iterates operation \isa{f}
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   343
  over all occurrences of types in \isa{t}; the term structure is
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   344
  traversed from left to right.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   345
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   346
  \item \verb|map_aterms|~\isa{f\ t} applies mapping \isa{f} to
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   347
  all atomic terms (\verb|Bound|, \verb|Free|, \verb|Var|, \verb|Const|)
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   348
  occurring in \isa{t}.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   349
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   350
  \item \verb|fold_aterms|~\isa{f\ t} iterates operation \isa{f}
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   351
  over all occurrences of atomic terms in (\verb|Bound|, \verb|Free|,
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   352
  \verb|Var|, \verb|Const|) \isa{t}; the term structure is traversed
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   353
  from left to right.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   354
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   355
  \item \verb|fastype_of|~\isa{t} recomputes the type of a
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   356
  well-formed term, while omitting any sanity checks.  This operation
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   357
  is relatively slow.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   358
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   359
  \item \verb|lambda|~\isa{a\ b} produces an abstraction \isa{{\isasymlambda}a{\isachardot}\ b}, where occurrences of the original (atomic) term \isa{a} are replaced by bound variables.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   360
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   361
  \item \verb|betapply|~\isa{t\ u} produces an application \isa{t\ u}, with topmost \isa{{\isasymbeta}}-conversion \isa{t} is an
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   362
  abstraction.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   363
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   364
  \item \verb|Sign.add_consts_i|~\isa{{\isacharbrackleft}{\isacharparenleft}c{\isacharcomma}\ {\isasymsigma}{\isacharcomma}\ mx{\isacharparenright}{\isacharcomma}\ {\isasymdots}{\isacharbrackright}} declares a
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   365
  new constant \isa{c\ {\isacharcolon}{\isacharcolon}\ {\isasymsigma}} with optional mixfix syntax.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   366
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   367
  \item \verb|Sign.add_abbrevs|~\isa{print{\isacharunderscore}mode\ {\isacharbrackleft}{\isacharparenleft}{\isacharparenleft}c{\isacharcomma}\ t{\isacharparenright}{\isacharcomma}\ mx{\isacharparenright}{\isacharcomma}\ {\isasymdots}{\isacharbrackright}}
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   368
  declares a new term abbreviation \isa{c\ {\isasymequiv}\ t} with optional
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   369
  mixfix syntax.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   370
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   371
  \item \verb|Sign.const_typargs|~\isa{thy\ {\isacharparenleft}c{\isacharcomma}\ {\isasymtau}{\isacharparenright}} produces the
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   372
  type arguments of the instance \isa{c\isactrlisub {\isasymtau}} wrt.\ its
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   373
  declaration in the theory.
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   374
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   375
  \item \verb|Sign.const_instance|~\isa{thy\ {\isacharparenleft}c{\isacharcomma}\ {\isacharbrackleft}{\isasymtau}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymtau}\isactrlisub n{\isacharbrackright}{\isacharparenright}} produces the full instance \isa{c{\isacharparenleft}{\isasymtau}\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ {\isasymtau}\isactrlisub n{\isacharparenright}} wrt.\ its declaration in the theory.
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   376
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   377
  \end{description}%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   378
\end{isamarkuptext}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   379
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   380
%
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   381
\endisatagmlref
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   382
{\isafoldmlref}%
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   383
%
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   384
\isadelimmlref
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   385
%
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   386
\endisadelimmlref
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   387
%
20451
27ea2ba48fa3 misc cleanup;
wenzelm
parents: 20450
diff changeset
   388
\isamarkupsection{Theorems \label{sec:thms}%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   389
}
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   390
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   391
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   392
\begin{isamarkuptext}%
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   393
\glossary{Proposition}{A \seeglossary{term} of \seeglossary{type}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   394
  \isa{prop}.  Internally, there is nothing special about
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   395
  propositions apart from their type, but the concrete syntax enforces
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   396
  a clear distinction.  Propositions are structured via implication
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   397
  \isa{A\ {\isasymLongrightarrow}\ B} or universal quantification \isa{{\isasymAnd}x{\isachardot}\ B\ x} ---
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   398
  anything else is considered atomic.  The canonical form for
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   399
  propositions is that of a \seeglossary{Hereditary Harrop Formula}. FIXME}
20481
c96f80442ce6 updated;
wenzelm
parents: 20477
diff changeset
   400
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   401
  \glossary{Theorem}{A proven proposition within a certain theory and
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   402
  proof context, formally \isa{{\isasymGamma}\ {\isasymturnstile}\isactrlsub {\isasymTheta}\ {\isasymphi}}; both contexts are
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   403
  rarely spelled out explicitly.  Theorems are usually normalized
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   404
  according to the \seeglossary{HHF} format. FIXME}
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   405
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   406
  \glossary{Fact}{Sometimes used interchangeably for
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   407
  \seeglossary{theorem}.  Strictly speaking, a list of theorems,
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   408
  essentially an extra-logical conjunction.  Facts emerge either as
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   409
  local assumptions, or as results of local goal statements --- both
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   410
  may be simultaneous, hence the list representation. FIXME}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   411
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   412
  \glossary{Schematic variable}{FIXME}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   413
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   414
  \glossary{Fixed variable}{A variable that is bound within a certain
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   415
  proof context; an arbitrary-but-fixed entity within a portion of
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   416
  proof text. FIXME}
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   417
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   418
  \glossary{Free variable}{Synonymous for \seeglossary{fixed
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   419
  variable}. FIXME}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   420
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   421
  \glossary{Bound variable}{FIXME}
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   422
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   423
  \glossary{Variable}{See \seeglossary{schematic variable},
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   424
  \seeglossary{fixed variable}, \seeglossary{bound variable}, or
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   425
  \seeglossary{type variable}.  The distinguishing feature of
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   426
  different variables is their binding scope. FIXME}
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   427
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   428
  A \emph{proposition} is a well-formed term of type \isa{prop}.
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   429
  The connectives of minimal logic are declared as constants of the
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   430
  basic theory:
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   431
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   432
  \smallskip
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   433
  \begin{tabular}{ll}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   434
  \isa{all\ {\isacharcolon}{\isacharcolon}\ {\isacharparenleft}{\isasymalpha}\ {\isasymRightarrow}\ prop{\isacharparenright}\ {\isasymRightarrow}\ prop} & universal quantification (binder \isa{{\isasymAnd}}) \\
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   435
  \isa{{\isasymLongrightarrow}\ {\isacharcolon}{\isacharcolon}\ prop\ {\isasymRightarrow}\ prop\ {\isasymRightarrow}\ prop} & implication (right associative infix) \\
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   436
  \end{tabular}
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   437
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   438
  \medskip A \emph{theorem} is a proven proposition, depending on a
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   439
  collection of assumptions, and axioms from the theory context.  The
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   440
  judgment \isa{A\isactrlisub {\isadigit{1}}{\isacharcomma}\ {\isasymdots}{\isacharcomma}\ A\isactrlisub n\ {\isasymturnstile}\ B} is defined
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   441
  inductively by the primitive inferences given in
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   442
  \figref{fig:prim-rules}; there is a global syntactic restriction
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   443
  that the hypotheses may not contain schematic variables.
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   444
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   445
  \begin{figure}[htb]
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   446
  \begin{center}
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   447
  \[
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   448
  \infer[\isa{{\isacharparenleft}axiom{\isacharparenright}}]{\isa{{\isasymturnstile}\ A}}{\isa{A\ {\isasymin}\ {\isasymTheta}}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   449
  \qquad
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   450
  \infer[\isa{{\isacharparenleft}assume{\isacharparenright}}]{\isa{A\ {\isasymturnstile}\ A}}{}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   451
  \]
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   452
  \[
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   453
  \infer[\isa{{\isacharparenleft}{\isasymAnd}{\isacharunderscore}intro{\isacharparenright}}]{\isa{{\isasymGamma}\ {\isasymturnstile}\ {\isasymAnd}x{\isachardot}\ b\ x}}{\isa{{\isasymGamma}\ {\isasymturnstile}\ b\ x} & \isa{x\ {\isasymnotin}\ {\isasymGamma}}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   454
  \qquad
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   455
  \infer[\isa{{\isacharparenleft}{\isasymAnd}{\isacharunderscore}elim{\isacharparenright}}]{\isa{{\isasymGamma}\ {\isasymturnstile}\ b\ a}}{\isa{{\isasymGamma}\ {\isasymturnstile}\ {\isasymAnd}x{\isachardot}\ b\ x}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   456
  \]
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   457
  \[
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   458
  \infer[\isa{{\isacharparenleft}{\isasymLongrightarrow}{\isacharunderscore}intro{\isacharparenright}}]{\isa{{\isasymGamma}\ {\isacharminus}\ A\ {\isasymturnstile}\ A\ {\isasymLongrightarrow}\ B}}{\isa{{\isasymGamma}\ {\isasymturnstile}\ B}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   459
  \qquad
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   460
  \infer[\isa{{\isacharparenleft}{\isasymLongrightarrow}{\isacharunderscore}elim{\isacharparenright}}]{\isa{{\isasymGamma}\isactrlsub {\isadigit{1}}\ {\isasymunion}\ {\isasymGamma}\isactrlsub {\isadigit{2}}\ {\isasymturnstile}\ B}}{\isa{{\isasymGamma}\isactrlsub {\isadigit{1}}\ {\isasymturnstile}\ A\ {\isasymLongrightarrow}\ B} & \isa{{\isasymGamma}\isactrlsub {\isadigit{2}}\ {\isasymturnstile}\ A}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   461
  \]
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   462
  \caption{Primitive inferences of the Pure logic}\label{fig:prim-rules}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   463
  \end{center}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   464
  \end{figure}
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   465
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   466
  The introduction and elimination rules for \isa{{\isasymAnd}} and \isa{{\isasymLongrightarrow}} are analogous to formation of (dependently typed) \isa{{\isasymlambda}}-terms representing the underlying proof objects.  Proof terms
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   467
  are \emph{irrelevant} in the Pure logic, they may never occur within
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   468
  propositions, i.e.\ the \isa{{\isasymLongrightarrow}} arrow of the framework is a
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   469
  non-dependent one.
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   470
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   471
  Also note that fixed parameters as in \isa{{\isasymAnd}{\isacharunderscore}intro} need not be
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   472
  recorded in the context \isa{{\isasymGamma}}, since syntactic types are
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   473
  always inhabitable.  An ``assumption'' \isa{x\ {\isacharcolon}{\isacharcolon}\ {\isasymtau}} is logically
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   474
  vacuous, because \isa{{\isasymtau}} is always non-empty.  This is the deeper
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   475
  reason why \isa{{\isasymGamma}} only consists of hypothetical proofs, but no
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   476
  hypothetical terms.
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   477
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   478
  The corresponding proof terms are left implicit in the classic
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   479
  ``LCF-approach'', although they could be exploited separately
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   480
  \cite{Berghofer-Nipkow:2000}.  The implementation provides a runtime
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   481
  option to control the generation of full proof terms.
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   482
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   483
  \medskip The axiomatization of a theory is implicitly closed by
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   484
  forming all instances of type and term variables: \isa{{\isasymturnstile}\ A{\isasymtheta}} for
20514
5ede702cd2ca more on terms;
wenzelm
parents: 20502
diff changeset
   485
  any substitution instance of axiom \isa{{\isasymturnstile}\ A}.  By pushing
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   486
  substitution through derivations inductively, we get admissible
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   487
  substitution rules for theorems shown in \figref{fig:subst-rules}.
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   488
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   489
  \begin{figure}[htb]
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   490
  \begin{center}
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   491
  \[
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   492
  \infer{\isa{{\isasymGamma}\ {\isasymturnstile}\ B{\isacharbrackleft}{\isacharquery}{\isasymalpha}{\isacharbrackright}}}{\isa{{\isasymGamma}\ {\isasymturnstile}\ B{\isacharbrackleft}{\isasymalpha}{\isacharbrackright}} & \isa{{\isasymalpha}\ {\isasymnotin}\ {\isasymGamma}}}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   493
  \quad
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   494
  \infer[\quad\isa{{\isacharparenleft}generalize{\isacharparenright}}]{\isa{{\isasymGamma}\ {\isasymturnstile}\ B{\isacharbrackleft}{\isacharquery}x{\isacharbrackright}}}{\isa{{\isasymGamma}\ {\isasymturnstile}\ B{\isacharbrackleft}x{\isacharbrackright}} & \isa{x\ {\isasymnotin}\ {\isasymGamma}}}
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   495
  \]
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   496
  \[
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   497
  \infer{\isa{{\isasymGamma}\ {\isasymturnstile}\ B{\isacharbrackleft}{\isasymtau}{\isacharbrackright}}}{\isa{{\isasymGamma}\ {\isasymturnstile}\ B{\isacharbrackleft}{\isacharquery}{\isasymalpha}{\isacharbrackright}}}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   498
  \quad
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   499
  \infer[\quad\isa{{\isacharparenleft}instantiate{\isacharparenright}}]{\isa{{\isasymGamma}\ {\isasymturnstile}\ B{\isacharbrackleft}t{\isacharbrackright}}}{\isa{{\isasymGamma}\ {\isasymturnstile}\ B{\isacharbrackleft}{\isacharquery}x{\isacharbrackright}}}
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   500
  \]
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   501
  \caption{Admissible substitution rules}\label{fig:subst-rules}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   502
  \end{center}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   503
  \end{figure}
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   504
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   505
  Note that \isa{instantiate{\isacharunderscore}term} could be derived using \isa{{\isasymAnd}{\isacharunderscore}intro{\isacharslash}elim}, but this is not how it is implemented.  The type
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   506
  instantiation rule is a genuine admissible one, due to the lack of
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   507
  true polymorphism in the logic.
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   508
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   509
  Since \isa{{\isasymGamma}} may never contain any schematic variables, the
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   510
  \isa{instantiate} do not require an explicit side-condition.  In
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   511
  principle, variables could be substituted in hypotheses as well, but
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   512
  this could disrupt monotonicity of the basic calculus: derivations
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   513
  could leave the current proof context.
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   514
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   515
  \medskip The framework also provides builtin equality \isa{{\isasymequiv}},
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   516
  which is conceptually axiomatized shown in \figref{fig:equality},
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   517
  although the implementation provides derived rules directly:
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   518
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   519
  \begin{figure}[htb]
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   520
  \begin{center}
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   521
  \begin{tabular}{ll}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   522
  \isa{{\isasymequiv}\ {\isacharcolon}{\isacharcolon}\ {\isasymalpha}\ {\isasymRightarrow}\ {\isasymalpha}\ {\isasymRightarrow}\ prop} & equality relation (infix) \\
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   523
  \isa{{\isasymturnstile}\ {\isacharparenleft}{\isasymlambda}x{\isachardot}\ b\ x{\isacharparenright}\ a\ {\isasymequiv}\ b\ a} & \isa{{\isasymbeta}}-conversion \\
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   524
  \isa{{\isasymturnstile}\ x\ {\isasymequiv}\ x} & reflexivity law \\
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   525
  \isa{{\isasymturnstile}\ x\ {\isasymequiv}\ y\ {\isasymLongrightarrow}\ P\ x\ {\isasymLongrightarrow}\ P\ y} & substitution law \\
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   526
  \isa{{\isasymturnstile}\ {\isacharparenleft}{\isasymAnd}x{\isachardot}\ f\ x\ {\isasymequiv}\ g\ x{\isacharparenright}\ {\isasymLongrightarrow}\ f\ {\isasymequiv}\ g} & extensionality \\
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   527
  \isa{{\isasymturnstile}\ {\isacharparenleft}A\ {\isasymLongrightarrow}\ B{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}B\ {\isasymLongrightarrow}\ A{\isacharparenright}\ {\isasymLongrightarrow}\ A\ {\isasymequiv}\ B} & coincidence with equivalence \\
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   528
  \end{tabular}
20502
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   529
  \caption{Conceptual axiomatization of equality.}\label{fig:equality}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   530
  \end{center}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   531
  \end{figure}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   532
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   533
  Since the basic representation of terms already accounts for \isa{{\isasymalpha}}-conversion, Pure equality essentially acts like \isa{{\isasymalpha}{\isasymbeta}{\isasymeta}}-equivalence on terms, while coinciding with bi-implication.
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   534
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   535
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   536
  \medskip Conjunction is defined in Pure as a derived connective, see
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   537
  \figref{fig:conjunction}.  This is occasionally useful to represent
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   538
  simultaneous statements behind the scenes --- framework conjunction
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   539
  is usually not exposed to the user.
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   540
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   541
  \begin{figure}[htb]
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   542
  \begin{center}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   543
  \begin{tabular}{ll}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   544
  \isa{{\isacharampersand}\ {\isacharcolon}{\isacharcolon}\ prop\ {\isasymRightarrow}\ prop\ {\isasymRightarrow}\ prop} & conjunction (hidden) \\
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   545
  \isa{{\isasymturnstile}\ A\ {\isacharampersand}\ B\ {\isasymequiv}\ {\isacharparenleft}{\isasymAnd}C{\isachardot}\ {\isacharparenleft}A\ {\isasymLongrightarrow}\ B\ {\isasymLongrightarrow}\ C{\isacharparenright}\ {\isasymLongrightarrow}\ C{\isacharparenright}} \\
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   546
  \end{tabular}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   547
  \caption{Definition of conjunction.}\label{fig:equality}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   548
  \end{center}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   549
  \end{figure}
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   550
08d227db6c74 updated;
wenzelm
parents: 20499
diff changeset
   551
  The definition allows to derive the usual introduction \isa{{\isasymturnstile}\ A\ {\isasymLongrightarrow}\ B\ {\isasymLongrightarrow}\ A\ {\isacharampersand}\ B}, and destructions \isa{A\ {\isacharampersand}\ B\ {\isasymLongrightarrow}\ A} and \isa{A\ {\isacharampersand}\ B\ {\isasymLongrightarrow}\ B}.%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   552
\end{isamarkuptext}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   553
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   554
%
20491
wenzelm
parents: 20481
diff changeset
   555
\isamarkupsection{Rules \label{sec:rules}%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   556
}
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   557
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   558
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   559
\begin{isamarkuptext}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   560
FIXME
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   561
20491
wenzelm
parents: 20481
diff changeset
   562
  A \emph{rule} is any Pure theorem in HHF normal form; there is a
wenzelm
parents: 20481
diff changeset
   563
  separate calculus for rule composition, which is modeled after
wenzelm
parents: 20481
diff changeset
   564
  Gentzen's Natural Deduction \cite{Gentzen:1935}, but allows
wenzelm
parents: 20481
diff changeset
   565
  rules to be nested arbitrarily, similar to \cite{extensions91}.
wenzelm
parents: 20481
diff changeset
   566
wenzelm
parents: 20481
diff changeset
   567
  Normally, all theorems accessible to the user are proper rules.
wenzelm
parents: 20481
diff changeset
   568
  Low-level inferences are occasional required internally, but the
wenzelm
parents: 20481
diff changeset
   569
  result should be always presented in canonical form.  The higher
wenzelm
parents: 20481
diff changeset
   570
  interfaces of Isabelle/Isar will always produce proper rules.  It is
wenzelm
parents: 20481
diff changeset
   571
  important to maintain this invariant in add-on applications!
wenzelm
parents: 20481
diff changeset
   572
wenzelm
parents: 20481
diff changeset
   573
  There are two main principles of rule composition: \isa{resolution} (i.e.\ backchaining of rules) and \isa{by{\isacharminus}assumption} (i.e.\ closing a branch); both principles are
20519
d7ad1217c24a more on terms;
wenzelm
parents: 20514
diff changeset
   574
  combined in the variants of \isa{elim{\isacharminus}resolution} and \isa{dest{\isacharminus}resolution}.  Raw \isa{composition} is occasionally
20491
wenzelm
parents: 20481
diff changeset
   575
  useful as well, also it is strictly speaking outside of the proper
wenzelm
parents: 20481
diff changeset
   576
  rule calculus.
wenzelm
parents: 20481
diff changeset
   577
wenzelm
parents: 20481
diff changeset
   578
  Rules are treated modulo general higher-order unification, which is
wenzelm
parents: 20481
diff changeset
   579
  unification modulo the equational theory of \isa{{\isasymalpha}{\isasymbeta}{\isasymeta}}-conversion
wenzelm
parents: 20481
diff changeset
   580
  on \isa{{\isasymlambda}}-terms.  Moreover, propositions are understood modulo
wenzelm
parents: 20481
diff changeset
   581
  the (derived) equivalence \isa{{\isacharparenleft}A\ {\isasymLongrightarrow}\ {\isacharparenleft}{\isasymAnd}x{\isachardot}\ B\ x{\isacharparenright}{\isacharparenright}\ {\isasymequiv}\ {\isacharparenleft}{\isasymAnd}x{\isachardot}\ A\ {\isasymLongrightarrow}\ B\ x{\isacharparenright}}.
wenzelm
parents: 20481
diff changeset
   582
wenzelm
parents: 20481
diff changeset
   583
  This means that any operations within the rule calculus may be
wenzelm
parents: 20481
diff changeset
   584
  subject to spontaneous \isa{{\isasymalpha}{\isasymbeta}{\isasymeta}}-HHF conversions.  It is common
wenzelm
parents: 20481
diff changeset
   585
  practice not to contract or expand unnecessarily.  Some mechanisms
wenzelm
parents: 20481
diff changeset
   586
  prefer an one form, others the opposite, so there is a potential
wenzelm
parents: 20481
diff changeset
   587
  danger to produce some oscillation!
wenzelm
parents: 20481
diff changeset
   588
wenzelm
parents: 20481
diff changeset
   589
  Only few operations really work \emph{modulo} HHF conversion, but
wenzelm
parents: 20481
diff changeset
   590
  expect a normal form: quantifiers \isa{{\isasymAnd}} before implications
wenzelm
parents: 20481
diff changeset
   591
  \isa{{\isasymLongrightarrow}} at each level of nesting.
wenzelm
parents: 20481
diff changeset
   592
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   593
\glossary{Hereditary Harrop Formula}{The set of propositions in HHF
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   594
format is defined inductively as \isa{H\ {\isacharequal}\ {\isacharparenleft}{\isasymAnd}x\isactrlsup {\isacharasterisk}{\isachardot}\ H\isactrlsup {\isacharasterisk}\ {\isasymLongrightarrow}\ A{\isacharparenright}}, for variables \isa{x} and atomic propositions \isa{A}.
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   595
Any proposition may be put into HHF form by normalizing with the rule
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   596
\isa{{\isacharparenleft}A\ {\isasymLongrightarrow}\ {\isacharparenleft}{\isasymAnd}x{\isachardot}\ B\ x{\isacharparenright}{\isacharparenright}\ {\isasymequiv}\ {\isacharparenleft}{\isasymAnd}x{\isachardot}\ A\ {\isasymLongrightarrow}\ B\ x{\isacharparenright}}.  In Isabelle, the outermost
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   597
quantifier prefix is represented via \seeglossary{schematic
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   598
variables}, such that the top-level structure is merely that of a
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   599
\seeglossary{Horn Clause}}.
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   600
20499
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   601
\glossary{HHF}{See \seeglossary{Hereditary Harrop Formula}.}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   602
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   603
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   604
  \[
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   605
  \infer[\isa{{\isacharparenleft}assumption{\isacharparenright}}]{\isa{C{\isasymvartheta}}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   606
  {\isa{{\isacharparenleft}{\isasymAnd}\isactrlvec x{\isachardot}\ \isactrlvec H\ \isactrlvec x\ {\isasymLongrightarrow}\ A\ \isactrlvec x{\isacharparenright}\ {\isasymLongrightarrow}\ C} & \isa{A{\isasymvartheta}\ {\isacharequal}\ H\isactrlsub i{\isasymvartheta}}~~\text{(for some~\isa{i})}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   607
  \]
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   608
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   609
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   610
  \[
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   611
  \infer[\isa{{\isacharparenleft}compose{\isacharparenright}}]{\isa{\isactrlvec A{\isasymvartheta}\ {\isasymLongrightarrow}\ C{\isasymvartheta}}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   612
  {\isa{\isactrlvec A\ {\isasymLongrightarrow}\ B} & \isa{B{\isacharprime}\ {\isasymLongrightarrow}\ C} & \isa{B{\isasymvartheta}\ {\isacharequal}\ B{\isacharprime}{\isasymvartheta}}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   613
  \]
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   614
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   615
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   616
  \[
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   617
  \infer[\isa{{\isacharparenleft}{\isasymAnd}{\isacharunderscore}lift{\isacharparenright}}]{\isa{{\isacharparenleft}{\isasymAnd}\isactrlvec x{\isachardot}\ \isactrlvec A\ {\isacharparenleft}{\isacharquery}\isactrlvec a\ \isactrlvec x{\isacharparenright}{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}{\isasymAnd}\isactrlvec x{\isachardot}\ B\ {\isacharparenleft}{\isacharquery}\isactrlvec a\ \isactrlvec x{\isacharparenright}{\isacharparenright}}}{\isa{\isactrlvec A\ {\isacharquery}\isactrlvec a\ {\isasymLongrightarrow}\ B\ {\isacharquery}\isactrlvec a}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   618
  \]
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   619
  \[
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   620
  \infer[\isa{{\isacharparenleft}{\isasymLongrightarrow}{\isacharunderscore}lift{\isacharparenright}}]{\isa{{\isacharparenleft}\isactrlvec H\ {\isasymLongrightarrow}\ \isactrlvec A{\isacharparenright}\ {\isasymLongrightarrow}\ {\isacharparenleft}\isactrlvec H\ {\isasymLongrightarrow}\ B{\isacharparenright}}}{\isa{\isactrlvec A\ {\isasymLongrightarrow}\ B}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   621
  \]
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   622
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   623
  The \isa{resolve} scheme is now acquired from \isa{{\isasymAnd}{\isacharunderscore}lift},
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   624
  \isa{{\isasymLongrightarrow}{\isacharunderscore}lift}, and \isa{compose}.
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   625
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   626
  \[
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   627
  \infer[\isa{{\isacharparenleft}resolution{\isacharparenright}}]
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   628
  {\isa{{\isacharparenleft}{\isasymAnd}\isactrlvec x{\isachardot}\ \isactrlvec H\ \isactrlvec x\ {\isasymLongrightarrow}\ \isactrlvec A\ {\isacharparenleft}{\isacharquery}\isactrlvec a\ \isactrlvec x{\isacharparenright}{\isacharparenright}{\isasymvartheta}\ {\isasymLongrightarrow}\ C{\isasymvartheta}}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   629
  {\begin{tabular}{l}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   630
    \isa{\isactrlvec A\ {\isacharquery}\isactrlvec a\ {\isasymLongrightarrow}\ B\ {\isacharquery}\isactrlvec a} \\
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   631
    \isa{{\isacharparenleft}{\isasymAnd}\isactrlvec x{\isachardot}\ \isactrlvec H\ \isactrlvec x\ {\isasymLongrightarrow}\ B{\isacharprime}\ \isactrlvec x{\isacharparenright}\ {\isasymLongrightarrow}\ C} \\
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   632
    \isa{{\isacharparenleft}{\isasymlambda}\isactrlvec x{\isachardot}\ B\ {\isacharparenleft}{\isacharquery}\isactrlvec a\ \isactrlvec x{\isacharparenright}{\isacharparenright}{\isasymvartheta}\ {\isacharequal}\ B{\isacharprime}{\isasymvartheta}} \\
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   633
   \end{tabular}}
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   634
  \]
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   635
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   636
18845f9dbd09 updated;
wenzelm
parents: 20494
diff changeset
   637
  FIXME \isa{elim{\isacharunderscore}resolution}, \isa{dest{\isacharunderscore}resolution}%
18537
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   638
\end{isamarkuptext}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   639
\isamarkuptrue%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   640
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   641
\isadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   642
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   643
\endisadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   644
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   645
\isatagtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   646
\isacommand{end}\isamarkupfalse%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   647
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   648
\endisatagtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   649
{\isafoldtheory}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   650
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   651
\isadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   652
%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   653
\endisadelimtheory
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   654
\isanewline
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   655
\end{isabellebody}%
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   656
%%% Local Variables:
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   657
%%% mode: latex
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   658
%%% TeX-master: "root"
2681f9e34390 "The Isabelle/Isar Implementation" manual;
wenzelm
parents:
diff changeset
   659
%%% End: