|
| 1 | +(* Basic types *) |
| 2 | +Parameter Entity : Type. |
| 3 | +Parameter Event : Type. |
| 4 | + |
| 5 | +Parameter Rel : Entity -> Entity -> Prop. |
| 6 | +Parameter Prog : Prop -> Prop. |
| 7 | +Parameter two : Entity -> Prop. |
| 8 | +Parameter _people : Entity -> Prop. |
| 9 | + |
| 10 | +(* Temporal operators *) |
| 11 | +Parameter Hold : Event -> Prop. |
| 12 | +Parameter Cul : Event -> Prop. |
| 13 | +Parameter Past : Event -> Prop. |
| 14 | +Parameter Future : Event -> Prop. |
| 15 | + |
| 16 | +(* Thematic roles *) |
| 17 | +Parameter Subj : Event -> Entity. |
| 18 | +Parameter Top : Event -> Entity. |
| 19 | +Parameter Acc : Event -> Entity. |
| 20 | +Parameter AccI : Event -> Prop -> Prop. |
| 21 | +Parameter AccE : Event -> Event. |
| 22 | +Parameter Dat : Event -> Entity. |
| 23 | +Parameter Attr : Event -> Entity. |
| 24 | +Parameter Deg : Event -> Entity. |
| 25 | + |
| 26 | +(* for underspecified terms *) |
| 27 | +Parameter ArgOf : Entity -> Entity -> Prop. |
| 28 | + |
| 29 | +Parameter _in_front_of : Event -> Entity -> Prop. |
| 30 | + |
| 31 | +(* Generalized quantifiers *) |
| 32 | +Parameter Most : (Entity -> Prop) -> (Entity -> Prop) -> Prop. |
| 33 | + |
| 34 | +Notation "'most' x ; P , Q" := (Most (fun x => P) (fun x => Q)) |
| 35 | + (at level 30, x ident, right associativity) : type_scope. |
| 36 | + |
| 37 | +Axiom most_ex_import : |
| 38 | + forall (F G: Entity -> Prop), |
| 39 | + (Most F G -> exists x, F x /\ G x). |
| 40 | + |
| 41 | +Axiom most_consv : |
| 42 | + forall (F G: Entity -> Prop), |
| 43 | + (Most F G -> Most F (fun x => (F x /\ G x))). |
| 44 | + |
| 45 | +Axiom most_rightup : |
| 46 | + forall (F G H: Entity -> Prop), |
| 47 | + ((Most F G) -> |
| 48 | + (forall x, G x -> H x) -> (Most F H)). |
| 49 | + |
| 50 | +Hint Resolve most_ex_import most_consv most_rightup. |
| 51 | + |
| 52 | +(* veridical predicates *) |
| 53 | +Parameter _true : Prop -> Prop. |
| 54 | + |
| 55 | +Axiom veridical_true : forall P, (_true P -> P). |
| 56 | + |
| 57 | +Ltac solve_veridical_true := |
| 58 | + match goal with |
| 59 | + H : _true _ |- _ |
| 60 | + => try apply veridical_true in H |
| 61 | + end. |
| 62 | + |
| 63 | +(* anti-veridical predicates *) |
| 64 | +Parameter _false : Prop -> Prop. |
| 65 | + |
| 66 | +Axiom antiveridical_false : forall P, (_false P -> ~P). |
| 67 | + |
| 68 | +Hint Resolve antiveridical_false. |
| 69 | + |
| 70 | +Ltac solve_antiveridical_false := |
| 71 | + match goal with |
| 72 | + H : _false _ |- _ |
| 73 | + => try apply antiveridical_false in H |
| 74 | + end. |
| 75 | + |
| 76 | +(* implicative verbs *) |
| 77 | +Parameter _manage : Event -> Prop. |
| 78 | + |
| 79 | +Axiom implicative_manage : forall v : Event, forall P : Prop, AccI v P -> _manage v -> P. |
| 80 | + |
| 81 | +Ltac solve_implicative_manage := |
| 82 | + match goal with |
| 83 | + H1 : _manage ?v, H2 : AccI ?v _ |- _ |
| 84 | + => try apply implicative_manage in H2 |
| 85 | + end. |
| 86 | + |
| 87 | +Parameter _fail : Event -> Prop. |
| 88 | + |
| 89 | +Axiom implicative_fail : forall v : Event, forall P : Prop, AccI v P -> _fail v -> ~ P. |
| 90 | + |
| 91 | +Ltac solve_implicative_fail := |
| 92 | + match goal with |
| 93 | + H : _fail ?v, H2 : AccI ?v _ |- _ |
| 94 | + => try apply implicative_fail in H2 |
| 95 | + end. |
| 96 | + |
| 97 | +(* factive verbs *) |
| 98 | +Parameter _know : Event -> Prop. |
| 99 | + |
| 100 | +Axiom factive_know : forall v : Event, forall P : Prop, AccI v P -> _know v -> P. |
| 101 | + |
| 102 | +Ltac solve_factive := |
| 103 | + match goal with |
| 104 | + H1 : _know ?v, H2 : AccI ?v _ |- _ |
| 105 | + => try apply factive_know in H2 |
| 106 | + end. |
| 107 | + |
| 108 | +(* privative adjectives *) |
| 109 | +Parameter _former : Prop -> Prop. |
| 110 | +Axiom privative_former : forall P, (_former P -> ~P). |
| 111 | + |
| 112 | +Ltac solve_privative_former := |
| 113 | + match goal with |
| 114 | + H : _former _ |- _ |
| 115 | + => try apply privative_former in H |
| 116 | + end. |
| 117 | + |
| 118 | +Parameter _fake : Prop -> Prop. |
| 119 | +Axiom privative_fake : forall P, (_fake P -> ~P). |
| 120 | + |
| 121 | +Ltac solve_privative_fake := |
| 122 | + match goal with |
| 123 | + H : _fake _ |- _ |
| 124 | + => try apply privative_fake in H |
| 125 | + end. |
| 126 | + |
| 127 | +(* before and after *) |
| 128 | +Parameter _before : Event -> Event -> Prop. |
| 129 | +Parameter _after : Event -> Event -> Prop. |
| 130 | + |
| 131 | +Axiom transitivity_before : forall v1 v2 v3 : Event, |
| 132 | + _before v1 v2 -> _before v2 v3 -> _before v1 v3. |
| 133 | + |
| 134 | +Axiom transitivity_after : forall v1 v2 v3 : Event, |
| 135 | + _after v1 v2 -> _after v2 v3 -> _after v1 v3. |
| 136 | + |
| 137 | +Axiom before_after : forall v1 v2 : Event, |
| 138 | + _before v1 v2 -> _after v2 v1. |
| 139 | + |
| 140 | +Axiom after_before : forall v1 v2 : Event, |
| 141 | + _after v1 v2 -> _before v2 v1. |
| 142 | + |
| 143 | +Hint Resolve transitivity_before transitivity_after before_after after_before. |
| 144 | + |
| 145 | + |
| 146 | +(* Preliminary tactics *) |
| 147 | + |
| 148 | +Ltac apply_ent := |
| 149 | + match goal with |
| 150 | + | [x : Entity, H : forall x : Entity, _ |- _] |
| 151 | + => apply H; clear H |
| 152 | + end. |
| 153 | + |
| 154 | +Ltac eqlem_sub := |
| 155 | + match goal with |
| 156 | + | [ H1: ?A ?t, H2: forall x, @?D x -> @?C x |- _ ] |
| 157 | + => match D with context[ A ] |
| 158 | + => assert(C t); try (apply H2 with (x:= t)); clear H2 |
| 159 | + end |
| 160 | + end. |
| 161 | + |
| 162 | +Axiom unique_role : forall v1 v2 : Event, Subj v1 = Subj v2 -> v1 = v2. |
| 163 | +Ltac resolve_unique_role := |
| 164 | + match goal with |
| 165 | + H : Subj ?v1 = Subj ?v2 |- _ |
| 166 | + => repeat apply unique_role in H |
| 167 | + end. |
| 168 | + |
| 169 | +Ltac substitution := |
| 170 | + match goal with |
| 171 | + | [H1 : _ = ?t |- _ ] |
| 172 | + => try repeat resolve_unique_role; try rewrite <- H1 in *; subst |
| 173 | + | [H1 : ?t = _ |- _ ] |
| 174 | + => try resolve_unique_role; try rewrite H1 in *; subst |
| 175 | + end. |
| 176 | + |
| 177 | +Ltac exchange := |
| 178 | + match goal with |
| 179 | + | [H1 : forall x, _, H2 : forall x, _ |- _] |
| 180 | + => generalize dependent H2 |
| 181 | + end. |
| 182 | + |
| 183 | +Ltac exchange_equality := |
| 184 | + match goal with |
| 185 | + | [H1 : _ = _, H2: _ = _ |- _] |
| 186 | + => generalize dependent H2 |
| 187 | + end. |
| 188 | + |
| 189 | +Ltac clear_pred := |
| 190 | + match goal with |
| 191 | + | [H1 : ?F ?t, H2 : ?F ?u |- _ ] |
| 192 | + => clear H2 |
| 193 | + end. |
| 194 | + |
| 195 | +Ltac solve_false := |
| 196 | + match goal with |
| 197 | + | [H : _ -> False |- False] |
| 198 | + => apply H |
| 199 | + end. |
| 200 | + |
| 201 | +(* Main tactics *) |
| 202 | + |
| 203 | +Ltac nltac_init := |
| 204 | + try(intuition; |
| 205 | + try solve_false; |
| 206 | + firstorder; |
| 207 | + repeat subst; |
| 208 | + firstorder). |
| 209 | + |
| 210 | +Ltac nltac_base := |
| 211 | + try nltac_init; |
| 212 | + try (eauto; eexists; firstorder); |
| 213 | + try repeat substitution; |
| 214 | + try (subst; eauto; firstorder; try congruence). |
| 215 | + |
| 216 | +Ltac nltac_axiom := |
| 217 | + try first |
| 218 | + [solve_veridical_true | |
| 219 | + solve_antiveridical_false | |
| 220 | + solve_implicative_manage | |
| 221 | + solve_implicative_fail | |
| 222 | + solve_factive | |
| 223 | + solve_privative_former | |
| 224 | + solve_privative_fake |
| 225 | + ]. |
| 226 | + |
| 227 | +Ltac nltac_set := |
| 228 | + repeat (nltac_init; |
| 229 | + try repeat substitution; |
| 230 | + try exchange_equality; |
| 231 | + try repeat substitution; |
| 232 | + try eqlem_sub). |
| 233 | + |
| 234 | +Ltac nltac_set_exch := |
| 235 | + repeat (nltac_init; |
| 236 | + try repeat substitution; |
| 237 | + try apply_ent; |
| 238 | + try exchange; |
| 239 | + try eqlem_sub). |
| 240 | + |
| 241 | +Ltac nltac_final := |
| 242 | + try solve [repeat nltac_base | clear_pred; repeat nltac_base]. |
| 243 | + |
| 244 | +Axiom urevent : Event. |
| 245 | +Ltac ap_event := try apply urevent. |
| 246 | + |
| 247 | +Ltac solve_gq := |
| 248 | + match goal with |
| 249 | + H : Most _ _ |- _ |
| 250 | + => let H0 := fresh in |
| 251 | + try solve [ |
| 252 | + pose (H0 := H); eapply most_ex_import in H0; |
| 253 | + try (nltac_set; nltac_final) | |
| 254 | + pose (H0 := H); eapply most_consv in H0; |
| 255 | + eapply most_rightup in H0; |
| 256 | + try (nltac_set; nltac_final) | |
| 257 | + pose (H0 := H); eapply most_consv in H0; |
| 258 | + try (nltac_set; nltac_final) | |
| 259 | + pose (H0 := H); eapply most_rightup in H0; |
| 260 | + try (nltac_set; nltac_final) ] |
| 261 | + end. |
| 262 | + |
| 263 | +Ltac nltac := |
| 264 | + try solve |
| 265 | + [nltac_set; nltac_final]. |
| 266 | + |
0 commit comments