Documentation

Cvc.Gen.TypedView

Generating typed views #

A theory's typed view is indexed by the sort it takes apart: Cvc.Typed.View.Arith : Typ → Type. It is built in two layers.

The viewer, View.Arith.of, converts the theory's sort-erased view: that has read the kind, the kids and the indices, and the typed view adds what the sort adds — the sort fields, read off the kids, and the proofs. It answers none where it cannot: a kid whose sort no Typ describes, a sort that does not fit the operator.

Emitted names #

Built with mkIdent and spliced, never written in a quotation: a name written there resolves against this module's environment, which imports neither layer.

Sorts with a view #

A sort a part produces, or a wrapper views.

  • name : Lean.Name

    The head's name: bool, bitVec, set, …, or any for every sort.

  • wrapper : String

    The wrapper's name: Bool, BitVec, Set, …, Any.

  • params : Array (Lean.TSyntax `Lean.Parser.Term.bracketedBinder)

    The part's (and wrapper's) parameters.

  • Those parameters as arguments, instances excluded.

  • allArgs : Array Lean.Term

    Every parameter as an argument, a hole for each instance: what an @-application passes.

  • target : Lean.Term

    The Lean type of the terms it views.

  • valueKind : Option Lean.Name

    The kind of its values, which the wrapper's .value leaf reads.

  • ordered : Array Lean.Name

    The parameters that carry an Ord instance.

Instances For
    def Cvc.TypedView.Head.plain (name : Lean.Name) (wrapper : String) (target : Lean.Name) (valueKind : Option Lean.Name) :

    A head with no parameters.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def Cvc.TypedView.sizeParam (x : Lean.Ident) :
      Lean.MacroM (Array (Lean.TSyntax `Lean.Parser.Term.bracketedBinder))

      A size parameter's binder.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Cvc.TypedView.typeParam (x : Lean.Ident) (ord : Bool) :
        Lean.MacroM (Array (Lean.TSyntax `Lean.Parser.Term.bracketedBinder))

        A type parameter's binders: the type, its order if a container keys on it, and its sort.

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

          The heads this prototype supports. Parameters are named apart from every specification's variables, so that a result's own variable can be unified with one.

          Equations
          Instances For
            def Cvc.TypedView.implicitBinders (bs : Array (Lean.TSyntax `Lean.Parser.Term.bracketedBinder)) :
            Lean.MacroM (Array (Lean.TSyntax `Lean.Parser.Term.bracketedBinder))

            The same binders with every explicit one made implicit, for a function whose parameters are determined by its argument's type.

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

              A component of a result that one of its head's parameters stands for.

              Instances For

                The Typ predicate a refinement class stands for.

                Equations
                Instances For

                  Rendering kids #

                  How each variable of an entry is bound in its constructor.

                  Instances For

                    Renders a size expression, arity excluded.

                    Renders a shape as a Typ, type variables being Typ fields or a parameter's Typ.of.

                    Renders a shape with no Typ field in it as the Lean type it denotes.

                    The index of a kid of this shape: the denotation of its Typ if a Typ field occurs in it, which reduces once the field is matched, and the Lean type it denotes otherwise.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      partial def Cvc.TypedView.bindIn (target : Lean.Name) (isSize : Bool) :

                      A pattern on a kid's Typ binding target where the shape mentions it, or none if it is not at a position a pattern can reach.

                      The theory views' heads #

                      How a part's head appears in the sort-indexed view.

                      • fields : Array (Lean.TSyntax `Lean.Parser.Term.bracketedBinder)

                        The theory constructor's fields ahead of the part.

                      • fieldArgs : Array Lean.Term

                        The arguments for those fields.

                      • partArgs : Array (Lean.TSyntax `Lean.Parser.Term.namedArgument)

                        The part's parameters, as named arguments.

                      • index : Lean.Term

                        The sort the theory constructor is indexed by.

                      • pattern : Lean.Term

                        A pattern on a node's sort matching the head, binding the fields.

                      • implicits : Array (Lean.TSyntax `Lean.Parser.Term.bracketedBinder)

                        The abbreviations' binders standing for the fields.

                      • ordered : Option Lean.Ident

                        The field whose denotation must be ordered, for the containers keyed on it.

                      Instances For

                        A part's head in the sort-indexed view.

                        Equations
                        Instances For

                          The registry #

                          A typed view's constructor, as the aggregate's abbreviations need it.

                          • name : Lean.Name

                            The operator's name, which its abbreviation takes.

                          • For a generated view, the part holding the operator and the part's head; none for a hand-written view, whose constructors are the theory view's own.

                          Instances For

                            A registered typed view.

                            Instances For

                              Every registered typed view.

                              Equations
                              Instances For

                                A theory's typed view #

                                One entry's constructor in its part, and the theory viewer's alternative for it.

                                Instances For

                                  Whether an entry's kids are an n-ary array: an n-ary entry over two arguments of one shape.

                                  Equations
                                  Instances For
                                    def Cvc.TypedView.genCtor (spec : OpSpec) (theory untyped part : Lean.Name) (head : Head) :

                                    Generates an entry's constructor in its part, and the alternative converting its sort-erased constructor — or why it cannot be. theory names the theory view, untyped the sort-erased one.

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

                                      A part's name: Cvc.Typed.View.Arith.OnBool.

                                      Equations
                                      Instances For

                                        Generates and registers a theory's typed view from its specification module.

                                        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

                                            Registers a hand-written typed view: its theory view, whose constructors are the operators, and each with the kind it owns. The theory is the view's last component.

                                            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

                                                The typed aggregate #

                                                Generates the typed aggregate V : Typ → Type from every registered typed view.

                                                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

                                                    Declares V : Typ → Type, a term of sort τ taken apart one level, over every theory imported.

                                                    V.of τ t takes t apart; a match on the sort and the view together refines both (| .int, .add kids gives kids : Kids Int). Besides the operators, V has the leaves .value, .symbol and .bvar, and .other for a term no imported theory takes apart. Needs variable [Ω] in scope.

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