Zulip Chat Archive

Stream: Is there code for X?

Topic: Exact absurd


Marcus Rossel (Feb 22 2023 at 18:24):

I use exact absurd h1 h2 all the time in tactic proofs. Is there a tactic which I can provide with h1 and h2 which does the same thing?

Pedro Sánchez Terraf (Feb 22 2023 at 18:30):

Is tactic#contradiction what you are looking for?

example (A B : Prop) (h : B) (h2 : ¬B): A := by contradiction

Marcus Rossel (Feb 22 2023 at 18:41):

@Pedro Sánchez Terraf, no. I want to be able to provide the hypotheses directly to the tactic. (I want to pass in terms which aren't in the proof context.)

Kyle Miller (Feb 22 2023 at 18:43):

Would you want the tactic to do anything other than exact absurd h1 h2? I've sometimes thought it would be nice to have absurd h1 h2 for short, but it's never seemed worth it since its only purpose would be to save 6 characters here and there.

Pedro Sánchez Terraf (Feb 22 2023 at 18:44):

Right, I was just typing that exact absurd h1 h2 is already pretty succinct.

Kyle Miller (Feb 22 2023 at 18:44):

Another way to write it is exact (h1 h2).elim, but that's the same number of characters. I usually use it when I temporarily forget which argument comes first in absurd.

Marcus Rossel (Feb 22 2023 at 18:48):

Kyle Miller said:

Would you want the tactic to do anything other than exact absurd h1 h2?

I guess it would be nice not to have to worry about the order of the arguments. I always forget whether the negation comes first or second. I think it would be nice to just be able to pass terms to the contradiction tactic which it would then consider in its search of a contradiction.

Kevin Buzzard (Feb 22 2023 at 18:49):

cases h1 h2 is shorter.

Kyle Miller (Feb 22 2023 at 18:50):

@Marcus Rossel The compositional version of that (i.e., a way to design things where you want to have simple parts that work together, rather than complex feature-ful parts), is you write have := h1, contradiction to add an extra thing to the local context.

Kyle Miller (Feb 22 2023 at 18:52):

@Kevin Buzzard That's smart, wish I'd thought of that before!

(I'm sure it'll save dozens of keystrokes :smile:)


Last updated: Dec 20 2023 at 11:08 UTC