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

problem with the apply tactic #1131

Open
bodeveix opened this issue Aug 26, 2024 · 7 comments
Open

problem with the apply tactic #1131

bodeveix opened this issue Aug 26, 2024 · 7 comments

Comments

@bodeveix
Copy link

The apply has a strange behaviour when the goal is quantified. In the following proof,
apply (λ h, h)
lets the goal unchanged as expected.
However, if we try to explicitly type the parameter h, the tactic apply fails. When looking at the unification problem, it seems that the universal variable x of the goal is discharged before the unification attempt, which makes it fail.

=================
symbol Prop: TYPE;
symbol π: Prop → TYPE;
symbol Set: TYPE;
constant symbol τ: Set → TYPE;

constant symbol ∀ [a] : (τ a → Prop) → Prop;
notation ∀ quantifier;
rule π (∀ $f) ↪ Π x, π ($f x);

symbol T: Set;
symbol P : τ T → Prop;

symbol bug: π (∀ (x: τ T), P x) ≔ begin print; debug +u; apply (λ (h : π (∀ x: τ T, P x)), h ); // error
// apply (λ h, h); // correct
print;
admit;
end;

@bodeveix
Copy link
Author

It seems the problem can be fixed by modifying line 247 of tactic.ml:

    | Some (_, a) -> count_products c a **- count_products c gt.goal_type**     

@fblanqui
Copy link
Member

Hi Jean-Paul. Thanks for your issue, and your suggestion. Note also that in case you have problems with apply, you can always use refine instead. But your tactic call is strange anyway. Your goal is (`∀ x, P x). (λ h, h) cannot be of this type. You can see this if instead you write: refine λ h, h, or perhaps better: refine λ x, x.

@bodeveix
Copy link
Author

bodeveix commented Aug 27, 2024 via email

@fblanqui
Copy link
Member

I still don't understand why you would like to do some apply that does not change the goal.
And this doesn't correspond to the semantics of (apply t), which is defined as (refine t _ ... _), which consists in instantiating the goal metavariable by (t _ ... _).
Trying your suggestion makes other libraries fail, where t is of arity 2 (e.g. ∨ₑ p for some p) and you want (apply t) to be (refine t _ _) whatever the arity of the goal is.
It is not clear to me how to define a better version of apply, but PRs are welcome.

@bodeveix
Copy link
Author

bodeveix commented Aug 27, 2024 via email

@bodeveix
Copy link
Author

bodeveix commented Aug 27, 2024 via email

@fblanqui
Copy link
Member

You'll see it if you do make tests: this is in the stdlib.

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

2 participants