Coq Z_3群定义左id定理

Coq Z_3群定义左id定理,coq,Coq,我试图证明Z3是一个群体 Class Group G : Type := { e : G; mult : G -> G -> G; inv : G -> G; left_id : forall x:G, mult e x = x; left_inv : forall x:G, mult (inv x) x = e; assoc : forall x y z:G, mult x (mult y z) = mult (

我试图证明Z3是一个群体

Class Group G : Type :=
{
    e : G;
    mult : G -> G -> G;
    inv : G -> G;
    left_id : forall x:G, mult e x = x;
    left_inv : forall x:G, mult (inv x) x = e;
    assoc : forall x y z:G,
        mult x (mult y z) = mult (mult x y) z
}.

Record Z_3 : Type := Z3
{
  n :> nat;
  proof : n < 3
}.

(* Inhabitants of Z_3 type *)

Proposition lt_0_3 : 0 < 3.
Proof.
  repeat constructor.
Qed.

Definition z3_0 : Z_3 := (Z3 0 lt_0_3).

Proposition lt_1_3 : 1 < 3.
Proof.
  repeat constructor.
Qed.

Definition z3_1 : Z_3 := (Z3 1 lt_1_3).

Proposition lt_2_3 : 2 < 3.
Proof.
  repeat constructor.
Qed.

Definition z3_2 : Z_3 := (Z3 2 lt_2_3).
(* End of inhabitants definition *)

Proposition three_ne_0 : 3 <> 0.
Proof.
  intro. discriminate.
Qed.

Definition Z3_op (x y: Z_3) : Z_3 :=
  let a := (x + y) mod 3 in
  Z3 a (Nat.mod_upper_bound _ 3 three_ne_0).

Lemma Z_3_inv_lemma (k: nat) : (3 + k) < 3 -> False.
Proof.
  intro. inversion_clear H. inversion_clear H0. inversion_clear H. inversion_clear H0.
Qed.

Lemma void {t : Set} : False -> t.
Proof.
  intro. contradiction H.
Qed.

Definition Z_3_inv (x : Z_3) : Z_3 :=
  match x with
  | Z3 0 pf => Z3 0 pf
  | Z3 1 pf => Z3 2 lt_2_3
  | Z3 2 pf => Z3 1 lt_1_3
  | Z3 (S (S (S k))) pf => void (Z_3_inv_lemma k pf)
  end.

Proposition Z3_left_id : forall x: Z_3, (Z3_op z3_0 x) = x.
Proof.
  intro. unfold Z3_op. destruct x. inversion proof0.
  - 
类别组G:类型:=
{
e:G;
mult:G->G->G;
存货:G->G;
左id:forall x:G,mult e x=x;
左库存:对于所有x:G,多(库存x)x=e;
助理:对于所有x y z:G,
mult x(mult y z)=mult(mult x y)z
}.
记录Z_3:类型:=Z3
{
n:>nat;
证明:n<3
}.
(*Z_3型居民*)
命题lt_0_3:0<3。
证明。
重复构造函数。
Qed。
定义z3_0:Z_3:=(z3 0 lt_0_3)。
命题lt_1_3:1<3。
证明。
重复构造函数。
Qed。
定义z3_1:Z_3:=(z3 1 lt_1_3)。
命题lt_2_3:2<3。
证明。
重复构造函数。
Qed。
定义z3_2:Z_3:=(z3 2 lt_2_3)。
(*结束定义*)
提案三:0:30。
证明。
简介。区别对待
Qed。
定义Z3_op(xy:Z_3):Z_3:=
设a:=(x+y)模3英寸
z3a(Nat.mod_上界u3-ne_0)。
引理Z_3_inv_引理(k:nat):(3+k)<3->False。
证明。
简介。反转清除H。反转清除H0。反转清除H。反转清除H0。
Qed。
引理void{t:Set}:False->t。
证明。
简介。矛盾H。
Qed。
定义Z_3_inv(x:Z_3):Z_3:=
将x与
|Z3 0 pf=>Z3 0 pf
|Z3 1 pf=>Z3 2 lt_2_3
|Z3 2 pf=>Z3 1 lt_1_3
|Z3(S(S(sk)))pf=>void(Z_3_inv_引理kpf)
结束。
命题Z3_left_id:forall x:Z_3,(Z3_op Z3_0 x)=x。
证明。
简介。展开Z3_op.销毁x。反转证明。
- 
我被困在这里:

1 subgoal (ID 46)
  
  n0 : nat
  proof0 : n0 < 3
  H0 : n0 = 2
  ============================
  {|
  n := (z3_0 + {| n := n0; proof := proof0 |}) mod 3;
  proof := Nat.mod_upper_bound
             (z3_0 + {| n := n0; proof := proof0 |}) 3
             three_ne_0 |} = {| n := n0; proof := proof0 |}
1子目标(ID 46)
n0:nat
证明0:n0<3
H0:n0=2
============================
{|
n:=(z3|0+{n:=n0;证明:=proof0})模3;
证明:=Nat.mod\u上界
(z3|0+{n:=n0;证明:=proof0})3
三个| ne|u 0 |}={n:=n0;证明:=proof0 |}

重写H0。
不起作用。抱歉,当涉及到这些记录时,我很难再进一步了。

您应该首先创建并应用一个单独的引理,它可以让您证明Z3元素之间的等式。然后,你将简化为拥有相等的西格玛类型,例如,你可以遵循


然而,在你的例子中,公理是可以避免的——你不需要函数的可扩展性,你可以通过存储一种证明不相关的证明来避免证明不相关的公理;这可能是因为
z<3
已经与证明无关,因为
“通过存储一类与证明无关的证明,可以避免证明无关的公理”——如何做到?你能举个例子吗?