src/HOL/Recdef.thy
author berghofe
Wed Feb 07 17:30:53 2007 +0100 (2007-02-07)
changeset 22264 6a65e9b2ae05
parent 19770 be5c23ebe1eb
child 22399 80395c2c40cc
permissions -rw-r--r--
Theorems for converting between wf and wfP are now declared
as hints.
     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
    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 begin
    22 
    23 lemma tfl_eq_True: "(x = True) --> x"
    24   by blast
    25 
    26 lemma tfl_rev_eq_mp: "(x = y) --> y --> x";
    27   by blast
    28 
    29 lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
    30   by blast
    31 
    32 lemma tfl_P_imp_P_iff_True: "P ==> P = True"
    33   by blast
    34 
    35 lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
    36   by blast
    37 
    38 lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
    39   by simp
    40 
    41 lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
    42   by blast
    43 
    44 lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
    45   by blast
    46 
    47 use "../TFL/casesplit.ML"
    48 use "../TFL/utils.ML"
    49 use "../TFL/usyntax.ML"
    50 use "../TFL/dcterm.ML"
    51 use "../TFL/thms.ML"
    52 use "../TFL/rules.ML"
    53 use "../TFL/thry.ML"
    54 use "../TFL/tfl.ML"
    55 use "../TFL/post.ML"
    56 use "Tools/recdef_package.ML"
    57 setup RecdefPackage.setup
    58 
    59 lemmas [recdef_simp] =
    60   inv_image_def
    61   measure_def
    62   lex_prod_def
    63   same_fst_def
    64   less_Suc_eq [THEN iffD2]
    65 
    66 lemmas [recdef_cong] = 
    67   if_cong image_cong INT_cong UN_cong bex_cong ball_cong imp_cong
    68 
    69 lemma let_cong [recdef_cong]:
    70     "M = N ==> (!!x. x = N ==> f x = g x) ==> Let M f = Let N g"
    71   by (unfold Let_def) blast
    72 
    73 lemmas [recdef_wf] =
    74   wf_trancl
    75   wf_less_than
    76   wf_lex_prod
    77   wf_inv_image
    78   wf_measure
    79   wf_pred_nat
    80   wf_same_fst
    81   wf_empty
    82   wf_implies_wfP
    83   wfP_implies_wf
    84 
    85 (* The following should really go into Datatype or Finite_Set, but
    86 each one lacks the other theory as a parent . . . *)
    87 
    88 lemma insert_None_conv_UNIV: "insert None (range Some) = UNIV"
    89 by (rule set_ext, case_tac x, auto)
    90 
    91 instance option :: (finite) finite
    92 proof
    93   have "finite (UNIV :: 'a set)" by (rule finite)
    94   hence "finite (insert None (Some ` (UNIV :: 'a set)))" by simp
    95   also have "insert None (Some ` (UNIV :: 'a set)) = UNIV"
    96     by (rule insert_None_conv_UNIV)
    97   finally show "finite (UNIV :: 'a option set)" .
    98 qed
    99 
   100 
   101 end