src/HOL/Library/Product_ord.thy
author haftmann
Thu Jan 25 09:32:36 2007 +0100 (2007-01-25)
changeset 22177 515021e98684
parent 21458 475b321982f7
child 22483 86064f2f2188
permissions -rw-r--r--
improved
     1 (*  Title:      HOL/Library/Product_ord.thy
     2     ID:         $Id$
     3     Author:     Norbert Voelker
     4 *)
     5 
     6 header {* Order on product types *}
     7 
     8 theory Product_ord
     9 imports Main
    10 begin
    11 
    12 instance "*" :: (ord, ord) ord
    13   prod_le_def: "(x \<le> y) \<equiv> (fst x < fst y) \<or> (fst x = fst y \<and> snd x \<le> snd y)"
    14   prod_less_def: "(x < y) \<equiv> (fst x < fst y) \<or> (fst x = fst y \<and> snd x < snd y)" ..
    15 
    16 lemmas prod_ord_defs = prod_less_def prod_le_def
    17 
    18 lemma [code func]:
    19   "(x1\<Colon>'a\<Colon>{ord, eq}, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
    20   "(x1\<Colon>'a\<Colon>{ord, eq}, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
    21   unfolding prod_ord_defs by simp_all
    22 
    23 lemma [code]:
    24   "(x1, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
    25   "(x1, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
    26   unfolding prod_ord_defs by simp_all
    27 
    28 instance * :: (order, order) order
    29   by default (auto simp: prod_ord_defs intro: order_less_trans)
    30 
    31 instance * :: (linorder, linorder) linorder
    32   by default (auto simp: prod_le_def)
    33 
    34 end