0xMiden / 0xMiden/air-script

add new built-in $x for accessing x value at each row

Aperta
#90 3 commenti 2 reazioni 0 assegnatari Vedi su GitHub
on hold
Lingua principale
Rust
Stelle
96
Fork
39
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

In order do define some constraints, we may want to be able to define lagrange polynomials directly. In such cases, the domain value that is used for interpolation is needed, so we need a shortcut for referring to this x-value at each row.

We can do this by adding a new built-in value $x that represents x at any given row.

Here's an example from @dlubarov at Polygon Zero of how this could give more flexibility in defining constraints:

```
// Boundary constraint.
a * l_0(x) = 0

// Every other row.
a * odd_row(x) = 0

def odd_row(x) = (x^(n/2) - 1)

def l_0(x) = (x^n - 1) / (x - 1)
```

Required changes:

- [ ] parser
- [ ] IR
- [ ] codegen

This adds flexibility to AirScript, but Miden VM does not need this at the moment, so we could keep updates to the miden codegen very minimal (i.e. just throw an error if this is used)

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

The issue requires modifying the parser, intermediate representation, and codegen. Start by examining the parser source to understand how built-ins like $x are currently handled. Look at the IR to see how values are represented and propagated. For codegen, the Miden VM backend should throw an error if $x is used, while other backends need to support it. Check existing tests for built-ins to see the pattern for adding a new one.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.