src/HOL/Library/Product_ord.thy
author haftmann
Thu, 26 Jun 2008 10:07:01 +0200
changeset 27368 9f90ac19e32b
parent 26993 b952df8d505b
child 28519 095fe24b48fd
permissions -rw-r--r--
established Plain theory and image
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15737
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/Library/Product_ord.thy
nipkow
parents:
diff changeset
     2
    ID:         $Id$
nipkow
parents:
diff changeset
     3
    Author:     Norbert Voelker
nipkow
parents:
diff changeset
     4
*)
nipkow
parents:
diff changeset
     5
17200
3a4d03d1a31b tuned presentation;
wenzelm
parents: 15737
diff changeset
     6
header {* Order on product types *}
15737
nipkow
parents:
diff changeset
     7
nipkow
parents:
diff changeset
     8
theory Product_ord
27368
9f90ac19e32b established Plain theory and image
haftmann
parents: 26993
diff changeset
     9
imports Plain
15737
nipkow
parents:
diff changeset
    10
begin
nipkow
parents:
diff changeset
    11
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    12
instantiation "*" :: (ord, ord) ord
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    13
begin
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    14
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    15
definition
25502
9200b36280c0 instance command as rudimentary class target
haftmann
parents: 22845
diff changeset
    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"
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    17
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    18
definition
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    19
  prod_less_def [code func del]: "x < y \<longleftrightarrow> fst x < fst y \<or> fst x = fst y \<and> snd x < snd y"
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    20
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    21
instance ..
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    22
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    23
end
15737
nipkow
parents:
diff changeset
    24
26993
b952df8d505b tuned theorem order
haftmann
parents: 25691
diff changeset
    25
lemma [code, code func del]:
b952df8d505b tuned theorem order
haftmann
parents: 25691
diff changeset
    26
  "(x1, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
b952df8d505b tuned theorem order
haftmann
parents: 25691
diff changeset
    27
  "(x1, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
b952df8d505b tuned theorem order
haftmann
parents: 25691
diff changeset
    28
  unfolding prod_le_def prod_less_def by simp_all
b952df8d505b tuned theorem order
haftmann
parents: 25691
diff changeset
    29
22177
515021e98684 improved
haftmann
parents: 21458
diff changeset
    30
lemma [code func]:
515021e98684 improved
haftmann
parents: 21458
diff changeset
    31
  "(x1\<Colon>'a\<Colon>{ord, eq}, y1) \<le> (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 \<le> y2"
515021e98684 improved
haftmann
parents: 21458
diff changeset
    32
  "(x1\<Colon>'a\<Colon>{ord, eq}, y1) < (x2, y2) \<longleftrightarrow> x1 < x2 \<or> x1 = x2 \<and> y1 < y2"
25502
9200b36280c0 instance command as rudimentary class target
haftmann
parents: 22845
diff changeset
    33
  unfolding prod_le_def prod_less_def by simp_all
22177
515021e98684 improved
haftmann
parents: 21458
diff changeset
    34
19736
wenzelm
parents: 17200
diff changeset
    35
instance * :: (order, order) order
25502
9200b36280c0 instance command as rudimentary class target
haftmann
parents: 22845
diff changeset
    36
  by default (auto simp: prod_le_def prod_less_def intro: order_less_trans)
15737
nipkow
parents:
diff changeset
    37
19736
wenzelm
parents: 17200
diff changeset
    38
instance * :: (linorder, linorder) linorder
wenzelm
parents: 17200
diff changeset
    39
  by default (auto simp: prod_le_def)
15737
nipkow
parents:
diff changeset
    40
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    41
instantiation * :: (linorder, linorder) distrib_lattice
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    42
begin
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    43
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    44
definition
25502
9200b36280c0 instance command as rudimentary class target
haftmann
parents: 22845
diff changeset
    45
  inf_prod_def: "(inf \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = min"
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    46
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    47
definition
25502
9200b36280c0 instance command as rudimentary class target
haftmann
parents: 22845
diff changeset
    48
  sup_prod_def: "(sup \<Colon> 'a \<times> 'b \<Rightarrow> _ \<Rightarrow> _) = max"
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    49
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    50
instance
22483
86064f2f2188 added instance for lattice
haftmann
parents: 22177
diff changeset
    51
  by intro_classes
86064f2f2188 added instance for lattice
haftmann
parents: 22177
diff changeset
    52
    (auto simp add: inf_prod_def sup_prod_def min_max.sup_inf_distrib1)
86064f2f2188 added instance for lattice
haftmann
parents: 22177
diff changeset
    53
19736
wenzelm
parents: 17200
diff changeset
    54
end
25571
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    55
c9e39eafc7a0 instantiation target rather than legacy instance
haftmann
parents: 25502
diff changeset
    56
end