src/HOL/Library/Product_ord.thy
author haftmann
Tue Dec 18 14:37:00 2007 +0100 (2007-12-18)
changeset 25691 8f8d83af100a
parent 25594 43c718438f9f
child 26993 b952df8d505b
permissions -rw-r--r--
switched from PreList to ATP_Linkup
nipkow@15737
     1
(*  Title:      HOL/Library/Product_ord.thy
nipkow@15737
     2
    ID:         $Id$
nipkow@15737
     3
    Author:     Norbert Voelker
nipkow@15737
     4
*)
nipkow@15737
     5
wenzelm@17200
     6
header {* Order on product types *}
nipkow@15737
     7
nipkow@15737
     8
theory Product_ord
haftmann@25691
     9
imports ATP_Linkup
nipkow@15737
    10
begin
nipkow@15737
    11
haftmann@25571
    12
instantiation "*" :: (ord, ord) ord
haftmann@25571
    13
begin
haftmann@25571
    14
haftmann@25571
    15
definition
haftmann@25502
    16
  prod_le_def [code func del]: "x \<le> y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x \<le> snd y"
haftmann@25571
    17
haftmann@25571
    18
definition
haftmann@25571
    19
  prod_less_def [code func del]: "x < y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x < snd y"
haftmann@25571
    20
haftmann@25571
    21
instance ..
haftmann@25571
    22
haftmann@25571
    23
end
nipkow@15737
    24
haftmann@22177
    25
lemma [code func]:
haftmann@22177
    26
  "(x1\<Colon>'a\<Colon>{ord, eq}, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
haftmann@22177
    27
  "(x1\<Colon>'a\<Colon>{ord, eq}, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
haftmann@25502
    28
  unfolding prod_le_def prod_less_def by simp_all
haftmann@22177
    29
haftmann@21458
    30
lemma [code]:
haftmann@21458
    31
  "(x1, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
haftmann@21458
    32
  "(x1, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
haftmann@25502
    33
  unfolding prod_le_def prod_less_def by simp_all
haftmann@21458
    34
wenzelm@19736
    35
instance * :: (order, order) order
haftmann@25502
    36
  by default (auto simp: prod_le_def prod_less_def intro: order_less_trans)
nipkow@15737
    37
wenzelm@19736
    38
instance * :: (linorder, linorder) linorder
wenzelm@19736
    39
  by default (auto simp: prod_le_def)
nipkow@15737
    40
haftmann@25571
    41
instantiation * :: (linorder, linorder) distrib_lattice
haftmann@25571
    42
begin
haftmann@25571
    43
haftmann@25571
    44
definition
haftmann@25502
    45
  inf_prod_def: "(inf \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = min"
haftmann@25571
    46
haftmann@25571
    47
definition
haftmann@25502
    48
  sup_prod_def: "(sup \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = max"
haftmann@25571
    49
haftmann@25571
    50
instance
haftmann@22483
    51
  by intro_classes
haftmann@22483
    52
    (auto simp add: inf_prod_def sup_prod_def min_max.sup_inf_distrib1)
haftmann@22483
    53
wenzelm@19736
    54
end
haftmann@25571
    55
haftmann@25571
    56
end