module PDS open std/ord -- opens specification template for linear order sig Component { name: Name, main: option Service, export: set Service, import: set Service, version: Number }{ no import & export } sig PDS { components: set Component, schedule: components -> Service ->? components, requires: components -> components }{ components.import in components.export } fact SoundPDSs { all P : PDS | with P { all c : components, s : Service | --1 let c' = c.schedule[s] { (some c' iff s in c.import) && (some c' => s in c'.export) } all c : components | c.requires = c.schedule[Service] } --2 } sig Name, Number, Service {} fun AddComponent(P, P': PDS, c: Component) { not c in P.components P'.components = P.components + c } run AddComponent for 3 but 2 PDS fun RemoveComponent(P, P': PDS, c : Component) { c in P.components P'.components = P.components - c } run RemoveComponent for 3 but 2 PDS fun HighestVersionPolicy(P: PDS) { with P { all s : Service, c : components, c' : c.schedule[s], c'' : components - c' { s in c''.export && c''.name = c'.name => c''.version in c'.version.^(Ord[Number].prev) } } } run HighestVersionPolicy for 3 but 1 PDS fun AGuidedSimulation(P,P',P'' : PDS, c1, c2 : Component) { AddComponent(P,P',c1) RemoveComponent(P,P'',c2) HighestVersionPolicy(P) HighestVersionPolicy(P') HighestVersionPolicy(P'') } run AGuidedSimulation for 3 assert AddingIsFunctionalForPDSs { all P, P', P'': PDS, c: Component { AddComponent(P,P',c) && AddComponent(P,P'',c) => P' = P'' } } check AddingIsFunctionalForPDSs for 3