Named RAM program examples #
Forward and mutual references are resolved once. Local even has the same
spelling as a function, but reading it and calling it use separate tables.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Ram.Named.Examples.parity_expands :
parity = { registers := 2,
declarations :=
[("even", { params := 1, locals := 2,
body :=
Stmt.ite (Expr.var 0) (Stmt.call [1] 1 [Expr.bin BinOp.sub (Expr.var 0) (Expr.const 1)])
(Stmt.assign 1 (Expr.const 1)),
results := [Expr.var 1] }), ("odd", { params := 1, locals := 2,
body :=
Stmt.ite (Expr.var 0) (Stmt.call [1] 0 [Expr.bin BinOp.sub (Expr.var 0) (Expr.const 1)])
(Stmt.assign 1 (Expr.const 0)),
results := [Expr.var 1] })],
main := (Stmt.read 0).seq ((Stmt.call [1] 0 [Expr.var 0]).seq (Stmt.write (Expr.var 1))) }
The forward call and the same-spelling call both have the intended static targets; their arguments still read each function's parameter register.
The same recursive declaration can be written without maintaining a self
number; its own name is already present when the body is lowered.
Equations
- One or more equations did not get rendered due to their size.