SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2309.15806 · 2023

Lyra: Orchestrating Dual Correction in Automated Theorem Proving

arXiv · PDF · Open in the Atlas

Code that ran

7 of 8 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 7 failures of our instrument; 1 no recorded run), measured 2026-11-24; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2309.15806.json · badge: /api/ran/2309.15806.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
chuanyang-zheng/lyra-theorem-prover canonical (classifier label)
classifier basis: census
7 ran · 1 no recorded run
FunctionStatusWhere it lives
MATH_example_template Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/lyra-theorem-prover/src/autoformalization/prompts.py
code served (permissive licence) · get_code("15fd5c7c3c95ffe6")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "example": {
        "problem": "Find the derivative of f(x) = x^2 + 3x + 2",
        "solution": "f'(x) = 2x + 3"
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
apply_subst Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/lyra-theorem-prover/formal_system_servers/mm_server_backend.py
code served (permissive licence) · get_code("bd6230cf4c7dd610")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import typing

# Set up the global verbosity and logfile for vprint
verbosity = 0
import sys
logfile = sys.stdout

# Type definitions matching the function
Var = str
Const = str
Symbol = typing.Union[Var, Const]
Stmt = typing.List[Symbol]

# Helper function
def vprint(vlevel: int, *arguments: typing.Any) -> None:
    """Print log message if verbosity level is higher than the argument."""
    if verbosity >= vlevel:
        print(*arguments, file=logfile)

def apply_subst(stmt: Stmt, subst: typing.Dict[Var, Stmt]) -> Stmt:
    """Return the token list resulting from the given substitution
    (dictionary) applied to the given statement (token list).
    """
    result = []
    for tok in stmt:
        if tok in subst:
            result += subst[tok]
        else:
            result.append(tok)
    vprint(20, 'Applying subst', subst, 'to stmt', stmt, ':', result)
    return result

# Construct valid arguments
stmt_example = ["x", "y", "z", "const1"]
subst_example = {
    "x": ["a", "b"],
    "y": ["c"],
}

ARGS = {
    "stmt": stmt_example,
    "subst": subst_example,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_finish Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/lyra-theorem-prover/src/autoformalization/utils.py
code served (permissive licence) · get_code("3a7d6557aa829cee")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import shutil

# Create a temporary directory structure for testing
temp_dir = tempfile.mkdtemp()
dump_path = temp_dir

# Create success and failure subdirectories with some test files
success_dir = os.path.join(dump_path, 'success')
failure_dir = os.path.join(dump_path, 'failure')
os.makedirs(success_dir, exist_ok=True)
os.makedirs(failure_dir, exist_ok=True)

# Create some test files in success directory
open(os.path.join(success_dir, 'problem1_attempt1.txt'), 'w').close()
open(os.path.join(success_dir, 'problem2_attempt2.txt'), 'w').close()

# Create some test files in failure directory
open(os.path.join(failure_dir, 'problem3_attempt1.txt'), 'w').close()
open(os.path.join(failure_dir, 'problem1_attempt2.txt'), 'w').close()

# Create args object with dump_path attribute
class Args:
    def __init__(self, dump_path):
        self.dump_path = dump_path

args = Args(dump_path)

ARGS = {
    'args': args,
    'only_success': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_problem_names Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/lyra-theorem-prover/src/autoformalization/utils.py
code served (permissive licence) · get_code("e10458c4731d6819")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile
import shutil

# Create a temporary directory structure to simulate the draft_data/isabelle/test directory
temp_base = tempfile.mkdtemp()
test_dir = os.path.join(temp_base, 'draft_data', 'isabelle', 'test')
os.makedirs(test_dir, exist_ok=True)

# Create some test files with different extensions
test_files = ['problem1.txt', 'problem2.txt', 'problem3.dat', 'problem4.isabelle']
for filename in test_files:
    filepath = os.path.join(test_dir, filename)
    with open(filepath, 'w') as f:
        f.write('test content')

# Change working directory to temp_base so relative paths work
original_cwd = os.getcwd()
os.chdir(temp_base)

ARGS = {
    'split': 'test'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_tactic Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/lyra-theorem-prover/formal_system_servers/mm_server_backend.py
code served (permissive licence) · get_code("d1ea6db0edebefb1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import re

def parse_tactic(tactic):
    """Parse tactic string. For example, if the tactic is
        [[ |- ph |- ( ph -> ps ) ]] |- ps {{ ph : ps }} {{ ps : ch }} 
    then 
        premise = '|- ph |- ( ph -> ps )'
        conclusion = '|- ps'
        substitution = '{{ ph : ps }} {{ ps : ch }}'
    """
    tactic_pattern = '\\[\\[ (\\|- ((?! \\]\\]).)*)* \\]\\] (((?! \\{\\{).)*)(.*)'
    tactic = tactic.strip()
    match = re.match(tactic_pattern, tactic)
    if match:
        premises = match.group(1)
        conclusion = match.group(3)
        substitution = match.group(5).strip()
        if premises is None:
            premises = ''
        return (premises, conclusion, substitution)
    else:
        raise ValueError('Syntax error for tactic: {}'.format(tactic))


# Valid tactic string with premises, conclusion, and substitution
tactic_string = "[[ |- ph |- ( ph -> ps ) ]] |- ps {{ ph : ps }} {{ ps : ch }}"

ARGS = {
    "tactic": tactic_string
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
prepare_generated_proof Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/lyra-theorem-prover/run_interact.py
code served (permissive licence) · get_code("0c6d2acafc44ef56")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import json
import tempfile
import shutil

# Create a temporary directory for the test
temp_dir = tempfile.mkdtemp()

# Create the generation_json_dict.json file with sample data
generation_data = {
    "problem_1": [
        {"generation": "This is the first informal proof for problem 1"},
        {"generation": "This is the second informal proof for problem 1"}
    ],
    "problem_2": [
        {"generation": "This is an informal proof for problem 2"}
    ],
    "problem_3": [
        {"generation": "First proof for problem 3"},
        {"generation": "Second proof for problem 3"},
        {"generation": "Third proof for problem 3"}
    ]
}

# Write the JSON file to the temporary directory
gen_dir = os.path.join(temp_dir, "generation_json_dict.json")
with open(gen_dir, 'w') as f:
    json.dump(generation_data, f)

# Define ARGS with the generation path (without the filename, as the function expects)
ARGS = {
    "generation_path": temp_dir
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
recursive_extract Ran
ran; our contract draft was wrong, not the code
chuanyang-zheng/lyra-theorem-prover/src/autoformalization/utils.py
code served (permissive licence) · get_code("39367ca7096740ac")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

ARGS = {
    'input': '```isabelle\nproof code here\n```\nsome text\n```isabelle\nmore proof\n```',
    'find': '```isabelle',
    'array_string': ''
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
parse_tactic_state Not yet run
unverified (harvested, no recorded run)
chuanyang-zheng/lyra-theorem-prover/formal_system_servers/mm_server_backend.py
code served (permissive licence) · get_code("6ef513fef14838a6")
How it ran

no invocation recorded.

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 8 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large Language Models (LLMs) present an intriguing avenue for exploration in the field of formal theorem proving. Nevertheless, their full potential, particularly concerning the mitigation of hallucinations and refinement through prover error messages, remains an area that has yet to be thoroughly investigated. To enhance the effectiveness of LLMs in the field, we introduce the Lyra, a new framework that employs two distinct correction mechanisms: Tool Correction (TC) and Conjecture Correction (CC). To implement Tool Correction in the post-processing of formal proofs, we leverage prior knowledge to utilize predefined prover tools (e.g., Sledgehammer) for guiding the replacement of incorrect tools. Tool Correction significantly contributes to mitigating hallucinations, thereby improving the overall accuracy of the proof. In addition, we introduce Conjecture Correction, an error feedback mechanism designed to interact with prover to refine formal proof conjectures with prover error messages. Compared to the previous refinement framework, the proposed Conjecture Correction refines generation with instruction but does not collect paired (generation, error & refinement) prompts. Our method has achieved state-of-the-art (SOTA) performance on both miniF2F validation (48.0% -> 55.3%) and test (45.5% -> 51.2%). We also present 3 IMO problems solved by Lyra. We believe Tool Correction (post-process for hallucination mitigation) and Conjecture Correction (subgoal adjustment from interaction with environment) could provide a promising avenue for future research in this field.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2309.15806")
get_code_for_paper("2309.15806")
have("2309.15806")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2309.15806.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2309.15806.svg)](https://syntology.ai/paper/2309.15806)

Connect an agent — have() is free.