如何使用Isar证明淘汰规则?

时间:2018-12-13 06:37:10

标签: isabelle

这是一个简单的理论:

datatype t1 = A | B | C
datatype t2 = D | E t1 | F | G

inductive R where
  "R A B"
| "R B C"

inductive_cases [elim]: "R x B" "R x A" "R x C"

inductive S where
  "S D (E _)"
| "R x y ⟹ S (E x) (E y)"

inductive_cases [elim]: "S x D" "S x (E y)"

我可以使用两个辅助引理证明引理elim

lemma tranclp_S_x_E:
  "S⇧+⇧+ x (E y) ⟹ x = D ∨ (∃z. x = E z)"
  by (induct rule: converse_tranclp_induct; auto)

(* Let's assume that it's proven *)
lemma reflect_tranclp_E:
  "S⇧+⇧+ (E x) (E y) ⟹ R⇧+⇧+ x y"
  sorry

lemma elim:
  "S⇧+⇧+ x (E y) ⟹
   (x = D ⟹ P) ⟹ (⋀z. x = E z ⟹ R⇧+⇧+ z y ⟹ P) ⟹ P"
  using reflect_tranclp_E tranclp_S_x_E by blast

我需要使用Isar证明elim

lemma elim:
  assumes "S⇧+⇧+ x (E y)"
    shows "(x = D ⟹ P) ⟹ (⋀z. x = E z ⟹ R⇧+⇧+ z y ⟹ P) ⟹ P"
proof -
  assume "S⇧+⇧+ x (E y)"
  then obtain z where "x = D ∨ x = E z"
    by (induct rule: converse_tranclp_induct; auto)
  also have "S⇧+⇧+ (E z) (E y) ⟹ R⇧+⇧+ z y"
    sorry
  finally show ?thesis

但是我遇到以下错误:

No matching trans rules for calculation:
    x = D ∨ x = E z
    S⇧+⇧+ (E z) (E y) ⟹ R⇧+⇧+ z y

Failed to refine any pending goal 
Local statement fails to refine any pending goal
Failed attempt to solve goal by exported rule:
  (S⇧+⇧+ x (E y)) ⟹ P

如何修复它们?

我想这个引理可以有一个更简单的证明。但是我需要分两步证明它:

  1. 显示x的可能值
  2. 表明E反映了传递闭包

我还认为,可以通过x上的案例证明这一引理。但是我的真实数据类型有太多情况。因此,这不是首选的解决方案。

1 个答案:

答案 0 :(得分:0)

此变体似乎有效:

lemma elim:
  assumes "S⇧+⇧+ x (E y)"
      and "x = D ⟹ P"
      and "⋀z. x = E z ⟹ R⇧+⇧+ z y ⟹ P"
    shows "P"
proof -
  have "S⇧+⇧+ x (E y)" by (simp add: assms(1))
  then obtain z where "x = D ∨ x = E z"
    by (induct rule: converse_tranclp_induct; auto)
  moreover
  have "S⇧+⇧+ (E z) (E y) ⟹ R⇧+⇧+ z y"
    sorry
  ultimately show ?thesis
    using assms by auto
qed
  • 假设应该与目标分开。
  • 首先,我应该使用have而不是assume。这不是一个新的假设,只是一个现有的假设。
  • 我应该使用finally而不是ultimately。似乎后一种具有更简单的应用程序逻辑。
相关问题