src/HOL/Library/Product_ord.thy
author haftmann
Fri Oct 10 06:45:53 2008 +0200 (2008-10-10)
changeset 28562 4e74209f113e
parent 28519 095fe24b48fd
child 30738 0842e906300c
permissions -rw-r--r--
`code func` now just `code`
     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 Plain
    10 begin
    11 
    12 instantiation "*" :: (ord, ord) ord
    13 begin
    14 
    15 definition
    16   prod_le_def [code 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 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]:
    26   "(x1\<Colon>'a\<Colon>{ord, eq}, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
    27   "(x1\<Colon>'a\<Colon>{ord, eq}, 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 instance * :: (order, order) order
    31   by default (auto simp: prod_le_def prod_less_def intro: order_less_trans)
    32 
    33 instance * :: (linorder, linorder) linorder
    34   by default (auto simp: prod_le_def)
    35 
    36 instantiation * :: (linorder, linorder) distrib_lattice
    37 begin
    38 
    39 definition
    40   inf_prod_def: "(inf \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = min"
    41 
    42 definition
    43   sup_prod_def: "(sup \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = max"
    44 
    45 instance
    46   by intro_classes
    47     (auto simp add: inf_prod_def sup_prod_def min_max.sup_inf_distrib1)
    48 
    49 end
    50 
    51 end