Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] [Agda] Prior work on proof assistant performance / optimization

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] [Agda] Prior work on proof assistant performance / optimization


Chronological Thread 
  • From: András Kovács <kovacsandras AT inf.elte.hu>
  • To: Jason Gross <jasongross9 AT gmail.com>
  • Cc: coq-club <coq-club AT inria.fr>, agda-list <agda AT lists.chalmers.se>, Coq Discourse <coq+miscellaneous AT discoursemail.com>, lean-user <lean-user AT googlegroups.com>, cl-isabelle-users AT lists.cam.ac.uk
  • Subject: Re: [Coq-Club] [Agda] Prior work on proof assistant performance / optimization
  • Date: Fri, 8 May 2020 10:55:31 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=inf.elte.hu; dmarc=pass action=none header.from=inf.elte.hu; dkim=pass header.d=inf.elte.hu; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xsWgZrlg12bfhM6P2TODJ6p1Ie1pgx4oEdXvyEslNW4=; b=Up8zV48qlxUHdF98p6PA7OhEL+TgHosSO3PntD9yLDlC0r/Hmzo3KImmINCHmuUrXJ6qa5kpVWnpdn7HFhgJCSo66D3r8CCrj8ISrIhtx9+9P/Q6r+Unr098qYW3AU8BF9XIxVE5fPOQ/igXluP6E/x3Htr+I1cYCZxuPK0mA/tP+FUwALHhsll9smSONG1L9zcmAbpgT0R5qtKb1QcYjOnsjjF6LxnJut8B388WVngJ4J5u3IwBnPOFn6Yx+o81g1hKG+Xi/w1Nem0FbudLlVT5ykY/1VJai2Xwa4yHzjcY6gJ/YvNFsnp9BEqzxVyzsYqWqo4G9ISsjahPkQfdXw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XiJBgi1kDdJNCIL2VMIYcGX9BslVSqJSXituegsH5Y4IlQZHMVSiRwbIhFY13b3UobTMPOEx3GnwYytXN41K2TW3OrfSHRTKfeXjO8ETsiJqxhhVs9oRTagbW7SPM4jIfpOs47hNOjdWlM+ZaNWBxM5EeH/MCTmQIr0I5xksyNqFAmZrOoiuQFLq5bsoFpQ8QWRYXynhIlYBAgYkIDaVrBr+qPrDivDrLqK1HcTmYKCKFYB1bJmitrr/6xzcLij0zhha89/WiZ6oTckyATN+PRUF+8jLJYo0wNEa8bxSx9ZQ3Bzz0c+QgZ361TEPWRxxeLH1te6AFHz6ZYyhaXuwLg==
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=kovacsandras AT inf.elte.hu; spf=Pass smtp.mailfrom=kovacsandras AT inf.elte.hu; spf=Pass smtp.helo=postmaster AT EUR02-VE1-obe.outbound.protection.outlook.com
  • Ironport-phdr: 9a23:VhWDVh0u3PrfHtUNsmDT+DRfVm0co7zxezQtwd8ZsesWLfXxwZ3uMQTl6Ol3ixeRBMOHsq8C27Cd6viocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmTqwbalxIRmoogndq9UaipZ+J6gszRfEvmFGcPlMy2NyIlKTkRf85sOu85Nm7i9dpfEv+dNeXKvjZ6g3QqBWAzogM2Au+c3krgLDQheV5nsdSWoZjBxFCBXY4R7gX5fxtiz6tvdh2CSfIMb7Q6w4VSik4qx2UxLjljsJOCAl/2HWksxwjbxUoBS9pxxk3oXYZJiZOOdicq/BeN8XQ21OUNtMVyxaGoOzcZcAD/YPM+ZfqonyvVoOrR2jDgWoC+7izjpEi3nr1qM4zushCxnL3AIiENwOvnrar8j7OrkOXu+6zanF1i/MY+9M1Drn9ITEbhIsrPeRVrxwa8rRzkwvGhvZg1WWtIPlJTGS1v8QuGae6OpgS+CohHI8qwpspTWvxcAsipfTiY0J0VDL7yN5z5svJdKiU052et+kEJ1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may be interested in my github repos: smalltt, normalization-bench. I haven't yet updated the smalltt repo, but there's a simplified implementation of its evaluator, which seems to have roughly the same performance but which is much simpler to implement. 

The basic idea is that in elaboration there are two primary computational tasks, one is conversion checking and the other is generating solutions for metavariables. Clearly, we should use NbE/environment machines for evaluation, and implement conversion checking in the semantic domain. However, when we want to generate meta solutions, we need to compute syntactic terms, and vanilla NbE domain only supports quote/readback to normal forms. Normal forms are way too big and terrible for this purpose. Hence, we extend vanilla NbE domain with lazy non-deterministic choice between two or more evaluation strategies. In the simplest case, the point of divergence is whether we unfold some class of definitions or not. Then, the conversion checking algorithm can choose to take the full-unfolding branch, and the quoting operation can choose to take the non-unfolding branch. At the same time, we have a great deal of shared computation between the two branches; we avoid recomputing many things if we choose to look at both branches.

I believe that a feature like this is absolutely necessary for robust performance. Otherwise, we choke on bad asymptotics, which is surprisingly common in dependent settings. In Agda and Coq, even something as trivial as elaborating a length-indexed vector _expression_ has quadratic complexity in the length of the vector. 

It is also extremely important to stick to the spirit of Coquand's semantic checking algorithm as much as possible. In summary: core syntax should support *no* expensive computation: no substitution, shifting, renaming, or other ad-hoc term massaging. Core syntax should be viewed as immutable machine code, which supports evaluation into various semantic domains, from which sometimes we can read syntax back; this also leaves it open to swap out the representation of core syntax to efficient alternatives such as bytecode or machine code. 

Only after we get  the above two basic points right, can we start to think about more specific and esoteric optimizations. I am skeptical of proposed solutions which do not include these. Hash consing has been brought up many times, but it is very unsatisfying compared to non-deterministic NbE, because of its large constant costs, implementation complexity, and the failure to handle sharing loss from beta-redexes in any meaningful way (which is the most important source of sharing loss!). I am also skeptical of exotic evaluators such as interaction nets and optimal beta reducers; there is a good reason that all modern functional languages run on environment machines instead of interaction nets. 

If we want to support type classes, then tabled instance resolution is also a must, otherwise we are again smothered by bad asymptotics even in modestly complex class hierarchies. This can be viewed as a specific instance of hash-consing (or rather  "memoization"), so while I think ubiquitous hash-consing is bad, some focused usage can do good. 

Injectivity analysis is another thing which I believe has large potential impact. By this I mean checking whether functions are injective up to definitional equality, which is decidable, and can be used to more precisely optimize unfolding in conversion checking.

I'd be very interested in your findings about proof assistant performance. This has been a topic that I've been working on on-and-off for several years. I've recently started to implement a system which I intend to be eventually "production strength" and also as fast as possible, and naturally I want to incorporate existing performance know-how.


Jason Gross <jasongross9 AT gmail.com> ezt írta (időpont: 2020. máj. 8., P, 0:20):
I'm in the process of writing my thesis on proof assistant performance bottlenecks (with a focus on Coq).  I'm having some trouble finding prior work on performance engineering and/or benchmarking of proof assistants (other than the paper on the Lean tactic language (https://leanprover.github.io/papers/tactic.pdf)), and figured I'd reach out to these lists.

Does anyone have references for prior work on performance analysis or engineering of proof assistants or dependently typed languages?  (Failing that, I'd also be interested in papers about compile-time performance of compilers.)

Thanks,
Jason
_______________________________________________
Agda mailing list
Agda AT lists.chalmers.se
https://lists.chalmers.se/mailman/listinfo/agda



Archive powered by MHonArc 2.6.18.

Top of Page