Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] When does the termination checker reduce a record accessor?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] When does the termination checker reduce a record accessor?


Chronological Thread 
  • From: Joachim Breitner <mail AT joachim-breitner.de>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] When does the termination checker reduce a record accessor?
  • Date: Fri, 03 Nov 2017 11:11:08 -0400
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mail AT joachim-breitner.de; spf=Neutral smtp.mailfrom=mail AT joachim-breitner.de; spf=None smtp.helo=postmaster AT hermes.serverama.de
  • Ironport-phdr: 9a23:9LIIARy7yT0+RmHXCy+O+j09IxM/srCxBDY+r6Qd0uIQIJqq85mqBkHD//Il1AaPBtqLra8cw8Pt8IneGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2SkPfuEKy7CIfX1DWfUowf7ytW92as8Pi3OervpbXfg9ghTynYLo0Ig/lgx/Ws5w0hoJpKqc0gjHTr3pUfelMjTdtLFOXtxT778yw/Zsm+T5duu4n+tQGXaisLPdwdqBREDlzazN938bsrxSWCFLXvnY=

Hi,

Am Freitag, den 03.11.2017, 16:00 +0100 schrieb William J. Bowman:
> > On Nov 3, 2017, at 3:39 PM, Joachim Breitner
> > <mail AT joachim-breitner.de>
> > wrote:
> >
> > Without δ, why does it unfold `list_P` and `existsb` to see that the
> > recursion on the list is nicely structural? And why do tree_P1 and
> > tree_P2 still work even when I specify Opaque list_P.?
>
> I was about to conjecture exactly what you discovered; thank you for
> digging into the source. And the question you pose is most
> mysterious. Are some definitions treated differently than others?

there is more code in that file of interest:

| Const (kn,u) ->
if evaluable_constant kn renv.env then
try List.iter (check_rec_call renv []) l
with (FixGuardError _ ) ->
let value = (applist(constant_value renv.env (kn,u), l)) in
check_rec_call renv stack value
else List.iter (check_rec_call renv []) l

so it looks like it unfolds constants on the fly, if it cannot prove
termination without the unfolding and if they are evaluable. Great,
that explains why it unfolds list_P and existsb. But why not P when
applied to list_C? P certainly is not opaque.

It also does not help to reimplement P with an explicit match, i.e.:

Definition P' {a} (a_C : C a) : a -> bool :=
match a_C with Build_C _ P => P end.


Greetings,
Joachim


--
Joachim Breitner

mail AT joachim-breitner.de
http://www.joachim-breitner.de/

Attachment: signature.asc
Description: This is a digitally signed message part




Archive powered by MHonArc 2.6.18.

Top of Page