Optimize cartographer.infer by ignoring constant functions
Add K rules to cartographer.infer