Documentation

Cedar.SymCCOpt.Compiler

This file defines an optimized Cedar symbolic compiler, which computes the actual compiled Term and the footprint simultaneously, avoiding the inefficiencies in the footprint function in SymCC/Enforcer.lean, which repeatedly calls compile on certain subexpressions, making it quadratic or worse in policy size, at least for certain policies.

For notes on the meaning of compile or footprint, see SymCC/Compiler.lean and SymCC/Enforcer.lean, which have clearer, unoptimized implementations.

Structure returned by the optimized compiler, as opposed to the unoptimized compiler which just produces a Term

  • term : Term

    Well-formed term of the appropriate type, representing the compiled expression

  • footprint : Data.Set Term

    The "footprint" of the compiled expression.

    This is the terms corresponding to subexpressions of the compiled expression of the following form:

    • A variable term with an entity type
    • An entity reference literal
    • An attribute access expression with an entity type
    • A binary (getTag) expression with an entity type

    These are the only basic expressions in Cedar that may evaluate to an entity. All other expressions that evaluate to an entity are built up from the above basic expresions.

    All terms in the footprint are of type TermType.option .entity.

Instances For

    Map on the Term, leaving the footprint unchanged

    Equations
    Instances For

      Return the footprint of this compiled term itself (not counting its subexpressions). Only terms of option-entity type have any direct footprint.

      This corresponds to ofEntity in the footprint function in SymCC/Enforcer.lean, except that we only call it when compiling to Term was successful, so it takes a Term argument rather than Result Term.

      Equations
      Instances For
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          Equations
          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Equations
                      Instances For
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          Equations
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                Equations
                                Instances For
                                  Equations
                                  Instances For
                                    @[irreducible]

                                    Given an expression x that has type τ with respect to a type environment Γ, and given a well-formed symbolic environment εnv that conforms to Γ, compile x εnv succeeds and produces a well-formed term of type .option τ.toTermType.

                                    Equations
                                    Instances For