Skip to content

Add property tests for moral algebra operations #3

@Tristan-Stoltz-ERC

Description

@Tristan-Stoltz-ERC

Summary

The moral algebra system (symthaea-core/src/hdc/moral_algebra.rs) currently has unit tests but could benefit from proptest-based property testing to verify mathematical invariants.

Properties to verify

  • Commutativity of moral composition — does order of stakeholder consideration matter?
  • Associativity — grouping of moral factors should not change outcome
  • Monotonicity of moral distance — adding harm should never decrease moral distance
  • Boundary behavior — extreme values (0.0, 1.0) should produce well-defined results
  • Idempotency — applying the same moral consideration twice should be stable
  • Triangle inequality — moral distance should satisfy metric properties

Existing patterns

See tests/proptest_feedback_stability.rs and tests/proptest_cantor.rs for proptest patterns already used in the codebase.

Getting started

  1. Add proptest = "1" to dev-dependencies (already in workspace)
  2. Create tests/proptest_moral_algebra.rs
  3. Use proptest! macro with custom strategies for moral values
  4. Current moral algebra score: 91.1% overall — tests should protect this

Moral algebra primer

The system encodes ethical principles as hypervectors and computes moral distances, compositions, and judgments using HDC operations. The key types are in moral_algebra.rs, moral_prototypes.rs, and moral_parser.rs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions