【发布时间】:2021-10-11 17:58:25
【问题描述】:
我有以下 Isar 风格的证明:
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
我试图通过首先在归纳中显示下半部分来将其转换为apply 样式。这是我的尝试之一:
lemma "map f (intersperse a (x # xs)) = intersperse (f a) (map f (x # xs))"
apply(cases xs)
apply(simp)
apply(auto) using Cons.IH
但是这里的最后一行似乎不是有效的语法。我也试过了
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)
然后我收到错误Undefined fact: "Cons.IH"。
将“使用”语句转换为应用样式证明的正确语法是什么?
【问题讨论】:
标签: isabelle