-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathcoqlib.v
266 lines (208 loc) · 6.33 KB
/
coqlib.v
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
(* Basic types *)
Parameter Entity : Type.
Parameter Event : Type.
Parameter Rel : Entity -> Entity -> Prop.
Parameter Prog : Prop -> Prop.
Parameter two : Entity -> Prop.
Parameter _people : Entity -> Prop.
(* Temporal operators *)
Parameter Hold : Event -> Prop.
Parameter Cul : Event -> Prop.
Parameter Past : Event -> Prop.
Parameter Future : Event -> Prop.
(* Thematic roles *)
Parameter Subj : Event -> Entity.
Parameter Top : Event -> Entity.
Parameter Acc : Event -> Entity.
Parameter AccI : Event -> Prop -> Prop.
Parameter AccE : Event -> Event.
Parameter Dat : Event -> Entity.
Parameter Attr : Event -> Entity.
Parameter Deg : Event -> Entity.
(* for underspecified terms *)
Parameter ArgOf : Entity -> Entity -> Prop.
Parameter _in_front_of : Event -> Entity -> Prop.
(* Generalized quantifiers *)
Parameter Most : (Entity -> Prop) -> (Entity -> Prop) -> Prop.
Notation "'most' x ; P , Q" := (Most (fun x => P) (fun x => Q))
(at level 30, x ident, right associativity) : type_scope.
Axiom most_ex_import :
forall (F G: Entity -> Prop),
(Most F G -> exists x, F x /\ G x).
Axiom most_consv :
forall (F G: Entity -> Prop),
(Most F G -> Most F (fun x => (F x /\ G x))).
Axiom most_rightup :
forall (F G H: Entity -> Prop),
((Most F G) ->
(forall x, G x -> H x) -> (Most F H)).
Hint Resolve most_ex_import most_consv most_rightup.
(* veridical predicates *)
Parameter _true : Prop -> Prop.
Axiom veridical_true : forall P, (_true P -> P).
Ltac solve_veridical_true :=
match goal with
H : _true _ |- _
=> try apply veridical_true in H
end.
(* anti-veridical predicates *)
Parameter _false : Prop -> Prop.
Axiom antiveridical_false : forall P, (_false P -> ~P).
Hint Resolve antiveridical_false.
Ltac solve_antiveridical_false :=
match goal with
H : _false _ |- _
=> try apply antiveridical_false in H
end.
(* implicative verbs *)
Parameter _manage : Event -> Prop.
Axiom implicative_manage : forall v : Event, forall P : Prop, AccI v P -> _manage v -> P.
Ltac solve_implicative_manage :=
match goal with
H1 : _manage ?v, H2 : AccI ?v _ |- _
=> try apply implicative_manage in H2
end.
Parameter _fail : Event -> Prop.
Axiom implicative_fail : forall v : Event, forall P : Prop, AccI v P -> _fail v -> ~ P.
Ltac solve_implicative_fail :=
match goal with
H : _fail ?v, H2 : AccI ?v _ |- _
=> try apply implicative_fail in H2
end.
(* factive verbs *)
Parameter _know : Event -> Prop.
Axiom factive_know : forall v : Event, forall P : Prop, AccI v P -> _know v -> P.
Ltac solve_factive :=
match goal with
H1 : _know ?v, H2 : AccI ?v _ |- _
=> try apply factive_know in H2
end.
(* privative adjectives *)
Parameter _former : Prop -> Prop.
Axiom privative_former : forall P, (_former P -> ~P).
Ltac solve_privative_former :=
match goal with
H : _former _ |- _
=> try apply privative_former in H
end.
Parameter _fake : Prop -> Prop.
Axiom privative_fake : forall P, (_fake P -> ~P).
Ltac solve_privative_fake :=
match goal with
H : _fake _ |- _
=> try apply privative_fake in H
end.
(* before and after *)
Parameter _before : Event -> Event -> Prop.
Parameter _after : Event -> Event -> Prop.
Axiom transitivity_before : forall v1 v2 v3 : Event,
_before v1 v2 -> _before v2 v3 -> _before v1 v3.
Axiom transitivity_after : forall v1 v2 v3 : Event,
_after v1 v2 -> _after v2 v3 -> _after v1 v3.
Axiom before_after : forall v1 v2 : Event,
_before v1 v2 -> _after v2 v1.
Axiom after_before : forall v1 v2 : Event,
_after v1 v2 -> _before v2 v1.
Hint Resolve transitivity_before transitivity_after before_after after_before.
(* Preliminary tactics *)
Ltac apply_ent :=
match goal with
| [x : Entity, H : forall x : Entity, _ |- _]
=> apply H; clear H
end.
Ltac eqlem_sub :=
match goal with
| [ H1: ?A ?t, H2: forall x, @?D x -> @?C x |- _ ]
=> match D with context[ A ]
=> assert(C t); try (apply H2 with (x:= t)); clear H2
end
end.
Axiom unique_role : forall v1 v2 : Event, Subj v1 = Subj v2 -> v1 = v2.
Ltac resolve_unique_role :=
match goal with
H : Subj ?v1 = Subj ?v2 |- _
=> repeat apply unique_role in H
end.
Ltac substitution :=
match goal with
| [H1 : _ = ?t |- _ ]
=> try repeat resolve_unique_role; try rewrite <- H1 in *; subst
| [H1 : ?t = _ |- _ ]
=> try resolve_unique_role; try rewrite H1 in *; subst
end.
Ltac exchange :=
match goal with
| [H1 : forall x, _, H2 : forall x, _ |- _]
=> generalize dependent H2
end.
Ltac exchange_equality :=
match goal with
| [H1 : _ = _, H2: _ = _ |- _]
=> generalize dependent H2
end.
Ltac clear_pred :=
match goal with
| [H1 : ?F ?t, H2 : ?F ?u |- _ ]
=> clear H2
end.
Ltac solve_false :=
match goal with
| [H : _ -> False |- False]
=> apply H
end.
(* Main tactics *)
Ltac nltac_init :=
try(intuition;
try solve_false;
firstorder;
repeat subst;
firstorder).
Ltac nltac_base :=
try nltac_init;
try (eauto; eexists; firstorder);
try repeat substitution;
try (subst; eauto; firstorder; try congruence).
Ltac nltac_axiom :=
try first
[solve_veridical_true |
solve_antiveridical_false |
solve_implicative_manage |
solve_implicative_fail |
solve_factive |
solve_privative_former |
solve_privative_fake
].
Ltac nltac_set :=
repeat (nltac_init;
try repeat substitution;
try exchange_equality;
try repeat substitution;
try eqlem_sub).
Ltac nltac_set_exch :=
repeat (nltac_init;
try repeat substitution;
try apply_ent;
try exchange;
try eqlem_sub).
Ltac nltac_final :=
try solve [repeat nltac_base | clear_pred; repeat nltac_base].
Axiom urevent : Event.
Ltac ap_event := try apply urevent.
Ltac solve_gq :=
match goal with
H : Most _ _ |- _
=> let H0 := fresh in
try solve [
pose (H0 := H); eapply most_ex_import in H0;
try (nltac_set; nltac_final) |
pose (H0 := H); eapply most_consv in H0;
eapply most_rightup in H0;
try (nltac_set; nltac_final) |
pose (H0 := H); eapply most_consv in H0;
try (nltac_set; nltac_final) |
pose (H0 := H); eapply most_rightup in H0;
try (nltac_set; nltac_final) ]
end.
Ltac nltac :=
try solve
[nltac_set; nltac_final].