• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • Proof-checker-array
      • Soft
      • C
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Leftist-trees
      • Java
      • Riscv
      • Taspi
      • Bitcoin
      • Des
      • Ethereum
      • X86isa
      • Sha-2
      • Yul
      • Zcash
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Poseidon
      • Where-do-i-place-my-book
      • Axe
      • Aleo
        • Aleobft
        • Aleovm
        • Leo
          • Grammar
          • Early-version
            • Json2ast
            • Testing
            • Definition
              • Flattening
              • Abstract-syntax
              • Dynamic-semantics
                • Execution
                • Values
                • Dynamic-environments
                • Arithmetic-operations
                  • Integer-arithmetic-operations
                  • Field-arithmetic-operations
                  • Scalar-field-arithmetic-operations
                  • Group-arithmetic-operations
                  • Op-mul
                  • Op-add
                  • Op-sub-wrapped
                  • Op-sub
                  • Op-rem-wrapped
                  • Op-pow-wrapped
                  • Op-pow
                  • Op-mul-wrapped
                  • Op-div-wrapped
                  • Op-div
                  • Op-add-wrapped
                  • Op-rem
                  • Op-square-root
                  • Op-square
                  • Op-neg
                  • Op-inv
                  • Op-double
                  • Op-abs-wrapped
                  • Op-abs
                • Curve-parameterization
                • Shift-operations
                • Errors
                • Value-expressions
                • Locations
                • Input-execution
                • Edwards-bls12-generator
                • Equality-operations
                • Logical-operations
                • Program-execution
                • Ordering-operations
                • Bitwise-operations
                • Literal-evaluation
                • Type-maps-for-struct-components
                • Output-execution
                • Tuple-operations
                • Struct-operations
              • Compilation
              • Static-semantics
              • Concrete-syntax
      • Bigmems
      • Builtins
      • Execloader
      • Solidity
      • Paco
      • Concurrent-programs
      • Bls12-377-curves
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • Math
    • Testing-utilities
  • Dynamic-semantics

Arithmetic-operations

Leo arithmetic operations.

These operate on integers, field elements, and group elements. But not every operator operates on all these types of values.

Since field operations depends on a prime number and group operations depend on an elliptic curve. The `curve` argument in the following functions is a unit type that is used to look up the prime and elliptic curve; see curve-parameterization.

For an operation that comes in non-wrapped and -wrapped forms, the non-wrapped form can get an error due to an overflow but the wrapped form will not. The exact handling of overflow values depends on the operation.

Subtopics

Integer-arithmetic-operations
Leo integer arithmetic operations.
Field-arithmetic-operations
Leo field arithmetic operations.
Scalar-field-arithmetic-operations
Leo scalar field arithmetic operations.
Group-arithmetic-operations
Leo group arithmetic operations.
Op-mul
Leo multiplication operation.
Op-add
Leo addition operation.
Op-sub-wrapped
Leo wrapping subtraction operation.
Op-sub
Leo subtraction operation.
Op-rem-wrapped
Leo wrapping remainder operation.
Op-pow-wrapped
Leo wrapping exponentiation operation.
Op-pow
Leo exponentiation operation.
Op-mul-wrapped
Leo wrapping multiplication operation.
Op-div-wrapped
Leo wrapping division operation.
Op-div
Leo division operation.
Op-add-wrapped
Leo wrapping addition operation.
Op-rem
Leo remainder operation.
Op-square-root
Leo square root operation.
Op-square
Leo squaring operation.
Op-neg
Leo negation operation.
Op-inv
Leo inverse (reciprocal) operation.
Op-double
Leo double operation.
Op-abs-wrapped
Leo wrapped absolute value operation.
Op-abs
Leo absolute value operation.