
krauss@19564: theory FunDef
krauss@19770: imports Accessible_Part Datatype Recdef
krauss@19564: uses 
krauss@19770: ("Tools/function_package/sum_tools.ML")
krauss@19564: ("Tools/function_package/fundef_common.ML")
krauss@19564: ("Tools/function_package/fundef_lib.ML")
krauss@19564: ("Tools/function_package/context_tree.ML")
krauss@19564: ("Tools/function_package/fundef_prep.ML")
krauss@19564: ("Tools/function_package/fundef_proof.ML")
krauss@19564: ("Tools/function_package/termination.ML")
krauss@19770: ("Tools/function_package/mutual.ML")
krauss@19564: ("Tools/function_package/fundef_package.ML")
krauss@19770: ("Tools/function_package/fundef_datatype.ML")
krauss@19770: ("Tools/function_package/auto_term.ML")
krauss@19564: begin
krauss@19564: 
krauss@19564: lemma fundef_ex1_existence:
krauss@19564: assumes f_def: "\<And>x. f x \<equiv> THE y. (x,y)\<in>G"
krauss@19564: assumes ex1: "\<exists>!y. (x,y)\<in>G"
krauss@19564: shows "(x, f x)\<in>G"
krauss@19564:   by (simp only:f_def, rule theI', rule ex1)
krauss@19564: 
krauss@19564: lemma fundef_ex1_uniqueness:
krauss@19564: assumes f_def: "\<And>x. f x \<equiv> THE y. (x,y)\<in>G"
krauss@19564: assumes ex1: "\<exists>!y. (x,y)\<in>G"
krauss@19564: assumes elm: "(x, h x)\<in>G"
krauss@19564: shows "h x = f x"
krauss@19564:   by (simp only:f_def, rule the1_equality[symmetric], rule ex1, rule elm)
krauss@19564: 
krauss@19564: lemma fundef_ex1_iff:
krauss@19564: assumes f_def: "\<And>x. f x \<equiv> THE y. (x,y)\<in>G"
krauss@19564: assumes ex1: "\<exists>!y. (x,y)\<in>G"
krauss@19564: shows "((x, y)\<in>G) = (f x = y)"
krauss@19564:   apply (auto simp:ex1 f_def the1_equality)
krauss@19564:   by (rule theI', rule ex1)
krauss@19564: 
krauss@19564: lemma True_implies: "(True \<Longrightarrow> PROP P) \<equiv> PROP P"
krauss@19564:   by simp
krauss@19564: 
krauss@19564: 
krauss@19770: subsection {* Projections *}
krauss@19770: consts
krauss@19770:   lpg::"(('a + 'b) * 'a) set"
krauss@19770:   rpg::"(('a + 'b) * 'b) set"
krauss@19770: 
krauss@19770: inductive lpg
krauss@19770: intros
krauss@19770:   "(Inl x, x) : lpg"
krauss@19770: inductive rpg
krauss@19770: intros
krauss@19770:   "(Inr y, y) : rpg"
krauss@19770: definition
krauss@19770:   "lproj x = (THE y. (x,y) : lpg)"
krauss@19770:   "rproj x = (THE y. (x,y) : rpg)"
krauss@19770: 
krauss@19770: lemma lproj_inl:
krauss@19770:   "lproj (Inl x) = x"
krauss@19770:   by (auto simp:lproj_def intro: the_equality lpg.intros elim: lpg.cases)
krauss@19770: lemma rproj_inr:
krauss@19770:   "rproj (Inr x) = x"
krauss@19770:   by (auto simp:rproj_def intro: the_equality rpg.intros elim: rpg.cases)
krauss@19770: 
krauss@19770: 
krauss@19770: 
krauss@19770: 
krauss@19770: use "Tools/function_package/sum_tools.ML"
krauss@19564: use "Tools/function_package/fundef_common.ML"
krauss@19564: use "Tools/function_package/fundef_lib.ML"
krauss@19564: use "Tools/function_package/context_tree.ML"
krauss@19564: use "Tools/function_package/fundef_prep.ML"
krauss@19564: use "Tools/function_package/fundef_proof.ML"
krauss@19564: use "Tools/function_package/termination.ML"
krauss@19770: use "Tools/function_package/mutual.ML"
krauss@19564: use "Tools/function_package/fundef_package.ML"
krauss@19564: 
krauss@19564: setup FundefPackage.setup
krauss@19564: 
krauss@19770: use "Tools/function_package/fundef_datatype.ML"
krauss@19770: setup FundefDatatype.setup
krauss@19770: 
krauss@19770: use "Tools/function_package/auto_term.ML"
krauss@19770: setup FundefAutoTerm.setup
krauss@19770: 
krauss@19770: 
krauss@19770: lemmas [fundef_cong] = 
krauss@19770:   let_cong if_cong image_cong INT_cong UN_cong bex_cong ball_cong imp_cong
krauss@19564: 
krauss@19564: 
krauss@19934: lemma split_cong[fundef_cong]:
krauss@19934:   "\<lbrakk> \<And>x y. (x, y) = q \<Longrightarrow> f x y = g x y; p = q \<rbrakk> 
krauss@19934:   \<Longrightarrow> split f p = split g q"
krauss@19934:   by (auto simp:split_def)
krauss@19934: 
krauss@19934: 
krauss@19564: end




