Add hash function for Expr

Fixes #4406
Add test for hash(Expr)
Merge pull request #4408 from simonster/expr-hash

Add hash function for Expr