-
Notifications
You must be signed in to change notification settings - Fork 5
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
New example with comments: ho_equalities, written in Ltac, Ltac2 and coq-elpi #21
Open
louiseddp
wants to merge
9
commits into
coq-community:main
Choose a base branch
from
louiseddp:main
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi @louiseddp thanks for your PR! I have a few comments on the elpi code:
Let me sketch the code I propose: pred mk-proof-eq i: term i: term, i: term, i: term, i:list term, o: term.
mk-proof-eq H T1 T2 (prod Na Ty F1) Acc (fun Na Ty F2) :-
pi x\ decl x Na Ty =>
mk-proof-eq H (app [T1, x]) (app [T2, x]) (F1 x) [x|Acc] (F2 x).
mk-proof-eq H T1 T2 Codom Acc {{ @eq_ind_r _ lp:T2 lp:Predicate (eq_refl lp:T2Args) T1 H }} :-
std.rev Acc Args,
coq.mk-app T2 Args T2Args,
Predicate = {{ fun y => lp:{{ app[ {{y}} | Args] }} = lp:T2Args }}. or pred mk-proof-eq i: term i: term, i: term, i: term, i:list term, o: term.
mk-proof-eq H T1 T2 (prod Na Ty F1) Acc (fun Na Ty F2) :-
pi x\ decl x Na Ty =>
mk-proof-eq H (app [T1, x]) (app [T2, x]) (F1 x) [x|Acc] (F2 x).
mk-proof-eq H T1 T2 Codom Acc {{ @eq_ind_r _ lp:T2 (fun y => lp:(P y)) lp:Refl T1 H }} :-
std.rev Acc Args,
Refl = {{ eq_refl lp:{{ app [ T2 | Args ] }} }},
pi y\
P y = {{ lp:{{ app[ y | Args] }} = lp:{{ app[T2 | Args] }} }}. and then mk-proof-eq H T1 T2 Ty [] R1,
coq.typecheck R1 _ ok, Hope it helps. |
Hi @gares, thank you very much for you detailed answer ! I'll submit a new PR taking into account your remarks.
Thank you again for your help ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The new tactic takes an hypothesis
H : f = g
, which f and g some functions, and generates and proves a new hypothesisH1 : forall x1 ... xn, f x1 ... xn = g x1 ... xn
. The tactic is written inLtac1
, showing how to cross binders in this language, inLtac2
, tackling some issues about variables, and incoq-elpi
, also showing how to combine tactics in this language. I tried to document everything as much as possible, but none of these implementations are trivial. I recommend usingcoq-8.17
to compile the files.