src/HOL/Recdef.thy
author haftmann
Wed Jan 28 11:03:16 2009 +0100 (2009-01-28)
changeset 29654 24e73987bfe2
parent 26748 4d51ddd6aa5c
child 31723 f5cafe803b55
permissions -rw-r--r--
Plain, Main form meeting points in import hierarchy
wenzelm@7701
     1
(*  Title:      HOL/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
nipkow@15131
     7
theory Recdef
haftmann@29654
     8
imports FunDef Plain
haftmann@16417
     9
uses
wenzelm@23150
    10
  ("Tools/TFL/casesplit.ML")
wenzelm@23150
    11
  ("Tools/TFL/utils.ML")
wenzelm@23150
    12
  ("Tools/TFL/usyntax.ML")
wenzelm@23150
    13
  ("Tools/TFL/dcterm.ML")
wenzelm@23150
    14
  ("Tools/TFL/thms.ML")
wenzelm@23150
    15
  ("Tools/TFL/rules.ML")
wenzelm@23150
    16
  ("Tools/TFL/thry.ML")
wenzelm@23150
    17
  ("Tools/TFL/tfl.ML")
wenzelm@23150
    18
  ("Tools/TFL/post.ML")
nipkow@15131
    19
  ("Tools/recdef_package.ML")
nipkow@15131
    20
begin
wenzelm@10773
    21
krauss@26748
    22
text{** This form avoids giant explosions in proofs.  NOTE USE OF ==*}
krauss@26748
    23
lemma def_wfrec: "[| f==wfrec r H;  wf(r) |] ==> f(a) = H (cut f r a) a"
krauss@26748
    24
apply auto
krauss@26748
    25
apply (blast intro: wfrec)
krauss@26748
    26
done
krauss@26748
    27
krauss@26748
    28
krauss@26748
    29
lemma tfl_wf_induct: "ALL R. wf R -->  
krauss@26748
    30
       (ALL P. (ALL x. (ALL y. (y,x):R --> P y) --> P x) --> (ALL x. P x))"
krauss@26748
    31
apply clarify
krauss@26748
    32
apply (rule_tac r = R and P = P and a = x in wf_induct, assumption, blast)
krauss@26748
    33
done
krauss@26748
    34
krauss@26748
    35
lemma tfl_cut_apply: "ALL f R. (x,a):R --> (cut f R a)(x) = f(x)"
krauss@26748
    36
apply clarify
krauss@26748
    37
apply (rule cut_apply, assumption)
krauss@26748
    38
done
krauss@26748
    39
krauss@26748
    40
lemma tfl_wfrec:
krauss@26748
    41
     "ALL M R f. (f=wfrec R M) --> wf R --> (ALL x. f x = M (cut f R x) x)"
krauss@26748
    42
apply clarify
krauss@26748
    43
apply (erule wfrec)
krauss@26748
    44
done
krauss@26748
    45
wenzelm@10773
    46
lemma tfl_eq_True: "(x = True) --> x"
wenzelm@10773
    47
  by blast
wenzelm@10773
    48
wenzelm@10773
    49
lemma tfl_rev_eq_mp: "(x = y) --> y --> x";
wenzelm@10773
    50
  by blast
wenzelm@10773
    51
wenzelm@10773
    52
lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
wenzelm@10773
    53
  by blast
wenzelm@6438
    54
wenzelm@10773
    55
lemma tfl_P_imp_P_iff_True: "P ==> P = True"
wenzelm@10773
    56
  by blast
wenzelm@10773
    57
wenzelm@10773
    58
lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
wenzelm@10773
    59
  by blast
wenzelm@10773
    60
wenzelm@12023
    61
lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
wenzelm@10773
    62
  by simp
wenzelm@10773
    63
wenzelm@12023
    64
lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
wenzelm@10773
    65
  by blast
wenzelm@10773
    66
wenzelm@12023
    67
lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
wenzelm@10773
    68
  by blast
wenzelm@10773
    69
wenzelm@23150
    70
use "Tools/TFL/casesplit.ML"
wenzelm@23150
    71
use "Tools/TFL/utils.ML"
wenzelm@23150
    72
use "Tools/TFL/usyntax.ML"
wenzelm@23150
    73
use "Tools/TFL/dcterm.ML"
wenzelm@23150
    74
use "Tools/TFL/thms.ML"
wenzelm@23150
    75
use "Tools/TFL/rules.ML"
wenzelm@23150
    76
use "Tools/TFL/thry.ML"
wenzelm@23150
    77
use "Tools/TFL/tfl.ML"
wenzelm@23150
    78
use "Tools/TFL/post.ML"
wenzelm@10773
    79
use "Tools/recdef_package.ML"
wenzelm@6438
    80
setup RecdefPackage.setup
wenzelm@6438
    81
wenzelm@9855
    82
lemmas [recdef_simp] =
wenzelm@9855
    83
  inv_image_def
wenzelm@9855
    84
  measure_def
wenzelm@9855
    85
  lex_prod_def
nipkow@11284
    86
  same_fst_def
wenzelm@9855
    87
  less_Suc_eq [THEN iffD2]
wenzelm@9855
    88
wenzelm@23150
    89
lemmas [recdef_cong] =
krauss@22622
    90
  if_cong let_cong image_cong INT_cong UN_cong bex_cong ball_cong imp_cong
wenzelm@9855
    91
wenzelm@9855
    92
lemmas [recdef_wf] =
wenzelm@9855
    93
  wf_trancl
wenzelm@9855
    94
  wf_less_than
wenzelm@9855
    95
  wf_lex_prod
wenzelm@9855
    96
  wf_inv_image
wenzelm@9855
    97
  wf_measure
wenzelm@9855
    98
  wf_pred_nat
nipkow@10653
    99
  wf_same_fst
wenzelm@9855
   100
  wf_empty
wenzelm@9855
   101
wenzelm@6438
   102
end