| 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 Import Ltac2.Init. |
| 12 |
|
| 13 |
Ltac2 Type t := projection. |
| 14 |
(** Type of primitive projections. This includes the unfolding boolean. *) |
| 15 |
|
| 16 |
Ltac2 @ external equal : t -> t -> bool := "rocq-runtime.plugins.ltac2" "projection_equal". |
| 17 |
(** Projections obtained through module aliases or Include are not |
| 18 |
considered equal by this function. The unfolding boolean is not ignored. *) |
| 19 |
|
| 20 |
Ltac2 @ external ind : t -> inductive := "rocq-runtime.plugins.ltac2" "projection_ind". |
| 21 |
(** Get the inductive to which the projectin belongs. *) |
| 22 |
|
| 23 |
Ltac2 @ external index : t -> int := "rocq-runtime.plugins.ltac2" "projection_index". |
| 24 |
(** The index of the projection indicates which field it projects. *) |
| 25 |
|
| 26 |
Ltac2 @ external unfolded : t -> bool := "rocq-runtime.plugins.ltac2" "projection_unfolded". |
| 27 |
(** Get the unfolding boolean. *) |
| 28 |
|
| 29 |
Ltac2 @ external set_unfolded : t -> bool -> t |
| 30 |
:= "rocq-runtime.plugins.ltac2" "projection_set_unfolded". |
| 31 |
(** Set the unfolding boolean. *) |
| 32 |
|
| 33 |
Ltac2 @ external of_constant : constant -> t option |
| 34 |
:= "rocq-runtime.plugins.ltac2" "projection_of_constant". |
| 35 |
(** Get the primitive projection associated to the constant. |
| 36 |
The returned projection is folded. |
| 37 |
Returns [None] when the constant is not associated to a primitive projection. *) |
| 38 |
|
| 39 |
Ltac2 @ external to_constant : t -> constant option |
| 40 |
:= "rocq-runtime.plugins.ltac2" "projection_to_constant". |
| 41 |
(** Get the constant associated to the primitive projection. |
| 42 |
Currently always returns [Some] but this may change in the future. *) |
| 43 |
|
| 44 |
Ltac2 @external print : t -> message |
| 45 |
:= "rocq-runtime.plugins.ltac2" "projection_print". |
| 46 |
(** Print the projection using the shortest qualified identifier which refers to it. |
| 47 |
Does not avoid variable names in the current or global environment. *) |