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;
krauss@44013
     1
(*  Title:      HOL/Library/Old_Recdef.thy
wenzelm@10773
     2
    Author:     Konrad Slind and Markus Wenzel, TU Muenchen
wenzelm@12023
     3
*)
wenzelm@5123
     4
wenzelm@60500
     5
section \<open>TFL: recursive function definitions\<close>
wenzelm@7701
     6
krauss@44013
     7
theory Old_Recdef
blanchet@55017
     8
imports Main
wenzelm@46950
     9
keywords
wenzelm@69913
    10
  "recdef" :: thy_defn and
wenzelm@46950
    11
  "permissive" "congs" "hints"
nipkow@15131
    12
begin
wenzelm@10773
    13
wenzelm@60500
    14
subsection \<open>Lemmas for TFL\<close>
krauss@44013
    15
wenzelm@67091
    16
lemma tfl_wf_induct: "\<forall>R. wf R \<longrightarrow>
wenzelm@67091
    17
       (\<forall>P. (\<forall>x. (\<forall>y. (y,x)\<in>R \<longrightarrow> P y) \<longrightarrow> P x) \<longrightarrow> (\<forall>x. P x))"
krauss@26748
    18
apply clarify
krauss@26748
    19
apply (rule_tac r = R and P = P and a = x in wf_induct, assumption, blast)
krauss@26748
    20
done
krauss@26748
    21
hoelzl@58184
    22
lemma tfl_cut_def: "cut f r x \<equiv> (\<lambda>y. if (y,x) \<in> r then f y else undefined)"
hoelzl@58184
    23
  unfolding cut_def .
hoelzl@58184
    24
wenzelm@67091
    25
lemma tfl_cut_apply: "\<forall>f R. (x,a)\<in>R \<longrightarrow> (cut f R a)(x) = f(x)"
krauss@26748
    26
apply clarify
krauss@26748
    27
apply (rule cut_apply, assumption)
krauss@26748
    28
done
krauss@26748
    29
krauss@26748
    30
lemma tfl_wfrec:
wenzelm@67091
    31
     "\<forall>M R f. (f=wfrec R M) \<longrightarrow> wf R \<longrightarrow> (\<forall>x. f x = M (cut f R x) x)"
krauss@26748
    32
apply clarify
krauss@26748
    33
apply (erule wfrec)
krauss@26748
    34
done
krauss@26748
    35
wenzelm@67091
    36
lemma tfl_eq_True: "(x = True) \<longrightarrow> x"
wenzelm@10773
    37
  by blast
wenzelm@10773
    38
wenzelm@67091
    39
lemma tfl_rev_eq_mp: "(x = y) \<longrightarrow> y \<longrightarrow> x"
wenzelm@10773
    40
  by blast
wenzelm@10773
    41
wenzelm@67091
    42
lemma tfl_simp_thm: "(x \<longrightarrow> y) \<longrightarrow> (x = x') \<longrightarrow> (x' \<longrightarrow> y)"
wenzelm@10773
    43
  by blast
wenzelm@6438
    44
wenzelm@67091
    45
lemma tfl_P_imp_P_iff_True: "P \<Longrightarrow> P = True"
wenzelm@10773
    46
  by blast
wenzelm@10773
    47
wenzelm@67091
    48
lemma tfl_imp_trans: "(A \<longrightarrow> B) \<Longrightarrow> (B \<longrightarrow> C) \<Longrightarrow> (A \<longrightarrow> C)"
wenzelm@10773
    49
  by blast
wenzelm@10773
    50
wenzelm@67091
    51
lemma tfl_disj_assoc: "(a \<or> b) \<or> c \<equiv> a \<or> (b \<or> c)"
wenzelm@10773
    52
  by simp
wenzelm@10773
    53
wenzelm@67091
    54
lemma tfl_disjE: "P \<or> Q \<Longrightarrow> P \<longrightarrow> R \<Longrightarrow> Q \<longrightarrow> R \<Longrightarrow> R"
wenzelm@10773
    55
  by blast
wenzelm@10773
    56
wenzelm@67091
    57
lemma tfl_exE: "\<exists>x. P x \<Longrightarrow> \<forall>x. P x \<longrightarrow> Q \<Longrightarrow> Q"
wenzelm@10773
    58
  by blast
wenzelm@10773
    59
wenzelm@69605
    60
ML_file \<open>old_recdef.ML\<close>
wenzelm@58825
    61
wenzelm@6438
    62
wenzelm@60500
    63
subsection \<open>Rule setup\<close>
krauss@32244
    64
wenzelm@9855
    65
lemmas [recdef_simp] =
wenzelm@9855
    66
  inv_image_def
wenzelm@9855
    67
  measure_def
wenzelm@9855
    68
  lex_prod_def
nipkow@11284
    69
  same_fst_def
wenzelm@9855
    70
  less_Suc_eq [THEN iffD2]
wenzelm@9855
    71
wenzelm@23150
    72
lemmas [recdef_cong] =
haftmann@56248
    73
  if_cong let_cong image_cong INF_cong SUP_cong bex_cong ball_cong imp_cong
wenzelm@60520
    74
  map_cong filter_cong takeWhile_cong dropWhile_cong foldl_cong foldr_cong
wenzelm@9855
    75
wenzelm@9855
    76
lemmas [recdef_wf] =
wenzelm@9855
    77
  wf_trancl
wenzelm@9855
    78
  wf_less_than
wenzelm@9855
    79
  wf_lex_prod
wenzelm@9855
    80
  wf_inv_image
wenzelm@9855
    81
  wf_measure
krauss@44013
    82
  wf_measures
wenzelm@9855
    83
  wf_pred_nat
nipkow@10653
    84
  wf_same_fst
wenzelm@9855
    85
  wf_empty
wenzelm@9855
    86
wenzelm@6438
    87
end