Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Variables outside sections

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Variables outside sections


Chronological Thread 
  • From: "Igor Zhirkov" <igorjirkov AT gmail.com>
  • To: "" <coq-club AT inria.fr>
  • Subject: [Coq-Club] Variables outside sections
  • Date: Fri, 04 Mar 2016 17:14:21 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=igorjirkov AT gmail.com; spf=Pass smtp.mailfrom=igorjirkov AT gmail.com; spf=None smtp.helo=postmaster AT mail-wm0-f46.google.com
  • Ironport-phdr: 9a23:JeZwXRZUy5/bKc5PZm9Kv8n/LSx+4OfEezUN459isYplN5qZpci5bnLW6fgltlLVR4KTs6sC0LqJ9f++Ejxcqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7/0pMOYM1kArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIYTGZn9Ku5yBehTCy1jOGQo7uXqswPCRE2B/C1PfH8Rl08CIgfC9lnIXpbrsSzk/KIp2SadJ8/3V7MzRxyt6q5qTFnjjyJRZG1xy33elsEl1PETmxmmvREqm4M=

Hi all,

I was refreshing my memory on coercions lately and saw some strange behaviour of Variables declared outside sections. MWE in Coq 8.5 :

Record mixin_of (T:Type) := Mixin { bogus: nat }.
Structure pack_type: Type := Pack { type: Type ; _ : mixin_of type }.
Coercion type: pack_type >-> Sortclass.

Variable cT: pack_type.

Check cT.    (* prints cT: pack_type *)

Definition my_struct : mixin_of cT :=
  match cT return mixin_of cT with
    | Pack _ c => c
  end.

Now that gives an error:

Toplevel input, characters 92-93:
Error:
In environment
T : Type
c : mixin_of T
The term "c" has type "mixin_of T" while it is expected to have type
 "mixin_of cT".


Looks strange to me because Check cT found it.
It works however:
* if the code above is inside a section;
* if cT is added to the argument list manually;

The Coq reference manual says that using Variable keyword is equivalent to Local Parameter, but I failed to find any explanation of the Local Parameter itself. (link: https://coq.inria.fr/refman/Reference-Manual003.html#hevea_default36 ).

So, what is actually going on here and why an information about such a variable is lost sometimes?


--Igor




Archive powered by MHonArc 2.6.18.

Top of Page