DeBruijn

scalus.uplc.DeBruijn
object DeBruijn

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
DeBruijn.type

Members list

Value members

Concrete methods

def checkScope(term: Term): Option[NamedDeBruijn]

Checks that a De Bruijn term is closed, exactly as the Cardano ledger checks a script before running it (Plutus mkTermToEvaluate runs UntypedPlutusCore.Check.Scope.checkScope).

Checks that a De Bruijn term is closed, exactly as the Cardano ledger checks a script before running it (Plutus mkTermToEvaluate runs UntypedPlutusCore.Check.Scope.checkScope).

Every variable must have an index from 1 to the number of enclosing binders. Like Plutus, this does not look inside Constr or Case: an out-of-scope index there passes, and fails only if evaluation reaches it. That is a Plutus quirk the ledger rules now depend on, see https://github.com/IntersectMBO/plutus/issues/7965.

Attributes

Returns

the first variable out of scope, or None if there is none

def deBruijnTerm(term: Term): Term

Converts a term with named variables to a term with De Bruijn indices. We use unique negative indices to represent free variables.

Converts a term with named variables to a term with De Bruijn indices. We use unique negative indices to represent free variables.

Value parameters

term

the term with named variables

Attributes

Returns

the term with De Bruijn indices

def deBruijnTerm(term: Term, throwOnFreeVariable: Boolean): Term
def fromDeBruijnTerm(term: Term): Term