-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: start working on the "tutorial"
- Loading branch information
Showing
17 changed files
with
266 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(documentation | ||
(package mugen)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{0 mugen: Universe Levels} | ||
|
||
{1 Links} | ||
|
||
{ul | ||
{- {{!page:quickstart} 🔰 Quickstart tutorial}} | ||
{- {{!module:Mugen} 📔 API reference}}} | ||
|
||
{1 What is "mugen"?} | ||
|
||
"mugen" is the transliteration of "無限" in Japanese, possibly a learned borrowing of "無限" from Chinese. It literally means "without limits", and is widely used in anime for the obvious reason. It is fitting in the context of universe polymorphism. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{0 Quickstart Tutorial} | ||
|
||
This tutorial is for an implementer (you!) to integrate this library into your type theory as quickly as possible. We will assume you are already familiar with OCaml and dependent type theory, and are using a typical OCaml package structure. | ||
|
||
{1 Introduction} | ||
|
||
A universe level expression in this library is represented as a pair of a variable together with a {i displacement}. For example, [x + 10] means the variable level [x] shifted by 10 levels. The "shifting of 10 levels" is a displacement in our terminology. While it looks limited to consider only a variable and a displacement, we proved that it is in a sense a universal scheme if you allow all mathematically possible displacements beyond natural numbers. We also call the minimum algebra of disablements that would make the scheme work a {i displacement algebra}. See our {{: https://doi.org/10.1145/3571250} POPL paper} for more details. | ||
|
||
This library implements several displacement algebras you could choose from, along with a uniform interface to construct and compare universe level expressions. | ||
|
||
{1 Choose Your Displacements} | ||
|
||
The first step is to choose your favorite {i displacements}. | ||
|
||
{1 Define Your Syntax} | ||
|
||
{1 Build Level Expressions} | ||
|
||
{1 Compare Level Expressions} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
type t = | ||
| Var of int | ||
| Univ of t | ||
| TpULvl | ||
| TpUnivLvl | ||
| Shift of t * int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
module ULvlShift = Mugen.Shift.Int | ||
module UnivLvlShift = Mugen.Shift.Int | ||
|
||
type t = | ||
type univ_lvl = (UnivLvlShift.t, t) Mugen.Syntax.endo | ||
|
||
and t = | ||
| Var of int | ||
| Univ of t | ||
| TpULvl | ||
| ULvl of (ULvlShift.t, t) Mugen.Syntax.endo | ||
| TpUnivLvl | ||
| UnivLvl of univ_lvl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module Endo = | ||
struct | ||
include BuilderSigs.Endo | ||
|
||
module Make (P : Param) : S with type shift := P.Shift.t and type level := P.level = | ||
struct | ||
include P | ||
open Syntax.Endo | ||
|
||
let top = level Top | ||
|
||
let shifted l s = | ||
match unlevel l with | ||
| Some Top -> invalid_arg "cannot shift the top level" | ||
| Some (Shifted (l, s')) -> | ||
let s = Shift.compose s' s in | ||
level @@ Shifted (l, s) | ||
| None -> | ||
level @@ Shifted (l, s) | ||
end | ||
end | ||
|
||
module Free = | ||
struct | ||
include BuilderSigs.Free | ||
|
||
module Make (P : Param) : S with type shift := P.Shift.t and type var := P.var = | ||
struct | ||
open Syntax.Free | ||
|
||
let var = var | ||
module P = struct | ||
include P | ||
type level = (Shift.t, var) Syntax.free | ||
let level t = Level t | ||
let unlevel t = match t with Level l -> Some l | _ -> None | ||
end | ||
|
||
include P | ||
include Endo.Make(P) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
(** Structured types used in this library *) | ||
module StructuredType : module type of StructuredType | ||
(** | ||
A gallary of | ||
*) | ||
|
||
(** {1 Gallery of Displacement Algebras} *) | ||
|
||
(** Displacement algebras *) | ||
module Shift : module type of Shift | ||
|
||
(** Displacement algebras with joins *) | ||
module ShiftWithJoin : module type of ShiftWithJoin | ||
|
||
(** Syntax of universe levels with displacements *) | ||
(** {1 Syntax of Level Expressions} *) | ||
|
||
(** Syntax of universe level expressions *) | ||
module Syntax : module type of Syntax | ||
|
||
(** Smart builders for universe level expressions *) | ||
module Builder : module type of Builder | ||
|
||
(** {1 Comparators of Level Expressions} *) | ||
|
||
(** Semantic operations for universe levels with displacements *) | ||
module Semantics : module type of Semantics | ||
module Theory : module type of Theory | ||
|
||
(**/**) | ||
|
||
(** Structured types used in this library *) | ||
module StructuredType : module type of StructuredType |
Oops, something went wrong.