theorem proving - Difficulty applying a proof in Idris -


i attempting prove property on 1 of defined data types follows:

reverseproof' : (inputblock : block itype isize iinputs)           -> (ind : fin rsize)           -> (rinputs : vect rsize ty)           -> (receiveblock : block rtype rsize rinputs)           -> (prf : index ind rinputs = itype)           -> (newinsert : maybeblockty itype)           -> (hvect (replaceat ind (maybeblockty itype) (map maybeblockty rinputs)))            ->  (hvect (map maybeblockty rinputs)) 

in attempting prove trying use earlier proved fact that:

replaceatproof' : (xs : vect n a)             -> (i : fin n)            -> (f : -> b)             -> ((index xs) = x)             -> (replaceat (f x) (map f xs)) = (map f xs)  

i hoping attempting rewrite appropriate expression in reverseatproof' achieve this, when attempting rewrite follows:

reverseproof' inputblock ind rinputs receiveblock prf newinsert x = rewrite replaceatproof' rinputs ind maybeblockty prf in x 

i error below:

when checking right hand side of reverseproof' expected type hvect (map maybeblockty rinputs)  rewriting replaceat ind           (maybe (len : nat ** tylist : vect len ty ** block itype len tylist))           (data.vect.vect n implementation of prelude.functor.functor, method map maybeblockty rinputs)                data.vect.vect n implementation of prelude.functor.functor, method map maybeblockty rinputs   did not change type hvect (data.vect.vect n implementation of prelude.functor.functor, method map maybeblockty rinputs) 

i read error saying not apply attempted rewrite not find specified pattern within x. appear because compiler reduces definition of

maybeblockty itype 

to be

maybe (len : nat ** tylist : vect len ty ** block itype len tylist) 

:edit definition of maybeblockty

is there way me prevent occurring given rewrite apply, or misreading given error?

rewrite changes type of goal using provided equality going left right. since need fit type of x, looks rewrite should go in opposite direction: try rewrite sym $ replaceatproof' rinputs ind maybeblockty prf in x


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -