Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Is it possible to rewrite under binders?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Is it possible to rewrite under binders?


Chronological Thread 
  • From: Jonathan Leivent <jonikelee AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Is it possible to rewrite under binders?
  • Date: Thu, 28 Jan 2016 12:11:32 -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-qk0-f174.google.com
  • Ironport-phdr: 9a23:B1YI+RxcsuLaQGXXCy+O+j09IxM/srCxBDY+r6Qd0ekfIJqq85mqBkHD//Il1AaPBtWEraoYwLuK+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuStGU15j8hrz60qaQSjsLrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGwD884mosVHSODxe7kyZb1eFjUvdW4vt+PxshyWbwyJ72ccW2NethdJHQXD8FmuXJD3syj3sudw8CafNMzyC7szXGLxvO9QVBb0hXJfZHYC+2bNh5kogQ==



On 01/28/2016 11:58 AM, Guillaume Melquiond wrote:
On 28/01/2016 17:15, Jonathan Leivent wrote:

If the output of extraction
from two extensionally-equivalent functions would behave differently in
OCaml, then I would prefer that they are not treated within Coq as
substitutionally identical.
But that is already the case, even without any functional extensionality!

Axiom g : nat -> nat -> nat.
Fixpoint f1 (n : nat) :=
match n with S n => g (f1 n) (f1 n) | O => g O O end.
Fixpoint f2 (n : nat) :=
match n with S n => let v := f2 n in g v v | O => g O O end.
Goal f1 = f2. reflexivity. Qed.

While f1 and f2 are convertible, their behavior is entirely different
when extracted to Ocaml. One performs an exponential number of calls to
g, the other one is only linear. Sure, you could devise an Ocaml
optimization so that f1 also has linear complexity once compiled. But
where do you set the limit of what a compiler is allowed to?

Best regards,

Guillaume

What's funny about this is that initially in my reply I had the parenthetical "(modulo reduction)", and then removed it just before hitting send ;)

-- Jonathan




Archive powered by MHonArc 2.6.18.

Top of Page