Context definitions

This book contains various Leibniz contexts, both as examples for studying and as foundations to build on.

A few contexts rely on support from the Leibniz run-time system, in particular for implementing data types such as numbers, character strings, and arrays. But most of these contexts are plain Leibniz code. Leibniz authors are encouraged to use them for inspiration rather than as an official standard library to re-use as-is. Readability for humans is the top priority for Leibniz, and that implies that superfluous code should be avoided. Fine-tune all definitions to the requirements of your own work!

Foundations

Sorts

Contravariant sort parameters

Logic

Logical truth, Boolean algebra, Term equality

Numbers

Integers, Rational numbers, Real numbers, Floating-point numbers

Integer intervals, Integer grids, Real number grids

Functions

Functions, Functions of several arguments, Function combinators

Pipeline notation for functions

Textual data

Character strings

Aggregate data structures

Tuples, Tuple items

Arrays, One-dimensional arrays, Array size, Array flattening

One-dimensional array indexation, One-dimensional array slicing, Function application to one-dimensional arrays, Reduction over one-dimensional arrays, One-dimensional index arrays, Algorithmic construction of one-dimensional arrays, Element selection from one-dimensional arrays, Function-based selection from one-dimensional arrays

Two-dimensional arrays, Two-dimensional array indexation Two-dimensional array slicing

Syntax

Subscript tags

Mathematics

Functions

Real-valued functions of one variable, Derivatives of real functions of one variable

Real functions of two real variables

Specific functions

Absolute value, Absolute value function

Differential equations

Euler method

Simulation support

Pseudo-randomness, Random integers, Random binary choice

Tools

Tool interfacing

Term classes, Snippets, Python code

Tools

Plotting

Solving recurrence equations

Workflows

Examples

Heron's algorithm for computing square roots

Lotka-Volterra equations

The Sakoda-Schelling checkerboard model for racial segregation

Sunspot detection