Universal qauntification hypothesis in Coq

南笙酒味 提交于 2020-01-07 04:37:01

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/15573794/universal-qauntification-hypothesis-in-coq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!