src/HOL/Recdef.thy
author krauss
Fri May 05 17:17:21 2006 +0200 (2006-05-05)
changeset 19564 d3e2f532459a
parent 18336 1a2e30b37ed3
child 19770 be5c23ebe1eb
permissions -rw-r--r--
First usable version of the new function definition package (HOL/function_packake/...).
Moved Accessible_Part.thy from Library to Main.
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
nipkow@15140
     9
imports Wellfounded_Relations Datatype
haftmann@16417
    10
uses
paulson@15150
    11
  ("../TFL/casesplit.ML")
wenzelm@10773
    12
  ("../TFL/utils.ML")
wenzelm@10773
    13
  ("../TFL/usyntax.ML")
wenzelm@10773
    14
  ("../TFL/dcterm.ML")
wenzelm@10773
    15
  ("../TFL/thms.ML")
wenzelm@10773
    16
  ("../TFL/rules.ML")
wenzelm@10773
    17
  ("../TFL/thry.ML")
wenzelm@10773
    18
  ("../TFL/tfl.ML")
wenzelm@10773
    19
  ("../TFL/post.ML")
nipkow@15131
    20
  ("Tools/recdef_package.ML")
krauss@19564
    21
  ("Tools/function_package/auto_term.ML")
nipkow@15131
    22
begin
wenzelm@10773
    23
wenzelm@10773
    24
lemma tfl_eq_True: "(x = True) --> x"
wenzelm@10773
    25
  by blast
wenzelm@10773
    26
wenzelm@10773
    27
lemma tfl_rev_eq_mp: "(x = y) --> y --> x";
wenzelm@10773
    28
  by blast
wenzelm@10773
    29
wenzelm@10773
    30
lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
wenzelm@10773
    31
  by blast
wenzelm@6438
    32
wenzelm@10773
    33
lemma tfl_P_imp_P_iff_True: "P ==> P = True"
wenzelm@10773
    34
  by blast
wenzelm@10773
    35
wenzelm@10773
    36
lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
wenzelm@10773
    37
  by blast
wenzelm@10773
    38
wenzelm@12023
    39
lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
wenzelm@10773
    40
  by simp
wenzelm@10773
    41
wenzelm@12023
    42
lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
wenzelm@10773
    43
  by blast
wenzelm@10773
    44
wenzelm@12023
    45
lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
wenzelm@10773
    46
  by blast
wenzelm@10773
    47
paulson@15150
    48
use "../TFL/casesplit.ML"
wenzelm@10773
    49
use "../TFL/utils.ML"
wenzelm@10773
    50
use "../TFL/usyntax.ML"
wenzelm@10773
    51
use "../TFL/dcterm.ML"
wenzelm@10773
    52
use "../TFL/thms.ML"
wenzelm@10773
    53
use "../TFL/rules.ML"
wenzelm@10773
    54
use "../TFL/thry.ML"
wenzelm@10773
    55
use "../TFL/tfl.ML"
wenzelm@10773
    56
use "../TFL/post.ML"
wenzelm@10773
    57
use "Tools/recdef_package.ML"
wenzelm@6438
    58
setup RecdefPackage.setup
wenzelm@6438
    59
wenzelm@9855
    60
lemmas [recdef_simp] =
wenzelm@9855
    61
  inv_image_def
wenzelm@9855
    62
  measure_def
wenzelm@9855
    63
  lex_prod_def
nipkow@11284
    64
  same_fst_def
wenzelm@9855
    65
  less_Suc_eq [THEN iffD2]
wenzelm@9855
    66
krauss@18336
    67
lemmas [recdef_cong] = 
krauss@18336
    68
  if_cong image_cong INT_cong UN_cong bex_cong ball_cong imp_cong
wenzelm@9855
    69
wenzelm@9855
    70
lemma let_cong [recdef_cong]:
wenzelm@9855
    71
    "M = N ==> (!!x. x = N ==> f x = g x) ==> Let M f = Let N g"
wenzelm@9855
    72
  by (unfold Let_def) blast
wenzelm@9855
    73
wenzelm@9855
    74
lemmas [recdef_wf] =
wenzelm@9855
    75
  wf_trancl
wenzelm@9855
    76
  wf_less_than
wenzelm@9855
    77
  wf_lex_prod
wenzelm@9855
    78
  wf_inv_image
wenzelm@9855
    79
  wf_measure
wenzelm@9855
    80
  wf_pred_nat
nipkow@10653
    81
  wf_same_fst
wenzelm@9855
    82
  wf_empty
wenzelm@9855
    83
nipkow@17040
    84
(* The following should really go into Datatype or Finite_Set, but
nipkow@17040
    85
each one lacks the other theory as a parent . . . *)
nipkow@17040
    86
nipkow@17040
    87
lemma insert_None_conv_UNIV: "insert None (range Some) = UNIV"
nipkow@17040
    88
by (rule set_ext, case_tac x, auto)
nipkow@17040
    89
nipkow@17040
    90
instance option :: (finite) finite
nipkow@17040
    91
proof
nipkow@17040
    92
  have "finite (UNIV :: 'a set)" by (rule finite)
nipkow@17040
    93
  hence "finite (insert None (Some ` (UNIV :: 'a set)))" by simp
nipkow@17040
    94
  also have "insert None (Some ` (UNIV :: 'a set)) = UNIV"
nipkow@17040
    95
    by (rule insert_None_conv_UNIV)
nipkow@17040
    96
  finally show "finite (UNIV :: 'a option set)" .
nipkow@17040
    97
qed
nipkow@17040
    98
krauss@19564
    99
krauss@19564
   100
use "Tools/function_package/auto_term.ML"
krauss@19564
   101
setup FundefAutoTerm.setup
krauss@19564
   102
wenzelm@6438
   103
end