src/HOL/BNF_Examples/Derivation_Trees/Prelim.thy
changeset 55931 62156e694f3d
parent 55414 eab03e9cee8a
child 57641 dc59f147b27d
equal deleted inserted replaced
55930:25a90cebbbe5 55931:62156e694f3d
    17 
    17 
    18 lemma fst_snd_convol_o[simp]: "<fst o s, snd o s> = s"
    18 lemma fst_snd_convol_o[simp]: "<fst o s, snd o s> = s"
    19 apply(rule ext) by (simp add: convol_def)
    19 apply(rule ext) by (simp add: convol_def)
    20 
    20 
    21 abbreviation sm_abbrev (infix "\<oplus>" 60)
    21 abbreviation sm_abbrev (infix "\<oplus>" 60)
    22 where "f \<oplus> g \<equiv> Sum_Type.sum_map f g"
    22 where "f \<oplus> g \<equiv> Sum_Type.map_sum f g"
    23 
    23 
    24 lemma sum_map_InlD: "(f \<oplus> g) z = Inl x \<Longrightarrow> \<exists>y. z = Inl y \<and> f y = x"
    24 lemma map_sum_InlD: "(f \<oplus> g) z = Inl x \<Longrightarrow> \<exists>y. z = Inl y \<and> f y = x"
    25 by (cases z) auto
    25 by (cases z) auto
    26 
    26 
    27 lemma sum_map_InrD: "(f \<oplus> g) z = Inr x \<Longrightarrow> \<exists>y. z = Inr y \<and> g y = x"
    27 lemma map_sum_InrD: "(f \<oplus> g) z = Inr x \<Longrightarrow> \<exists>y. z = Inr y \<and> g y = x"
    28 by (cases z) auto
    28 by (cases z) auto
    29 
    29 
    30 abbreviation case_sum_abbrev ("[[_,_]]" 800)
    30 abbreviation case_sum_abbrev ("[[_,_]]" 800)
    31 where "[[f,g]] \<equiv> Sum_Type.case_sum f g"
    31 where "[[f,g]] \<equiv> Sum_Type.case_sum f g"
    32 
    32 
    35 shows "Inl tr \<in> tns"
    35 shows "Inl tr \<in> tns"
    36 using assms apply clarify by (case_tac x, auto)
    36 using assms apply clarify by (case_tac x, auto)
    37 
    37 
    38 lemma Inl_oplus_iff[simp]: "Inl tr \<in> (id \<oplus> f) ` tns \<longleftrightarrow> Inl tr \<in> tns"
    38 lemma Inl_oplus_iff[simp]: "Inl tr \<in> (id \<oplus> f) ` tns \<longleftrightarrow> Inl tr \<in> tns"
    39 using Inl_oplus_elim
    39 using Inl_oplus_elim
    40 by (metis id_def image_iff sum_map.simps(1))
    40 by (metis id_def image_iff map_sum.simps(1))
    41 
    41 
    42 lemma Inl_m_oplus[simp]: "Inl -` (id \<oplus> f) ` tns = Inl -` tns"
    42 lemma Inl_m_oplus[simp]: "Inl -` (id \<oplus> f) ` tns = Inl -` tns"
    43 using Inl_oplus_iff unfolding vimage_def by auto
    43 using Inl_oplus_iff unfolding vimage_def by auto
    44 
    44 
    45 lemma Inr_oplus_elim:
    45 lemma Inr_oplus_elim:
    49 
    49 
    50 lemma Inr_oplus_iff[simp]:
    50 lemma Inr_oplus_iff[simp]:
    51 "Inr tr \<in> (id \<oplus> f) ` tns \<longleftrightarrow> (\<exists> n. Inr n \<in> tns \<and> f n = tr)"
    51 "Inr tr \<in> (id \<oplus> f) ` tns \<longleftrightarrow> (\<exists> n. Inr n \<in> tns \<and> f n = tr)"
    52 apply (rule iffI)
    52 apply (rule iffI)
    53  apply (metis Inr_oplus_elim)
    53  apply (metis Inr_oplus_elim)
    54 by (metis image_iff sum_map.simps(2))
    54 by (metis image_iff map_sum.simps(2))
    55 
    55 
    56 lemma Inr_m_oplus[simp]: "Inr -` (id \<oplus> f) ` tns = f ` (Inr -` tns)"
    56 lemma Inr_m_oplus[simp]: "Inr -` (id \<oplus> f) ` tns = f ` (Inr -` tns)"
    57 using Inr_oplus_iff unfolding vimage_def by auto
    57 using Inr_oplus_iff unfolding vimage_def by auto
    58 
    58 
    59 lemma Inl_Inr_image_cong:
    59 lemma Inl_Inr_image_cong: