diff --git a/formal/checklist.vdmsl b/formal/checklist.vdmsl index b74004a..6982548 100644 --- a/formal/checklist.vdmsl +++ b/formal/checklist.vdmsl @@ -24,98 +24,53 @@ values before_start_procedure: Procedure = [fuel_chkl, pax_sign_chkl, windows_chkl, acol_chkl]; - aircraft = mk_Aircraft(aircraft_panels, {"Before Start" |-> before_start_procedure}); + aircraft = mk_Aircraft(aircraft_panels, before_start_procedure); types - --@LF can this be empty? perhaps seq1? - String = seq of char; + --@doc The dataref name in X-Plane + Dataref = seq1 of char; -- Aircraft -- Switches --@doc The state a switch can be in - -- 1 means off SwitchState = | | ; --@LF why have a type kist as a rename? - ItemState = SwitchState; + ItemState = SwitchState; --@TODO | Button | ... --@doc A switch, with the possible states it can be in, and the state that it is in Switch :: - position : SwitchState - middlePosition : bool - inv s == - --@LF boolean conditions like these are clearer described as - -- not s.middlePosition => s.position <> - -- = - -- (s.position = => s.middlePosition) - -- - -- - --if s.middlePosition = false then - -- s.position <> - --else true; - (s.position = => s.middlePosition); + position : SwitchState + middlePosition : bool + inv s == + (s.position = => s.middlePosition); -- Knob Knob :: - position : nat1 - --@LF how can a state be an int? perhaps a proper type (i..e. subset of int range or a union?) - states : seq1 of int - inv k == - --@LF if k.pos <= len k.states and pos is nat1, then states better be seq1 as well?! It implicitly already is anyhow. - k.position <= len k.states; + position : nat + --@LF how can a state be an int? perhaps a proper type (i..e. subset of int range or a union?) + states : set1 of nat + inv k == + k.position in set k.states; Lever = nat inv t == t <= 100; Throttle :: - thrust: Lever - reverser: Lever - inv t == - --@LF again, this is "programming" not modelling. This one won't turn out as clear as the one for Switch - -- but it is effectively this - -- - -- (t.thrust > 0 <=> t.reverser = 0) - -- - -- that is, if t.thurst > 0 then t.reverser = 0 and - -- and , if not (t.thurst > 0) then not t.reverser = 0 - -- == - -- if (t.thurst <= 0) then t.reverser <> 0 - -- - -- coming to think of this, t.reverser is already >= 0 (i.e. it's a nat?). - -- so the else is spurious (i.e. it is a good as "true"). Don't you mean - -- "t.reverser > 0"? (i.e. if thurst is <= 0, then reverser cannot be zero)? - -- - -- again, this is concrete example how logic is better to illstrate issue than if-then-else. - -- arguably this is also a matter of taste. But as-is, this seems wrong. - if t.thrust > 0 then - t.reverser = 0 - else - t.reverser >= 0; + thrust: Lever + reverser: Lever + inv t == + (t.reverser > 0 <=> t.thrust = 0); --@doc The type that the action of the button is ItemType = | |