src/Doc/Classes/Classes.thy
changeset 55385 169e12bbf9a3
parent 53015 a1119cf551e8
child 56678 71a8ac5d039f
equal deleted inserted replaced
55384:1107de77c633 55385:169e12bbf9a3
   354 text {* \noindent together with corresponding constant(s): *}
   354 text {* \noindent together with corresponding constant(s): *}
   355 
   355 
   356 consts %quote f :: "\<alpha> \<Rightarrow> \<alpha>"
   356 consts %quote f :: "\<alpha> \<Rightarrow> \<alpha>"
   357 
   357 
   358 text {*
   358 text {*
   359   \noindent The connection to the type system is done by means
   359   \noindent The connection to the type system is done by means of a
   360   of a primitive type class
   360   primitive type class @{text "idem"}, together with a corresponding
   361 *} (*<*)setup %invisible {* Sign.add_path "foo" *}
   361   interpretation:
   362 (*>*)
   362 *}
   363 classes %quote idem < type
       
   364 (*<*)axiomatization where idem: "f (f (x::\<alpha>\<Colon>idem)) = f x"
       
   365 setup %invisible {* Sign.parent_path *}(*>*)
       
   366 
       
   367 text {* \noindent together with a corresponding interpretation: *}
       
   368 
   363 
   369 interpretation %quote idem_class:
   364 interpretation %quote idem_class:
   370   idem "f \<Colon> (\<alpha>\<Colon>idem) \<Rightarrow> \<alpha>"
   365   idem "f \<Colon> (\<alpha>\<Colon>idem) \<Rightarrow> \<alpha>"
   371 (*<*)proof qed (rule idem)(*>*)
   366 (*<*)sorry(*>*)
   372 
   367 
   373 text {*
   368 text {*
   374   \noindent This gives you the full power of the Isabelle module system;
   369   \noindent This gives you the full power of the Isabelle module system;
   375   conclusions in locale @{text idem} are implicitly propagated
   370   conclusions in locale @{text idem} are implicitly propagated
   376   to class @{text idem}.
   371   to class @{text idem}.