A Formal Framework with Refinement