Using eexists to construct record terms in Coq -


suppose there denary relation r on type a.

variable : type. variable r : -> -> -> -> -> -> -> -> -> -> prop. 

x , y different propositions both assert r holds on 10 terms of type a.

inductive x : prop := | x_intro : forall a0 a1 a2 a3 a4 a5 a6 a7 a8 a9,  r a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 -> x.   record y : prop := { a0 : a; a1 : a; a2 : a; a3 : a; a4 : a;   a5 : a; a6 : a; a7 : a; a8 : a; a9 : a;   ry : r a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 }.  

since x , y assert same things, should easy prove x -> y. could, instance, explicitly constructing proof of y.

theorem xy : x -> y. inversion 1. exists a0 a1 a2 a3 a4  a5 a6 a7 a8 a9. apply h0. qed. 

but seems unnecessary. last proposition obtained inversion on premise determines 10 terms, shouldn't have spell names out. postpone identification eexists , unify them later.

theorem xy' : x -> y. intro. eexists. inversion h. apply h0. 

but unification fails here. goals before apply h0:

h0 : r a0 a1 a2 a3 a4 a5 a6 a7 a8 a9  ======================== ( 1 / 1 ) r ?46 ?47 ?48 ?49 ?50 ?51 ?52 ?53 ?54 ?55 

all arguments r undetermined, should possible unify ?46 a0, ?47 a1, , on. why fail?

the error message along lines of:

unable unify "?a0" "a0" (cannot instantiate "?a0" because "a0" not in scope)

this common error. let me explain simple example.

let's start defining inductive data type wraps value of type a:

variable : type.  inductive box := | elem : -> box. 

next, let's define theorem data type states if have box, there exists element equal thing in box:

theorem boxok (b:box) : exists a, match b elem a' => = a' end. 

we can try prove way:

  eexists.   destruct b.   fail reflexivity. restart. 

but reflexivity fails, dreaded error message:

unable unify "?a" "a" (cannot instantiate "?a" because "a" not in scope: available arguments "elem a").

so happens here? term these tactics construct looks following:

ex_intro _ ?a (match b elem => eq_refl end). 

and asking coq fill in ?a a, cannot work because a not defined in scope of ?a. the common problem error eexists called early.

so instead, should destruct first, , call eexists. , works:

  destruct b.   eexists.   reflexivity. qed. 

the term these tactics construct looks following:

match b elem => (ex_intro _ ?a eq_refl) end. 

and a in ?a's scope , can filled in.

in example, should following (which did in manual proof).

theorem xy' : x -> y.   intro h.    inversion h [? ? ? ? ? ? ? ? ? ? h'].   eexists.    apply h'. qed. 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -