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

Advanced Addition World - Level 10 and 11 #126

Open
miguel-negrao opened this issue Jan 26, 2023 · 2 comments
Open

Advanced Addition World - Level 10 and 11 #126

miguel-negrao opened this issue Jan 26, 2023 · 2 comments

Comments

@miguel-negrao
Copy link

The text in level 11 says "We just proved add_left_eq_zero (a b : mynat) : a + b = 0 → b = 0. " but actually the theorem in level 10 is "add_left_eq_zero {{a b : mynat}} (H : a + b = 0) : b = 0".

Also, the fact that add_left_eq_zero is not an implication but has the premise as an "argument?" left me confused, I don't think I had seen this before ? I think a theorem which has an hypothesis as argument needs to be explained ? I don't think I can use "apply" on add_left_eq_zero, right ?

@kbuzzard
Copy link
Collaborator

variables (P Q : Prop)

def example1 (hP : P) : Q := sorry
def example2 : P → Q := sorry

example : example1 = example2 := rfl -- they're the same

@miguel-negrao
Copy link
Author

miguel-negrao commented Jan 28, 2023

Ah, ok, that wasn't clear, thanks ! In any case it's worth checking if this is explained before somewhere on the text.

But then I get stuck I believe on the implicit parameters:

intro h,
rw add_comm a b at h,
apply add_left_eq_zero,

gives

2 goals
a b : mynat,
h : b + a = 0
⊢ ?m_1 + a = 0
 
a b : mynat,
h : b + a = 0
⊢ mynat

I was able to solve it reading about implicit parameters in lean's manual:

intro h,
rw add_comm a b at h,
apply @add_left_eq_zero b a,
exact h,

edit:
Ah, actually it also works if I ignore the problem and continue anyway since that term is not needed after:

intro h,
rw add_comm a b at h,
apply add_left_eq_zero,
exact h,

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