/*----------------------------------------------------------------------
--  User rules for procedure Door.UnlockDoor.
--
--  File name: unlockdoor.rlu
--
--  Description:
--    Procedure rule file.
--
--  Author: Phil Thornley, April 2009.  See www.sparksure.com
--
-- Copyright (c) 2009, Phil Thornley
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions
-- are met:
--
--  * Redistributions of source code must retain the above copyright
--    notice, this list of conditions and the following disclaimer.
--
--  * Redistributions in binary form must reproduce the above copyright
--    notice, this list of conditions and the following disclaimer in
--    the documentation and/or other materials provided with the distribution.
--
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
-- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------*/


/*----------------------------------------------------------------------
--  Rule 1
--
--  Justification:
--    The conclusion (C) and the hypothesis (1) are equivalent:
--      C1 and (1)2 are the same condition.
--      C2 and (1)1 are equivalent as:
--        the proof function thecurrentdoor(State) models the CurrentDoor
--        element of the refined State, so:
--            thecurrentdoor(S2) = fld_currentdoor(S2) and
--            fld_currentdoor(S2) = fld_currentdoor(S) by (2).
--      C3 and (1)3 are equivalent as:
--        the proof function prf_alarmtimeout models the AlarmTimeout
--        element of the refined State, so:
--            prf_alarmtimeout(S2) = fld_alarmtimeout(S2)
--      C4 and (1)4 are equivalent as:
--        the proof function thedooralarm models the DoorAlarm
--        element of the refined State, so:
--            thedooralarm(S2) = fld_dooralarm(S2).
----------------------------------------------------------------------*/
unlockdoor_user(1): B1 and                                                 /* C1 */
                    (thecurrentdoor(S2) = open and                         /* C2 */
                     clock__greaterthanorequal(T, prf_alarmtimeout(S2)))   /* C3 */
                    <->
                    thedooralarm(S2) = alarmtypes__alarming                /* C4 */
                      may_be_deduced_from
                    [ fld_currentdoor(S) = open and                        /* (1)1 */
                      (B1 and                                              /* (1)2 */
                       clock__greaterthanorequal(T, fld_alarmtimeout(S2))) /* (1)3 */
                      <->
                      fld_dooralarm(S2) = alarmtypes__alarming,            /* (1)4 */
                      fld_currentdoor(S)  = fld_currentdoor(S2)  ] .       /* (2)  */
