这是我尝试定义diffb。 diff x y y返回true,如果x<> y,否则为假。
Definition diffb (b c : bool) : bool :=
match b, c with
| true, false => true
| false, true => true
| false, false => false
| true, true => false
end.
我上面已经尝试定义diffb,虽然我不确定它是否正确:(,我还需要证明diffb:
Theorem diffb_correct : forall a b : bool,
a <> b <-> diffb a b = true.
虽然在我的子目标中出现diffb时我不知道该怎么办。
感谢
卢西奥
修改。解决了它:))
这里是
Definition diffb (b c : bool) : bool :=
match b, c with
| true, false => true
| false, true => true
| false, false => false
| true, true => false
end.
(*现在证明你的功能符合规范。*)
Theorem diffb_correct : forall a b : bool,
a <> b <-> diffb a b = true.
intro a.
destruct a.
intro b.
destruct b.
split.
intro c.
destruct c.
reflexivity.
intro d.
discriminate.
split.
intro e.
reflexivity.
intro f.
discriminate.
intro g.
destruct g.
split.
intro h.
reflexivity.
discriminate.
split.
intro i.
destruct i.
reflexivity.
discriminate.
Qed.
答案 0 :(得分:0)
您的diffb
功能似乎完全正常。由于它是通过对其论证的案例分析来定义的,因此您的证明必须遵循相同的路径。我会给你两个建议,而不是一个完整的脚本:
case
和destruct
。unfold
或simpl
按其定义替换diffb
并在分析后对其进行简化。干杯, 诉