renamed prefix* in Library/Sublist
authornipkow
Mon May 23 22:43:11 2016 +0200 (2016-05-23)
changeset 63117acb6d72fc42e
parent 63113 fe31996e3898
child 63118 80c361e9d19d
renamed prefix* in Library/Sublist
NEWS
src/HOL/Library/Linear_Temporal_Logic_on_Streams.thy
src/HOL/Library/Prefix_Order.thy
src/HOL/Library/Sublist.thy
src/HOL/Unix/Unix.thy
     1.1 --- a/NEWS	Mon May 23 15:30:13 2016 +0200
     1.2 +++ b/NEWS	Mon May 23 22:43:11 2016 +0200
     1.3 @@ -196,6 +196,8 @@
     1.4  pave way for a possible future different type class instantiation
     1.5  for polynomials over factorial rings.  INCOMPATIBILITY.
     1.6  
     1.7 +* Library/Sublist.thy: renamed prefixeq -> prefix and prefix -> strict_prefix
     1.8 +
     1.9  * Dropped various legacy fact bindings, whose replacements are often
    1.10  of a more general type also:
    1.11    lcm_left_commute_nat ~> lcm.left_commute
     2.1 --- a/src/HOL/Library/Linear_Temporal_Logic_on_Streams.thy	Mon May 23 15:30:13 2016 +0200
     2.2 +++ b/src/HOL/Library/Linear_Temporal_Logic_on_Streams.thy	Mon May 23 22:43:11 2016 +0200
     2.3 @@ -13,7 +13,7 @@
     2.4  
     2.5  lemma shift_prefix:
     2.6  assumes "xl @- xs = yl @- ys" and "length xl \<le> length yl"
     2.7 -shows "prefixeq xl yl"
     2.8 +shows "prefix xl yl"
     2.9  using assms proof(induct xl arbitrary: yl xs ys)
    2.10    case (Cons x xl yl xs ys)
    2.11    thus ?case by (cases yl) auto
    2.12 @@ -21,7 +21,7 @@
    2.13  
    2.14  lemma shift_prefix_cases:
    2.15  assumes "xl @- xs = yl @- ys"
    2.16 -shows "prefixeq xl yl \<or> prefixeq yl xl"
    2.17 +shows "prefix xl yl \<or> prefix yl xl"
    2.18  using shift_prefix[OF assms]
    2.19  by (cases "length xl \<le> length yl") (metis, metis assms nat_le_linear shift_prefix)
    2.20  
    2.21 @@ -297,17 +297,17 @@
    2.22    moreover obtain yl ys1 where xs2: "xs = yl @- ys1" and \<psi>\<psi>: "alw \<psi> ys1"
    2.23    using \<psi> by (metis ev_imp_shift)
    2.24    ultimately have 0: "xl @- xs1 = yl @- ys1" by auto
    2.25 -  hence "prefixeq xl yl \<or> prefixeq yl xl" using shift_prefix_cases by auto
    2.26 +  hence "prefix xl yl \<or> prefix yl xl" using shift_prefix_cases by auto
    2.27    thus ?thesis proof
    2.28 -    assume "prefixeq xl yl"
    2.29 -    then obtain yl1 where yl: "yl = xl @ yl1" by (elim prefixeqE)
    2.30 +    assume "prefix xl yl"
    2.31 +    then obtain yl1 where yl: "yl = xl @ yl1" by (elim prefixE)
    2.32      have xs1': "xs1 = yl1 @- ys1" using 0 unfolding yl by simp
    2.33      have "alw \<phi> ys1" using \<phi>\<phi> unfolding xs1' by (metis alw_shift)
    2.34      hence "alw (\<phi> aand \<psi>) ys1" using \<psi>\<psi> unfolding alw_aand by auto
    2.35      thus ?thesis unfolding xs2 by (auto intro: alw_ev_shift)
    2.36    next
    2.37 -    assume "prefixeq yl xl"
    2.38 -    then obtain xl1 where xl: "xl = yl @ xl1" by (elim prefixeqE)
    2.39 +    assume "prefix yl xl"
    2.40 +    then obtain xl1 where xl: "xl = yl @ xl1" by (elim prefixE)
    2.41      have ys1': "ys1 = xl1 @- xs1" using 0 unfolding xl by simp
    2.42      have "alw \<psi> xs1" using \<psi>\<psi> unfolding ys1' by (metis alw_shift)
    2.43      hence "alw (\<phi> aand \<psi>) xs1" using \<phi>\<phi> unfolding alw_aand by auto
     3.1 --- a/src/HOL/Library/Prefix_Order.thy	Mon May 23 15:30:13 2016 +0200
     3.2 +++ b/src/HOL/Library/Prefix_Order.thy	Mon May 23 22:43:11 2016 +0200
     3.3 @@ -11,7 +11,7 @@
     3.4  instantiation list :: (type) order
     3.5  begin
     3.6  
     3.7 -definition "(xs::'a list) \<le> ys \<equiv> prefixeq xs ys"
     3.8 +definition "(xs::'a list) \<le> ys \<equiv> prefix xs ys"
     3.9  definition "(xs::'a list) < ys \<equiv> xs \<le> ys \<and> \<not> (ys \<le> xs)"
    3.10  
    3.11  instance
    3.12 @@ -19,23 +19,26 @@
    3.13  
    3.14  end
    3.15  
    3.16 -lemmas prefixI [intro?] = prefixeqI [folded less_eq_list_def]
    3.17 -lemmas prefixE [elim?] = prefixeqE [folded less_eq_list_def]
    3.18 -lemmas strict_prefixI' [intro?] = prefixI' [folded less_list_def]
    3.19 -lemmas strict_prefixE' [elim?] = prefixE' [folded less_list_def]
    3.20 -lemmas strict_prefixI [intro?] = prefixI [folded less_list_def]
    3.21 -lemmas strict_prefixE [elim?] = prefixE [folded less_list_def]
    3.22 -lemmas Nil_prefix [iff] = Nil_prefixeq [folded less_eq_list_def]
    3.23 -lemmas prefix_Nil [simp] = prefixeq_Nil [folded less_eq_list_def]
    3.24 -lemmas prefix_snoc [simp] = prefixeq_snoc [folded less_eq_list_def]
    3.25 -lemmas Cons_prefix_Cons [simp] = Cons_prefixeq_Cons [folded less_eq_list_def]
    3.26 -lemmas same_prefix_prefix [simp] = same_prefixeq_prefixeq [folded less_eq_list_def]
    3.27 -lemmas same_prefix_nil [iff] = same_prefixeq_nil [folded less_eq_list_def]
    3.28 -lemmas prefix_prefix [simp] = prefixeq_prefixeq [folded less_eq_list_def]
    3.29 -lemmas prefix_Cons = prefixeq_Cons [folded less_eq_list_def]
    3.30 -lemmas prefix_length_le = prefixeq_length_le [folded less_eq_list_def]
    3.31 -lemmas strict_prefix_simps [simp, code] = prefix_simps [folded less_list_def]
    3.32 +lemma less_list_def': "(xs::'a list) < ys \<longleftrightarrow> strict_prefix xs ys"
    3.33 +by (simp add: less_eq_list_def order.strict_iff_order prefix_order.less_le)
    3.34 +
    3.35 +lemmas prefixI [intro?] = prefixI [folded less_eq_list_def]
    3.36 +lemmas prefixE [elim?] = prefixE [folded less_eq_list_def]
    3.37 +lemmas strict_prefixI' [intro?] = strict_prefixI' [folded less_list_def']
    3.38 +lemmas strict_prefixE' [elim?] = strict_prefixE' [folded less_list_def']
    3.39 +lemmas strict_prefixI [intro?] = strict_prefixI [folded less_list_def']
    3.40 +lemmas strict_prefixE [elim?] = strict_prefixE [folded less_list_def']
    3.41 +lemmas Nil_prefix [iff] = Nil_prefix [folded less_eq_list_def]
    3.42 +lemmas prefix_Nil [simp] = prefix_Nil [folded less_eq_list_def]
    3.43 +lemmas prefix_snoc [simp] = prefix_snoc [folded less_eq_list_def]
    3.44 +lemmas Cons_prefix_Cons [simp] = Cons_prefix_Cons [folded less_eq_list_def]
    3.45 +lemmas same_prefix_prefix [simp] = same_prefix_prefix [folded less_eq_list_def]
    3.46 +lemmas same_prefix_nil [iff] = same_prefix_nil [folded less_eq_list_def]
    3.47 +lemmas prefix_prefix [simp] = prefix_prefix [folded less_eq_list_def]
    3.48 +lemmas prefix_Cons = prefix_Cons [folded less_eq_list_def]
    3.49 +lemmas prefix_length_le = prefix_length_le [folded less_eq_list_def]
    3.50 +lemmas strict_prefix_simps [simp, code] = strict_prefix_simps [folded less_list_def']
    3.51  lemmas not_prefix_induct [consumes 1, case_names Nil Neq Eq] =
    3.52 -  not_prefixeq_induct [folded less_eq_list_def]
    3.53 +  not_prefix_induct [folded less_eq_list_def]
    3.54  
    3.55  end
     4.1 --- a/src/HOL/Library/Sublist.thy	Mon May 23 15:30:13 2016 +0200
     4.2 +++ b/src/HOL/Library/Sublist.thy	Mon May 23 22:43:11 2016 +0200
     4.3 @@ -11,103 +11,103 @@
     4.4  
     4.5  subsection \<open>Prefix order on lists\<close>
     4.6  
     4.7 -definition prefixeq :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool"
     4.8 -  where "prefixeq xs ys \<longleftrightarrow> (\<exists>zs. ys = xs @ zs)"
     4.9 +definition prefix :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool"
    4.10 +  where "prefix xs ys \<longleftrightarrow> (\<exists>zs. ys = xs @ zs)"
    4.11  
    4.12 -definition prefix :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool"
    4.13 -  where "prefix xs ys \<longleftrightarrow> prefixeq xs ys \<and> xs \<noteq> ys"
    4.14 +definition strict_prefix :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool"
    4.15 +  where "strict_prefix xs ys \<longleftrightarrow> prefix xs ys \<and> xs \<noteq> ys"
    4.16  
    4.17 -interpretation prefix_order: order prefixeq prefix
    4.18 -  by standard (auto simp: prefixeq_def prefix_def)
    4.19 +interpretation prefix_order: order prefix strict_prefix
    4.20 +  by standard (auto simp: prefix_def strict_prefix_def)
    4.21  
    4.22 -interpretation prefix_bot: order_bot Nil prefixeq prefix
    4.23 -  by standard (simp add: prefixeq_def)
    4.24 +interpretation prefix_bot: order_bot Nil prefix strict_prefix
    4.25 +  by standard (simp add: prefix_def)
    4.26  
    4.27 -lemma prefixeqI [intro?]: "ys = xs @ zs \<Longrightarrow> prefixeq xs ys"
    4.28 -  unfolding prefixeq_def by blast
    4.29 +lemma prefixI [intro?]: "ys = xs @ zs \<Longrightarrow> prefix xs ys"
    4.30 +  unfolding prefix_def by blast
    4.31  
    4.32 -lemma prefixeqE [elim?]:
    4.33 -  assumes "prefixeq xs ys"
    4.34 +lemma prefixE [elim?]:
    4.35 +  assumes "prefix xs ys"
    4.36    obtains zs where "ys = xs @ zs"
    4.37 -  using assms unfolding prefixeq_def by blast
    4.38 +  using assms unfolding prefix_def by blast
    4.39  
    4.40 -lemma prefixI' [intro?]: "ys = xs @ z # zs \<Longrightarrow> prefix xs ys"
    4.41 -  unfolding prefix_def prefixeq_def by blast
    4.42 +lemma strict_prefixI' [intro?]: "ys = xs @ z # zs \<Longrightarrow> strict_prefix xs ys"
    4.43 +  unfolding strict_prefix_def prefix_def by blast
    4.44  
    4.45 -lemma prefixE' [elim?]:
    4.46 -  assumes "prefix xs ys"
    4.47 +lemma strict_prefixE' [elim?]:
    4.48 +  assumes "strict_prefix xs ys"
    4.49    obtains z zs where "ys = xs @ z # zs"
    4.50  proof -
    4.51 -  from \<open>prefix xs ys\<close> obtain us where "ys = xs @ us" and "xs \<noteq> ys"
    4.52 -    unfolding prefix_def prefixeq_def by blast
    4.53 +  from \<open>strict_prefix xs ys\<close> obtain us where "ys = xs @ us" and "xs \<noteq> ys"
    4.54 +    unfolding strict_prefix_def prefix_def by blast
    4.55    with that show ?thesis by (auto simp add: neq_Nil_conv)
    4.56  qed
    4.57  
    4.58 -lemma prefixI [intro?]: "prefixeq xs ys \<Longrightarrow> xs \<noteq> ys \<Longrightarrow> prefix xs ys"
    4.59 -  unfolding prefix_def by blast
    4.60 +lemma strict_prefixI [intro?]: "prefix xs ys \<Longrightarrow> xs \<noteq> ys \<Longrightarrow> strict_prefix xs ys"
    4.61 +  unfolding strict_prefix_def by blast
    4.62  
    4.63 -lemma prefixE [elim?]:
    4.64 +lemma strict_prefixE [elim?]:
    4.65    fixes xs ys :: "'a list"
    4.66 -  assumes "prefix xs ys"
    4.67 -  obtains "prefixeq xs ys" and "xs \<noteq> ys"
    4.68 -  using assms unfolding prefix_def by blast
    4.69 +  assumes "strict_prefix xs ys"
    4.70 +  obtains "prefix xs ys" and "xs \<noteq> ys"
    4.71 +  using assms unfolding strict_prefix_def by blast
    4.72  
    4.73  
    4.74  subsection \<open>Basic properties of prefixes\<close>
    4.75  
    4.76 -theorem Nil_prefixeq [iff]: "prefixeq [] xs"
    4.77 -  by (simp add: prefixeq_def)
    4.78 +theorem Nil_prefix [iff]: "prefix [] xs"
    4.79 +  by (simp add: prefix_def)
    4.80  
    4.81 -theorem prefixeq_Nil [simp]: "(prefixeq xs []) = (xs = [])"
    4.82 -  by (induct xs) (simp_all add: prefixeq_def)
    4.83 +theorem prefix_Nil [simp]: "(prefix xs []) = (xs = [])"
    4.84 +  by (induct xs) (simp_all add: prefix_def)
    4.85  
    4.86 -lemma prefixeq_snoc [simp]: "prefixeq xs (ys @ [y]) \<longleftrightarrow> xs = ys @ [y] \<or> prefixeq xs ys"
    4.87 +lemma prefix_snoc [simp]: "prefix xs (ys @ [y]) \<longleftrightarrow> xs = ys @ [y] \<or> prefix xs ys"
    4.88  proof
    4.89 -  assume "prefixeq xs (ys @ [y])"
    4.90 +  assume "prefix xs (ys @ [y])"
    4.91    then obtain zs where zs: "ys @ [y] = xs @ zs" ..
    4.92 -  show "xs = ys @ [y] \<or> prefixeq xs ys"
    4.93 -    by (metis append_Nil2 butlast_append butlast_snoc prefixeqI zs)
    4.94 +  show "xs = ys @ [y] \<or> prefix xs ys"
    4.95 +    by (metis append_Nil2 butlast_append butlast_snoc prefixI zs)
    4.96  next
    4.97 -  assume "xs = ys @ [y] \<or> prefixeq xs ys"
    4.98 -  then show "prefixeq xs (ys @ [y])"
    4.99 -    by (metis prefix_order.eq_iff prefix_order.order_trans prefixeqI)
   4.100 +  assume "xs = ys @ [y] \<or> prefix xs ys"
   4.101 +  then show "prefix xs (ys @ [y])"
   4.102 +    by (metis prefix_order.eq_iff prefix_order.order_trans prefixI)
   4.103  qed
   4.104  
   4.105 -lemma Cons_prefixeq_Cons [simp]: "prefixeq (x # xs) (y # ys) = (x = y \<and> prefixeq xs ys)"
   4.106 -  by (auto simp add: prefixeq_def)
   4.107 +lemma Cons_prefix_Cons [simp]: "prefix (x # xs) (y # ys) = (x = y \<and> prefix xs ys)"
   4.108 +  by (auto simp add: prefix_def)
   4.109  
   4.110 -lemma prefixeq_code [code]:
   4.111 -  "prefixeq [] xs \<longleftrightarrow> True"
   4.112 -  "prefixeq (x # xs) [] \<longleftrightarrow> False"
   4.113 -  "prefixeq (x # xs) (y # ys) \<longleftrightarrow> x = y \<and> prefixeq xs ys"
   4.114 +lemma prefix_code [code]:
   4.115 +  "prefix [] xs \<longleftrightarrow> True"
   4.116 +  "prefix (x # xs) [] \<longleftrightarrow> False"
   4.117 +  "prefix (x # xs) (y # ys) \<longleftrightarrow> x = y \<and> prefix xs ys"
   4.118    by simp_all
   4.119  
   4.120 -lemma same_prefixeq_prefixeq [simp]: "prefixeq (xs @ ys) (xs @ zs) = prefixeq ys zs"
   4.121 +lemma same_prefix_prefix [simp]: "prefix (xs @ ys) (xs @ zs) = prefix ys zs"
   4.122    by (induct xs) simp_all
   4.123  
   4.124 -lemma same_prefixeq_nil [iff]: "prefixeq (xs @ ys) xs = (ys = [])"
   4.125 -  by (metis append_Nil2 append_self_conv prefix_order.eq_iff prefixeqI)
   4.126 +lemma same_prefix_nil [iff]: "prefix (xs @ ys) xs = (ys = [])"
   4.127 +  by (metis append_Nil2 append_self_conv prefix_order.eq_iff prefixI)
   4.128  
   4.129 -lemma prefixeq_prefixeq [simp]: "prefixeq xs ys \<Longrightarrow> prefixeq xs (ys @ zs)"
   4.130 -  by (metis prefix_order.le_less_trans prefixeqI prefixE prefixI)
   4.131 +lemma prefix_prefix [simp]: "prefix xs ys \<Longrightarrow> prefix xs (ys @ zs)"
   4.132 +  by (metis prefix_order.le_less_trans prefixI strict_prefixE strict_prefixI)
   4.133  
   4.134 -lemma append_prefixeqD: "prefixeq (xs @ ys) zs \<Longrightarrow> prefixeq xs zs"
   4.135 -  by (auto simp add: prefixeq_def)
   4.136 +lemma append_prefixD: "prefix (xs @ ys) zs \<Longrightarrow> prefix xs zs"
   4.137 +  by (auto simp add: prefix_def)
   4.138  
   4.139 -theorem prefixeq_Cons: "prefixeq xs (y # ys) = (xs = [] \<or> (\<exists>zs. xs = y # zs \<and> prefixeq zs ys))"
   4.140 -  by (cases xs) (auto simp add: prefixeq_def)
   4.141 +theorem prefix_Cons: "prefix xs (y # ys) = (xs = [] \<or> (\<exists>zs. xs = y # zs \<and> prefix zs ys))"
   4.142 +  by (cases xs) (auto simp add: prefix_def)
   4.143  
   4.144 -theorem prefixeq_append:
   4.145 -  "prefixeq xs (ys @ zs) = (prefixeq xs ys \<or> (\<exists>us. xs = ys @ us \<and> prefixeq us zs))"
   4.146 +theorem prefix_append:
   4.147 +  "prefix xs (ys @ zs) = (prefix xs ys \<or> (\<exists>us. xs = ys @ us \<and> prefix us zs))"
   4.148    apply (induct zs rule: rev_induct)
   4.149     apply force
   4.150    apply (simp del: append_assoc add: append_assoc [symmetric])
   4.151    apply (metis append_eq_appendI)
   4.152    done
   4.153  
   4.154 -lemma append_one_prefixeq:
   4.155 -  "prefixeq xs ys \<Longrightarrow> length xs < length ys \<Longrightarrow> prefixeq (xs @ [ys ! length xs]) ys"
   4.156 -  proof (unfold prefixeq_def)
   4.157 +lemma append_one_prefix:
   4.158 +  "prefix xs ys \<Longrightarrow> length xs < length ys \<Longrightarrow> prefix (xs @ [ys ! length xs]) ys"
   4.159 +  proof (unfold prefix_def)
   4.160      assume a1: "\<exists>zs. ys = xs @ zs"
   4.161      then obtain sk :: "'a list" where sk: "ys = xs @ sk" by fastforce
   4.162      assume a2: "length xs < length ys"
   4.163 @@ -117,42 +117,42 @@
   4.164      thus "\<exists>zs. ys = (xs @ [ys ! length xs]) @ zs" using f1 by fastforce
   4.165    qed
   4.166  
   4.167 -theorem prefixeq_length_le: "prefixeq xs ys \<Longrightarrow> length xs \<le> length ys"
   4.168 -  by (auto simp add: prefixeq_def)
   4.169 +theorem prefix_length_le: "prefix xs ys \<Longrightarrow> length xs \<le> length ys"
   4.170 +  by (auto simp add: prefix_def)
   4.171  
   4.172 -lemma prefixeq_same_cases:
   4.173 -  "prefixeq (xs\<^sub>1::'a list) ys \<Longrightarrow> prefixeq xs\<^sub>2 ys \<Longrightarrow> prefixeq xs\<^sub>1 xs\<^sub>2 \<or> prefixeq xs\<^sub>2 xs\<^sub>1"
   4.174 -  unfolding prefixeq_def by (force simp: append_eq_append_conv2)
   4.175 +lemma prefix_same_cases:
   4.176 +  "prefix (xs\<^sub>1::'a list) ys \<Longrightarrow> prefix xs\<^sub>2 ys \<Longrightarrow> prefix xs\<^sub>1 xs\<^sub>2 \<or> prefix xs\<^sub>2 xs\<^sub>1"
   4.177 +  unfolding prefix_def by (force simp: append_eq_append_conv2)
   4.178  
   4.179 -lemma set_mono_prefixeq: "prefixeq xs ys \<Longrightarrow> set xs \<subseteq> set ys"
   4.180 -  by (auto simp add: prefixeq_def)
   4.181 +lemma set_mono_prefix: "prefix xs ys \<Longrightarrow> set xs \<subseteq> set ys"
   4.182 +  by (auto simp add: prefix_def)
   4.183  
   4.184 -lemma take_is_prefixeq: "prefixeq (take n xs) xs"
   4.185 -  unfolding prefixeq_def by (metis append_take_drop_id)
   4.186 +lemma take_is_prefix: "prefix (take n xs) xs"
   4.187 +  unfolding prefix_def by (metis append_take_drop_id)
   4.188  
   4.189 -lemma map_prefixeqI: "prefixeq xs ys \<Longrightarrow> prefixeq (map f xs) (map f ys)"
   4.190 -  by (auto simp: prefixeq_def)
   4.191 +lemma map_prefixI: "prefix xs ys \<Longrightarrow> prefix (map f xs) (map f ys)"
   4.192 +  by (auto simp: prefix_def)
   4.193  
   4.194 -lemma prefixeq_length_less: "prefix xs ys \<Longrightarrow> length xs < length ys"
   4.195 -  by (auto simp: prefix_def prefixeq_def)
   4.196 +lemma prefix_length_less: "strict_prefix xs ys \<Longrightarrow> length xs < length ys"
   4.197 +  by (auto simp: strict_prefix_def prefix_def)
   4.198  
   4.199 -lemma prefix_simps [simp, code]:
   4.200 -  "prefix xs [] \<longleftrightarrow> False"
   4.201 -  "prefix [] (x # xs) \<longleftrightarrow> True"
   4.202 -  "prefix (x # xs) (y # ys) \<longleftrightarrow> x = y \<and> prefix xs ys"
   4.203 -  by (simp_all add: prefix_def cong: conj_cong)
   4.204 +lemma strict_prefix_simps [simp, code]:
   4.205 +  "strict_prefix xs [] \<longleftrightarrow> False"
   4.206 +  "strict_prefix [] (x # xs) \<longleftrightarrow> True"
   4.207 +  "strict_prefix (x # xs) (y # ys) \<longleftrightarrow> x = y \<and> strict_prefix xs ys"
   4.208 +  by (simp_all add: strict_prefix_def cong: conj_cong)
   4.209  
   4.210 -lemma take_prefix: "prefix xs ys \<Longrightarrow> prefix (take n xs) ys"
   4.211 +lemma take_strict_prefix: "strict_prefix xs ys \<Longrightarrow> strict_prefix (take n xs) ys"
   4.212    apply (induct n arbitrary: xs ys)
   4.213     apply (case_tac ys; simp)
   4.214 -  apply (metis prefix_order.less_trans prefixI take_is_prefixeq)
   4.215 +  apply (metis prefix_order.less_trans strict_prefixI take_is_prefix)
   4.216    done
   4.217  
   4.218 -lemma not_prefixeq_cases:
   4.219 -  assumes pfx: "\<not> prefixeq ps ls"
   4.220 +lemma not_prefix_cases:
   4.221 +  assumes pfx: "\<not> prefix ps ls"
   4.222    obtains
   4.223      (c1) "ps \<noteq> []" and "ls = []"
   4.224 -  | (c2) a as x xs where "ps = a#as" and "ls = x#xs" and "x = a" and "\<not> prefixeq as xs"
   4.225 +  | (c2) a as x xs where "ps = a#as" and "ls = x#xs" and "x = a" and "\<not> prefix as xs"
   4.226    | (c3) a as x xs where "ps = a#as" and "ls = x#xs" and "x \<noteq> a"
   4.227  proof (cases ps)
   4.228    case Nil
   4.229 @@ -162,13 +162,13 @@
   4.230    note c = \<open>ps = a#as\<close>
   4.231    show ?thesis
   4.232    proof (cases ls)
   4.233 -    case Nil then show ?thesis by (metis append_Nil2 pfx c1 same_prefixeq_nil)
   4.234 +    case Nil then show ?thesis by (metis append_Nil2 pfx c1 same_prefix_nil)
   4.235    next
   4.236      case (Cons x xs)
   4.237      show ?thesis
   4.238      proof (cases "x = a")
   4.239        case True
   4.240 -      have "\<not> prefixeq as xs" using pfx c Cons True by simp
   4.241 +      have "\<not> prefix as xs" using pfx c Cons True by simp
   4.242        with c Cons True show ?thesis by (rule c2)
   4.243      next
   4.244        case False
   4.245 @@ -177,40 +177,40 @@
   4.246    qed
   4.247  qed
   4.248  
   4.249 -lemma not_prefixeq_induct [consumes 1, case_names Nil Neq Eq]:
   4.250 -  assumes np: "\<not> prefixeq ps ls"
   4.251 +lemma not_prefix_induct [consumes 1, case_names Nil Neq Eq]:
   4.252 +  assumes np: "\<not> prefix ps ls"
   4.253      and base: "\<And>x xs. P (x#xs) []"
   4.254      and r1: "\<And>x xs y ys. x \<noteq> y \<Longrightarrow> P (x#xs) (y#ys)"
   4.255 -    and r2: "\<And>x xs y ys. \<lbrakk> x = y; \<not> prefixeq xs ys; P xs ys \<rbrakk> \<Longrightarrow> P (x#xs) (y#ys)"
   4.256 +    and r2: "\<And>x xs y ys. \<lbrakk> x = y; \<not> prefix xs ys; P xs ys \<rbrakk> \<Longrightarrow> P (x#xs) (y#ys)"
   4.257    shows "P ps ls" using np
   4.258  proof (induct ls arbitrary: ps)
   4.259    case Nil then show ?case
   4.260 -    by (auto simp: neq_Nil_conv elim!: not_prefixeq_cases intro!: base)
   4.261 +    by (auto simp: neq_Nil_conv elim!: not_prefix_cases intro!: base)
   4.262  next
   4.263    case (Cons y ys)
   4.264 -  then have npfx: "\<not> prefixeq ps (y # ys)" by simp
   4.265 +  then have npfx: "\<not> prefix ps (y # ys)" by simp
   4.266    then obtain x xs where pv: "ps = x # xs"
   4.267 -    by (rule not_prefixeq_cases) auto
   4.268 -  show ?case by (metis Cons.hyps Cons_prefixeq_Cons npfx pv r1 r2)
   4.269 +    by (rule not_prefix_cases) auto
   4.270 +  show ?case by (metis Cons.hyps Cons_prefix_Cons npfx pv r1 r2)
   4.271  qed
   4.272  
   4.273  
   4.274  subsection \<open>Parallel lists\<close>
   4.275  
   4.276  definition parallel :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool"  (infixl "\<parallel>" 50)
   4.277 -  where "(xs \<parallel> ys) = (\<not> prefixeq xs ys \<and> \<not> prefixeq ys xs)"
   4.278 +  where "(xs \<parallel> ys) = (\<not> prefix xs ys \<and> \<not> prefix ys xs)"
   4.279  
   4.280 -lemma parallelI [intro]: "\<not> prefixeq xs ys \<Longrightarrow> \<not> prefixeq ys xs \<Longrightarrow> xs \<parallel> ys"
   4.281 +lemma parallelI [intro]: "\<not> prefix xs ys \<Longrightarrow> \<not> prefix ys xs \<Longrightarrow> xs \<parallel> ys"
   4.282    unfolding parallel_def by blast
   4.283  
   4.284  lemma parallelE [elim]:
   4.285    assumes "xs \<parallel> ys"
   4.286 -  obtains "\<not> prefixeq xs ys \<and> \<not> prefixeq ys xs"
   4.287 +  obtains "\<not> prefix xs ys \<and> \<not> prefix ys xs"
   4.288    using assms unfolding parallel_def by blast
   4.289  
   4.290 -theorem prefixeq_cases:
   4.291 -  obtains "prefixeq xs ys" | "prefix ys xs" | "xs \<parallel> ys"
   4.292 -  unfolding parallel_def prefix_def by blast
   4.293 +theorem prefix_cases:
   4.294 +  obtains "prefix xs ys" | "strict_prefix ys xs" | "xs \<parallel> ys"
   4.295 +  unfolding parallel_def strict_prefix_def by blast
   4.296  
   4.297  theorem parallel_decomp:
   4.298    "xs \<parallel> ys \<Longrightarrow> \<exists>as b bs c cs. b \<noteq> c \<and> xs = as @ b # bs \<and> ys = as @ c # cs"
   4.299 @@ -221,13 +221,13 @@
   4.300  next
   4.301    case (snoc x xs)
   4.302    show ?case
   4.303 -  proof (rule prefixeq_cases)
   4.304 -    assume le: "prefixeq xs ys"
   4.305 +  proof (rule prefix_cases)
   4.306 +    assume le: "prefix xs ys"
   4.307      then obtain ys' where ys: "ys = xs @ ys'" ..
   4.308      show ?thesis
   4.309      proof (cases ys')
   4.310        assume "ys' = []"
   4.311 -      then show ?thesis by (metis append_Nil2 parallelE prefixeqI snoc.prems ys)
   4.312 +      then show ?thesis by (metis append_Nil2 parallelE prefixI snoc.prems ys)
   4.313      next
   4.314        fix c cs assume ys': "ys' = c # cs"
   4.315        have "x \<noteq> c" using snoc.prems ys ys' by fastforce
   4.316 @@ -235,8 +235,8 @@
   4.317          using ys ys' by blast
   4.318      qed
   4.319    next
   4.320 -    assume "prefix ys xs"
   4.321 -    then have "prefixeq ys (xs @ [x])" by (simp add: prefix_def)
   4.322 +    assume "strict_prefix ys xs"
   4.323 +    then have "prefix ys (xs @ [x])" by (simp add: strict_prefix_def)
   4.324      with snoc have False by blast
   4.325      then show ?thesis ..
   4.326    next
   4.327 @@ -252,7 +252,7 @@
   4.328  lemma parallel_append: "a \<parallel> b \<Longrightarrow> a @ c \<parallel> b @ d"
   4.329    apply (rule parallelI)
   4.330      apply (erule parallelE, erule conjE,
   4.331 -      induct rule: not_prefixeq_induct, simp+)+
   4.332 +      induct rule: not_prefix_induct, simp+)+
   4.333    done
   4.334  
   4.335  lemma parallel_appendI: "xs \<parallel> ys \<Longrightarrow> x = xs @ xs' \<Longrightarrow> y = ys @ ys' \<Longrightarrow> x \<parallel> y"
   4.336 @@ -327,14 +327,14 @@
   4.337      by (induct zs) (auto intro!: suffixeq_appendI suffixeq_ConsI)
   4.338  qed
   4.339  
   4.340 -lemma suffixeq_to_prefixeq [code]: "suffixeq xs ys \<longleftrightarrow> prefixeq (rev xs) (rev ys)"
   4.341 +lemma suffixeq_to_prefix [code]: "suffixeq xs ys \<longleftrightarrow> prefix (rev xs) (rev ys)"
   4.342  proof
   4.343    assume "suffixeq xs ys"
   4.344    then obtain zs where "ys = zs @ xs" ..
   4.345    then have "rev ys = rev xs @ rev zs" by simp
   4.346 -  then show "prefixeq (rev xs) (rev ys)" ..
   4.347 +  then show "prefix (rev xs) (rev ys)" ..
   4.348  next
   4.349 -  assume "prefixeq (rev xs) (rev ys)"
   4.350 +  assume "prefix (rev xs) (rev ys)"
   4.351    then obtain zs where "rev ys = rev xs @ zs" ..
   4.352    then have "rev (rev ys) = rev zs @ rev (rev xs)" by simp
   4.353    then have "ys = rev zs @ xs" by simp
   4.354 @@ -379,10 +379,10 @@
   4.355    qed
   4.356  qed
   4.357  
   4.358 -lemma parallelD1: "x \<parallel> y \<Longrightarrow> \<not> prefixeq x y"
   4.359 +lemma parallelD1: "x \<parallel> y \<Longrightarrow> \<not> prefix x y"
   4.360    by blast
   4.361  
   4.362 -lemma parallelD2: "x \<parallel> y \<Longrightarrow> \<not> prefixeq y x"
   4.363 +lemma parallelD2: "x \<parallel> y \<Longrightarrow> \<not> prefix y x"
   4.364    by blast
   4.365  
   4.366  lemma parallel_Nil1 [simp]: "\<not> x \<parallel> []"
   4.367 @@ -395,7 +395,7 @@
   4.368    by auto
   4.369  
   4.370  lemma Cons_parallelI2: "\<lbrakk> a = b; as \<parallel> bs \<rbrakk> \<Longrightarrow> a # as \<parallel> b # bs"
   4.371 -  by (metis Cons_prefixeq_Cons parallelE parallelI)
   4.372 +  by (metis Cons_prefix_Cons parallelE parallelI)
   4.373  
   4.374  lemma not_equal_is_parallel:
   4.375    assumes neq: "xs \<noteq> ys"
     5.1 --- a/src/HOL/Unix/Unix.thy	Mon May 23 15:30:13 2016 +0200
     5.2 +++ b/src/HOL/Unix/Unix.thy	Mon May 23 22:43:11 2016 +0200
     5.3 @@ -924,7 +924,7 @@
     5.4      with tr obtain opt where root': "root' = update (path_of x) opt root"
     5.5        by cases auto
     5.6      show ?thesis
     5.7 -    proof (rule prefixeq_cases)
     5.8 +    proof (rule prefix_cases)
     5.9        assume "path_of x \<parallel> path"
    5.10        with inv root'
    5.11        have "\<And>perms. access root' path user\<^sub>1 perms = access root path user\<^sub>1 perms"
    5.12 @@ -932,7 +932,7 @@
    5.13        with inv show "invariant root' path"
    5.14          by (simp only: invariant_def)
    5.15      next
    5.16 -      assume "prefixeq (path_of x) path"
    5.17 +      assume "prefix (path_of x) path"
    5.18        then obtain ys where path: "path = path_of x @ ys" ..
    5.19  
    5.20        show ?thesis
    5.21 @@ -969,7 +969,7 @@
    5.22            by (simp only: invariant_def access_def)
    5.23        qed
    5.24      next
    5.25 -      assume "prefix path (path_of x)"
    5.26 +      assume "strict_prefix path (path_of x)"
    5.27        then obtain y ys where path: "path_of x = path @ y # ys" ..
    5.28  
    5.29        obtain dir' where