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

Tutorial about Intro patterns #73

Merged
merged 20 commits into from
Jan 3, 2025

Conversation

thomas-lamiaux
Copy link
Collaborator

A completion of #32

@thomas-lamiaux thomas-lamiaux added the documentation Improvements or additions to documentation label Dec 23, 2024

(** The second pattern is for inductive types that only have one constructor,
like records. In this case, it is possible to write [(a, b, ..., d)] rather
than [ [a b ... d]]. The interrest is that it enables to preserves [let-in]
Copy link

Choose a reason for hiding this comment

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

inteRest

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. Btw, if you have never used it you should check out the code suggestion functionality. It enables to suggest a modification that I can later commit if I want. It is great to fix typos. It is this button

image

@Matafou
Copy link

Matafou commented Dec 24, 2024

Nice tuto!

Copy link
Contributor

@Tragicus Tragicus left a comment

Choose a reason for hiding this comment

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

Nice work indeed. As a small optimization, you do not need cbn before reflexivity, since reflexivity unifies both sides of the equality, which reduces the terms as needed. I mostly checked for typos, should I also check the writing style?

src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
Co-authored-by: Quentin VERMANDE <[email protected]>
@thomas-lamiaux
Copy link
Collaborator Author

@Tragicus Thanks for checking for typos. Most comes from refactoring. After staring at the code for so long you start not seeing them anymore and basic spell checker don't catch them.

Concerning cbnI know it is not needed but for introductory contents I think it is important that people see the simplification to get what is going on.

Copy link
Collaborator

@Villetaneuse Villetaneuse left a comment

Choose a reason for hiding this comment

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

Nice work. I have some minor suggestions and a longer one (about nat).

src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
Copy link

@LyesSaadi LyesSaadi left a comment

Choose a reason for hiding this comment

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

Very good explanations which are easy to understand, and very pertinent examples. I frequently found myself asking for "hey, would we be able to combine this and that", only for an example of that to be given just afterward.

src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
src/Tutorial_intro_patterns.v Outdated Show resolved Hide resolved
@thomas-lamiaux
Copy link
Collaborator Author

@Villetaneuse All is solved for one detail. In your suggestion you have introduced the as ... notation which uses intro patterns itself but without explanation, so I feel there is a bit of a loop. What do you think ?

@Villetaneuse
Copy link
Collaborator

@Villetaneuse All is solved for one detail. In your suggestion you have introduced the as ... notation which uses intro patterns itself but without explanation, so I feel there is a bit of a loop. What do you think ?

That's indeed an issue. However, I was thinking that the reader was already familiar with these forms for the destruct and injection tactics (even though she may ignore that there is an intro pattern after as).
That's what I do in my course.

As I see it, we can go in two directions:

  • remove as in the beginning of this tutorial, use case instead of destruct to avoid auto names, or as you did before use destruct and do not use the auto names, and progressively introduce the as (almost) "tactical"
  • rely on some previous experience with destruct as; we still can explain that in general as takes an intro pattern

What do you think?

Would you like that I extract from my course a tutorial about basic proofs of logical statements which could be a prerequisite, in order to have a clearer view?

@thomas-lamiaux
Copy link
Collaborator Author

thomas-lamiaux commented Dec 30, 2024

I think it is best to suppose people know destruct as and want to know about intro patterns, and to just add a comment.

Would you like that I extract from my course a tutorial about basic proofs of logical statements which could be a prerequisite, in order to have a clearer view?

@Villetaneuse Sth that is a bit urgent to do, would be a learning game for Coq, an adaptation of the natural number game or sth else so that people can try it out and learn the base.

@Villetaneuse
Copy link
Collaborator

I think it is best to suppose people know destruct as and want to know about intro patterns, and to just add a comment.

All right, I will add a remark and a list of tactics which allow as intro_pattern in the end.

Would you like that I extract from my course a tutorial about basic proofs of logical statements which could be a prerequisite, in order to have a clearer view?

@Villetaneuse Sth that is a bit urgent to do, would be a learning game for Coq, an adaptation of the natural number game or sth else so that people can try it out and learn the base.

If you really want something which resembles the natural number game, it's very difficult at this point, I'm afraid. We would first need a stable javascript backend and, to some extent, frontend.

Villetaneuse and others added 3 commits December 30, 2024 11:54
also correct some whitespace issues and add a small remark after the
first "destruct as".
@thomas-lamiaux thomas-lamiaux merged commit ee8f08b into coq:main Jan 3, 2025
2 checks passed
@thomas-lamiaux thomas-lamiaux deleted the intro-patterns branch January 3, 2025 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
Development

Successfully merging this pull request may close these issues.

6 participants