CookBook/Package/simple_inductive_package.ML
author Christian Urban <urbanc@in.tum.de>
Sat, 07 Feb 2009 12:05:02 +0000
changeset 102 5e309df58557
parent 91 667a0943c40b
child 110 12533bb49615
permissions -rw-r--r--
general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     1
(* @chunk SIMPLE_INDUCTIVE_PACKAGE *)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     2
signature SIMPLE_INDUCTIVE_PACKAGE =
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     3
sig
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     4
  val add_inductive_i:
76
b99fa5fa63fc adapted to changes in binding.ML
Christian Urban <urbanc@in.tum.de>
parents: 55
diff changeset
     5
    ((Binding.binding * typ) * mixfix) list ->  (*{predicates}*)
b99fa5fa63fc adapted to changes in binding.ML
Christian Urban <urbanc@in.tum.de>
parents: 55
diff changeset
     6
    (Binding.binding * typ) list ->  (*{parameters}*)
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     7
    (Attrib.binding * term) list ->  (*{rules}*)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     8
    local_theory -> (thm list * thm list) * local_theory
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
     9
  val add_inductive:
76
b99fa5fa63fc adapted to changes in binding.ML
Christian Urban <urbanc@in.tum.de>
parents: 55
diff changeset
    10
    (Binding.binding * string option * mixfix) list ->  (*{predicates}*)
b99fa5fa63fc adapted to changes in binding.ML
Christian Urban <urbanc@in.tum.de>
parents: 55
diff changeset
    11
    (Binding.binding * string option * mixfix) list ->  (*{parameters}*)
102
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    12
    (Attrib.binding * string list) list list ->  (*{rules}*)
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    13
    local_theory -> local_theory
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    14
end;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    15
(* @end *)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    16
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    17
structure SimpleInductivePackage: SIMPLE_INDUCTIVE_PACKAGE =
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    18
struct
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    19
102
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    20
fun mk_all x P = HOLogic.all_const (fastype_of x) $ lambda x P 
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    21
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    22
fun inst_spec ct = Drule.instantiate'
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    23
      [SOME (ctyp_of_term ct)] [NONE, SOME ct] @{thm spec};
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    24
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    25
val all_elims = fold (fn ct => fn th => th RS inst_spec ct);
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    26
val imp_elims = fold (fn th => fn th' => [th', th] MRS @{thm mp});
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
    27
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    28
fun add_inductive_i preds_syn params intrs lthy =
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    29
  let
55
0b55402ae95e Adapted to changes in binding module.
berghofe
parents: 32
diff changeset
    30
    val params' = map (fn (p, T) => Free (Binding.base_name p, T)) params;
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    31
    val preds = map (fn ((R, T), _) =>
55
0b55402ae95e Adapted to changes in binding module.
berghofe
parents: 32
diff changeset
    32
      list_comb (Free (Binding.base_name R, T), params')) preds_syn;
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    33
    val Tss = map (binder_types o fastype_of) preds;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    34
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    35
    (* making the definition *)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    36
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    37
    val intrs' = map
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    38
      (ObjectLogic.atomize_term (ProofContext.theory_of lthy) o snd) intrs;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    39
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    40
    val (defs, lthy1) = fold_map (fn ((((R, _), syn), pred), Ts) =>
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    41
      let val zs = map Free (Variable.variant_frees lthy intrs'
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    42
        (map (pair "z") Ts))
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    43
      in
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    44
        LocalTheory.define Thm.internalK
55
0b55402ae95e Adapted to changes in binding module.
berghofe
parents: 32
diff changeset
    45
          ((R, syn), (Attrib.empty_binding, fold_rev lambda (params' @ zs)
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    46
            (fold_rev mk_all preds (fold_rev (curry HOLogic.mk_imp)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    47
               intrs' (list_comb (pred, zs)))))) #>> snd #>> snd
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    48
       end) (preds_syn ~~ preds ~~ Tss) lthy;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    49
55
0b55402ae95e Adapted to changes in binding module.
berghofe
parents: 32
diff changeset
    50
    val (_, lthy2) = Variable.add_fixes (map (Binding.base_name o fst) params) lthy1;
91
667a0943c40b added a section that will eventually describe the code
Christian Urban <urbanc@in.tum.de>
parents: 76
diff changeset
    51
 
667a0943c40b added a section that will eventually describe the code
Christian Urban <urbanc@in.tum.de>
parents: 76
diff changeset
    52
     
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    53
    (* proving the induction rules *)
91
667a0943c40b added a section that will eventually describe the code
Christian Urban <urbanc@in.tum.de>
parents: 76
diff changeset
    54
    (* @chunk induction_rules *)
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    55
    val (Pnames, lthy3) =
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    56
      Variable.variant_fixes (replicate (length preds) "P") lthy2;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    57
    val Ps = map (fn (s, Ts) => Free (s, Ts ---> HOLogic.boolT))
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    58
      (Pnames ~~ Tss);
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    59
    val cPs = map (cterm_of (ProofContext.theory_of lthy3)) Ps;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    60
    val intrs'' = map (subst_free (preds ~~ Ps) o snd) intrs;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    61
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    62
    fun prove_indrule ((R, P), Ts) =
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    63
      let
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    64
        val (znames, lthy4) =
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    65
          Variable.variant_fixes (replicate (length Ts) "z") lthy3;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    66
        val zs = map Free (znames ~~ Ts)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    67
      in
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    68
        Goal.prove lthy4 []
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    69
          [HOLogic.mk_Trueprop (list_comb (R, zs))]
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    70
          (Logic.list_implies (intrs'',
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    71
             HOLogic.mk_Trueprop (list_comb (P, zs))))
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    72
          (fn {prems, ...} => EVERY
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    73
             ([ObjectLogic.full_atomize_tac 1,
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    74
               cut_facts_tac prems 1,
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    75
               rewrite_goals_tac defs] @
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    76
              map (fn ct => dtac (inst_spec ct) 1) cPs @
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    77
              [assume_tac 1])) |>
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    78
        singleton (ProofContext.export lthy4 lthy1)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    79
      end;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    80
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    81
    val indrules = map prove_indrule (preds ~~ Ps ~~ Tss);
91
667a0943c40b added a section that will eventually describe the code
Christian Urban <urbanc@in.tum.de>
parents: 76
diff changeset
    82
    (* @end *)
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    83
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    84
    (* proving the introduction rules *)
91
667a0943c40b added a section that will eventually describe the code
Christian Urban <urbanc@in.tum.de>
parents: 76
diff changeset
    85
    (* @chunk intro_rules *) 
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    86
    fun prove_intr (i, (_, r)) =
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    87
      Goal.prove lthy2 [] [] r
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    88
        (fn {prems, context = ctxt} => EVERY
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    89
           [ObjectLogic.rulify_tac 1,
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    90
            rewrite_goals_tac defs,
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    91
            REPEAT (resolve_tac [allI, impI] 1),
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    92
            SUBPROOF (fn {params, prems, context = ctxt', ...} =>
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    93
              let
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    94
                val (prems1, prems2) =
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    95
                  chop (length prems - length intrs) prems;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    96
                val (params1, params2) =
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    97
                  chop (length params - length preds) params
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    98
              in
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
    99
                rtac (ObjectLogic.rulify
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   100
                  (all_elims params1 (nth prems2 i))) 1 THEN
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   101
                EVERY (map (fn prem =>
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   102
                  SUBPROOF (fn {prems = prems', concl, ...} =>
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   103
                    let
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   104
                      val prem' = prems' MRS prem;
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   105
                      val prem'' = case prop_of prem' of
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   106
                          _ $ (Const (@{const_name All}, _) $ _) =>
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   107
                            prem' |> all_elims params2 |>
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   108
                            imp_elims prems2
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   109
                        | _ => prem'
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   110
                    in rtac prem'' 1 end) ctxt' 1) prems1)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   111
              end) ctxt 1]) |>
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   112
      singleton (ProofContext.export lthy2 lthy1);
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   113
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   114
    val intr_ths = map_index prove_intr intrs;
91
667a0943c40b added a section that will eventually describe the code
Christian Urban <urbanc@in.tum.de>
parents: 76
diff changeset
   115
    (* @end *)
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   116
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   117
    (* storing the theorems *)
91
667a0943c40b added a section that will eventually describe the code
Christian Urban <urbanc@in.tum.de>
parents: 76
diff changeset
   118
    (* @chunk storing *)
55
0b55402ae95e Adapted to changes in binding module.
berghofe
parents: 32
diff changeset
   119
    val mut_name = space_implode "_" (map (Binding.base_name o fst o fst) preds_syn);
0b55402ae95e Adapted to changes in binding module.
berghofe
parents: 32
diff changeset
   120
    val case_names = map (Binding.base_name o fst o fst) intrs
91
667a0943c40b added a section that will eventually describe the code
Christian Urban <urbanc@in.tum.de>
parents: 76
diff changeset
   121
    (* @end *)
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   122
  in
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   123
    lthy1 |>
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   124
    LocalTheory.notes Thm.theoremK (map (fn (((a, atts), _), th) =>
55
0b55402ae95e Adapted to changes in binding module.
berghofe
parents: 32
diff changeset
   125
      ((Binding.qualify mut_name a, atts), [([th], [])]))
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   126
        (intrs ~~ intr_ths)) |->
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   127
    (fn intr_thss => LocalTheory.note Thm.theoremK
55
0b55402ae95e Adapted to changes in binding module.
berghofe
parents: 32
diff changeset
   128
       ((Binding.qualify mut_name (Binding.name "intros"), []), maps snd intr_thss)) |>>
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   129
    snd ||>>
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   130
    (LocalTheory.notes Thm.theoremK (map (fn (((R, _), _), th) =>
55
0b55402ae95e Adapted to changes in binding module.
berghofe
parents: 32
diff changeset
   131
       ((Binding.qualify (Binding.base_name R) (Binding.name "induct"),
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   132
         [Attrib.internal (K (RuleCases.case_names case_names)),
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   133
          Attrib.internal (K (RuleCases.consumes 1)),
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   134
          Attrib.internal (K (Induct.induct_pred ""))]), [([th], [])]))
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   135
         (preds_syn ~~ indrules)) #>> maps snd)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   136
  end;
91
667a0943c40b added a section that will eventually describe the code
Christian Urban <urbanc@in.tum.de>
parents: 76
diff changeset
   137
   
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   138
(* @chunk add_inductive *)
102
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   139
fun add_inductive preds params specs lthy =
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   140
 let
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   141
    val ((vars, specs'), _) = Specification.read_specification (preds @ params) specs lthy;
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   142
    val (preds', params') = chop (length preds) vars;
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   143
    val specs'' = map (apsnd the_single) specs'
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   144
    val params'' = map fst params'
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   145
 in
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   146
    snd (add_inductive_i preds' params'' specs'' lthy) 
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   147
 end;
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   148
(* @end *)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   149
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   150
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   151
(* outer syntax *)
102
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   152
(* @chunk syntax *)
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   153
val parser = 
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   154
   OuterParse.opt_target --
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   155
   OuterParse.fixes -- 
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   156
   OuterParse.for_fixes --
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   157
   Scan.optional 
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   158
       (OuterParse.$$$ "where" |--
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   159
          OuterParse.!!! 
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   160
            (OuterParse.enum1 "|" 
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   161
               ((SpecParse.opt_thm_name ":" -- 
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   162
                   (OuterParse.prop >> single)) >> single))) []
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   163
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   164
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   165
val ind_decl =
102
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   166
    parser >>
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   167
    (fn (((loc, preds), params), specs) =>
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   168
      Toplevel.local_theory loc (add_inductive preds params specs));
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   169
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   170
val _ = OuterSyntax.command "simple_inductive" "define inductive predicates"
102
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 91
diff changeset
   171
  OuterKeyword.thy_decl ind_decl;
32
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   172
(* @end *)
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   173
5bb2d29553c2 Added new chapter about writing packages.
berghofe
parents:
diff changeset
   174
end;