Zulip Chat Archive

Stream: Is there code for X?

Topic: Simplest possible tactic implementation


Ryan Ziegler (Oct 21 2023 at 00:25):

Hi, I'm new to Lean and have been trying to find a minimal working example of a tactic that doesn't depend on any libraries etc. Something like taking h1 : p and h2 : p -> q and getting q (I know this is easy to do without a tactic, but I'm in search of a minimal example). Any pointers would be great!

Richard Copley (Oct 21 2023 at 00:35):

There are some good ones in Std.Tactic.Basic.

macro "exfalso" : tactic => `(tactic| apply False.elim)

example (P Q : Prop) (hp : P) (hnp : ¬P) : Q := by
  exfalso
  exact hnp hp

Ryan Ziegler (Oct 21 2023 at 00:36):

Perfect, thanks!


Last updated: Dec 20 2023 at 11:08 UTC