Isabelle 如何引用Isar中的当前子目标?
我试图从中解决练习4.7。 我遇到了一个案件,在这个案件中,我证明了我的错误,因此证明了一切,但我无法结案,因为我不知道如何引用我的证明义务Isabelle 如何引用Isar中的当前子目标?,isabelle,isar,Isabelle,Isar,我试图从中解决练习4.7。 我遇到了一个案件,在这个案件中,我证明了我的错误,因此证明了一切,但我无法结案,因为我不知道如何引用我的证明义务 theory ProgProveEx47 imports Main begin datatype alpha = a | b | c inductive S :: "alpha list ⇒ bool" where Nil: "S []" | Grow: "S xs ⟹ S ([a]@xs@[b])" | Append: "S xs ⟹
theory ProgProveEx47
imports Main
begin
datatype alpha = a | b | c
inductive S :: "alpha list ⇒ bool" where
Nil: "S []" |
Grow: "S xs ⟹ S ([a]@xs@[b])" |
Append: "S xs ⟹ S ys ⟹ S (xs@ys)"
fun balanced :: "nat ⇒ alpha list ⇒ bool" where
"balanced 0 [] = True" |
"balanced (Suc n) (b#xs) = balanced n xs" |
"balanced n (a#xs) = balanced (Suc n) xs" |
"balanced _ _ = False"
lemma
fixes n xs
assumes b: "balanced n xs"
shows "S (replicate n a @ xs)"
proof -
from b show ?thesis
proof (induction xs)
case Nil
hence "S (replicate n a)"
proof (induction n)
case 0
show ?case using S.Nil by simp
case (Suc n)
value ?case
from `balanced (Suc n) []` have False by simp
(* thus "S (replicate (Suc n) a)" by simp *)
(* thus ?case by simp *)
then show "⋀n. (balanced n [] ⟹ S (replicate n a)) ⟹ balanced (Suc n) [] ⟹ S (replicate (Suc n) a)" by simp
上次演出后的命题是从Isabelle/jedit中的证明状态复制而来的。但是,Isabelle报告了错误(在上次的show
):
被注释掉的证明目标现在导致了同样的错误。如果我将案例交换为0
和Suc
,则0
案例的最后一次show
会出现错误,但Suc
案例不再出现错误
有人能解释为什么伊莎贝尔不会接受这些看似正确的目标吗?我怎样才能以伊莎贝尔会接受的方式陈述子目标?是否有一个通用的方法来引用当前的子目标?我认为,考虑到我使用的结构,?case
应该可以完成这项工作,但显然不行
我发现了堆栈溢出问题,其中提到了相同的错误,但问题不同(定理有一个等价性,应该通过隐式应用规则
,将其分解为定向子目标)在我的例子中,应用提供的解决方案会导致不正确和无法实现的目标。在内部归纳证明中,您只是缺少了一个下一个
lemma
fixes n xs
assumes b: "balanced n xs"
shows "S (replicate n a @ xs)"
proof -
from b show ?thesis
proof (induction xs)
case Nil
hence "S (replicate n a)"
proof (induction n)
case 0
show ?case using S.Nil by simp
next (* this next was missing *)
case (Suc n)
show ?case sorry
qed
show ?case sorry
next
case (Cons a xs)
then show ?case sorry
qed
lemma
fixes n xs
assumes b: "balanced n xs"
shows "S (replicate n a @ xs)"
proof -
from b show ?thesis
proof (induction xs)
case Nil
hence "S (replicate n a)"
proof (induction n)
case 0
show ?case using S.Nil by simp
next (* this next was missing *)
case (Suc n)
show ?case sorry
qed
show ?case sorry
next
case (Cons a xs)
then show ?case sorry
qed