src/HOL/Library/List_lexord.thy
changeset 17200 3a4d03d1a31b
parent 15737 c7e522520910
child 21458 475b321982f7
     1.1 --- a/src/HOL/Library/List_lexord.thy	Wed Aug 31 15:46:36 2005 +0200
     1.2 +++ b/src/HOL/Library/List_lexord.thy	Wed Aug 31 15:46:37 2005 +0200
     1.3 @@ -3,51 +3,54 @@
     1.4      Author:     Norbert Voelker
     1.5  *)
     1.6  
     1.7 -header {* Instantiation of order classes for lexord on lists *}
     1.8 +header {* Lexicographic order on lists *}
     1.9  
    1.10  theory List_lexord
    1.11  imports Main
    1.12  begin
    1.13  
    1.14  instance list :: (ord) ord ..
    1.15 -defs(overloaded)
    1.16 -  list_le_def:  "(xs::('a::ord) list) \<le> ys \<equiv> (xs < ys \<or> xs = ys)" 
    1.17 -  list_less_def: "(xs::('a::ord) list) < ys \<equiv> (xs,ys) \<in> lexord {(u,v). u < v}"
    1.18 +defs (overloaded)
    1.19 +  list_le_def:  "(xs::('a::ord) list) \<le> ys \<equiv> (xs < ys \<or> xs = ys)"
    1.20 +  list_less_def: "(xs::('a::ord) list) < ys \<equiv> (xs, ys) \<in> lexord {(u,v). u < v}"
    1.21  
    1.22  lemmas list_ord_defs = list_less_def list_le_def
    1.23  
    1.24 -instance list::(order)order
    1.25 +instance list :: (order) order
    1.26    apply (intro_classes, unfold list_ord_defs)
    1.27 -  apply (rule disjI2, safe)
    1.28 -  apply (blast intro: lexord_trans transI order_less_trans)
    1.29 +     apply (rule disjI2, safe)
    1.30 +    apply (blast intro: lexord_trans transI order_less_trans)
    1.31 +   apply (rule_tac r1 = "{(a::'a,b). a < b}" in lexord_irreflexive [THEN notE])
    1.32 +    apply simp
    1.33 +   apply (blast intro: lexord_trans transI order_less_trans)
    1.34    apply (rule_tac r1 = "{(a::'a,b). a < b}" in lexord_irreflexive [THEN notE])
    1.35    apply simp
    1.36 -  apply (blast intro: lexord_trans transI order_less_trans)
    1.37 -  apply (rule_tac r1 = "{(a::'a,b). a < b}" in lexord_irreflexive [THEN notE])
    1.38 -  apply simp
    1.39 -  by assumption
    1.40 +  apply assumption
    1.41 +  done
    1.42  
    1.43  instance list::(linorder)linorder
    1.44    apply (intro_classes, unfold list_le_def list_less_def, safe)
    1.45 -  apply (cut_tac x="x" and y="y" and  r = "{(a,b). a < b}"  in lexord_linear)
    1.46 -  by (force, simp)
    1.47 +  apply (cut_tac x = x and y = y and  r = "{(a,b). a < b}"  in lexord_linear)
    1.48 +   apply force
    1.49 +  apply simp
    1.50 +  done
    1.51  
    1.52 -lemma not_less_Nil[simp]: "~(x < [])";
    1.53 -  by (unfold list_less_def, simp);
    1.54 +lemma not_less_Nil[simp]: "~(x < [])"
    1.55 +  by (unfold list_less_def) simp
    1.56  
    1.57 -lemma Nil_less_Cons[simp]: "[] < a # x";
    1.58 -  by (unfold list_less_def, simp);
    1.59 +lemma Nil_less_Cons[simp]: "[] < a # x"
    1.60 +  by (unfold list_less_def) simp
    1.61  
    1.62 -lemma Cons_less_Cons[simp]: "(a # x < b # y) = (a < b | a = b & x < y)";
    1.63 -  by (unfold list_less_def, simp);
    1.64 +lemma Cons_less_Cons[simp]: "(a # x < b # y) = (a < b | a = b & x < y)"
    1.65 +  by (unfold list_less_def) simp
    1.66  
    1.67 -lemma le_Nil[simp]: "(x <= [])   = (x = [])";
    1.68 -  by (unfold list_ord_defs, case_tac x, auto);
    1.69 +lemma le_Nil[simp]: "(x <= []) = (x = [])"
    1.70 +  by (unfold list_ord_defs, cases x) auto
    1.71  
    1.72 -lemma Nil_le_Cons[simp]: "([] <= x)";
    1.73 -  by (unfold list_ord_defs, case_tac x, auto);
    1.74 +lemma Nil_le_Cons [simp]: "([] <= x)"
    1.75 +  by (unfold list_ord_defs, cases x) auto
    1.76  
    1.77 -lemma Cons_le_Cons[simp]: "(a # x <= b # y) = (a < b | a = b & x <= y)";
    1.78 -  by (unfold list_ord_defs, auto);
    1.79 +lemma Cons_le_Cons[simp]: "(a # x <= b # y) = (a < b | a = b & x <= y)"
    1.80 +  by (unfold list_ord_defs) auto
    1.81  
    1.82 -end
    1.83 \ No newline at end of file
    1.84 +end