Towards Ltac 2.0 P.-M. Pdrot INRIA DeepSpec Workshop 8th June - - PowerPoint PPT Presentation

towards ltac 2 0
SMART_READER_LITE
LIVE PREVIEW

Towards Ltac 2.0 P.-M. Pdrot INRIA DeepSpec Workshop 8th June - - PowerPoint PPT Presentation

. . . . . . . . . . . . . . . Towards Ltac 2.0 P.-M. Pdrot INRIA DeepSpec Workshop 8th June 2016 Pdrot (INRIA) Towards Ltac 2.0 8/06/2016 . . . . . . . . . . . . . . . . . . . . . . . . . 1 / 13 .


slide-1
SLIDE 1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Towards Ltac 2.0

P.-M. Pédrot

INRIA

DeepSpec Workshop

8th June 2016

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 1 / 13

slide-2
SLIDE 2

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

How did we get there?

Tactics were introduced in Coq 4.10 (May 89).

Goal (a:A)(m:list) (Null (cons a m)). Red. Intros. Do (resolve_unfolds) O_S. Exact (length m). Change <nat>(length nil)=(length (cons a m)). Do (incomplet [3]) (f_equal length). Assumption. Save nil_cons.

Only primitive tactics at the time!

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 2 / 13

slide-3
SLIDE 3

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Ltac

Ltac was introduced in the 7.x branch by David Delahaye (around 2000). Translated excerpt from the French CHANGES fjles: Ltac is a new layer of metalanguage to handle small automations.

<blink>SMALL</blink>

That sentence never made it into the English documentation.

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 3 / 13

slide-4
SLIDE 4

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Ltac

Ltac was introduced in the 7.x branch by David Delahaye (around 2000). Translated excerpt from the French CHANGES fjles: Ltac is a new layer of metalanguage to handle small automations.

<blink>SMALL</blink>

That sentence never made it into the English documentation.

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 3 / 13

slide-5
SLIDE 5

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Ltac

Ltac was introduced in the 7.x branch by David Delahaye (around 2000). Translated excerpt from the French CHANGES fjles: Ltac is a new layer of metalanguage to handle small automations.

<blink>SMALL</blink>

That sentence never made it into the English documentation.

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 3 / 13

slide-6
SLIDE 6

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Ltac

Ltac was introduced in the 7.x branch by David Delahaye (around 2000). Translated excerpt from the French CHANGES fjles: Ltac is a new layer of metalanguage to handle small automations.

<blink>SMALL</blink>

That sentence never made it into the English documentation.

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 3 / 13

slide-7
SLIDE 7

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15 years later

2016: Probably more than 105 loc in Ltac (educated guess), which is: Not fjtted for that scale Not specifjed Not specifjable Brittle Slow A kludgy pile of random stufg nobody really understands

« Ltac is the PHP of proof assistants »

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 4 / 13

slide-8
SLIDE 8

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

A little issue

Facebook has billions of PHP loc, but if they were to start from scratch, they would probably use a decent language (Haskell, OCaml, …). We don’t have that luck.

As of today, we don’t know what a good tactic language is.

Experimental research: Mtac, Rtac, ssrefmect...

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 5 / 13

slide-9
SLIDE 9

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Being Pragmatic

It looks like we can’t really do much more about Ltac than in 2000.

WRONG!

Since Coq 8.5, we have a new tactic engine (A. Spiwack). Features backtrack and term refjning Monadic ML API Ltac is built atop of it We can reason about the programs (hello, semantics!)

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 6 / 13

slide-10
SLIDE 10

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Being Pragmatic

It looks like we can’t really do much more about Ltac than in 2000.

WRONG!

Since Coq 8.5, we have a new tactic engine (A. Spiwack). Features backtrack and term refjning Monadic ML API Ltac is built atop of it We can reason about the programs (hello, semantics!)

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 6 / 13

slide-11
SLIDE 11

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Being Pragmatic II

We can’t make a perfect language, let us make a better Ltac.

Use the sane semantics of the tactic engine for Ltac 2.0

Ltac 2.0... will look like Ltac (syntax-wise) will kind of taste like Ltac (semantics-wise) but fortunately won’t be Ltac! (implementation-wise)

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 7 / 13

slide-12
SLIDE 12

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

The rough bluesheet

Following a very simple recipe:

1 Take the best minimalist language out there: ML 2 Interpret the ambient efgects as the engine monad 3 Add some meta-programming facilities 4 Sprinkle notations here and there

... and voilá, you have Ltac 2.0.

Estimated implementation time for a prototype: 2 weeks.

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 8 / 13

slide-13
SLIDE 13

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

What’s for me in this?

In particular, Ltac 2.0 will be: typed supporting datatypes and programming features (partly) specifjed Problems Ltac 2.0 won’t solve: Unifjcation Unspecifjed / unstable primitive tactics Effjciency (in a fjrst time) Typing of metaprogramming

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 9 / 13

slide-14
SLIDE 14

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Acknowledging the existing

Thanks to notations, certain idioms should be mostly compatible, e.g. intros [H|H]; destruct H as x; exact x. Following guidelines, we can recover a certain amount of forward compatibility, e.g. Don’t write let t := idtac; foo in … t … But write let t _ := foo in … t () … TODO: write the guidelines! (Un)luckily, crazy stufg is going to die in a horrible well-deserved sufgering.

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 10 / 13

slide-15
SLIDE 15

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Transition path

Most probably, today’s Ltac is going to survive through a plugin. Require Import LegacyLtac. This should content the crazy stufg people. Other people would get a sane language when booting Coq. Hopefully, crazy stufg is going to be rewritten at some point.

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 11 / 13

slide-16
SLIDE 16

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

TODO

I am going to write the specs of Ltac 2.0 in a CEP. Probably going to write a prototype as well at some point.

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 12 / 13

slide-17
SLIDE 17

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

I had a dream

What if we fostered tactic DSL?

Pédrot (INRIA) Towards Ltac 2.0 8/06/2016 13 / 13