File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed
rocq-ltac2-tc-dispatch/theories Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change 1+ Require Ltac2.Ltac2.
2+ Require Import skylabs.ltac2.tc_dispatch.lookup.
3+
4+ (**
5+ [crush_ext] is An extensible version of [crush].
6+
7+ Users can add new tactics / strategies by adding [Ltac2Lookup] hints
8+ to the [crush_ext] database.
9+ *)
10+
11+ Create HintDb crush_ext discriminated.
12+
13+ Module ltac2.
14+ Import Ltac2.Init.
15+ Import Ltac2.Notations.
16+ Ltac2 crush2 () :=
17+ let dbs := Some [ident:(crush_ext)] in
18+ repeat (ltac2.goal_dispatch_with dbs).
19+ End ltac2.
20+
21+ Ltac crush_ext :=
22+ ltac2:(ltac2.crush2 ()).
Original file line number Diff line number Diff line change @@ -37,11 +37,11 @@ Module ltac2.
3737 | List.cons ?c ?cs => f c :: list_of_list_constr f cs
3838 end .
3939
40- Ltac2 goal_dispatch ( ) :=
40+ Ltac2 goal_dispatch_with (dbs : ident list option ) :=
4141 let g := Control.goal () in
4242 let query := constr :(Ltac2Lookup $g) in
4343 (* let _ := printf "query=%t" query in *)
44- let inst := Constr.Unsafe.make (TC.resolve None query) in
44+ let inst := Constr.Unsafe.make (TC.resolve dbs query) in
4545 (* let _ := printf "inst=%t" inst in *)
4646 let flags := RedFlags.all in
4747 let reduced_inst := Std.eval_cbv flags inst in
@@ -68,8 +68,9 @@ Module ltac2.
6868 | _ =>
6969 Control.zero (Tactic_failure (Some (Message.of_string "Could not reduce instance to record.")))
7070 end .
71+
7172End ltac2.
7273
7374Ltac goal_dispatch :=
7475 idtac;
75- ltac2:(ltac2.goal_dispatch () ).
76+ ltac2:(ltac2.goal_dispatch_with None ).
You can’t perform that action at this time.
0 commit comments