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