verse-lab / lean-ssr

LeanSSR: an SSReflect-Like Tactic Language for Lean
Apache License 2.0
31 stars 0 forks source link

Sequence with case split #9

Open dranov opened 7 months ago

dranov commented 7 months ago

In Coq, I can write something like:

Lemma lastP s : last_spec s.
Proof. case: s => [|x s]; [left | rewrite lastI; right]. Qed.

Is there something similar in Ssrlean?

Currently I do the following, which is a bit verbose:

theorem lastP (s : Seq α) : last_spec s := by
  scase: s => [|x s]
  { left }
  { srw lastI; right }
volodeyka commented 7 months ago

I've never been into the [ .. | .. | ...] syntax for tactics. It actually comes from vanilla Coq, and (I suggest) not idiomatic in Lean. Maybe you can try something like:

theorem lastP (s : Seq α) : last_spec s := by
  scase: s => [|x s]; { left }; srw lastI; right