
wenzelm@10330: (*  Title:      HOL/Library/List_Prefix.thy
wenzelm@10330:     ID:         $Id$
wenzelm@10330:     Author:     Tobias Nipkow and Markus Wenzel, TU Muenchen
wenzelm@10330: *)
wenzelm@10330: 
wenzelm@14706: header {* List prefixes and postfixes *}
wenzelm@10330: 
nipkow@15131: theory List_Prefix
haftmann@25595: imports List
nipkow@15131: begin
wenzelm@10330: 
wenzelm@10330: subsection {* Prefix order on lists *}
wenzelm@10330: 
haftmann@25764: instantiation list :: (type) order
haftmann@25764: begin
haftmann@25764: 
haftmann@25764: definition
haftmann@25764:   prefix_def [code func del]: "xs \<le> ys = (\<exists>zs. ys = xs @ zs)"
wenzelm@10330: 
haftmann@25764: definition
haftmann@25764:   strict_prefix_def [code func del]: "xs < ys = (xs \<le> ys \<and> xs \<noteq> (ys::'a list))"
wenzelm@10330: 
haftmann@25764: instance
wenzelm@10389:   by intro_classes (auto simp add: prefix_def strict_prefix_def)
wenzelm@10330: 
haftmann@25764: end
haftmann@25764: 
wenzelm@10389: lemma prefixI [intro?]: "ys = xs @ zs ==> xs \<le> ys"
wenzelm@18730:   unfolding prefix_def by blast
wenzelm@10330: 
wenzelm@21305: lemma prefixE [elim?]:
wenzelm@21305:   assumes "xs \<le> ys"
wenzelm@21305:   obtains zs where "ys = xs @ zs"
wenzelm@23394:   using assms unfolding prefix_def by blast
wenzelm@10330: 
wenzelm@10870: lemma strict_prefixI' [intro?]: "ys = xs @ z # zs ==> xs < ys"
wenzelm@18730:   unfolding strict_prefix_def prefix_def by blast
wenzelm@10870: 
wenzelm@10870: lemma strict_prefixE' [elim?]:
wenzelm@21305:   assumes "xs < ys"
wenzelm@21305:   obtains z zs where "ys = xs @ z # zs"
wenzelm@10870: proof -
wenzelm@21305:   from `xs < ys` obtain us where "ys = xs @ us" and "xs \<noteq> ys"
wenzelm@18730:     unfolding strict_prefix_def prefix_def by blast
wenzelm@21305:   with that show ?thesis by (auto simp add: neq_Nil_conv)
wenzelm@10870: qed
wenzelm@10870: 
wenzelm@10389: lemma strict_prefixI [intro?]: "xs \<le> ys ==> xs \<noteq> ys ==> xs < (ys::'a list)"
wenzelm@18730:   unfolding strict_prefix_def by blast
wenzelm@10330: 
wenzelm@10389: lemma strict_prefixE [elim?]:
wenzelm@21305:   fixes xs ys :: "'a list"
wenzelm@21305:   assumes "xs < ys"
wenzelm@21305:   obtains "xs \<le> ys" and "xs \<noteq> ys"
wenzelm@23394:   using assms unfolding strict_prefix_def by blast
wenzelm@10330: 
wenzelm@10330: 
wenzelm@10389: subsection {* Basic properties of prefixes *}
wenzelm@10330: 
wenzelm@10330: theorem Nil_prefix [iff]: "[] \<le> xs"
wenzelm@10389:   by (simp add: prefix_def)
wenzelm@10330: 
wenzelm@10330: theorem prefix_Nil [simp]: "(xs \<le> []) = (xs = [])"
wenzelm@10389:   by (induct xs) (simp_all add: prefix_def)
wenzelm@10330: 
wenzelm@10330: lemma prefix_snoc [simp]: "(xs \<le> ys @ [y]) = (xs = ys @ [y] \<or> xs \<le> ys)"
wenzelm@10389: proof
wenzelm@10389:   assume "xs \<le> ys @ [y]"
wenzelm@10389:   then obtain zs where zs: "ys @ [y] = xs @ zs" ..
wenzelm@10389:   show "xs = ys @ [y] \<or> xs \<le> ys"
nipkow@25564:     by (metis append_Nil2 butlast_append butlast_snoc prefixI zs)
wenzelm@10389: next
wenzelm@10389:   assume "xs = ys @ [y] \<or> xs \<le> ys"
wenzelm@23254:   then show "xs \<le> ys @ [y]"
nipkow@25564:     by (metis order_eq_iff strict_prefixE strict_prefixI' xt1(7))
wenzelm@10389: qed
wenzelm@10330: 
wenzelm@10330: lemma Cons_prefix_Cons [simp]: "(x # xs \<le> y # ys) = (x = y \<and> xs \<le> ys)"
wenzelm@10389:   by (auto simp add: prefix_def)
wenzelm@10330: 
wenzelm@10330: lemma same_prefix_prefix [simp]: "(xs @ ys \<le> xs @ zs) = (ys \<le> zs)"
wenzelm@10389:   by (induct xs) simp_all
wenzelm@10330: 
wenzelm@10389: lemma same_prefix_nil [iff]: "(xs @ ys \<le> xs) = (ys = [])"
wenzelm@25692:   by (metis append_Nil2 append_self_conv order_eq_iff prefixI)
nipkow@25665: 
wenzelm@10330: lemma prefix_prefix [simp]: "xs \<le> ys ==> xs \<le> ys @ zs"
wenzelm@25692:   by (metis order_le_less_trans prefixI strict_prefixE strict_prefixI)
nipkow@25665: 
nipkow@14300: lemma append_prefixD: "xs @ ys \<le> zs \<Longrightarrow> xs \<le> zs"
wenzelm@17201:   by (auto simp add: prefix_def)
nipkow@14300: 
wenzelm@10330: theorem prefix_Cons: "(xs \<le> y # ys) = (xs = [] \<or> (\<exists>zs. xs = y # zs \<and> zs \<le> ys))"
wenzelm@10389:   by (cases xs) (auto simp add: prefix_def)
wenzelm@10330: 
wenzelm@10330: theorem prefix_append:
nipkow@25564:   "(xs \<le> ys @ zs) = (xs \<le> ys \<or> (\<exists>us. xs = ys @ us \<and> us \<le> zs))"
wenzelm@10330:   apply (induct zs rule: rev_induct)
wenzelm@10330:    apply force
wenzelm@10330:   apply (simp del: append_assoc add: append_assoc [symmetric])
nipkow@25564:   apply (metis append_eq_appendI)
wenzelm@10330:   done
wenzelm@10330: 
wenzelm@10330: lemma append_one_prefix:
nipkow@25564:   "xs \<le> ys ==> length xs < length ys ==> xs @ [ys ! length xs] \<le> ys"
wenzelm@25692:   unfolding prefix_def
wenzelm@25692:   by (metis Cons_eq_appendI append_eq_appendI append_eq_conv_conj
wenzelm@25692:     eq_Nil_appendI nth_drop')
nipkow@25665: 
wenzelm@10330: theorem prefix_length_le: "xs \<le> ys ==> length xs \<le> length ys"
wenzelm@10389:   by (auto simp add: prefix_def)
wenzelm@10330: 
nipkow@14300: lemma prefix_same_cases:
nipkow@25564:   "(xs\<^isub>1::'a list) \<le> ys \<Longrightarrow> xs\<^isub>2 \<le> ys \<Longrightarrow> xs\<^isub>1 \<le> xs\<^isub>2 \<or> xs\<^isub>2 \<le> xs\<^isub>1"
wenzelm@25692:   unfolding prefix_def by (metis append_eq_append_conv2)
nipkow@25665: 
nipkow@25564: lemma set_mono_prefix: "xs \<le> ys \<Longrightarrow> set xs \<subseteq> set ys"
wenzelm@25692:   by (auto simp add: prefix_def)
nipkow@14300: 
nipkow@25564: lemma take_is_prefix: "take n xs \<le> xs"
wenzelm@25692:   unfolding prefix_def by (metis append_take_drop_id)
nipkow@25665: 
wenzelm@25692: lemma map_prefixI: "xs \<le> ys \<Longrightarrow> map f xs \<le> map f ys"
wenzelm@25692:   by (auto simp: prefix_def)
kleing@25322: 
wenzelm@25692: lemma prefix_length_less: "xs < ys \<Longrightarrow> length xs < length ys"
wenzelm@25692:   by (auto simp: strict_prefix_def prefix_def)
nipkow@25665: 
kleing@25299: lemma strict_prefix_simps [simp]:
wenzelm@25692:     "xs < [] = False"
wenzelm@25692:     "[] < (x # xs) = True"
wenzelm@25692:     "(x # xs) < (y # ys) = (x = y \<and> xs < ys)"
wenzelm@25692:   by (simp_all add: strict_prefix_def cong: conj_cong)
kleing@25299: 
nipkow@25564: lemma take_strict_prefix: "xs < ys \<Longrightarrow> take n xs < ys"
wenzelm@25692:   apply (induct n arbitrary: xs ys)
wenzelm@25692:    apply (case_tac ys, simp_all)[1]
wenzelm@25692:   apply (metis order_less_trans strict_prefixI take_is_prefix)
wenzelm@25692:   done
kleing@25299: 
wenzelm@25355: lemma not_prefix_cases:
kleing@25299:   assumes pfx: "\<not> ps \<le> ls"
wenzelm@25356:   obtains
wenzelm@25356:     (c1) "ps \<noteq> []" and "ls = []"
wenzelm@25356:   | (c2) a as x xs where "ps = a#as" and "ls = x#xs" and "x = a" and "\<not> as \<le> xs"
wenzelm@25356:   | (c3) a as x xs where "ps = a#as" and "ls = x#xs" and "x \<noteq> a"
kleing@25299: proof (cases ps)
wenzelm@25692:   case Nil then show ?thesis using pfx by simp
kleing@25299: next
kleing@25299:   case (Cons a as)
wenzelm@25692:   note c = `ps = a#as`
kleing@25299:   show ?thesis
kleing@25299:   proof (cases ls)
wenzelm@25692:     case Nil then show ?thesis by (metis append_Nil2 pfx c1 same_prefix_nil)
kleing@25299:   next
kleing@25299:     case (Cons x xs)
kleing@25299:     show ?thesis
kleing@25299:     proof (cases "x = a")
wenzelm@25355:       case True
wenzelm@25355:       have "\<not> as \<le> xs" using pfx c Cons True by simp
wenzelm@25355:       with c Cons True show ?thesis by (rule c2)
wenzelm@25355:     next
wenzelm@25355:       case False
wenzelm@25355:       with c Cons show ?thesis by (rule c3)
kleing@25299:     qed
kleing@25299:   qed
kleing@25299: qed
kleing@25299: 
kleing@25299: lemma not_prefix_induct [consumes 1, case_names Nil Neq Eq]:
kleing@25299:   assumes np: "\<not> ps \<le> ls"
wenzelm@25356:     and base: "\<And>x xs. P (x#xs) []"
wenzelm@25356:     and r1: "\<And>x xs y ys. x \<noteq> y \<Longrightarrow> P (x#xs) (y#ys)"
wenzelm@25356:     and r2: "\<And>x xs y ys. \<lbrakk> x = y; \<not> xs \<le> ys; P xs ys \<rbrakk> \<Longrightarrow> P (x#xs) (y#ys)"
wenzelm@25356:   shows "P ps ls" using np
kleing@25299: proof (induct ls arbitrary: ps)
wenzelm@25355:   case Nil then show ?case
kleing@25299:     by (auto simp: neq_Nil_conv elim!: not_prefix_cases intro!: base)
kleing@25299: next
wenzelm@25355:   case (Cons y ys)
wenzelm@25355:   then have npfx: "\<not> ps \<le> (y # ys)" by simp
wenzelm@25355:   then obtain x xs where pv: "ps = x # xs"
kleing@25299:     by (rule not_prefix_cases) auto
nipkow@25564:   show ?case by (metis Cons.hyps Cons_prefix_Cons npfx pv r1 r2)
kleing@25299: qed
nipkow@14300: 
wenzelm@25356: 
wenzelm@10389: subsection {* Parallel lists *}
wenzelm@10389: 
wenzelm@19086: definition
wenzelm@21404:   parallel :: "'a list => 'a list => bool"  (infixl "\<parallel>" 50) where
wenzelm@19086:   "(xs \<parallel> ys) = (\<not> xs \<le> ys \<and> \<not> ys \<le> xs)"
wenzelm@10389: 
wenzelm@10389: lemma parallelI [intro]: "\<not> xs \<le> ys ==> \<not> ys \<le> xs ==> xs \<parallel> ys"
wenzelm@25692:   unfolding parallel_def by blast
wenzelm@10330: 
wenzelm@10389: lemma parallelE [elim]:
wenzelm@25692:   assumes "xs \<parallel> ys"
wenzelm@25692:   obtains "\<not> xs \<le> ys \<and> \<not> ys \<le> xs"
wenzelm@25692:   using assms unfolding parallel_def by blast
wenzelm@10330: 
wenzelm@10389: theorem prefix_cases:
wenzelm@25692:   obtains "xs \<le> ys" | "ys < xs" | "xs \<parallel> ys"
wenzelm@25692:   unfolding parallel_def strict_prefix_def by blast
wenzelm@10330: 
wenzelm@10389: theorem parallel_decomp:
wenzelm@10389:   "xs \<parallel> ys ==> \<exists>as b bs c cs. b \<noteq> c \<and> xs = as @ b # bs \<and> ys = as @ c # cs"
wenzelm@10408: proof (induct xs rule: rev_induct)
wenzelm@11987:   case Nil
wenzelm@23254:   then have False by auto
wenzelm@23254:   then show ?case ..
wenzelm@10408: next
wenzelm@11987:   case (snoc x xs)
wenzelm@11987:   show ?case
wenzelm@10408:   proof (rule prefix_cases)
wenzelm@10408:     assume le: "xs \<le> ys"
wenzelm@10408:     then obtain ys' where ys: "ys = xs @ ys'" ..
wenzelm@10408:     show ?thesis
wenzelm@10408:     proof (cases ys')
nipkow@25564:       assume "ys' = []"
wenzelm@25692:       then show ?thesis by (metis append_Nil2 parallelE prefixI snoc.prems ys)
wenzelm@10389:     next
wenzelm@10408:       fix c cs assume ys': "ys' = c # cs"
wenzelm@25692:       then show ?thesis
wenzelm@25692:         by (metis Cons_eq_appendI eq_Nil_appendI parallelE prefixI
wenzelm@25692:           same_prefix_prefix snoc.prems ys)
wenzelm@10389:     qed
wenzelm@10408:   next
wenzelm@23254:     assume "ys < xs" then have "ys \<le> xs @ [x]" by (simp add: strict_prefix_def)
wenzelm@11987:     with snoc have False by blast
wenzelm@23254:     then show ?thesis ..
wenzelm@10408:   next
wenzelm@10408:     assume "xs \<parallel> ys"
wenzelm@11987:     with snoc obtain as b bs c cs where neq: "(b::'a) \<noteq> c"
wenzelm@10408:       and xs: "xs = as @ b # bs" and ys: "ys = as @ c # cs"
wenzelm@10408:       by blast
wenzelm@10408:     from xs have "xs @ [x] = as @ b # (bs @ [x])" by simp
wenzelm@10408:     with neq ys show ?thesis by blast
wenzelm@10389:   qed
wenzelm@10389: qed
wenzelm@10330: 
nipkow@25564: lemma parallel_append: "a \<parallel> b \<Longrightarrow> a @ c \<parallel> b @ d"
wenzelm@25692:   apply (rule parallelI)
wenzelm@25692:     apply (erule parallelE, erule conjE,
wenzelm@25692:       induct rule: not_prefix_induct, simp+)+
wenzelm@25692:   done
kleing@25299: 
wenzelm@25692: lemma parallel_appendI: "xs \<parallel> ys \<Longrightarrow> x = xs @ xs' \<Longrightarrow> y = ys @ ys' \<Longrightarrow> x \<parallel> y"
wenzelm@25692:   by (simp add: parallel_append)
kleing@25299: 
wenzelm@25692: lemma parallel_commute: "a \<parallel> b \<longleftrightarrow> b \<parallel> a"
wenzelm@25692:   unfolding parallel_def by auto
oheimb@14538: 
wenzelm@25356: 
oheimb@14538: subsection {* Postfix order on lists *}
wenzelm@17201: 
wenzelm@19086: definition
wenzelm@21404:   postfix :: "'a list => 'a list => bool"  ("(_/ >>= _)" [51, 50] 50) where
wenzelm@19086:   "(xs >>= ys) = (\<exists>zs. xs = zs @ ys)"
oheimb@14538: 
wenzelm@21305: lemma postfixI [intro?]: "xs = zs @ ys ==> xs >>= ys"
wenzelm@25692:   unfolding postfix_def by blast
wenzelm@21305: 
wenzelm@21305: lemma postfixE [elim?]:
wenzelm@25692:   assumes "xs >>= ys"
wenzelm@25692:   obtains zs where "xs = zs @ ys"
wenzelm@25692:   using assms unfolding postfix_def by blast
wenzelm@21305: 
wenzelm@21305: lemma postfix_refl [iff]: "xs >>= xs"
wenzelm@14706:   by (auto simp add: postfix_def)
wenzelm@17201: lemma postfix_trans: "\<lbrakk>xs >>= ys; ys >>= zs\<rbrakk> \<Longrightarrow> xs >>= zs"
wenzelm@14706:   by (auto simp add: postfix_def)
wenzelm@17201: lemma postfix_antisym: "\<lbrakk>xs >>= ys; ys >>= xs\<rbrakk> \<Longrightarrow> xs = ys"
wenzelm@14706:   by (auto simp add: postfix_def)
oheimb@14538: 
wenzelm@17201: lemma Nil_postfix [iff]: "xs >>= []"
wenzelm@14706:   by (simp add: postfix_def)
wenzelm@17201: lemma postfix_Nil [simp]: "([] >>= xs) = (xs = [])"
wenzelm@21305:   by (auto simp add: postfix_def)
oheimb@14538: 
wenzelm@17201: lemma postfix_ConsI: "xs >>= ys \<Longrightarrow> x#xs >>= ys"
wenzelm@14706:   by (auto simp add: postfix_def)
wenzelm@17201: lemma postfix_ConsD: "xs >>= y#ys \<Longrightarrow> xs >>= ys"
wenzelm@14706:   by (auto simp add: postfix_def)
oheimb@14538: 
wenzelm@17201: lemma postfix_appendI: "xs >>= ys \<Longrightarrow> zs @ xs >>= ys"
wenzelm@14706:   by (auto simp add: postfix_def)
wenzelm@17201: lemma postfix_appendD: "xs >>= zs @ ys \<Longrightarrow> xs >>= ys"
wenzelm@21305:   by (auto simp add: postfix_def)
oheimb@14538: 
wenzelm@21305: lemma postfix_is_subset: "xs >>= ys ==> set ys \<subseteq> set xs"
wenzelm@21305: proof -
wenzelm@21305:   assume "xs >>= ys"
wenzelm@21305:   then obtain zs where "xs = zs @ ys" ..
wenzelm@21305:   then show ?thesis by (induct zs) auto
wenzelm@21305: qed
oheimb@14538: 
wenzelm@21305: lemma postfix_ConsD2: "x#xs >>= y#ys ==> xs >>= ys"
wenzelm@21305: proof -
wenzelm@21305:   assume "x#xs >>= y#ys"
wenzelm@21305:   then obtain zs where "x#xs = zs @ y#ys" ..
wenzelm@21305:   then show ?thesis
wenzelm@21305:     by (induct zs) (auto intro!: postfix_appendI postfix_ConsI)
wenzelm@21305: qed
oheimb@14538: 
wenzelm@21305: lemma postfix_to_prefix: "xs >>= ys \<longleftrightarrow> rev ys \<le> rev xs"
wenzelm@21305: proof
wenzelm@21305:   assume "xs >>= ys"
wenzelm@21305:   then obtain zs where "xs = zs @ ys" ..
wenzelm@21305:   then have "rev xs = rev ys @ rev zs" by simp
wenzelm@21305:   then show "rev ys <= rev xs" ..
wenzelm@21305: next
wenzelm@21305:   assume "rev ys <= rev xs"
wenzelm@21305:   then obtain zs where "rev xs = rev ys @ zs" ..
wenzelm@21305:   then have "rev (rev xs) = rev zs @ rev (rev ys)" by simp
wenzelm@21305:   then have "xs = rev zs @ ys" by simp
wenzelm@21305:   then show "xs >>= ys" ..
wenzelm@21305: qed
wenzelm@17201: 
nipkow@25564: lemma distinct_postfix: "distinct xs \<Longrightarrow> xs >>= ys \<Longrightarrow> distinct ys"
wenzelm@25692:   by (clarsimp elim!: postfixE)
kleing@25299: 
nipkow@25564: lemma postfix_map: "xs >>= ys \<Longrightarrow> map f xs >>= map f ys"
wenzelm@25692:   by (auto elim!: postfixE intro: postfixI)
kleing@25299: 
wenzelm@25356: lemma postfix_drop: "as >>= drop n as"
wenzelm@25692:   unfolding postfix_def
wenzelm@25692:   apply (rule exI [where x = "take n as"])
wenzelm@25692:   apply simp
wenzelm@25692:   done
kleing@25299: 
nipkow@25564: lemma postfix_take: "xs >>= ys \<Longrightarrow> xs = take (length xs - length ys) xs @ ys"
wenzelm@25692:   by (clarsimp elim!: postfixE)
kleing@25299: 
wenzelm@25356: lemma parallelD1: "x \<parallel> y \<Longrightarrow> \<not> x \<le> y"
wenzelm@25692:   by blast
kleing@25299: 
wenzelm@25356: lemma parallelD2: "x \<parallel> y \<Longrightarrow> \<not> y \<le> x"
wenzelm@25692:   by blast
wenzelm@25355: 
wenzelm@25355: lemma parallel_Nil1 [simp]: "\<not> x \<parallel> []"
wenzelm@25692:   unfolding parallel_def by simp
wenzelm@25355: 
kleing@25299: lemma parallel_Nil2 [simp]: "\<not> [] \<parallel> x"
wenzelm@25692:   unfolding parallel_def by simp
kleing@25299: 
nipkow@25564: lemma Cons_parallelI1: "a \<noteq> b \<Longrightarrow> a # as \<parallel> b # bs"
wenzelm@25692:   by auto
kleing@25299: 
nipkow@25564: lemma Cons_parallelI2: "\<lbrakk> a = b; as \<parallel> bs \<rbrakk> \<Longrightarrow> a # as \<parallel> b # bs"
wenzelm@25692:   by (metis Cons_prefix_Cons parallelE parallelI)
nipkow@25665: 
kleing@25299: lemma not_equal_is_parallel:
kleing@25299:   assumes neq: "xs \<noteq> ys"
wenzelm@25356:     and len: "length xs = length ys"
wenzelm@25356:   shows "xs \<parallel> ys"
kleing@25299:   using len neq
wenzelm@25355: proof (induct rule: list_induct2)
wenzelm@25356:   case 1
wenzelm@25356:   then show ?case by simp
kleing@25299: next
kleing@25299:   case (2 a as b bs)
wenzelm@25355:   have ih: "as \<noteq> bs \<Longrightarrow> as \<parallel> bs" by fact
kleing@25299:   show ?case
kleing@25299:   proof (cases "a = b")
wenzelm@25355:     case True
wenzelm@25355:     then have "as \<noteq> bs" using 2 by simp
wenzelm@25355:     then show ?thesis by (rule Cons_parallelI2 [OF True ih])
kleing@25299:   next
kleing@25299:     case False
wenzelm@25355:     then show ?thesis by (rule Cons_parallelI1)
kleing@25299:   qed
kleing@25299: qed
haftmann@22178: 
wenzelm@25355: 
wenzelm@25356: subsection {* Executable code *}
haftmann@22178: 
haftmann@22178: lemma less_eq_code [code func]:
wenzelm@25356:     "([]\<Colon>'a\<Colon>{eq, ord} list) \<le> xs \<longleftrightarrow> True"
wenzelm@25356:     "(x\<Colon>'a\<Colon>{eq, ord}) # xs \<le> [] \<longleftrightarrow> False"
wenzelm@25356:     "(x\<Colon>'a\<Colon>{eq, ord}) # xs \<le> y # ys \<longleftrightarrow> x = y \<and> xs \<le> ys"
haftmann@22178:   by simp_all
haftmann@22178: 
haftmann@22178: lemma less_code [code func]:
wenzelm@25356:     "xs < ([]\<Colon>'a\<Colon>{eq, ord} list) \<longleftrightarrow> False"
wenzelm@25356:     "[] < (x\<Colon>'a\<Colon>{eq, ord})# xs \<longleftrightarrow> True"
wenzelm@25356:     "(x\<Colon>'a\<Colon>{eq, ord}) # xs < y # ys \<longleftrightarrow> x = y \<and> xs < ys"
haftmann@22178:   unfolding strict_prefix_def by auto
haftmann@22178: 
haftmann@22178: lemmas [code func] = postfix_to_prefix
haftmann@22178: 
wenzelm@10330: end




