module Checklist exports all definitions values -- Before Start Checklist -- Items in Aircraft -- Flight Deck... (can't check) fuel: ItemObject = mk_ItemObject(, mk_Switch(, false)); pax_sign: ItemObject = mk_ItemObject(, mk_Switch(, true)); windows: ItemObject = mk_ItemObject(, mk_Switch(, false)); -- Preflight steps acol: ItemObject = mk_ItemObject(, mk_Switch(, false)); aircraft_panels: Items = {"Fuel Pump" |-> fuel, "Passenger Signs" |-> pax_sign, "Windows" |-> windows, "Anti Collision Lights" |-> acol}; -- Checklist -- Flight Deck... (can't check) fuel_chkl: ChecklistItem = mk_ChecklistItem("Fuel Pump", , , false); pax_sign_chkl: ChecklistItem = mk_ChecklistItem("Passenger Signs", , , false); windows_chkl: ChecklistItem = mk_ChecklistItem("Windows", , , false); -- Preflight steps acol_chkl: ChecklistItem = mk_ChecklistItem("Anti Collision Lights", , , false); before_start_procedure: Procedure = [fuel_chkl, pax_sign_chkl, windows_chkl, acol_chkl]; aircraft = mk_Aircraft(aircraft_panels, {"Before Start" |-> before_start_procedure}); types --@LF can this be empty? perhaps seq1? String = seq 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; --@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); -- 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; 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; --@doc The type that the action of the button is ItemType = | |