Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何编写一个Ltac,将方程的两边乘以Coq中的一个组元素_Coq_Ltac - Fatal编程技术网

如何编写一个Ltac,将方程的两边乘以Coq中的一个组元素

如何编写一个Ltac,将方程的两边乘以Coq中的一个组元素,coq,ltac,Coq,Ltac,使用组的此定义: Structure group := { G :> Set; id : G; op : G -> G -> G; inv : G -> G; op_assoc_def : forall (x y z : G), op x (op y z) = op (op x y) z; op_inv_l : forall (x : G), id = op (inv x) x; op_id_l : fora

使用组的此定义:

Structure group :=
  {
    G :> Set;

    id : G;
    op : G -> G -> G;
    inv : G -> G;

    op_assoc_def : forall (x y z : G), op x (op y z) = op (op x y) z;
    op_inv_l : forall (x : G), id = op (inv x) x;
    op_id_l : forall (x : G), x = op id x
  }.

(** Set implicit arguments *)
Arguments id {g}.
Arguments op {g} _ _.
Arguments inv {g} _.

Notation "x # y" := (op x y) (at level 50, left associativity).
证明了这个定理:

Theorem mult_both_sides (G : group) : forall (a b c : G),
    a = b <-> c # a = c # b.

你真的需要一个具体的策略吗?如果您只是使用
应用于此

Goal forall (G:group) (a b c: G), a = b.
  intros.
  apply (mult_both_sides _ _ _ c).
现在你的目标是

  G0 : group
  a, b, c : G0
  ============================
  c # a = c # b
如果你想修改一个假设
H
,那么只需执行
应用。。。在H

中,您可以使用
战术符号
s来编写

Tactic Notation "left_mult" uconstr(arbitrary_expression) :=
  apply (mult_both_sides _ _ _ arbitrary_expression).
Tactic Notation "left_mult" uconstr(arbitrary_expression) "in" hyp(hypothesis) :=
  apply (mult_both_sides _ _ _ arbitrary_expression) in hypothesis.

使用
uconstr
表示“延迟该术语的类型检查,直到我们将其插入
apply
”。(其他选项包括
constr
open\u-constr
open\u-constr

和声明
G
a
b
为隐式参数,这样您就不需要键入3个下划线。这似乎是我所需要的。然而,我仍然想知道如何像“重写”或“应用”策略那样使用“in”关键字。
Tactic Notation "left_mult" uconstr(arbitrary_expression) :=
  apply (mult_both_sides _ _ _ arbitrary_expression).
Tactic Notation "left_mult" uconstr(arbitrary_expression) "in" hyp(hypothesis) :=
  apply (mult_both_sides _ _ _ arbitrary_expression) in hypothesis.