coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Ramkumar Ramachandra <artagnon AT gmail.com>
- To: coq-club AT inria.fr
- Subject: Re: [Coq-Club] [NEWBIE] Applying Nat.eq_dec
- Date: Fri, 5 Jan 2018 13:12:28 -0800
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=artagnon AT gmail.com; spf=Pass smtp.mailfrom=artagnon AT gmail.com; spf=None smtp.helo=postmaster AT mail-yw0-f174.google.com
- Ironport-phdr: 9a23:0PgscxEGufZbsEia+EreYZ1GYnF86YWxBRYc798ds5kLTJ78ps2wAkXT6L1XgUPTWs2DsrQY07OQ6/iocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmCexbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj8KODw38G/XhMJ+j79Vrgy9qBFk2YHYfJuYOeBicq/Bf94XQ3dKUMZLVyxGB4Oxd5cBAPAEPeZbson9okEBrQGjDgewHuzvzyVHiWP23aIg1eQuDBvG0xY9FN8JqnvUtsn1O70dUeCzy6nIyy7Ob/xT2Tjn6YjIdgotru2LXbJ1aMfcz1QkGQDdjliIt4DpIzeY2v4OvmWb9eZsSOOih3M9pw1soDWiycEhgZTTiI0P0FDL7yB5zZ41JdKmTE57ZsapEJ5KuCGbM4t6W8MjQm90tCojxL0KpJy2cScQxJQowB7fbPOHc4yW7R75SOmRJjJ4iGpkeLK5mRmy7VCtxvPgWsSwylpHrSpInsPRun0MyhDf8NWLR/ly80u53DaAzQHT6uVKIUAukqrbLoYszaQqlpoPq0vDESn2mELwjKKNeUUk//Kn6+XjYrn8upCcMIp0hhnkMqsygsy/Hfg4Mg8WUmeH/uS8zaTv8lH9QLVXlfI7ibLZsZDfJcQDvKG1GQ5V0oA56xa+FTiqytoYnWNUZG5CLRmAls3iP0zECPH+F/a2xVq2wxlxwPWTBLTkAYjIJ2KLqr7kdL194khQ0gN7mdlF+5tbDLYHCP32U0718tffC0lqYESP3+/7BYAlhcslUmWVD/rBPQ==
Now I have an additional Lemma which I'm not able to apply, due to "Cannot change D, it is used in conclusion".
Lemma trivialEq : forall a : M.key, {a = a} + {a <> a} -> True.
Proof.
trivial.
Qed.
Lemma keyInMap : forall a b, M.find (elt := nat) a [a |-> b] = Some b.
Proof.
intros.
unfold update. unfold fst. unfold snd.
rewrite F.add_o.
unfold Nat_as_OT.eq_dec.
remember (Nat.eq_dec a a) as D.
apply trivialEq in D.
My hypothesis and goals window looks like this in the last step:
- a: M.key
- b: nat
- D: {a = a} + {a <> a}
- HeqD: D = Nat.eq_dec a a
- 1/1(if D then Some b else M.find (elt:=nat) a [ ]) = Some b
Why do I get the error? I have all the right types for unification.
Thanks.
Ram
On Thu, Jan 4, 2018 at 6:47 PM, Ramkumar Ramachandra <artagnon AT gmail.com> wrote:
Hi folks,I'm trying to use Coq to prove that M.find (referring to FMapAVL) finds an element that exists in the map. Here's my progress so far:Lemma keyInMap : forall a b, M.find (elt := nat) a [a |-> b] = Some b.Proof.intros.unfold update. unfold fst. unfold snd.rewrite F.add_o.unfold Nat_as_OT.eq_dec.remember (Nat.eq_dec a a) as D.induction D.reflexivity.rewrite F.empty_o.Qed.Somehow, I get stuck with this to prove:
- a: M.key
- b: nat
- b0: a <> a
- HeqD: right b0 = Nat.eq_dec a a
- 1/1None = Some b
Which is a falsehood, so I think I did the wrong thing by using "induction D". To eliminate one of the cases of the `if`, I will need to apply `Nat.eq_dec`, and I'm unable to apply it for some strange reason.Some pointers would be appreciated.Thanks.Ram
- [Coq-Club] [NEWBIE] Applying Nat.eq_dec, Ramkumar Ramachandra, 01/05/2018
- Re: [Coq-Club] [NEWBIE] Applying Nat.eq_dec, Ramkumar Ramachandra, 01/05/2018
- Re: [Coq-Club] [NEWBIE] Applying Nat.eq_dec, Yao Li, 01/05/2018
- Re: [Coq-Club] [NEWBIE] Applying Nat.eq_dec, Ramkumar Ramachandra, 01/06/2018
- Re: [Coq-Club] [NEWBIE] Applying Nat.eq_dec, Yao Li, 01/06/2018
- Re: [Coq-Club] [NEWBIE] Applying Nat.eq_dec, Ramkumar Ramachandra, 01/06/2018
- Re: [Coq-Club] [NEWBIE] Applying Nat.eq_dec, Yao Li, 01/05/2018
- Re: [Coq-Club] [NEWBIE] Applying Nat.eq_dec, ikdc, 01/07/2018
- Re: [Coq-Club] [NEWBIE] Applying Nat.eq_dec, Ramkumar Ramachandra, 01/05/2018
Archive powered by MHonArc 2.6.18.