Zulip Chat Archive
Stream: new members
Topic: Can i `revert` unnamed variables?
Tobias Grosser (Apr 12 2024 at 11:14):
I happen to have come across a situation where I would like to revert unnamed variables. I prepared a contrived test case below:
theorem test : ∀ a: ℕ, 2 * a = a + a := by
intros
-- QUESTIONS:
-- a) can I `revert a✝` without naming a in `intros a`?
-- b) can I revert all `a`s of type `ℕ`, again without naming them explicitly?
sorry
Is what I want to achieve possible?
Eric Wieser (Apr 12 2024 at 11:19):
revert ‹ℕ›
works for your first question
Tobias Grosser (Apr 12 2024 at 11:23):
Amazing. Thank you @Eric Wieser
Tobias Grosser (Apr 12 2024 at 11:29):
Interestingly, my use case uses Option Nat
instead of plain Nat
. Any idea why this does not work?
theorem test : ∀ a : Option Nat, 0 = 0 := by
intros
revert ⟨Option Nat⟩
-- QUESTION:
-- why does this not work?
sorry
-- invalid constructor ⟨...⟩, expected type must be an inductive type
-- ?m.128390
Option is clearly an inductive type:
inductive Option (α : Type u) where
/-- No value. -/
| none : Option α
/-- Some value of type `α`. -/
| some (val : α) : Option α
Eric Wieser (Apr 12 2024 at 11:30):
Those are not the same angle brackets
Tobias Grosser (Apr 12 2024 at 11:31):
Now it works like a charm.
Tobias Grosser (Apr 12 2024 at 11:31):
Thank you.
Last updated: May 02 2025 at 03:31 UTC