I have the following proof in Isar style:
fun intersperse :: "'a ⇒ 'a list ⇒ 'a list" where
"intersperse _ [] = []" |
"intersperse _ [x] = [x]" |
"intersperse a (x#xs) = x#a#(intersperse a xs)"
lemma "map f (intersperse a xs) = intersperse (f a) (map f xs)"
proof (induction xs)
case Nil
then show ?case by auto
next
case (Cons x xs)
thus ?case
proof (cases xs)
case Nil
then show ?thesis by simp
next
case (Cons y ys)
then show ?thesis using Cons.IH by auto
qed
qed
I have attempted to convert this to apply style by first showing the second half in the induction. Here is one of my tries:
lemma "map f (intersperse a (x # xs)) = intersperse (f a) (map f (x # xs))"
apply(cases xs)
apply(simp)
apply(auto) using Cons.IH
However the last line here doesn't appear to be valid syntax. I also tried
lemma "map f (intersperse a (x # xs)) = intersperse (f a) (map f (x # xs))"
apply(cases xs)
apply(simp)
apply(auto simp add: Cons.IH)
However then I get the error Undefined fact: "Cons.IH".
What is the correct syntax for converting a "using" statement to an apply style proof?