equal
deleted
inserted
replaced
993 |
993 |
994 lemma last_appendR[simp]: "ys \<noteq> [] \<Longrightarrow> last(xs @ ys) = last ys" |
994 lemma last_appendR[simp]: "ys \<noteq> [] \<Longrightarrow> last(xs @ ys) = last ys" |
995 by(simp add:last_append) |
995 by(simp add:last_append) |
996 |
996 |
997 |
997 |
|
998 lemma hd_rev: "xs \<noteq> [] \<Longrightarrow> hd(rev xs) = last xs" |
|
999 by(rule rev_exhaust[of xs]) simp_all |
|
1000 |
|
1001 lemma last_rev: "xs \<noteq> [] \<Longrightarrow> last(rev xs) = hd xs" |
|
1002 by(cases xs) simp_all |
|
1003 |
|
1004 |
998 lemma length_butlast [simp]: "length (butlast xs) = length xs - 1" |
1005 lemma length_butlast [simp]: "length (butlast xs) = length xs - 1" |
999 by (induct xs rule: rev_induct) auto |
1006 by (induct xs rule: rev_induct) auto |
1000 |
1007 |
1001 lemma butlast_append: |
1008 lemma butlast_append: |
1002 "!!ys. butlast (xs @ ys) = (if ys = [] then butlast xs else xs @ butlast ys)" |
1009 "!!ys. butlast (xs @ ys) = (if ys = [] then butlast xs else xs @ butlast ys)" |