Documentation

Strata.Languages.Core.DDMTransform.Translate

@[reducible, inline]

Location of expressions this file builds itself.

Equations
Instances For
    Instances For
      @[instance_reducible]
      Equations
      • One or more equations did not get rendered due to their size.
      Equations
      Instances For
        def Strata.TransM.error {α : Type} [Inhabited α] (msg : String) :
        Equations
        Instances For
          def Strata.TransM.recordError {α : Type} (msg : String) (fallback : α) :

          Record a translation error without panicking, then continue with fallback. Use for malformed user input (as opposed to internal invariant violations, which use TransM.error).

          Equations
          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              Equations
              Instances For
                Equations
                Instances For
                  def Strata.translateIdent (Identifier : Type) [Coe String Identifier] [Inhabited Identifier] (arg : StrataDDM.Arg) :
                  TransM Identifier
                  Equations
                  Instances For

                    Translate an optional Core.label argument, returning the user-supplied label name if one was written, or none otherwise.

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

                            Translate a MetadataAnnKey to a string (bare or dialect-prefixed).

                            Equations
                            Instances For

                              Translate a MetadataAnnEntry to a MetaDataElem (flags and string values only; expression values are not yet supported).

                              Equations
                              Instances For

                                Translate an Option MetadataAnn argument into MetaData. Returns empty metadata if the annotation is absent.

                                Equations
                                Instances For

                                  Merge explicit annotation metadata (annMd) into source-position metadata (md).

                                  getOpMetaData derives a provenance element from the op's DDM source position. There is only ever one provenance, so an explicit @[provenance = …] replaces that derived one instead of being appended and ignored. Other keys stay additive. A future metadata validator can reject bad input like duplicate provenance; for now the last one wins.

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

                                    Merge explicit annotation metadata into source-position metadata from an op. Combines getOpMetaData (source positions) with translateOptMetadataAnn (user-supplied annotations).

                                    Equations
                                    Instances For
                                      inductive Strata.GenKind :
                                      Instances For
                                        @[instance_reducible]
                                        Equations
                                        structure Strata.GenNum :

                                        Counters for assigning default names for various definitions.

                                        • var_def : Nat
                                        • axiom_def : Nat
                                        • assume_def : Nat
                                        • assert_def : Nat
                                        • cover_def : Nat
                                        Instances For
                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            @[instance_reducible]
                                            Equations

                                            A scoped frame of the translator. :)

                                            Instances For
                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                def Strata.nextLabel (namePrefix : String) (kind : GenKind) (labelArg : StrataDDM.Arg) (bindings : TransBindings) :

                                                Generate a default label and increment the counter for the given kind.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  @[instance_reducible]
                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  @[instance_reducible]
                                                  Equations
                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    Equations
                                                    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
                                                              Instances For
                                                                Equations
                                                                Instances For
                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For

                                                                    Shared binding setup for lambdas and quantifiers: translates the declaration list, creates scoped bound variables, and translates the body in the extended scope.

                                                                    Translate a have x : T = value in body binding. body is translated with x in scope (reusing withScopedBindings, as lambda does); value is translated in the outer scope. Desugars to (λ x : T. body) value via LExpr.mkHave.

                                                                    Resolve a function from a recFuncBlock by its global-context index.

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For
                                                                      Equations
                                                                      Instances For
                                                                        Equations
                                                                        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

                                                                                Decompose an LHS into a base identifier and a (reversed) list of index expressions. For m[k1][k2], returns (m, [k2, k1]).

                                                                                Equations
                                                                                Instances For

                                                                                  Translate an assert/cover/assume statement with optional metadata annotations.

                                                                                  Equations
                                                                                  • One or more equations did not get rendered due to their size.
                                                                                  Instances For
                                                                                    Instances For
                                                                                      @[instance_reducible]
                                                                                      Equations
                                                                                      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

                                                                                          Like translateBindings but also returns the index of the @[cases] parameter, if any.

                                                                                          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

                                                                                                    Translate a procedure's parameter bindings (the mkBindings arg bop) and push the body's variable scope.

                                                                                                    Returns the partitioned input/output signatures for the header, together with bindings extended by the parameter scope. The declaration-order invariant lives here: the body's de Bruijn indices are assigned against the original textual order, not the input/output partition, so the scope binds every parameter in declaration order.

                                                                                                    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

                                                                                                        Translate a top-level block command as a nameless parameterless procedure

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

                                                                                                            Translate a single CFG block

                                                                                                            Equations
                                                                                                            Instances For

                                                                                                              Translate a CFG body

                                                                                                              Equations
                                                                                                              Instances For

                                                                                                                Translate a procedure with CFG body

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

                                                                                                                  Translate const x : T;, a constant whose value is left unspecified.

                                                                                                                  It elaborates to a nullary function without a body, so x is constrained only by whatever axioms mention it.

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

                                                                                                                    Translate const x : T := v;, a constant declared together with its value.

                                                                                                                    It elaborates to a nullary function whose body is v, so the value is available to the type checker and to symbolic evaluation without an SMT-level axiom relating x to v. As for a function definition, the body is substituted at each use only when the declaration is marked inline.

                                                                                                                    Like const x : T;, this form takes no type arguments: a constant is monomorphic. Write a polymorphic nullary value with function syntax instead.

                                                                                                                    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

                                                                                                                        Translate an optional DeclLabel, the name in front of a parameter list.

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

                                                                                                                          Translate the name and proposition of axiom or lemma written with a parameter list, [name] (x : T, ...) { triggers }: e, into the name and forall x : T, ... :: { triggers } e. args holds the label, the parameter list, the triggers and the proposition, in that order.

                                                                                                                          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
                                                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                                                    Instances For
                                                                                                                                      Instances For
                                                                                                                                        Equations
                                                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                                                        Instances For

                                                                                                                                          Translate a single function within a mutual recursive block. fnOp is a recfn_decl operation. preBindings has placeholder fvars for all functions in the block. siblingExprs contains the opExpr for each preceding sibling (for bvar resolution).

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

                                                                                                                                            Translate a command_recfndefs block (one or more mutually recursive functions).

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

                                                                                                                                              Information about a single constructor extracted during translation. This is the Strata Core-specific version of ConstructorInfo from AST.lean, with types translated from TypeExpr to LMonoTy.

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

                                                                                                                                                  Extract and translate constructor information from a constructor list argument.

                                                                                                                                                  Parameters:

                                                                                                                                                  • p: The DDM Program (provides dialect map for annotation lookup)
                                                                                                                                                  • bindings: Current translation bindings (for type variable resolution)
                                                                                                                                                  • arg: The constructor list argument from the parsed datatype command
                                                                                                                                                  Equations
                                                                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                                                                  Instances For

                                                                                                                                                    Extract type arguments from a datatype's optional bindings argument.

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

                                                                                                                                                      Create a placeholder LDatatype for recursive type references.

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

                                                                                                                                                        Filter factory function declarations to extract constructor, tester, and field accessor decls for a single datatype.

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

                                                                                                                                                          Build LConstr list from TransConstructorInfo array.

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

                                                                                                                                                            Generate factory function declarations from a list of LDatatypes.

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

                                                                                                                                                              Translate a datatype block (one or more datatype declarations). The @[preRegisterTypes] metadata on command_datatypes ensures that type names are pre-registered in the DDM GlobalContext before processing.

                                                                                                                                                              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