Skip to content

Commit 9a07e8c

Browse files
shilangyuKacperFKorbandhalilov
committed
Support Ltac1
Co-authored-by: Kacper Korban <kacper.f.korban@gmail.com> Co-authored-by: Dario Halilovic <dario.halilovic@epfl.ch>
1 parent 4ecff7b commit 9a07e8c

5 files changed

Lines changed: 21 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ jobs:
3131
opam install . --deps-only
3232
3333
- name: Dune build
34-
run: opam exec -- dune build
34+
run: |
35+
opam exec -- dune build
36+
opam exec -- dune build --profile ltac2

Ltac2Loader.v

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
From Ltac2 Require Import Ltac2.

Solver.v

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,19 @@ Ltac2 find_contradiction hyps_map: constr :=
171171
try_contras hyps_map (List.map fst (FMap.bindings hyps_map)).
172172

173173
(* collect all hyps of the rel relation, put them in a map, do a dfs until we find the required one *)
174-
Ltac2 solve_strict_order rel: constr :=
174+
Ltac2 solve_strict_order rel: unit :=
175+
normalize_relations rel;
175176
let hyps_map := build_graph rel in
176-
match get_elements (Control.goal ()) rel with
177+
let refined := match get_elements (Control.goal ()) rel with
177178
| Some (a_str, b_str) =>
178179
Control.plus (fun _ => find_path hyps_map a_str b_str) (fun _ => find_contradiction hyps_map)
179180
| _ =>
180181
find_contradiction hyps_map
181-
end.
182+
end in
183+
Control.refine (fun _ => refined).
182184

183-
Ltac2 Notation "strict_order" rel(constr) :=
184-
normalize_relations rel;
185-
Control.refine (fun _ => solve_strict_order rel).
185+
Ltac2 Notation "strict_order" rel(constr) := solve_strict_order rel.
186+
187+
Ltac strict_order rel :=
188+
let p := ltac2:(rel |- solve_strict_order (Option.get (Ltac1.to_constr rel))) in
189+
p rel.

Tests.v

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
From Ltac2 Require Import Ltac2.
21
From Stdlib Require Import Classes.RelationClasses Lists.List.
32
Import ListNotations.
43

dune

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
(env
2+
(ltac2
3+
(rocq
4+
(flags
5+
; turn on Ltac2 proof mode for tests
6+
(:standard -l Ltac2Loader.v)))))
7+
18
(rocq.theory
29
(name StrictOrderSolver)
310
(package strict-order-solver)

0 commit comments

Comments
 (0)