Case analysis on function definition in Isabelle

旧时模样 提交于 2020-04-30 08:33:31

问题


Imagine I have a function definition with three cases:

function f where 
    eq1 if cond1 
  | eq2 if cond2
  | eq3 if cond3

How can I prove some equation:

f x y = f y x

using case analysis on the left-hand side?

Just writing apply(cases f.cases) does not work for me. I get an error

Undefined constant: "f"⌂


回答1:


I decided to post my comment as an answer in an attempt to close this issue.

For your use case, it should be possible to use apply(cases ‹(x, y)› rule: f.cases) (or similar). However, it would help to see a minimal working example before one can confirm this.

For further information about the method cases see section 6.5.2 "Proof methods" in Isar-ref.




回答2:


In order to complement user9716869's answer, here's a minimal working example:

function f where
  "f x y = 0" if "x = y" | 
  "f x y = Suc 0" if "x ≠ y"
by auto
termination by lexicographic_order

lemma "f x y = f y x"
proof (cases ‹(x, y)› rule: f.cases)
  case (1 x y)
  then show ?thesis
    by simp
next
  case (2 x y)
  then show ?thesis
    by simp
qed



来源:https://stackoverflow.com/questions/60683091/case-analysis-on-function-definition-in-isabelle

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