Precedence_ord.thy
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Fri, 21 Dec 2012 00:24:30 +0000
changeset 12 85116bc854c0
parent 0 110247f9d47e
child 33 9b9f2117561f
permissions -rw-r--r--
updated

header {* Order on product types *}

theory Precedence_ord
imports Main
begin

datatype precedence = Prc nat nat

instantiation precedence :: order
begin

definition
  precedence_le_def: "x \<le> y \<longleftrightarrow> (case (x, y) of
                                   (Prc fx sx, Prc fy sy) \<Rightarrow> 
                                 fx < fy \<or> (fx \<le> fy \<and> sy \<le> sx))"

definition
  precedence_less_def: "x < y \<longleftrightarrow> (case (x, y) of
                               (Prc fx sx, Prc fy sy) \<Rightarrow> 
                                     fx < fy \<or> (fx \<le> fy \<and> sy < sx))"

instance
proof
qed (auto simp: precedence_le_def precedence_less_def 
              intro: order_trans split:precedence.splits)
end

instance precedence :: preorder ..

instance precedence :: linorder proof
qed (auto simp: precedence_le_def precedence_less_def 
              intro: order_trans split:precedence.splits)

end