0

I want to change the hypothesis H from the form below

mL : Map
mR : Map
H : forall (k : RecType) (e : String.string),
       MapsTo k e (filter (is_vis_cookie l) mL) <->
       MapsTo k e (filter (is_vis_cookie l) mR)
-------------------------------------------------------
Goal

to

mL : Map
mR : Map
k : RecType
e : String.string
H : MapsTo k e (filter (is_vis_cookie l) mL) <->
    MapsTo k e (filter (is_vis_cookie l) mR)
-------------------------------------------------------
Goal

I think, they can both solve the same goal, but I need the hypothesis in the later form. Or more specifically, further separating k into its elements, like below. How can I change the hypotheses H to these two forms?

    mL : Map
    mR : Map
    ks : String.string
    kh : String.string
    e : String.string
    H : MapsTo {| elem1:= ks; elem2:= kh|} e (filter (is_vis_cookie l) mL) <->
        MapsTo {| elem1:= ks; elem2:= kh|} e (filter (is_vis_cookie l) mR)
    -------------------------------------------------------
    Goal
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Khan
  • 303
  • 2
  • 14

1 Answers1

3

To do this, you need to have in your context a term k of type RecType and a term of type e of type String.string. With this, you can obtain this:


Using pose proof (H k e) as Hke:

mL : Map
mR : Map
k : RecType
e : String.string
H : forall (k : RecType) (e : String.string),
    MapsTo k e (filter (is_vis_cookie l) mL) <->
    MapsTo k e (filter (is_vis_cookie l) mR)
Hke : MapsTo k e (filter (is_vis_cookie l) mL) <->
      MapsTo k e (filter (is_vis_cookie l) mR)
-------------------------------------------------------
Goal

Notice that you still have H available.


Using specialize (H k e).:

mL : Map
mR : Map
k : RecType
e : String.string
H : MapsTo k e (filter (is_vis_cookie l) mL) <->
    MapsTo k e (filter (is_vis_cookie l) mR)
-------------------------------------------------------
Goal

Notice that H has been specialized, and cannot be specialized again.


You cannot "obtain" k and e from H though, this does not make much sense for universal quantification, as these are formal parameters of the term H (a function does not carry its arguments, rather it asks for them as input).

You must be mistaken with existential quantification, where you can destruct an hypothesis to obtain the witness and the proof that the witness satisfies the property.

Ptival
  • 9,167
  • 36
  • 53
  • Thanks for your reply. Actually, I dont have `k` and `e` in the context. I tried a goal of the form `forall (k : RecType) (e : String.string), MapsTo k e (filter (is_vis_cookie l) mL) <-> MapsTo k e (filter (is_vis_cookie l) mR)` with `intros k e`. (**now k and e are in context *) then `apply H`, but then `k` and `e` re-combines..., which I don't want... – Khan Mar 26 '13 at 10:25
  • What you're doing is very confusing and shows that you don't really understand what is going on. Could you provide the shape of your actual goal for instance? – Ptival Mar 26 '13 at 14:10
  • I am not expert, my questions may be annoying. sorry for that. The goal is: `StringMap.MapsTo zk zv (get_site_cookies (http_s_url p d ru) ckmL) <-> StringMap.MapsTo zk zv (get_site_cookies (http_s_url p d ru) ckmR)` where `zk` and `zv` are key-value strings, `RecType` is a record of five elements (key is one of them) and `get_site_cookies` is a fold with f operating only on 3 elements of `RecType`. `MapsTo` in H in post above is CookieMap.MapsTo... It may be difficult to understand the types/maps, however, I can provide the detailed types/functions, if you need. – Khan Apr 02 '13 at 08:32
  • It's ok to be a beginner. Just try to give details to help people help you! So it seems that, if you need to apply your hypothesis `H`, you want to use it on `zk` and `zv` using something such as `specialize (H zk zv).`. However, it gives you a proof of `MapsTo zk zv (filter (is_vis_cookie l) mL) <-> MapsTo zk zv (filter (is_vis_cookie l) mR)`. This is still a far cry from your goal (if `mL` and `ckmL` aren't the same, it might even be useless). Since `get_site_cookies` is a fold, you probably want a proof by induction. – Ptival Apr 02 '13 at 14:47