src/HOL/Main.thy
author paulson
Fri Aug 20 12:21:03 2004 +0200 (2004-08-20)
changeset 15151 429666b09783
parent 15140 322485b816ac
child 15382 e56ce5cefe9c
permissions -rw-r--r--
proof reconstruction for external ATPs
     1 (*  Title:      HOL/Main.thy
     2     ID:         $Id$
     3     Author:     Stefan Berghofer, Tobias Nipkow, Tjark Weber, Markus Wenzel (TU Muenchen)
     4 *)
     5 
     6 header {* Main HOL *}
     7 
     8 theory Main
     9     imports Map Infinite_Set Extraction Refute Reconstruction
    10 
    11 begin
    12 
    13 text {*
    14   Theory @{text Main} includes everything.  Note that theory @{text
    15   PreList} already includes most HOL theories.
    16 *}
    17 
    18 subsection {* Configuration of the code generator *}
    19 
    20 types_code
    21   "bool"  ("bool")
    22   "*"     ("(_ */ _)")
    23 
    24 consts_code
    25   "True"    ("true")
    26   "False"   ("false")
    27   "Not"     ("not")
    28   "op |"    ("(_ orelse/ _)")
    29   "op &"    ("(_ andalso/ _)")
    30   "If"      ("(if _/ then _/ else _)")
    31 
    32   "Pair"    ("(_,/ _)")
    33   "fst"     ("fst")
    34   "snd"     ("snd")
    35 
    36   "wfrec"   ("wf'_rec?")
    37 
    38 quickcheck_params [default_type = int]
    39 
    40 ML {*
    41 fun wf_rec f x = f (wf_rec f) x;
    42 
    43 fun term_of_bool b = if b then HOLogic.true_const else HOLogic.false_const;
    44 val term_of_int = HOLogic.mk_int;
    45 fun term_of_id_42 f T g U (x, y) = HOLogic.pair_const T U $ f x $ g y;
    46 fun term_of_fun_type _ T _ U _ = Free ("<function>", T --> U);
    47 
    48 val eq_codegen_setup = [Codegen.add_codegen "eq_codegen"
    49   (fn thy => fn gr => fn dep => fn b => fn t =>
    50     (case strip_comb t of
    51        (Const ("op =", Type (_, [Type ("fun", _), _])), _) => None
    52      | (Const ("op =", _), [t, u]) =>
    53           let
    54             val (gr', pt) = Codegen.invoke_codegen thy dep false (gr, t);
    55             val (gr'', pu) = Codegen.invoke_codegen thy dep false (gr', u)
    56           in
    57             Some (gr'', Codegen.parens
    58               (Pretty.block [pt, Pretty.str " =", Pretty.brk 1, pu]))
    59           end
    60      | (t as Const ("op =", _), ts) => Some (Codegen.invoke_codegen
    61          thy dep b (gr, Codegen.eta_expand t ts 2))
    62      | _ => None))];
    63 
    64 fun gen_bool i = one_of [false, true];
    65 
    66 fun gen_int i = one_of [~1, 1] * random_range 0 i;
    67 
    68 fun gen_id_42 aG bG i = (aG i, bG i);
    69 
    70 fun gen_fun_type _ G i =
    71   let
    72     val f = ref (fn x => raise ERROR);
    73     val _ = (f := (fn x =>
    74       let
    75         val y = G i;
    76         val f' = !f
    77       in (f := (fn x' => if x = x' then y else f' x'); y) end))
    78   in (fn x => !f x) end;
    79 *}
    80 
    81 setup eq_codegen_setup
    82 
    83 lemma [code]: "((n::nat) < 0) = False" by simp
    84 lemma [code]: "(0 < Suc n) = True" by simp
    85 lemmas [code] = Suc_less_eq imp_conv_disj
    86 
    87 subsection {* Configuration of the 'refute' command *}
    88 
    89 text {*
    90   The following are fairly reasonable default values.  For an
    91   explanation of these parameters, see 'HOL/Refute.thy'.
    92 *}
    93 
    94 refute_params [minsize=1,
    95                maxsize=8,
    96                maxvars=10000,
    97                maxtime=60,
    98                satsolver="auto"]
    99 
   100 end