Zulip Chat Archive

Stream: new members

Topic: tutorials 0081


Patrick Lutz (May 21 2020 at 03:38):

I'm currently working through @Patrick Massot 's tutorial and Lean claims to not recognize inv_succ_pos though I believe it's supposed to be available when doing exercise 81. I checked tuto_lib.lean and it's not there, so maybe it was accidentally left out?

Yury G. Kudryashov (May 21 2020 at 03:39):

Please provide links to the files you're talking about.

Patrick Lutz (May 21 2020 at 03:40):

Sorry, exercise 81 is in the file which is on github here: https://github.com/leanprover-community/tutorials/blob/master/src/exercises/09_limits_final.lean

Patrick Lutz (May 21 2020 at 03:41):

tuto_lib.lean is here: https://github.com/leanprover-community/tutorials/blob/master/src/solutions/tuto_lib.lean

Patrick Lutz (May 21 2020 at 03:42):

I'm trying to follow the instructions in the README of the tutorial about making threads on zulip to ask about it, sorry if I've left out context

Bryan Gin-ge Chen (May 21 2020 at 03:47):

It's proved in 00_first_proofs.lean, so you could add import .00_first_proofs at the top of your file as a workaround.

Patrick Lutz (May 21 2020 at 03:52):

When I do that it tells me "command expected"

Johan Commelin (May 21 2020 at 03:54):

Weird, can you copy paste the top of your file?

Patrick Lutz (May 21 2020 at 03:54):

import tuto_lib
import .00_first_proofs

set_option pp.beta true
set_option pp.coercions false

Patrick Lutz (May 21 2020 at 03:54):

the only change I made was the one Bryan suggested

Johan Commelin (May 21 2020 at 03:55):

Tip: #backticks

Patrick Lutz (May 21 2020 at 03:55):

strangely, after doing this VS Code was able to auto-complete to inv_succ_pos but lean still didn't recognize it

Johan Commelin (May 21 2020 at 03:55):

Very weird...

Patrick Lutz (May 21 2020 at 03:55):

import tuto_lib
import .00_first_proofs

set_option pp.beta true
set_option pp.coercions false

Patrick Lutz (May 21 2020 at 03:55):

oops

Johan Commelin (May 21 2020 at 03:56):

You can edit

Johan Commelin (May 21 2020 at 03:56):

You need 3 backticks on their own line

Patrick Lutz (May 21 2020 at 03:57):

Yeah it took me too long to realize you were linking to something

Johan Commelin (May 21 2020 at 03:57):

Anyway, I really don't know what's wrong now... Could you try saving and restarting?

Patrick Lutz (May 21 2020 at 03:57):

sure

Patrick Lutz (May 21 2020 at 03:58):

same behavior

Johan Commelin (May 21 2020 at 03:59):

Can you write #print up_bounds just after the import statements?

Johan Commelin (May 21 2020 at 04:00):

And maybe change the import to import exercises.00_first_proofs

Johan Commelin (May 21 2020 at 04:00):

Is there a red underline under one of the import statements?

Bryan Gin-ge Chen (May 21 2020 at 04:00):

Heh, I see. The source directory in leanpkg.toml is set to src/solutions.

Bryan Gin-ge Chen (May 21 2020 at 04:01):

So just import 00_first_proofs should work

Bryan Gin-ge Chen (May 21 2020 at 04:01):

Or it would, if Lean accepted imports of files that started with 0, I guess.

Patrick Lutz (May 21 2020 at 04:02):

I tried #print up_bounds and it highlited import .00_first_proofs

Patrick Lutz (May 21 2020 at 04:02):

I also tried import 00_first_proofs initially but it didn't work

Johan Commelin (May 21 2020 at 04:02):

import «00_first_proofs»?

Johan Commelin (May 21 2020 at 04:03):

Does that work around the "you cannot start with a digit" problem?

Patrick Lutz (May 21 2020 at 04:03):

how do you make that symbol before 00?

Patrick Lutz (May 21 2020 at 04:04):

wait nvm I figured out how to make it

Patrick Lutz (May 21 2020 at 04:05):

it says "illegal character in escaped identifier"

Patrick Lutz (May 21 2020 at 04:05):

oops I probably messed it up

Bryan Gin-ge Chen (May 21 2020 at 04:06):

With \f<< and \f>> it works for me, but then le_lim gets an error because it's already defined.

Bryan Gin-ge Chen (May 21 2020 at 04:06):

I didn't know this trick, by the way. Is it just for imports?

Patrick Lutz (May 21 2020 at 04:06):

yeah that's what I have now too

Patrick Lutz (May 21 2020 at 04:06):

I initially left out the \f>>

Patrick Lutz (May 21 2020 at 04:07):

but at least that resolves the issue

Patrick Lutz (May 21 2020 at 04:07):

although I think probably inv_succ_pos is supposed to be in tuto_lib?

Bryan Gin-ge Chen (May 21 2020 at 04:08):

Yeah, most likely. Although I cheated and looked at the solutions and they don't use inv_succ_pos :wink: .

Patrick Lutz (May 21 2020 at 04:08):

lol, I just wanted to use it in my solution and was surprised it wasn't available

Patrick Lutz (May 21 2020 at 04:09):

but some of my solutions seem less efficient than the official ones

Mario Carneiro (May 21 2020 at 04:11):

Bryan Gin-ge Chen said:

I didn't know this trick, by the way. Is it just for imports?

No, it works for any name

Mario Carneiro (May 21 2020 at 04:11):

so identifiers of theorems and definitions too

Johan Commelin (May 21 2020 at 04:16):

def «☃» : Prop := sorry
example : «☃» := sorry

Patrick Massot (May 21 2020 at 10:38):

Patrick Lutz said:

I'm trying to follow the instructions in the README of the tutorial about making threads on zulip to ask about it, sorry if I've left out context

You did this perfectly, but I think you're the first one to achieve this level of excellency in following the instructions, hence Yury was caught off-guard.

Patrick Massot (May 21 2020 at 10:40):

About you're question now: this is all my fault, this line mentionning inv_succ_pos is a left-over from the previous life of this file as teaching material for my undergrads where I had a lot of renamed lemmas (most often for translations purposes). This is now fixed.

Patrick Lutz (May 21 2020 at 20:08):

@Patrick Massot , thanks for the reply. And thanks for making the tutorial in the first place, it's really great.

Patrick Massot (May 21 2020 at 20:11):

This tutorial is only a translated and lightly edited version of what I wrote for a course I taught to 1st year undergrads in Orsay (who had seen the math material in a traditional way in the preceding semester). The effort of turning it into a tutorial was not so big.

Patrick Massot (May 21 2020 at 20:14):

Oh, I could add a file with the exam now that the exam is over. I still need to mark it :sad:

Ryan Lahfa (May 21 2020 at 21:50):

Patrick Massot said:

Oh, I could add a file with the exam now that the exam is over. I still need to mark it :sad:

The exam is your first PR to mathlib!

Kevin Buzzard (May 21 2020 at 23:41):

@Abhimanyu Pallavi Sudhir formalised my final exam from 2018 or 2019 somewhere, that was kind of cool to know that Lean could pass it


Last updated: Dec 20 2023 at 11:08 UTC