src/HOL/Library/Product_ord.thy
author haftmann
Fri Mar 27 10:05:11 2009 +0100 (2009-03-27)
changeset 30738 0842e906300c
parent 28562 4e74209f113e
child 31040 996ae76c9eda
permissions -rw-r--r--
normalized imports
nipkow@15737
     1
(*  Title:      HOL/Library/Product_ord.thy
nipkow@15737
     2
    Author:     Norbert Voelker
nipkow@15737
     3
*)
nipkow@15737
     4
wenzelm@17200
     5
header {* Order on product types *}
nipkow@15737
     6
nipkow@15737
     7
theory Product_ord
haftmann@30738
     8
imports Main
nipkow@15737
     9
begin
nipkow@15737
    10
haftmann@25571
    11
instantiation "*" :: (ord, ord) ord
haftmann@25571
    12
begin
haftmann@25571
    13
haftmann@25571
    14
definition
haftmann@28562
    15
  prod_le_def [code del]: "x \<le> y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x \<le> snd y"
haftmann@25571
    16
haftmann@25571
    17
definition
haftmann@28562
    18
  prod_less_def [code del]: "x < y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x < snd y"
haftmann@25571
    19
haftmann@25571
    20
instance ..
haftmann@25571
    21
haftmann@25571
    22
end
nipkow@15737
    23
haftmann@28562
    24
lemma [code]:
haftmann@22177
    25
  "(x1\<Colon>'a\<Colon>{ord, eq}, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
haftmann@22177
    26
  "(x1\<Colon>'a\<Colon>{ord, eq}, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
haftmann@25502
    27
  unfolding prod_le_def prod_less_def by simp_all
haftmann@22177
    28
wenzelm@19736
    29
instance * :: (order, order) order
haftmann@25502
    30
  by default (auto simp: prod_le_def prod_less_def intro: order_less_trans)
nipkow@15737
    31
wenzelm@19736
    32
instance * :: (linorder, linorder) linorder
wenzelm@19736
    33
  by default (auto simp: prod_le_def)
nipkow@15737
    34
haftmann@25571
    35
instantiation * :: (linorder, linorder) distrib_lattice
haftmann@25571
    36
begin
haftmann@25571
    37
haftmann@25571
    38
definition
haftmann@25502
    39
  inf_prod_def: "(inf \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = min"
haftmann@25571
    40
haftmann@25571
    41
definition
haftmann@25502
    42
  sup_prod_def: "(sup \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = max"
haftmann@25571
    43
haftmann@25571
    44
instance
haftmann@22483
    45
  by intro_classes
haftmann@22483
    46
    (auto simp add: inf_prod_def sup_prod_def min_max.sup_inf_distrib1)
haftmann@22483
    47
wenzelm@19736
    48
end
haftmann@25571
    49
haftmann@25571
    50
end