Documentation

LeanUnits.Framework.Dimensions.PrimeScale

Encode a string to ℕ Making sure the encoding is injective.

Equations
Instances For
    @[irreducible]

    Helper function to get the digits of a natural number in base 2^32.

    Equations
    Instances For

      Get the next Nat.Primes after n.

      Equations
      Instances For

        Get the n-th Nat.Primes (0-indexed). For example, nth_prime 0 = 2, nth_prime 1 = 3, nth_prime 2 = 5, etc.

        Equations
        Instances For

          Get the n-th Nat prime number (0-indexed). For example, nth_prime 0 = 2, nth_prime 1 = 3, nth_prime 2 = 5, etc.

          Equations
          Instances For

            Get the prime number associated to a string. This allows us to assign a unique prime number to each base dimension represented by a string. We use it to construct the PrimeScale of a dimension.

            Equations
            Instances For
              noncomputable def Units.Dimension.PrimeScale.prime_pow (s : String) (q : ) :

              Compute the prime expnentiation for a given string and rational number. It's used to compute the PrimeScale of a dimension.

              Equations
              Instances For
                theorem Units.Dimension.PrimeScale.prime_pow_inj_left (s1 s2 : String) (q : ) (h : q 0) :
                prime_pow s1 q = prime_pow s2 q s1 = s2

                prime_pow injective if q≠0

                For a fixed base (prime_from_str s : ℝ) > 1, the map q ↦ prime_pow s q is injective on ℚ.

                theorem Units.Dimension.PrimeScale.prime_pow_inj_nat (s1 s2 : String) {n1 n2 : } (h1 : n1 0) (h2 : n2 0) :
                prime_pow s1 n1 = prime_pow s2 n2 s1 = s2 n1 = n2
                theorem Units.Dimension.PrimeScale.prime_pow_inj_int (s1 s2 : String) {z1 z2 : } (h1 : z1 0) (h2 : z2 0) :
                prime_pow s1 z1 = prime_pow s2 z2 s1 = s2 z1 = z2
                theorem Units.Dimension.PrimeScale.prime_pow_inj (s1 s2 : String) {q1 q2 : } (h1 : q1 0) (h2 : q2 0) :
                prime_pow s1 q1 = prime_pow s2 q2 s1 = s2 q1 = q2
                theorem Units.Dimension.PrimeScale.prime_pow_mul_prime_pow_eq_one_iff {s1 s2 : String} {q1 q2 : } :
                prime_pow s1 q1 * prime_pow s2 q2 = 1 s1 = s2 q1 = -q2 q1 = 0 q2 = 0
                theorem Units.Dimension.PrimeScale.diff_prime_pow_mul_prime_pow_eq_one_iff {s1 s2 : String} {q1 q2 : } (h : s1 s2) :
                prime_pow s1 q1 * prime_pow s2 q2 = 1 q1 = 0 q2 = 0
                theorem Units.Dimension.PrimeScale.prod_prime_pow_eq_one_iff (S : Finset String) (q : String) :
                sS, prime_pow s (q s) = 1 sS, q s = 0