gpt4 book ai didi

syntax - Coq 介绍语法

转载 作者:行者123 更新时间:2023-12-05 03:14:45 26 4
gpt4 key购买 nike

有人可以解释一下下面的 intros 语法吗?

Lemma is_single_nBTP : forall t, is_single_nBT t = true -> exists n : nat, t = Leaf n.
Proof.
intros [ nleaf | nnode t1 t2] h.
exists nleaf.
reflexivity.
...

其中nBT是nat二叉树,is_single_nBT是一个函数,当ttrue时返回true一片叶子。

(这个例子来自这个lecture。)

最佳答案

[A | B] 是一个析取模式。这与函数式编程语言中的案例分析是相同的思想。

在这种情况下,您要创建两个子目标。一个已知 t 是一个以自然数 nleaf 作为参数的叶子,另一个是 t 作为 引入的带有参数 nnodet1t2 的节点

另一种说法 h : is_single_nBT ? = true 被引入,其中 ?Leaf nleafNode nnode t1 t2

关于syntax - Coq 介绍语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22998210/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com