Cleanup ProtoCore.Type and fix MAGN-1851

This is the cleanup work for ProtoCore.Type. Some issues in FFI is related to it. 

1. Type.IsIndexable is a public field, so that it could be set. And in multiple places, a type's rank could be arbitrary and at the same time is not indexable (IsIndexable == false), or, a type's rank is 0 but it is indexable. In this submission this field is changed to a getter. 
2. Constant.kUndefinedRank is removed. 
3. Code cleanup for built in methods.