On a connection between algebra, logic and linguistics