logic - 如何在 Coq 中证明逻辑等价?
问题描述
如何使用 Coq 证明以下内容?
(q V p) ∧ (¬p -> q) <-> (p V q)。
我的尝试
Lemma work: (forall p q: Prop, (q \/ p)/\(~p -> q) <-> (p \/ q)).
Proof.
intros p q.
split.
intros q_or_p_and_not_p_implies_q.
intros p_or_q.
split.
解决方案
这是一个非常相似的陈述的证明。p \/ q
为了q \/ p
匹配您给出的语句,需要做更多的工作来交换第一个。
Theorem work : (forall p q : Prop, (p \/ q) /\ (~p -> q) <-> (p \/ q)).
Proof.
intros p q.
split.
(* Prove the "->" direction *)
intros given.
destruct given as [p_or_q _].
exact p_or_q.
(* Prove the "<-" direction *)
intros p_or_q.
refine (conj p_or_q _).
case p_or_q.
(* We're given that p is true, so ~p implies anything *)
intros p_true p_false.
case (p_false p_true).
(* We're given that q is true *)
intros q_true p_false.
exact q_true.
Qed.
推荐阅读
- python - Django 覆盖范围不包括 APITestCase 测试
- python - 无法更新 Kivy-Mapview Python 上的标记
- azure-data-factory - 对于以 ADX 作为源的复制活动,ADF 不支持以 MB (100) 为单位的接收器块大小
- mysql - 使用 CONCAT 的 SQL 中的 CASE WHEN
- vuejs2 - axios.delete() 419 未知状态
- python-3.x - issubclass(typing.List, list) 引发 TypeError
- node.js - 尝试使用旧节点版本来实现 Firebase 兼容性
- python-3.x - 从谷歌分析python API查询“屏幕时间”指标
- swift - Xcode 不会跳转到构建失败
- sql - 对多行的 JSON 属性求和