src/HOL/Library/Product_ord.thy
author haftmann
Mon May 26 17:55:34 2008 +0200 (2008-05-26)
changeset 26993 b952df8d505b
parent 25691 8f8d83af100a
child 27368 9f90ac19e32b
permissions -rw-r--r--
tuned theorem order
     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 ATP_Linkup
    10 begin
    11 
    12 instantiation "*" :: (ord, ord) ord
    13 begin
    14 
    15 definition
    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"
    17 
    18 definition
    19   prod_less_def [code func del]: "x < y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x < snd y"
    20 
    21 instance ..
    22 
    23 end
    24 
    25 lemma [code, code func del]:
    26   "(x1, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
    27   "(x1, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
    28   unfolding prod_le_def prod_less_def by simp_all
    29 
    30 lemma [code func]:
    31   "(x1\<Colon>'a\<Colon>{ord, eq}, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
    32   "(x1\<Colon>'a\<Colon>{ord, eq}, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
    33   unfolding prod_le_def prod_less_def by simp_all
    34 
    35 instance * :: (order, order) order
    36   by default (auto simp: prod_le_def prod_less_def intro: order_less_trans)
    37 
    38 instance * :: (linorder, linorder) linorder
    39   by default (auto simp: prod_le_def)
    40 
    41 instantiation * :: (linorder, linorder) distrib_lattice
    42 begin
    43 
    44 definition
    45   inf_prod_def: "(inf \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = min"
    46 
    47 definition
    48   sup_prod_def: "(sup \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = max"
    49 
    50 instance
    51   by intro_classes
    52     (auto simp add: inf_prod_def sup_prod_def min_max.sup_inf_distrib1)
    53 
    54 end
    55 
    56 end