Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add powers and convert to Minion #589

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Add powers and convert to Minion #589

wants to merge 5 commits into from

Conversation

niklasdewally
Copy link
Collaborator

@niklasdewally niklasdewally commented Jan 14, 2025

Implement powers x**y.

  • Add the UnsafePow, SafePow, and FlatPowEq expressions
  • JSON Parsing of x**y into UnsafePow.
  • Defindness semantics / bubble rules.
  • Add partial / total evaluation.
  • Flatten SafePow expressions.
  • Add Minion introduction rule for FlatPow.
  • Add solver adaptor support.

UNDEFINEDNESS SEMANTICS

x**y=z is defined when:

(x!=0 \/ y!=0) /\ y>=0

[Savile Row Manual]

This commit adds a UnsafePow and SafePow expression, representing
the power operation before and after it has been made safe.

Similarly to division, safety is achieved by converting UnsafePow to
SafePow and bubbling up the definedness condition (x!=0 \/ y!=0) /\ y>=0).

Implement powers `x**y`.

* Add the `UnsafePow`, `SafePow`, and `FlatPow` expressions
* JSON Parsing of `x**y` into `UnsafePow`.
* Defindness semantics / bubble rules.
* Add partial / total evaluation.
* Flatten `SafePow` expressions.
* Add Minion introduction rule for `FlatPow`.
* Add solver adaptor support.

UNDEFINEDNESS SEMANTICS

`x**y=z` is defined when:

```
(x!=0 \/ y!=0) /\ y>=0
```

[Savile Row Manual]

This commit adds a `UnsafePow` and `SafePow` expression, representing
the power operation before and after it has been made safe.

Similarly to division, safety is achieved by converting `UnsafePow` to
`SafePow`, and bubbling up the definedness condition `(x!=0 \/ y!=0) /\
y>=0)`.
@niklasdewally
Copy link
Collaborator Author

niklasdewally commented Jan 14, 2025

Ready to review; just need to double check and document Minion's pow semantics before merging (minion/minion#40)

Add powers and convert to Minion

Implement powers `x**y`.

* Add the `UnsafePow`, `SafePow`, and `FlatPowEq` expressions
* JSON Parsing of `x**y` into `UnsafePow`.
* Defindness semantics / bubble rules.
* Add partial / total evaluation.
* Flatten `SafePow` expressions.
* Add Minion introduction rule for `FlatPowEq`.
* Add solver adaptor support.

UNDEFINEDNESS SEMANTICS

`x**y=z` is defined when:

```
(x!=0 \/ y!=0) /\ y>=0
```

[Savile Row Manual]

This commit adds a `UnsafePow` and `SafePow` expression, representing
the power operation before and after it has been made safe.

Similarly to division, safety is achieved by converting `UnsafePow` to
`SafePow`, and bubbling up the definedness condition `(x!=0 \/ y!=0) /\
y>=0)`.
Copy link
Contributor

@ozgurakgun ozgurakgun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once you clarify the minion semantics question and deal with the commented out code comment.

crates/conjure_core/src/rules/minion.rs Outdated Show resolved Hide resolved
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.

2 participants