src/HOL/Library/Old_Recdef.thy
author wenzelm
Wed Mar 08 10:50:59 2017 +0100 (2017-03-08)
changeset 65151 a7394aa4d21c
parent 60523 be2d9f5ddc76
child 67091 1393c2340eec
permissions -rw-r--r--
tuned proofs;
     1 (*  Title:      HOL/Library/Old_Recdef.thy
     2     Author:     Konrad Slind and Markus Wenzel, TU Muenchen
     3 *)
     4 
     5 section \<open>TFL: recursive function definitions\<close>
     6 
     7 theory Old_Recdef
     8 imports Main
     9 keywords
    10   "recdef" :: thy_decl and
    11   "permissive" "congs" "hints"
    12 begin
    13 
    14 subsection \<open>Lemmas for TFL\<close>
    15 
    16 lemma tfl_wf_induct: "ALL R. wf R -->
    17        (ALL P. (ALL x. (ALL y. (y,x):R --> P y) --> P x) --> (ALL x. P x))"
    18 apply clarify
    19 apply (rule_tac r = R and P = P and a = x in wf_induct, assumption, blast)
    20 done
    21 
    22 lemma tfl_cut_def: "cut f r x \<equiv> (\<lambda>y. if (y,x) \<in> r then f y else undefined)"
    23   unfolding cut_def .
    24 
    25 lemma tfl_cut_apply: "ALL f R. (x,a):R --> (cut f R a)(x) = f(x)"
    26 apply clarify
    27 apply (rule cut_apply, assumption)
    28 done
    29 
    30 lemma tfl_wfrec:
    31      "ALL M R f. (f=wfrec R M) --> wf R --> (ALL x. f x = M (cut f R x) x)"
    32 apply clarify
    33 apply (erule wfrec)
    34 done
    35 
    36 lemma tfl_eq_True: "(x = True) --> x"
    37   by blast
    38 
    39 lemma tfl_rev_eq_mp: "(x = y) --> y --> x"
    40   by blast
    41 
    42 lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
    43   by blast
    44 
    45 lemma tfl_P_imp_P_iff_True: "P ==> P = True"
    46   by blast
    47 
    48 lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
    49   by blast
    50 
    51 lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
    52   by simp
    53 
    54 lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
    55   by blast
    56 
    57 lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
    58   by blast
    59 
    60 ML_file "old_recdef.ML"
    61 
    62 
    63 subsection \<open>Rule setup\<close>
    64 
    65 lemmas [recdef_simp] =
    66   inv_image_def
    67   measure_def
    68   lex_prod_def
    69   same_fst_def
    70   less_Suc_eq [THEN iffD2]
    71 
    72 lemmas [recdef_cong] =
    73   if_cong let_cong image_cong INF_cong SUP_cong bex_cong ball_cong imp_cong
    74   map_cong filter_cong takeWhile_cong dropWhile_cong foldl_cong foldr_cong
    75 
    76 lemmas [recdef_wf] =
    77   wf_trancl
    78   wf_less_than
    79   wf_lex_prod
    80   wf_inv_image
    81   wf_measure
    82   wf_measures
    83   wf_pred_nat
    84   wf_same_fst
    85   wf_empty
    86 
    87 end