coq - 如何避免真=假条件
问题描述
我正在使用标准库中的函数(list_max l)并证明以下引理。我在以下几点面临问题,请指导我。
Fixpoint g_fun (l : list nat) :=
match l with
| nil => 1
| b::nil=> b
| b::t => gcd b (g_fun t)
end.
Lemma gc1: forall (l : list nat),
l<>nil -> list_max l = 0-> g_fun l=0.
Proof.
intros. induction l. unfold g_fun.
解决方案
I haven't tried it, but I think I would prove two auxiliary lemmas first:
- if
list_max l = 0
, thenl
is a list with only zeros [EDIT: orl
is empty]; proving this will likely go throughlist_max_le
. g_fun [n; n; ...; n] = g_fun [n]
; this should be a simple induction together withNat.gcd_diag
.
If l
is empty, your lemma is actually false, because list_max nil = 0
and g_fun nil = 1
. Otherwise the lemma is an easy corollary of these two facts.
推荐阅读
- android - 权限对话框未在 android 中显示
- python - 如何使用 Ctypes 和 kernel32.dll 将 Python 脚本添加到注册表
- python-3.x - PYTHON3:打印一组随机整数有时会得到排序输出,有时会得到未排序输出!为什么?
- python - 使用列表项索引作为python中另一个列表的索引
- docker - Docker DNS 忽略主机上的 /etc/nsswitch.conf
- sql - Postgresql数据库中分母最小公倍数的计算
- oracle - SQL 错误:ORA-00904 "SYS"."DBMS_CRYPTO"."HASH": 在 Oracle12C 中更新表时出现无效标识符错误
- clojure - 在clojure中使用变量作为dict键
- curl - 如何在 jenkinsfile 中显示 curl http 返回状态
- r - modelvalid:用于 GmAMisc 中的二进制 Logistic 回归内部验证的 R 函数:“Gianmarco Alberti”