Documentation

Blaster.Optimize.Rewriting.OptimizeNat

Apply the following simplification/normalization rules on Nat.add :

  • 0 + n ==> n
  • N1 + N2 ===> N1 "+" N2
  • N1 + (N2 + n) ==> (N1 "+" N2) + n
  • n1 + n2 ==> n2 + n1 (if n2 <ₒ n1) Assume that f = Expr.const ``Nat.add. An error is triggered when args.size ≠ 2 (i.e., only fully applied Nat.add expected at this stage)
Equations
  • One or more equations did not get rendered due to their size.
Instances For

    Apply the following simplification/normalization rules on Nat.sub :

    • n1 - n2 ==> 0 (if n1 =ₚₜᵣ n2)
    • 0 - n ==> 0
    • n - 0 ==> n
    • N1 - N2 ==> N1 "-" N2
    • N1 - (N2 + n) ==> (N1 "-" N2) - n
    • (N1 - n) - N2 ==> (N1 "-" N2) - n
    • (n - N1) - N2 ==> n - (N1 "+" N2)
    • (N1 + n) - N2 ==> (N1 "-" N2) + n (if N1 ≥ N2) Assume that f = Expr.const ``Nat.sub. An error is triggered when args.size ≠ 2 (i.e., only fully applied Nat.sub expected at this stage)
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      Equations
      Instances For
        Equations
        Instances For

          Apply the following simplification/normalization rules on Nat.pow :

          • n ^ 0 ==> 1
          • N1 ^ N2 ==> N1 "^" N2 Assume that f = Expr.const ``Nat.pow. An error is triggered when args.size ≠ 2 (i.e., only fully applied Nat.pow expected at this stage)
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Apply the following simplification/normalization rules on Nat.mul :

            • 0 * n ==> 0
            • 1 * n ==> n
            • N1 + N2 ==> N1 "*" N2
            • N1 * (N2 * n) ==> (N1 "*" N2) * n
            • n1 * n2 ==> n2 * n1 (if n2 <ₒ n1)
            • n * n^m ===> n ^ (m + 1) Assume that f = Expr.const ``Nat.mul. An error is triggered when args.size ≠ 2 (i.e., only fully applied Nat.mul expected at this stage)
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Given e1 and e2 corresponding to the operands for Nat.mul, return some e1^(m + 1) only when e2 := e1 ^ m

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

                Given e1 and e2 corresponding to the operands for Nat.div (i.e., e1 / e2), return some n only when one of the following conditions is satisfied:

                • e1 := m * n ∧ e2 = m ∧ (0 < m := _ ∈ hypothesisContext.hypothesisMap ∨ ¬ (0 = m) := _ ∈ hypothesisContext.hypothesisMap); or
                • e1 := n * m ∧ e2 = m ∧ (0 < m := _ ∈ hypothesisContext.hypothesisMap ∨ ¬ (0 = m) := _ ∈ hypothesisContext.hypothesisMap); Otherwise, return none.
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Given e1 and e2 corresponding to the operands for Nat.div (i.e., e1 / e2), return some 1 only when the following conditions are satisfied:

                  • e1 =ₚₜᵣ e2 ∧
                  • 0 < e1 := _ ∈ hypothesisContext.hypothesisMap ∨ ¬ (0 = e1) := _ ∈ hypothesisContext.hypothesisMap Otherwise, return none.
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    Apply the following simplification/normalization rules on Nat.div :

                    • n / 0 ==> 0
                    • n / 1 ==> n
                    • 0 / n ==> 0
                    • N1 / N2 ==> N1 "/" N2
                    • (n / N1) / N2 ==> n / (N1 "*" N2)
                    • (N1 * n) / N2 ===> ((N1 "/" Nat.gcd N1 N2) * n) / (N2 "/" Nat.gcd N1 N2) (if N2 > 0 ∧ Nat.gcd N1 N2 ≠ 1)
                    • n / n ==> 1 (if 0 < n := _ ∈ hypothesisContext.hypothesisMap ∨ ¬ (0 = n) := _ ∈ hypothesisContext.hypothesisMap)
                    • (m * n) / m | (n * m) / m ==> n (if 0 < m := _ ∈ hypothesisContext.hypothesisMap ∨ ¬ (0 = m) := _ ∈ hypothesisContext.hypothesisMap)

                    Assume that f = Expr.const ``Nat.div. An error is triggered when args.size ≠ 2 (i.e., only fully applied Nat.div expected at this stage)

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

                        Given e1 and e2 corresponding to the operands for Nat.mod (i.e., e1 % e2), return some 0 only when one of the following conditions is satisfied:

                        • e1 =ₚₜᵣ e2; or
                        • e1 := m * n ∧ e2 = m; or
                        • e1 := n * m ∧ e2 = m; Otherwise, return none.
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Apply the following simplification/normalization rules on Nat.mod :

                          • n % 0 ==> n
                          • n % 1 ==> 0
                          • 0 % n ==> 0
                          • N1 % N2 ==> N1 "%" N2
                          • (N1 * n) % N2 ==> 0 (if N1 % N2 = 0)
                          • n1 % n2 ==> 0 (if n1 =ₚₜᵣ n2)
                          • (m * n) % m | (n * m) % m ==> 0 Assume that f = Expr.const ``Nat.mod. An error is triggered when args.size ≠ 2 (i.e., only fully applied Nat.mod expected at this stage)
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For

                            Normalize Nat.beq x y to x == y only when option normalizeFunCall is set to true. Assume that f = Expr.const ``Nat.beq NOTE: This normalization rule is still required here mainly to properly handle the case where another rec function is equivalent to Nat.beq #

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

                              Normalize Nat.ble x y to decide' (x ≤ y) only when option normalizeFunCall is set to true. Assume that f = Expr.const ``Nat.ble NOTE: This normalization rule is still required here mainly to properly handle the case where another rec function is equivalent to Nat.beq

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

                                Apply simplification/normalization rules on Nat operators.

                                Equations
                                Instances For