equal
deleted
inserted
replaced
118 lemmas cases = sum.case |
118 lemmas cases = sum.case |
119 lemmas simps = sum.inject sum.distinct sum.case old.sum.recs |
119 lemmas simps = sum.inject sum.distinct sum.case old.sum.recs |
120 |
120 |
121 setup {* Sign.parent_path *} |
121 setup {* Sign.parent_path *} |
122 |
122 |
123 primrec sum_map :: "('a \<Rightarrow> 'c) \<Rightarrow> ('b \<Rightarrow> 'd) \<Rightarrow> 'a + 'b \<Rightarrow> 'c + 'd" where |
123 old_primrec sum_map :: "('a \<Rightarrow> 'c) \<Rightarrow> ('b \<Rightarrow> 'd) \<Rightarrow> 'a + 'b \<Rightarrow> 'c + 'd" where |
124 "sum_map f1 f2 (Inl a) = Inl (f1 a)" |
124 "sum_map f1 f2 (Inl a) = Inl (f1 a)" |
125 | "sum_map f1 f2 (Inr a) = Inr (f2 a)" |
125 | "sum_map f1 f2 (Inr a) = Inr (f2 a)" |
126 |
126 |
127 functor sum_map: sum_map proof - |
127 functor sum_map: sum_map proof - |
128 fix f g h i |
128 fix f g h i |
175 from a have "case_sum f1 f2 (Inr y) = case_sum g1 g2 (Inr y)" by simp |
175 from a have "case_sum f1 f2 (Inr y) = case_sum g1 g2 (Inr y)" by simp |
176 then show "f2 y = g2 y" by simp |
176 then show "f2 y = g2 y" by simp |
177 qed |
177 qed |
178 qed |
178 qed |
179 |
179 |
180 primrec Suml :: "('a \<Rightarrow> 'c) \<Rightarrow> 'a + 'b \<Rightarrow> 'c" where |
180 old_primrec Suml :: "('a \<Rightarrow> 'c) \<Rightarrow> 'a + 'b \<Rightarrow> 'c" where |
181 "Suml f (Inl x) = f x" |
181 "Suml f (Inl x) = f x" |
182 |
182 |
183 primrec Sumr :: "('b \<Rightarrow> 'c) \<Rightarrow> 'a + 'b \<Rightarrow> 'c" where |
183 old_primrec Sumr :: "('b \<Rightarrow> 'c) \<Rightarrow> 'a + 'b \<Rightarrow> 'c" where |
184 "Sumr f (Inr x) = f x" |
184 "Sumr f (Inr x) = f x" |
185 |
185 |
186 lemma Suml_inject: |
186 lemma Suml_inject: |
187 assumes "Suml f = Suml g" shows "f = g" |
187 assumes "Suml f = Suml g" shows "f = g" |
188 proof |
188 proof |