coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jeremy Dawson <Jeremy.Dawson AT anu.edu.au>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] how to rewrite, needed to match goal
- Date: Thu, 17 Dec 2020 23:18:08 +1100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=anu.edu.au; dmarc=pass action=none header.from=anu.edu.au; dkim=pass header.d=anu.edu.au; 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=AZh8QL7FhZLeeOTFyu3lrSTXi+6JxyLqS2V6fY5Dz+o=; b=gN9hLzRDgO29LWBF1k0MN/yDy5wUYJbedoMM5jk9kjLae28hW8AC9JnxQaz5EGFjmX9aRijk1KdmW7a+fcaSIZkbMZtC5sSX10QExU1ztdlexWxBkoyhAwLewhRPbk6ZsyVADVU+GXGeG/J6vG9drk+7CXpICc1Ui8bDsmxspZkE9dYqVJxtOkvTAtIVtYlhkQ1yunEODE+YFcCGUWImxAErFGJXdYrnKgKjQN4zrffvKdJXx5T9W9gIJXY2H77XFvWqPrf0CfKzRDjAgc0kQBNB+I5xx8jtv2UZ4Ufo6ACj7lcSmAQaKHRNQPcXCGof1P9bRQR8i92FetPFZelDzg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QxXskv50oZQ6Idtu1H45wMVLx8twVnF/7L1zuCbKB7iyfpAMmdPZo6bEwUmf0K4zZ469Z5fXe74aOYGPueww8lf1MkLAC/8m8h0t2LMR5M9JklBtc7Hbkh5egvvfVUhFwsIxZuDcp5T1PymZYTBhGqeAswXVX0YaZX1nnz0Kq2g/gBD2u3zq2SXGnG/VOGrCy9BSRknoeBHyPOPOHBFUUHpQHtWc0r16YZVAZYjH/psr/4b1ia6YKiC+XQ7uE7lDtH7wSfln/FdjwKJ37EFpTEoefExViVXh7YY7hsJv8CIdo8JI5O8ViVogKoWmLrCk6WXt4HUId6KtAhoV2iKy6A==
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=Jeremy.Dawson AT anu.edu.au; spf=Pass smtp.mailfrom=Jeremy.Dawson AT anu.edu.au; spf=Pass smtp.helo=postmaster AT AUS01-SY4-obe.outbound.protection.outlook.com
- Ironport-phdr: 9a23:yVSCXRDE/t4Wdw76uoghUyQJP3N1i/DPJgcQr6AfoPdwSPX7pMbcNUDSrc9gkEXOFd2Cra4d1KyP4vurADRRqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRoLerpBIHSk9631+ev8JHPfglEnjWwba5wIRmssAncsscbjYR/JqotzhbCv2dFdflRyW50P1yYggzy5t23/J5t8iRQv+wu+stdWqjkfKo2UKJVAi0+P286+MPkux/DTRCS5nQHSWUZjgBIAwne4x7kWJr6rzb3ufB82CmeOs32UKw0VDG/5KplVBPklCEKPCM//WrKiMJ/kbhbrQq8qRJhzY7aYIKbOvRwcazfYdwUSmtBUclKWixdAY6xdZcDA/YPMOtaqYT2ulsArQG5BQmpHO7hziFHhmXo0q0/0+UqDA/I0xYuHtIVt3TUqsj+OaAWX++r1qnH0zDDbvNM1Tnz8ofJfAshofaKXb9ra8XRz1QvGxnbgVqNtIzpJSma1vkUvmWd8uFvWv6hhXQ9pAFtvjig2N0sio/Ri4wb1lzI6Sp3zZo2KNCkVEN1YcOoHIVOuy2EKod7X80sTn9otis51LAKpJG2cicFxZkoyBPSauKLfoeK7xztVOucJypzinF9eL+niBu+7VKsxvDgWsS2ylpGszZJn9vWunwQ2RHe5NCLR/R580u7xDqC1Bzf5vtaLU06l6fXMYMtz7oumpcVrE/NBDX5mF/sg6+Tbkgk+van6+DgYrj+upKTOZJ6hh3jPqg3h8KwA+s1PhEJX2eA5+uwzrrj/VDlQLpRif02j6/Zv43AKcQDvK65BBNV3Zg/5BajDjem19IYkWMALFJYZBKHi4/pO1bNIPziEfi/hFGsnC9qx/DAILLhHo3AI3ffnLv7YLpx90xRxBAuwdxD5Z9YEKwNLfz9V0PpsdzXFB45Mwi6w+b9D9V905sTV2aRDa+DLqzStF+J6vghLeaWao4VozH9K/4+6vH0i385hEURcre00psKcny3BOlmL12DYXXwmtcBDXsKvg0mQeP2j12CSCdfaGq2X6Ih/T42E5mmDIfGRoC1mrONxia7HptMZmBHEF+AC3nod5/XE8sLPSmVO4pqliEOfbmnUY4okx+05yHgzL8yDOfO9ygJ/b7qy8Ny4aWHtxwo+DllSeiUzHqKSUl9mH5OSjMrmqli9x8ugmyf2LR11qQLXedY4OlEB19jaczsitdiAtW3YTrvO8+TQQ/8ENygHHc8Qs93ysJcOx8gSeXntQjK2m+RO5FQl7GPA8BroIvh5CCoYv1MlzPB3qRniEQ6SMxSM2HgnrR46wXYG4/OlQOeirqucqMfmiXK8TXalDvcjARjSAd1FJ79czUab0rSo87+4xqYHbaoFPIqPhYHwNPQc6Y=
Thanks Clement, that's very helpful!
Cheers, Jeremy
On 17/12/20 5:05 pm, Clément Pit-Claudel wrote:
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+.