This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
verify ( (strategy) => Real.({ | |
valid_strategy(strategy) ==> | |
( expected_reward ( | |
make_scenario_pmf(pDoorsBiased,strategy) | |
) <= 2000000.0 / 3.0 ) | |
})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expected_reward( | |
make_scenario_pmf(pDoorsEqual, CX.strategy) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type choice = | |
| Stay | |
| Swap | |
type scenario = | |
{ prize : door | |
, first_guess : door | |
, choice : choice | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let prize = 1000000.0 | |
type door = | |
| DoorA | |
| DoorB | |
| DoorC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let pDoorsBiased = (door : door) => Real.( | |
switch (door){ | |
| DoorA => 3.0 / 5.0 | |
| DoorB | DoorC => 1.0 / 5.0 | |
} | |
); | |
valid_door_pmf(pDoorsBiased) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let random_then_stay_strategy : (door => choice => real) = | |
(door) => (choice) => Real.( | |
switch(door,choice){ | |
| ( _ ,Stay) => 1.0 / 3.0 | |
| ( _ ,Swap) => 0.0 | |
} | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expected_reward( | |
make_scenario_pmf(pDoorsEqual, random_then_stay_strategy) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let make_scenario_pmf : (door => real) => (door => choice => real) => (scenario => real) = | |
(door_pmf) => (strategy) => (s) => Real.({ | |
door_pmf(s.prize) * strategy(s.first_guess, s.choice) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let expected_reward : (scenario => real) => real = | |
(scenario_pmf) => Real.({ | |
let pr = (s) => scenario_pmf(s) * reward(s); | |
let avg = (choice) => { | |
let avg = (first_guess) => { | |
pr { prize: DoorA, first_guess, choice} + | |
pr { prize: DoorB, first_guess, choice} + | |
pr { prize: DoorC, first_guess, choice} | |
}; | |
avg(DoorA) + avg(DoorB) + avg(DoorC) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let valid_strategy : (door => choice => real) => bool = | |
(strategy) => Real.({ | |
(strategy(DoorA,Stay) >= 0.0) && (strategy(DoorA,Swap) >= 0.0) && | |
(strategy(DoorB,Stay) >= 0.0) && (strategy(DoorB,Swap) >= 0.0) && | |
(strategy(DoorC,Stay) >= 0.0) && (strategy(DoorC,Swap) >= 0.0) && | |
( strategy(DoorA,Stay) + strategy(DoorA,Swap) + | |
strategy(DoorB,Stay) + strategy(DoorB,Swap) + | |
strategy(DoorC,Stay) + strategy(DoorC,Swap) == 1.0) | |
}); |