Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] tracing extracted code

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] tracing extracted code


Chronological Thread 
  • From: Matěj Grabovský <matej.grabovsky AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] tracing extracted code
  • Date: Mon, 23 Nov 2015 14:45:48 +0100
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=matej.grabovsky AT gmail.com; spf=Pass smtp.mailfrom=matej.grabovsky AT gmail.com; spf=None smtp.helo=postmaster AT mail-oi0-f48.google.com
  • Ironport-phdr: 9a23:maEn6RNwo3Gp1E7+ZHwl6mtUPXoX/o7sNwtQ0KIMzox0KPj/rarrMEGX3/hxlliBBdydsKIZzbWO+PuwEUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35nxiLj5oM2bSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Lpyv/JHBK79ZuEzSaFSJDUgKWE8osPx5jfZSg7aw3IA8WdevQBBCQ/b9xJvFsP0uzf3tKxywiCQOtPtTqEcVjGr7qMtQxjt3nRUfwUl+X3a35QjxJlQpwis8kRy

Hi.

You could instead declare Trace like

> Parameter Trace : forall A, nat -> A -> A.
> Extract Constant Trace => "trace_helper".

and define a helper function such as

> let trace_helper n ret = let _ = trace_nat n in ret

Your function would then become

> Definition f (n : nat) := Trace n n.

This will probably get hairy with more complicated expressions but
again, it's just a thought.

Best regards,
Matěj

On 23 November 2015 at 14:25, Frédéric Besson
<frederic.besson AT inria.fr>
wrote:
> Dear all,
>
> I would like to trace some Coq extracted code.
> Something like:
> Parameter Trace : nat -> unit.
>
> Definition f (n : nat) := let _ := Trace n in n.
>
> Extract Constant Trace => "trace_nat ». (* Here, I will perform
> side-effect *)
> Separate Extraction f.
>
> I have the problem that the extraction mechanism is too clever.
> It removes my call to Trace under the « false » assumption that it is
> side-effect free.
>
> Is there a way to instruct the extraction not to do that ?
> For instance: Hey, this is an axiom : do not assume there is no
> side-effect!"
>
> It seems that disabling optimisations is not enough i.e Unset Extraction
> Optimize.
>
> Does anyone know about any way?
>
> Thanks,
>
> Frédéric
>
>
>
>
>



Archive powered by MHonArc 2.6.18.

Top of Page