src/HOL/Library/List_lexord.thy
changeset 28562 4e74209f113e
parent 27682 25aceefd4786
child 30663 0b6aff7451b2
equal deleted inserted replaced
28561:056255ade52a 28562:4e74209f113e
    11 
    11 
    12 instantiation list :: (ord) ord
    12 instantiation list :: (ord) ord
    13 begin
    13 begin
    14 
    14 
    15 definition
    15 definition
    16   list_less_def [code func del]: "(xs::('a::ord) list) < ys \<longleftrightarrow> (xs, ys) \<in> lexord {(u,v). u < v}"
    16   list_less_def [code del]: "(xs::('a::ord) list) < ys \<longleftrightarrow> (xs, ys) \<in> lexord {(u,v). u < v}"
    17 
    17 
    18 definition
    18 definition
    19   list_le_def [code func del]: "(xs::('a::ord) list) \<le> ys \<longleftrightarrow> (xs < ys \<or> xs = ys)"
    19   list_le_def [code del]: "(xs::('a::ord) list) \<le> ys \<longleftrightarrow> (xs < ys \<or> xs = ys)"
    20 
    20 
    21 instance ..
    21 instance ..
    22 
    22 
    23 end
    23 end
    24 
    24 
    61 
    61 
    62 instantiation list :: (linorder) distrib_lattice
    62 instantiation list :: (linorder) distrib_lattice
    63 begin
    63 begin
    64 
    64 
    65 definition
    65 definition
    66   [code func del]: "(inf \<Colon> 'a list \<Rightarrow> _) = min"
    66   [code del]: "(inf \<Colon> 'a list \<Rightarrow> _) = min"
    67 
    67 
    68 definition
    68 definition
    69   [code func del]: "(sup \<Colon> 'a list \<Rightarrow> _) = max"
    69   [code del]: "(sup \<Colon> 'a list \<Rightarrow> _) = max"
    70 
    70 
    71 instance
    71 instance
    72   by intro_classes
    72   by intro_classes
    73     (auto simp add: inf_list_def sup_list_def min_max.sup_inf_distrib1)
    73     (auto simp add: inf_list_def sup_list_def min_max.sup_inf_distrib1)
    74 
    74 
    90   by (unfold list_le_def, cases x) auto
    90   by (unfold list_le_def, cases x) auto
    91 
    91 
    92 lemma Cons_le_Cons [simp]: "a # x \<le> b # y \<longleftrightarrow> a < b \<or> a = b \<and> x \<le> y"
    92 lemma Cons_le_Cons [simp]: "a # x \<le> b # y \<longleftrightarrow> a < b \<or> a = b \<and> x \<le> y"
    93   by (unfold list_le_def) auto
    93   by (unfold list_le_def) auto
    94 
    94 
    95 lemma less_code [code func]:
    95 lemma less_code [code]:
    96   "xs < ([]\<Colon>'a\<Colon>{eq, order} list) \<longleftrightarrow> False"
    96   "xs < ([]\<Colon>'a\<Colon>{eq, order} list) \<longleftrightarrow> False"
    97   "[] < (x\<Colon>'a\<Colon>{eq, order}) # xs \<longleftrightarrow> True"
    97   "[] < (x\<Colon>'a\<Colon>{eq, order}) # xs \<longleftrightarrow> True"
    98   "(x\<Colon>'a\<Colon>{eq, order}) # xs < y # ys \<longleftrightarrow> x < y \<or> x = y \<and> xs < ys"
    98   "(x\<Colon>'a\<Colon>{eq, order}) # xs < y # ys \<longleftrightarrow> x < y \<or> x = y \<and> xs < ys"
    99   by simp_all
    99   by simp_all
   100 
   100 
   101 lemma less_eq_code [code func]:
   101 lemma less_eq_code [code]:
   102   "x # xs \<le> ([]\<Colon>'a\<Colon>{eq, order} list) \<longleftrightarrow> False"
   102   "x # xs \<le> ([]\<Colon>'a\<Colon>{eq, order} list) \<longleftrightarrow> False"
   103   "[] \<le> (xs\<Colon>'a\<Colon>{eq, order} list) \<longleftrightarrow> True"
   103   "[] \<le> (xs\<Colon>'a\<Colon>{eq, order} list) \<longleftrightarrow> True"
   104   "(x\<Colon>'a\<Colon>{eq, order}) # xs \<le> y # ys \<longleftrightarrow> x < y \<or> x = y \<and> xs \<le> ys"
   104   "(x\<Colon>'a\<Colon>{eq, order}) # xs \<le> y # ys \<longleftrightarrow> x < y \<or> x = y \<and> xs \<le> ys"
   105   by simp_all
   105   by simp_all
   106 
   106