src/HOL/Library/Poly_Mapping.thy
changeset 80914 d97fdabd9e2b
parent 80095 0f9cd1a5edbe
child 81332 f94b30fa2b6c
equal deleted inserted replaced
80913:46f59511b7bb 80914:d97fdabd9e2b
    87 qed
    87 qed
    88 
    88 
    89 context zero
    89 context zero
    90 begin
    90 begin
    91 
    91 
    92 definition "when" :: "'a \<Rightarrow> bool \<Rightarrow> 'a" (infixl "when" 20)
    92 definition "when" :: "'a \<Rightarrow> bool \<Rightarrow> 'a" (infixl \<open>when\<close> 20)
    93 where
    93 where
    94   "(a when P) = (if P then a else 0)"
    94   "(a when P) = (if P then a else 0)"
    95 
    95 
    96 text \<open>
    96 text \<open>
    97   Case distinctions always complicate matters, particularly when
    97   Case distinctions always complicate matters, particularly when
   222 
   222 
   223 text \<open>
   223 text \<open>
   224   The following type is of central importance:
   224   The following type is of central importance:
   225 \<close>
   225 \<close>
   226 
   226 
   227 typedef (overloaded) ('a, 'b) poly_mapping ("(_ \<Rightarrow>\<^sub>0 /_)" [1, 0] 0) =
   227 typedef (overloaded) ('a, 'b) poly_mapping (\<open>(_ \<Rightarrow>\<^sub>0 /_)\<close> [1, 0] 0) =
   228   "{f :: 'a \<Rightarrow> 'b::zero. finite {x. f x \<noteq> 0}}"
   228   "{f :: 'a \<Rightarrow> 'b::zero. finite {x. f x \<noteq> 0}}"
   229   morphisms lookup Abs_poly_mapping
   229   morphisms lookup Abs_poly_mapping
   230 proof -
   230 proof -
   231   have "(\<lambda>_::'a. (0 :: 'b)) \<in> ?poly_mapping" by simp
   231   have "(\<lambda>_::'a. (0 :: 'b)) \<in> ?poly_mapping" by simp
   232   then show ?thesis by (blast intro!: exI)
   232   then show ?thesis by (blast intro!: exI)