| 1 |
(************************************************************************) |
| 2 |
(* * The Rocq Prover / The Rocq Development Team *) |
| 3 |
(* v * Copyright INRIA, CNRS and contributors *) |
| 4 |
(* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 |
(* \VV/ **************************************************************) |
| 6 |
(* // * This file is distributed under the terms of the *) |
| 7 |
(* * GNU Lesser General Public License Version 2.1 *) |
| 8 |
(* * (see LICENSE file for the text of the license) *) |
| 9 |
(************************************************************************) |
| 10 |
|
| 11 |
Require Corelib.Init.Ltac. |
| 12 |
|
| 13 |
Declare ML Module "rocq-runtime.plugins.ltac2". |
| 14 |
Declare ML Module "rocq-runtime.plugins.ltac2_ltac1". |
| 15 |
|
| 16 |
#[export] Set Default Proof Mode "Ltac2". |
| 17 |
|
| 18 |
(** Primitive types *) |
| 19 |
|
| 20 |
Ltac2 Type int. |
| 21 |
Ltac2 Type string. |
| 22 |
Ltac2 Type char. |
| 23 |
Ltac2 Type ident. |
| 24 |
Ltac2 Type uint63. |
| 25 |
Ltac2 Type float. |
| 26 |
Ltac2 Type pstring. |
| 27 |
|
| 28 |
(** Constr-specific built-in types *) |
| 29 |
Ltac2 Type meta. |
| 30 |
Ltac2 Type evar. |
| 31 |
Ltac2 Type sort. |
| 32 |
Ltac2 Type cast. |
| 33 |
Ltac2 Type instance. |
| 34 |
Ltac2 Type constant. |
| 35 |
Ltac2 Type inductive. |
| 36 |
Ltac2 Type constructor. |
| 37 |
Ltac2 Type projection. |
| 38 |
Ltac2 Type pattern. |
| 39 |
Ltac2 Type constr. |
| 40 |
Ltac2 Type preterm. |
| 41 |
Ltac2 Type binder. |
| 42 |
|
| 43 |
Ltac2 Type message. |
| 44 |
Ltac2 Type ('a, 'b, 'c, 'd) format. |
| 45 |
Ltac2 Type exn := [ .. ]. |
| 46 |
Ltac2 Type 'a array. |
| 47 |
|
| 48 |
(** Tuples *) |
| 49 |
|
| 50 |
Ltac2 fst (p:'a * 'b) : 'a := let (x,_) := p in x. |
| 51 |
Ltac2 snd (p:'a * 'b) : 'b := let (_,y) := p in y. |
| 52 |
|
| 53 |
(** Pervasive types *) |
| 54 |
|
| 55 |
Ltac2 Type 'a option := [ None | Some ('a) ]. |
| 56 |
|
| 57 |
Ltac2 Type 'a ref := { mutable contents : 'a }. |
| 58 |
|
| 59 |
Ltac2 Type bool := [ true | false ]. |
| 60 |
|
| 61 |
Ltac2 Type 'a result := [ Val ('a) | Err (exn) ]. |
| 62 |
|
| 63 |
(** Pervasive exceptions *) |
| 64 |
|
| 65 |
Ltac2 Type err. |
| 66 |
(** Rocq internal errors. Cannot be constructed, merely passed around. *) |
| 67 |
|
| 68 |
Ltac2 Type exn ::= [ Internal (err) ]. |
| 69 |
(** Wrapper around the errors raised by Rocq implementation. *) |
| 70 |
|
| 71 |
Ltac2 Type exn ::= [ Out_of_bounds (message option) ]. |
| 72 |
(** Used for bound checking, e.g. with String and Array. *) |
| 73 |
|
| 74 |
Ltac2 Type exn ::= [ Not_focussed ]. |
| 75 |
(** In Ltac2, the notion of "current environment" only makes sense when there is |
| 76 |
at most one goal under focus. Contrarily to Ltac1, instead of dynamically |
| 77 |
focussing when we need it, we raise this non-backtracking error when it does |
| 78 |
not make sense. *) |
| 79 |
|
| 80 |
Ltac2 Type exn ::= [ Not_found ]. |
| 81 |
(** Used when something is missing. *) |
| 82 |
|
| 83 |
Ltac2 Type exn ::= [ No_value ]. |
| 84 |
(** Used for empty lists, None options and the like. *) |
| 85 |
|
| 86 |
Ltac2 Type exn ::= [ Match_failure ]. |
| 87 |
(** Used to signal a pattern didn't match a term. *) |
| 88 |
|
| 89 |
Ltac2 Type exn ::= [ Invalid_argument (message option) ]. |
| 90 |
(** Used to signal that an invalid argument was passed to a tactic. *) |
| 91 |
|
| 92 |
Ltac2 Type exn ::= [ Tactic_failure (message option) ]. |
| 93 |
(** Generic error for tactic failure. *) |
| 94 |
|
| 95 |
Ltac2 Type exn ::= [ Assertion_failure ]. |
| 96 |
(** Used to indicate that an Ltac2 function ran into a situation that should never occcur. *) |
| 97 |
|
| 98 |
Ltac2 Type exn ::= [ Division_by_zero ]. |
| 99 |
(** Int division by zero or modulus by zero *) |
| 100 |
|
| 101 |
Ltac2 Type exninfo. |
| 102 |
(** Information attached to an exception (e.g., backtrace). *) |