doc-src/IsarAdvanced/Codegen/Thy/Codegen.thy
changeset 26732 6ea9de67e576
parent 26513 6f306c8c2c54
child 26973 6d52187fc2a6
equal deleted inserted replaced
26731:48df747c8543 26732:6ea9de67e576
   608 
   608 
   609 text {*
   609 text {*
   610   Obviously, polymorphic equality is implemented the Haskell
   610   Obviously, polymorphic equality is implemented the Haskell
   611   way using a type class.  How is this achieved?  HOL introduces
   611   way using a type class.  How is this achieved?  HOL introduces
   612   an explicit class @{text eq} with a corresponding operation
   612   an explicit class @{text eq} with a corresponding operation
   613   @{const eq} such that @{thm eq [no_vars]}.
   613   @{const eq_class.eq} such that @{thm eq [no_vars]}.
   614   The preprocessing framework does the rest.
   614   The preprocessing framework does the rest.
   615   For datatypes, instances of @{text eq} are implicitly derived
   615   For datatypes, instances of @{text eq} are implicitly derived
   616   when possible.  For other types, you may instantiate @{text eq}
   616   when possible.  For other types, you may instantiate @{text eq}
   617   manually like any other type class.
   617   manually like any other type class.
   618 
   618 
   932 typedecl bar
   932 typedecl bar
   933 
   933 
   934 instantiation bar :: eq
   934 instantiation bar :: eq
   935 begin
   935 begin
   936 
   936 
   937 definition "eq (x\<Colon>bar) y \<longleftrightarrow> x = y"
   937 definition "eq_class.eq (x\<Colon>bar) y \<longleftrightarrow> x = y"
   938 
   938 
   939 instance by default (simp add: eq_bar_def)
   939 instance by default (simp add: eq_bar_def)
   940 
   940 
   941 end
   941 end
   942 
   942