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