【问题标题】:How do I write a custom induction rule over a parameterized inductive set?如何在参数化归纳集上编写自定义归纳规则?
【发布时间】:2018-03-24 14:10:39
【问题描述】:

我正在尝试为归纳集编写自定义归纳规则。不幸的是,当我尝试使用induction rule: my_induct_rule 应用它时,我得到了一个额外的、无法证明的案例。我有以下内容:

inductive iterate :: "('a ⇒ 'a ⇒ bool) ⇒ 'a ⇒ 'a ⇒ bool" for f where
  iter_refl [simp]: "iterate f a a"
| iter_step [elim]: "f a b ⟹ iterate f b c ⟹ iterate f a c"

theorem my_iterate_induct: "iterate f x y ⟹ (⋀a. P a a) ⟹ 
    (⋀a b c. f a b ⟹ iterate f b c ⟹ P b c ⟹ P a c) ⟹ P x y"
  by (induction x y rule: iterate.induct) simp_all

lemma iter_step_backwards: "iterate f a b ⟹ f b c ⟹ iterate f a c"
  proof (induction a b rule: my_iterate_induct)
    ...
  qed

显然,自定义归纳规则并没有给我任何新的力量(我的实际用例更复杂),但这就是重点。 my_iterate_induct 与自动生成的 iterate.induct 规则完全相同,据我所知,但在证明块内我有以下目标:

goal (3 subgoals):
 1. iterate ?f a b
 2. ⋀a. iterate f a a ⟹ f a c ⟹ iterate f a c
 3. ⋀a b ca. ?f a b ⟹ iterate ?f b ca ⟹ 
      (iterate f b ca ⟹ f ca c ⟹ iterate f b c) ⟹ iterate f a ca ⟹ 
        f ca c ⟹ iterate f a c

目标 1 似乎是由于未能将 ?f 与实际参数 f 统一起来,但如果我忽略 f 是固定的事实并尝试induction f a b rule: my_iterate_induct,我只会得到Failed to apply proof method,正如预期的那样。如何获得常规 iterate.induct 提供的良好行为?

【问题讨论】:

    标签: isabelle induction


    【解决方案1】:

    您需要使用consumes 属性将您的自定义归纳规则声明为“消耗”一个前提(请参阅 Isabelle/Isar 参考手册,第 6.5.1 节):

    theorem my_iterate_induct [consumes 1]: "iterate f x y ⟹ (⋀a. P a a) ⟹ 
       (⋀a b c. f a b ⟹ iterate f b c ⟹ P b c ⟹ P a c) ⟹ P x y"
      by (induction x y rule: iterate.induct) simp_all
    

    【讨论】:

    • 美丽。我猜这也会让case_names 的名字排成一行?谢谢!
    • “排队”是什么意思?一般来说,如果你想为你的案例命名,我认为你必须在自定义归纳规则中添加一个“case_names”属性。
    • 好吧,只是当我输入[case_names: iter_refl iter_step] 时,它们没有附加到正确的案例中,因为一开始就有额外的案例。输入[consumes 1, case_names: iter_refl iter_step] 确实有效。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-28
    • 2016-12-11
    • 2017-11-13
    • 2016-05-26
    • 2019-06-28
    相关资源
    最近更新 更多