src/HOL/Library/Product_ord.thy
author haftmann
Wed Nov 22 10:20:18 2006 +0100 (2006-11-22)
changeset 21458 475b321982f7
parent 19736 d8d0f8f51d69
child 22177 515021e98684
permissions -rw-r--r--
added code lemmas
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
nipkow@15737
     9
imports Main
nipkow@15737
    10
begin
nipkow@15737
    11
haftmann@21458
    12
instance "*" :: (ord, ord) ord
wenzelm@19736
    13
  prod_le_def: "(x \<le> y) \<equiv> (fst x < fst y) | (fst x = fst y & snd x \<le> snd y)"
haftmann@21458
    14
  prod_less_def: "(x < y) \<equiv> (fst x < fst y) | (fst x = fst y & snd x < snd y)" ..
nipkow@15737
    15
nipkow@15737
    16
lemmas prod_ord_defs = prod_less_def prod_le_def
nipkow@15737
    17
haftmann@21458
    18
lemma [code]:
haftmann@21458
    19
  "(x1, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
haftmann@21458
    20
  "(x1, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
haftmann@21458
    21
  unfolding prod_ord_defs by simp_all
haftmann@21458
    22
wenzelm@19736
    23
instance * :: (order, order) order
wenzelm@19736
    24
  by default (auto simp: prod_ord_defs intro: order_less_trans)
nipkow@15737
    25
wenzelm@19736
    26
instance * :: (linorder, linorder) linorder
wenzelm@19736
    27
  by default (auto simp: prod_le_def)
nipkow@15737
    28
wenzelm@19736
    29
end