我正在编写一个小程序,以便我可以使用HoTT书(等)中的类型导入/消除规则来对deMorgans定律进行一些证明。我的模型/示例代码都在这里,https://mdnahas.github.io/doc/Reading_HoTT_in_Coq.pdf。到目前为止,我有,错误:在当前环境中找不到参考fst
Definition idmap {A:Type} (x:A) : A := x.
Inductive prod (A B:Type) : Type := pair : A -> B -> @prod A B.
Notation "x * y" := (prod x y) : type_scope.
Notation "x , y" := (pair _ _ x y) (at level 10).
Section projections.
Context {A : Type} {B : Type}.
Definition fst (p: A * B) :=
match p with
| (x , y) => x
end.
Definition snd (p:A * B) :=
match p with
| (x , y) => y
end.
End projections.
Inductive sum (A B : Type) : Type :=
| inl : A -> sum A B
| inr : B -> sum A B.
Arguments inl {A B} _ , [A] B _.
Arguments inr {A B} _ , A [B].
Notation "x + y" := (sum x y) : type_scope.
Inductive Empty_set:Set :=.
Inductive unit:Set := tt:unit.
Definition Empty := Empty_set.
Definition Unit := unit.
Definition not (A:Type) : Type := A -> Empty.
Notation "~ x" := (not x) : type_scope.
Variables X:Type.
Variables Y:Type.
Goal (X * Y) -> (not X + not Y).
intro h. fst h.
现在我真的不知道问题是什么。我有人使用定义的例子,但他们总是涉及“计算”命令,我想将规则fst应用到h以获得x:X,所以它们没有帮助。
我试过“apply fst”。这让我
Error: Cannot infer the implicit parameter B of fst whose type is
"Type" in environment:
h : A * B