-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMelissaNaomi.agda
306 lines (235 loc) · 7.61 KB
/
MelissaNaomi.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
-- Melissa and Naomi talking
module MelissaNaomi where
open import Data.Empty using (⊥)
open import Data.Product using (Σ-syntax; _,_)
open import Data.String using (String)
open import Data.Unit using (⊤)
open import Function using (_∘_)
open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl; cong; subst; sym)
open import Coercion
postulate
LOC TIM : Set
-- Пример. Devlin, p. 610 sqq
postulate
Human Door Object SIT Referable : Set
-- some coercions
postulate
fDO : Door → Object
fHO : Human → Object
fOR : Object → Referable
instance
DOc : Door <: Object
DOc = coerce fDO
HOc : Human <: Object
HOc = coerce fHO
OOc : Object <: Object
OOc = identityCoercion
ORc : Object <: Referable
ORc = coerce fOR
DRc : Door <: Referable
DRc = coerce (fOR ∘ fDO)
HRc : Human <: Referable
HRc = coerce (fOR ∘ fHO)
HHc : Human <: Human
HHc = identityCoercion
Stc : ∀ {a} → Set a <: Set a
Stc = identityCoercion
postulate
_refers-to_via_/_,_ : Human → Referable → String → LOC → TIM → Set
_speaks-to_/_,_ : Human → Human → LOC → TIM → Set
_utters_/_,_ : Human → String → LOC → TIM → Set
-- someone uttering a phrase, speaking to someone
record SitUttering : Set where
constructor mkSitUttering
field
{l} : LOC
{t} : TIM
{speaker} : Human
{listener} : Human
{phr} : String
spk : speaker speaks-to listener / l , t
utt : speaker utters phr / l , t
open SitUttering {{...}} public
-- reference situations
-- Someone refers when utters something.
record SitRef : Set where
field
situ : SitUttering
open SitUttering --public
field
{referent} : Referable
{phrase} : String -- not necessarily equal to SitUttering.phr
referring : (speaker situ) refers-to referent via phrase / l situ , t situ
-- someone utters 'I'
record SitI : Set where
field
situ : SitUttering
open SitUttering --public
field
uI : phr situ ≡ "I"
-- Melissa speaks to Naomi "A man is at the door"
postulate
_at-the-door_ : Human → Door → Set
-- described situation: a man at the door.
-- The type of situations described by the phrase "A man is at the door".
record SitManDoor : Set where
field
{man} : Human
{door} : Door
mandoor : man at-the-door door
module theSit where -- Our situation
postulate sitManDoor : SitManDoor
open SitManDoor sitManDoor using (door) -- we don't know the man Melissa refers to
Melissa-man = SitManDoor.man sitManDoor
Melissa-mandoor = SitManDoor.mandoor sitManDoor
postulate
Melissa Naomi : Human
sitUttering-mandoor : SitUttering
s≡m : SitUttering.speaker sitUttering-mandoor ≡ Melissa
l≡n : SitUttering.listener sitUttering-mandoor ≡ Naomi
p≡md : SitUttering.phr sitUttering-mandoor ≡ "A man is at the door"
loc = SitUttering.l sitUttering-mandoor
tim = SitUttering.t sitUttering-mandoor
postulate
mrefd : Melissa refers-to ⟪ door ⟫ via "door" / loc , tim
mrefm : Melissa refers-to ⟪ Melissa-man ⟫ via "man" / loc , tim
_ : Σ[ x ∈ Human ] x at-the-door door
_ = Melissa-man , Melissa-mandoor
_ : Σ[ x ∈ Human ] Σ[ y ∈ Door ] x at-the-door y
_ = Melissa-man , door , Melissa-mandoor
-- the type of Humans Melissa refers to
_ : Σ[ x ∈ Human ] Σ[ p ∈ String ] Σ[ l ∈ LOC ] Σ[ t ∈ TIM ]
Melissa refers-to ⟪ x ⟫ via p / l , t
_ = Melissa-man , "man" , loc , tim , mrefm
-- Melissa refers to door (when speaks to Naomi)
MrD : SitRef
MrD = record
{ situ = sitUttering-mandoor
; referring =
subst (λ x → x refers-to ⟪ door ⟫ via "door" / loc , tim)
(sym s≡m) mrefd
}
-- Melissa refers to man (when speaks to Naomi)
MrM : SitRef
MrM = record
{ situ = sitUttering-mandoor
; referring =
subst (λ x → x refers-to ⟪ Melissa-man ⟫ via "man" / loc , tim)
(sym s≡m) mrefm
}
-- Defining meaning ---------------------------------
postulate
Meaning : Set
fRM : Referable → Meaning
-- What meaning can be:
instance
RMc : Referable <: Meaning
RMc = coerce fRM
OMc : Object <: Meaning
OMc = coerce (fRM ∘ fOR)
DMc : Door <: Meaning
DMc = coerce (fRM ∘ fOR ∘ fDO)
HMc : Human <: Meaning
HMc = coerce (fRM ∘ fOR ∘ fHO)
MMc : Meaning <: Meaning
MMc = identityCoercion
RRc : Referable <: Referable
RRc = identityCoercion
-- The situation in which someone utters a phrase that means something.
-- Simple uttering cannot be meaningful, there should be some reference.
record SitMeaning (A : Set) : Set where
field
sitmu : A → SitUttering
meaning : A → Referable -- Meaning
open SitMeaning {{...}} public
-- abstract meaning
instance
SMRef : SitMeaning SitRef
sitmu {{SMRef}} = SitRef.situ
meaning {{SMRef}} s = ⟪ SitRef.referent s ⟫
-- meaning-in-use
_ : meaning MrD ≡ ⟪ door ⟫
_ = refl
_ : meaning MrM ≡ ⟪ Melissa-man ⟫
_ = refl
-- but we don't need to define MrD or MrM:
_ : meaning record
{ situ = sitUttering-mandoor
; referring =
subst (λ x → x refers-to ⟪ door ⟫ via "door" / loc , tim)
(sym s≡m) mrefd
}
≡ ⟪ door ⟫
_ = refl
-- abstract meaning = the speaker of SitI
instance
SMI : SitMeaning SitI
sitmu {{SMI}} = SitI.situ
meaning {{SMI}} s = ⟪ SitUttering.speaker (SitI.situ s) ⟫
postulate
sitUttering-I : SitUttering
s≡mI : SitUttering.speaker sitUttering-I ≡ Melissa
p≡mdI : SitUttering.phr sitUttering-I ≡ "I"
-- meaning-in-use
-- the meaning of 'I' = Melissa
_ : meaning record
{ situ = sitUttering-I
; uI = p≡mdI
}
≡ ⟪ Melissa ⟫
_ = ≡-coerce s≡mI
-- Situations as meaning.
postulate
fSR : SIT → Referable
fMDS : SitManDoor → SIT
instance
SRc : SIT <: Referable
SRc = coerce fSR
SMc : SIT <: Meaning
SMc = coerce (fRM ∘ fSR)
SSc : SIT <: SIT
SSc = identityCoercion
MDSc : SitManDoor <: SIT
MDSc = coerce fMDS
MDRc : SitManDoor <: Referable
MDRc = coerce (fSR ∘ fMDS)
MDMc : SitManDoor <: Meaning
MDMc = coerce (fRM ∘ fSR ∘ fMDS)
-- Melissa utters 'Man at the door'
postulate
mref-mandoor : SitUttering.speaker sitUttering-mandoor
refers-to ⟪ sitManDoor ⟫ via "A man is at the door"
/ loc , tim
instance
SMSIT : SitMeaning SitRef
sitmu {{SMSIT}} = SitRef.situ
meaning {{SMSIT}} s = ⟪ SitRef.referent s ⟫
_ : meaning record
{ situ = sitUttering-mandoor
; referring = mref-mandoor
}
≡ ⟪ sitManDoor ⟫
_ = refl
-- -- Resource situations
-- -- Melissa utters "The man I saw running yesterday is at the door"
-- postulate
-- _runs/_ : Human → TIM → Set
-- yesterday : TIM
-- -- Resource situation "a man running yesterday"
-- record man-runs : Set where
-- field
-- man : Human
-- mrun : man runs/ yesterday
-- -- open man-runs
-- record MsNr : Set where
-- open man-runs
-- field
-- loc : LOC
-- tim : TIM
-- sit-mr : man-runs
-- door : Door
-- mandoor : at-the-door (man sit-mr) door
-- phrase : String
-- utters : Melissa utters phrase to Naomi / loc , tim
-- refm : Melissa refers-to ⟪ man sit-mr ⟫ via MAN / loc , tim
-- refd : Melissa refers-to ⟪ door ⟫ via DOOR / loc , tim