Documentation

Cvc.Spec.Decl

The op% specification command #

op% declares one entry of the term-creation specification. An entry is written in the typed form and registered in Cvc.opSpecExt; nothing is generated at the declaration site.

/-- Binary conjunction. -/
op% and (lft rgt : bool) : bool := AND unit true

/-- Binary equality. -/
op% equal {α} (lft rgt : α) : bool := EQUAL unit true

/-- Binary addition. -/
op% add {α : IsArith} (lft rgt : α) : α := ADD unit 0

/-- Binary subtraction. -/
op% sub {α : IsArith} (lft rgt : α) : α := SUB nary

/-- Bit-vector concatenation. -/
op% bvConcat {n m : size} (lft : bitVec n) (rgt : bitVec m) : bitVec (n + m) := BITVECTOR_CONCAT

Binders are {α} for a plain type variable, {α : Class, …} for one constrained by refinement classes, and {n : size} for a size variable. Square brackets ahead of the binders declare operator indices, the Nats SMT-LIB writes as (_ extract hi lo):

/-- The bit range `[lo, hi]`, both bounds included. -/
op% bvExtract [hi lo] {n : size} (bv : bitVec n) : bitVec (hi - lo + 1) := BITVECTOR_EXTRACT

Indices become explicit Nat arguments ahead of the term arguments and may appear in the result's sort; size variables stay implicit and are inferred from the arguments.

Sort shapes reuse Lean's term syntax and are interpreted structurally, so no new tokens are reserved: an application head names a shape constructor (bitVec, float, finiteField, seq, set, bag, array, fn), a bare identifier is either a sort atom (bool, int, real, string, regex, roundingMode) or a variable.

The trailing nary generates the N variant, and unit <literal> generates both N and N', the latter defaulting on zero- and one-element arrays.

Syntax categories introduced here use (behavior := symbol) so that their leading identifiers are not reserved as keywords for every downstream module.

Operator indices, written like SMT-LIB's (_ extract hi lo).

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

    Binder for a type or size variable.

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

      Group of arguments sharing a sort shape.

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

        Group of value parameters sharing a Lean type, written (name :! Type).

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

          N-ary generation policy.

          Declared with behavior := symbol so that the leading identifiers are not reserved as keywords globally, which would shadow the nary/unit field names.

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

              Generate the N variant, which takes a term array with at least two elements.

              Equations
              Instances For

                As nary, naming the variant, for when <id>N is not the right name.

                Equations
                Instances For

                  Generate the N and N' variants, the latter defaulting on 0- and 1-element arrays.

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

                      How the term is built, when applying its kind is not how.

                      Declared with behavior := symbol so that tm is not reserved as a keyword globally.

                      Equations
                      Instances For

                        Build the term with the named TermManager method rather than by applying the kind.

                        Equations
                        Instances For

                          As tm, naming the shape whose sort the method takes, for the methods that do not take the sort of the term they build.

                          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

                              Surface notation for the smt! DSL.

                              infixl/infixr/prefix are already Lean tokens, so naming them here reserves nothing new.

                              Equations
                              Instances For

                                Left-associative infix notation, at the given precedence.

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

                                  Right-associative infix notation, at the given precedence.

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

                                    Prefix notation, at the given rule and argument precedences.

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

                                      Everything needed to generate the typed and untyped constructors for one term kind.

                                      The entry is keyed by id, the name of the generated function; kind is the cvc5.Kind constructor the term is built with, and is checked to exist when the entry is declared.

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

                                        Interprets term syntax as a size expression.

                                        Interprets term syntax as a sort shape.

                                        Interprets term syntax as the unit element of an n-ary operator.

                                        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