## 2.4 Section mechanism

The sectioning mechanism allows to organize a proof in structured sections. Then local declarations become available (see section 1.3.2).

### 2.4.1 `Section` ident``

This command is used to open a section named ident.
Variants:

1. `Chapter` ident
   Same as `Section` ident

### 2.4.2 `End` ident``

This command closes the section named ident. When a section is closed, all local declarations (variables and locals) are discharged. This means that all global objects defined in the section are closed (in the sense of l-calculus) with as many abstractions as there were local declarations in the section explicitly occurring in the term. A local object in the section is not exported and its value will be substituted in the other definitions.
Here is an example :
`Coq` `<``Section s1.`
`Coq` `<``Variables x,y : nat.`
`x is assumed`
`y is assumed`
`Coq` `<``Local y' := y.`
`y' is defined`
`Coq` `<``Definition x' := (S x).`
`x' is defined`
`Coq` `<``Print x'.`
`x' = (S x)`
`: nat`
`Coq` `<``End s1.`
`x' is discharged.`
`Coq` `<``Print x'.`
`x' = [x:nat](S x)`
`: nat-``>``nat`
Note the difference between the value of `x'` inside section `s1` and outside.
Error messages:

1. `Section` ident`does not exist (or is already closed)`
2. `Section` ident`is not the innermost section`

Remarks:

1. Most commands, like `Hint` ident or `Syntactic Definition` which appear inside a section are cancelled when the section is closed.