Commit 28910297 authored by jfschaefer's avatar jfschaefer

added current version of Fragment 4 (this is the sketch we came up with in...

added current version of Fragment 4 (this is the sketch we came up with in class, much work still needed)
parent 2d55c27e
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Fragment 4\n",
"\n",
"Let's focus on noun phrases.\n",
"\n",
"Example sentences:\n",
"* *Peter loved the cat*\n",
"* *Peter killed the cat with a white tail*\n",
"* *Peter chased the gangster in hte car*\n",
"* *Peter loved every cat*\n",
"* *every man loved a woman*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### First we define the grammar rules:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Changed to archive Teaching/lbs1920"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"Changed to subdirectory generated"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"archive Teaching/lbs1920\n",
"subdir generated"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Defined Frag4Cat"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"abstract Frag4Cat = Frag3Cat ** {\n",
" cat\n",
" Det ; -- the, every, some, a, ...\n",
" Prep ;\n",
" PrepPhrase ;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Defined Frag4Grammar"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"abstract Frag4Grammar = Frag3Grammar, Frag4Cats ** {\n",
" fun\n",
" n2np : Det -> Noun -> NounPhrase ;\n",
" makePP : Prep -> NounPhrase -> PrepPhrase ;\n",
" prepnp : NounPhrase -> PrepPhrase -> NounPhrase ;\n",
" -- \"the cat\" \"with\" \"a white tail\" -> \"the cat with a white tail\"\n",
" prepvp : VerbPhraseInf -> PrepPhrase -> VerbPhraseInf ;\n",
" every : Det ;\n",
" the : Det ;\n",
" some : Det ;\n",
" a_Det : Det ;\n",
" \n",
" in_Prep : Prep ;\n",
" with_Prep : Prep ;\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"invalid unit: http://mathhub.info/Teaching/lbs1920?Frag4GrammarSemantics?[http://mathhub.info/Teaching/lbs1920/generated/Frag4Grammar.gf?Frag4Grammar]/n2np?definition: Judgment |- [det,noun]det noun : (noun⟶pred1⟶o)⟶(noun⟶ι)\n",
"invalid unit: http://mathhub.info/Teaching/lbs1920?Frag4GrammarSemantics?[http://mathhub.info/Teaching/lbs1920/generated/Frag4Grammar.gf?Frag4Grammar]/n2np?definition: Judgment |- [det,noun]det noun : (noun⟶pred1⟶o)⟶(noun⟶ι)\n",
"unbound token: ∀\n",
"invalid unit: http://mathhub.info/Teaching/lbs1920?Frag4GrammarSemantics?[http://mathhub.info/Teaching/lbs1920/generated/Frag4Grammar.gf?Frag4Grammar]/every?definition: Judgment |- [P,Q]∀ [x](P x)⇒(Q x) : noun⟶pred1⟶o\n",
"unbound token: ∃\n",
"invalid unit: http://mathhub.info/Teaching/lbs1920?Frag4GrammarSemantics?[http://mathhub.info/Teaching/lbs1920/generated/Frag4Grammar.gf?Frag4Grammar]/some?definition: Judgment |- [P,Q]∃ [x](P x)∧(Q x) : noun⟶pred1⟶o\n",
"keyword expected, within module http://mathhub.info/Teaching/lbs1920?Frag4GrammarSemantics\n",
"invalid element: view is not total: http://mathhub.info/Teaching/lbs1920?Frag4GrammarSemantics"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"view Frag4GrammarSemantics : https://mathhub.info/Teaching/lbs1920/generated/Frag4Grammar.gf?Frag4Grammar -> ?frag3DomainTheory =\n",
" include ?Frag3GrammarSemantics ❙\n",
" // noun = ι ⟶ o ❙\n",
" Det = noun ⟶ pred1 ⟶ o ❙\n",
" Prep = ι ⟶ (ι ⟶ ι) ❙\n",
" PrepPhrase = ι ⟶ ι ❙\n",
" n2np = [det,noun] det noun ❙\n",
" makePP = [prep, np] prep np ❙\n",
" prepnp = [np,pp] pp np ❙\n",
" // prepvp : (ι ⟶ o) ⟶ PrepPhrase ⟶ (ι ⟶ o) ❙\n",
" prepvp = [vp,pp] [x] vp (pp x) ❙\n",
" every = [P,Q] ∀[x] (P x) ⇒ (Q x) ❙\n",
" some = [P,Q] ∃[x] (P x) ∧ (Q x) ❙\n",
"❙"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "GLF",
"language": "gf",
"name": "glf"
},
"language_info": {
"codemirror_mode": {
"name": "gf",
"version": 3
},
"file_extension": ".gf",
"mimetype": "text/gf",
"name": "gf"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment