coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Clément Pit-Claudel <cpitclaudel AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] how to rewrite, needed to match goal
- Date: Thu, 17 Dec 2020 01:05:02 -0500
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=cpitclaudel AT gmail.com; spf=Pass smtp.mailfrom=cpitclaudel AT gmail.com; spf=None smtp.helo=postmaster AT mail-qt1-f179.google.com
- Ironport-phdr: 9a23:c+t3uxFlzUJtWqaw58ZRWJ1GYnF86YWxBRYc798ds5kLTJ7zosmwAkXT6L1XgUPTWs2DsrQY0rWQ6vG7EjBeqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5wIRmssAncsscbjYRtJ6sw1xDEvmZGd+NKyG1yOFmdhQz85sC+/J5i9yRfpfcs/NNeXKv5Yqo1U6VWACwpPG4p6sLrswLDTRaU6XsHTmoWiBtIDBPb4xz8Q5z8rzH1tut52CmdIM32UbU5Uims4qt3VBPljjoMOjgk+2/Vl8NwlrpWrg+/qRxxw4DaY4+bO/RxcazfYdwUSnFMXtpSWiFbHo+wc4UCAugHMO1Fr4f9vVwOrR6mCASyAOPo0DpIiWHw3a0my+svCwDG3BA5E98QtHTbtsj1O7oMXuCx0aLFyinMb+tX2Tfh9IfIdgouoeyRUr1udcrc0kYvFwbfgVWRrYzpJS+a1uMIs2WC6edrSO2ghXI9pQ5rvjiv2tkjipPPho8NyV3J8St0zYk3KNO3SkN1bsKpHZlQuiybK4Z7RsEvT39ntSs5yLALuoO2cTUExZg6xxPRZeKKfouK7xzjW+icITF1j29mdrKnnxu+71Ssx+nmWsS30FtGtDdJn9jQunwXyhDe6MyKRuNj8kquwzqC1h3f5vtaLU07iabXMZ0szqI2m5EOq0rMBDX2l1/zjKKOdkUr5Oyo6+P/b7XjvJCcNot0hhjnMqQyh8CzGOo4PhUMUmWf4+i827rj/Ur2QLVOkPI6iLXWsJffJcgDp665BRFa0po75hqhEzur1M4UkHoHIV5fZR6KjpTlN0vTLP36Cfqzm1Gsny1qx/DCML3hGJLNLn3bnbj9ZbZ96lJcxxY3zd9F+pJbF68OIPboV0/+sdzXFB45Mwiuz+n7D9V905sSWXiTDa+BLKPSrViI6/ozLOmLfY8ZoSryK/w45/H1lnI5gl8cfayx3ZQNcny4H/JmI1+YYXX2mNsBH30K7UICS7nhj0THWjpObV6zWbg973c1EtGIF4DGE6upAbmM2juMJpxKI0tCA02AHHOgI46cWusHbCuPLsJlujMBXLmlDYQm0Ef950fB17N7I7+MqWUjvpX52Y0tvrGBpVQJ7TVxSv+l/SSVVWgtxzEHQjY32OZ0pkkvkg7Sg5g9uORREJlo390MVw47MZDGyOkjUoL9XwvAepGCT1P0G4z7UwF0dco4xpo1W2g4G9imiUqdjS+jArtQjqDSQZJtrfOa0H/2KMJwjX3B0ft5gg==
This is the short version of your problem, I think:
Require Coq.Vectors.Vector.
Goal forall n (v: Vector.t nat (S (n + 0))),
@Vector.hd (n + 0) v = 0 -> True.
Proof.
intros.
Fail rewrite plus_n_O in v.
(* Error: Cannot change v, it is used in hypothesis H. *)
remember (n + 0) as n0 eqn:Heq in *.
rewrite <- plus_n_O in Heq.
subst.
The first rewrite fails because H would be ill-typed if it succeeded: you'd
have (v: S n) and (H: @Vector.hd (n + 0) v); the latter is ill-typed because
(n + 0) and n are not unifiable.
So what you need to do is rewrite in both hypotheses at once, so that there's
no ill-typed intermediate stage. You can do this with [remember] and [subst]
as I did above (and as you observed) or with revert:
Require Coq.Vectors.Vector.
Goal forall n (v: Vector.t nat (S (n + 0))),
Vector.hd v = 0 -> True.
Proof.
intros.
Fail rewrite plus_n_O in v.
(* Error: Cannot change v, it is used in hypothesis H. *)
revert v H.
rewrite <- plus_n_O.
intros.
The key is that you can't rewrite an hypothesis' type if that leads other
hypotheses to being ill-typed.
Clément.
On 12/16/20 11:42 PM, Jeremy Dawson wrote:
> curiouser and curiouser -
>
> in investigating how I got to this situation I found that
> Coq would substitute (using subst.) the following equality in l and d1
>
> Γ0 = Γ1 ++ []
>
> So doing rewrite app_nil_r before substituting solves my problem in this
> particular case.
>
> But in general - (1) why can you do subst but not rewrite in d1
> (2) in general, how do you handle this problem
>
> Jeremy
>
> On 17/12/20 2:43 pm, Jeremy Dawson wrote:
>>
>> Hi,
>>
>> I have the following goal (only key parts included)
>>
>> l : LJArules (map (apfst (fmlsext (Γ1 ++ []) Γ2)) ps1)
>> (fmlsext Γ1 Γ2 [Imp (Var p) B], Var p)
>> d1 : dersrec LJArules prems (map (apfst (fmlsext (Γ1 ++ []) Γ2)) ps1)
>> apd : allDT (no_rpt_same seq_ord (prems:=prems))
>> (derI (fmlsext Γ1 Γ2 [Imp (Var p) B], Var p) l d1)
>> ============================
>> allDT (no_rpt_same seq_ord (prems:=prems))
>> (derI (fmlsext Γ1 Γ2 [Imp (Var p) B], Var p) ?l ?d1)
>>
>> Now the goal doesn't match apd because the types are wrong,
>> ?l and ?d1 have types which would match those of l and d1 if
>> l and d1 had (Γ1 ++ []) rewritten to Γ1
>>
>> But rewrite app_nil_r in d1. rewrite app_nil_r in l.
>> fails because
>> Ltac call to "rewrite (ssrrwargs) (ssrclauses)" failed.
>> d1 is used in hypothesis apd.
>> Ltac call to "rewrite (ssrrwargs) (ssrclauses)" failed.
>> l is used in hypothesis apd.
>>
>> How can I handle this situation?
>>
>> Thanks
>>
>> Jeremy
>>
- [Coq-Club] how to rewrite, needed to match goal, Jeremy Dawson, 12/17/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Jeremy Dawson, 12/17/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Clément Pit-Claudel, 12/17/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Jeremy Dawson, 12/17/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Jeremy Dawson, 12/28/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Jeremy Dawson, 12/30/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Clément Pit-Claudel, 12/30/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Jeremy Dawson, 12/30/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Clément Pit-Claudel, 12/30/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Jeremy Dawson, 12/30/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Clément Pit-Claudel, 12/30/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Clément Pit-Claudel, 12/30/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Jeremy Dawson, 12/30/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Clément Pit-Claudel, 12/17/2020
- Re: [Coq-Club] how to rewrite, needed to match goal, Jeremy Dawson, 12/17/2020
Archive powered by MHonArc 2.6.19+.