src/HOL/Library/Prefix_Order.thy
author Andreas Lochbihler
Fri Sep 20 10:09:16 2013 +0200 (2013-09-20)
changeset 53745 788730ab7da4
parent 49322 fbb320d02420
child 54538 ba7392b52a7c
permissions -rw-r--r--
prefer Code.abort over code_abort
wenzelm@49322
     1
(*  Title:      HOL/Library/Prefix_Order.thy
Christian@49089
     2
    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
Christian@49089
     3
*)
Christian@49089
     4
Christian@49089
     5
header {* Prefix order on lists as order class instance *}
Christian@49089
     6
Christian@49089
     7
theory Prefix_Order
Christian@49089
     8
imports Sublist
Christian@49089
     9
begin
Christian@49089
    10
Christian@49089
    11
instantiation list :: (type) order
Christian@49089
    12
begin
Christian@49089
    13
Christian@49089
    14
definition "(xs::'a list) \<le> ys \<equiv> prefixeq xs ys"
Christian@49089
    15
definition "(xs::'a list) < ys \<equiv> xs \<le> ys \<and> \<not> (ys \<le> xs)"
Christian@49089
    16
Christian@49089
    17
instance by (default, unfold less_eq_list_def less_list_def) auto
Christian@49089
    18
Christian@49089
    19
end
Christian@49089
    20
Christian@49089
    21
lemmas prefixI [intro?] = prefixeqI [folded less_eq_list_def]
Christian@49089
    22
lemmas prefixE [elim?] = prefixeqE [folded less_eq_list_def]
Christian@49089
    23
lemmas strict_prefixI' [intro?] = prefixI' [folded less_list_def]
Christian@49089
    24
lemmas strict_prefixE' [elim?] = prefixE' [folded less_list_def]
Christian@49089
    25
lemmas strict_prefixI [intro?] = prefixI [folded less_list_def]
Christian@49089
    26
lemmas strict_prefixE [elim?] = prefixE [folded less_list_def]
Christian@49089
    27
theorems Nil_prefix [iff] = Nil_prefixeq [folded less_eq_list_def]
Christian@49089
    28
theorems prefix_Nil [simp] = prefixeq_Nil [folded less_eq_list_def]
Christian@49089
    29
lemmas prefix_snoc [simp] = prefixeq_snoc [folded less_eq_list_def]
Christian@49089
    30
lemmas Cons_prefix_Cons [simp] = Cons_prefixeq_Cons [folded less_eq_list_def]
Christian@49089
    31
lemmas same_prefix_prefix [simp] = same_prefixeq_prefixeq [folded less_eq_list_def]
Christian@49089
    32
lemmas same_prefix_nil [iff] = same_prefixeq_nil [folded less_eq_list_def]
Christian@49089
    33
lemmas prefix_prefix [simp] = prefixeq_prefixeq [folded less_eq_list_def]
Christian@49089
    34
theorems prefix_Cons = prefixeq_Cons [folded less_eq_list_def]
Christian@49089
    35
theorems prefix_length_le = prefixeq_length_le [folded less_eq_list_def]
Christian@49089
    36
lemmas strict_prefix_simps [simp, code] = prefix_simps [folded less_list_def]
Christian@49089
    37
lemmas not_prefix_induct [consumes 1, case_names Nil Neq Eq] =
Christian@49089
    38
  not_prefixeq_induct [folded less_eq_list_def]
Christian@49089
    39
Christian@49089
    40
end