src/HOL/Recdef.thy
author haftmann
Fri Jan 02 08:12:46 2009 +0100 (2009-01-02)
changeset 29332 edc1e2a56398
parent 26748 4d51ddd6aa5c
child 29654 24e73987bfe2
permissions -rw-r--r--
named code theorem for Fract_norm
wenzelm@7701
     1
(*  Title:      HOL/Recdef.thy
wenzelm@7701
     2
    ID:         $Id$
wenzelm@10773
     3
    Author:     Konrad Slind and Markus Wenzel, TU Muenchen
wenzelm@12023
     4
*)
wenzelm@5123
     5
wenzelm@12023
     6
header {* TFL: recursive function definitions *}
wenzelm@7701
     7
nipkow@15131
     8
theory Recdef
krauss@26748
     9
imports FunDef
haftmann@16417
    10
uses
wenzelm@23150
    11
  ("Tools/TFL/casesplit.ML")
wenzelm@23150
    12
  ("Tools/TFL/utils.ML")
wenzelm@23150
    13
  ("Tools/TFL/usyntax.ML")
wenzelm@23150
    14
  ("Tools/TFL/dcterm.ML")
wenzelm@23150
    15
  ("Tools/TFL/thms.ML")
wenzelm@23150
    16
  ("Tools/TFL/rules.ML")
wenzelm@23150
    17
  ("Tools/TFL/thry.ML")
wenzelm@23150
    18
  ("Tools/TFL/tfl.ML")
wenzelm@23150
    19
  ("Tools/TFL/post.ML")
nipkow@15131
    20
  ("Tools/recdef_package.ML")
nipkow@15131
    21
begin
wenzelm@10773
    22
krauss@26748
    23
text{** This form avoids giant explosions in proofs.  NOTE USE OF ==*}
krauss@26748
    24
lemma def_wfrec: "[| f==wfrec r H;  wf(r) |] ==> f(a) = H (cut f r a) a"
krauss@26748
    25
apply auto
krauss@26748
    26
apply (blast intro: wfrec)
krauss@26748
    27
done
krauss@26748
    28
krauss@26748
    29
krauss@26748
    30
lemma tfl_wf_induct: "ALL R. wf R -->  
krauss@26748
    31
       (ALL P. (ALL x. (ALL y. (y,x):R --> P y) --> P x) --> (ALL x. P x))"
krauss@26748
    32
apply clarify
krauss@26748
    33
apply (rule_tac r = R and P = P and a = x in wf_induct, assumption, blast)
krauss@26748
    34
done
krauss@26748
    35
krauss@26748
    36
lemma tfl_cut_apply: "ALL f R. (x,a):R --> (cut f R a)(x) = f(x)"
krauss@26748
    37
apply clarify
krauss@26748
    38
apply (rule cut_apply, assumption)
krauss@26748
    39
done
krauss@26748
    40
krauss@26748
    41
lemma tfl_wfrec:
krauss@26748
    42
     "ALL M R f. (f=wfrec R M) --> wf R --> (ALL x. f x = M (cut f R x) x)"
krauss@26748
    43
apply clarify
krauss@26748
    44
apply (erule wfrec)
krauss@26748
    45
done
krauss@26748
    46
wenzelm@10773
    47
lemma tfl_eq_True: "(x = True) --> x"
wenzelm@10773
    48
  by blast
wenzelm@10773
    49
wenzelm@10773
    50
lemma tfl_rev_eq_mp: "(x = y) --> y --> x";
wenzelm@10773
    51
  by blast
wenzelm@10773
    52
wenzelm@10773
    53
lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
wenzelm@10773
    54
  by blast
wenzelm@6438
    55
wenzelm@10773
    56
lemma tfl_P_imp_P_iff_True: "P ==> P = True"
wenzelm@10773
    57
  by blast
wenzelm@10773
    58
wenzelm@10773
    59
lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
wenzelm@10773
    60
  by blast
wenzelm@10773
    61
wenzelm@12023
    62
lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
wenzelm@10773
    63
  by simp
wenzelm@10773
    64
wenzelm@12023
    65
lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
wenzelm@10773
    66
  by blast
wenzelm@10773
    67
wenzelm@12023
    68
lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
wenzelm@10773
    69
  by blast
wenzelm@10773
    70
wenzelm@23150
    71
use "Tools/TFL/casesplit.ML"
wenzelm@23150
    72
use "Tools/TFL/utils.ML"
wenzelm@23150
    73
use "Tools/TFL/usyntax.ML"
wenzelm@23150
    74
use "Tools/TFL/dcterm.ML"
wenzelm@23150
    75
use "Tools/TFL/thms.ML"
wenzelm@23150
    76
use "Tools/TFL/rules.ML"
wenzelm@23150
    77
use "Tools/TFL/thry.ML"
wenzelm@23150
    78
use "Tools/TFL/tfl.ML"
wenzelm@23150
    79
use "Tools/TFL/post.ML"
wenzelm@10773
    80
use "Tools/recdef_package.ML"
wenzelm@6438
    81
setup RecdefPackage.setup
wenzelm@6438
    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
wenzelm@9855
    92
wenzelm@9855
    93
lemmas [recdef_wf] =
wenzelm@9855
    94
  wf_trancl
wenzelm@9855
    95
  wf_less_than
wenzelm@9855
    96
  wf_lex_prod
wenzelm@9855
    97
  wf_inv_image
wenzelm@9855
    98
  wf_measure
wenzelm@9855
    99
  wf_pred_nat
nipkow@10653
   100
  wf_same_fst
wenzelm@9855
   101
  wf_empty
wenzelm@9855
   102
wenzelm@6438
   103
end