Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

polymorphic equality in coq

I cannot find a standard library == function which is overloaded and returns a boolean (or a sumbool, or something I can compute with). I would like to be able to do

3==5

and

"hello" == "hello"

without having to specify the type of the arguments. I would be surprised if Coq does not have this feature for equality types; could someone tell me where to find it? I have a feeling it has something to do with ssreflect but I cannot figure it out.

Thanks.

like image 882
push33n Avatar asked Sep 13 '26 15:09

push33n


1 Answers

Ssreflect has the eqType class, which has exactly what you need:

From mathcomp Require Import ssreflect ssrfun ssrbool eqtype.

Check (3 == 5).

Most standard types have an equality operator defined in ssreflect. Unfortunately, strings are not one of them, though it is not to hard to roll up your own. (The Deriving library ships with an instance, but it is not marked as stable yet.)

like image 132
Arthur Azevedo De Amorim Avatar answered Sep 20 '26 19:09

Arthur Azevedo De Amorim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!