bdd-mathematical-verification

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

BDD Mathematical Verification Skill

BDD数学验证技能

Overview

概述

This skill enables Behavior-Driven Development (BDD) workflows for mathematics, combining:
  1. Gherkin Specifications: Plain-text scenario definitions
  2. RSpec Implementation: Executable Ruby verification code
  3. mathpix-gem Integration: Automatic LaTeX extraction from images
  4. Pattern Matching: Syntax-tree validation for mathematical expressions
  5. Iterative Discovery: Cucumber features guide formula exploration
该技能为数学领域提供**行为驱动开发(BDD)**工作流,结合了以下内容:
  1. Gherkin规格说明:纯文本场景定义
  2. RSpec实现:可执行的Ruby验证代码
  3. mathpix-gem集成:从图片中自动提取LaTeX
  4. 模式匹配:数学表达式的语法树校验
  5. 迭代探索:通过Cucumber特性引导公式探索

Core Components

核心组件

1. Feature Specifications (Gherkin)

1. 特性规格说明(Gherkin)

gherkin
Feature: Mathematical Formula Extraction and Verification

  Scenario: Extract LaTeX from mathematical image
    Given I have a mathematical image file "quadratic.png"
    When I extract LaTeX using Mathpix
    Then I should get a LaTeX formula matching the pattern "ax^2 + bx + c"
    And the formula should be registered as an artifact

  Scenario: Verify quadratic formula in standard form
    Given a quadratic formula "x^2 - 5*x + 6"
    When I verify it is in standard form
    Then the coefficients should be [1, -5, 6]
    And it should be factorable as "(x - 2)(x - 3)"

  Scenario Outline: Verify binomial expansion
    Given a binomial expression "<binomial>"
    When I expand it using binomial theorem
    Then the result should match "<expanded>"
    And all terms should be present with correct signs

    Examples:
      | binomial  | expanded                    |
      | (x + 1)^2 | x^2 + 2*x + 1              |
      | (a - b)^3 | a^3 - 3*a^2*b + 3*a*b^2 - b^3 |
      | (2*x + 3)^2 | 4*x^2 + 12*x + 9         |
gherkin
Feature: Mathematical Formula Extraction and Verification

  Scenario: Extract LaTeX from mathematical image
    Given I have a mathematical image file "quadratic.png"
    When I extract LaTeX using Mathpix
    Then I should get a LaTeX formula matching the pattern "ax^2 + bx + c"
    And the formula should be registered as an artifact

  Scenario: Verify quadratic formula in standard form
    Given a quadratic formula "x^2 - 5*x + 6"
    When I verify it is in standard form
    Then the coefficients should be [1, -5, 6]
    And it should be factorable as "(x - 2)(x - 3)"

  Scenario Outline: Verify binomial expansion
    Given a binomial expression "<binomial>"
    When I expand it using binomial theorem
    Then the result should match "<expanded>"
    And all terms should be present with correct signs

    Examples:
      | binomial  | expanded                    |
      | (x + 1)^2 | x^2 + 2*x + 1              |
      | (a - b)^3 | a^3 - 3*a^2*b + 3*a*b^2 - b^3 |
      | (2*x + 3)^2 | 4*x^2 + 12*x + 9         |

2. RSpec Implementation Blocks

2. RSpec实现代码块

ruby
describe "Mathematical Formula Verification" do

  describe "Formula Extraction" do
    context "with valid mathematical image" do
      it "extracts LaTeX representation" do
        # Extraction step
      end

      it "normalizes notation to standard form" do
        # Normalization step
      end
    end

    context "with multi-page document" do
      it "extracts all formulas in order" do
        # Batch processing
      end
    end
  end

  describe "Formula Verification" do
    context "with polynomial expressions" do
      it "matches pattern against syntax tree" do
        # Pattern matching verification
      end

      it "verifies algebraic equivalence" do
        # Equivalence checking
      end
    end

    context "with nested/complex expressions" do
      it "validates form requirement" do
        # Form verification (expanded/factored/etc)
      end
    end
  end

  describe "Scenario-Driven Discovery" do
    context "with parameterized examples" do
      it "verifies all example variations" do
        # Parameterized testing
      end
    end
  end
end
ruby
describe "Mathematical Formula Verification" do

  describe "Formula Extraction" do
    context "with valid mathematical image" do
      it "extracts LaTeX representation" do
        # Extraction step
      end

      it "normalizes notation to standard form" do
        # Normalization step
      end
    end

    context "with multi-page document" do
      it "extracts all formulas in order" do
        # Batch processing
      end
    end
  end

  describe "Formula Verification" do
    context "with polynomial expressions" do
      it "matches pattern against syntax tree" do
        # Pattern matching verification
      end

      it "verifies algebraic equivalence" do
        # Equivalence checking
      end
    end

    context "with nested/complex expressions" do
      it "validates form requirement" do
        # Form verification (expanded/factored/etc)
      end
    end
  end

  describe "Scenario-Driven Discovery" do
    context "with parameterized examples" do
      it "verifies all example variations" do
        # Parameterized testing
      end
    end
  end
end

3. Pattern Matching on Syntax Trees

3. 语法树模式匹配

ruby
module MathematicalPatternMatching
  # Pattern: ax^n + bx^(n-1) + ... + c (polynomial)
  POLYNOMIAL_PATTERN = /^([^+\-]+)([\+\-][^+\-]+)*$/

  # Pattern: (expression)^exponent
  POWER_PATTERN = /^\(([^)]+)\)\^(\d+)$/

  # Match polynomial coefficients
  # In: "3*x^2 + 2*x + 1"
  # Out: {degree: 2, coefficients: [3, 2, 1], terms: [...]}

  def parse_polynomial(formula_str)
    # Returns AST (Abstract Syntax Tree)
    # Each node: {type: :term, coefficient: n, variable: 'x', exponent: m}
  end

  def verify_form(formula_ast, required_form)
    # required_form: :expanded, :factored, :simplified
    case required_form
    when :expanded
      all_terms_distributed?(formula_ast)
    when :factored
      has_minimal_complexity?(formula_ast)
    when :simplified
      no_like_terms_combinable?(formula_ast)
    end
  end
end
ruby
module MathematicalPatternMatching
  # Pattern: ax^n + bx^(n-1) + ... + c (polynomial)
  POLYNOMIAL_PATTERN = /^([^+\-]+)([\+\-][^+\-]+)*$/

  # Pattern: (expression)^exponent
  POWER_PATTERN = /^\(([^)]+)\)\^(\d+)$/

  # Match polynomial coefficients
  # In: "3*x^2 + 2*x + 1"
  # Out: {degree: 2, coefficients: [3, 2, 1], terms: [...]}

  def parse_polynomial(formula_str)
    # Returns AST (Abstract Syntax Tree)
    # Each node: {type: :term, coefficient: n, variable: 'x', exponent: m}
  end

  def verify_form(formula_ast, required_form)
    # required_form: :expanded, :factored, :simplified
    case required_form
    when :expanded
      all_terms_distributed?(formula_ast)
    when :factored
      has_minimal_complexity?(formula_ast)
    when :simplified
      no_like_terms_combinable?(formula_ast)
    end
  end
end

4. mathpix-gem Integration

4. mathpix-gem集成

ruby
require 'mathpix'

class MathematicalContentExtractor
  def initialize(api_key: ENV['MATHPIX_API_KEY'])
    @client = Mathpix::Client.new(api_key: api_key)
  end

  # Image → LaTeX
  def extract_from_image(image_path)
    result = @client.process_image(
      image_path: image_path,
      output_format: :latex
    )
    {
      latex: result.latex,
      confidence: result.confidence,
      format: :latex
    }
  end

  # Document → Markdown with embedded LaTeX
  def extract_from_document(pdf_path)
    result = @client.process_document(
      document_path: pdf_path,
      output_format: :markdown
    )
    {
      content: result.markdown,
      formulas: extract_formulas(result.markdown),
      format: :markdown
    }
  end

  # Chemistry → SMILES
  def extract_from_chemistry(image_path)
    result = @client.process_image(
      image_path: image_path,
      output_format: :smiles
    )
    {
      smiles: result.smiles,
      format: :smiles
    }
  end

  private

  def extract_formulas(markdown_content)
    # Extract all $...$ and $$...$$ blocks
    formulas = []
    markdown_content.scan(/\$\$?([^\$]+)\$\$?/) do |match|
      formulas << {latex: match[0], inline: match[0].include?('\$')}
    end
    formulas
  end
end
ruby
require 'mathpix'

class MathematicalContentExtractor
  def initialize(api_key: ENV['MATHPIX_API_KEY'])
    @client = Mathpix::Client.new(api_key: api_key)
  end

  # Image → LaTeX
  def extract_from_image(image_path)
    result = @client.process_image(
      image_path: image_path,
      output_format: :latex
    )
    {
      latex: result.latex,
      confidence: result.confidence,
      format: :latex
    }
  end

  # Document → Markdown with embedded LaTeX
  def extract_from_document(pdf_path)
    result = @client.process_document(
      document_path: pdf_path,
      output_format: :markdown
    )
    {
      content: result.markdown,
      formulas: extract_formulas(result.markdown),
      format: :markdown
    }
  end

  # Chemistry → SMILES
  def extract_from_chemistry(image_path)
    result = @client.process_image(
      image_path: image_path,
      output_format: :smiles
    )
    {
      smiles: result.smiles,
      format: :smiles
    }
  end

  private

  def extract_formulas(markdown_content)
    # Extract all $...$ and $$...$$ blocks
    formulas = []
    markdown_content.scan(/\$\$?([^\$]+)\$\$?/) do |match|
      formulas << {latex: match[0], inline: match[0].include?('\$')}
    end
    formulas
  end
end

5. Cucumber Step Definitions

5. Cucumber步骤定义

ruby
undefined
ruby
undefined

features/step_definitions/mathematical_steps.rb

features/step_definitions/mathematical_steps.rb

Given('a mathematical formula {string}') do |formula_str| @formula = formula_str @ast = MathematicalPatternMatching.parse_polynomial(@formula) end
When('I extract LaTeX using Mathpix') do extractor = MathematicalContentExtractor.new @extracted = extractor.extract_from_image(@image_path) end
When('I verify it is in {word} form') do |form| @form = form.to_sym @is_valid_form = MathematicalPatternMatching.verify_form(@ast, @form) end
Then('the coefficients should be {brackets}') do |coefficients_str| coefficients = JSON.parse(coefficients_str.gsub('=>', ':')) extracted_coeffs = @ast[:coefficients] expect(extracted_coeffs).to eq(coefficients) end
Then('it should be factorable as {string}') do |factored_form| factorization = @ast.factorize expect(factorization).to match_polynomial_pattern(factored_form) end
Then('I should get a LaTeX formula matching the pattern {string}') do |pattern| expect(@extracted[:latex]).to match_latex_pattern(pattern) end
undefined
Given('a mathematical formula {string}') do |formula_str| @formula = formula_str @ast = MathematicalPatternMatching.parse_polynomial(@formula) end
When('I extract LaTeX using Mathpix') do extractor = MathematicalContentExtractor.new @extracted = extractor.extract_from_image(@image_path) end
When('I verify it is in {word} form') do |form| @form = form.to_sym @is_valid_form = MathematicalPatternMatching.verify_form(@ast, @form) end
Then('the coefficients should be {brackets}') do |coefficients_str| coefficients = JSON.parse(coefficients_str.gsub('=>', ':')) extracted_coeffs = @ast[:coefficients] expect(extracted_coeffs).to eq(coefficients) end
Then('it should be factorable as {string}') do |factored_form| factorization = @ast.factorize expect(factorization).to match_polynomial_pattern(factored_form) end
Then('I should get a LaTeX formula matching the pattern {string}') do |pattern| expect(@extracted[:latex]).to match_latex_pattern(pattern) end
undefined

6. RSpec Matchers for Mathematics

6. RSpec数学匹配器

ruby
module RSpec
  module Matchers
    # Match LaTeX pattern: "ax^2 + bx + c"
    matcher :match_latex_pattern do |expected_pattern|
      match do |actual|
        # Parse both patterns, compare syntactic structure
        actual_normalized = normalize_latex(actual)
        expected_normalized = normalize_latex(expected_pattern)
        structure_matches?(actual_normalized, expected_normalized)
      end
    end

    # Verify algebraic equivalence
    matcher :be_algebraically_equivalent_to do |expected|
      match do |actual|
        # Simplify both, compare canonical form
        actual_canonical = canonicalize_polynomial(actual)
        expected_canonical = canonicalize_polynomial(expected)
        actual_canonical == expected_canonical
      end
    end

    # Verify formula is in expanded form
    matcher :be_in_expanded_form do
      match do |formula_ast|
        # Check all products are distributed
        has_no_nested_products?(formula_ast) &&
        all_terms_separated?(formula_ast)
      end
    end
  end
end
ruby
module RSpec
  module Matchers
    # Match LaTeX pattern: "ax^2 + bx + c"
    matcher :match_latex_pattern do |expected_pattern|
      match do |actual|
        # Parse both patterns, compare syntactic structure
        actual_normalized = normalize_latex(actual)
        expected_normalized = normalize_latex(expected_pattern)
        structure_matches?(actual_normalized, expected_normalized)
      end
    end

    # Verify algebraic equivalence
    matcher :be_algebraically_equivalent_to do |expected|
      match do |actual|
        # Simplify both, compare canonical form
        actual_canonical = canonicalize_polynomial(actual)
        expected_canonical = canonicalize_polynomial(expected)
        actual_canonical == expected_canonical
      end
    end

    # Verify formula is in expanded form
    matcher :be_in_expanded_form do
      match do |formula_ast|
        # Check all products are distributed
        has_no_nested_products?(formula_ast) &&
        all_terms_separated?(formula_ast)
      end
    end
  end
end

7. Integration with Music-Topos

7. 与Music-Topos集成

ruby
class MathematicalArtifactRegistration
  def initialize(provenance_db: DuckDB.new)
    @db = provenance_db
  end

  def register_verified_formula(formula_ast, extraction_method, scenario_name)
    artifact_id = generate_artifact_id(formula_ast)

    # Register in provenance database
    @db.execute(
      "INSERT INTO artifacts (id, content, type, metadata)
       VALUES (?, ?, 'formula', ?)",
      [
        artifact_id,
        formula_ast.to_json,
        {
          latex: formula_ast.to_latex,
          verified: true,
          verification_scenario: scenario_name,
          extraction_method: extraction_method,
          timestamp: Time.now.iso8601,
          gayseed_color: assign_color(formula_ast)
        }.to_json
      ]
    )

    artifact_id
  end

  private

  def generate_artifact_id(formula_ast)
    content_hash = Digest::SHA256.hexdigest(formula_ast.canonical_form)
    "formula-#{content_hash[0..15]}"
  end

  def assign_color(formula_ast)
    gayseed_index = GaySeed.hash_to_index(formula_ast.canonical_form)
    GaySeed::PALETTE[gayseed_index]
  end
end
ruby
class MathematicalArtifactRegistration
  def initialize(provenance_db: DuckDB.new)
    @db = provenance_db
  end

  def register_verified_formula(formula_ast, extraction_method, scenario_name)
    artifact_id = generate_artifact_id(formula_ast)

    # Register in provenance database
    @db.execute(
      "INSERT INTO artifacts (id, content, type, metadata)
       VALUES (?, ?, 'formula', ?)",
      [
        artifact_id,
        formula_ast.to_json,
        {
          latex: formula_ast.to_latex,
          verified: true,
          verification_scenario: scenario_name,
          extraction_method: extraction_method,
          timestamp: Time.now.iso8601,
          gayseed_color: assign_color(formula_ast)
        }.to_json
      ]
    )

    artifact_id
  end

  private

  def generate_artifact_id(formula_ast)
    content_hash = Digest::SHA256.hexdigest(formula_ast.canonical_form)
    "formula-#{content_hash[0..15]}"
  end

  def assign_color(formula_ast)
    gayseed_index = GaySeed.hash_to_index(formula_ast.canonical_form)
    GaySeed::PALETTE[gayseed_index]
  end
end

Usage Examples

使用示例

Example 1: BDD Workflow - Polynomial Verification

示例1:BDD工作流 - 多项式验证

bash
undefined
bash
undefined

1. Write feature file

1. 编写特性文件

cat > features/polynomial_verification.feature << 'EOF' Feature: Verify polynomial in standard form
Scenario: Extract and verify quadratic Given a mathematical image file "quadratic_equation.png" When I extract LaTeX using Mathpix And I parse the extracted formula Then the formula should match pattern "ax^2 + bx + c" And it should have exactly 3 terms And it should register as verified artifact EOF
cat > features/polynomial_verification.feature << 'EOF' Feature: Verify polynomial in standard form
Scenario: Extract and verify quadratic Given a mathematical image file "quadratic_equation.png" When I extract LaTeX using Mathpix And I parse the extracted formula Then the formula should match pattern "ax^2 + bx + c" And it should have exactly 3 terms And it should register as verified artifact EOF

2. Run Cucumber to generate step definitions

2. 运行Cucumber生成步骤定义

cucumber --dry-run features/polynomial_verification.feature
cucumber --dry-run features/polynomial_verification.feature

3. Implement step definitions in features/step_definitions/

3. 在features/step_definitions/中实现步骤定义

4. Run full BDD verification

4. 运行完整的BDD验证

cucumber features/polynomial_verification.feature
cucumber features/polynomial_verification.feature

5. Verify with RSpec

5. 使用RSpec验证

rspec spec/mathematical_formula_spec.rb
undefined
rspec spec/mathematical_formula_spec.rb
undefined

Example 2: Scenario Outline - Formula Family Testing

示例2:场景大纲 - 公式族测试

gherkin
Feature: Binomial Expansion Verification

  Scenario Outline: Verify binomial theorem for various exponents
    Given a binomial expression "<binomial>"
    When I apply binomial theorem
    Then the expanded form should be "<expanded>"
    And each term should verify against the pattern

    Examples: Basic binomials
      | binomial  | expanded                        |
      | (x + 1)^2 | x^2 + 2*x + 1                  |
      | (x - 1)^2 | x^2 - 2*x + 1                  |
      | (x + 2)^2 | x^2 + 4*x + 4                  |

    Examples: Coefficient variations
      | binomial    | expanded                      |
      | (2*x + 1)^2 | 4*x^2 + 4*x + 1              |
      | (x + 3)^2   | x^2 + 6*x + 9                |
      | (3*x - 2)^2 | 9*x^2 - 12*x + 4             |
gherkin
Feature: Binomial Expansion Verification

  Scenario Outline: Verify binomial theorem for various exponents
    Given a binomial expression "<binomial>"
    When I apply binomial theorem
    Then the expanded form should be "<expanded>"
    And each term should verify against the pattern

    Examples: Basic binomials
      | binomial  | expanded                        |
      | (x + 1)^2 | x^2 + 2*x + 1                  |
      | (x - 1)^2 | x^2 - 2*x + 1                  |
      | (x + 2)^2 | x^2 + 4*x + 4                  |

    Examples: Coefficient variations
      | binomial    | expanded                      |
      | (2*x + 1)^2 | 4*x^2 + 4*x + 1              |
      | (x + 3)^2   | x^2 + 6*x + 9                |
      | (3*x - 2)^2 | 9*x^2 - 12*x + 4             |

Example 3: RSpec + Pattern Matching

示例3:RSpec + 模式匹配

ruby
describe "Mathematical Formula Pattern Matching" do
  let(:extractor) { MathematicalContentExtractor.new }

  describe "Polynomial degree detection" do
    context "with valid polynomial" do
      it "identifies degree from syntax tree" do
        formula = "3*x^4 + 2*x^2 + 1"
        ast = MathematicalPatternMatching.parse_polynomial(formula)
        expect(ast.degree).to eq(4)
      end
    end
  end

  describe "Algebraic equivalence" do
    it "verifies (x+1)^2 ≡ x^2 + 2x + 1" do
      f1 = "(x + 1)^2"
      f2 = "x^2 + 2*x + 1"
      expect(f1).to be_algebraically_equivalent_to(f2)
    end
  end

  describe "Form verification" do
    it "validates formula is in expanded form" do
      formula_ast = parse_as_ast("x^2 + 2*x + 1")
      expect(formula_ast).to be_in_expanded_form
    end

    it "rejects non-expanded formulas" do
      formula_ast = parse_as_ast("(x + 1)^2")
      expect(formula_ast).not_to be_in_expanded_form
    end
  end
end
ruby
describe "Mathematical Formula Pattern Matching" do
  let(:extractor) { MathematicalContentExtractor.new }

  describe "Polynomial degree detection" do
    context "with valid polynomial" do
      it "identifies degree from syntax tree" do
        formula = "3*x^4 + 2*x^2 + 1"
        ast = MathematicalPatternMatching.parse_polynomial(formula)
        expect(ast.degree).to eq(4)
      end
    end
  end

  describe "Algebraic equivalence" do
    it "verifies (x+1)^2 ≡ x^2 + 2x + 1" do
      f1 = "(x + 1)^2"
      f2 = "x^2 + 2*x + 1"
      expect(f1).to be_algebraically_equivalent_to(f2)
    end
  end

  describe "Form verification" do
    it "validates formula is in expanded form" do
      formula_ast = parse_as_ast("x^2 + 2*x + 1")
      expect(formula_ast).to be_in_expanded_form
    end

    it "rejects non-expanded formulas" do
      formula_ast = parse_as_ast("(x + 1)^2")
      expect(formula_ast).not_to be_in_expanded_form
    end
  end
end

Iterative Discovery Process

迭代探索流程

Phase 1: Feature Definition

阶段1:特性定义

  • Write Gherkin scenarios describing mathematical behavior
  • Parameterize examples for formula families
  • Use natural language for accessibility
  • 编写描述数学行为的Gherkin场景
  • 为公式族参数化示例
  • 使用自然语言提升可访问性

Phase 2: Step Implementation

阶段2:步骤实现

  • Implement each Given/When/Then step
  • Create RSpec matchers for assertions
  • Define pattern matching rules
  • 实现每个Given/When/Then步骤
  • 创建用于断言的RSpec匹配器
  • 定义模式匹配规则

Phase 3: mathpix-gem Integration

阶段3:mathpix-gem集成

  • Extract real content from images/documents
  • Normalize extracted LaTeX to standard forms
  • Create parsing pipeline
  • 从图片/文档中提取真实内容
  • 将提取的LaTeX规范化为标准格式
  • 创建解析流水线

Phase 4: Verification

阶段4:验证

  • Run Cucumber features to validate specifications
  • Run RSpec for detailed unit verification
  • Register verified formulas as artifacts
  • 运行Cucumber特性以验证规格说明
  • 运行RSpec进行详细的单元验证
  • 将验证通过的公式注册为工件

Phase 5: Artifact Integration

阶段5:工件集成

  • Store formulas in DuckDB provenance database
  • Assign deterministic GaySeed colors
  • Create retromap entries for temporal tracking
  • 将公式存储在DuckDB溯源数据库中
  • 确定性分配GaySeed颜色
  • 创建retromap条目用于时间跟踪

Testing the Skill

测试该技能

bash
undefined
bash
undefined

Run all BDD tests

运行所有BDD测试

cucumber features/
cucumber features/

Run RSpec tests

运行RSpec测试

rspec spec/
rspec spec/

Run with coverage

带覆盖率运行

rspec --format documentation --require spec_helper spec/
rspec --format documentation --require spec_helper spec/

Run specific feature

运行特定特性

cucumber features/polynomial_verification.feature -t @focus
cucumber features/polynomial_verification.feature -t @focus

Integration test with Music-Topos

与Music-Topos的集成测试

rspec spec/music_topos_integration_spec.rb
undefined
rspec spec/music_topos_integration_spec.rb
undefined

Configuration

配置

ruby
undefined
ruby
undefined

config/bdd_mathematical_verification.rb

config/bdd_mathematical_verification.rb

BddMathematicalVerification.configure do |config|

Mathpix API configuration

config.mathpix_api_key = ENV['MATHPIX_API_KEY'] config.mathpix_timeout = 30 config.mathpix_batch_size = 10

Pattern matching configuration

config.polynomial_degree_limit = 10 config.expression_complexity_limit = 50

Verification configuration

config.enable_symbolic_simplification = true config.algebraic_equivalence_method = :canonical_form

Artifact registration

config.register_to_provenance = true config.provenance_database = DuckDB.new('data/provenance/provenance.duckdb') end
undefined
BddMathematicalVerification.configure do |config|

Mathpix API配置

config.mathpix_api_key = ENV['MATHPIX_API_KEY'] config.mathpix_timeout = 30 config.mathpix_batch_size = 10

模式匹配配置

config.polynomial_degree_limit = 10 config.expression_complexity_limit = 50

验证配置

config.enable_symbolic_simplification = true config.algebraic_equivalence_method = :canonical_form

工件注册

config.register_to_provenance = true config.provenance_database = DuckDB.new('data/provenance/provenance.duckdb') end
undefined

Dependencies

依赖

  • rspec (3.12+): Executable specification framework
  • cucumber (8.0+): Gherkin scenario runner
  • mathpix (0.1.2+): LaTeX extraction from images
  • parslet (2.0+): Parser combinator for syntax trees
  • mathn (0.1.0+): Mathematical operations in pure Ruby
  • rspec (3.12+):可执行规格说明框架
  • cucumber (8.0+):Gherkin场景运行器
  • mathpix (0.1.2+):从图片中提取LaTeX
  • parslet (2.0+):用于语法树的解析器组合子
  • mathn (0.1.0+):纯Ruby实现的数学运算

Integration Points

集成点

With Music-Topos

与Music-Topos集成

  • Register verified formulas as artifacts
  • Assign GaySeed colors deterministically
  • Create provenance records with timestamps
  • Enable formula search via DuckDB retromap
  • 将验证通过的公式注册为工件
  • 确定性分配GaySeed颜色
  • 创建带时间戳的溯源记录
  • 通过DuckDB retromap实现公式搜索

With Glass-Bead-Game Skill

与Glass-Bead-Game技能集成

  • Create Badiou triangles from formula domains
  • Link mathematical concepts to philosophical structures
  • Generate synthesis insights through formula relationships
  • 从公式领域创建Badiou三角形
  • 将数学概念与哲学结构关联
  • 通过公式关系生成综合洞察

With Bisimulation-Game Skill

与Bisimulation-Game技能集成

  • Verify observational equivalence of formulas
  • Test semantic preservation through transformations
  • Validate GF(3) conservation in algebraic operations
  • 验证公式的观测等价性
  • 测试转换过程中的语义保留
  • 验证代数运算中的GF(3)守恒

Future Enhancements

未来增强

  1. Interactive Mode: Real-time formula input and verification
  2. Proof Generation: Automatic proof verification for theorems
  3. LaTeX Optimization: Convert extracted LaTeX to canonical forms
  4. Machine Learning: Learn formula patterns from verified examples
  5. Symbolic Computation: Integration with SymPy or Sage
  6. Distributed Testing: Parallel scenario execution across agents
  1. 交互模式:实时公式输入与验证
  2. 证明生成:自动验证定理证明
  3. LaTeX优化:将提取的LaTeX转换为规范格式
  4. 机器学习:从验证示例中学习公式模式
  5. 符号计算:与SymPy或Sage集成
  6. 分布式测试:跨Agent并行执行场景

References

参考资料


Status: ✓ Ready for iterative BDD-driven mathematical discovery Last Updated: December 21, 2025

状态:✓ 可用于迭代式BDD驱动的数学探索 最后更新:2025年12月21日