v0.2.0
This version was a complete rewrite of the proof assistant, using a new parser, a new internal representation, and a rewrite of the typechecking logic. This is still a prototype, but, arguably, significantly more stable and manageable than version 0.1.0.
Online documentation with a playground: https://fizruk.github.io/rzk/v0.2.0/
Language
Syntax is almost entirely backwards compatible with version 0.1.0.
Typechecking has been fixed and improved.
Breaking Changes
The only known breaking changes are:
- Terms like
second x y
which previous have been parsed assecond (x y)
now are properly parsed as(second x) y
. - It is now necessary to have at least a minimal indentation in the definition of a term after a newline.
- Unicode syntax is temporarily disabled, except for dependent sums and arrows in function types.
- The restriction syntax
[ ... ]
now has a slightly different precedence, so some parentheses are required, e.g. in(A -> B) [ phi |-> f]
or(f t = g t) [ phi |-> f]
. - Duplicate top-level definitions are no longer allowed.
Deprecated Syntax
The angle brackets for extension types are supported, but deprecated,
as they are completely unnecessary now: <{t : I | psi t} -> A t [ phi t |-> a t ]>
can now be written as {t : I | psi t} -> A t [ phi t |-> a t]
or even (t : psi) -> A t [ phi t |-> a t ]
.
Syntax Relaxation
Otherwise, syntax is now made more flexible:
-
Function parameters can be unnamed:
A -> B
is the same as(_ : A) -> B
. -
Angle brackets are now optional:
{t : I | psi t} -> A t [ phi t |-> a t ]
-
Nullary extension types are possible:
A t [ phi t |-> a t ]
-
Lambda abstractions can introduce multiple arguments:
#def hom : (A : U) -> A -> A -> U := \A x y -> (t : Δ¹) -> A [ ∂Δ¹ t |-> recOR(t === 0_2, t === 1_2, x, y) ]
-
Parameters can be introduced simultaneously for the type and body. Moreover, multiple parameters can be introduced with the same type:
#def hom (A : U) (x y : A) : U := (t : Δ¹) -> A [ ∂Δ¹ t |-> recOR(t === 0_2, t === 1_2, x, y) ]
-
Restrictions can now support multiple subshapes, effectively internalising
recOR
:#def hom (A : U) (x y : A) : U := (t : Δ¹) -> A [ t === 0_2 |-> x, t === 1_2 |-> y ]
-
There are now 3 syntactic versions of
refl
with different amount of explicit annotations:
refl
,refl_{x}
andrefl_{x : A}
-
There are now 2 syntactic versions of identity types (
=
):x = y
andx =_{A} y
. -
recOR
now supports alternative syntax with an arbitrary number of subshapes:
recOR( tope1 |-> term1, tope2 |-> term2, ..., topeN |-> termN )
-
Now it is possible to have type ascriptions:
t as T
. This can help with ensuring types of subexpressions in parts of formalisations, or to upcast types. -
New (better) commands are now supported:
-
#define <name> (<param>)* : <type> := <term>
— same as#def
, but with full spelling of the word -
#postulate <name> (<param>)* : <type>
— postulate an axiom -
#check <term> : <type>
— typecheck an expression against a given type -
#compute-whnf <term>
— compute (WHNF) of a term -
#compute-nf <term>
— compute normal form of a term -
#compute <term>
— alias for#compute-whnf
-
#set-option <option> = <value>
— set a (typechecker) option:#set-option "verbosity" = "silent"
— no log printing#set-option "verbosity" = "normal"
— log typechecking progress#set-option "verbosity" = "debug"
— log every intermediate action
(may be useful to debug when some definition does not typecheck)
-
#unset-option <option>
— revert option's value to its default
-
Simple Shape Coercions
In some places, shapes (cube indexed tope families) can be used directly:
-
In function parameters:
(Λ -> A) -> (Δ² -> A)
is the same as({(t, s) : 2 * 2 | Λ (t, s)} -> A) -> ({(t, s) : 2 * 2 | Δ²} -> A)
-
In parameter types of lambda abstractions:
\((t, s) : Δ²) -> ...
is the same as\{(t, s) : 2 * 2 | Δ² (t, s)} -> ...
Better Type Inference
-
It is now not required to annotate point variables with tope restrictions, the typechecker is finally smart enough to figure them out from the context.
-
It is now possible to simply write
refl
in most situations. -
It is now possible to omit the index type in an identity type:
x = y
Better output and error message
The output and error messages have been slightly improved, but not in a major way.
Internal representation
A new internal representation (a version of second-order abstract syntax)
allows to stop worrying about name captures in substitutions,
so the implementation is much more trustworthy.
The new representation will also allow to bring in higher-order unification in the future, for better type inference, matching, etc.
New representation also allowed annotating each (sub)term with its type to avoid recomputations and some other minor speedups. There are still some performance issues, which need to be debugged, but overall it is much faster than version 0.1.0 already.