src/HOL/Recdef.thy
author krauss
Fri May 05 17:17:21 2006 +0200 (2006-05-05)
changeset 19564 d3e2f532459a
parent 18336 1a2e30b37ed3
child 19770 be5c23ebe1eb
permissions -rw-r--r--
First usable version of the new function definition package (HOL/function_packake/...).
Moved Accessible_Part.thy from Library to Main.
     1 (*  Title:      HOL/Recdef.thy
     2     ID:         $Id$
     3     Author:     Konrad Slind and Markus Wenzel, TU Muenchen
     4 *)
     5 
     6 header {* TFL: recursive function definitions *}
     7 
     8 theory Recdef
     9 imports Wellfounded_Relations Datatype
    10 uses
    11   ("../TFL/casesplit.ML")
    12   ("../TFL/utils.ML")
    13   ("../TFL/usyntax.ML")
    14   ("../TFL/dcterm.ML")
    15   ("../TFL/thms.ML")
    16   ("../TFL/rules.ML")
    17   ("../TFL/thry.ML")
    18   ("../TFL/tfl.ML")
    19   ("../TFL/post.ML")
    20   ("Tools/recdef_package.ML")
    21   ("Tools/function_package/auto_term.ML")
    22 begin
    23 
    24 lemma tfl_eq_True: "(x = True) --> x"
    25   by blast
    26 
    27 lemma tfl_rev_eq_mp: "(x = y) --> y --> x";
    28   by blast
    29 
    30 lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
    31   by blast
    32 
    33 lemma tfl_P_imp_P_iff_True: "P ==> P = True"
    34   by blast
    35 
    36 lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
    37   by blast
    38 
    39 lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
    40   by simp
    41 
    42 lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
    43   by blast
    44 
    45 lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
    46   by blast
    47 
    48 use "../TFL/casesplit.ML"
    49 use "../TFL/utils.ML"
    50 use "../TFL/usyntax.ML"
    51 use "../TFL/dcterm.ML"
    52 use "../TFL/thms.ML"
    53 use "../TFL/rules.ML"
    54 use "../TFL/thry.ML"
    55 use "../TFL/tfl.ML"
    56 use "../TFL/post.ML"
    57 use "Tools/recdef_package.ML"
    58 setup RecdefPackage.setup
    59 
    60 lemmas [recdef_simp] =
    61   inv_image_def
    62   measure_def
    63   lex_prod_def
    64   same_fst_def
    65   less_Suc_eq [THEN iffD2]
    66 
    67 lemmas [recdef_cong] = 
    68   if_cong image_cong INT_cong UN_cong bex_cong ball_cong imp_cong
    69 
    70 lemma let_cong [recdef_cong]:
    71     "M = N ==> (!!x. x = N ==> f x = g x) ==> Let M f = Let N g"
    72   by (unfold Let_def) blast
    73 
    74 lemmas [recdef_wf] =
    75   wf_trancl
    76   wf_less_than
    77   wf_lex_prod
    78   wf_inv_image
    79   wf_measure
    80   wf_pred_nat
    81   wf_same_fst
    82   wf_empty
    83 
    84 (* The following should really go into Datatype or Finite_Set, but
    85 each one lacks the other theory as a parent . . . *)
    86 
    87 lemma insert_None_conv_UNIV: "insert None (range Some) = UNIV"
    88 by (rule set_ext, case_tac x, auto)
    89 
    90 instance option :: (finite) finite
    91 proof
    92   have "finite (UNIV :: 'a set)" by (rule finite)
    93   hence "finite (insert None (Some ` (UNIV :: 'a set)))" by simp
    94   also have "insert None (Some ` (UNIV :: 'a set)) = UNIV"
    95     by (rule insert_None_conv_UNIV)
    96   finally show "finite (UNIV :: 'a option set)" .
    97 qed
    98 
    99 
   100 use "Tools/function_package/auto_term.ML"
   101 setup FundefAutoTerm.setup
   102 
   103 end