## 6.1 Switching on/off the proof editing mode

### 6.1.1 `Goal` form`.`

This command switches Coq to editing proof mode and sets form as the original goal. It associates the name `Unnamed_thm` to that goal.
Error messages:

1. `the term` form`has type ... which should be Set, Prop or Type`
2. `repeated goal not permitted in refining mode` the command `Goal` cannot be used while a proof is already being edited.

See also: section 6.1.3

### 6.1.2 `Qed.`

This command is available in interactive editing proof mode when the proof is completed. Then `Qed` extracts a proof term from the proof script, switches back to Coq top-level and attaches the extracted proof term to the declared name of the original goal. This name is added to the environment as an `Opaque` constant.
Error messages:

1. `Attempt to save an incomplete proof`
2. ident `already exists`
   The implicit name is already defined. You have then to provide explicitly a new name (see variant 2 below).
3. Sometimes an error occurs when building the proof term, because tactics do not enforce completely the term construction constraints.
   The user should also be aware of the fact that since the proof term is completely rechecked at this point, one may have to wait a while when the proof is large. In some exceptional cases one may even incur a memory overflow.

Variants:

1. `Defined.`
   Defines the proved term as a transparent constant.
2. `Save.`
   Is equivalent to `Qed`.
3. `Save` ident`.`
   Forces the name of the original goal to be ident. This command (and the following ones) can only be used if the original goal has been opened using the `Goal` command.
4. `Save Theorem` ident`.`
   `Save Lemma` ident`.`
   Are equivalent to `Save` ident`.`
5. `Save Remark` ident`.`
   Defines the proved term as a constant that will not be accessible without using a qualified name after the end of the current section.
6. `Save Fact` ident`.`
   Defines the proved term as a constant that will not be accessible without using a qualified name after the closing of two levels of sectioning.

### 6.1.3 `Theorem` ident`:` form`.`

This command switches to interactive editing proof mode and declares ident as being the name of the original goal form. When declared as a `Theorem`, the name ident is known at all section levels: `Theorem` is a global lemma.
Error message: (see section 6.1.1)
Variants:

1. `Lemma` ident`:` form`.`
   It is equivalent to `Theorem` ident`:` form`.`
2. `Remark` ident`:` form`.`
   Analogous to `Theorem` except that ident will be accessible only by a qualified name after closing the current section.
3. `Fact` ident`:` form`.`
   Analogous to `Theorem` except that ident is accessible by a short name after closing the current section but will be accessible only by a qualified name after closing the section which is above the current section.
4. `Definition` ident`:` form`.`
   Analogous to `Theorem`, intended to be used in conjunction with `Defined` (see 6.1.2) in order to define a transparent constant.
5. `Local` ident`:` form`.`
   Analogous to `Definition` except that the definition is turned into a local definition on objects depending on it after closing the current section.

### 6.1.4 `Proof` term`.`

This command applies in proof editing mode. It is equivalent to `Exact` term`; Save.` That is, you have to give the full proof in one gulp, as a proof term (see section 7.2.1).
Variants:

1. `Proof.` is a noop which is useful to delimit the sequence of tactic commands which start a proof, after a `Theorem` command. It is a good practice to use `Proof.` as an opening parenthesis, closed in the script with a closing `Qed.`

### 6.1.5 `Abort.`

This command cancels the current proof development, switching back to the previous proof development, or to the Coq toplevel if no other proof was edited.
Error messages:

1. `No focused proof``(No proof-editing in progress)`

Variants:

1. `Abort` ident`.`
   Aborts the editing of the proof named ident.
2. `Abort All.`
   Aborts all current goals, switching back to the Coq toplevel.

### 6.1.6 `Suspend.`

This command applies in proof editing mode. It switches back to the Coq toplevel, but without canceling the current proofs.

### 6.1.7 `Resume.`

This commands switches back to the editing of the last edited proof.
Error messages:

1. `No proof-editing in progress`

Variants:

1. `Resume` ident`.`
   Restarts the editing of the proof named ident. This can be used to navigate between currently edited proofs.

Error messages:

1. `No such proof`