Case-based modeling and the SACS Toolkit: a mathematical outline