Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] match context and evars

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] match context and evars


Chronological Thread 
  • From: Jonathan Leivent <jonikelee AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] match context and evars
  • Date: Thu, 24 Nov 2016 11:31:05 -0500
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jonikelee AT gmail.com; spf=Pass smtp.mailfrom=jonikelee AT gmail.com; spf=None smtp.helo=postmaster AT mail-qt0-f169.google.com
  • Ironport-phdr: 9a23:+tB1oRHUv9/uiIhkLDcknJ1GYnF86YWxBRYc798ds5kLTJ76r8SwAkXT6L1XgUPTWs2DsrQf2rGQ6fGrCTVIoc7Y9itdINoUD15NoP5VtjJjKfbNMVf8Iv/uYn5yN+V5f3ghwUuGN1NIEt31fVzYry76xzcTHhLiKVg9fbytScbkpp/ojKXqp9WTPl0J13KBZuZ5KwzzpgHMvOEXh5FjI+A/0EjnuHxNLsZRw2p0JVuV1zLx59m9+oIrpyZXvfMi+spNXI31eq05SfpTCzFwYDN939HiqRSWFVjH3XAbSGhDz0JF



On 11/24/2016 11:09 AM, Jan-Oliver Kaiser wrote:
Hello Jonathan,

Thank you! This will prevent a lot of future headache. My preliminary tests indicate that it is not actually `id` which is unfolded here - it seems to work with all valid names. Am I right in assuming that you took `id` because it is a somewhat canonical choice of an existing name?

Any reduction will work (except for "red" which will fail because there is no head constant). I just used "id" to illustrate that.

Also, on "lazy" vs. "cbv" - there is a bug in Coq that seems to make "cbv" style reductions a bit fragile on evars (see https://coq.inria.fr/bugs/show_bug.cgi?id=3906), while "lazy" reductions continue to work.

-- Jonathan


Best,
Jan-Oliver

On 11/24/2016 04:56 PM, Jonathan Leivent wrote:
Hi Jan-Oliver,

This will demonstrate the issue:

exvar Type (fun t => unify t nat; idtac t; let t2 := eval lazy delta
[id] in t in idtac t2).

The first idtac will print something like "?X6", while the second will
print "nat". What type of reduction is done is not important
(obviously, there is no id function to delta reduce here, so this
reduction is a no-op). Coq isn't always very good about noticing the
instantiation of an evar through the raw evar itself, so this reduction
step just prods it into doing so.

-- Jonathan


On 11/24/2016 09:59 AM, Jan-Oliver Kaiser wrote:
Hello,

I am trying to find occurrences of an instantiated existential
variable in a bigger term. I have yet to find a way to make this work.
I have, however, identified a rather peculiar minimal failing example
of interaction between evars and match context:

(* Some notation to hide a the overhead associated with evars *)
Tactic Notation "exvar" constr(type) tactic(cnt) :=
let name := fresh in
evar (name : type);
let var := (eval unfold name in name) in
clear name;
cnt var.

Goal True.
exvar Type (fun t => unify t nat; match nat with context f [nat] =>
idtac "yay" end).
Fail exvar Type (fun t => unify t nat; match nat with context f [t]
=> idtac "yay" end).
Abort.

The first call to exvar is just a sanity check to see if the evar
machinery works and the context pattern work as intended. The second
call is what really baffles me. t is successfully unified with nat -
but it cannot be found in the term nat. What is going on here?

Thanks,
Jan-Oliver






Archive powered by MHonArc 2.6.18.

Top of Page