Updated to support literal canonicalization and both lexical and value equality testing.