SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2307.07699 · 2023

Leveraging Large Language Models to Generate Answer Set Programs

arXiv · PDF · Open in the Atlas

Code that ran

2 of 3 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; 2 failures of our instrument; 1 no recorded run), measured 2026-11-22; 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/2307.07699.json · badge: /api/ran/2307.07699.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
azreasoners/gpt-asp-rules canonical (classifier label)
classifier basis: census
2 ran · 1 no recorded run
FunctionStatusWhere it lives
gen_response Ran
ran; our contract draft was wrong, not the code
azreasoners/gpt-asp-rules/jobs_puzzle.py
code served (permissive licence) · get_code("901b6fbeddbcb578")
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 openai
import json
from unittest.mock import Mock, patch, MagicMock
import os
import tempfile

# Create a temporary directory for cache files
temp_dir = tempfile.mkdtemp()
cache_dir = os.path.join(temp_dir, 'caches')
os.makedirs(cache_dir, exist_ok=True)

# Mock the openai module to avoid actual API calls
mock_response_gpt4 = {
    'choices': [
        {
            'message': {
                'content': 'This is a GPT-4 response.'
            }
        }
    ]
}

mock_response_completion = {
    'choices': [
        {
            'text': 'This is a completion response.'
        }
    ]
}

# Create a mock prompt_cache - a dict that stores cached responses
prompt_cache = {
    'What is AI?': mock_response_gpt4,
    'Explain machine learning': mock_response_completion
}

# Set up the arguments
prompt = 'What is AI?'
engine = 'gpt-4'

ARGS = {
    'prompt': prompt,
    'engine': engine,
    'prompt_cache': prompt_cache
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — 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
gen_response Ran
ran; our contract draft was wrong, not the code
azreasoners/gpt-asp-rules/sudoku.py
code served (permissive licence) · get_code("a5a8a2958e9fd501")
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 openai
import json
from unittest.mock import MagicMock, patch

# Mock the openai module to avoid actual API calls
openai.ChatCompletion = MagicMock()
openai.Completion = MagicMock()

# Create a mock response for gpt-4
mock_gpt4_response = {
    'choices': [
        {
            'message': {
                'content': 'This is a mocked GPT-4 response.'
            }
        }
    ]
}

# Create a mock response for other engines
mock_completion_response = {
    'choices': [
        {
            'text': 'This is a mocked completion response.'
        }
    ]
}

# Set up the mock to return these responses
openai.ChatCompletion.create = MagicMock(return_value=mock_gpt4_response)
openai.Completion.create = MagicMock(return_value=mock_completion_response)

# Mock file I/O to prevent actual file writes
import builtins
original_open = builtins.open
def mock_open(*args, **kwargs):
    mock_file = MagicMock()
    mock_file.__enter__ = MagicMock(return_value=mock_file)
    mock_file.__exit__ = MagicMock(return_value=False)
    return mock_file

builtins.open = mock_open

# Define the arguments
ARGS = {
    'prompt': 'What is the solution to this sudoku puzzle?',
    'engine': 'gpt-4',
    'prompt_cache': {}
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — 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
data_gen Not yet run
unverified (harvested, no recorded run)
azreasoners/gpt-asp-rules/dataset150.py
code served (permissive licence) · get_code("d3d8829eeb34c05e")
How it ran

no invocation recorded.

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 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 3 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-22.

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), such as GPT-3 and GPT-4, have demonstrated exceptional performance in various natural language processing tasks and have shown the ability to solve certain reasoning problems. However, their reasoning capabilities are limited and relatively shallow, despite the application of various prompting techniques. In contrast, formal logic is adept at handling complex reasoning, but translating natural language descriptions into formal logic is a challenging task that non-experts struggle with. This paper proposes a neuro-symbolic method that combines the strengths of large language models and answer set programming. Specifically, we employ an LLM to transform natural language descriptions of logic puzzles into answer set programs. We carefully design prompts for an LLM to convert natural language descriptions into answer set programs in a step by step manner. Surprisingly, with just a few in-context learning examples, LLMs can generate reasonably complex answer set programs. The majority of errors made are relatively simple and can be easily corrected by humans, thus enabling LLMs to effectively assist in the creation of answer set programs.

For agents

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

get_harvested_code_for_paper("2307.07699")
get_code_for_paper("2307.07699")
have("2307.07699")

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

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

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

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

Connect an agent — have() is free.