Documentation

Blaster.Optimize.Rewriting.Utils

Return true if n corresponds to an unsafe definition (e.g, partial recursive function, partial inductive predicate, etc).

Equations
Instances For

    Return true if e corresponds to an enumerator constructor (i.e., constructor without any parameters).

    Equations
    Instances For

      Return true if e corresponds to a nullary constructor or a fully applied parametric constructor.

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

        Return true if e corresponds to a constructor that may contain free or bounded variables.

        Equations
        Instances For
          @[inline]

          Return true if e corresponds to a constructor applied to only constant values (e.g., no free or bounded variables).

          Equations
          Instances For

            Return true if c corresponds to a nullary constructor.

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

              Return true if t is not a Prop and corresponds to one of the following:

              • is a sort type; or
              • is a class constraint; or
              • is an inductive type for which either at least one nullary constructor or an Inhabited instance exists. TODO: extends check to also consider parametric constructor for which each parameter type satisfy isSortOrInhabited.
              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Return ! e when b = false. Otherwise return e.

                Equations
                Instances For

                  Inductive type used to characterize Nat binary operators when at least one operand is a constant. This type is exclusively used by function toNatCstOpExpr?

                  Instances For

                    Return a NatCstOpInfo for e according to the following rules:

                    • NatAddExpr N n (if e := Nat.add N n)
                    • NatSubLeftExpr N n (if e := Nat.sub N n)
                    • NatSubRightExpr n N (if e := Nat.sub n N)
                    • NatMulExpr N n (if e := Nat.mul N n)
                    • NatDivLeftExpr N n (if e := Nat.div N n)
                    • NatDivLeftExpr n N (if e := Nat.div n N)
                    • NatModLeftExpr N n (if e := Nat.mod N n)
                    • NatModRightExpr n N (if e := Nat.mod n N)

                    Return none when e is not a full applied Nat binary operator. Assume that operands have already been reordered for commutative operators.

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

                      Inductive type used to characterize Int binary operators when at least one operand is a constant. This type is exclusively used by function toIntCstOpExpr?

                      Instances For

                        Return a IntCstOpInfo for e according to the following rules:

                        • IntAddExpr N n (if e := Int.add N n)
                        • IntMulExpr N n (if e := Int.mul N n)
                        • IntTDivLeftExpr N n (if e := Int.tdiv N n)
                        • IntTDivLeftExpr n N (if e := Int.tdiv n N)
                        • IntTModLeftExpr N n (if e := Int.tmod N n)
                        • IntTModRightExpr n N (if e := Int.tmod n N)
                        • IntEDivLeftExpr N n (if e := Int.ediv N n)
                        • IntEDivLeftExpr n N (if e := Int.ediv n N)
                        • IntEModLeftExpr N n (if e := Int.emod N n)
                        • IntEModRightExpr n N (if e := Int.emod n N)
                        • IntFDivLeftExpr N n (if e := Int.fdiv N n)
                        • IntFDivLeftExpr n N (if e := Int.fdiv n N)
                        • IntFModLeftExpr N n (if e := Int.fmod N n)
                        • IntFModRightExpr n N (if e := Int.fmod n N)
                        • IntNegAddExpr N n (if e := Int.neg (Int.add N n))

                        Return none when e is not a full applied Int binary operator. Assume that operands have already been reordered for commutative operators.

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

                            Reorder operands for commutative Bool operators as follows:

                            • #[``false, _] ===> args
                            • #[e,false] ===> #[false, e]
                            • #[``true, _] ===> args
                            • #[e true] ===> #[true, e]
                            • #[fvar id1, fvar id2] ===> #[fvar id2, fvar id1] (if id2.name < id1.name)
                            • #[fvar _, _] ===> args
                            • #[e, fvar id] ===> #[fvar id, e]
                            • #[e1, e2] ===> #[e2, e1] (if isTaggedRecursiveCall e1 ∧ ¬ (isTaggedRecursiveCall e2))
                            • #[e1, e2] ===> #[e2, e1] (if e2 < e1)
                            • #[not e, e] ===> #[e, not e]
                            • #[e1, e2] ===> args Assume that args.size = 2
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              @[inline]

                              Reorder operands for commutative Prop operators as follows:

                              • #[``False, _] ===> args
                              • #[e,False] ===> #[False, e]
                              • #[True, _] ===> args
                              • #[e True] ===> #[True, e]
                              • #[fvar id1, fvar id2] ===> #[fvar id2, fvar id1] (if id2.name < id1.name)
                              • #[fvar _, _] ===> args
                              • #[e, fvar _] ===> #[fvar _, e]
                              • #[¬ e, e] ===> #[e, ¬ e]
                              • #[false = c, true = c] ===> #[true = c, false = c]
                              • #[e1 -> e2, e1] ===> #[e1, e1 -> e2]
                              • #[e1, e2] ===> #[e2, e1] (if isTaggedRecursiveCall e1 ∧ ¬ (isTaggedRecursiveCall e2))
                              • #[e1, e2] ===> #[e2, e1] (if e2 < e1)
                              • #[e1, e2] ===> args Assume that args.size = 2
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                @[inline]

                                Reorder operands for Eq operators by applying reorderPropOp first and followed by the rules:

                                • #[Expr.lit _, _] ===> args
                                • #[e, Expr.lit l] ===> #[Expr.lit l, e]
                                • #[e1, e2] ===> args (if isConstructor e1) -- already ordered by reorderPropOp
                                • #[e1, e2] ===> #[e2, e1] (if isConstructor e2)
                                • #[e1, e2] ===> args Assume that args.size = 2 NOTE: Precedence is applied according to the order in which the rules have been specified.
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  @[inline]

                                  Reorder operands for commutative Int operators as follows:

                                  • #[N1, N2] ===> args
                                  • #[N, e] ===> args
                                  • #[e, N] ===> #[N, e]
                                  • #[fvar id1, fvar id2] ===> #[fvar id2, fvar id1] (if id2.name < id1.name)
                                  • #[fvar _, _] ===> args
                                  • #[e, fvar _] ===> #[fvar _, e]
                                  • #[(Nat.sub x y), (Nat.add p q)] ===> #[Nat.add p q, Nat.sub x y]
                                  • #[(Nat.pow x y), e] ===> #[e, Nat.pow x y] if ¬ (isNatPowExpr e)
                                  • #[e1, e2] ===> #[e2, e1] (if isTaggedRecursiveCall e1 ∧ ¬ (isTaggedRecursiveCall e2))
                                  • #[e1, e2] ===> #[e2, e1] (if e2 < e1)
                                  • #[e1, e2] ===> args Assume that args.size = 2
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    @[inline]

                                    Reorder operands for commutative Int operators as follows:

                                    • #[N1, N2] ===> args
                                    • #[N, e] ===> args
                                    • #[e, N] ===> #[N, e]
                                    • #[fvar id1, fvar id2] ===> #[fvar id2, fvar id1] (if id2.name < id1.name)
                                    • #[fvar _, _] ===> args
                                    • #[e, fvar _] ===> #[fvar _, e]
                                    • #[Int.neg x, x] ===> #[x, Int.neg x]
                                    • #[e1, e2] ===> #[e2, e1] (if isTaggedRecursiveCall e1 ∧ ¬ (isTaggedRecursiveCall e2))
                                    • #[e1, e2] ===> #[e2, e1] (if e2 < e1)
                                    • #[e1, e2] ===> args Assume that args.size = 2
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For

                                      Reorder operands for commutative operators

                                      Equations
                                      Instances For

                                        Return true if e corresponds t a casesOn function.

                                        Equations
                                        Instances For
                                          Equations
                                          Instances For

                                            Return true if the given type expression t (e.g., obtained via inferType) satisfy the following:

                                            • t := α₁ → ... → αₙ Assumes that t is not a Prop.
                                            Equations
                                            Instances For

                                              Return true if the given type expression t (e.g., obtained via inferType) satisfy the following:

                                              • ¬ isProp t
                                              • t := α₁ → ... → αₙ
                                              Equations
                                              Instances For
                                                @[inline]

                                                Same as getFunBodyAux? but cache result

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

                                                  Return true if e corresponds to an undefined type class function application, s.t.:

                                                  • e := app (Expr.proj c _ _) ...; and
                                                  • c is the name of a type class in the given environment; and
                                                  • Expr.proj c _ _ cannot be reduced.
                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For

                                                    Return true only when e := Expr.const n l and one of the following condition is satisfied:

                                                    • n := namedPattern; or
                                                    • n is a class instance; or
                                                    • n is a match expression; or
                                                    • n is a class constraint; or
                                                    • n is an inductive datatype ∧ n ∉ opaqueFuns;
                                                    Equations
                                                    Instances For

                                                      Same as isNotFunAux but caches the result.

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

                                                        Return true only when e := Expr.const n l and one of the following condition is satisfied:

                                                        • n is not tagged as an opaque definition when flag opaqueCheck is set to true;
                                                        • n is not a recursive function when flag recFunCheck is set to true;
                                                        • n is a class instance;
                                                        • n is an inductive datatype;
                                                        • n := namedPattern;
                                                        • n is not a match expression; or
                                                        • n is not a class constraint.
                                                        Equations
                                                        Instances For

                                                          Unfold fuction f w.r.t. the effective parameters args only when:

                                                          • f is not a constructor
                                                          • f is not tagged as an opaque definition
                                                          • f is not a recursive function
                                                          • f is not a class constraint
                                                          • f is not an undefined type class function
                                                          • f is not a match application
                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For

                                                            Unfold an opaque relation function up to its base definition Assume that f corresponds to an opaque relation function on first call.

                                                            Return true when the following conditions are satisfied:

                                                            • f is an opaque relation function
                                                            • f has a sort parameter not in relationalCompatibleTypes
                                                            • f is an alias to a well-founded recursive definition.
                                                            Equations
                                                            Instances For

                                                              Trigger an error if e contains at least one theorem with sorry demonstration.

                                                              Given pType := λ α₁ → .. → λ αₙ → t returns λ α₁ → .. → λ αₙ → eType This function is expected to be used only when updating a match return type

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