A program should turn the lights on if the light switch in the room is in the "ON" position. Similarly, it should turn on the lights if it detects there are people in the room using a motion sensor, regardless of whether the light switch is "ON" or "OFF". However, it should respect a master switch, such that if the master switch is off, the lights can not be turned on at all.

Switch A Motion B Master C Output
F F F F
F F T F
F T F F
F T T T
T F F F
T F T T
T T F F
T T T T

Motion Sensor ⋀ Master

Light Switch ⋀ Master

Light Switch ⋀ Motion Sensor ⋀ Master

Output

A ⋀ C

B ⋀ C

(A ⋀ C) ? (B ⋀ C)

(A ⋀ C) ⋁ (B ⋀ C)

(Light Switch ⋀ Master Switch)

(Motion Sensor ⋀ Master Switch)

Switch A Motion B Master C Output
F F F F
F F T F
F T F F
F T T T
T F F F
T F T T
T T F F
T T T T
Switch A Motion B Master C Output
F T T T
T F T T
T T T T

(¬A ⋀ B ⋀ C)
⋁ (A ⋀ ¬B ⋀ C)
⋁ (A ⋀ B ⋀ C)

(¬A ⋀ B ⋀ C)
⋁ (A ⋀ ¬B ⋀ C)
⋁ (A ⋀ B ⋀ C)

(¬A ⋀ B ⋀ C)
⋁ (A ⋀ ¬B ⋀ C)
⋁ (A ⋀ B ⋀ C)
⋁ (A ⋀ B ⋀ C)

(¬A ⋀ B ⋀ C)
⋁ (A ⋀ B ⋀ C)
⋁ (A ⋀ ¬B ⋀ C)
⋁ (A ⋀ B ⋀ C)

(¬A ⋀ B ⋀ C)
⋁ (A ⋀ B ⋀ C)
⋁ (¬B ⋀ A ⋀ C)
⋁ (B ⋀ A ⋀ C)

((¬A ⋀ (B ⋀ C))
(A ⋀ (B ⋀ C)))

((¬B ⋀ (A ⋀ C))
(B ⋀ (A ⋀ C)))

((¬A ⋀ (B ⋀ C))
(A ⋀ (B ⋀ C)))

((¬B ⋀ (A ⋀ C))
(B ⋀ (A ⋀ C)))

((B ⋀ C) ⋀ (¬A ⋁ A))

((¬B ⋀ (A ⋀ C))
(B ⋀ (A ⋀ C)))

((B ⋀ C) ⋀ (¬A ⋁ A))

((¬B ⋀ (A ⋀ C))
(B ⋀ (A ⋀ C)))

((B ⋀ C) ⋀ (¬A ⋁ A))

((A ⋀ C) ⋀ (¬B ⋁ B))

((B ⋀ C) ⋀ (¬A ⋁ A))

((A ⋀ C) ⋀ (¬B ⋁ B))

((B ⋀ C) ⋀ T)

((A ⋀ C) ⋀ T)

((B ⋀ C) ⋀ T)

((A ⋀ C) ⋀ T)

(B ⋀ C)

(A ⋀ C)

(Motion Sensor ⋀ Master Switch)

(Light Switch ⋀ Master Switch)

(Master Switch)

(Light Switch ⋁ Motion Sensor)