src/Doc/Datatypes/Datatypes.thy
changeset 80914 d97fdabd9e2b
parent 80786 70076ba563d2
child 81019 dd59daa3c37a
equal deleted inserted replaced
80913:46f59511b7bb 80914:d97fdabd9e2b
   359     no_translations
   359     no_translations
   360       "[x, xs]" == "x # [xs]"
   360       "[x, xs]" == "x # [xs]"
   361       "[x]" == "x # []"
   361       "[x]" == "x # []"
   362 
   362 
   363     no_notation
   363     no_notation
   364       Nil ("[]") and
   364       Nil (\<open>[]\<close>) and
   365       Cons (infixr "#" 65)
   365       Cons (infixr \<open>#\<close> 65)
   366 
   366 
   367     hide_type list
   367     hide_type list
   368     hide_const Nil Cons case_list hd tl set map list_all2 rec_list size_list list_all
   368     hide_const Nil Cons case_list hd tl set map list_all2 rec_list size_list list_all
   369 
   369 
   370     context early
   370     context early
   434 \<close>
   434 \<close>
   435 
   435 
   436 (*<*)
   436 (*<*)
   437     end
   437     end
   438 (*>*)
   438 (*>*)
   439     datatype ('a, 'b) prod (infixr "*" 20) = Pair 'a 'b
   439     datatype ('a, 'b) prod (infixr \<open>*\<close> 20) = Pair 'a 'b
   440 
   440 
   441 text \<open>\blankline\<close>
   441 text \<open>\blankline\<close>
   442 
   442 
   443     datatype (set: 'a) list =
   443     datatype (set: 'a) list =
   444       null: Nil ("[]")
   444       null: Nil (\<open>[]\<close>)
   445     | Cons (hd: 'a) (tl: "'a list") (infixr "#" 65)
   445     | Cons (hd: 'a) (tl: "'a list") (infixr \<open>#\<close> 65)
   446     for
   446     for
   447       map: map
   447       map: map
   448       rel: list_all2
   448       rel: list_all2
   449       pred: list_all
   449       pred: list_all
   450 
   450 
   451 text \<open>
   451 text \<open>
   452 \noindent
   452 \noindent
   453 Incidentally, this is how the traditional syntax can be set up:
   453 Incidentally, this is how the traditional syntax can be set up:
   454 \<close>
   454 \<close>
   455 
   455 
   456     syntax "_list" :: "list_args \<Rightarrow> 'a list" ("[(_)]")
   456     syntax "_list" :: "list_args \<Rightarrow> 'a list" (\<open>[(_)]\<close>)
   457 
   457 
   458 text \<open>\blankline\<close>
   458 text \<open>\blankline\<close>
   459 
   459 
   460     translations
   460     translations
   461       "[x, xs]" == "x # [xs]"
   461       "[x, xs]" == "x # [xs]"