Zulip Chat Archive
Stream: general
Topic: missing cases in auto_cases?
Lucas Allen (Nov 16 2019 at 22:23):
Auto_cases
seems to miss some possible induction
hypotheses. One example of this is
lemma test_one (n a : ℕ) (h : 1 ≤ n) : n * a = a * n := begin --auto_cases, induction h, sorry, sorry, end
Here auto_cases
says that it "did not find any hypotheses to apply cases
or induction
to", but induction h
works.
Another example is
lemma test_three (n : ℕ) : n = n := begin --auto_cases, induction n, sorry, sorry, end
auto_cases
gives the same message, but induction n
works, I don't know if this is what it's supposed to do though.
Reid Barton (Nov 16 2019 at 22:25):
auto_cases
isn't really intended for the end user
Reid Barton (Nov 16 2019 at 22:26):
It's part of tidy
. It has a list of known types for which it's usually a good idea to apply cases
(or occasionally induction
, I don't really understand why induction
is even necessary)
Lucas Allen (Nov 16 2019 at 22:38):
I see. If I wanted something like this for the end user, would it make more sense to just run cases
and induction
on each hypothesis and report the ones which work?
Reid Barton (Nov 16 2019 at 22:40):
I assumed you were the end user
Reid Barton (Nov 16 2019 at 22:40):
What are you really trying to do?
Lucas Allen (Nov 16 2019 at 22:54):
I'm writing a tactic called check
which goes through a list of tactics (an extended version of the list from tidy
) and reports which ones succeed without modifying the tactic state. The idea is that this might be helpful when I get stuck proving something. Would something like this be suitable for mathlib?
Scott Morrison (Nov 21 2019 at 23:21):
@Lucas Allen, look for case_bash
, hiding somewhere in mathlib.
Lucas Allen (Nov 22 2019 at 02:08):
II found it, it's in core.lean. A few modifications and it'll do what I want it to. Thanks.
Last updated: Dec 20 2023 at 11:08 UTC