Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Extend Refinement Types to Support Real-Number Constraints #1457

Copy link
Copy link
@uyweywe

Description

@uyweywe
Issue body actions

Description:
Typed Racket's refinement types (Refine) are currently limited to linear integer constraints (e.g., <=, and, or on integer linear combinations). This restriction prevents expressing essential real-number constraints, such as non-zero denominators or real-valued ranges, hindering type safety in numerical computations.

Example Failure:

(define-type NonzeroReal (Refine [r : Real] (not (= r 0))))  ; ❌ Type checker error
(: safe-div (-> Real NonzeroReal Real))
(define (safe-div x y)
  (/ x y))

Proposal:
Extend the Refine type to support real-number equality and inequality constraints (e.g., (not (= r 0)), (< a b), (<= c 1.0)). This enhancement would:

  1. Enable type-safe checks for non-zero reals and bounded ranges.
  2. Enhance expressiveness for real-valued domains while preserving type safety.

Requested Features:

  • Support for real-number predicates in Refine, including equality (=), inequality (<, >, <=, >=), and logical combinations (and, or, not).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.