5
$\begingroup$

In proof mode, if I know an expression e of type T, I can write pose foo : T := e to add foo := e : T as a hypothesis. Often, I don't care about that foo is the same as e, I only care that foo has type T, so in the hypotheses list I would like to see foo : T instead of foo := e : T to reduce mental clutter. How can I do that?

$\endgroup$
5
  • $\begingroup$ I get syntax error at : if I use pose foo : T := t1. But pose (foo := t1) works here. $\endgroup$ Commented Feb 19, 2022 at 21:06
  • $\begingroup$ @JoachimBreitner I get no syntax error on the following example: Lemma foo S T (f : S -> T) (s : S) : T. Proof. pose foo : T := f s. $\endgroup$
    – CrabMan
    Commented Feb 19, 2022 at 21:08
  • $\begingroup$ @CrabMan Which Coq version do you use? I get a syntax error on your example on all Coq versions I can test from 8.6 to 8.15. $\endgroup$
    – Zimm i48
    Commented Feb 21, 2022 at 13:08
  • $\begingroup$ @Zimmi48 Coq 8.13 and I don't know which version of mathcomp. Do From mathcomp Require Import ssreflect ssrfun ssrbool eqtype ssrnat seq. and then it'll work. $\endgroup$
    – CrabMan
    Commented Feb 21, 2022 at 14:58
  • $\begingroup$ OK, then this explains why (that's the SSReflect pose tactic)! $\endgroup$
    – Zimm i48
    Commented Feb 22, 2022 at 22:31

3 Answers 3

3
$\begingroup$

It seems that

assert (foo := t1).

(docs here) does what you want?

$\endgroup$
3
$\begingroup$

assert was already mentioned in another answer. An alternative (if you like the word pose) is pose proof. Several syntax variants are supported, including the one with :=. In practice, the two will produce exactly the same proof, so this is a purely stylistic choice.

$\endgroup$
2
$\begingroup$

The question text did not make that clear, but it turns out (from the comments) that what you are using is actually the pose tactic from SSReflect (documentation here) and not the standard Coq pose tactic (documentation here). If you want to keep using SSReflect tactics, then the recommended answer to your question is to replace pose with have (documentation here) when you do not need the body. E.g.:

Require Import ssreflect.

Lemma foo S T (f : S -> T) (s : S) : T.
Proof.
have foo : T := f s.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.