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

derive eqbOK does not work with is_true #780

Closed
eponier opened this issue Feb 21, 2025 · 3 comments · Fixed by #784
Closed

derive eqbOK does not work with is_true #780

eponier opened this issue Feb 21, 2025 · 3 comments · Fixed by #784

Comments

@eponier
Copy link
Collaborator

eponier commented Feb 21, 2025

This works

From elpi.apps Require Import derive.std.

Inductive t (n:nat) := C : Nat.leb n 0 = true -> t.

#[only(param1)] derive Nat.leb.
#[only(eqbOK)] derive t.

but this does not

From elpi.apps Require Import derive.std.

Inductive t (n:nat) := C : Datatypes.is_true (Nat.leb n 0) -> t.

#[only(param1)] derive Nat.leb.
#[only(param1)] derive Datatypes.is_true.
#[only(eqbOK)] derive t.

(*
derive.param1_inhab: cannot prove inhabitation: param1-inhab-db
 (app
   [global (const «is_is_true»), 
    app [global (const «Nat.leb»), c0, global (indc «O»)], 
    app
     [global (const «is_leb»), c0, c1, global (indc «O»), 
      global (indc «is_O»)]]) X0^4
*)
@gares
Copy link
Contributor

gares commented Feb 22, 2025

The problem is that I have a special case for eq here

I think it should not be hard to understand is_true there as well

@eponier
Copy link
Collaborator Author

eponier commented Feb 24, 2025

is_true is common enough to deserve a special case indeed, I think. But could it also be possible to unfold it and discover the equality inside? Maybe this is not the spirit of the param1 commands.

@gares
Copy link
Contributor

gares commented Feb 24, 2025

Yes, I was imagining an ad-hoc unfold rule

param1-inhab-db {{ lib:elpi.derive.is_true lp:B }} R :- param1-inhab-db {{ lib:elpi.eq bool lp:B true }} R.
% also for inhab

(there is not Register for is_true today)

@gares gares linked a pull request Feb 25, 2025 that will close this issue
2 tasks
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 a pull request may close this issue.

2 participants