Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % file: security.pl
- % Title: CPSC 322 Assignment 3 Question 4
- % Authors: Chris Liu (35551118) & Adriano Sela Aviles (31063150)
- % a (door) sensor is triggered if:
- % a door is open, the door has a sensor, and power is on (live).
- triggered(S) <- door_open(DOOR) & hasSensor(DOOR, S) & live(S).
- % a (laser) sensor is triggered if:
- % a laser is interrupted, the laser has a sensor, and the power is on (live).
- triggered(S) <- laser_interrupted(LASER) & hasSensor(LASER, S) & live(S).
- % a (window) sensor is triggered if:
- % a window is broken is broken, the window has a sensor, and the power is on (live).
- triggered(S) <- window_broken(WINDOW) & hasSensor(WINDOW, S) & live(S).
- % an alarm is triggered if:
- % a sensor is triggered and the alarm is a system
- alarm_triggered(ALARM) <- triggered(S) & system(ALARM).
- % the power is on ( live(S) is true ) if:
- % S is live and connected (there is a current)
- live(S) <- connected_to(S,S1) & live(S1).
- % connected_to(x, y) is true if x is connected to y s.t. current flows from y to x.
- connected_to(ds1,power).
- connected_to(ls1,ds1) <- circuit_ok(c1).
- connected_to(ws1,ls1) <- circuit_ok(c2).
- % initial sensor/alarms setup - do not modify
- hasSensor(door1,ds1).
- hasSensor(laser1,ls1).
- hasSensor(window1, ws1).
- system(alarm1).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement