src/HOL/Library/Old_Recdef.thy
author wenzelm
Thu Mar 15 22:08:53 2012 +0100 (2012-03-15)
changeset 46950 d0181abdbdac
parent 46947 b8c7eb0c2f89
child 48891 c0eafbd55de3
permissions -rw-r--r--
declare command keywords via theory header, including strict checking outside Pure;
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
krauss@44014
     8
imports Wfrec
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"
haftmann@16417
    13
uses
krauss@44013
    14
  ("~~/src/HOL/Tools/TFL/casesplit.ML")
krauss@44013
    15
  ("~~/src/HOL/Tools/TFL/utils.ML")
krauss@44013
    16
  ("~~/src/HOL/Tools/TFL/usyntax.ML")
krauss@44013
    17
  ("~~/src/HOL/Tools/TFL/dcterm.ML")
krauss@44013
    18
  ("~~/src/HOL/Tools/TFL/thms.ML")
krauss@44013
    19
  ("~~/src/HOL/Tools/TFL/rules.ML")
krauss@44013
    20
  ("~~/src/HOL/Tools/TFL/thry.ML")
krauss@44013
    21
  ("~~/src/HOL/Tools/TFL/tfl.ML")
krauss@44013
    22
  ("~~/src/HOL/Tools/TFL/post.ML")
krauss@44013
    23
  ("~~/src/HOL/Tools/recdef.ML")
nipkow@15131
    24
begin
wenzelm@10773
    25
krauss@44013
    26
subsection {* Lemmas for TFL *}
krauss@44013
    27
krauss@26748
    28
lemma tfl_wf_induct: "ALL R. wf R -->  
krauss@26748
    29
       (ALL P. (ALL x. (ALL y. (y,x):R --> P y) --> P x) --> (ALL x. P x))"
krauss@26748
    30
apply clarify
krauss@26748
    31
apply (rule_tac r = R and P = P and a = x in wf_induct, assumption, blast)
krauss@26748
    32
done
krauss@26748
    33
krauss@26748
    34
lemma tfl_cut_apply: "ALL f R. (x,a):R --> (cut f R a)(x) = f(x)"
krauss@26748
    35
apply clarify
krauss@26748
    36
apply (rule cut_apply, assumption)
krauss@26748
    37
done
krauss@26748
    38
krauss@26748
    39
lemma tfl_wfrec:
krauss@26748
    40
     "ALL M R f. (f=wfrec R M) --> wf R --> (ALL x. f x = M (cut f R x) x)"
krauss@26748
    41
apply clarify
krauss@26748
    42
apply (erule wfrec)
krauss@26748
    43
done
krauss@26748
    44
wenzelm@10773
    45
lemma tfl_eq_True: "(x = True) --> x"
wenzelm@10773
    46
  by blast
wenzelm@10773
    47
wenzelm@46947
    48
lemma tfl_rev_eq_mp: "(x = y) --> y --> x"
wenzelm@10773
    49
  by blast
wenzelm@10773
    50
wenzelm@10773
    51
lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
wenzelm@10773
    52
  by blast
wenzelm@6438
    53
wenzelm@10773
    54
lemma tfl_P_imp_P_iff_True: "P ==> P = True"
wenzelm@10773
    55
  by blast
wenzelm@10773
    56
wenzelm@10773
    57
lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
wenzelm@10773
    58
  by blast
wenzelm@10773
    59
wenzelm@12023
    60
lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
wenzelm@10773
    61
  by simp
wenzelm@10773
    62
wenzelm@12023
    63
lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
wenzelm@10773
    64
  by blast
wenzelm@10773
    65
wenzelm@12023
    66
lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
wenzelm@10773
    67
  by blast
wenzelm@10773
    68
krauss@44013
    69
use "~~/src/HOL/Tools/TFL/casesplit.ML"
krauss@44013
    70
use "~~/src/HOL/Tools/TFL/utils.ML"
krauss@44013
    71
use "~~/src/HOL/Tools/TFL/usyntax.ML"
krauss@44013
    72
use "~~/src/HOL/Tools/TFL/dcterm.ML"
krauss@44013
    73
use "~~/src/HOL/Tools/TFL/thms.ML"
krauss@44013
    74
use "~~/src/HOL/Tools/TFL/rules.ML"
krauss@44013
    75
use "~~/src/HOL/Tools/TFL/thry.ML"
krauss@44013
    76
use "~~/src/HOL/Tools/TFL/tfl.ML"
krauss@44013
    77
use "~~/src/HOL/Tools/TFL/post.ML"
krauss@44013
    78
use "~~/src/HOL/Tools/recdef.ML"
haftmann@31723
    79
setup Recdef.setup
wenzelm@6438
    80
krauss@44014
    81
subsection {* Rule setup *}
krauss@32244
    82
wenzelm@9855
    83
lemmas [recdef_simp] =
wenzelm@9855
    84
  inv_image_def
wenzelm@9855
    85
  measure_def
wenzelm@9855
    86
  lex_prod_def
nipkow@11284
    87
  same_fst_def
wenzelm@9855
    88
  less_Suc_eq [THEN iffD2]
wenzelm@9855
    89
wenzelm@23150
    90
lemmas [recdef_cong] =
krauss@22622
    91
  if_cong let_cong image_cong INT_cong UN_cong bex_cong ball_cong imp_cong
krauss@44013
    92
  map_cong filter_cong takeWhile_cong dropWhile_cong foldl_cong foldr_cong 
wenzelm@9855
    93
wenzelm@9855
    94
lemmas [recdef_wf] =
wenzelm@9855
    95
  wf_trancl
wenzelm@9855
    96
  wf_less_than
wenzelm@9855
    97
  wf_lex_prod
wenzelm@9855
    98
  wf_inv_image
wenzelm@9855
    99
  wf_measure
krauss@44013
   100
  wf_measures
wenzelm@9855
   101
  wf_pred_nat
nipkow@10653
   102
  wf_same_fst
wenzelm@9855
   103
  wf_empty
wenzelm@9855
   104
wenzelm@6438
   105
end