lean3 icon indicating copy to clipboard operation
lean3 copied to clipboard

Unsolved `case` tactic error position

Open leodemoura opened this issue 7 years ago • 4 comments

The case tactic is super nice for structuring proofs. However, if it doesn't solve the goal, the error position is very inconvenient. Here is an example:

example (a b : nat) : a + b = b + a :=
begin
   induction b,
   case nat.succ x {  }
--^ the error message is here, it would be much nicer if it was in the } 
end

I'm adding a done tactic before } as a workaround.

example (a b : nat) : a + b = b + a :=
begin
   induction b,
   case nat.succ x {  ...,  done }
                          --^ error message is here if not done.
end

leodemoura avatar Jun 02 '17 00:06 leodemoura

We could add a new special type solve1_itactic which we handle just like { tac } (for which we already special-case the error position); I don't see a nice pure-Lean solution. What do you think?

Kha avatar Jun 02 '17 14:06 Kha

@kha I agree with you. I also didn't see a pure-Lean solution. I like the solve1_itactic. I think it is worth to add it since case is super useful.

leodemoura avatar Jun 02 '17 14:06 leodemoura

We can do something very close in pure Lean using the cur_pos parser: we could use the position after the closing brace as the default position. To get the position inside the braces we'd need something like solve1_itactic.

gebner avatar Jun 02 '17 16:06 gebner

We can do something very close in pure Lean using the cur_pos parser: we could use the position after the closing brace as the default position.

I tried something like that yesterday, but found the resulting error positions very unconvincing.

Kha avatar Jun 03 '17 08:06 Kha