Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Is there something like especialize?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Is there something like especialize?


Chronological Thread 
  • From: Pierre Courtieu <pierre.courtieu AT gmail.com>
  • To: Coq Club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Is there something like especialize?
  • Date: Mon, 30 Apr 2018 14:01:59 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=pierre.courtieu AT gmail.com; spf=Pass smtp.mailfrom=pierre.courtieu AT gmail.com; spf=None smtp.helo=postmaster AT mail-oi0-f44.google.com
  • Ironport-phdr: 9a23:tFGxTxYwtZyQwNCpWpLCfnn/LSx+4OfEezUN459isYplN5qZoMuzbnLW6fgltlLVR4KTs6sC17KN9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCazbL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjm58axlVAHnhzsGNz4h8WHYlMpwjL5AoBm8oxBz2pPYbJ2JOPZ7eK7WYNEUSndbXstJVSNBDIOyYYUMAeQcI+hXs4bzqkASrRunHwSgGP/jxiNKi3LwwKY00/4hEQbD3AE4BdwOsWrbrM/vNKgMTOu40q7IzSjZb/NK2Dfy9pXIeQ0mrPGUXLJ/b9DRyVMxGA/fklqQrpHlPymJ1uQMrWeb8vFtVe2qi2E9qgFxpiKjydsrionMn48YzE3P+yZhwIstO9G0VEp2bcSnHZZQrS2WKZZ6T8A4T2xntys3zKANt4ShcygQ0psnwgbSa/yZfIiM5RLuTOORLi15hHJhYb6/gBey/VS5xu3yWcS530xGriVCktnLuXAN0wLc5tKbRft6+0etwTeP1wbN5eFYOU04i7bXJpo7zrMzlpcfq1rPEjL1lUnsg6KbeV0o+u2y5OTmZrXmqIWcN4hxigzmKqQum9KwAf4iMgcQRWSU5eO81KD5/U3lQbVFkOA2n7LWsJDfP8sbp6q5DxVJ3YYk7hazFy2m38gAnXkbMFJFfwqKgJTuO1HXOfz3EfO/g0m3nzpw3PDHPrjhAo3XIXTZkbfhe6x9609GxwYpw9Bf/cEcNrZUC/XqEmT1qdaQWhQ+Kkm/x/vtINR7zIIXH2yVVPy3KqTX5GeJ6/g1LqGnY5IPpDfwNrBx///jl2U031QaYLO13JYKQH+9F/ViZU6eZCy/0Z86DW4Ws19mH6TRg1qYXGsWPi7qBvNu1nQAEIujSLz7aMWoib2F0j28G8QPNG9DA1GIV3zvctfdAqteWGepOsZk1wc8e/25UYZ4jEOhsQb7z/xsKe+GonRF56Km78B84qjorT939TFwCJ7AgWSETmUxmWJQAjFqgOZwpktyzlrF2q990aRV

2018-04-30 11:54 GMT+02:00 Soegtrop, Michael
<michael.soegtrop AT intel.com>:
> Dear Pierre,
>
>> I think that would make a good feature wish.
>
> fine, I will create one.

I will try to find some time to implement it :-).

> Does the syntax you outlined work for eapply?

No because eapply makes evars with all uninstantiated variables anyway
so there is no need to have an explicit syntax for that. But
specialize has one more degree of freedom: one can chose to let some
parameters uninstantiated. See below.

> I am not such a fan of the "with" syntax and would like to write:

There is one general advantage to "with": you can omit completely
parameters that will be found by unification (you don't need to put
the right number of "_").
There is one particular advantage to "with" when used on "specialize":
you can also omit parameters that will not be found by unification:
they will be left in place.

For instance if you have a big hypothesis with several dependent
hypothesis and you would like to instantiate what can currently be:

...
H: forall (nme : name) (v : value) (addr_nme load_addr_nme : expr)
(vaddr : Values.val) (typ_nme : type) (cm_typ_nme : Ctypes.type),
transl_name st CE nme = Errors.OK addr_nme
→ eval_expr g sp locenv m addr_nme vaddr
→ evalName st s nme (OK v)
→ transl_type st typ_nme = Errors.OK cm_typ_nme
→ type_of_name st nme = Errors.OK typ_nme
→ make_load addr_nme cm_typ_nme = Errors.OK
load_addr_nme
→ ∃ v_t : Values.val, transl_value v v_t ∧
eval_expr g sp locenv m load_addr_nme v_t
...
Htrsl : transl_type st typ_nme = Errors.OK cm_typ_nme (* I know this
must be my 4th dep hyp in H *)
...
==================
...

I like to write:

specialize H with (4:=Htrsl).

which will also instantiate (typ_nme : type) (cm_typ_nme :
Ctypes.type) and leave all other parameters of H unchanged.

Doing the same without "with" would be awful:

specialize (fun nme v addr_nme load_addr_nme vaddr h1 h2 h3 =>
h_stk_mtch_s_m nme v addr_nme load_addr_nme vaddr _ _ h1 h2 h3 Htrsl).

> especialize (H t u _ ?[h2])
>
> in the case you outlined, assuming H has parameters x y and two hypothesis.
> Not sure if the ?[name] syntax works for eapply, though. I tend to use it
> only with refine.

it seems so:

Lemma foo:forall n m , (forall a b:nat, a < m -> n = m -> False) -> False.
intros n m H.
eapply (H 1 2 ?[h] ?[h']).

The new feature should allow both syntaxes imho.

> I think one should keep the syntax and options identical to eapply - in the
> end it is not that much of a difference if one tries to solve the current
> goal or a prerequisite of a hypothesis.

I think [eapply t] means "I want to instantiate all hypothesis of t,
make evars with unsolved parameters". But with specialize there is one
more level of freedom as I said above: leave some hypothesis
uninstantiated. We should have a way to tell that to especialize imho.

P.


> Best regards,
>
> Michael



Archive powered by MHonArc 2.6.18.

Top of Page