I want to write a function which take set as input and return true if it is top and false if it is bottom.
I have tried in this way..
isTop : Set → Bool
isTop x = if (x eq ⊤) then true
else false
But i am not able to define eq correctly. I tried as..
_eq_ : Set → Set → Bool
⊤ eq ⊥ = false
This is not working because when i check T eq T it is also returning false.
Please help me to write this eq function or any other ways to write isTop.
isTop
? – luquiisTop
, but the reason⊤ eq ⊤
is returning false is because you cannot pattern match on something of typeSet
. Agda is interpreting⊤
and⊥
as ordinary variable names. It would be same same as sayingx eq y = false
. – MattSet
is not an inductively defined type, so you can't use pattern matching on that. Suppose you could somehow have a definition for_eq_
using pattern matching. Later on you could add a custom typedata Foo : Set where ...
, whereFoo
was not considered in the definition of_eq_
. – chi