src/HOL/Library/Prefix_Order.thy
author desharna
Mon, 13 Jun 2022 20:02:00 +0200
changeset 75560 aeb797356de0
parent 63465 d7610beb98bc
permissions -rw-r--r--
added lemmas image_mset_eq_{image_mset_plus,plus,plus_image_mset}D, and multp_image_mset_image_msetD
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49322
fbb320d02420 tuned headers;
wenzelm
parents: 49089
diff changeset
     1
(*  Title:      HOL/Library/Prefix_Order.thy
49089
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
     2
    Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
     3
*)
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
     4
60500
903bb1495239 isabelle update_cartouches;
wenzelm
parents: 58881
diff changeset
     5
section \<open>Prefix order on lists as order class instance\<close>
49089
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
     6
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
     7
theory Prefix_Order
55579
207538943038 reverted ba7392b52a7c: List_Prefix not needed anymore by codatatypes
traytel
parents: 54538
diff changeset
     8
imports Sublist
49089
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
     9
begin
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    10
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    11
instantiation list :: (type) order
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    12
begin
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    13
63465
d7610beb98bc misc tuning and modernization;
wenzelm
parents: 63117
diff changeset
    14
definition "xs \<le> ys \<equiv> prefix xs ys" for xs ys :: "'a list"
d7610beb98bc misc tuning and modernization;
wenzelm
parents: 63117
diff changeset
    15
definition "xs < ys \<equiv> xs \<le> ys \<and> \<not> (ys \<le> xs)" for xs ys :: "'a list"
49089
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    16
60679
ade12ef2773c tuned proofs;
wenzelm
parents: 60500
diff changeset
    17
instance
ade12ef2773c tuned proofs;
wenzelm
parents: 60500
diff changeset
    18
  by standard (auto simp: less_eq_list_def less_list_def)
49089
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    19
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    20
end
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    21
63465
d7610beb98bc misc tuning and modernization;
wenzelm
parents: 63117
diff changeset
    22
lemma less_list_def': "xs < ys \<longleftrightarrow> strict_prefix xs ys" for xs ys :: "'a list"
d7610beb98bc misc tuning and modernization;
wenzelm
parents: 63117
diff changeset
    23
  by (simp add: less_eq_list_def order.strict_iff_order prefix_order.less_le)
63117
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    24
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    25
lemmas prefixI [intro?] = prefixI [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    26
lemmas prefixE [elim?] = prefixE [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    27
lemmas strict_prefixI' [intro?] = strict_prefixI' [folded less_list_def']
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    28
lemmas strict_prefixE' [elim?] = strict_prefixE' [folded less_list_def']
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    29
lemmas strict_prefixI [intro?] = strict_prefixI [folded less_list_def']
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    30
lemmas strict_prefixE [elim?] = strict_prefixE [folded less_list_def']
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    31
lemmas Nil_prefix [iff] = Nil_prefix [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    32
lemmas prefix_Nil [simp] = prefix_Nil [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    33
lemmas prefix_snoc [simp] = prefix_snoc [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    34
lemmas Cons_prefix_Cons [simp] = Cons_prefix_Cons [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    35
lemmas same_prefix_prefix [simp] = same_prefix_prefix [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    36
lemmas same_prefix_nil [iff] = same_prefix_nil [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    37
lemmas prefix_prefix [simp] = prefix_prefix [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    38
lemmas prefix_Cons = prefix_Cons [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    39
lemmas prefix_length_le = prefix_length_le [folded less_eq_list_def]
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    40
lemmas strict_prefix_simps [simp, code] = strict_prefix_simps [folded less_list_def']
49089
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    41
lemmas not_prefix_induct [consumes 1, case_names Nil Neq Eq] =
63117
acb6d72fc42e renamed prefix* in Library/Sublist
nipkow
parents: 61337
diff changeset
    42
  not_prefix_induct [folded less_eq_list_def]
49089
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    43
cd73b439cbe5 added theory instantiating type class order for list prefixes
Christian Sternagel
parents:
diff changeset
    44
end