【发布时间】:2019-03-05 21:14:43
【问题描述】:
我之前提出过一个问题,但我认为这个问题形式化不好,所以...... 我在使用这个特定定义来证明它们的属性时遇到了一些问题:
我有一个列表的定义:
Inductive list (A : Type) (f : A -> A -> A) : A -> Type :=
|Acons : forall {x : A} (y' : A) (cons' : list f x), list f (f x y')
|Anil : forall (x: A) (y : A), list f (f x y).
这就是定义:
Definition t_list (T : Type) := (T -> T -> T) -> T -> T.
Definition nil {A : Type} (f : A -> A -> A) (d : A) := d.
Definition cons {A : Type} (v' : A) (c_cons : t_list _) (f : A -> A -> A) (v'' : A) :=
f (c_cons f v'') v'.
Fixpoint list_correspodence (A : Type) (v' : A) (z : A -> A -> A) (xs : list func v'):=
let fix curry_list {y : A} {z' : A -> A -> A} (l : list z' y) :=
match l with
|Acons x y => cons x (curry_list y)
|Anil _ _ y => cons y nil
end in (@curry_list _ _ xs) z (let fix minimal_case {y' : A} {functor : A -> A -> A} (a : list functor y') {struct a} :=
match a with
|Acons x y => minimal_case y
|Anil _ x _ => x
end in minimal_case xs).
Theorem z_next_list_coorresp : forall {A} (z : A -> A -> A) (x y' : A) (x' : list z x), z (list_correspodence x') y' = list_correspodence (Acons y' x').
intros.
generalize (Acons y' x').
intros.
unfold list_correspodence.
(*reflexivity should works ?*)
Qed.
z_next_list_coorres 实际上是一个引理,我需要在另一个理论中证明一个目标 (v'_list x = (list_correspodence x))。
我一直在尝试使用一些有限的范围来证明 list_correspodence 并且效果很好,似乎定义是相等的,但对于 coq 却不是。
【问题讨论】:
-
由于某种原因,将变量
A重用为类型和列表,这让我很难理解这个程序。将curry_list和minimal_case提升为顶级Fixpoint也有助于提高可读性,而不是像这里那样使它们成为本地函数。
标签: coq proof dependent-type proof-of-correctness church-encoding