| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
open Names |
| 12 |
open Genredexpr |
| 13 |
open Tac2expr |
| 14 |
open Tac2val |
| 15 |
open Tac2ffi |
| 16 |
open Tac2types |
| 17 |
open Tac2extffi |
| 18 |
open Proofview.Notations |
| 19 |
|
| 20 |
module Value = Tac2ffi |
| 21 |
|
| 22 |
|
| 23 |
let make_to_repr f = Tac2ffi.make_repr (fun _ -> assert false) f |
| 24 |
|
| 25 |
let return x = Proofview.tclUNIT x |
| 26 |
let thaw f = f () |
| 27 |
let uthaw r f = Tac2ffi.to_fun1 Tac2ffi.of_unit (repr_to r) f () |
| 28 |
|
| 29 |
let to_name c = match Value.to_option Value.to_ident c with |
| 30 |
| None -> Anonymous |
| 31 |
| Some id -> Name id |
| 32 |
|
| 33 |
let name = make_to_repr to_name |
| 34 |
|
| 35 |
let to_occurrences = function |
| 36 |
| ValInt 0 -> AllOccurrences |
| 37 |
| ValBlk (0, [| vl |]) -> AllOccurrencesBut (Value.to_list Value.to_int vl) |
| 38 |
| ValInt 1 -> NoOccurrences |
| 39 |
| ValBlk (1, [| vl |]) -> OnlyOccurrences (Value.to_list Value.to_int vl) |
| 40 |
| _ -> assert false |
| 41 |
|
| 42 |
let occurrences = make_to_repr to_occurrences |
| 43 |
|
| 44 |
let to_hyp_location_flag v = match Value.to_int v with |
| 45 |
| 0 -> InHyp |
| 46 |
| 1 -> InHypTypeOnly |
| 47 |
| 2 -> InHypValueOnly |
| 48 |
| _ -> assert false |
| 49 |
|
| 50 |
let to_clause v = match Value.to_tuple v with |
| 51 |
| [| hyps; concl |] -> |
| 52 |
let cast v = match Value.to_tuple v with |
| 53 |
| [| hyp; occ; flag |] -> |
| 54 |
(Value.to_ident hyp, to_occurrences occ, to_hyp_location_flag flag) |
| 55 |
| _ -> assert false |
| 56 |
in |
| 57 |
let hyps = Value.to_option (fun h -> Value.to_list cast h) hyps in |
| 58 |
{ onhyps = hyps; concl_occs = to_occurrences concl; } |
| 59 |
| _ -> assert false |
| 60 |
|
| 61 |
let clause = make_to_repr to_clause |
| 62 |
|
| 63 |
let to_red_strength = function |
| 64 |
| ValInt 0 -> Norm |
| 65 |
| ValInt 1 -> Head |
| 66 |
| _ -> assert false |
| 67 |
|
| 68 |
let to_red_flag v : Tac2types.red_flag = match Value.to_tuple v with |
| 69 |
| [| strength; beta; iota; fix; cofix; zeta; delta; const |] -> |
| 70 |
{ |
| 71 |
rStrength = to_red_strength strength; |
| 72 |
rBeta = Value.to_bool beta; |
| 73 |
rMatch = Value.to_bool iota; |
| 74 |
rFix = Value.to_bool fix; |
| 75 |
rCofix = Value.to_bool cofix; |
| 76 |
rZeta = Value.to_bool zeta; |
| 77 |
rDelta = Value.to_bool delta; |
| 78 |
rConst = Value.to_list Value.to_reference const; |
| 79 |
} |
| 80 |
| _ -> assert false |
| 81 |
|
| 82 |
let red_flags = make_to_repr to_red_flag |
| 83 |
|
| 84 |
let constr_with_occs = pair constr occurrences |
| 85 |
|
| 86 |
let reference_with_occs = pair reference occurrences |
| 87 |
|
| 88 |
let to_red_context = to_option (to_pair to_pattern to_occurrences) |
| 89 |
|
| 90 |
let red_context = make_to_repr to_red_context |
| 91 |
|
| 92 |
let rec to_intro_pattern v = match Value.to_block v with |
| 93 |
| (0, [| b |]) -> IntroForthcoming (Value.to_bool b) |
| 94 |
| (1, [| pat |]) -> IntroNaming (to_intro_pattern_naming pat) |
| 95 |
| (2, [| act |]) -> IntroAction (to_intro_pattern_action act) |
| 96 |
| _ -> assert false |
| 97 |
|
| 98 |
and to_intro_pattern_naming = function |
| 99 |
| ValBlk (0, [| id |]) -> IntroIdentifier (Value.to_ident id) |
| 100 |
| ValBlk (1, [| id |]) -> IntroFresh (Value.to_ident id) |
| 101 |
| ValInt 0 -> IntroAnonymous |
| 102 |
| _ -> assert false |
| 103 |
|
| 104 |
and to_intro_pattern_action = function |
| 105 |
| ValInt 0 -> IntroWildcard |
| 106 |
| ValBlk (0, [| op |]) -> IntroOrAndPattern (to_or_and_intro_pattern op) |
| 107 |
| ValBlk (1, [| inj |]) -> |
| 108 |
let map ipat = to_intro_pattern ipat in |
| 109 |
IntroInjection (Value.to_list map inj) |
| 110 |
| ValBlk (2, [| c; ipat |]) -> |
| 111 |
let c = Value.to_fun1 Value.of_unit Value.to_constr c in |
| 112 |
IntroApplyOn (c, to_intro_pattern ipat) |
| 113 |
| ValBlk (3, [| b |]) -> IntroRewrite (Value.to_bool b) |
| 114 |
| _ -> assert false |
| 115 |
|
| 116 |
and to_or_and_intro_pattern v = match Value.to_block v with |
| 117 |
| (0, [| ill |]) -> |
| 118 |
IntroOrPattern (Value.to_list to_intro_patterns ill) |
| 119 |
| (1, [| il |]) -> |
| 120 |
IntroAndPattern (to_intro_patterns il) |
| 121 |
| _ -> assert false |
| 122 |
|
| 123 |
and to_intro_patterns il = |
| 124 |
Value.to_list to_intro_pattern il |
| 125 |
|
| 126 |
let rec of_intro_pattern = function |
| 127 |
| IntroForthcoming b -> of_block (0, [|of_bool b|]) |
| 128 |
| IntroNaming pat -> of_block (1, [|of_intro_pattern_naming pat|]) |
| 129 |
| IntroAction act -> of_block (2, [|of_intro_pattern_action act|]) |
| 130 |
|
| 131 |
and of_intro_pattern_naming = function |
| 132 |
| IntroIdentifier id -> of_block (0, [|of_ident id|]) |
| 133 |
| IntroFresh id -> of_block (1, [|of_ident id|]) |
| 134 |
| IntroAnonymous -> of_int 0 |
| 135 |
|
| 136 |
and of_intro_pattern_action = function |
| 137 |
| IntroWildcard -> of_int 0 |
| 138 |
| IntroOrAndPattern op -> of_block (0, [|of_or_and_intro_pattern op|]) |
| 139 |
| IntroInjection inj -> of_block (1, [|of_list of_intro_pattern inj|]) |
| 140 |
| IntroApplyOn (c, ipat) -> |
| 141 |
let c = repr_of (fun1 unit constr) c in |
| 142 |
of_block (2, [|c; of_intro_pattern ipat|]) |
| 143 |
| IntroRewrite b -> of_block (3, [|of_bool b|]) |
| 144 |
|
| 145 |
and of_or_and_intro_pattern = function |
| 146 |
| IntroOrPattern ill -> of_block (0, [|of_list of_intro_patterns ill|]) |
| 147 |
| IntroAndPattern il -> of_block (1, [|of_intro_patterns il|]) |
| 148 |
|
| 149 |
and of_intro_patterns il = of_list of_intro_pattern il |
| 150 |
|
| 151 |
let intro_pattern = make_repr of_intro_pattern to_intro_pattern |
| 152 |
|
| 153 |
let intro_patterns = make_repr of_intro_patterns to_intro_patterns |
| 154 |
|
| 155 |
let to_destruction_arg v = match Value.to_block v with |
| 156 |
| (0, [| c |]) -> |
| 157 |
let c = uthaw constr_with_bindings c in |
| 158 |
ElimOnConstr c |
| 159 |
| (1, [| id |]) -> ElimOnIdent (Value.to_ident id) |
| 160 |
| (2, [| n |]) -> ElimOnAnonHyp (Value.to_int n) |
| 161 |
| _ -> assert false |
| 162 |
|
| 163 |
let destruction_arg = make_to_repr to_destruction_arg |
| 164 |
|
| 165 |
let to_induction_clause v = match Value.to_tuple v with |
| 166 |
| [| arg; eqn; as_; in_ |] -> |
| 167 |
let arg = to_destruction_arg arg in |
| 168 |
let eqn = Value.to_option to_intro_pattern_naming eqn in |
| 169 |
let as_ = Value.to_option to_or_and_intro_pattern as_ in |
| 170 |
let in_ = Value.to_option to_clause in_ in |
| 171 |
(arg, eqn, as_, in_) |
| 172 |
| _ -> |
| 173 |
assert false |
| 174 |
|
| 175 |
let induction_clause = make_to_repr to_induction_clause |
| 176 |
|
| 177 |
let to_assertion v = match Value.to_block v with |
| 178 |
| (0, [| ipat; t; tac |]) -> |
| 179 |
let to_tac t = Value.to_fun1 Value.of_unit Value.to_unit t in |
| 180 |
let ipat = Value.to_option to_intro_pattern ipat in |
| 181 |
let t = Value.to_constr t in |
| 182 |
let tac = Value.to_option to_tac tac in |
| 183 |
AssertType (ipat, t, tac) |
| 184 |
| (1, [| id; c |]) -> |
| 185 |
AssertValue (Value.to_ident id, Value.to_constr c) |
| 186 |
| _ -> assert false |
| 187 |
|
| 188 |
let assertion = make_to_repr to_assertion |
| 189 |
|
| 190 |
let to_multi = function |
| 191 |
| ValBlk (0, [| n |]) -> Precisely (Value.to_int n) |
| 192 |
| ValBlk (1, [| n |]) -> UpTo (Value.to_int n) |
| 193 |
| ValInt 0 -> RepeatStar |
| 194 |
| ValInt 1 -> RepeatPlus |
| 195 |
| _ -> assert false |
| 196 |
|
| 197 |
let to_rewriting v = match Value.to_tuple v with |
| 198 |
| [| orient; repeat; c |] -> |
| 199 |
let orient = Value.to_option Value.to_bool orient in |
| 200 |
let repeat = to_multi repeat in |
| 201 |
let c = uthaw constr_with_bindings c in |
| 202 |
(orient, repeat, c) |
| 203 |
| _ -> assert false |
| 204 |
|
| 205 |
let rewriting = make_to_repr to_rewriting |
| 206 |
|
| 207 |
let to_debug v = match Value.to_int v with |
| 208 |
| 0 -> Hints.Off |
| 209 |
| 1 -> Hints.Info |
| 210 |
| 2 -> Hints.Debug |
| 211 |
| _ -> assert false |
| 212 |
|
| 213 |
let debug = make_to_repr to_debug |
| 214 |
|
| 215 |
let to_strategy v = match Value.to_int v with |
| 216 |
| 0 -> Class_tactics.Bfs |
| 217 |
| 1 -> Class_tactics.Dfs |
| 218 |
| _ -> assert false |
| 219 |
|
| 220 |
let strategy = make_to_repr to_strategy |
| 221 |
|
| 222 |
let to_inversion_kind v = match Value.to_int v with |
| 223 |
| 0 -> Inv.SimpleInversion |
| 224 |
| 1 -> Inv.FullInversion |
| 225 |
| 2 -> Inv.FullInversionClear |
| 226 |
| _ -> assert false |
| 227 |
|
| 228 |
let inversion_kind = make_to_repr to_inversion_kind |
| 229 |
|
| 230 |
let to_move_location = function |
| 231 |
| ValInt 0 -> Logic.MoveFirst |
| 232 |
| ValInt 1 -> Logic.MoveLast |
| 233 |
| ValBlk (0, [|id|]) -> Logic.MoveAfter (Value.to_ident id) |
| 234 |
| ValBlk (1, [|id|]) -> Logic.MoveBefore (Value.to_ident id) |
| 235 |
| _ -> assert false |
| 236 |
|
| 237 |
let move_location = make_to_repr to_move_location |
| 238 |
|
| 239 |
let to_generalize_arg v = match Value.to_tuple v with |
| 240 |
| [| c; occs; na |] -> |
| 241 |
(Value.to_constr c, to_occurrences occs, to_name na) |
| 242 |
| _ -> assert false |
| 243 |
|
| 244 |
let generalize_arg = make_to_repr to_generalize_arg |
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
open Tac2externals |
| 249 |
|
| 250 |
let define s = |
| 251 |
define { mltac_plugin = "rocq-runtime.plugins.ltac2"; mltac_tactic = s } |
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
let () = |
| 256 |
define "tac_intros" |
| 257 |
(bool @-> intro_patterns @-> tac unit) |
| 258 |
Tac2tactics.intros_patterns |
| 259 |
|
| 260 |
let () = |
| 261 |
define "tac_apply" |
| 262 |
(bool @-> bool @-> list (thunk constr_with_bindings) @-> |
| 263 |
option (pair ident (option intro_pattern)) @-> tac unit) |
| 264 |
Tac2tactics.apply |
| 265 |
|
| 266 |
let () = |
| 267 |
define "tac_elim" |
| 268 |
(bool @-> constr_with_bindings @-> option constr_with_bindings @-> tac unit) |
| 269 |
Tac2tactics.elim |
| 270 |
|
| 271 |
let () = |
| 272 |
define "tac_case" |
| 273 |
(bool @-> constr_with_bindings @-> tac unit) |
| 274 |
Tac2tactics.general_case_analysis |
| 275 |
|
| 276 |
let () = |
| 277 |
define "tac_generalize" |
| 278 |
(list generalize_arg @-> tac unit) |
| 279 |
Tac2tactics.generalize |
| 280 |
|
| 281 |
let () = |
| 282 |
define "tac_assert" |
| 283 |
(assertion @-> tac unit) |
| 284 |
Tac2tactics.assert_ |
| 285 |
|
| 286 |
let tac_enough c tac ipat = |
| 287 |
let tac = Option.map (fun o -> Option.map (fun f -> thaw f) o) tac in |
| 288 |
Tac2tactics.forward false tac ipat c |
| 289 |
let () = |
| 290 |
define "tac_enough" |
| 291 |
(constr @-> option (option (thunk unit)) @-> option intro_pattern @-> tac unit) |
| 292 |
tac_enough |
| 293 |
|
| 294 |
let tac_pose na c = Tactics.letin_tac None na c None Locusops.nowhere |
| 295 |
let () = |
| 296 |
define "tac_pose" |
| 297 |
(name @-> constr @-> tac unit) |
| 298 |
tac_pose |
| 299 |
|
| 300 |
let tac_set ev p cl = |
| 301 |
Proofview.tclEVARMAP >>= fun sigma -> |
| 302 |
thaw p >>= fun (na, c) -> |
| 303 |
Tac2tactics.letin_pat_tac ev None na (Some sigma, c) cl |
| 304 |
let () = |
| 305 |
define "tac_set" |
| 306 |
(bool @-> thunk (pair name constr) @-> clause @-> tac unit) |
| 307 |
tac_set |
| 308 |
|
| 309 |
let tac_remember ev na c eqpat cl = |
| 310 |
let eqpat = Option.default (IntroNaming IntroAnonymous) eqpat in |
| 311 |
match eqpat with |
| 312 |
| IntroNaming eqpat -> |
| 313 |
Proofview.tclEVARMAP >>= fun sigma -> |
| 314 |
thaw c >>= fun c -> |
| 315 |
Tac2tactics.letin_pat_tac ev (Some (true, eqpat)) na (Some sigma, c) cl |
| 316 |
| _ -> |
| 317 |
Tacticals.tclZEROMSG (Pp.str "Invalid pattern for remember") |
| 318 |
let () = |
| 319 |
define "tac_remember" |
| 320 |
(bool @-> name @-> thunk constr @-> option intro_pattern @-> clause @-> tac unit) |
| 321 |
tac_remember |
| 322 |
|
| 323 |
let () = |
| 324 |
define "tac_destruct" |
| 325 |
(bool @-> list induction_clause @-> option constr_with_bindings @-> tac unit) |
| 326 |
(Tac2tactics.induction_destruct false) |
| 327 |
|
| 328 |
let () = |
| 329 |
define "tac_induction" |
| 330 |
(bool @-> list induction_clause @-> option constr_with_bindings @-> tac unit) |
| 331 |
(Tac2tactics.induction_destruct true) |
| 332 |
|
| 333 |
let () = define "tac_exfalso" (unit @-> tac unit) @@ fun () -> |
| 334 |
Tactics.exfalso |
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
let () = |
| 339 |
define "reduce_in" |
| 340 |
(reduction @-> clause @-> tac unit) |
| 341 |
Tac2tactics.reduce_in |
| 342 |
|
| 343 |
let () = |
| 344 |
define "reduce_constr" |
| 345 |
(reduction @-> constr @-> tac constr) |
| 346 |
Tac2tactics.reduce_constr |
| 347 |
|
| 348 |
let () = define "red" |
| 349 |
(ret reduction) |
| 350 |
Red |
| 351 |
|
| 352 |
let () = define "hnf" |
| 353 |
(ret reduction) |
| 354 |
Hnf |
| 355 |
|
| 356 |
let () = |
| 357 |
define "simpl" |
| 358 |
(red_flags @-> red_context @-> tac reduction) |
| 359 |
Tac2tactics.simpl |
| 360 |
|
| 361 |
let () = |
| 362 |
define "cbv" |
| 363 |
(red_flags @-> tac reduction) |
| 364 |
Tac2tactics.cbv |
| 365 |
|
| 366 |
let () = |
| 367 |
define "cbn" |
| 368 |
(red_flags @-> tac reduction) |
| 369 |
Tac2tactics.cbn |
| 370 |
|
| 371 |
let () = |
| 372 |
define "lazy" |
| 373 |
(red_flags @-> tac reduction) |
| 374 |
Tac2tactics.lazy_ |
| 375 |
|
| 376 |
let () = |
| 377 |
define "unfold" |
| 378 |
(list reference_with_occs @-> tac reduction) |
| 379 |
Tac2tactics.unfold |
| 380 |
|
| 381 |
let () = |
| 382 |
define "fold" |
| 383 |
(list constr @-> ret reduction) |
| 384 |
(fun cs -> Fold cs) |
| 385 |
|
| 386 |
let () = |
| 387 |
define "pattern" |
| 388 |
(list constr_with_occs @-> ret reduction) |
| 389 |
Tac2tactics.pattern |
| 390 |
|
| 391 |
let () = |
| 392 |
define "vm" |
| 393 |
(red_context @-> ret reduction) |
| 394 |
Tac2tactics.vm |
| 395 |
|
| 396 |
let () = |
| 397 |
define "native" |
| 398 |
(red_context @-> ret reduction) |
| 399 |
Tac2tactics.native |
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
let () = |
| 405 |
define "tac_change" |
| 406 |
(option pattern @-> fun1 (array constr) constr @-> clause @-> tac unit) |
| 407 |
Tac2tactics.change |
| 408 |
|
| 409 |
let () = |
| 410 |
define "tac_rewrite" |
| 411 |
(bool @-> list rewriting @-> clause @-> option (thunk unit) @-> tac unit) |
| 412 |
Tac2tactics.rewrite |
| 413 |
|
| 414 |
let () = |
| 415 |
define "tac_setoid_rewrite" |
| 416 |
(bool @-> uthaw constr_with_bindings @--> occurrences @-> option ident @-> tac unit) |
| 417 |
Tac2tactics.setoid_rewrite |
| 418 |
|
| 419 |
let () = |
| 420 |
define "tac_rewrite_strat" |
| 421 |
(rewstrategy @-> option ident @-> tac unit) |
| 422 |
Tac2tactics.rewrite_strat |
| 423 |
|
| 424 |
let () = |
| 425 |
define "rewstrat_id" |
| 426 |
(ret rewstrategy) |
| 427 |
Rewrite.Strategies.id |
| 428 |
|
| 429 |
let () = |
| 430 |
define "rewstrat_fail" |
| 431 |
(ret rewstrategy) |
| 432 |
Rewrite.Strategies.fail |
| 433 |
|
| 434 |
let () = |
| 435 |
define "rewstrat_refl" |
| 436 |
(ret rewstrategy) |
| 437 |
Rewrite.Strategies.refl |
| 438 |
|
| 439 |
let () = |
| 440 |
define "rewstrat_progress" |
| 441 |
(rewstrategy @-> ret rewstrategy) |
| 442 |
Rewrite.Strategies.progress |
| 443 |
|
| 444 |
let () = |
| 445 |
define "rewstrat_seq" |
| 446 |
(rewstrategy @-> rewstrategy @-> ret rewstrategy) |
| 447 |
Rewrite.Strategies.seq |
| 448 |
|
| 449 |
let () = |
| 450 |
define "rewstrat_seqs" |
| 451 |
(list rewstrategy @-> ret rewstrategy) |
| 452 |
Rewrite.Strategies.seqs |
| 453 |
|
| 454 |
let () = |
| 455 |
define "rewstrat_choice" |
| 456 |
(rewstrategy @-> rewstrategy @-> ret rewstrategy) |
| 457 |
Rewrite.Strategies.choice |
| 458 |
|
| 459 |
let () = |
| 460 |
define "rewstrat_choices" |
| 461 |
(list rewstrategy @-> ret rewstrategy) |
| 462 |
Rewrite.Strategies.choices |
| 463 |
|
| 464 |
let () = |
| 465 |
define "rewstrat_try" |
| 466 |
(rewstrategy @-> ret rewstrategy) |
| 467 |
Rewrite.Strategies.try_ |
| 468 |
|
| 469 |
let () = |
| 470 |
define "rewstrat_fix" |
| 471 |
(closure @-> tac rewstrategy) |
| 472 |
Tac2tactics.RewriteStrats.fix |
| 473 |
|
| 474 |
let () = |
| 475 |
define "rewstrat_any" |
| 476 |
(rewstrategy @-> ret rewstrategy) |
| 477 |
Rewrite.Strategies.any |
| 478 |
|
| 479 |
let () = |
| 480 |
define "rewstrat_repeat" |
| 481 |
(rewstrategy @-> ret rewstrategy) |
| 482 |
Rewrite.Strategies.repeat |
| 483 |
|
| 484 |
let () = |
| 485 |
define "rewstrat_one_subterm" |
| 486 |
(rewstrategy @-> ret rewstrategy) |
| 487 |
Rewrite.Strategies.one_subterm |
| 488 |
|
| 489 |
let () = |
| 490 |
define "rewstrat_all_subterms" |
| 491 |
(rewstrategy @-> ret rewstrategy) |
| 492 |
Rewrite.Strategies.all_subterms |
| 493 |
|
| 494 |
let () = |
| 495 |
define "rewstrat_bottomup" |
| 496 |
(rewstrategy @-> ret rewstrategy) |
| 497 |
Rewrite.Strategies.bottomup |
| 498 |
|
| 499 |
let () = |
| 500 |
define "rewstrat_topdown" |
| 501 |
(rewstrategy @-> ret rewstrategy) |
| 502 |
Rewrite.Strategies.topdown |
| 503 |
|
| 504 |
let () = |
| 505 |
define "rewstrat_innermost" |
| 506 |
(rewstrategy @-> ret rewstrategy) |
| 507 |
Rewrite.Strategies.innermost |
| 508 |
|
| 509 |
let () = |
| 510 |
define "rewstrat_outermost" |
| 511 |
(rewstrategy @-> ret rewstrategy) |
| 512 |
Rewrite.Strategies.outermost |
| 513 |
|
| 514 |
let () = |
| 515 |
define "rewstrat_hints" |
| 516 |
(ident @-> ret rewstrategy) |
| 517 |
Tac2tactics.RewriteStrats.hints |
| 518 |
|
| 519 |
let () = |
| 520 |
define "rewstrat_old_hints" |
| 521 |
(ident @-> ret rewstrategy) |
| 522 |
Tac2tactics.RewriteStrats.old_hints |
| 523 |
|
| 524 |
let () = |
| 525 |
define "rewstrat_one_lemma" |
| 526 |
(preterm @-> bool @-> ret rewstrategy) |
| 527 |
Tac2tactics.RewriteStrats.one_lemma |
| 528 |
|
| 529 |
let () = |
| 530 |
define "rewstrat_lemmas" |
| 531 |
(list preterm @-> ret rewstrategy) |
| 532 |
Tac2tactics.RewriteStrats.lemmas |
| 533 |
|
| 534 |
let () = |
| 535 |
define "rewstrat_fold" |
| 536 |
(constr @-> ret rewstrategy) |
| 537 |
Rewrite.Strategies.fold |
| 538 |
|
| 539 |
let () = |
| 540 |
define "rewstrat_eval" |
| 541 |
(reduction @-> ret rewstrategy) |
| 542 |
Rewrite.Strategies.reduce |
| 543 |
|
| 544 |
|
| 545 |
let () = |
| 546 |
define "tac_inversion" |
| 547 |
(inversion_kind @-> destruction_arg @-> option intro_pattern @-> |
| 548 |
option (list ident) @-> tac unit) |
| 549 |
Tac2tactics.inversion |
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
let () = |
| 554 |
define "tac_reflexivity" (unit @-> tac unit) (fun _ -> Tactics.intros_reflexivity) |
| 555 |
|
| 556 |
let () = |
| 557 |
define "tac_move" (ident @-> move_location @-> tac unit) Tactics.move_hyp |
| 558 |
|
| 559 |
let tac_intro id mv = |
| 560 |
let mv = Option.default Logic.MoveLast mv in |
| 561 |
Tactics.intro_move id mv |
| 562 |
let () = |
| 563 |
define "tac_intro" (option ident @-> option move_location @-> tac unit) tac_intro |
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
let () = |
| 574 |
define "tac_assumption" (unit @-> tac unit) (fun _ -> Tactics.assumption) |
| 575 |
|
| 576 |
let () = |
| 577 |
define "tac_eassumption" (unit @-> tac unit) (fun _ -> Eauto.e_assumption) |
| 578 |
|
| 579 |
let () = |
| 580 |
define "tac_transitivity" (constr @-> tac unit) |
| 581 |
(fun c -> Tactics.intros_transitivity (Some c)) |
| 582 |
|
| 583 |
let () = |
| 584 |
define "tac_etransitivity" (unit @-> tac unit) |
| 585 |
(fun _ -> Tactics.intros_transitivity None) |
| 586 |
|
| 587 |
let () = |
| 588 |
define "tac_cut" (constr @-> tac unit) Tactics.cut |
| 589 |
|
| 590 |
let () = |
| 591 |
define "tac_left" (bool @-> bindings @-> tac unit) Tac2tactics.left_with_bindings |
| 592 |
|
| 593 |
let () = |
| 594 |
define "tac_right" (bool @-> bindings @-> tac unit) Tac2tactics.right_with_bindings |
| 595 |
|
| 596 |
let () = |
| 597 |
define "tac_introsuntil" (qhyp @-> tac unit) Tactics.intros_until |
| 598 |
|
| 599 |
let () = |
| 600 |
define "tac_exactnocheck" (constr @-> tac unit) Tactics.exact_no_check |
| 601 |
|
| 602 |
let () = |
| 603 |
define "tac_vmcastnocheck" (constr @-> tac unit) Tactics.vm_cast_no_check |
| 604 |
|
| 605 |
let () = |
| 606 |
define "tac_nativecastnocheck" (constr @-> tac unit) Tactics.native_cast_no_check |
| 607 |
|
| 608 |
let () = |
| 609 |
define "tac_constructor" (bool @-> tac unit) (fun ev -> Tactics.any_constructor ev None) |
| 610 |
|
| 611 |
let () = |
| 612 |
define "tac_constructorn" (bool @-> int @-> bindings @-> tac unit) |
| 613 |
(fun ev n bnd -> Tac2tactics.constructor_tac ev None n bnd) |
| 614 |
|
| 615 |
let () = |
| 616 |
define "tac_specialize" |
| 617 |
(constr_with_bindings @-> option intro_pattern @-> tac unit) |
| 618 |
Tac2tactics.specialize |
| 619 |
|
| 620 |
let () = |
| 621 |
define "tac_symmetry" (clause @-> tac unit) Tac2tactics.symmetry |
| 622 |
|
| 623 |
let () = |
| 624 |
define "tac_split" (bool @-> bindings @-> tac unit) Tac2tactics.split_with_bindings |
| 625 |
|
| 626 |
let () = |
| 627 |
define "tac_rename" (list (pair ident ident) @-> tac unit) Tactics.rename_hyp |
| 628 |
|
| 629 |
let () = |
| 630 |
define "tac_revert" (list ident @-> tac unit) Generalize.revert |
| 631 |
|
| 632 |
let () = |
| 633 |
define "tac_admit" (unit @-> tac unit) (fun _ -> Proofview.give_up) |
| 634 |
|
| 635 |
let () = |
| 636 |
define "tac_fix" (ident @-> int @-> tac unit) FixTactics.fix |
| 637 |
|
| 638 |
let () = |
| 639 |
define "tac_cofix" (ident @-> tac unit) FixTactics.cofix |
| 640 |
|
| 641 |
let () = |
| 642 |
define "tac_clear" (list ident @-> tac unit) Tactics.clear |
| 643 |
|
| 644 |
let () = |
| 645 |
define "tac_keep" (list ident @-> tac unit) Tactics.keep |
| 646 |
|
| 647 |
let () = |
| 648 |
define "tac_clearbody" (list ident @-> tac unit) Tactics.clear_body |
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
let () = |
| 653 |
define "tac_discriminate" |
| 654 |
(bool @-> option destruction_arg @-> tac unit) |
| 655 |
Tac2tactics.discriminate |
| 656 |
|
| 657 |
let () = |
| 658 |
define "tac_injection" |
| 659 |
(bool @-> option intro_patterns @-> option destruction_arg @-> tac unit) |
| 660 |
Tac2tactics.injection |
| 661 |
|
| 662 |
let () = |
| 663 |
define "tac_absurd" (constr @-> tac unit) Contradiction.absurd |
| 664 |
|
| 665 |
let () = |
| 666 |
define "tac_contradiction" |
| 667 |
(option constr_with_bindings @-> tac unit) |
| 668 |
Tac2tactics.contradiction |
| 669 |
|
| 670 |
let () = |
| 671 |
define "tac_autorewrite" |
| 672 |
(bool @-> option (thunk unit) @-> list ident @-> clause @-> tac unit) |
| 673 |
(fun all by ids cl -> Tac2tactics.autorewrite ~all by ids cl) |
| 674 |
|
| 675 |
let () = |
| 676 |
define "tac_subst" (list ident @-> tac unit) Equality.subst |
| 677 |
|
| 678 |
let () = |
| 679 |
define "tac_substall" |
| 680 |
(unit @-> tac unit) |
| 681 |
(fun _ -> return () >>= fun () -> Equality.subst_all ()) |
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
let () = |
| 686 |
define "tac_trivial" |
| 687 |
(debug @-> list reference @-> option (list ident) @-> tac unit) |
| 688 |
Tac2tactics.trivial |
| 689 |
|
| 690 |
let () = |
| 691 |
define "tac_eauto" |
| 692 |
(debug @-> option int @-> list reference @-> option (list ident) @-> tac unit) |
| 693 |
Tac2tactics.eauto |
| 694 |
|
| 695 |
let () = |
| 696 |
define "tac_auto" |
| 697 |
(debug @-> option int @-> list reference @-> option (list ident) @-> tac unit) |
| 698 |
Tac2tactics.auto |
| 699 |
|
| 700 |
let () = |
| 701 |
define "tac_typeclasses_eauto" |
| 702 |
(option strategy @-> option int @-> option (list ident) @-> tac unit) |
| 703 |
Tac2tactics.typeclasses_eauto |
| 704 |
|
| 705 |
let () = |
| 706 |
define "tac_resolve_tc" (constr @-> tac unit) Class_tactics.resolve_tc |
| 707 |
|
| 708 |
let () = |
| 709 |
define "tac_unify" (constr @-> constr @-> tac unit) Tac2tactics.unify |
| 710 |
|
| 711 |
|
| 712 |
|
| 713 |
let () = |
| 714 |
define "current_transparent_state" |
| 715 |
(unit @-> tac transparent_state) |
| 716 |
Tac2tactics.current_transparent_state |
| 717 |
|
| 718 |
let () = |
| 719 |
define "full_transparent_state" (ret transparent_state) TransparentState.full |
| 720 |
|
| 721 |
let () = |
| 722 |
define "empty_transparent_state" (ret transparent_state) TransparentState.empty |
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
let to_conv_pb v = match Tac2ffi.to_int v with |
| 727 |
| 0 -> Conversion.CONV |
| 728 |
| 1 -> Conversion.CUMUL |
| 729 |
| _ -> assert false |
| 730 |
|
| 731 |
let () = |
| 732 |
define "infer_conv" (to_conv_pb @--> transparent_state @-> constr @-> constr @-> tac bool) @@ fun pb ts c1 c2 -> |
| 733 |
Tac2core.pf_apply @@ fun env sigma -> |
| 734 |
match Reductionops.infer_conv ~pb ~ts env sigma c1 c2 with |
| 735 |
| Some sigma -> Proofview.Unsafe.tclEVARS sigma <*> return true |
| 736 |
| None -> return false |
| 737 |
|
| 738 |
let () = |
| 739 |
define "evarconv_unify" |
| 740 |
(transparent_state @-> constr @-> constr @-> tac unit) |
| 741 |
Tac2tactics.evarconv_unify |
| 742 |
|
| 743 |
let () = |
| 744 |
define "congruence" |
| 745 |
(option int @-> option (list constr) @-> tac unit) |
| 746 |
Tac2tactics.congruence |
| 747 |
|
| 748 |
let () = |
| 749 |
define "simple_congruence" |
| 750 |
(option int @-> option (list constr) @-> tac unit) |
| 751 |
Tac2tactics.simple_congruence |
| 752 |
|
| 753 |
let () = define "f_equal" (unit @-> tac unit) @@ fun () -> |
| 754 |
Tac2tactics.f_equal |