Coq 从自动战术的角度来看,符号和定义之间有什么区别?

Coq 从自动战术的角度来看,符号和定义之间有什么区别?,coq,coq-tactic,Coq,Coq Tactic,在中,我们发现以下内容: (** [idB = \x:Bool. x] *) Notation idB := (abs x Bool (var x)). (** [idBB = \x:Bool->Bool. x] *) Notation idBB := (abs x (Arrow Bool Bool) (var x)). [...] (** (We write these as [Notation]s rather than [Definition]s to make

在中,我们发现以下内容:

(** [idB = \x:Bool. x] *)

Notation idB :=
  (abs x Bool (var x)).

(** [idBB = \x:Bool->Bool. x] *)

Notation idBB :=
  (abs x (Arrow Bool Bool) (var x)).

[...]

(** (We write these as [Notation]s rather than [Definition]s to make
    things easier for [auto].) *)

这里的实质是什么?从
auto
策略的角度来看,
Notation
Definition
之间有什么区别?

注释只是为了你的眼睛,而定义是由coq内核理解的,这是第一个区别。 当对一个术语进行类型检查时,它不应该有太大的影响,因为定义可以展开

Definition foo : nat := 3 + 3.

(* [foo] is convertible to [3 + 3], its definition. *)
Check eq_refl : foo = 3 + 3.
auto
-就像所有的战术一样,战术是从语法上看术语的。 例如,如果你要写以下愚蠢的策略:

然后,它只适用于您的目标是准确地(即语法上)
foo=3+3

Goal foo = foo.
Proof.
  Fail bar.
  unfold foo at 2. (* We need to unfold [foo] on the right to apply our tactic. *)
  bar.
Qed.
现在,符号不同了,就像我说的,只有你能看到它们,ltac不能

Notation foofoo := (3 + 3).

Goal foofoo = 3 + 3.
Proof.
  match goal with
  | |- 3 + 3 = 3 + 3 => reflexivity
  end.
Qed.

对于ltac,
foofoo
3+3
相同,无需进行任何展开。

符号仅用于您的眼睛,而定义由coq内核理解,这是第一个区别。 当对一个术语进行类型检查时,它不应该有太大的影响,因为定义可以展开

Definition foo : nat := 3 + 3.

(* [foo] is convertible to [3 + 3], its definition. *)
Check eq_refl : foo = 3 + 3.
auto
-就像所有的战术一样,战术是从语法上看术语的。 例如,如果你要写以下愚蠢的策略:

然后,它只适用于您的目标是准确地(即语法上)
foo=3+3

Goal foo = foo.
Proof.
  Fail bar.
  unfold foo at 2. (* We need to unfold [foo] on the right to apply our tactic. *)
  bar.
Qed.
现在,符号不同了,就像我说的,只有你能看到它们,ltac不能

Notation foofoo := (3 + 3).

Goal foofoo = 3 + 3.
Proof.
  match goal with
  | |- 3 + 3 = 3 + 3 => reflexivity
  end.
Qed.
对于ltac,
foofoo
3+3
相同,无需进行任何展开