equal
deleted
inserted
replaced
7 |
7 |
8 theory List_lexord |
8 theory List_lexord |
9 imports List |
9 imports List |
10 begin |
10 begin |
11 |
11 |
12 instance list :: (ord) ord |
12 instantiation list :: (ord) ord |
|
13 begin |
|
14 |
|
15 definition |
13 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 func del]: "(xs::('a::ord) list) < ys \<longleftrightarrow> (xs, ys) \<in> lexord {(u,v). u < v}" |
14 list_le_def [code func del]: "(xs::('a::ord) list) \<le> ys \<longleftrightarrow> (xs < ys \<or> xs = ys)" .. |
17 |
|
18 definition |
|
19 list_le_def [code func del]: "(xs::('a::ord) list) \<le> ys \<longleftrightarrow> (xs < ys \<or> xs = ys)" |
|
20 |
|
21 instance .. |
|
22 |
|
23 end |
15 |
24 |
16 instance list :: (order) order |
25 instance list :: (order) order |
17 apply (intro_classes, unfold list_less_def list_le_def) |
26 apply (intro_classes, unfold list_less_def list_le_def) |
18 apply safe |
27 apply safe |
19 apply (rule_tac r1 = "{(a::'a,b). a < b}" in lexord_irreflexive [THEN notE]) |
28 apply (rule_tac r1 = "{(a::'a,b). a < b}" in lexord_irreflexive [THEN notE]) |
30 apply (cut_tac x = x and y = y and r = "{(a,b). a < b}" in lexord_linear) |
39 apply (cut_tac x = x and y = y and r = "{(a,b). a < b}" in lexord_linear) |
31 apply force |
40 apply force |
32 apply simp |
41 apply simp |
33 done |
42 done |
34 |
43 |
35 instance list :: (linorder) distrib_lattice |
44 instantiation list :: (linorder) distrib_lattice |
|
45 begin |
|
46 |
|
47 definition |
36 [code func del]: "(inf \<Colon> 'a list \<Rightarrow> _) = min" |
48 [code func del]: "(inf \<Colon> 'a list \<Rightarrow> _) = min" |
|
49 |
|
50 definition |
37 [code func del]: "(sup \<Colon> 'a list \<Rightarrow> _) = max" |
51 [code func del]: "(sup \<Colon> 'a list \<Rightarrow> _) = max" |
|
52 |
|
53 instance |
38 by intro_classes |
54 by intro_classes |
39 (auto simp add: inf_list_def sup_list_def min_max.sup_inf_distrib1) |
55 (auto simp add: inf_list_def sup_list_def min_max.sup_inf_distrib1) |
|
56 |
|
57 end |
40 |
58 |
41 lemma not_less_Nil [simp]: "\<not> (x < [])" |
59 lemma not_less_Nil [simp]: "\<not> (x < [])" |
42 by (unfold list_less_def) simp |
60 by (unfold list_less_def) simp |
43 |
61 |
44 lemma Nil_less_Cons [simp]: "[] < a # x" |
62 lemma Nil_less_Cons [simp]: "[] < a # x" |