Skip to content

Commit 9697919

Browse files
author
Your Name
committed
Use source file for Mizar
verification; add install helper
1 parent b196739 commit 9697919

File tree

2 files changed

+103
-1
lines changed

2 files changed

+103
-1
lines changed

scripts/install-provers.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
TOOLBOX_NAME="${TOOLBOX_NAME:-toolbx}"
6+
IN_TOOLBOX=0
7+
if [[ -f /run/.containerenv || -n "${TOOLBOX_PATH:-}" ]]; then
8+
IN_TOOLBOX=1
9+
fi
10+
11+
BASE_PACKAGES=(
12+
agda
13+
coq
14+
cvc5
15+
acl2
16+
)
17+
18+
OPTIONAL_PACKAGES=(
19+
isabelle
20+
hol4
21+
hol-light
22+
metamath
23+
mizar
24+
)
25+
26+
run_host_install() {
27+
if [[ "$IN_TOOLBOX" -eq 1 ]]; then
28+
echo "[install] Running inside toolbox; skipping host installs."
29+
return 0
30+
fi
31+
if ! command -v dnf >/dev/null 2>&1; then
32+
echo "[install] dnf not found on host; skipping host installs."
33+
return 0
34+
fi
35+
36+
echo "[install] Installing base provers on host..."
37+
sudo dnf -y install --skip-unavailable "${BASE_PACKAGES[@]}" || true
38+
39+
echo "[install] Installing optional provers on host..."
40+
sudo dnf -y install --skip-unavailable "${OPTIONAL_PACKAGES[@]}" || true
41+
42+
echo "[install] Host package search (for missing packages):"
43+
dnf search "${BASE_PACKAGES[@]}" "${OPTIONAL_PACKAGES[@]}" || true
44+
}
45+
46+
run_toolbox_install() {
47+
if ! command -v toolbox >/dev/null 2>&1; then
48+
echo "[install] toolbox not available; skipping toolbox installs."
49+
return 0
50+
fi
51+
if [[ "$IN_TOOLBOX" -eq 1 ]]; then
52+
echo "[install] Installing provers inside current toolbox..."
53+
sudo dnf -y install --skip-unavailable "${BASE_PACKAGES[@]}" || true
54+
sudo dnf -y install --skip-unavailable "${OPTIONAL_PACKAGES[@]}" || true
55+
dnf search "${BASE_PACKAGES[@]}" "${OPTIONAL_PACKAGES[@]}" || true
56+
return 0
57+
fi
58+
59+
echo "[install] Installing base provers in toolbox (${TOOLBOX_NAME})..."
60+
toolbox run -c "${TOOLBOX_NAME}" -- sudo dnf -y install --skip-unavailable ${BASE_PACKAGES[*]} || true
61+
62+
echo "[install] Installing optional provers in toolbox (${TOOLBOX_NAME})..."
63+
toolbox run -c "${TOOLBOX_NAME}" -- sudo dnf -y install --skip-unavailable ${OPTIONAL_PACKAGES[*]} || true
64+
65+
echo "[install] Toolbox package search (for missing packages):"
66+
toolbox run -c "${TOOLBOX_NAME}" -- dnf search ${BASE_PACKAGES[*]} ${OPTIONAL_PACKAGES[*]} || true
67+
}
68+
69+
run_mizar_checks() {
70+
echo "[mizar] Checking Mizar toolchain on host..."
71+
if command -v verifier >/dev/null 2>&1 && command -v mizf >/dev/null 2>&1; then
72+
verifier -h >/dev/null 2>&1 || true
73+
mizf -h >/dev/null 2>&1 || true
74+
echo "[mizar] verifier and mizf are on PATH."
75+
else
76+
echo "[mizar] verifier/mizf not found on PATH."
77+
fi
78+
79+
echo "[mizar] If installed under ~/.local/mizar, export:"
80+
echo " export PATH=\"\$HOME/.local/mizar/bin:\$PATH\""
81+
echo " export MIZFILES=\"\$HOME/.local/mizar/share\""
82+
}
83+
84+
echo "[install] Working directory: ${ROOT_DIR}"
85+
run_host_install
86+
run_toolbox_install
87+
run_mizar_checks
88+
89+
echo "[install] Done."

src/rust/provers/mizar.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,12 @@ impl ProverBackend for MizarBackend {
340340
.await
341341
.context("Failed to read Mizar file")?;
342342

343-
self.parse_string(&content).await
343+
let mut state = self.parse_string(&content).await?;
344+
state.metadata.insert(
345+
"source_path".to_string(),
346+
serde_json::Value::String(path.to_string_lossy().to_string()),
347+
);
348+
Ok(state)
344349
}
345350

346351
async fn parse_string(&self, content: &str) -> Result<ProofState> {
@@ -498,6 +503,14 @@ impl ProverBackend for MizarBackend {
498503
return Ok(false);
499504
}
500505

506+
if let Some(serde_json::Value::String(path)) = state.metadata.get("source_path") {
507+
let path = Path::new(path);
508+
if path.exists() {
509+
let result = self.verify_file(path).await?;
510+
return Ok(result.success);
511+
}
512+
}
513+
501514
let mizar_content = self.export_to_mizar(state)?;
502515

503516
let temp_dir = std::env::temp_dir();

0 commit comments

Comments
 (0)