math-类:证明Munit是它自己的否定
math-classes: Prove that Munit is its own negation
我刚刚开始使用 math-类 库,我想证明以下引理:
Require Import
MathClasses.interfaces.abstract_algebra MathClasses.interfaces.vectorspace MathClasses.interfaces.canonical_names.
Lemma Munit_is_its_own_negation `{Module R M} : Munit = - Munit.
我正打算这样证明:
- 使用
right_identity
将 Munit 添加到右侧:Munit = - Munit & Munit
- 右边使用
left_inverse
:Munit = Munit
- 使用
reflexivity
.
但是,当我尝试应用 rewrite <- right_inverse
时,出现以下错误:
Error:
Unable to satisfy the following constraints:
In environment:
R : Type
M : Type
Re : Equiv R
Rplus : Plus R
Rmult : Mult R
Rzero : Zero R
Rone : One R
Rnegate : Negate R
Me : Equiv M
Mop : SgOp M
Munit : MonUnit M
Mnegate : Negate M
sm : ScalarMult R M
H : Module R M
?A : "Type"
?B : "Type"
?H : "Equiv (MonUnit M)"
?op : "?A → ?B → MonUnit M"
?inv : "?A → ?B"
?RightInverse : "RightInverse ?op ?inv Munit"
为什么 Coq 寻找环境中的 Equiv (MonUnit M)
而不仅仅是 Equiv M
或 MonUnit M
?是否可以完成此证明?如果可以,怎么做?
Munit
是参数化 MonUnit
类型类的实例。这意味着 Munit
本质上是一个记录(只有一个字段 -- mon_unit
),但我想你想要关于类型 M
的单位元素的声明,因为它通常否定一条记录没有多大意义。
我相信原则上有可能让 Coq 解包 Munit
并做正确的事情,但如果我们可以重申引理,为什么还要挣扎:
Lemma mon_unit_is_its_own_negation `{Module R M} :
mon_unit = - mon_unit.
然后一切就如您所描述的那样:
Proof.
rewrite <- (right_identity (- mon_unit)).
now rewrite left_inverse.
Qed.
我刚刚开始使用 math-类 库,我想证明以下引理:
Require Import
MathClasses.interfaces.abstract_algebra MathClasses.interfaces.vectorspace MathClasses.interfaces.canonical_names.
Lemma Munit_is_its_own_negation `{Module R M} : Munit = - Munit.
我正打算这样证明:
- 使用
right_identity
将 Munit 添加到右侧:Munit = - Munit & Munit
- 右边使用
left_inverse
:Munit = Munit
- 使用
reflexivity
.
但是,当我尝试应用 rewrite <- right_inverse
时,出现以下错误:
Error:
Unable to satisfy the following constraints:
In environment:
R : Type
M : Type
Re : Equiv R
Rplus : Plus R
Rmult : Mult R
Rzero : Zero R
Rone : One R
Rnegate : Negate R
Me : Equiv M
Mop : SgOp M
Munit : MonUnit M
Mnegate : Negate M
sm : ScalarMult R M
H : Module R M
?A : "Type"
?B : "Type"
?H : "Equiv (MonUnit M)"
?op : "?A → ?B → MonUnit M"
?inv : "?A → ?B"
?RightInverse : "RightInverse ?op ?inv Munit"
为什么 Coq 寻找环境中的 Equiv (MonUnit M)
而不仅仅是 Equiv M
或 MonUnit M
?是否可以完成此证明?如果可以,怎么做?
Munit
是参数化 MonUnit
类型类的实例。这意味着 Munit
本质上是一个记录(只有一个字段 -- mon_unit
),但我想你想要关于类型 M
的单位元素的声明,因为它通常否定一条记录没有多大意义。
我相信原则上有可能让 Coq 解包 Munit
并做正确的事情,但如果我们可以重申引理,为什么还要挣扎:
Lemma mon_unit_is_its_own_negation `{Module R M} :
mon_unit = - mon_unit.
然后一切就如您所描述的那样:
Proof.
rewrite <- (right_identity (- mon_unit)).
now rewrite left_inverse.
Qed.