lean-pkg 0.25.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lean_pkg/__init__.py +3 -0
- lean_pkg/adapters/__init__.py +148 -0
- lean_pkg/adapters/github.py +65 -0
- lean_pkg/adapters/leansearch.py +68 -0
- lean_pkg/adapters/loogle.py +45 -0
- lean_pkg/adapters/palomar.py +170 -0
- lean_pkg/adapters/reservoir.py +127 -0
- lean_pkg/anchor.py +678 -0
- lean_pkg/audit.py +716 -0
- lean_pkg/binding_file.py +446 -0
- lean_pkg/blueprint.py +213 -0
- lean_pkg/build_scope.py +282 -0
- lean_pkg/ci_github.py +917 -0
- lean_pkg/claim_axioms.py +421 -0
- lean_pkg/claims.py +1155 -0
- lean_pkg/claims_mark.py +197 -0
- lean_pkg/cli.py +5208 -0
- lean_pkg/cli_parser.py +768 -0
- lean_pkg/command_tree.py +615 -0
- lean_pkg/comparator_config.py +990 -0
- lean_pkg/comparator_contracts.py +382 -0
- lean_pkg/comparator_receipt.py +2854 -0
- lean_pkg/comparator_stage.py +623 -0
- lean_pkg/comparator_types.py +830 -0
- lean_pkg/container.py +172 -0
- lean_pkg/core.py +1570 -0
- lean_pkg/coverage.py +1278 -0
- lean_pkg/data/stacks/lts-2026.10.yaml +73 -0
- lean_pkg/data/toolchain-advisories.yaml +77 -0
- lean_pkg/data/upgrade-breaking.yaml +20 -0
- lean_pkg/data/verify-workflow-pins.yaml +14 -0
- lean_pkg/deps_closure.py +512 -0
- lean_pkg/deps_fill.py +445 -0
- lean_pkg/dup_constants.py +448 -0
- lean_pkg/exercise.py +828 -0
- lean_pkg/exercise_forbid.py +288 -0
- lean_pkg/export_paths.py +77 -0
- lean_pkg/extract.py +1172 -0
- lean_pkg/extract_decls.py +501 -0
- lean_pkg/extract_ledger.py +1408 -0
- lean_pkg/extract_summary.py +132 -0
- lean_pkg/extract_types.py +502 -0
- lean_pkg/extract_write.py +138 -0
- lean_pkg/formalization.py +1078 -0
- lean_pkg/formalization_kept.py +182 -0
- lean_pkg/fresh_repo.py +709 -0
- lean_pkg/gate.py +2141 -0
- lean_pkg/headline.py +211 -0
- lean_pkg/help_topics.py +442 -0
- lean_pkg/holes.py +289 -0
- lean_pkg/host_routes.py +376 -0
- lean_pkg/hypotheses.py +788 -0
- lean_pkg/index.py +1749 -0
- lean_pkg/json_stdout.py +48 -0
- lean_pkg/lake_hygiene.py +289 -0
- lean_pkg/lean_diag.py +280 -0
- lean_pkg/lean_scan.py +1300 -0
- lean_pkg/ledger.py +582 -0
- lean_pkg/next_step.py +510 -0
- lean_pkg/page.py +1831 -0
- lean_pkg/page_html.py +153 -0
- lean_pkg/palomar.py +316 -0
- lean_pkg/palomar_check.py +1027 -0
- lean_pkg/port_modules.py +677 -0
- lean_pkg/prior_art.py +286 -0
- lean_pkg/producer.py +212 -0
- lean_pkg/producer_skew.py +208 -0
- lean_pkg/public_safety.py +1487 -0
- lean_pkg/publish.py +402 -0
- lean_pkg/rebase.py +984 -0
- lean_pkg/receipt.py +2385 -0
- lean_pkg/receipt_check.py +1064 -0
- lean_pkg/receipt_ci.py +660 -0
- lean_pkg/receipt_systemd.py +890 -0
- lean_pkg/recommended.py +232 -0
- lean_pkg/report.py +727 -0
- lean_pkg/reservoir.py +203 -0
- lean_pkg/scaffold.py +588 -0
- lean_pkg/schemas/formalization-0.4.schema.json +344 -0
- lean_pkg/schemas/formalization-0.4.schema.source.txt +15 -0
- lean_pkg/scripts/ClaimAxioms.lean +47 -0
- lean_pkg/scripts/ContractsOnly.lean +300 -0
- lean_pkg/scripts/DupConstants.lean +149 -0
- lean_pkg/scripts/HypProbe.lean +257 -0
- lean_pkg/scripts/comparator-check.sh +396 -0
- lean_pkg/scripts/verify-comparator.sh +135 -0
- lean_pkg/seal_bundle.py +647 -0
- lean_pkg/search.py +865 -0
- lean_pkg/site_profiles/easley.yaml +10 -0
- lean_pkg/site_profiles/github-actions.yaml +12 -0
- lean_pkg/sites.py +225 -0
- lean_pkg/stacks.py +373 -0
- lean_pkg/statements_module.py +217 -0
- lean_pkg/templates/Apache-2.0.txt +202 -0
- lean_pkg/toolchain_advisories.py +225 -0
- lean_pkg/upgrade.py +706 -0
- lean_pkg/verify.py +495 -0
- lean_pkg-0.25.0.dist-info/METADATA +93 -0
- lean_pkg-0.25.0.dist-info/RECORD +103 -0
- lean_pkg-0.25.0.dist-info/WHEEL +5 -0
- lean_pkg-0.25.0.dist-info/entry_points.txt +5 -0
- lean_pkg-0.25.0.dist-info/licenses/LICENSE +202 -0
- lean_pkg-0.25.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Vendored from https://github.com/PalomarRegistry/PalomarTemplate (Apache-2.0),
|
|
3
|
+
# scripts/verify-comparator.sh at commit 2891de4c48955af824969a263d31b25e7a9a1406, 2026-10-05.
|
|
4
|
+
# Local changes (lean-pkg): (1) the config path is taken from $1 (default
|
|
5
|
+
# comparator.json); (2) the script runs in the current directory (the runner
|
|
6
|
+
# sets cwd to the project) instead of cd'ing to its own parent, because it is
|
|
7
|
+
# shipped as package data, not inside the project; (3) `lake exe cache get` is
|
|
8
|
+
# skipped when VERIFY_COMPARATOR_SKIP_CACHE_GET=1 (the runner sets it for a project
|
|
9
|
+
# declared to have no Mathlib, where Lake has no `cache` executable), and the
|
|
10
|
+
# line "== lake comparator (toolchain) <config>" is printed right before `lake
|
|
11
|
+
# comparator`, so a failure before it is reported as a tool failure, not as a
|
|
12
|
+
# rejected proof; (4) before `lake comparator`, lake_shadow_check refuses a
|
|
13
|
+
# LEAN_PATH entry other than the project's own .lake/build/lib/lean that holds
|
|
14
|
+
# one of the project's root namespaces (Lake lists the root package last and
|
|
15
|
+
# Lean loads <R>/ from the first entry holding it; lean_pkg/lake_hygiene.py);
|
|
16
|
+
# (5) a file-wide `# shellcheck disable=SC2016` below: the shared
|
|
17
|
+
# lake_shadow_check block's single-quoted backticks are literal (Lean name
|
|
18
|
+
# literals in roots/globs), and a line-level directive would have to go into
|
|
19
|
+
# every copy of that block.
|
|
20
|
+
# Everything else is upstream.
|
|
21
|
+
# shellcheck disable=SC2016
|
|
22
|
+
set -euo pipefail
|
|
23
|
+
|
|
24
|
+
# Judge Solution against Challenge the way Palomar does: with the `lake
|
|
25
|
+
# comparator` that ships in this project's own toolchain, replaying the proof
|
|
26
|
+
# through Lean's kernel and the toolchain's bundled independent kernels
|
|
27
|
+
# (NanoDa and con-ron). Nothing is built from a pin; everything that judges
|
|
28
|
+
# comes from `lean-toolchain`, which Palomar requires to be v4.35.0-rc2 or
|
|
29
|
+
# later.
|
|
30
|
+
|
|
31
|
+
config_path="${1:-comparator.json}"
|
|
32
|
+
|
|
33
|
+
for required_command in bwrap lake lean python3; do
|
|
34
|
+
if ! command -v "$required_command" >/dev/null 2>&1; then
|
|
35
|
+
echo "error: $required_command is required to run lake comparator" >&2
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
done
|
|
39
|
+
|
|
40
|
+
toolchain=$(tr -d '[:space:]' < lean-toolchain)
|
|
41
|
+
prefix=$(lean --print-prefix)
|
|
42
|
+
for tool in lake leanexport leanchecker nanoda_bin con-ron; do
|
|
43
|
+
if [ ! -x "$prefix/bin/$tool" ]; then
|
|
44
|
+
echo "error: toolchain $toolchain does not bundle $tool" >&2
|
|
45
|
+
echo "Palomar requires leanprover/lean4:v4.35.0-rc2 or later" >&2
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
done
|
|
49
|
+
|
|
50
|
+
# Palomar ignores `enable_nanoda` and rejects `external_kernels` in a submitted
|
|
51
|
+
# comparator.json: it registers the toolchain's bundled kernels itself. This
|
|
52
|
+
# generated copy does the same, so the local check judges as the registry does.
|
|
53
|
+
config=$(mktemp "${TMPDIR:-/tmp}/palomar-comparator.XXXXXX")
|
|
54
|
+
trap 'rm -f "$config"' EXIT
|
|
55
|
+
python3 - "$config_path" "$config" "$prefix" <<'PY'
|
|
56
|
+
import json
|
|
57
|
+
import pathlib
|
|
58
|
+
import sys
|
|
59
|
+
|
|
60
|
+
source, destination, prefix = sys.argv[1:]
|
|
61
|
+
try:
|
|
62
|
+
config = json.loads(pathlib.Path(source).read_text(encoding="utf-8"))
|
|
63
|
+
except (OSError, UnicodeError, json.JSONDecodeError) as error:
|
|
64
|
+
print(f"error: cannot read valid Comparator config {source}: {error}", file=sys.stderr)
|
|
65
|
+
raise SystemExit(1)
|
|
66
|
+
if not isinstance(config, dict):
|
|
67
|
+
print(f"error: {source} must contain one JSON object", file=sys.stderr)
|
|
68
|
+
raise SystemExit(1)
|
|
69
|
+
if "external_kernels" in config:
|
|
70
|
+
print(f"error: {source}: external_kernels is not a submitter field; Palomar rejects it", file=sys.stderr)
|
|
71
|
+
raise SystemExit(1)
|
|
72
|
+
config.pop("enable_nanoda", None)
|
|
73
|
+
config["external_kernels"] = {
|
|
74
|
+
"nanoda": [f"{prefix}/bin/nanoda_bin"],
|
|
75
|
+
"con-ron": [f"{prefix}/bin/con-ron"],
|
|
76
|
+
}
|
|
77
|
+
pathlib.Path(destination).write_text(json.dumps(config, indent=2) + "\n", encoding="utf-8")
|
|
78
|
+
PY
|
|
79
|
+
|
|
80
|
+
if [ "${VERIFY_COMPARATOR_SKIP_CACHE_GET:-}" = 1 ]; then
|
|
81
|
+
echo "skipping lake exe cache get (VERIFY_COMPARATOR_SKIP_CACHE_GET=1: no Mathlib dependency)"
|
|
82
|
+
else
|
|
83
|
+
lake exe cache get
|
|
84
|
+
fi
|
|
85
|
+
# >>> lean-pkg lake_shadow_check (keep identical in every copy; see lean_pkg/lake_hygiene.py)
|
|
86
|
+
lake_root_namespaces() {
|
|
87
|
+
local found
|
|
88
|
+
found=$(
|
|
89
|
+
{
|
|
90
|
+
if [ -f lakefile.toml ]; then
|
|
91
|
+
awk '/^[[:space:]]*\[/ { lib = ($0 ~ /^[[:space:]]*\[\[[[:space:]]*lean_lib[[:space:]]*\]\]/) }
|
|
92
|
+
lib && /^[[:space:]]*(name|roots|globs)[[:space:]]*=/' lakefile.toml | grep -oE '"[^"]+"' | tr -d '"'
|
|
93
|
+
fi
|
|
94
|
+
if [ -f lakefile.lean ]; then
|
|
95
|
+
grep -oE 'lean_lib[[:space:]]+(«[^»]+»|[A-Za-z_][A-Za-z0-9_.]*)' lakefile.lean | awk '{print $2}'
|
|
96
|
+
tr '\n' ' ' < lakefile.lean | grep -oE '(roots|globs)[[:space:]]*:=[[:space:]]*#\[[^]]*\]' \
|
|
97
|
+
| grep -oE '`[^]`[:space:],)]+' | tr -d '`'
|
|
98
|
+
fi
|
|
99
|
+
} 2>/dev/null | sed -e 's/^«\([^»]*\)».*$/\1/' -e 's/[.].*$//' | grep -E '^[A-Za-z_]' | sort -u || true
|
|
100
|
+
)
|
|
101
|
+
if [ -z "$found" ]; then
|
|
102
|
+
found=$(find . -path ./.lake -prune -o -name '*.lean' ! -path ./lakefile.lean -print 2>/dev/null \
|
|
103
|
+
| sed -e 's|^\./||' -e 's|/.*$||' -e 's|\.lean$||' | grep -E '^[A-Za-z_]' | sort -u || true)
|
|
104
|
+
fi
|
|
105
|
+
printf '%s\n' "$found"
|
|
106
|
+
}
|
|
107
|
+
lake_shadow_check() {
|
|
108
|
+
local own entry r n=0 hits=0 roots
|
|
109
|
+
local -a entries
|
|
110
|
+
own="$(pwd -P)/.lake/build/lib/lean"
|
|
111
|
+
roots=$(lake_root_namespaces)
|
|
112
|
+
IFS=: read -r -a entries <<<"${1:-}"
|
|
113
|
+
for entry in "${entries[@]}"; do
|
|
114
|
+
[ -n "$entry" ] || continue
|
|
115
|
+
n=$((n + 1))
|
|
116
|
+
if [ "$(cd "$entry" 2>/dev/null && pwd -P)" = "$own" ]; then continue; fi
|
|
117
|
+
for r in $roots; do
|
|
118
|
+
if [ -d "$entry/$r" ] || [ -e "$entry/$r.olean" ] || [ -e "$entry/$r.ilean" ]; then
|
|
119
|
+
echo "lean-path-shadow: $entry/$r"
|
|
120
|
+
hits=$((hits + 1))
|
|
121
|
+
fi
|
|
122
|
+
done
|
|
123
|
+
done
|
|
124
|
+
if [ "$hits" -gt 0 ]; then return 1; fi
|
|
125
|
+
echo "lean-path-shadow: none ($n entries, roots $(printf '%s' "$roots" | paste -sd, -))"
|
|
126
|
+
}
|
|
127
|
+
# <<< lean-pkg lake_shadow_check
|
|
128
|
+
lean_path="$(lake env printenv LEAN_PATH)"
|
|
129
|
+
if ! lake_shadow_check "$lean_path"; then
|
|
130
|
+
echo "error: a LEAN_PATH entry shadows this project's own modules (lean-path-shadow lines above);" \
|
|
131
|
+
"a dependency's copy would be judged instead; remove it and rebuild" >&2
|
|
132
|
+
exit 1
|
|
133
|
+
fi
|
|
134
|
+
echo "== lake comparator (toolchain) $config_path"
|
|
135
|
+
lake comparator --config "$config"
|