971 |
971 |
972 subsection {* Types and type abbreviations \label{sec:types-pure} *} |
972 subsection {* Types and type abbreviations \label{sec:types-pure} *} |
973 |
973 |
974 text {* |
974 text {* |
975 \begin{matharray}{rcll} |
975 \begin{matharray}{rcll} |
976 @{command_def "types"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
976 @{command_def "type_synonym"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
977 @{command_def "typedecl"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
977 @{command_def "typedecl"} & : & @{text "local_theory \<rightarrow> local_theory"} \\ |
978 @{command_def "arities"} & : & @{text "theory \<rightarrow> theory"} & (axiomatic!) \\ |
978 @{command_def "arities"} & : & @{text "theory \<rightarrow> theory"} & (axiomatic!) \\ |
979 \end{matharray} |
979 \end{matharray} |
980 |
980 |
981 \begin{rail} |
981 \begin{rail} |
982 'types' (typespec '=' type mixfix? +) |
982 'type_synonym' (typespec '=' type mixfix?) |
983 ; |
983 ; |
984 'typedecl' typespec mixfix? |
984 'typedecl' typespec mixfix? |
985 ; |
985 ; |
986 'arities' (nameref '::' arity +) |
986 'arities' (nameref '::' arity +) |
987 ; |
987 ; |
988 \end{rail} |
988 \end{rail} |
989 |
989 |
990 \begin{description} |
990 \begin{description} |
991 |
991 |
992 \item @{command "types"}~@{text "(\<alpha>\<^sub>1, \<dots>, \<alpha>\<^sub>n) t = \<tau>"} introduces a |
992 \item @{command "type_synonym"}~@{text "(\<alpha>\<^sub>1, \<dots>, \<alpha>\<^sub>n) t = \<tau>"} |
993 \emph{type synonym} @{text "(\<alpha>\<^sub>1, \<dots>, \<alpha>\<^sub>n) t"} for the existing type |
993 introduces a \emph{type synonym} @{text "(\<alpha>\<^sub>1, \<dots>, \<alpha>\<^sub>n) t"} for the |
994 @{text "\<tau>"}. Unlike actual type definitions, as are available in |
994 existing type @{text "\<tau>"}. Unlike actual type definitions, as are |
995 Isabelle/HOL for example, type synonyms are merely syntactic |
995 available in Isabelle/HOL for example, type synonyms are merely |
996 abbreviations without any logical significance. Internally, type |
996 syntactic abbreviations without any logical significance. |
997 synonyms are fully expanded. |
997 Internally, type synonyms are fully expanded. |
998 |
998 |
999 \item @{command "typedecl"}~@{text "(\<alpha>\<^sub>1, \<dots>, \<alpha>\<^sub>n) t"} declares a new |
999 \item @{command "typedecl"}~@{text "(\<alpha>\<^sub>1, \<dots>, \<alpha>\<^sub>n) t"} declares a new |
1000 type constructor @{text t}. If the object-logic defines a base sort |
1000 type constructor @{text t}. If the object-logic defines a base sort |
1001 @{text s}, then the constructor is declared to operate on that, via |
1001 @{text s}, then the constructor is declared to operate on that, via |
1002 the axiomatic specification @{command arities}~@{text "t :: (s, \<dots>, |
1002 the axiomatic specification @{command arities}~@{text "t :: (s, \<dots>, |