src/Doc/IsarRef/HOL_Specific.thy
changeset 53015 a1119cf551e8
parent 52895 a806aa7a5370
child 53219 ca237b9e4542
equal deleted inserted replaced
53009:bb18eed53ed6 53015:a1119cf551e8
  1210   corresponding type constructor and must conform to the following
  1210   corresponding type constructor and must conform to the following
  1211   type pattern:
  1211   type pattern:
  1212 
  1212 
  1213   \begin{matharray}{lll}
  1213   \begin{matharray}{lll}
  1214     @{text "m"} & @{text "::"} &
  1214     @{text "m"} & @{text "::"} &
  1215       @{text "\<sigma>\<^isub>1 \<Rightarrow> \<dots> \<sigma>\<^isub>k \<Rightarrow> (\<^vec>\<alpha>\<^isub>n) t \<Rightarrow> (\<^vec>\<beta>\<^isub>n) t"} \\
  1215       @{text "\<sigma>\<^sub>1 \<Rightarrow> \<dots> \<sigma>\<^sub>k \<Rightarrow> (\<^vec>\<alpha>\<^sub>n) t \<Rightarrow> (\<^vec>\<beta>\<^sub>n) t"} \\
  1216   \end{matharray}
  1216   \end{matharray}
  1217 
  1217 
  1218   \noindent where @{text t} is the type constructor, @{text
  1218   \noindent where @{text t} is the type constructor, @{text
  1219   "\<^vec>\<alpha>\<^isub>n"} and @{text "\<^vec>\<beta>\<^isub>n"} are distinct
  1219   "\<^vec>\<alpha>\<^sub>n"} and @{text "\<^vec>\<beta>\<^sub>n"} are distinct
  1220   type variables free in the local theory and @{text "\<sigma>\<^isub>1"},
  1220   type variables free in the local theory and @{text "\<sigma>\<^sub>1"},
  1221   \ldots, @{text "\<sigma>\<^isub>k"} is a subsequence of @{text "\<alpha>\<^isub>1 \<Rightarrow>
  1221   \ldots, @{text "\<sigma>\<^sub>k"} is a subsequence of @{text "\<alpha>\<^sub>1 \<Rightarrow>
  1222   \<beta>\<^isub>1"}, @{text "\<beta>\<^isub>1 \<Rightarrow> \<alpha>\<^isub>1"}, \ldots,
  1222   \<beta>\<^sub>1"}, @{text "\<beta>\<^sub>1 \<Rightarrow> \<alpha>\<^sub>1"}, \ldots,
  1223   @{text "\<alpha>\<^isub>n \<Rightarrow> \<beta>\<^isub>n"}, @{text "\<beta>\<^isub>n \<Rightarrow>
  1223   @{text "\<alpha>\<^sub>n \<Rightarrow> \<beta>\<^sub>n"}, @{text "\<beta>\<^sub>n \<Rightarrow>
  1224   \<alpha>\<^isub>n"}.
  1224   \<alpha>\<^sub>n"}.
  1225 
  1225 
  1226   \end{description}
  1226   \end{description}
  1227 *}
  1227 *}
  1228 
  1228 
  1229 
  1229 
  1439     (@{syntax nameref} (@{syntax term} + ) + @'and')
  1439     (@{syntax nameref} (@{syntax term} + ) + @'and')
  1440   "}
  1440   "}
  1441 
  1441 
  1442   \begin{description}
  1442   \begin{description}
  1443 
  1443 
  1444   \item @{command "adhoc_overloading"}~@{text "c v\<^isub>1 ... v\<^isub>n"}
  1444   \item @{command "adhoc_overloading"}~@{text "c v\<^sub>1 ... v\<^sub>n"}
  1445   associates variants with an existing constant.
  1445   associates variants with an existing constant.
  1446 
  1446 
  1447   \item @{command "no_adhoc_overloading"} is similar to
  1447   \item @{command "no_adhoc_overloading"} is similar to
  1448   @{command "adhoc_overloading"}, but removes the specified variants
  1448   @{command "adhoc_overloading"}, but removes the specified variants
  1449   from the present context.
  1449   from the present context.
  1685   "}
  1685   "}
  1686 
  1686 
  1687   \begin{description}
  1687   \begin{description}
  1688 
  1688 
  1689   \item @{attribute (HOL) "coercion"}~@{text "f"} registers a new
  1689   \item @{attribute (HOL) "coercion"}~@{text "f"} registers a new
  1690   coercion function @{text "f :: \<sigma>\<^isub>1 \<Rightarrow> \<sigma>\<^isub>2"} where @{text "\<sigma>\<^isub>1"} and
  1690   coercion function @{text "f :: \<sigma>\<^sub>1 \<Rightarrow> \<sigma>\<^sub>2"} where @{text "\<sigma>\<^sub>1"} and
  1691   @{text "\<sigma>\<^isub>2"} are type constructors without arguments.  Coercions are
  1691   @{text "\<sigma>\<^sub>2"} are type constructors without arguments.  Coercions are
  1692   composed by the inference algorithm if needed.  Note that the type
  1692   composed by the inference algorithm if needed.  Note that the type
  1693   inference algorithm is complete only if the registered coercions
  1693   inference algorithm is complete only if the registered coercions
  1694   form a lattice.
  1694   form a lattice.
  1695 
  1695 
  1696   \item @{attribute (HOL) "coercion_map"}~@{text "map"} registers a
  1696   \item @{attribute (HOL) "coercion_map"}~@{text "map"} registers a
  1697   new map function to lift coercions through type constructors. The
  1697   new map function to lift coercions through type constructors. The
  1698   function @{text "map"} must conform to the following type pattern
  1698   function @{text "map"} must conform to the following type pattern
  1699 
  1699 
  1700   \begin{matharray}{lll}
  1700   \begin{matharray}{lll}
  1701     @{text "map"} & @{text "::"} &
  1701     @{text "map"} & @{text "::"} &
  1702       @{text "f\<^isub>1 \<Rightarrow> \<dots> \<Rightarrow> f\<^isub>n \<Rightarrow> (\<alpha>\<^isub>1, \<dots>, \<alpha>\<^isub>n) t \<Rightarrow> (\<beta>\<^isub>1, \<dots>, \<beta>\<^isub>n) t"} \\
  1702       @{text "f\<^sub>1 \<Rightarrow> \<dots> \<Rightarrow> f\<^sub>n \<Rightarrow> (\<alpha>\<^sub>1, \<dots>, \<alpha>\<^sub>n) t \<Rightarrow> (\<beta>\<^sub>1, \<dots>, \<beta>\<^sub>n) t"} \\
  1703   \end{matharray}
  1703   \end{matharray}
  1704 
  1704 
  1705   where @{text "t"} is a type constructor and @{text "f\<^isub>i"} is of type
  1705   where @{text "t"} is a type constructor and @{text "f\<^sub>i"} is of type
  1706   @{text "\<alpha>\<^isub>i \<Rightarrow> \<beta>\<^isub>i"} or @{text "\<beta>\<^isub>i \<Rightarrow> \<alpha>\<^isub>i"}.  Registering a map function
  1706   @{text "\<alpha>\<^sub>i \<Rightarrow> \<beta>\<^sub>i"} or @{text "\<beta>\<^sub>i \<Rightarrow> \<alpha>\<^sub>i"}.  Registering a map function
  1707   overwrites any existing map function for this particular type
  1707   overwrites any existing map function for this particular type
  1708   constructor.
  1708   constructor.
  1709 
  1709 
  1710   \item @{attribute (HOL) "coercion_enabled"} enables the coercion
  1710   \item @{attribute (HOL) "coercion_enabled"} enables the coercion
  1711   inference algorithm.
  1711   inference algorithm.
  1879 fun collinear :: "point \<Rightarrow> point \<Rightarrow> point \<Rightarrow> bool" where
  1879 fun collinear :: "point \<Rightarrow> point \<Rightarrow> point \<Rightarrow> bool" where
  1880   "collinear (Ax, Ay) (Bx, By) (Cx, Cy) \<longleftrightarrow>
  1880   "collinear (Ax, Ay) (Bx, By) (Cx, Cy) \<longleftrightarrow>
  1881     (Ax - Bx) * (By - Cy) = (Ay - By) * (Bx - Cx)"
  1881     (Ax - Bx) * (By - Cy) = (Ay - By) * (Bx - Cx)"
  1882 
  1882 
  1883 lemma collinear_inv_rotation:
  1883 lemma collinear_inv_rotation:
  1884   assumes "collinear (Ax, Ay) (Bx, By) (Cx, Cy)" and "c\<twosuperior> + s\<twosuperior> = 1"
  1884   assumes "collinear (Ax, Ay) (Bx, By) (Cx, Cy)" and "c\<^sup>2 + s\<^sup>2 = 1"
  1885   shows "collinear (Ax * c - Ay * s, Ay * c + Ax * s)
  1885   shows "collinear (Ax * c - Ay * s, Ay * c + Ax * s)
  1886     (Bx * c - By * s, By * c + Bx * s) (Cx * c - Cy * s, Cy * c + Cx * s)"
  1886     (Bx * c - By * s, By * c + Bx * s) (Cx * c - Cy * s, Cy * c + Cx * s)"
  1887   using assms by (algebra add: collinear.simps)
  1887   using assms by (algebra add: collinear.simps)
  1888 
  1888 
  1889 text {*
  1889 text {*