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

Runtime irrelevance #2486

Open
kurnevsky opened this issue Sep 26, 2024 · 7 comments
Open

Runtime irrelevance #2486

kurnevsky opened this issue Sep 26, 2024 · 7 comments

Comments

@kurnevsky
Copy link

kurnevsky commented Sep 26, 2024

Hi. I'm trying to use erased annotations but as I can see agda stdlib doesn't really support them. What I stumbled upon so far:

  • ⊥-elim can't take an erased argument which is often needed when all proofs are erased.
  • Idris defines Σ variants with erased first and second values called Exists and Subset which are also quite convenient to erase proofs.

Here is an example.

Should maybe agda stdlib have something similar? That would require agda stdlib to have --erasure option enabled which requires all dependent modules to have it.

@jamesmckinna
Copy link
Contributor

See #2346 for an earlier version of a similar line of thought... I'd be broadly in favour, but for the complicated balance of forces/compatibility issues (esp. wrt infective options) involved in what constitutes a 'standard' library.

@gallais
Copy link
Member

gallais commented Sep 30, 2024

Note that you can implement

recover : @0 ⊥ → ⊥
recover ()

so you can plug your contradiction into a call to ⊥-elim.

@jamesmckinna
Copy link
Contributor

jamesmckinna commented Sep 30, 2024

Cf. Relation.Nullary.Recomputable.⊥-recompute... ob @gallais 's observation, while your other examples from Idris seem to be related to the other combinators defined there...?

@kurnevsky
Copy link
Author

while your other examples from Idris seem to be related to the other combinators defined there...?

Is it a question to me? :)
I meant that it's sometimes useful to have dependent sum types with erased first/second values, and Idris has them. For instance, using my own definition of such type gave me almost 2x speed up in runtime for my code :)

@jamesmckinna
Copy link
Contributor

See also: Data.Refinement for a version of "dependent sum types with erased second values" at least.
Agree that erased first projections are independently interesting, though...

@gallais
Copy link
Member

gallais commented Oct 3, 2024

There's also the issue of Irrelevant vs. @0 annotation. I don't think we have anything @0-related in the lib at the minute.

@jamesmckinna
Copy link
Contributor

There's also the issue of Irrelevant vs. @0 annotation. I don't think we have anything @0-related in the lib at the minute.

Absolutely! I raised this explicitly as a point for us to discuss after the merge of experimental following the v2.7.0 release...

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

No branches or pull requests

3 participants