Documentation

MeTTaIL.Theory.Ops

def MeTTaIL.distinct {α : Type} [BEq α] (xs : List α) :
List α

Keep the first occurrence of each element, dropping later duplicates. The analogue of Scala List.distinct.

Equations
Instances For

    Whether an item is a terminal (a literal token).

    Equations
    Instances For

      The non-terminal items of a rule: everything that is not a literal token, so plain non-terminals and the two binder forms. Mirrors Scala AddEqRwHelpers.nonTerminals, used for the arity and category-alignment checks on replacements.

      Equations
      Instances For

        The sort of a plain non-terminal item, and nothing for a terminal or a binder. This is the category Scala collects with collect { case nt: NTerminal => nt.cat_ } in handleConj, handleSubtract, and checkAddTerms; binder items are deliberately not counted, matching Scala.

        Equations
        Instances For

          The categories a function symbol mentions for the intersection and difference filters and the unknown-category check: its output sort and the sorts of its plain non-terminal items. Mirrors the set Set(rule.cat_) ++ {nterminal item cats} Scala builds in handleConj, handleSubtract, and checkAddTerms.

          Equations
          Instances For

            The head label of a term, if it is an applied constructor; nothing for a variable or a substitution.

            Equations
            Instances For

              The (top-level) labels appearing in an equation. Mirrors Scala labelsInEquation: it recurses through a freshness guard, and on each side takes only the head label (Scala's per-term labelsInAST is non-recursive).

              Equations
              Instances For

                Strip the premises (let h in ...) of a rewrite to its conclusion lhs ~> rhs. Mirrors ASTHelpers.rewriteBase.

                Equations
                Instances For

                  The (top-level) labels appearing in a rewrite's conclusion.

                  Equations
                  Instances For

                    Union of two presentations: concatenate each component and keep first occurrences. Mirrors handleDisj (the \/ operator), which builds a fresh presentation with empty references (as the intersection and difference operators do).

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

                      Intersection of two presentations, filtered to common sorts and surviving labels. Mirrors handleConj (the /\ operator): keep sorts in both; keep defs in both whose mentioned categories are all common; keep equations/rewrites in both whose labels all survive.

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

                        Difference of two presentations. Mirrors handleSubtract (the \ operator): remove pb's sorts; drop defs that are in pb or that mention a removed sort; keep equations/rewrites not in pb whose labels all survive.

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

                          The base identifier of a dotted path: the variable name it heads. A premise src ~> tgt binds tgt's base identifier.

                          Equations
                          Instances For

                            The premises (the let h in ... hypotheses) of a rewrite, outermost first.

                            Equations
                            Instances For