diff --git a/README.md b/README.md index be26fae..8718a37 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The system consists of the following modules, implemented symmetrically in `ddss - **Output** (`ddss/output.py`, `ddss/output.ts`): Real-time display of facts and ideas from the database - **Load** (`ddss/load.py`, `ddss/load.ts`): Batch import of facts from standard input - **Dump** (`ddss/dump.py`, `ddss/dump.ts`): Export all facts and ideas to output -- **DS** (`ddss/ds.py`, `ddss/ds.ts`): Forward-chaining deductive search engine +- **Search** (`ddss/search.py`, `ddss/search.ts`): Forward-chaining deductive search engine - **Egg** (`ddss/egg.py`, `ddss/egg.ts`): E-graph based equality reasoning engine ## Installation @@ -89,14 +89,14 @@ ddss --addr postgresql://user:password@host:port/database ### Selecting Components -By default, DDSS runs with all interactive components (`input`, `output`, `ds`, `egg`). You can select specific components using the `-c` or `--component` option: +By default, DDSS runs with all interactive components (`input`, `output`, `search`, `egg`). You can select specific components using the `-c` or `--component` option: ```bash # Run only input and output (no inference engines) ddss --component input output # Run with only the forward-chaining engine -ddss --component input output ds +ddss --component input output search # Run with only the E-graph engine ddss --component input output egg @@ -105,7 +105,7 @@ ddss --component input output egg Available components: - `input`: Interactive input interface - `output`: Real-time display of facts and ideas -- `ds`: Forward-chaining deductive search engine +- `search`: Forward-chaining deductive search engine - `egg`: E-graph based equality reasoning engine - `load`: Batch import facts from standard input - `dump`: Export all facts and ideas to output diff --git a/ddss/main.py b/ddss/main.py index 23fd82b..21c6b70 100644 --- a/ddss/main.py +++ b/ddss/main.py @@ -4,7 +4,7 @@ from typing import Annotated, Optional import tyro from .orm import initialize_database -from .ds import main as ds +from .search import main as search from .egg import main as egg from .input import main as input from .output import main as output @@ -12,7 +12,7 @@ from .dump import main as dump component_map = { - "ds": ds, + "search": search, "egg": egg, "input": input, "output": output, @@ -63,7 +63,7 @@ def main( aliases=["-c"], help="Components to run.", ), - ] = ["input", "output", "ds", "egg"], + ] = ["input", "output", "search", "egg"], ) -> None: """DDSS - Distributed Deductive System Sorts: Run DDSS with an interactive deductive environment.""" if addr is None: diff --git a/ddss/main.ts b/ddss/main.ts index 08f0876..e34c19d 100644 --- a/ddss/main.ts +++ b/ddss/main.ts @@ -3,7 +3,7 @@ import * as os from "node:os"; import * as path from "node:path"; import { Command } from "commander"; import type { Sequelize } from "sequelize"; -import { main as ds } from "./ds.ts"; +import { main as search } from "./search.ts"; import { main as dump } from "./dump.ts"; import { main as egg } from "./egg.ts"; import { main as input } from "./input.ts"; @@ -14,7 +14,7 @@ import { initializeDatabase } from "./orm.ts"; type ComponentMain = (addr: string, sequelize: Sequelize) => Promise; const componentMap: Record = { - ds, + search, egg, input, output, @@ -49,7 +49,7 @@ export function cli() { .name("ddss") .description("DDSS - Distributed Deductive System Sorts: Run DDSS with an interactive deductive environment.") .option("-a, --addr ", "Database address URL. If not provided, uses a temporary SQLite database.") - .option("-c, --component ", "Components to run.", ["input", "output", "ds", "egg"]) + .option("-c, --component ", "Components to run.", ["input", "output", "search", "egg"]) .action(async (options) => { let addr = options.addr; let tmpDir: string | undefined; diff --git a/ddss/ds.py b/ddss/search.py similarity index 100% rename from ddss/ds.py rename to ddss/search.py diff --git a/ddss/ds.ts b/ddss/search.ts similarity index 100% rename from ddss/ds.ts rename to ddss/search.ts diff --git a/docs/en/modules.md b/docs/en/modules.md index 446b2f4..584e25c 100644 --- a/docs/en/modules.md +++ b/docs/en/modules.md @@ -6,5 +6,5 @@ The system consists of the following modules, implemented symmetrically in `ddss - **Output** (`ddss/output.py`, `ddss/output.ts`): Real-time display of facts and ideas from the database - **Load** (`ddss/load.py`, `ddss/load.ts`): Batch import of facts from standard input - **Dump** (`ddss/dump.py`, `ddss/dump.ts`): Export all facts and ideas to output -- **DS** (`ddss/ds.py`, `ddss/ds.ts`): Forward-chaining deductive search engine +- **Search** (`ddss/search.py`, `ddss/search.ts`): Forward-chaining deductive search engine - **Egg** (`ddss/egg.py`, `ddss/egg.ts`): E-graph based equality reasoning engine diff --git a/docs/en/usage.md b/docs/en/usage.md index cc774a0..555a784 100644 --- a/docs/en/usage.md +++ b/docs/en/usage.md @@ -30,14 +30,14 @@ ddss --addr postgresql://user:password@host:port/database ## Selecting Components -By default, DDSS runs with all interactive components (`input`, `output`, `ds`, `egg`). You can select specific components using the `-c` or `--component` option: +By default, DDSS runs with all interactive components (`input`, `output`, `search`, `egg`). You can select specific components using the `-c` or `--component` option: ```bash # Run only input and output (no inference engines) ddss --component input output # Run with only the forward-chaining engine -ddss --component input output ds +ddss --component input output search # Run with only the E-graph engine ddss --component input output egg @@ -46,7 +46,7 @@ ddss --component input output egg Available components: - `input`: Interactive input interface - `output`: Real-time display of facts and ideas -- `ds`: Forward-chaining deductive search engine +- `search`: Forward-chaining deductive search engine - `egg`: E-graph based equality reasoning engine - `load`: Batch import facts from standard input - `dump`: Export all facts and ideas to output diff --git a/docs/zh/modules.md b/docs/zh/modules.md index 46604b0..32cfcef 100644 --- a/docs/zh/modules.md +++ b/docs/zh/modules.md @@ -6,5 +6,5 @@ - **Output** (`ddss/output.py`, `ddss/output.ts`):实时显示数据库中的事实和想法。 - **Load** (`ddss/load.py`, `ddss/load.ts`):从标准输入批量导入事实。 - **Dump** (`ddss/dump.py`, `ddss/dump.ts`):将所有事实和想法导出到输出。 -- **DS** (`ddss/ds.py`, `ddss/ds.ts`):前向链接演绎搜索引擎。 +- **Search** (`ddss/search.py`, `ddss/search.ts`):前向链接演绎搜索引擎。 - **Egg** (`ddss/egg.py`, `ddss/egg.ts`):基于 E-graph 的等式推理引擎。 diff --git a/docs/zh/usage.md b/docs/zh/usage.md index d57458a..862f32a 100644 --- a/docs/zh/usage.md +++ b/docs/zh/usage.md @@ -30,14 +30,14 @@ ddss --addr postgresql://user:password@host:port/database ## 选择组件 -默认情况下,DDSS 运行所有交互式组件(`input`, `output`, `ds`, `egg`)。您可以使用 `-c` 或 `--component` 选项选择特定组件: +默认情况下,DDSS 运行所有交互式组件(`input`, `output`, `search`, `egg`)。您可以使用 `-c` 或 `--component` 选项选择特定组件: ```bash # 仅运行输入和输出(无推理引擎) ddss --component input output # 仅运行前向链接引擎 -ddss --component input output ds +ddss --component input output search # 仅运行 E-graph 引擎 ddss --component input output egg @@ -46,7 +46,7 @@ ddss --component input output egg 可用组件: - `input`: 交互式输入接口 - `output`: 实时显示事实和想法 -- `ds`: 前向链接演绎搜索引擎 +- `search`: 前向链接演绎搜索引擎 - `egg`: 基于 E-graph 的等式推理引擎 - `load`: 批量导入事实 - `dump`: 导出所有事实和想法 diff --git a/tests/test_ds.py b/tests/test_search.py similarity index 92% rename from tests/test_ds.py rename to tests/test_search.py index baa864b..48d1583 100644 --- a/tests/test_ds.py +++ b/tests/test_search.py @@ -5,7 +5,7 @@ import pytest_asyncio from sqlalchemy import select from ddss.orm import initialize_database, Facts, Ideas -from ddss.ds import main +from ddss.search import main @pytest_asyncio.fixture @@ -20,7 +20,7 @@ async def temp_db(): @pytest.mark.asyncio -async def test_ds_simple_modus_ponens(temp_db): +async def test_search_simple_modus_ponens(temp_db): """Test simple modus ponens: 'a => b' with '=> a' produces '=> b'.""" addr, engine, session = temp_db @@ -48,7 +48,7 @@ async def test_ds_simple_modus_ponens(temp_db): @pytest.mark.asyncio -async def test_ds_multi_premise_with_idea(temp_db): +async def test_search_multi_premise_with_idea(temp_db): """Test multi-premise rule: 'a, b => c' with '=> a' produces 'b => c' and idea '=> b'.""" addr, engine, session = temp_db @@ -83,7 +83,7 @@ async def test_ds_multi_premise_with_idea(temp_db): @pytest.mark.asyncio -async def test_ds_no_inference_without_matching_facts(temp_db): +async def test_search_no_inference_without_matching_facts(temp_db): """Test that no inference occurs when facts don't match.""" addr, engine, session = temp_db @@ -114,7 +114,7 @@ async def test_ds_no_inference_without_matching_facts(temp_db): @pytest.mark.asyncio -async def test_ds_multiple_inferences(temp_db): +async def test_search_multiple_inferences(temp_db): """Test multiple inference steps in sequence.""" addr, engine, session = temp_db @@ -144,8 +144,8 @@ async def test_ds_multiple_inferences(temp_db): @pytest.mark.asyncio -async def test_ds_cancellation(temp_db): - """Test that the ds main function can be cancelled without hanging.""" +async def test_search_cancellation(temp_db): + """Test that the search main function can be cancelled without hanging.""" addr, engine, session = temp_db # Run the main function and cancel it @@ -161,7 +161,7 @@ async def test_ds_cancellation(temp_db): @pytest.mark.asyncio -async def test_ds_duplicate_facts_not_added(temp_db): +async def test_search_duplicate_facts_not_added(temp_db): """Test that duplicate facts are not added to the database.""" addr, engine, session = temp_db diff --git a/tests/test_ds.ts b/tests/test_search.ts similarity index 91% rename from tests/test_ds.ts rename to tests/test_search.ts index 785ad74..75e2bc2 100644 --- a/tests/test_ds.ts +++ b/tests/test_search.ts @@ -1,9 +1,9 @@ import { jest, describe, it, expect, beforeEach, afterEach } from "@jest/globals"; -import { main } from "../ddss/ds.ts"; +import { main } from "../ddss/search.ts"; import { Fact, Idea } from "../ddss/orm.ts"; import { createTempDb } from "./utils.ts"; -describe("ds", () => { +describe("search", () => { let sequelize: any; let cleanup: any; let addr: string; @@ -52,7 +52,7 @@ describe("ds", () => { } }; - it("test_ds_simple_modus_ponens", async () => { + it("test_search_simple_modus_ponens", async () => { // Add initial facts: a => b and => a await Fact.bulkCreate([{ data: "a\n----\nb\n" }, { data: "----\na\n" }]); @@ -63,7 +63,7 @@ describe("ds", () => { expect(factsData).toContain("----\nb\n"); }); - it("test_ds_multi_premise_with_idea", async () => { + it("test_search_multi_premise_with_idea", async () => { // Add initial facts: a, b => c and => a await Fact.bulkCreate([{ data: "a\nb\n----\nc\n" }, { data: "----\na\n" }]); @@ -78,7 +78,7 @@ describe("ds", () => { expect(ideasData).toContain("----\nb\n"); }); - it("test_ds_no_inference_without_matching_facts", async () => { + it("test_search_no_inference_without_matching_facts", async () => { // Add facts that don't match: a => b and => c await Fact.bulkCreate([{ data: "a\n----\nb\n" }, { data: "----\nc\n" }]); @@ -92,7 +92,7 @@ describe("ds", () => { expect(factsData).toContain("----\nc\n"); }); - it("test_ds_multiple_inferences", async () => { + it("test_search_multiple_inferences", async () => { // Add facts for chained inference: a => b, b => c, => a await Fact.bulkCreate([{ data: "a\n----\nb\n" }, { data: "b\n----\nc\n" }, { data: "----\na\n" }]); @@ -105,7 +105,7 @@ describe("ds", () => { expect(factsData).toContain("----\nc\n"); }); - it("test_ds_duplicate_facts_not_added", async () => { + it("test_search_duplicate_facts_not_added", async () => { // Add facts that will produce a duplicate: a => b twice with => a // "a\n----\nc\n" and "b\n----\nc\n" (Wait, python test says a=>b twice? // No, Python test says: