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