From 1cfdb1162beea779d2fb888a8ecc034a03e6c6d4 Mon Sep 17 00:00:00 2001 From: kach Date: Wed, 3 Jul 2024 00:12:33 -0400 Subject: [PATCH] rsa recursive swap speaker/listener --- demo-rsa-recursive.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/demo-rsa-recursive.py b/demo-rsa-recursive.py index 88cdce8..90d4951 100644 --- a/demo-rsa-recursive.py +++ b/demo-rsa-recursive.py @@ -13,17 +13,6 @@ def denotes(u, r): [1, 1] ])[r, u] -@memo -def listener[u: U, r: R](beta, t): - cast: [listener, speaker] - listener: thinks[ - speaker: given(r in R, wpp=1), - speaker: chooses(u in U, wpp=speaker[u, r](beta, t - 1) if t > 0 else denotes(u, r)) - ] - listener: observes [speaker.u] is u - listener: chooses(r in R, wpp=E[speaker.r == r]) - return E[listener.r == r] - @memo def speaker[u: U, r: R](beta, t): cast: [speaker, listener] @@ -35,6 +24,17 @@ def speaker[u: U, r: R](beta, t): ]) return E[speaker.u == u] +@memo +def listener[u: U, r: R](beta, t): + cast: [listener, speaker] + listener: thinks[ + speaker: given(r in R, wpp=1), + speaker: chooses(u in U, wpp=speaker[u, r](beta, t - 1) if t > 0 else denotes(u, r)) + ] + listener: observes [speaker.u] is u + listener: chooses(r in R, wpp=E[speaker.r == r]) + return E[listener.r == r] + beta = 3. for t in range(10): ic(t, listener(beta, t), speaker(beta, t)) \ No newline at end of file