Skip to content

Commit ff9a58a

Browse files
hyperpolymathclaude
andcommitted
corpus: AFP → 50K, broader Agda extraction, rebalance
- extract_afp.jl: MAX_PER_ARTICLE 25 → 70. AFP corpus grows 20,486 → 50,137 (post-dedup 48,432), pushing Isabelle to rank 2 at 18.36% share. - extract_agda.jl: drop the PROOFY signature gate (was biasing toward equational proofs) and walk the whole agda-stdlib tree (doc/, dev/, .github/ in addition to src/). Agda grows 5,529 → 9,312 (post-dedup 5,942). The stdlib source (1,343 files) caps further growth here — reaching 50K would require vendoring additional Agda corpora (cubical, unimath, TypeTopology). Unified corpus: 233,407 → 263,792. Lean share 42.56% → 37.66%. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4b07e0c commit ff9a58a

6 files changed

Lines changed: 63228 additions & 26008 deletions

File tree

scripts/extract_afp.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const OUTPUT_DIR = joinpath(REPO_ROOT, "training_data")
4242
const OUTPUT_FILE = joinpath(OUTPUT_DIR, "proof_states_afp.jsonl")
4343
const STATS_FILE = joinpath(OUTPUT_DIR, "stats_afp.json")
4444
const START_ID = 220000
45-
const MAX_PER_ARTICLE = 25 # keep the corpus balanced across AFP entries
45+
const MAX_PER_ARTICLE = 70 # target ~50K (893 articles, many <70 lemmas)
4646

4747
# Keyword that introduces a theorem-shaped declaration.
4848
const THM_KW = raw"(?:lemma|theorem|corollary|proposition|schematic_goal)"

scripts/extract_agda.jl

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,21 @@ function parse_file(path::String)::Vector{Dict{String,Any}}
226226
sig_body = sig_body[1:400] * ""
227227
end
228228

229-
if looks_proofy(sig_body)
230-
key = name * "@" * rel
231-
if !(key in seen)
232-
push!(seen, key)
233-
ctx = collect_context(sig_body)
234-
push!(out, Dict{String,Any}(
235-
"theorem" => name,
236-
"goal" => sig_body,
237-
"context" => ctx,
238-
"source" => "agda-stdlib/" * relpath(path, AGDA_ROOT),
239-
))
240-
end
229+
# Keep any well-formed top-level signature. The PROOFY gate
230+
# biased the extraction toward equational proofs, which left
231+
# Agda under 5K records out of 1,182 files. The signatures we
232+
# drop otherwise are still useful as training context — they
233+
# establish definitions that proof-shaped signatures reference.
234+
key = name * "@" * rel
235+
if !(key in seen)
236+
push!(seen, key)
237+
ctx = collect_context(sig_body)
238+
push!(out, Dict{String,Any}(
239+
"theorem" => name,
240+
"goal" => sig_body,
241+
"context" => ctx,
242+
"source" => "agda-stdlib/" * relpath(path, AGDA_ROOT),
243+
))
241244
end
242245

243246
i = max(j, i + 1)
@@ -279,12 +282,12 @@ function main()
279282
isdir(AGDA_SRC) || error("Missing $AGDA_SRC — vendor agda-stdlib first.")
280283

281284
files = String[]
282-
for (root, _, names) in walkdir(AGDA_SRC)
285+
for (root, _, names) in walkdir(AGDA_ROOT)
283286
for n in names
284287
endswith(n, ".agda") && push!(files, joinpath(root, n))
285288
end
286289
end
287-
println("Scanning $(length(files)) .agda files under $AGDA_SRC")
290+
println("Scanning $(length(files)) .agda files under $AGDA_ROOT (incl. doc/, dev/, .github/)")
288291

289292
all_records = Dict{String,Any}[]
290293
parsed_ok = 0

0 commit comments

Comments
 (0)