How to prove lemmas for mutually recursive types?

╄→гoц情女王★ 提交于 2019-12-24 08:19:07

问题


Here is a sample theory:

datatype t1 = A | B t2
     and t2 = C | D t1

inductive rel1 and rel2 where
  "rel1 A 0"
| "rel2 x n ⟹
   rel1 (B x) n"
| "rel2 C 1"
| "rel1 x n ⟹
   rel2 (D x) n"

lemma rel1_det:
  "rel1 x n ⟹ rel1 x m ⟹ n = m"
  apply (induct x, auto)
  apply (simp add: rel1.simps)
  apply (simp add: rel1.simps)

I'm trying to prove, that rel1 is deterministic. But it seems that I can't use a simple induction. Could you suggest what tactics to use to prove such lemmas?


回答1:


For mutually dependent types, proofs use mutually dependent induction. So, the lemma is going to have two claims as well:

lemma
    rel1_det: "rel1 x n ⟹ rel1 x m ⟹ n = (m::nat)" and
    rel2_det: "rel2 y p ⟹ rel2 y q ⟹ p = (q::nat)"
        apply (induction x and y arbitrary: n m and p q)
        apply (simp add: rel1.simps)+
        apply (simp add: rel2.simps)+
    done


来源:https://stackoverflow.com/questions/53905744/how-to-prove-lemmas-for-mutually-recursive-types

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!