src/HOL/Library/Old_Recdef.thy
author haftmann
Mon Jun 05 15:59:41 2017 +0200 (2017-06-05)
changeset 66010 2f7d39285a1a
parent 60523 be2d9f5ddc76
child 67091 1393c2340eec
permissions -rw-r--r--
executable domain membership checks
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@60523
    10
  "recdef" :: thy_decl 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@60520
    16
lemma tfl_wf_induct: "ALL R. wf R -->
krauss@26748
    17
       (ALL P. (ALL x. (ALL y. (y,x):R --> P y) --> P x) --> (ALL 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
krauss@26748
    25
lemma tfl_cut_apply: "ALL f R. (x,a):R --> (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:
krauss@26748
    31
     "ALL M R f. (f=wfrec R M) --> wf R --> (ALL 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@10773
    36
lemma tfl_eq_True: "(x = True) --> x"
wenzelm@10773
    37
  by blast
wenzelm@10773
    38
wenzelm@46947
    39
lemma tfl_rev_eq_mp: "(x = y) --> y --> x"
wenzelm@10773
    40
  by blast
wenzelm@10773
    41
wenzelm@10773
    42
lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
wenzelm@10773
    43
  by blast
wenzelm@6438
    44
wenzelm@10773
    45
lemma tfl_P_imp_P_iff_True: "P ==> P = True"
wenzelm@10773
    46
  by blast
wenzelm@10773
    47
wenzelm@10773
    48
lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
wenzelm@10773
    49
  by blast
wenzelm@10773
    50
wenzelm@12023
    51
lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
wenzelm@10773
    52
  by simp
wenzelm@10773
    53
wenzelm@12023
    54
lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
wenzelm@10773
    55
  by blast
wenzelm@10773
    56
wenzelm@12023
    57
lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
wenzelm@10773
    58
  by blast
wenzelm@10773
    59
wenzelm@60520
    60
ML_file "old_recdef.ML"
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