
krauss@44013: (*  Title:      HOL/Library/Old_Recdef.thy
wenzelm@10773:     Author:     Konrad Slind and Markus Wenzel, TU Muenchen
wenzelm@12023: *)
wenzelm@5123: 
wenzelm@12023: header {* TFL: recursive function definitions *}
wenzelm@7701: 
krauss@44013: theory Old_Recdef
blanchet@55017: imports Main
wenzelm@46950: keywords
wenzelm@46950:   "recdef" "defer_recdef" :: thy_decl and
wenzelm@46950:   "recdef_tc" :: thy_goal and
wenzelm@46950:   "permissive" "congs" "hints"
nipkow@15131: begin
wenzelm@10773: 
krauss@44013: subsection {* Lemmas for TFL *}
krauss@44013: 
krauss@26748: lemma tfl_wf_induct: "ALL R. wf R -->  
krauss@26748:        (ALL P. (ALL x. (ALL y. (y,x):R --> P y) --> P x) --> (ALL x. P x))"
krauss@26748: apply clarify
krauss@26748: apply (rule_tac r = R and P = P and a = x in wf_induct, assumption, blast)
krauss@26748: done
krauss@26748: 
hoelzl@58184: lemma tfl_cut_def: "cut f r x \<equiv> (\<lambda>y. if (y,x) \<in> r then f y else undefined)"
hoelzl@58184:   unfolding cut_def .
hoelzl@58184: 
krauss@26748: lemma tfl_cut_apply: "ALL f R. (x,a):R --> (cut f R a)(x) = f(x)"
krauss@26748: apply clarify
krauss@26748: apply (rule cut_apply, assumption)
krauss@26748: done
krauss@26748: 
krauss@26748: lemma tfl_wfrec:
krauss@26748:      "ALL M R f. (f=wfrec R M) --> wf R --> (ALL x. f x = M (cut f R x) x)"
krauss@26748: apply clarify
krauss@26748: apply (erule wfrec)
krauss@26748: done
krauss@26748: 
wenzelm@10773: lemma tfl_eq_True: "(x = True) --> x"
wenzelm@10773:   by blast
wenzelm@10773: 
wenzelm@46947: lemma tfl_rev_eq_mp: "(x = y) --> y --> x"
wenzelm@10773:   by blast
wenzelm@10773: 
wenzelm@10773: lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
wenzelm@10773:   by blast
wenzelm@6438: 
wenzelm@10773: lemma tfl_P_imp_P_iff_True: "P ==> P = True"
wenzelm@10773:   by blast
wenzelm@10773: 
wenzelm@10773: lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
wenzelm@10773:   by blast
wenzelm@10773: 
wenzelm@12023: lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
wenzelm@10773:   by simp
wenzelm@10773: 
wenzelm@12023: lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
wenzelm@10773:   by blast
wenzelm@10773: 
wenzelm@12023: lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
wenzelm@10773:   by blast
wenzelm@10773: 
wenzelm@48891: ML_file "~~/src/HOL/Tools/TFL/casesplit.ML"
wenzelm@48891: ML_file "~~/src/HOL/Tools/TFL/utils.ML"
wenzelm@48891: ML_file "~~/src/HOL/Tools/TFL/usyntax.ML"
wenzelm@48891: ML_file "~~/src/HOL/Tools/TFL/dcterm.ML"
wenzelm@48891: ML_file "~~/src/HOL/Tools/TFL/thms.ML"
wenzelm@48891: ML_file "~~/src/HOL/Tools/TFL/rules.ML"
wenzelm@48891: ML_file "~~/src/HOL/Tools/TFL/thry.ML"
wenzelm@48891: ML_file "~~/src/HOL/Tools/TFL/tfl.ML"
wenzelm@48891: ML_file "~~/src/HOL/Tools/TFL/post.ML"
wenzelm@48891: ML_file "~~/src/HOL/Tools/recdef.ML"
haftmann@31723: setup Recdef.setup
wenzelm@6438: 
krauss@44014: subsection {* Rule setup *}
krauss@32244: 
wenzelm@9855: lemmas [recdef_simp] =
wenzelm@9855:   inv_image_def
wenzelm@9855:   measure_def
wenzelm@9855:   lex_prod_def
nipkow@11284:   same_fst_def
wenzelm@9855:   less_Suc_eq [THEN iffD2]
wenzelm@9855: 
wenzelm@23150: lemmas [recdef_cong] =
haftmann@56248:   if_cong let_cong image_cong INF_cong SUP_cong bex_cong ball_cong imp_cong
krauss@44013:   map_cong filter_cong takeWhile_cong dropWhile_cong foldl_cong foldr_cong 
wenzelm@9855: 
wenzelm@9855: lemmas [recdef_wf] =
wenzelm@9855:   wf_trancl
wenzelm@9855:   wf_less_than
wenzelm@9855:   wf_lex_prod
wenzelm@9855:   wf_inv_image
wenzelm@9855:   wf_measure
krauss@44013:   wf_measures
wenzelm@9855:   wf_pred_nat
nipkow@10653:   wf_same_fst
wenzelm@9855:   wf_empty
wenzelm@9855: 
wenzelm@6438: end




