Documentation

MeTTaIL.Syntax

A dotted path of identifiers, e.g. a.b.c. Mirrors BNFC DottedPath (BaseDottedPath Ident | QualifiedDottedPath Ident DottedPath).

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

      A sort / category, i.e. an arity expression. The arity language is the generating shapes closed under lists, exponentials (arrow), and products. Mirrors BNFC Cat (IdCat | ListOfCat | ArrowCat | ProdCat).

      Instances For

        Structural equality on categories, the analogue of the Scala Cat.equals. Hand-written because Cat nests through List Cat in prod, which deriving BEq does not support.

        Equations
        Instances For

          Pointwise structural equality on category lists (the prod arguments).

          Equations
          Instances For
            @[implicit_reducible]
            Equations
            inductive MeTTaIL.Label :

            A constructor label. Mirrors BNFC Label (Id | Wild | ListE | ListCons | ListOne). The list labels carry the element category of the list sort they construct.

            Instances For
              @[implicit_reducible]
              Equations
              inductive MeTTaIL.Item :

              One item in a function symbol's concrete syntax. Mirrors BNFC Item. terminal is a literal; nterminal is a sort argument; absNTerminal x it is the abstraction (x) it with x bound in it; bindNTerminal x c is (Bind x c). The absNTerminal/bindNTerminal pair encodes a higher-order (exponential) argument.

              Instances For
                @[implicit_reducible]
                Equations
                structure MeTTaIL.Rule :

                A function symbol, written as a grammar rule label . cat ::= items. cat is the output arity; the input arity is read off the non-terminal items. Mirrors BNFC Rule . Def.

                Instances For
                  @[implicit_reducible]
                  Equations
                  Equations
                  Instances For
                    inductive MeTTaIL.AST :

                    A term. Mirrors BNFC AST: var is a (possibly qualified) variable, sexp label args is an applied constructor (label args...), and subst body repl v is the built-in capture-avoiding substitution (Subst body repl v) that drives the COMM rule.

                    Instances For

                      Structural equality on terms, the analogue of the Scala AST.equals. Hand-written because AST nests through List AST in sexp.

                      Equations
                      Instances For

                        Pointwise structural equality on term lists (the sexp arguments).

                        Equations
                        Instances For
                          @[implicit_reducible]
                          Equations

                          An equation, optionally guarded by a freshness side condition if x # y then .... Mirrors BNFC Equation (EquationImpl | EquationFresh).

                          Instances For
                            structure MeTTaIL.Hyp :

                            A rewrite premise src ~> tgt over dotted-path variables. Mirrors BNFC Hyp . Hypothesis.

                            Instances For
                              Equations
                              Instances For
                                @[implicit_reducible]
                                Equations

                                A rewrite rule: a conclusion lhs ~> rhs, optionally under premises let h in .... Mirrors BNFC Rewrite (RewriteBase | RewriteContext).

                                Instances For

                                  A named rewrite declaration name : rw. Mirrors BNFC RDecl . RewriteDecl.

                                  Instances For
                                    Equations
                                    Instances For

                                      A theory presentation, the in-memory BasePres: exported sorts, function symbols (terms), equations, rewrites, and a references map (declared prefix to sub-presentation) used to validate dotted-path prefixes in rewrites.

                                      The references field makes the type recursive, exactly as BasePres.listmapentry_ does (MakeMapEntry . MapEntry ::= Ident "=>" Pres). Our elaborate never populates it, so every presentation this development produces has empty references; the field is kept to mirror BasePres faithfully, where a literal presentation can carry references. The type is an inductive rather than a structure because Lean structures may not be recursive; named accessors are defined just below.

                                      Instances For

                                        Structural equality on presentations. Hand-written because Presentation nests through List (String × Presentation) in references.

                                        Equations
                                        Instances For

                                          Pointwise structural equality on reference maps.

                                          Equations
                                          Instances For

                                            The exported sorts of a presentation (the generating shapes S).

                                            Equations
                                            Instances For

                                              The function symbols of a presentation (the set F, written as grammar rules).

                                              Equations
                                              Instances For

                                                The equations of a presentation (the set E).

                                                Equations
                                                Instances For

                                                  The named rewrite rules of a presentation (the GSLT reduction rules).

                                                  Equations
                                                  Instances For

                                                    The references map of a presentation (declared prefix to sub-presentation).

                                                    Equations
                                                    Instances For

                                                      The empty presentation: no exports, terms, equations, rewrites, or references. Mirrors BasePresOps.empty.

                                                      Equations
                                                      Instances For