prototype stuff for invariant checking