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
     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) | (fst x = fst y & snd x \<le> snd y)"
    14   prod_less_def: "(x < y) \<equiv> (fst x < fst y) | (fst x = fst y & snd x < snd y)" ..
    15 
    16 lemmas prod_ord_defs = prod_less_def prod_le_def
    17 
    18 lemma [code]:
    19   "(x1, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
    20   "(x1, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
    21   unfolding prod_ord_defs by simp_all
    22 
    23 instance * :: (order, order) order
    24   by default (auto simp: prod_ord_defs intro: order_less_trans)
    25 
    26 instance * :: (linorder, linorder) linorder
    27   by default (auto simp: prod_le_def)
    28 
    29 end