Invariant generation

Merging with current develop branch and a few bug fixes in revamped trans sys.