Zulip Chat Archive

Stream: general

Topic: fin.pred_above


Scott Morrison (Feb 08 2021 at 09:11):

We currently have a function fin.pred_above p i h, which sends fin (n+1) to fin n, by subtracting one if p < i.

It's set up to take a proof that h : p \ne i. This seems really strange to me --- more natural would be to have a total function, which just sends both p and p+1 to p.

Would anyone object if I tried to make this change? (Or know what would go horribly wrong elsewhere?)

Johan Commelin (Feb 08 2021 at 09:20):

I've also noticed this. I think this is a good idea. But I guess you need to think about n = 0.

Scott Morrison (Feb 08 2021 at 09:25):

Indeed. But I think that is only a matter of choosing between a hypothesis 0 < n, or sending fin (n+2) to fin (n+1).

Scott Morrison (Feb 08 2021 at 09:26):

My inclination is to use the former, to avoid DTT hell.

Johan Commelin (Feb 08 2021 at 09:26):

yup, agreed

Scott Morrison (Feb 08 2021 at 09:26):

In either case it's still a "total function".

Johan Commelin (Feb 08 2021 at 09:26):

We could even consider using [fact (0 < n)]

Scott Morrison (Feb 08 2021 at 09:26):

It looks like pred_above is not actually used much, so I might just go for it.

Scott Morrison (Feb 08 2021 at 09:38):

I think a better approach is to have p : fin n, and i : fin (n+1), and then subtract one if p < i. That ensures both that n \ne 0, and that subtraction actually occurs somewhere.

Yakov Pechersky (Feb 08 2021 at 15:47):

The one downside to this is that you lose the "injectivity" of fin.pred_above.

Yakov Pechersky (Feb 08 2021 at 15:47):

And if one was to change fin.pred_above, what about fin.succ_above?

Floris van Doorn (Feb 08 2021 at 16:19):

I agree that this should be made total (at the very least, the total version should exist).

You don't really lose the "injectivity", it will still hold under the assumptions that your input is not equal to i, and these inequalities must also appear in any current statement of "injectivity".

Scott Morrison (Feb 08 2021 at 21:40):

As far as I can see, fin.succ_above is already as it should be.

Scott Morrison (Feb 08 2021 at 21:41):

I got hung up last night on some lemmas about insert_nth and remove_nth that used pred_above, but I think I see how to handle them now.

Yury G. Kudryashov (Feb 09 2021 at 18:24):

What exactly do you suggest to do with n = 0?

Scott Morrison (Feb 09 2021 at 22:22):

I've made a PR now, as #6125. To handle n = 0, the change I've made is that p : fin n while i : fin (n + 1), and p.pred_above i produces something in fin n. Notice in particular that the original pred_above allowed p : fin (n+1). (This is fine if we insist p \ne i, but not if we want a total function, and this is also what causes the problem at n = 0.)

Kevin Buzzard (Feb 09 2021 at 22:52):

5^3*7^2


Last updated: Dec 20 2023 at 11:08 UTC