Documentation

Cvc.Untyped.Theory.Regex

Generated Regex constructors, sort-erased #

Intersection.

Equations
Instances For
    def Cvc.Untyped.Term.reInterN [Ω] (terms : Terms) (atLeastTwoElements : 2 ≤ Array.size terms := by (try grind) <;> fail "failed to prove term array has at least two elements") :

    reInter over two or more terms.

    Equations
    Instances For
      def Cvc.Untyped.Term.reLoop [Ω] (lo hi : Nat) (re : Term) :

      Between lo and hi repetitions, both included.

      Equations
      Instances For
        def Cvc.Untyped.Term.reUnionN [Ω] (terms : Terms) (atLeastTwoElements : 2 ≤ Array.size terms := by (try grind) <;> fail "failed to prove term array has at least two elements") :

        reUnion over two or more terms.

        Equations
        Instances For

          Concatenation.

          Equations
          Instances For

            The regular expression matching every string.

            Equations
            Instances For

              The regular expression matching nothing.

              Equations
              Instances For

                Zero or one repetition.

                Equations
                Instances For
                  def Cvc.Untyped.Term.reConcatN [Ω] (terms : Terms) (atLeastTwoElements : 2 ≤ Array.size terms := by (try grind) <;> fail "failed to prove term array has at least two elements") :

                  reConcat over two or more terms.

                  Equations
                  Instances For

                    Difference: the strings matching lft but not rgt.

                    Equations
                    Instances For

                      Any one character from lo to hi included; matches nothing unless both are one character.

                      Equations
                      Instances For

                        Kleene star.

                        Equations
                        Instances For

                          One or more repetitions.

                          Equations
                          Instances For
                            def Cvc.Untyped.Term.reRepeat [Ω] (count : Nat) (re : Term) :

                            Exactly the given number of repetitions.

                            Equations
                            Instances For

                              Union.

                              Equations
                              Instances For

                                The regular expression matching every one-character string.

                                Equations
                                Instances For

                                  Takes a term apart one level, if Regex owns its operator.

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

                                    Regex's operators, taken apart one level, sort-erased.

                                    • reConcat [Ω] (kids : Kids) : View.Regex

                                      Concatenation.

                                      kids holds every operand, two or more.

                                    • reUnion [Ω] (kids : Kids) : View.Regex

                                      Union.

                                      kids holds every operand, two or more.

                                    • reInter [Ω] (kids : Kids) : View.Regex

                                      Intersection.

                                      kids holds every operand, two or more.

                                    • reDiff [Ω] (lft rgt : Term) : View.Regex

                                      Difference: the strings matching lft but not rgt.

                                    • reStar [Ω] (re : Term) : View.Regex

                                      Kleene star.

                                    • rePlus [Ω] (re : Term) : View.Regex

                                      One or more repetitions.

                                    • reOpt [Ω] (re : Term) : View.Regex

                                      Zero or one repetition.

                                    • reRange [Ω] (lo hi : Term) : View.Regex

                                      Any one character from lo to hi included; matches nothing unless both are one character.

                                    • reComplement [Ω] (re : Term) : View.Regex

                                      Complement.

                                    • reLoop [Ω] (lo hi : Nat) (re : Term) : View.Regex

                                      Between lo and hi repetitions, both included.

                                    • reRepeat [Ω] (count : Nat) (re : Term) : View.Regex

                                      Exactly the given number of repetitions.

                                    • reAll [Ω] : View.Regex

                                      The regular expression matching every string.

                                    • reAllChar [Ω] : View.Regex

                                      The regular expression matching every one-character string.

                                    • reNone [Ω] : View.Regex

                                      The regular expression matching nothing.

                                    Instances For

                                      Values #

                                      A regular expression has no Lean value: cvc5 exposes no accessor for the language a constant regex denotes, so Regex has no value conversions. Read a model's regex as a term, with Solver.getValue.

                                      regex! #

                                      Regular expressions in the notation they are usually written in, building the same terms as the re… constructors:

                                      regex! ['a'-'z' '_'] ['a'-'z' '0'-'9' '_']*     -- an identifier
                                      regex! digit+ ("." digit+)?                       -- `digit` a regex term in scope
                                      regex! ("ab" | "cd"){2,3} ∖ "abab"
                                      
                                      formmeaning
                                      "abc", 'a'the literal string, the literal character
                                      x, ![e]a regex term in scope, any Lean term of type Env Term
                                      ., ∅any single character, the empty language (.* is every string)
                                      ['a'-'z' '_'], [^ …]a character class: ranges and characters; its complement in .
                                      r*, r+, r?, r{n}, r{n,m}star, plus, option, exactly n, between n and m
                                      r sconcatenation
                                      ¬ rcomplement
                                      r ∩ s, r ∖ sintersection, difference
                                      r \| sunion

                                      Postfix operators bind tightest, then complement, then concatenation, then ∩/∖, then |, as in the usual notation. A literal string is Lean's, so escapes are Lean's and a "." is a dot, never "any character". No token is added that Lean does not already have.

                                      regex! is scoped in each layer, as smt! is: open Cvc.Untyped selects this one, which answers an Env Term; the typed one answers an Env (Term Regex).

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

                                        A regular expression, as regex! writes one.

                                        Equations
                                        Instances For

                                          An item of a character class: a character, or a range of them.

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

                                              A single character.

                                              Equations
                                              Instances For

                                                The characters from the first to the second, inclusive.

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

                                                  A literal string.

                                                  Equations
                                                  Instances For

                                                    A literal character.

                                                    Equations
                                                    Instances For

                                                      A regex term in scope.

                                                      Equations
                                                      Instances For

                                                        Any Lean term building a regex: Env Term, Env (Term Regex) typed.

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

                                                          Grouping.

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

                                                            Any single character.

                                                            Equations
                                                            Instances For

                                                              The empty language.

                                                              Equations
                                                              Instances For

                                                                A character class.

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

                                                                  A negated character class: any single character not in it.

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

                                                                    Exactly n.

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

                                                                      Between n and m, inclusive.

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

                                                                        Concatenation, by juxtaposition: flat, as application is in smt!.

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

                                                                          Intersection.

                                                                          Equations
                                                                          Instances For

                                                                            A sort-erased regex; regex! under open Cvc.Untyped.

                                                                            Equations
                                                                            Instances For

                                                                              A typed regex; regex! under open Cvc.Typed.

                                                                              Equations
                                                                              Instances For

                                                                                A sort-erased regex term, in Env, in the usual notation: regex! ['a'-'z']+ ("." | "_")?.

                                                                                Equations
                                                                                Instances For
                                                                                  partial def Cvc.Ext.expandRegex (layer : Layer) (stx : Lean.Syntax) :

                                                                                  Expands a regex! node into a term of the given layer, in Env.