src/HOL/Library/Old_Recdef.thy
author hoelzl
Thu Sep 04 14:02:37 2014 +0200 (2014-09-04)
changeset 58184 db1381d811ab
parent 56248 67dc9549fa15
child 58825 2065f49da190
permissions -rw-r--r--
cleanup Wfrec; introduce dependent_wf/wellorder_choice
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@12023
     5
header {* TFL: recursive function definitions *}
wenzelm@7701
     6
krauss@44013
     7
theory Old_Recdef
blanchet@55017
     8
imports Main
wenzelm@46950
     9
keywords
wenzelm@46950
    10
  "recdef" "defer_recdef" :: thy_decl and
wenzelm@46950
    11
  "recdef_tc" :: thy_goal and
wenzelm@46950
    12
  "permissive" "congs" "hints"
nipkow@15131
    13
begin
wenzelm@10773
    14
krauss@44013
    15
subsection {* Lemmas for TFL *}
krauss@44013
    16
krauss@26748
    17
lemma tfl_wf_induct: "ALL R. wf R -->  
krauss@26748
    18
       (ALL P. (ALL x. (ALL y. (y,x):R --> P y) --> P x) --> (ALL x. P x))"
krauss@26748
    19
apply clarify
krauss@26748
    20
apply (rule_tac r = R and P = P and a = x in wf_induct, assumption, blast)
krauss@26748
    21
done
krauss@26748
    22
hoelzl@58184
    23
lemma tfl_cut_def: "cut f r x \<equiv> (\<lambda>y. if (y,x) \<in> r then f y else undefined)"
hoelzl@58184
    24
  unfolding cut_def .
hoelzl@58184
    25
krauss@26748
    26
lemma tfl_cut_apply: "ALL f R. (x,a):R --> (cut f R a)(x) = f(x)"
krauss@26748
    27
apply clarify
krauss@26748
    28
apply (rule cut_apply, assumption)
krauss@26748
    29
done
krauss@26748
    30
krauss@26748
    31
lemma tfl_wfrec:
krauss@26748
    32
     "ALL M R f. (f=wfrec R M) --> wf R --> (ALL x. f x = M (cut f R x) x)"
krauss@26748
    33
apply clarify
krauss@26748
    34
apply (erule wfrec)
krauss@26748
    35
done
krauss@26748
    36
wenzelm@10773
    37
lemma tfl_eq_True: "(x = True) --> x"
wenzelm@10773
    38
  by blast
wenzelm@10773
    39
wenzelm@46947
    40
lemma tfl_rev_eq_mp: "(x = y) --> y --> x"
wenzelm@10773
    41
  by blast
wenzelm@10773
    42
wenzelm@10773
    43
lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
wenzelm@10773
    44
  by blast
wenzelm@6438
    45
wenzelm@10773
    46
lemma tfl_P_imp_P_iff_True: "P ==> P = True"
wenzelm@10773
    47
  by blast
wenzelm@10773
    48
wenzelm@10773
    49
lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
wenzelm@10773
    50
  by blast
wenzelm@10773
    51
wenzelm@12023
    52
lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
wenzelm@10773
    53
  by simp
wenzelm@10773
    54
wenzelm@12023
    55
lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
wenzelm@10773
    56
  by blast
wenzelm@10773
    57
wenzelm@12023
    58
lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
wenzelm@10773
    59
  by blast
wenzelm@10773
    60
wenzelm@48891
    61
ML_file "~~/src/HOL/Tools/TFL/casesplit.ML"
wenzelm@48891
    62
ML_file "~~/src/HOL/Tools/TFL/utils.ML"
wenzelm@48891
    63
ML_file "~~/src/HOL/Tools/TFL/usyntax.ML"
wenzelm@48891
    64
ML_file "~~/src/HOL/Tools/TFL/dcterm.ML"
wenzelm@48891
    65
ML_file "~~/src/HOL/Tools/TFL/thms.ML"
wenzelm@48891
    66
ML_file "~~/src/HOL/Tools/TFL/rules.ML"
wenzelm@48891
    67
ML_file "~~/src/HOL/Tools/TFL/thry.ML"
wenzelm@48891
    68
ML_file "~~/src/HOL/Tools/TFL/tfl.ML"
wenzelm@48891
    69
ML_file "~~/src/HOL/Tools/TFL/post.ML"
wenzelm@48891
    70
ML_file "~~/src/HOL/Tools/recdef.ML"
haftmann@31723
    71
setup Recdef.setup
wenzelm@6438
    72
krauss@44014
    73
subsection {* Rule setup *}
krauss@32244
    74
wenzelm@9855
    75
lemmas [recdef_simp] =
wenzelm@9855
    76
  inv_image_def
wenzelm@9855
    77
  measure_def
wenzelm@9855
    78
  lex_prod_def
nipkow@11284
    79
  same_fst_def
wenzelm@9855
    80
  less_Suc_eq [THEN iffD2]
wenzelm@9855
    81
wenzelm@23150
    82
lemmas [recdef_cong] =
haftmann@56248
    83
  if_cong let_cong image_cong INF_cong SUP_cong bex_cong ball_cong imp_cong
krauss@44013
    84
  map_cong filter_cong takeWhile_cong dropWhile_cong foldl_cong foldr_cong 
wenzelm@9855
    85
wenzelm@9855
    86
lemmas [recdef_wf] =
wenzelm@9855
    87
  wf_trancl
wenzelm@9855
    88
  wf_less_than
wenzelm@9855
    89
  wf_lex_prod
wenzelm@9855
    90
  wf_inv_image
wenzelm@9855
    91
  wf_measure
krauss@44013
    92
  wf_measures
wenzelm@9855
    93
  wf_pred_nat
nipkow@10653
    94
  wf_same_fst
wenzelm@9855
    95
  wf_empty
wenzelm@9855
    96
wenzelm@6438
    97
end