Add hard core lattice model.
Update sum example
Fix type inference bugs
Fix sum example