src/HOL/FunDef.thy
author wenzelm
Thu Aug 03 15:03:11 2006 +0200 (2006-08-03)
changeset 20324 71d63a30cc96
parent 20270 3abe7dae681e
child 20523 36a59e5d0039
permissions -rw-r--r--
removed True_implies (cf. True_implies_equals);
added header;
wenzelm@20324
     1
(*  Title:      HOL/FunDef.thy
wenzelm@20324
     2
    ID:         $Id$
wenzelm@20324
     3
    Author:     Alexander Krauss, TU Muenchen
wenzelm@20324
     4
wenzelm@20324
     5
A package for general recursive function definitions. 
wenzelm@20324
     6
*)
wenzelm@20324
     7
krauss@19564
     8
theory FunDef
krauss@19770
     9
imports Accessible_Part Datatype Recdef
krauss@19564
    10
uses 
krauss@19770
    11
("Tools/function_package/sum_tools.ML")
krauss@19564
    12
("Tools/function_package/fundef_common.ML")
krauss@19564
    13
("Tools/function_package/fundef_lib.ML")
krauss@19564
    14
("Tools/function_package/context_tree.ML")
krauss@19564
    15
("Tools/function_package/fundef_prep.ML")
krauss@19564
    16
("Tools/function_package/fundef_proof.ML")
krauss@19564
    17
("Tools/function_package/termination.ML")
krauss@19770
    18
("Tools/function_package/mutual.ML")
krauss@20270
    19
("Tools/function_package/pattern_split.ML")
krauss@19564
    20
("Tools/function_package/fundef_package.ML")
krauss@19770
    21
("Tools/function_package/fundef_datatype.ML")
krauss@19770
    22
("Tools/function_package/auto_term.ML")
krauss@19564
    23
begin
krauss@19564
    24
krauss@19564
    25
lemma fundef_ex1_existence:
krauss@19564
    26
assumes f_def: "\<And>x. f x \<equiv> THE y. (x,y)\<in>G"
krauss@19564
    27
assumes ex1: "\<exists>!y. (x,y)\<in>G"
krauss@19564
    28
shows "(x, f x)\<in>G"
krauss@19564
    29
  by (simp only:f_def, rule theI', rule ex1)
krauss@19564
    30
krauss@19564
    31
lemma fundef_ex1_uniqueness:
krauss@19564
    32
assumes f_def: "\<And>x. f x \<equiv> THE y. (x,y)\<in>G"
krauss@19564
    33
assumes ex1: "\<exists>!y. (x,y)\<in>G"
krauss@19564
    34
assumes elm: "(x, h x)\<in>G"
krauss@19564
    35
shows "h x = f x"
krauss@19564
    36
  by (simp only:f_def, rule the1_equality[symmetric], rule ex1, rule elm)
krauss@19564
    37
krauss@19564
    38
lemma fundef_ex1_iff:
krauss@19564
    39
assumes f_def: "\<And>x. f x \<equiv> THE y. (x,y)\<in>G"
krauss@19564
    40
assumes ex1: "\<exists>!y. (x,y)\<in>G"
krauss@19564
    41
shows "((x, y)\<in>G) = (f x = y)"
krauss@19564
    42
  apply (auto simp:ex1 f_def the1_equality)
krauss@19564
    43
  by (rule theI', rule ex1)
krauss@19564
    44
krauss@19564
    45
krauss@19770
    46
subsection {* Projections *}
krauss@19770
    47
consts
krauss@19770
    48
  lpg::"(('a + 'b) * 'a) set"
krauss@19770
    49
  rpg::"(('a + 'b) * 'b) set"
krauss@19770
    50
krauss@19770
    51
inductive lpg
krauss@19770
    52
intros
krauss@19770
    53
  "(Inl x, x) : lpg"
krauss@19770
    54
inductive rpg
krauss@19770
    55
intros
krauss@19770
    56
  "(Inr y, y) : rpg"
krauss@19770
    57
definition
krauss@19770
    58
  "lproj x = (THE y. (x,y) : lpg)"
krauss@19770
    59
  "rproj x = (THE y. (x,y) : rpg)"
krauss@19770
    60
krauss@19770
    61
lemma lproj_inl:
krauss@19770
    62
  "lproj (Inl x) = x"
krauss@19770
    63
  by (auto simp:lproj_def intro: the_equality lpg.intros elim: lpg.cases)
krauss@19770
    64
lemma rproj_inr:
krauss@19770
    65
  "rproj (Inr x) = x"
krauss@19770
    66
  by (auto simp:rproj_def intro: the_equality rpg.intros elim: rpg.cases)
krauss@19770
    67
krauss@19770
    68
krauss@19770
    69
krauss@19770
    70
krauss@19770
    71
use "Tools/function_package/sum_tools.ML"
krauss@19564
    72
use "Tools/function_package/fundef_common.ML"
krauss@19564
    73
use "Tools/function_package/fundef_lib.ML"
krauss@19564
    74
use "Tools/function_package/context_tree.ML"
krauss@19564
    75
use "Tools/function_package/fundef_prep.ML"
krauss@19564
    76
use "Tools/function_package/fundef_proof.ML"
krauss@19564
    77
use "Tools/function_package/termination.ML"
krauss@19770
    78
use "Tools/function_package/mutual.ML"
krauss@20270
    79
use "Tools/function_package/pattern_split.ML"
krauss@19564
    80
use "Tools/function_package/fundef_package.ML"
krauss@19564
    81
krauss@19564
    82
setup FundefPackage.setup
krauss@19564
    83
krauss@19770
    84
use "Tools/function_package/fundef_datatype.ML"
krauss@19770
    85
setup FundefDatatype.setup
krauss@19770
    86
krauss@19770
    87
use "Tools/function_package/auto_term.ML"
krauss@19770
    88
setup FundefAutoTerm.setup
krauss@19770
    89
krauss@19770
    90
krauss@19770
    91
lemmas [fundef_cong] = 
krauss@19770
    92
  let_cong if_cong image_cong INT_cong UN_cong bex_cong ball_cong imp_cong
krauss@19564
    93
krauss@19564
    94
krauss@19934
    95
lemma split_cong[fundef_cong]:
krauss@19934
    96
  "\<lbrakk> \<And>x y. (x, y) = q \<Longrightarrow> f x y = g x y; p = q \<rbrakk> 
krauss@19934
    97
  \<Longrightarrow> split f p = split g q"
krauss@19934
    98
  by (auto simp:split_def)
krauss@19934
    99
krauss@19934
   100
krauss@19564
   101
end