ilyasergey / pnp

Lecture notes for a short course on proving/programming in Coq via SSReflect.
https://ilyasergey.net/pnp
BSD 2-Clause "Simplified" License
159 stars 16 forks source link

Redefinition of `reflect` lacks View-Hints #18

Closed WojciechKarpiel closed 4 years ago

WojciechKarpiel commented 4 years ago

Hi!

Thank you for writing the book, I enjoy learning from it!

In chapter 5 "Views and Boolean reflection", reader is encouraged to redefine reflect (note that in the actual code definition is wrapped in a module): https://github.com/ilyasergey/pnp/blob/master/coq/BoolReflect.v#L680 then the book redefines andP (original code uses the o ssrbool.reflect, while a reader likely uses his own version of reflect): https://github.com/ilyasergey/pnp/blob/master/coq/BoolReflect.v#L728 then the book defines andb_orb, which relies on elimTF View-Hint, which is absent from reader-defined reflect (therefore type-checking fails): https://github.com/ilyasergey/pnp/blob/master/coq/BoolReflect.v#L777 then the book explains that elimTF is necessary (if it didn't, then I'd be totally in the dark about what went wrong :P): https://github.com/ilyasergey/pnp/blob/master/coq/BoolReflect.v#L815

My problem is that reader fails to prove andb_orb when following the book. I suggest changing the text so that there is no unexpected type-checking failure. For example, either:

ilyasergey commented 4 years ago

Dear Wojciech,

Thank you for the suggestion. Please, feel free to arrange them as a PR – I'll be happy to review and adopt them once they are considered acceptable.