SLIDE 12 Inheritance and Parameterization
Finite Stacks
species stack ( typ is setoid , max in i n t ) inherits setoid = sig empty in self ; sig push in typ → self → self ; sig pop in self → self ; sig head in self → typ ; sig size in self → i n t ; l e t i s _ f u l l ( s ) = #int_eq ( ! size ( s ) , max ) ; l e t is_empty ( s ) = ! equal ( s , ! empty ) ; property size_max : a l l s in self , # i n t _ l e q ( ! size ( s ) , max ) ; property ie_empty : a l l s in self , ! is_empty ( ! empty ) ; property hd_push : a l l e in typ , a l l s in self , not ( ! i s _ f u l l ( s ) ) → typ ! equal ( ! head ( ! push (e , s ) ) , e ) ; property id_ppop : a l l e in typ , a l l s in self , not ( ! i s _ f u l l ( s ) ) → ! equal ( ! pop ( ! push (e , s ) ) , s ) ; . . . end
- D. Delahaye (CEDRIC/CNAM)
From Focal to UML UML&FM’08 12 / 20