-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Homework 5" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## 5.1" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Rules:\n", | ||
"1. If the unicorn is mythical, then it is immortal.\n", | ||
"2. If it is not mythical, then it is a mortal mammal. \n", | ||
"3. If the unicorn is either immortal or a mammal, then it is horned. \n", | ||
"4. If the unicorn is horned, then it is magical. \n", | ||
"\n", | ||
"You cannot prove the unicorn is mythical, but you can prove both that it is magical and that it is horned.\n", | ||
"We can't prove the unicorn is mythical because neither the first rule nor the second is a biconditional. So we have no way to conclude anything about whether the unicorn is mythical or not, since none of the other rules involve the unicorn's mythicality at all.\n", | ||
"\n", | ||
"To start proving the unicorn is horned and magical, either the unicorn is mythical or it is not mythical.\n", | ||
"\n", | ||
"Suppose the unicorn is mythical.\n", | ||
"\n", | ||
"Since it is mythical, it is immortal. \n", | ||
"\n", | ||
"Since it is immortal, it is either immortal or a mammal.\n", | ||
"\n", | ||
"Since it is either immortal or a mammal, it is horned.\n", | ||
"\n", | ||
"Since it is horned, then it is magical.\n", | ||
"\n", | ||
"Therefore, if the unicorn is mythical, then it is horned and magical.\n", | ||
"\n", | ||
"\n", | ||
"Alternatively, suppose the unicorn is not mythical.\n", | ||
"\n", | ||
"Since it is not mythical, it is a mortal and a mammal.\n", | ||
"\n", | ||
"Since it is a mortal and a mammal, it is a mammal.\n", | ||
"\n", | ||
"Since it is a mammal, it is either immortal or a mammal.\n", | ||
"\n", | ||
"Since it is either immortal or a mammal, then it is horned.\n", | ||
"\n", | ||
"Since it is horned, then it is magical.\n", | ||
"\n", | ||
"Therefore, if the unicorn is not mythical, then it is horned and magical.\n", | ||
"\n", | ||
"Since the unicorn is either mythical or not mythical, and either way the unicorn is horned and magical, the unicorn is horned and magical." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### More formally: " | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"1. mythical(unicorn) => immortal(unicorn)\n", | ||
"2. !mythical(unicorn) => mammal(unicorn) ^ mortal(unicorn)\n", | ||
"3. immortal(unicorn) v mammal(unicorn) => horned(unicorn)\n", | ||
"4. horned(unicorn) => magical(unicorn)\n", | ||
"_______________________________________\n", | ||
"5. mythical(unicorn) v !mythical(unicorn)\n", | ||
" 1. Suppose mythical(unicorn)\n", | ||
" _________________________________\n", | ||
" 2. immortal(unicorn) | (conditional elimination/modus ponens, from statements 1 and A)\n", | ||
" 3. immortal(unicorn) v mammal(unicorn) | (disjunctive introduction, statement B)\n", | ||
" 4. horned(unicorn) | (conditional elimination/modus ponens, from statements 3 and C)\n", | ||
" 5. magical(unicorn) | (conditional elimination/modus ponens, from statements 4 and D)\n", | ||
" 6. magical(unicorn) ^ horned(unicorn) | (conjunctive introduction, statements D and E)\n", | ||
"6. mythical(unicorn) => magical(unicorn) ^ horned(unicorn) | (conditional introduction, statements A-F)\n", | ||
" 7. Suppose !mythical(unicorn)\n", | ||
" _________________________________\n", | ||
" 8. mortal(unicorn) ^ mammal(unicorn) | (conditional elimination/modus ponens, from statements 2 and G)\n", | ||
" 9. mammal(unicorn) | (conjunction elimination, statement H)\n", | ||
" 10. immortal(unicorn) v mammal(unicorn) | (disjunctive introduction, statement I)\n", | ||
" 11. horned(unicorn) | (conditional elimination/modus ponens, from statements 3 and J)\n", | ||
" 12. magical(unicorn) | (conditional elimination/modus ponens, from statements 4 and K)\n", | ||
" 13. magical(unicorn) ^ horned(unicorn) | (conjunctive introduction, statements K and L)\n", | ||
"7. !mythical(unicorn) => magical(unicorn) ^ horned(unicorn) | (conditional introduction, statements G-M)\n", | ||
"8. magical(unicorn) ^ horned(unicorn) | (disjunction elimination, statements 5, 6, and 7)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"### Prolog" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"I think this program would be pretty difficult to program in Prolog. The main issue would be the second rule, where we conclude the unicorn is a mortal mammal as the result of the unicorn *not* being mythical. Rule one would be very easy; and while it might require multiple statements to state that the unicorn is a mortal mammal, that aspect of rule two would be doable. The final rules would be very easy. But the *not* aspect of rule two would complicate things considerably, I think, maybe even to the point of making it impossible. Making a negatory statement in Prolog is not simple." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## 5.2" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
" crossword(V1,V2,V3,H1,H2,H3) :- word(V1, _,A,_,B,_,C,_), \n", | ||
"\t\t\t\tword(V2, _,D,_,E,_,F,_),\n", | ||
"\t\t\t\tword(V3, _,G,_,H,_,I,_),\n", | ||
"\t\t\t\tword(H1, _,A,_,D,_,G,_),\n", | ||
"\t\t\t\tword(H2, _,B,_,E,_,H,_),\n", | ||
"\t\t\t\tword(H3, _,C,_,F,_,I,_),\n", | ||
"\t\t\t\tV1 \\== V2,\n", | ||
"\t\t\t\tV1 \\== V3,\n", | ||
"\t\t\t\tV1 \\== H1,\n", | ||
"\t\t\t\tV1 \\== H2,\n", | ||
"\t\t\t\tV1 \\== H3,\n", | ||
"\t\t\t\tV2 \\== V3,\n", | ||
"\t\t\t\tV2 \\== H1,\n", | ||
"\t\t\t\tV2 \\== H2,\n", | ||
"\t\t\t\tV2 \\== H3,\n", | ||
"\t\t\t\tV3 \\== H1,\n", | ||
"\t\t\t\tV3 \\== H2,\n", | ||
"\t\t\t\tV3 \\== H3,\n", | ||
"\t\t\t\tH1 \\== H2,\n", | ||
"\t\t\t\tH1 \\== H3,\n", | ||
"\t\t\t\tH2 \\== H3." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3.7 (tensorflow)", | ||
"language": "python", | ||
"name": "tensorflow" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.7.7" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |