这是一个简单的归纳关系:
datatype t1 = A t1 t1 | B
datatype t2 = C t2 t2 | D
inductive P :: "t1 ⇒ t2 ⇒ bool" where
"P x1 y1 ⟹ P x2 y2 ⟹ P (A x1 x2) (C y1 y2)" |
"P B D"
lemma P_fun:
"P x y ⟹ P x z ⟹ y = z"
apply (erule P.cases)
你能否建议如何证明对于同一个参数,它总会给出相同的第二个参数?
答案 0 :(得分:1)
我会在第一个前提P x y
上进行归纳,然后针对每个归纳案例对第二个前提P x z
进行案例分析。当然,你需要概括归纳中第二个前提的z
,这总共产生了以下证据:
lemma P_fun:
"P x y ⟹ P x z ⟹ y = z"
proof (induct x y arbitrary: z rule: P.induct)
case (1 x1 y1 x2 y2)
from `P (A x1 x2) z` obtain z1 z2
where "z = C z1 z2" "P x1 z1" "P x2 z2" by (cases, auto)
with 1 show ?case by auto
next
case 2
then show ?case by (cases, auto)
qed