> ## Documentation Index
> Fetch the complete documentation index at: https://starkware-9575960b-agent-options.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Writing a spreadsheet

<Frame caption="Figure 1: Prover workflow: Create a table">
  <img src="https://mintcdn.com/starkware-9575960b-agent-options/4HXKWaB2V6I5hK0g/learn/s-two/air-development/writing-a-simple-air/writing-a-spreadsheet-1.png?maxW=5208&auto=format&n=4HXKWaB2V6I5hK0g&q=85&s=f0157d0071e89b18f05dddd7a2fb8c79" width="5208" height="3596" data-path="learn/s-two/air-development/writing-a-simple-air/writing-a-spreadsheet-1.png" />
</Frame>

In order to write a proof, we first need to create a table of rows and columns. This is no different than writing integers to an Excel spreadsheet as we can see in Figure 2.

<Frame caption="Figure 2: From spreadsheet to table">
  <img src="https://mintcdn.com/starkware-9575960b-agent-options/4HXKWaB2V6I5hK0g/learn/s-two/air-development/writing-a-simple-air/writing-a-spreadsheet-2.png?maxW=1644&auto=format&n=4HXKWaB2V6I5hK0g&q=85&s=b6782e4d31e1d4deba75cb62e7bc4951" width="1644" height="724" data-path="learn/s-two/air-development/writing-a-simple-air/writing-a-spreadsheet-2.png" />
</Frame>

But there is a slight caveat to consider when creating the table. S-two implements [SIMD operations](https://en.wikipedia.org/wiki/Single_instruction,_multiple_data) to speed up the prover in the CPU, but this requires providing the table cells in chunks of 16 rows. Simply put, this is because S-two supports 16 lanes of 32-bit integers, which means that the same instruction can be run simultaneously for 16 different data.

Alas, for our table, we will need to create 14 dummy rows to make the total number of rows equal to 16, as shown in Figure 3. For the sake of simplicity, however, we will omit the dummy rows in the diagrams of the following sections.

<Frame caption="Figure 3: Creating a table with 16 rows">
  <img src="https://mintcdn.com/starkware-9575960b-agent-options/4HXKWaB2V6I5hK0g/learn/s-two/air-development/writing-a-simple-air/writing-a-spreadsheet-3.png?maxW=2084&auto=format&n=4HXKWaB2V6I5hK0g&q=85&s=b2e965ae7dbaf616f2f2376f7ae8d494" width="2084" height="2884" data-path="learn/s-two/air-development/writing-a-simple-air/writing-a-spreadsheet-3.png" />
</Frame>

Given all that, let's create this table using S-two.

```rust
use stwo_prover::core::{
    backend::{
        simd::{column::BaseColumn, m31::N_LANES},
        Column,
    },
    fields::m31::M31,
};

fn main() {
    let num_rows = N_LANES;

    let mut col_1 = BaseColumn::zeros(num_rows as usize);
    col_1.set(0, M31::from(1));
    col_1.set(1, M31::from(7));

    let mut col_2 = BaseColumn::zeros(num_rows as usize);
    col_2.set(0, M31::from(5));
    col_2.set(1, M31::from(11));
}
```

As mentioned above, we instantiate the `num_rows` of our table as `N_LANES=16` to accommodate SIMD operations. Then we create a `BaseColumn` of `N_LANES=16` rows for each column and populate the first two rows with our values and the rest with dummy values.

Note that the values in the `BaseColumn` need to be of type `M31`, which refers to the Mersenne-31 prime field that S-two uses. This means that the integers in the table must be in the range $[0, 2^{31}-1]$.
