Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some details to field/group/scalar doc #267

Merged
merged 4 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions documentation/aleo/03_language.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,35 @@ Higher bit length integers generate more constraints in the circuit, which can s

### Field Elements

Aleo instructions supports the `field` type for the base field elements of the elliptic curve.
These are unsigned integers below the modulus of the base field.
Aleo instructions supports the `field` type for elements of the base field of the elliptic curve.
These are unsigned integers less than the modulus of the base field, so the largest field element
is `8444461749428370424248824938781546531375899335154063827935233455917409239040field`.

```aleo
function main:
input r0: field.private;
```

### Group Elements

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually not directly related to the changes in this PR, but since we have just one elliptic curve at the moment,
we could change the sentence just below to omit 'passed into the Aleo instructions compiler'.

The set of affine points on the elliptic curve passed into the Aleo instructions compiler forms a group.
Leo supports a subgroup of this group, generated by a generator point, as a primitive data type.
Group elements are special since their values can be defined from the x-coordinate of a coordinate pair, such as
`0group`. The group type keyword `group` must be used when specifying a group value.
The curve is a Twisted Edwards curve with `a = -1` and `d = 3021`.
Aleo instructions supports a subgroup of the group, generated by a generator point, as a primitive data type.
A group element is denoted by the x-coordinate of its point; for example,
`2group` means the point `(2, 5553594316923449299484601589326170487897520766531075014687114064346375156608)`.
The generator point is `1540945439182663264862696551825005342995406165131907382295858612069623286213group`.

```aleo
function main:
input r0: group.private;
```

### Scalar Elements
Aleo instructions supports the `scalar` type for scalar field elements of the elliptic curve subgroup.
These are unsigned integers below the modulus of the scalar field.

Aleo instructions supports the `scalar` type for elements of the scalar field defined by the elliptic curve subgroup.
These are unsigned integers less than the modulus of the scalar field, so the largest scalar is
`2111115437357092606062206234695386632838870926408408195193685246394721360382scalar`.

```aleo
function main:
input r0: scalar.private;
Expand Down
29 changes: 17 additions & 12 deletions documentation/leo/03_language.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,26 @@ let b: u8 = 2; // implicit type -- not supported

### Field Elements

Leo supports the `field` type for the base field elements of the elliptic curve.
These are unsigned integers below the modulus of the base field.
Leo supports the `field` type for elements of the base field of the elliptic curve.
These are unsigned integers less than the modulus of the base field. The following are the
smallest and largest field elements.

```leo
let a: field = 1field;
let b: field = 21888242871839275222246405745257275088548364400416034343698204186575808495617field;
let a: field = 0field;
let b: field = 8444461749428370424248824938781546531375899335154063827935233455917409239040field;
```

### Group Elements

The set of affine points on the elliptic curve passed into the Leo compiler forms a group.
Leo supports a subgroup of this group, generated by a generator point, as a primitive data type.
Group elements are special since their values can be defined from the x-coordinate of a coordinate pair, such as
`0group`. The group type keyword `group` must be used when specifying a group value.
The set of affine points on the elliptic curve forms a group.
The curve is a Twisted Edwards curve with `a = -1` and `d = 3021`.
Leo supports a subgroup of the group, generated by a generator point, as a primitive data type.
A group element is denoted by the x-coordinate of its point; for example,
`2group` means the point `(2, 5553594316923449299484601589326170487897520766531075014687114064346375156608)`.

```leo
let b: group = 0group; // the point with 0 x-coordinate
let a: group = 0group; // the point with 0 x-coordinate, (0, 1)
let b: group = 1540945439182663264862696551825005342995406165131907382295858612069623286213group; // the generator point
```

The aforementioned generator point can be obtained via a constant associated to the `group` type.
Expand All @@ -84,11 +87,13 @@ let g: group = group::GEN; // the group generator

### Scalar Elements

Leo supports the `scalar` type for scalar field elements of the elliptic curve subgroup.
These are unsigned integers below the modulus of the scalar field.
Leo supports the `scalar` type for elements of the scalar field defined by the elliptic curve subgroup.
These are unsigned integers less than the modulus of the scalar field. Showing the smallest and largest
scalars.

```leo
let a: scalar = 1scalar;
let a: scalar = 0scalar;
let b: scalar = 2111115437357092606062206234695386632838870926408408195193685246394721360382scalar;
```

### Addresses
Expand Down
Loading