Subtype requirements -- signature and behavior

Safety properties -- nothing bad


slide: Subtyping and behavior


Example -- $IntSet \not<= FatSet$

History property -- not satisfied by $IntSet$


slide: History properties -- example


Types as behavior -- constraints

  • x : 9..11 <=> x : Int /\ 9 <= x <= 11

Behavioral constraints -- signature versus assertions

  • f(x:9..11) : 3..5 { ... }


    int f(int x) {
       require( 9 <= x  && x <= 11 );
       ...
       promise( 3 <= result && result <= 5);
       return result;
       }
  

slide: Types and behavioral constraints