Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

induction from start#555

Merged
johoelzl merged 1 commit intoleanprover-community:masterfrom
sgouezel:induction_from_start
Jan 23, 2019
Merged

induction from start#555
johoelzl merged 1 commit intoleanprover-community:masterfrom
sgouezel:induction_from_start

Conversation

@sgouezel
Copy link
Copy Markdown
Collaborator

Induction on nat, from a starting point which may be different from 0. Contributed by Mario on Zulip. I needed it for my developments and I am sure it will be useful to others also. Not sure about the name of the lemma, though.

-- induction

lemma induction_from_start (P : nat → Prop) {m} (h0 : P m) (h1 : ∀ n ≥ m, P n → P (n + 1)) : ∀ n ≥ m, P n :=
begin
Copy link
Copy Markdown

@mdickinson mdickinson Dec 28, 2018

Choose a reason for hiding this comment

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

You could use nat.less_than_or_equal.rec for a significantly shorter proof:

begin
  apply nat.less_than_or_equal.rec h0,
  exact h1
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The given proof makes more sense when P : nat -> Sort l instead of Prop

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, this is much more efficient. Thanks!


lemma induction_from_start (P : nat → Prop) {m} (h0 : P m) (h1 : ∀ n ≥ m, P n → P (n + 1)) : ∀ n ≥ m, P n :=
by apply nat.less_than_or_equal.rec h0; exact h1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be tagged @[elab_as_eliminator] and P made implicit?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done, thanks

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how about calling this le_induction to match le_rec_on in #585 ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@sgouezel
Copy link
Copy Markdown
Collaborator Author

Subsumed by #585

@sgouezel sgouezel closed this Jan 11, 2019
@sgouezel
Copy link
Copy Markdown
Collaborator Author

In fact, #585 does not exactly cover this...

@sgouezel sgouezel reopened this Jan 11, 2019
@digama0
Copy link
Copy Markdown
Member

digama0 commented Jan 11, 2019

There is a conflict? Please rebase

@sgouezel sgouezel force-pushed the induction_from_start branch from 7cb88d6 to 065dc14 Compare January 12, 2019 18:03
@sgouezel
Copy link
Copy Markdown
Collaborator Author

Rebased (and squashed)

@sgouezel sgouezel force-pushed the induction_from_start branch from 065dc14 to 790bad8 Compare January 17, 2019 12:36
@johoelzl johoelzl merged commit 6da9b21 into leanprover-community:master Jan 23, 2019
@sgouezel sgouezel deleted the induction_from_start branch February 7, 2019 10:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants