• Stars
    star
    118
  • Rank 299,923 (Top 6 %)
  • Language
    OCaml
  • License
    BSD 2-Clause "Sim...
  • Created over 12 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Real number computation software

Marshall

Marshall is a programming language for exact real arithmetic based on ideas from Abstract Stone Duality (ASD) and the construction of the Dedekind reals in ASD. See also Andrej Bauer's talk on Efficient computations with Dedekind reals.

The main idea of Marshall is that a real number x is given as a Dedekind cut, i.e., as a pair of predicates describing which numbers are smaller than x and which ones larger. For example, the sqrt function is defined in Marshall as

let sqrt =
  fun a : real =>
    cut x
      left  (x < 0 \/ x * x < a)
      right (x > 0 /\ x * x > a)

See example.asd for more examples.

Prerequisites

To compile Marshall you will need Ocaml, version 4.12 or later, the OCaml dune build system, the menhir parser generator, and the large number library num. The best way to obtain these is to use the OCaml package manager opam. Once you have got OPAM going, run

opam install dune menhir num

Optionally, you may install the rlwrap or ledit command-line editing wrappers. Marshall will use them automatically in the interactive mode.

Compilation

Compilation should run smoothly or not at all. Type

dune build

If all goes well, an executable marshall.exe will appear in the main directory.

Examples

There are examples in the example subdirectory. It may be instructive to look at prelude.asd.

A small Haskell implementation

In etc/haskell you can find a small Haskell implementation of real numbers that somewhat follows the ideas of Marshall. It was implemented as part of a graduate course on computable topology in 2009 at the Faculty of Computer Science and Informatics, University of Ljubljana. Of particular help might be the notes etc/haskell/notes.tex.

Compiling with MPFR

In theory Marshall can be compiled with the MPFR library, but the current configuration is not set up to use it. If you manage to do it in a nice way, please contact us. Here are some obsolete instruction that may or may not work:

  1. Install mpfr through OPAM, as well as its dependencies.
  2. Add mpfr as a dependency to dune-project.
  3. Change src/main.ml so that it uses the MPFR interval arithmetic instead of Big_num.

More Repositories

1

plzoo

Programming Languages Zoo
OCaml
1,451
star
2

homotopy-type-theory-course

A course on homotopy theory and type theory, taught jointly with Jaka Smrekar
TeX
276
star
3

spartan-type-theory

Spartan type theory
OCaml
249
star
4

Homotopy

Homotopy theory in Coq.
Verilog
90
star
5

coop

A prototype programming language for programming with runners
OCaml
88
star
6

alg

Alg is a program that generates all finite models of a first-order theory. It is optimized for equational theories.
OCaml
83
star
7

notes-on-realizability

Lecture notes on realizability
TeX
65
star
8

mathematics-and-computation

Andrej Bauer's blog "Mathematics and Computation"
Mathematica
47
star
9

what-is-algebraic-about-algebraic-effects

TeX
46
star
10

social-distancing-simulator

An artificial simulation of social distancing in the time of an epidemic.
HTML
29
star
11

clerical

Command-like expressions for real infinite-precision calculations
OCaml
22
star
12

miniLCF

A bare-bones LCF-style proof assistant
OCaml
21
star
13

higher-rank-syntax

Agda
16
star
14

simple-random-art

A simple implementation of Random art in Python. Suitable for teaching and experiments.
Python
16
star
15

repl-in-browser

Implementation of a language interpreter in the browser, using js_of_ocaml.
OCaml
15
star
16

mathematical-stories

Mathematical stories
13
star
17

hydra

The combinatorial Hydra game
Java
12
star
18

kmeans

A demonstration of Ocaml modules & functors for machine learning.
OCaml
11
star
19

zeroes

Programs for computing beautiful pictures and animations of zeroes of polynomials.
Python
11
star
20

rz

A tool for automatic generation of specifications based on realizability theory
TeX
9
star
21

dependent-type-theory-syntax

An Agda formalization of raw syntax for dependent type theory
Agda
8
star
22

ppj-skripta

Zapiski pri predmetu Principi programskih jezikov
OCaml
7
star
23

formalized-mathematics-in-lean

A graduate course on formalized mathematics at the Faculty of Mathematics and Physics, University of Ljubljana, Fall semester 2024/25
Shell
7
star
24

costa-surface

Triangulation of Costa's minimal surface with normals, suitable for PovRay rendering
Python
6
star
25

slack-to-discord

Transfer Slack archives to a Discord server on a per-channel basis
Python
6
star
26

ucbenik-logika-in-mnozice

Učbenik za predmet Logika in množice na Fakulteti za matematiko in fiziko, Univerza v Ljubljani
TeX
6
star
27

lvr-sat

SAT solver (for teaching purposes in the course Logic in computer science)
OCaml
5
star
28

lvr-coq

Coq related material for the Logic in computer science course
Coq
4
star
29

lean2sexp

Convert Lean .olean files to s-expressions
Lean
3
star
30

the-daily-algebra

The daily algebra fact.
3
star
31

jurij

A simple Python application for drawing graphs, useful for teaching and experiments.
Python
2
star
32

backup

Remote backups using ssh and rsync.
Perl
2
star
33

TopologyPrimerTest

A test before showing a Lean project to students
TeX
1
star