Add files via upload
This commit is contained in:
@@ -261,7 +261,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"The function `statement3` takes as input a single possible birthdate and returns `True` if Albert's statement is true for that birthdate. How do we go from Albert's English statement to a Python function? Let's paraphrase it in a form that uses the concepts we have defined:\n",
|
"The function `statement3` takes as input a single possible birthdate and returns `True` if Albert's statement is true for that birthdate. How do we go from Albert's English statement to a Python function? Let's paraphrase it in a form that uses the concepts we have defined:\n",
|
||||||
"\n",
|
"\n",
|
||||||
"> **Albert**: After Cheryl **told** me the **month** of her birthdate, my **belief set** was such that I didn't **know** her birthday. I do know that Bernard does not know. How do I know that? I can see that for **all** the possible dates in my **belief set**, if Bernard was **told** the **day** of that date, he would **not know** Cheryl's birthday.\n",
|
"> **Albert**: After Cheryl **told** me the **month** of her birthdate, my **belief set** was such that I didn't **know** her birthday. And I know that Bernard does not know; in other words he could not make the statement that he knows. How do I know that? I can see that for all the possible dates in my **belief set**, if Bernard was **told** the **day** of that date, he would **not know** Cheryl's birthday.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"That I can translate directly into code:"
|
"That I can translate directly into code:"
|
||||||
]
|
]
|
||||||
@@ -275,9 +275,9 @@
|
|||||||
"def statement3(date) -> bool:\n",
|
"def statement3(date) -> bool:\n",
|
||||||
" \"\"\"Albert: I don't know when Cheryl's birthday is, but I know that Bernard does not know too.\"\"\"\n",
|
" \"\"\"Albert: I don't know when Cheryl's birthday is, but I know that Bernard does not know too.\"\"\"\n",
|
||||||
" albert_beliefs = told(month(date))\n",
|
" albert_beliefs = told(month(date))\n",
|
||||||
" return (not know(albert_beliefs) \n",
|
" return not know(albert_beliefs) and not satisfy(albert_beliefs, bernard_knows)\n",
|
||||||
" and all(not know(told(day(d))) \n",
|
"\n",
|
||||||
" for d in albert_beliefs))"
|
"def bernard_knows(date) -> bool: return know(told(day(date))) "
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -481,7 +481,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"dates = '06:32, 06:43, 06:50, 07:17, 07:46, 08:19, 08:32, 09:17, 09:19, 09:50'.replace(':', ' ').split(', ')\n",
|
"times = '06:32 06:43 06:50 07:17 07:46 08:19 08:32 09:17 09:19 09:50'.split()\n",
|
||||||
|
"dates = [t.replace(':', ' ') for t in times]\n",
|
||||||
"\n",
|
"\n",
|
||||||
"cheryls_birthday()"
|
"cheryls_birthday()"
|
||||||
]
|
]
|
||||||
|
|||||||
359
ipynb/Maze.ipynb
359
ipynb/Maze.ipynb
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user