# HG changeset patch # User blanchet # Date 1348101768 -7200 # Node ID 7a28d22c33c68fd2fb929ec8817d4c419a429206 # Parent 24029cbec12aafdd9de96f8461f65e6ccfb64642 renamed "sum_setl" to "setl" and similarly for r diff -r 24029cbec12a -r 7a28d22c33c6 src/HOL/Codatatype/BNF_FP.thy --- a/src/HOL/Codatatype/BNF_FP.thy Thu Sep 20 02:42:48 2012 +0200 +++ b/src/HOL/Codatatype/BNF_FP.thy Thu Sep 20 02:42:48 2012 +0200 @@ -113,11 +113,11 @@ unfolding fsts_def snds_def by simp+ lemma sum_set_simps: -"sum_setl (Inl x) = {x}" -"sum_setl (Inr x) = {}" -"sum_setr (Inl x) = {}" -"sum_setr (Inr x) = {x}" -unfolding sum_setl_def sum_setr_def by simp+ +"setl (Inl x) = {x}" +"setl (Inr x) = {}" +"setr (Inl x) = {}" +"setr (Inr x) = {x}" +unfolding sum_set_defs by simp+ ML_file "Tools/bnf_fp_util.ML" ML_file "Tools/bnf_fp_sugar_tactics.ML" diff -r 24029cbec12a -r 7a28d22c33c6 src/HOL/Codatatype/Basic_BNFs.thy --- a/src/HOL/Codatatype/Basic_BNFs.thy Thu Sep 20 02:42:48 2012 +0200 +++ b/src/HOL/Codatatype/Basic_BNFs.thy Thu Sep 20 02:42:48 2012 +0200 @@ -73,15 +73,15 @@ lemma DEADID_pred[simp]: "DEADID_pred = (op =)" unfolding DEADID_pred_def DEADID.rel_Id by simp -definition sum_setl :: "'a + 'b \ 'a set" where -"sum_setl x = (case x of Inl z => {z} | _ => {})" +definition setl :: "'a + 'b \ 'a set" where +"setl x = (case x of Inl z => {z} | _ => {})" -definition sum_setr :: "'a + 'b \ 'b set" where -"sum_setr x = (case x of Inr z => {z} | _ => {})" +definition setr :: "'a + 'b \ 'b set" where +"setr x = (case x of Inr z => {z} | _ => {})" -lemmas sum_set_defs = sum_setl_def[abs_def] sum_setr_def[abs_def] +lemmas sum_set_defs = setl_def[abs_def] setr_def[abs_def] -bnf_def sum_map [sum_setl, sum_setr] "\_::'a + 'b. natLeq" [Inl, Inr] +bnf_def sum_map [setl, setr] "\_::'a + 'b. natLeq" [Inl, Inr] proof - show "sum_map id id = id" by (rule sum_map.id) next @@ -90,38 +90,38 @@ by (rule sum_map.comp[symmetric]) next fix x f1 f2 g1 g2 - assume a1: "\z. z \ sum_setl x \ f1 z = g1 z" and - a2: "\z. z \ sum_setr x \ f2 z = g2 z" + assume a1: "\z. z \ setl x \ f1 z = g1 z" and + a2: "\z. z \ setr x \ f2 z = g2 z" thus "sum_map f1 f2 x = sum_map g1 g2 x" proof (cases x) - case Inl thus ?thesis using a1 by (clarsimp simp: sum_setl_def) + case Inl thus ?thesis using a1 by (clarsimp simp: setl_def) next - case Inr thus ?thesis using a2 by (clarsimp simp: sum_setr_def) + case Inr thus ?thesis using a2 by (clarsimp simp: setr_def) qed next fix f1 f2 - show "sum_setl o sum_map f1 f2 = image f1 o sum_setl" - by (rule ext, unfold o_apply) (simp add: sum_setl_def split: sum.split) + show "setl o sum_map f1 f2 = image f1 o setl" + by (rule ext, unfold o_apply) (simp add: setl_def split: sum.split) next fix f1 f2 - show "sum_setr o sum_map f1 f2 = image f2 o sum_setr" - by (rule ext, unfold o_apply) (simp add: sum_setr_def split: sum.split) + show "setr o sum_map f1 f2 = image f2 o setr" + by (rule ext, unfold o_apply) (simp add: setr_def split: sum.split) next show "card_order natLeq" by (rule natLeq_card_order) next show "cinfinite natLeq" by (rule natLeq_cinfinite) next fix x - show "|sum_setl x| \o natLeq" + show "|setl x| \o natLeq" apply (rule ordLess_imp_ordLeq) apply (rule finite_iff_ordLess_natLeq[THEN iffD1]) - by (simp add: sum_setl_def split: sum.split) + by (simp add: setl_def split: sum.split) next fix x - show "|sum_setr x| \o natLeq" + show "|setr x| \o natLeq" apply (rule ordLess_imp_ordLeq) apply (rule finite_iff_ordLess_natLeq[THEN iffD1]) - by (simp add: sum_setr_def split: sum.split) + by (simp add: setr_def split: sum.split) next fix A1 :: "'a set" and A2 :: "'b set" have in_alt: "{x. (case x of Inl z => {z} | _ => {}) \ A1 \ @@ -132,7 +132,7 @@ hence "x \ Inl ` A1 \ x \ Inr ` A2" by (cases x) simp+ thus "x \ A1 <+> A2" by blast qed (auto split: sum.split) - show "|{x. sum_setl x \ A1 \ sum_setr x \ A2}| \o + show "|{x. setl x \ A1 \ setr x \ A2}| \o (( |A1| +c |A2| ) +c ctwo) ^c natLeq" apply (rule ordIso_ordLeq_trans) apply (rule card_of_ordIso_subst) @@ -155,8 +155,8 @@ pull1: "\b1 b2. \b1 \ B11; b2 \ B21; f11 b1 = f21 b2\ \ \a \ A1. p11 a = b1 \ p21 a = b2" and pull2: "\b1 b2. \b1 \ B12; b2 \ B22; f12 b1 = f22 b2\ \ \a \ A2. p12 a = b1 \ p22 a = b2" unfolding wpull_def by blast+ - show "wpull {x. sum_setl x \ A1 \ sum_setr x \ A2} - {x. sum_setl x \ B11 \ sum_setr x \ B12} {x. sum_setl x \ B21 \ sum_setr x \ B22} + show "wpull {x. setl x \ A1 \ setr x \ A2} + {x. setl x \ B11 \ setr x \ B12} {x. setl x \ B21 \ setr x \ B22} (sum_map f11 f12) (sum_map f21 f22) (sum_map p11 p12) (sum_map p21 p22)" (is "wpull ?in ?in1 ?in2 ?mapf1 ?mapf2 ?mapp1 ?mapp2") proof (unfold wpull_def) @@ -169,7 +169,7 @@ with Inl *(3) have False by simp } then obtain b2 where Inl': "B2 = Inl b2" by (cases B2) (simp, blast) with Inl * have "b1 \ B11" "b2 \ B21" "f11 b1 = f21 b2" - by (simp add: sum_setl_def)+ + by (simp add: setl_def)+ with pull1 obtain a where "a \ A1" "p11 a = b1" "p21 a = b2" by blast+ with Inl Inl' have "Inl a \ ?in" "?mapp1 (Inl a) = B1 \ ?mapp2 (Inl a) = B2" by (simp add: sum_set_defs)+ @@ -196,7 +196,7 @@ "sum_pred \ \ x y = (case x of Inl a1 \ (case y of Inl a2 \ \ a1 a2 | Inr _ \ False) | Inr b1 \ (case y of Inl _ \ False | Inr b2 \ \ b1 b2))" -unfolding sum_setl_def sum_setr_def sum_pred_def sum_rel_def Gr_def relcomp_unfold converse_unfold +unfolding setl_def setr_def sum_pred_def sum_rel_def Gr_def relcomp_unfold converse_unfold by (fastforce split: sum.splits)+ lemma singleton_ordLeq_ctwo_natLeq: "|{x}| \o ctwo *c natLeq"