0

I have defined a Semigroup as follows:

record Semigroup : Set1 where
    field
        X : Set
        e : X
        _◇_  :  X -> X -> X
        assoc : ∀ {x y z} -> (x ◇ y) ◇ z -> x ◇ (y ◇ z)

But I get the following error:

X should be a sort, but it isn't
when checking that the expression (x ◇ y) ◇ z has type _52

Can anyone help me determine what's wrong?

user1023733
  • 805
  • 5
  • 14

1 Answers1

0

Never mind, the problem was that (x ◇ y) ◇ z and x ◇ (y ◇ z) were of type X and Agda was expecting them to be of type Set. This code works:

record Semigroup {X} (_≈_ : Rel X): Set1 where
    field
        e : X
        _◇_  :  X -> X -> X
        equivalence : Equivalence _≈_
        assoc : ∀ {x y z} -> ((x ◇ y) ◇ z) ≈ (x ◇ (y ◇ z))
user1023733
  • 805
  • 5
  • 14