Documentation

Strata.Languages.Core.StatementEval

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

    Create fresh variables for return and LHS mapping.

    Return mapping is used for postcondition substitution, i.e., to map procedure's return parameter names to fresh variables.

    LHS mapping is used for environment updates, i.e., to map caller's LHS variable names to the same fresh variables as above.

    For example, if we have call x := Inc(8) where Inc returns a variable named ret: Return mapping: [("ret", fresh_var)] LHS mapping: [("x", fresh_var)]

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

      Evaluate a procedure call by inlining its contract. args and lhs are matched positionally against proc.header.inputs and proc.header.outputs respectively.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Core.Statement.Command.eval (E : Env) (old_var_subst : SubstMap) (c : Command) :
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[irreducible]

          Generic function to check if a statement contains a specific command type.

          Equations
          Instances For
            @[irreducible]

            Generic function to check if statements contain a specific command type.

            Equations
            Instances For

              Detect if statements contain any cover commands.

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

                Detect if statements contain any assert commands.

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

                  Substitute free variables in an expression with their current values from the environment, excluding the given parameter names (which are bound by the function, not free). This implements value capture semantics for local function declarations (funcDecl).

                  Unlike global functions (which are evaluated at the top level with no local state), local functions capture the values of free variables at the point of declaration. Parameters are excluded because they are bound by the function definition and should not be substituted with values from the enclosing scope.

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

                    An environment with an optional exit label.

                    • env : Env
                    • exitLabel : Option (Option String)

                      none = no exit active; some none = exit nearest block; some (some l) = exit block l

                    • splitConds : Array (Nat × Expression.Expr × Bool)

                      Stack of unmerged split conditions. Each entry is (splitId, cond, side) where splitId uniquely identifies the split origin (both paths from the same split get the same splitId), cond is the branch condition expression, and side distinguishes the branches (true = then, false = else for ITE splits). Last element is the most recent (innermost) unmerged split.

                      Key invariant: both sides of a split always share the same splitId and cond; only side differs. Entries are only pushed in processIteBranches when pathCap is active. mergeCondPairs relies on this to correctly pair and merge paths.

                    Instances For
                      @[irreducible]
                      def Core.Statement.evalAuxGo (steps : Nat) (old_var_subst : SubstMap) (Ewns : List EnvWithNext) (ss : Statements) (nextSplitId : Nat) :

                      Batch symbolic evaluator: evaluates a statement list for all input paths simultaneously. Between each statement, enforces the path cap by merging continuing (.none exit) paths.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        @[irreducible]
                        def Core.Statement.processIteBranches (steps : Nat) (old_var_subst : SubstMap) (Ewn : EnvWithNext) (cond cond' : Expression.Expr) (then_ss else_ss : Statements) (nextSplitId : Nat) :
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def Core.Statement.evalAux (E : Env) (old_var_subst : SubstMap) (ss : Statements) (optExit : Option (Option String)) :
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            Equations
                            Instances For
                              def Core.Statement.eval (E : Env) (old_var_subst : SubstMap) (ss : Statements) :

                              A symbolic simulator for statements yielding a list of resulting environments.

                              The argument old_var_subst below is a substitution map from global variables to their pre-state value in the enclosing procedure of ss.

                              Equations
                              Instances For
                                def Core.Statement.evalOne (E : Env) (old_var_subst : SubstMap) (ss : Statements) :

                                A symbolic simulator for statements yielding one environment.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  @[irreducible]
                                  def Core.Statement.Command.runCall (lhs : List Expression.Ident) (procName : String) (args : List Expression.Expr) (fuel : Nat) (E : Env) :

                                  Interpret a single procedure call.

                                  Importantly, this creates a separate Env to execute the body of the procedure with, which initially only contains input/output variables. The resulting Env is the original passed in Env with the output variables copied back into it.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    @[irreducible]
                                    def Core.Statement.Command.run (fuel : Nat) (E : Env) (c : Command) :
                                    Equations
                                    Instances For