LoginSignup
4
4

More than 5 years have passed since last update.

Coq の Variable と Parameter の違い

Last updated at Posted at 2015-05-23

Coq の Variable(s), Parameter(s), Hypothesis(es), Axiom, Conjecture の違いがいつもわからなくなるのでメモ。

まず Parameter = Parameters = Axiom = Conjecture で、Variable = Variables = Hypothesis = Hypotheses です。

この2つは Section を使わない場合や Section の中にいる場合は同じなのですが、Section の中で使ってその Section を閉じた場合に違いがでます。

(* Coq8.4pl5 *)

Section Sect.
  Parameter (A : Type).
  Variable (B : Type).

  Definition A' := A.
  Definition B' := B.

  Print A.  (* => *** [ A : Type ] *)
  Print B.  (* => *** [B : Type] *)

  Print A'. (* => A' = A : Type *)
  Print B'. (* => B' = B : Type *)
End Sect.

Print A.    (* => *** [ A : Type ] *)
Print A'.   (* => A' = A : Type *)
Print B'.   (* => B' = fun B : Type => B : Type -> Type
                  Argument scope is [type_scope] *)
Print B.    (* => Error: B not a defined object. *)

Section の中ではどちらも同じですが、Section を閉じたあとは、Variable で定義した B は消え、B' は Type -> Type の関数になっています。

また慣習として、ソートが Prop のときは Axiom, Hypothesis を、それ以外のときは Parameter, Variable を使うようです。

参照: https://coq.inria.fr/refman/Reference-Manual003.html#sec41

4
4
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4