src/HOL/Library/More_List.thy
changeset 75008 43b3d5318d72
parent 71420 572ab9e64e18
equal deleted inserted replaced
75007:2e16798b6f2b 75008:43b3d5318d72
    89 
    89 
    90 definition no_leading :: "('a \<Rightarrow> bool) \<Rightarrow> 'a list \<Rightarrow> bool"
    90 definition no_leading :: "('a \<Rightarrow> bool) \<Rightarrow> 'a list \<Rightarrow> bool"
    91 where
    91 where
    92   "no_leading P xs \<longleftrightarrow> (xs \<noteq> [] \<longrightarrow> \<not> P (hd xs))"
    92   "no_leading P xs \<longleftrightarrow> (xs \<noteq> [] \<longrightarrow> \<not> P (hd xs))"
    93 
    93 
    94 lemma no_leading_Nil [simp, intro!]:
    94 lemma no_leading_Nil [iff]:
    95   "no_leading P []"
    95   "no_leading P []"
    96   by (simp add: no_leading_def)
    96   by (simp add: no_leading_def)
    97 
    97 
    98 lemma no_leading_Cons [simp, intro!]:
    98 lemma no_leading_Cons [iff]:
    99   "no_leading P (x # xs) \<longleftrightarrow> \<not> P x"
    99   "no_leading P (x # xs) \<longleftrightarrow> \<not> P x"
   100   by (simp add: no_leading_def)
   100   by (simp add: no_leading_def)
   101 
   101 
   102 lemma no_leading_append [simp]:
   102 lemma no_leading_append [simp]:
   103   "no_leading P (xs @ ys) \<longleftrightarrow> no_leading P xs \<and> (xs = [] \<longrightarrow> no_leading P ys)"
   103   "no_leading P (xs @ ys) \<longleftrightarrow> no_leading P xs \<and> (xs = [] \<longrightarrow> no_leading P ys)"
   146 
   146 
   147 lemma no_trailing_unfold:
   147 lemma no_trailing_unfold:
   148   "no_trailing P xs \<longleftrightarrow> (xs \<noteq> [] \<longrightarrow> \<not> P (last xs))"
   148   "no_trailing P xs \<longleftrightarrow> (xs \<noteq> [] \<longrightarrow> \<not> P (last xs))"
   149   by (induct xs) simp_all
   149   by (induct xs) simp_all
   150 
   150 
   151 lemma no_trailing_Nil [simp, intro!]:
   151 lemma no_trailing_Nil [iff]:
   152   "no_trailing P []"
   152   "no_trailing P []"
   153   by simp
   153   by simp
   154 
   154 
   155 lemma no_trailing_Cons [simp]:
   155 lemma no_trailing_Cons [simp]:
   156   "no_trailing P (x # xs) \<longleftrightarrow> no_trailing P xs \<and> (xs = [] \<longrightarrow> \<not> P x)"
   156   "no_trailing P (x # xs) \<longleftrightarrow> no_trailing P xs \<and> (xs = [] \<longrightarrow> \<not> P x)"