summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSon Ho2023-06-02 16:10:20 +0200
committerSon HO2023-06-04 21:54:38 +0200
commit54afbf3a8b71ee729641ee3024d19aaf8fa92a67 (patch)
treea014bdb321be1ada84a8687e38bd17c487d68889
parent435d75174a12a47da84537cc7c9730a0eccf6d1f (diff)
Start setting up the Nix derivation for HOL4
Diffstat (limited to '')
-rw-r--r--Makefile6
-rw-r--r--backends/hol4/divDefNoFixLib.sml2
-rw-r--r--backends/hol4/primitivesBaseTacLib.sml8
-rw-r--r--flake.nix33
-rw-r--r--tests/hol4/Makefile12
-rw-r--r--tests/hol4/hashmap/hashmap_PropertiesScript.sml9
6 files changed, 58 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 14f35ce7..a5d1fd09 100644
--- a/Makefile
+++ b/Makefile
@@ -283,7 +283,7 @@ thol4p-%:
# Nix - TODO: add the lean tests
.PHONY: nix
-nix: nix-aeneas-tests nix-aeneas-verify-fstar nix-aeneas-verify-coq
+nix: nix-aeneas-tests nix-aeneas-verify-fstar nix-aeneas-verify-coq nix-aeneas-verify-hol4
.PHONY: nix-aeneas-tests
nix-aeneas-tests:
@@ -300,3 +300,7 @@ nix-aeneas-verify-coq:
.PHONY: nix-aeneas-verify-lean
nix-aeneas-verify-lean:
nix build .#checks.x86_64-linux.aeneas-verify-lean --show-trace -L
+
+.PHONY: nix-aeneas-verify-hol4
+nix-aeneas-verify-hol4:
+ nix build .#checks.x86_64-linux.aeneas-verify-hol4 --show-trace -L
diff --git a/backends/hol4/divDefNoFixLib.sml b/backends/hol4/divDefNoFixLib.sml
index f7b9763d..85a1b1a8 100644
--- a/backends/hol4/divDefNoFixLib.sml
+++ b/backends/hol4/divDefNoFixLib.sml
@@ -206,7 +206,7 @@ fun get_smallest_unique_id_for_names (names : string list) : string =
handle HOL_ERR _ => false
val _ =
while !continue do (
- let val _ = (continue := not (forall name_is_ok names)) in
+ let val _ = (continue := not (all name_is_ok names)) in
if !continue then incr_i () else () end
)
in
diff --git a/backends/hol4/primitivesBaseTacLib.sml b/backends/hol4/primitivesBaseTacLib.sml
index f256d330..c079bcf1 100644
--- a/backends/hol4/primitivesBaseTacLib.sml
+++ b/backends/hol4/primitivesBaseTacLib.sml
@@ -17,6 +17,14 @@ val gsym = GSYM
*)
fun ignore_tac (_ : thm) : tactic = ALL_TAC
+(* REMARK: the last github version of HOL4 defines some functions which seem
+ to be absent from the last release version (which is older). As a consequence,
+ the Nix flake fails if we don't redefine those here.
+ *)
+val pop_last_assum = last_x_assum
+val qexists = qexists_tac
+(* END OF REMARK *)
+
val pop_ignore_tac = pop_assum ignore_tac
(* TODO: no exfalso tactic?? *)
diff --git a/flake.nix b/flake.nix
index 14964718..4ff46046 100644
--- a/flake.nix
+++ b/flake.nix
@@ -109,7 +109,7 @@
make prepare-projects
make verify -j $NIX_BUILD_CORES
'';
- # The tests don't generate anything
+ # The tests don't generate anything - TODO: actually they do
installPhase = "touch $out";
};
# Replay the Coq proofs.
@@ -121,7 +121,7 @@
make prepare-projects
make verify -j $NIX_BUILD_CORES
'';
- # The tests don't generate anything
+ # The tests don't generate anything - TODO: actually they do
installPhase = "touch $out";
};
# Replay the Lean proofs. TODO: doesn't work
@@ -137,7 +137,30 @@
#make verify -j $NIX_BUILD_CORES
make verify
'';
- # The tests don't generate anything
+ };
+ # Replay the HOL4 proofs
+ #
+ # Remark: we tried to have two targets, one for ./backends/hol4 and
+ # one for ./tests/hol4 but we didn't manage to make ./tests/hol4
+ # reuse the build of ./backends/hol4.
+ aeneas-verify-hol4 = pkgs.stdenv.mkDerivation {
+ name = "aeneas_verify_hol4";
+ # Remark: we tried to filter the sources to only include ./backends/hol4
+ # and ./tests/hol4 (see comment below), but it didn't work
+ src = ./.;
+ # src = pkgs.lib.cleanSourceWith {
+ # src = ./.;
+ # filter = path: type:
+ # pkgs.lib.hasPrefix (toString ./backends/hol4) path
+ # || pkgs.lib.hasPrefix (toString ./tests/hol4) path;
+ # };
+ buildInputs = [ pkgs.hol ];
+ buildPhase= ''
+ cd ./tests/hol4
+ make prepare-projects
+ make verify -j $NIX_BUILD_CORES
+ '';
+ # The build doesn't generate anything
installPhase = "touch $out";
};
in {
@@ -145,7 +168,7 @@
inherit aeneas;
default = aeneas;
};
- checks = { inherit aeneas aeneas-tests aeneas-verify-fstar aeneas-verify-coq aeneas-verify-lean; };
- hydraJobs = { inherit aeneas aeneas-tests aeneas-verify-fstar aeneas-verify-coq aeneas-verify-lean; };
+ checks = { inherit aeneas aeneas-tests aeneas-verify-fstar aeneas-verify-coq aeneas-verify-lean aeneas-verify-hol4; };
+ hydraJobs = { inherit aeneas aeneas-tests aeneas-verify-fstar aeneas-verify-coq aeneas-verify-lean aeneas-verify-hol4; };
});
}
diff --git a/tests/hol4/Makefile b/tests/hol4/Makefile
index fa2c5512..cef04aca 100644
--- a/tests/hol4/Makefile
+++ b/tests/hol4/Makefile
@@ -9,6 +9,7 @@ CLEAN_DIRS = $(addprefix clean-,$(ALL_DIRS))
COPY_HOLMAKEFILE = $(addprefix copy-holmakefile-,$(ALL_DIRS))
# This allows to customize the INCLUDES variable of the Holmakefile - useful for Nix
+AENEAS_PRIMITIVES ?= ../../backends/hol4
HOLMAKEFILE_INCLUDES ?= ../../../backends/hol4
.PHONY: all
@@ -24,11 +25,20 @@ copy-holmakefile-%:
echo "INCLUDES = " $(HOLMAKEFILE_INCLUDES) >> $*/Holmakefile
cat Holmakefile.template >> $*/Holmakefile
+# There are racing issues with Holmake: if we run several builds in parallel,
+# Holmake will complain that the dependencies (in `aeneas/backends/hol4` are
+# not built). For this reason, we add this rule which enforces that *one*
+# Holmake process builds the dependencies, before the test subdirectories
+# (hashmap, etc.) are built in parallel.
+.PHONY: verify-primitives
+verify-primitives:
+ cd $(AENEAS_PRIMITIVES) && Holmake
+
.PHONY: verify
verify: $(VERIFY_DIRS)
.PHONY: verif-%
-verif-%:
+verif-%: verify-primitives
cd $* && Holmake
.PHONY: clean
diff --git a/tests/hol4/hashmap/hashmap_PropertiesScript.sml b/tests/hol4/hashmap/hashmap_PropertiesScript.sml
index 6b64affe..c8e87f07 100644
--- a/tests/hol4/hashmap/hashmap_PropertiesScript.sml
+++ b/tests/hol4/hashmap/hashmap_PropertiesScript.sml
@@ -670,8 +670,10 @@ Proof
case_tac >>
case_tac >>
Cases_on ‘hm’ >> fs [] >>
- fs [hashmap_TypesTheory.recordtype_hash_map_t_seldef_hash_map_slots_fupd_def] >>
- fs [hashmap_TypesTheory.recordtype_hash_map_t_seldef_hash_map_num_entries_fupd_def]
+ (* Remark: we initially used directly hashmap_TypesTheory.recordtype_hash_map_t_seldef_hash_map_slots_fupd_def
+ and hashmap_TypesTheory.recordtype_hash_map_t_seldef_hash_map_num_entries_fupd_def,
+ but it fails in the Nix derivation *)
+ fs (TypeBase.updates_of “:'a hash_map_t”)
QED
val hash_map_insert_no_resize_fwd_back_branches_eq = SIMP_RULE (srw_ss ()) [] hash_map_insert_no_resize_fwd_back_branches_eq
@@ -1818,8 +1820,7 @@ Proof
rw [bind_def] >>
rpt (case_tac >> fs []) >>
Cases_on ‘hm’ >> fs [] >>
- fs [hashmap_TypesTheory.recordtype_hash_map_t_seldef_hash_map_slots_fupd_def,
- hashmap_TypesTheory.recordtype_hash_map_t_seldef_hash_map_num_entries_fupd_def]
+ fs (TypeBase.updates_of “:'a hash_map_t”)
QED
(* TODO: this doesn't work very well *)