src/HOL/Library/Product_ord.thy
author haftmann
Wed May 06 09:08:47 2009 +0200 (2009-05-06)
changeset 31040 996ae76c9eda
parent 30738 0842e906300c
child 37678 0040bafffdef
permissions -rw-r--r--
compatible with preorder; bot and top instances
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@31040
    15
  prod_le_def [code del]: "x \<le> y \<longleftrightarrow> fst x < fst y \<or> fst x \<le> fst y \<and> snd x \<le> snd y"
haftmann@25571
    16
haftmann@25571
    17
definition
haftmann@31040
    18
  prod_less_def [code del]: "x < y \<longleftrightarrow> fst x < fst y \<or> fst x \<le> 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@31040
    25
  "(x1\<Colon>'a\<Colon>{ord, eq}, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 \<le> x2 \<and> y1 \<le> y2"
haftmann@31040
    26
  "(x1\<Colon>'a\<Colon>{ord, eq}, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 \<le> x2 \<and> y1 < y2"
haftmann@25502
    27
  unfolding prod_le_def prod_less_def by simp_all
haftmann@22177
    28
haftmann@31040
    29
instance * :: (preorder, preorder) preorder proof
haftmann@31040
    30
qed (auto simp: prod_le_def prod_less_def less_le_not_le intro: order_trans)
nipkow@15737
    31
haftmann@31040
    32
instance * :: (order, order) order proof
haftmann@31040
    33
qed (auto simp add: prod_le_def)
haftmann@31040
    34
haftmann@31040
    35
instance * :: (linorder, linorder) linorder proof
haftmann@31040
    36
qed (auto simp: prod_le_def)
nipkow@15737
    37
haftmann@25571
    38
instantiation * :: (linorder, linorder) distrib_lattice
haftmann@25571
    39
begin
haftmann@25571
    40
haftmann@25571
    41
definition
haftmann@25502
    42
  inf_prod_def: "(inf \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = min"
haftmann@25571
    43
haftmann@25571
    44
definition
haftmann@25502
    45
  sup_prod_def: "(sup \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = max"
haftmann@25571
    46
haftmann@31040
    47
instance proof
haftmann@31040
    48
qed (auto simp add: inf_prod_def sup_prod_def min_max.sup_inf_distrib1)
haftmann@31040
    49
haftmann@31040
    50
end
haftmann@31040
    51
haftmann@31040
    52
instantiation * :: (bot, bot) bot
haftmann@31040
    53
begin
haftmann@31040
    54
haftmann@31040
    55
definition
haftmann@31040
    56
  bot_prod_def: "bot = (bot, bot)"
haftmann@31040
    57
haftmann@31040
    58
instance proof
haftmann@31040
    59
qed (auto simp add: bot_prod_def prod_le_def)
haftmann@31040
    60
haftmann@31040
    61
end
haftmann@31040
    62
haftmann@31040
    63
instantiation * :: (top, top) top
haftmann@31040
    64
begin
haftmann@31040
    65
haftmann@31040
    66
definition
haftmann@31040
    67
  top_prod_def: "top = (top, top)"
haftmann@31040
    68
haftmann@31040
    69
instance proof
haftmann@31040
    70
qed (auto simp add: top_prod_def prod_le_def)
haftmann@22483
    71
wenzelm@19736
    72
end
haftmann@25571
    73
haftmann@25571
    74
end