src/HOL/Library/Old_Recdef.thy
 author wenzelm Thu Mar 14 16:55:06 2019 +0100 (5 weeks ago) changeset 69913 ca515cf61651 parent 69605 a96320074298 permissions -rw-r--r--
more specific keyword kinds;
```     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_defn and
```
```    11   "permissive" "congs" "hints"
```
```    12 begin
```
```    13
```
```    14 subsection \<open>Lemmas for TFL\<close>
```
```    15
```
```    16 lemma tfl_wf_induct: "\<forall>R. wf R \<longrightarrow>
```
```    17        (\<forall>P. (\<forall>x. (\<forall>y. (y,x)\<in>R \<longrightarrow> P y) \<longrightarrow> P x) \<longrightarrow> (\<forall>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: "\<forall>f R. (x,a)\<in>R \<longrightarrow> (cut f R a)(x) = f(x)"
```
```    26 apply clarify
```
```    27 apply (rule cut_apply, assumption)
```
```    28 done
```
```    29
```
```    30 lemma tfl_wfrec:
```
```    31      "\<forall>M R f. (f=wfrec R M) \<longrightarrow> wf R \<longrightarrow> (\<forall>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) \<longrightarrow> x"
```
```    37   by blast
```
```    38
```
```    39 lemma tfl_rev_eq_mp: "(x = y) \<longrightarrow> y \<longrightarrow> x"
```
```    40   by blast
```
```    41
```
```    42 lemma tfl_simp_thm: "(x \<longrightarrow> y) \<longrightarrow> (x = x') \<longrightarrow> (x' \<longrightarrow> y)"
```
```    43   by blast
```
```    44
```
```    45 lemma tfl_P_imp_P_iff_True: "P \<Longrightarrow> P = True"
```
```    46   by blast
```
```    47
```
```    48 lemma tfl_imp_trans: "(A \<longrightarrow> B) \<Longrightarrow> (B \<longrightarrow> C) \<Longrightarrow> (A \<longrightarrow> C)"
```
```    49   by blast
```
```    50
```
```    51 lemma tfl_disj_assoc: "(a \<or> b) \<or> c \<equiv> a \<or> (b \<or> c)"
```
```    52   by simp
```
```    53
```
```    54 lemma tfl_disjE: "P \<or> Q \<Longrightarrow> P \<longrightarrow> R \<Longrightarrow> Q \<longrightarrow> R \<Longrightarrow> R"
```
```    55   by blast
```
```    56
```
```    57 lemma tfl_exE: "\<exists>x. P x \<Longrightarrow> \<forall>x. P x \<longrightarrow> Q \<Longrightarrow> Q"
```
```    58   by blast
```
```    59
```
```    60 ML_file \<open>old_recdef.ML\<close>
```
```    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
```