| 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 |
(** * Initialization code for typeclasses, setting up the default tactic |
| 12 |
for instance search. |
| 13 |
|
| 14 |
Author: Matthieu Sozeau |
| 15 |
Institution: LRI, CNRS UMR 8623 - University Paris Sud |
| 16 |
*) |
| 17 |
|
| 18 |
(** Hints for the proof search: these combinators should be considered rigid. *) |
| 19 |
|
| 20 |
Require Import Corelib.Program.Basics. |
| 21 |
|
| 22 |
Global Typeclasses Opaque id const flip compose arrow impl iff not all. |
| 23 |
|
| 24 |
(** Apply using the same opacity information as typeclass proof search. *) |
| 25 |
|
| 26 |
Ltac class_apply c := autoapply c with typeclass_instances. |
| 27 |
|
| 28 |
(** The unconvertible typeclass, to test that two objects of the same type are |
| 29 |
actually different. *) |
| 30 |
#[universes(polymorphic)] |
| 31 |
Class Unconvertible (A : Type) (a b : A) := unconvertible : unit. |
| 32 |
|
| 33 |
Ltac unconvertible := |
| 34 |
match goal with |
| 35 |
| |- @Unconvertible _ ?x ?y => unify x y with typeclass_instances ; fail 1 "Convertible" |
| 36 |
| |- _ => exact tt |
| 37 |
end. |
| 38 |
|
| 39 |
#[global] |
| 40 |
Hint Extern 0 (@Unconvertible _ _ _) => unconvertible : typeclass_instances. |