3
提供部分參數考慮本節:的例子
Section MyMap.
Variables D R : Type.
Fixpoint mymap (f : D -> R) (l : list D) : list R :=
match l with
| nil => nil
| d :: t => f d :: mymap f t
end.
End MyMap.
在這裏,我用Variables
聲明我的定義域和值域類型。由於我的函數的定義完整性檢查,我想包括Example
:
Example example_map_S : mymap S [0; 1; 2] = [1; 2; 3].
Proof.
simpl; trivial.
Qed.
但是似乎我無法將部分內這樣做。相反,我得到:
Error: The term "S" has type "nat -> nat" while it is expected to have type "D -> R".
這不是太奇怪,所以讓我們嘗試另一種方式:
Example example_map_S : @mymap nat nat S [0; 1; 2] = [1; 2; 3].
Proof.
simpl; trivial.
Qed.
主要生產:
Error: The term "nat" has type "Set" while it is expected to have type "D -> R".
我想這是公平的,部分-美化版Variables
AREN與隱含的論證不同。但它仍然留下了問題!
如何在結束本節之前提供混凝土Variables
以創建有用的Examples
?
AFAIK你不能。您必須先關閉該部分才能使參數被拉姆達提升。 – gallais
Boooooo。這顯然不是一個大問題,但將我的例子遠離他們的定義會傷害他們的實用性。 – phs
順便說一句,我認爲你想'變量'而不是'參數',因爲'參數'是'Axiom'的另一個名字。在關閉該部分併發出'Check mymap.'命令後,可以看到差異。 –