| 1 |
(* discriminated database with transparent items in hints *) |
| 2 |
From Corelib Require Import Nat. |
| 3 |
Theorem bar: 1+1+1=3. reflexivity. Qed. |
| 4 |
Theorem bar2: 3+1+1=5. reflexivity. Qed. |
| 5 |
|
| 6 |
Definition one := 1. |
| 7 |
Definition two := 2. |
| 8 |
Definition one_plus_one_plus_one := 1+1+1. |
| 9 |
|
| 10 |
Create HintDb db discriminated. |
| 11 |
Hint Resolve bar | 2 : db. |
| 12 |
Hint Resolve bar2 | 1 : db. |
| 13 |
Hint Opaque Nat.add : db. |
| 14 |
Set Typeclasses Debug Verbosity 2. |
| 15 |
|
| 16 |
Goal two+1+1=5. |
| 17 |
(* matches bar2, which fails in the tactic*) |
| 18 |
Fail progress debug auto with db nocore. |
| 19 |
Fail typeclasses eauto with db nocore. |
| 20 |
Abort. |
| 21 |
|
| 22 |
Goal 1+1+1=one. |
| 23 |
(* matches bar, which fails in the tactic *) |
| 24 |
Fail progress debug auto with db nocore. |
| 25 |
Fail typeclasses eauto with db nocore. |
| 26 |
Abort. |
| 27 |
|
| 28 |
Goal two+1+1=one. |
| 29 |
(* matches both bar and bar2, which both fail in the tactic *) |
| 30 |
Fail progress debug auto with db nocore. |
| 31 |
Fail typeclasses eauto with db nocore. |
| 32 |
Abort. |
| 33 |
|
| 34 |
Goal 1+1+1=1+1+1. |
| 35 |
(* no match, fails *) |
| 36 |
Fail progress debug auto with db nocore. |
| 37 |
Fail typeclasses eauto with db nocore. |
| 38 |
Abort. |
| 39 |
|
| 40 |
Goal 1+1+1=one_plus_one_plus_one. |
| 41 |
(* matches bar, succeeds because tactic uses conversion *) |
| 42 |
Succeed progress debug auto with db nocore. |
| 43 |
|
| 44 |
Succeed exact bar. |
| 45 |
Succeed simple apply bar. |
| 46 |
Fail autoapply bar with db. (* a bug or poor documentation? *) |
| 47 |
|
| 48 |
Set Typeclasses Debug Verbosity 2. |
| 49 |
(* fails because tc eauto uses autoapply, copying that Nat.add is opaque *) |
| 50 |
Fail typeclasses eauto with db nocore. |
| 51 |
Abort. |