Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
2ca5103
add command to check mappings
agontard Aug 15, 2025
0edbda0
add file
agontard Aug 15, 2025
40c5937
fix
agontard Aug 15, 2025
6d230ad
test
agontard Aug 15, 2025
8b914ed
fix options
agontard Aug 15, 2025
9fd7b13
fix implicit arguments + untranslated ident
agontard Aug 15, 2025
29b4224
fix
agontard Aug 15, 2025
4f2cfc3
small fix
agontard Aug 15, 2025
e9e4465
avoid nested proofs
agontard Aug 15, 2025
6136607
add case for mappings that do not exist (typo, forgot to remove etc...)
agontard Aug 15, 2025
1cc28b2
fix
agontard Aug 15, 2025
cde6933
add wrong type error
agontard Aug 15, 2025
3708605
remove rocq compile warnings
agontard Aug 15, 2025
643d813
HOL Light 3.1.0
agontard Aug 15, 2025
c0682c6
cleaner feedback
agontard Aug 15, 2025
0df34dc
minor change
agontard Aug 15, 2025
9ee35a7
compile deps before check-mappings.
agontard Oct 6, 2025
fa3cb91
fix
agontard Oct 6, 2025
ea55720
add lambdapi dependency in dune-project
agontard Oct 6, 2025
8003a02
remove integer result
agontard Oct 7, 2025
6f820c9
fixed error logging
agontard Oct 17, 2025
a71740a
put lemmas as comments
agontard Oct 17, 2025
23b4642
name them lemmas
agontard Oct 17, 2025
3d7de24
print unused mappings
agontard Oct 17, 2025
70df574
forgot a .
agontard Oct 17, 2025
e2cd22d
- Also check objects in the theory_hol, types and axioms files
agontard Oct 18, 2025
433e8aa
fix
agontard Oct 18, 2025
dd0de91
fix
agontard Oct 18, 2025
7995e09
fix
agontard Oct 18, 2025
09518c9
fix
agontard Oct 18, 2025
20ff4f6
fix untyped parameter for lambdapi export
agontard Oct 18, 2025
6ff2696
ignore specific mappings and do not put an @ in front of types
agontard Oct 23, 2025
a090e43
fix type identification
agontard Oct 23, 2025
acdfbac
small fix
agontard Oct 23, 2025
c9c53e3
more detailed positive diagnostics
agontard Oct 23, 2025
cfb98d0
small fix
agontard Oct 23, 2025
5e8d82d
make get-check-mappings now depends on make opam
agontard Oct 23, 2025
f016506
update description
agontard Oct 25, 2025
fb075d2
wip + test
agontard Nov 20, 2025
19289b6
test
agontard Nov 20, 2025
2b85ea9
use Export.Coq when possible
agontard Nov 21, 2025
4ef1781
fix
agontard Nov 21, 2025
d655075
fixes
agontard Dec 16, 2025
ea6556e
fix
agontard Dec 17, 2025
128be30
fix
agontard Dec 17, 2025
6f9a2e1
clean
agontard Dec 17, 2025
ade0818
clean
agontard Dec 17, 2025
a74b280
fixed
agontard Dec 17, 2025
43c8c15
more precise errors
agontard Dec 31, 2025
4271c9b
use correct renamings
agontard Dec 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
_build/
output*
.vscode
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,22 @@ clean-lpo: rm-lpo
rm-lpo:
-find . -maxdepth 1 -name '*.lpo' -delete

.PHONY: get-check-mappings
get-check-mappings: opam
@echo generate check_mappings file ...
@hol2dk check-mappings $(BASE) $(HOL2DK_DIR)/encoding.lp $(HOL2DK_DIR)/renaming.lp $(MAPPING) $(REQUIRING)

BASE_ROCQ_OPTIONS := -q -no-glob -R . $(ROOT_PATH)
# User specifiable rocq options
EXTRA_ROCQ_OPTIONS ?=
ROCQ_OPTIONS := $(BASE_ROCQ_OPTIONS) $(EXTRA_ROCQ_OPTIONS)

.PHONY: check-mappings
check-mappings: get-check-mappings $(VOFILES)
@echo check generated file ...
@rocq compile $(ROCQ_OPTIONS) $(BASE)_checkmappings.v
rm -f $(BASE)_checkmappings.v $(BASE)_checkmappings.vo $(BASE)_checkmappings.vok $(BASE)_checkmappings.vos

.PHONY: v
v: $(LP_FILES:%.lp=%.v)
ifneq ($(SET_LP_FILES),1)
Expand Down Expand Up @@ -299,10 +315,6 @@ ifneq ($(INCLUDE_VO_MK),1)
touch .finished
endif

BASE_ROCQ_OPTIONS := -q -no-glob -R . $(ROOT_PATH)
# User specifiable rocq options
EXTRA_ROCQ_OPTIONS ?=
ROCQ_OPTIONS := $(BASE_ROCQ_OPTIONS) $(EXTRA_ROCQ_OPTIONS)

%.vo: %.v
@echo rocq $<
Expand Down
2 changes: 1 addition & 1 deletion dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(executable
(public_name hol2dk)
(name main)
(libraries str unix)
(libraries str unix lambdapi.lplib lambdapi.common lambdapi.parsing lambdapi.core lambdapi.export)
)

(install
Expand Down
3 changes: 2 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
dune
(ocaml (>= 4.13))
(hol_light (= 3.0.0))
)
(lambdapi (= 3.0.0))
)
)

; See the complete stanza docs at https://dune.readthedocs.io/en/stable/dune-files.html#dune-project
21 changes: 21 additions & 0 deletions main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ hol2dk files [$path/]$base.(dk|lp)
for each HOL-Light file required by $HOLLIGHT_DIR/$path/$base.ml, generate
a (dk|lp) file with the statements of the theorems proved in that file

hol2dk check-mappings $base $encoding.lp $renaming.lp $mappings.lp $requiring
generates a file $(base).checkmappings.v that can be used to diagnose
badly typed mappings, unused mappings, unmapped axioms and non-fully
mapped definitions.

hol2dk env
print the values of $HOL2DK_DIR and $HOLLIGHT_DIR

Expand Down Expand Up @@ -1236,6 +1241,22 @@ and command = function

| "abbrev"::_ -> wrong_nb_args()

(* generate file to check mappings *)
| "check-mappings"::b::e::rn::m::rq ->
Xmapcheck.base := b ;
Export.Coq.stt := true ;
Export.Coq.use_implicits := false ;
Export.Coq.use_notations := true ;
Export.Coq.set_renaming rn ;
Xmapcheck.initial_rmap := !Export.Coq.rmap ;
Export.Coq.set_mapping m ;
Xmapcheck.unused_mappings := !Export.Coq.erase ;
Export.Coq.set_encoding e ;
Xmapcheck.requiring := String.concat " " rq ;
Xmapcheck.generate_check_file()

| "check-mappings"::_ -> wrong_nb_args()

(* Single file generation (used neither in b.mk nor in Makefile). *)
| f::args ->
let r = range args in
Expand Down
30 changes: 30 additions & 0 deletions renaming.lp
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
// map for renaming dk/lp identifiers (on the right)
// to Coq expressions (on the left)

builtin "type'" ≔ Set;
builtin "arrow" ≔ fun;
builtin "equal" ≔ =;
builtin "exists_1" ≔ ∃₁;
builtin "exists_1_def" ≔ ∃₁_def;
builtin "neg" ≔ ¬;
builtin "neg_def" ≔ ¬_def;
builtin "bottom" ≔ ⊥;
builtin "bottom_def" ≔ ⊥_def;
builtin "vee" ≔ ∨;
builtin "vee_def" ≔ ∨_def;
builtin "existsq" ≔ ∃;
builtin "exists_def" ≔ ∃_def;
builtin "forallq" ≔ ∀;
builtin "forall_def" ≔ ∀_def;
builtin "doublearrow" ≔ ⇒;
builtin "doublearrow_def" ≔ ⇒_def;
builtin "wedge" ≔ ∧;
builtin "wedge_def" ≔ ∧_def;
builtin "top" ≔ ⊤;
builtin "top_def" ≔ ⊤_def;
builtin "top_i" ≔ ⊤ᵢ;
builtin "wedge_e1" ≔ ∧ₑ₁;
builtin "wedge_e2" ≔ ∧ₑ₂;
builtin "exists_i" ≔ ∃ᵢ;
builtin "exists_e" ≔ ∃ₑ;
builtin "vee_i1" ≔ ∨ᵢ₁;
builtin "vee_i2" ≔ ∨ᵢ₂;
builtin "vee_e" ≔ ∨ₑ;

builtin "minus" ≔ -;
builtin "minus_def" ≔ -_def;
builtin "minus'" ≔ -';
Expand Down
2 changes: 1 addition & 1 deletion theory_hol.lp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ symbol ⊤ᵢ : Prf ⊤;
symbol ∧ᵢ [p : El bool] : Prf p → Π [q : El bool], Prf q → Prf (∧ p q);
symbol ∧ₑ₁ [p q : El bool] : Prf (∧ p q) → Prf p;
symbol ∧ₑ₂ [p q : El bool] : Prf (∧ p q) → Prf q;
symbol ∃ᵢ [a] (p : El a → El bool) t : Prf (p t) → Prf (∃ p);
symbol ∃ᵢ [a] (p : El a → El bool) (t : El a) : Prf (p t) → Prf (∃ p);
symbol ∃ₑ [a] [p : El a → El bool] : Prf (∃ (λ x, p x)) → Π [r : El bool], (Π x:El a, Prf (p x) → Prf r) → Prf r;
symbol ∨ᵢ₁ [p : El bool] : Prf p → Π q : El bool, Prf (∨ p q);
symbol ∨ᵢ₂ (p : El bool) [q : El bool] : Prf q → Prf (∨ p q);
Expand Down
Loading
Loading