Two traffic lights stand on your way to work, and you logged them for some days: each day is a pair [first_green, second_green], 1 if that light was green when you got there and 0 if not. Write chance_both(log): the chance that both lights are green on a day, judging by the log.
Two traffic lights logged for 20 days: light 1 on top, light 2 below, green when it was green. Each is green half the time, so multiplying says both are green a quarter of the days, but these two share a timer. Rewired to the opposite, multiplying still says a quarter. The goal is the chance both are green, read from the log.
chance_both(log)| log | a list of days, each [first_green, second_green]: 1 if that light was green that day, 0 if not | e.g. [[1, 1], [0, 0], [1, 1], [1, 0], [0, 1], [… |
| returns | the chance that both lights are green on a day | |