Skip to content

Proposal: indexed infinity for division by zero (RICIS-III ontology) #236

Description

@A1Dmitry

Current behavior

In Pony, integer division by zero returns 0:

let x = I64(1) / I64(0) // x = 0

This is pragmatic but loses provenance: 1/0 and 2/0 both return 0.

Proposal: indexed infinity (RICIS-III ontology)

RICIS-III (DOI: 10.5281/zenodo.17872755) defines F/0 = ∞_F — an indexed infinity that preserves the numerator as provenance.

Expression Current Pony Proposed
1/0 0 ∞_1
2/0 0 ∞_2
0/0 0 resolved via A4
∞_1/∞_2 NaN 1/2

This could be a fourth division mode (/? preserves the indexed structure) or a compile-time option.

Why

  • Preserves information that Pony currently discards
  • Allows structural cancellation: 0_F/0_G = F/G
  • Prevents NaN cascade from inf/inf
  • Already implemented in C# (Expression Trees): [link to your repo]

Questions for maintainers

  1. Would a fourth division mode (/?i for indexed) be acceptable?
  2. Could this be a compiler flag?
  3. Interested in a proof-of-concept PR?

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    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