Skip to content

fix: Implement recursive expansion for axioms A5 and A6#54

Merged
netkeep80 merged 3 commits intonetkeep80:mainfrom
konard:issue-53-02e3c5d827cf
Feb 13, 2026
Merged

fix: Implement recursive expansion for axioms A5 and A6#54
netkeep80 merged 3 commits intonetkeep80:mainfrom
konard:issue-53-02e3c5d827cf

Conversation

@konard
Copy link
Contributor

@konard konard commented Feb 13, 2026

🎯 Summary

This PR implements recursive expansion for Male (♂x) and Female (x♀) expressions, fixing the issue where ♂v = ♂v -> v -> v -> v was incorrectly marked as unprovable.

📋 Issue Reference

Fixes #53

🔍 Problem

The formula ♂v = ♂v -> v -> v -> v was being marked as failed (✗), but it should be provable through recursive expansion of axiom A5, similar to how axiom A4 handles recursive collapsing for infinity expressions.

According to axiom A5: ♂x = ♂x -> x

The recursive expansion works as follows:

  1. ♂v = (♂v -> v) by A5
  2. Substituting ♂v: ♂v = ((♂v -> v) -> v)
  3. Substituting again: ♂v = (((♂v -> v) -> v) -> v)
  4. And so on recursively...

🛠️ Solution

Implementation Details

  1. Added expandMale() function - Recursively expands Male expressions using axiom A5: ♂x = (♂x -> x)

    • Collapses patterns like (♂x -> x), ((♂x -> x) -> x), etc. back to ♂x
    • Similar to how collapseInfinity() works for A4
  2. Added expandFemale() function - Recursively expands Female expressions using axiom A6: x♀ = (x -> x♀)

    • Collapses patterns like (x -> x♀), (x -> (x -> x♀)), etc. back to x♀
    • Works on the right side of the link (complementary to Male expansion)
  3. Integrated into checkEquality() - Added recursive expansion checks after simple axiom applications and before infinity collapse

    • Verifies both directions of the equality
    • Provides detailed proof steps explaining the recursive expansion

Test Coverage

Added comprehensive test suites for both axioms:

Male expansion (A5):

  • ♂v = ♂v -> v -> v -> v (left-associative, 3-level)
  • ♂v = (♂v -> v) -> v (2-level)
  • ♂v = ((♂v -> v) -> v) -> v (3-level explicit)
  • ✓ Reverse direction tests
  • ✓ Regression test for simple case

Female expansion (A6):

  • r♀ = r -> (r -> r♀) (right-associative, 2-level)
  • r♀ = r -> (r -> (r -> r♀)) (3-level)
  • ✓ Reverse direction tests
  • ✓ Regression test for simple case

✅ Testing

  • All 253 tests pass locally
  • CI checks passed ✅
  • No existing functionality was broken
  • Added 13 new test cases for recursive expansion

📊 Test Results

Test Files  7 passed (7)
     Tests  253 passed | 3 skipped (256)
  Duration  1.21s

🎨 Example Output

Before this fix, the formula would fail:

✗ (♂v = (((♂v -> v) -> v) -> v))
  // Невозможно доказать равенство

After this fix:

✓ (♂v = (((♂v -> v) -> v) -> v))
  // Применена аксиома А5: ♂x = (♂x → x) с рекурсивным свёртыванием
  // Аксиомы: A5

🔗 Related Work

This implementation follows the same pattern as the recursive collapse for infinity (issue #51), ensuring consistency across axiom handling.


Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

konard and others added 2 commits February 13, 2026 23:37
Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: netkeep80#53
This commit implements recursive expansion for Male (♂x) and Female (x♀)
expressions, similar to the recursive collapse implemented for Infinity (∞)
in issue netkeep80#51.

Changes:
- Added expandMale() function to recursively expand Male expressions
  using axiom A5: ♂x = (♂x -> x)
- Added expandFemale() function to recursively expand Female expressions
  using axiom A6: x♀ = (x -> x♀)
- Integrated these functions into checkEquality() to verify recursive
  expansions like:
  - ♂v = ♂v -> v -> v -> v (left-associative)
  - r♀ = r -> (r -> (r -> r♀)) (right-associative)
- Added comprehensive test cases for both Male and Female recursive
  expansions

The implementation follows the same pattern as collapseInfinity():
1. ♂v = (♂v -> v) by A5
2. Substituting ♂v: ♂v = ((♂v -> v) -> v)
3. Therefore: ♂v = (((♂v -> v) -> v) -> v)
4. And so on recursively...

Fixes netkeep80#53

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@konard konard changed the title [WIP] Ошибка в формуле ♂v = ♂v -> v -> v -> v. fix: Implement recursive expansion for axioms A5 and A6 Feb 13, 2026
@konard konard marked this pull request as ready for review February 13, 2026 22:44
@konard
Copy link
Contributor Author

konard commented Feb 13, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $1.798951
  • Calculated by Anthropic: $2.209530 USD
  • Difference: $0.410579 (+22.82%)
    📎 Log file uploaded as Gist (587KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@netkeep80 netkeep80 merged commit b277619 into netkeep80:main Feb 13, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ошибка в формуле ♂v = ♂v -> v -> v -> v.

2 participants