Add files via upload
This commit is contained in:
parent
6c6221b868
commit
507d42f8f1
@ -62,7 +62,18 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'May'"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"month('May 15')"
|
||||
]
|
||||
@ -71,7 +82,18 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'15'"
|
||||
]
|
||||
},
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"day('May 15')"
|
||||
]
|
||||
@ -129,7 +151,18 @@
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"{'May 15', 'May 16', 'May 19'}"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"told('May')"
|
||||
]
|
||||
@ -196,7 +229,7 @@
|
||||
"\n",
|
||||
"Here is the main function, `cheryls_birthday`, which computes the subset of dates in the global variable `dates` that satisfy statements 3 through 5. We will define a **statement** as a boolean function that takes a single date as input and returns true if the statement would be true in the condition that the given date is Cheryl's actual birthday. So a statement only has to consider one date at a time. But the code within a statement may have to consider the belief states of Albert and Bernard, to determine if the statement is true.\n",
|
||||
"\n",
|
||||
"The function `satisfy` takes a collection of dates and some statement(s) and returns the subset that satisfies all the statements:"
|
||||
"The function `satisfy` takes a collection of dates and some statement(s) and returns the subset of dates that satisfies all the statements."
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -240,7 +273,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def albert1(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, and I know that Bernard does not know.\"\n",
|
||||
" albert_beliefs = told(month(date))\n",
|
||||
" return not know(albert_beliefs) and not satisfy(albert_beliefs, bernard_knows)\n",
|
||||
"\n",
|
||||
|
Loading…
Reference in New Issue
Block a user