简体   繁体   中英

Using sets as hyphotesis and goal in COQ

How exactly could a proof like the following be completed?

1 subgoals
IHt1 : {t' : some_type | something_using t'}
IHt2 : {t' : some_type | something_else_using t'}
______________________________________(1/1)
{t' : some_type | another_thing_involving t'}

I do understand that the {x|P x} notation is a shorthand for the sig definition but I really cannot understand how to use it.

{x : D | P x} {x : D | P x} is intuitively speaking the subset of the domain D containing the elements that satisfy the predicate P . As a proposition, it is true if that subset is non-empty, ie if there is a witness x0 in D such that P x0 is true.

An object of type {x : D | P x} {x : D | P x} is a pair containing an element x0 : D and a proof of P x0 . This is visible when you look at the definition of {x : D | P x} {x : D | P x} , which is syntactic sugar for sig (fun x:D => P x)

Inductive sig (D:Type) (P:D -> Prop) : Type :=
    exist : forall x:D, P x -> sig P.

The type of the constructor is a dependent pair type; the first element of the pair has the type D and the second element has the type P x in which x is the first element.

To make use of a hypothesis of the form {x : D | P x} {x : D | P x} , the most basic way is to use the destruct tactic to break it down into its two components: a witness x0 : D and a proof H : P x0 .

destruct IHt1.

1 subgoals
t' : some_type
H : something_using t'
IHt2 : {t'0 : some_type | something_else_using t'0}
______________________________________(1/1)
{t'0 : some_type | another_thing_involving t'0}

To prove a goal of the form {x : D | P x} {x : D | P x} , the most basic is to use the exist tactic to introduce the intended witness. This leaves one subgoal which is to prove that the witness has the desired property.

exists u.

⋮
______________________________________(1/1)
another_thing_involving u

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM