pre and post condition contracts for Set and Matrix