Skip to content

Commit 8e0af0c

Browse files
committed
Merge branch 'release-v0.7.3'
* release-v0.7.3: Bump version and update changelog Stop typechecking after a parse error in some file (avoid invalid cache) Fix warning Make formatFile strict Clean up formatting code Check Rzk formatting for all languages before rendering MkDocs Apply autoformatting to docs Make safer resolveLayout, use that in the formatter, drop deepseq dependency Convert `formatTextEdits` to IO to catch errors Add DeepSeq package to dependencies Add a couple of logs for errors while typechecking Split the space edits around bin ops into 2 to avoid overlapping with possible unicode edits Skip typechecking when the decls have not changed Add some tests for the formatter Install HSpec and configure HSpec-Discover Unignore the tests directory
2 parents 4adb752 + beaa7c9 commit 8e0af0c

31 files changed

+489
-88
lines changed

.github/workflows/mkdocs.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ jobs:
4343
pushd ${lang_dir} && rzk typecheck; popd ;
4444
done
4545

46+
- name: Check Rzk formatting for each language
47+
run:
48+
for lang_dir in $(ls -d docs/docs/*/); do
49+
pushd ${lang_dir} && rzk format --check; popd ;
50+
done
51+
4652
- name: 🔨 Install MkDocs Material and mike
4753
run: pip install -r docs/requirements.txt
4854

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ authors:
88
- family-names: Danko
99
given-names: Danila
1010
title: "Rzk: a proof assistant for synthetic $\\infty$-categories"
11-
version: 0.7.2
11+
version: 0.7.3
1212
url: "https://github.com/rzk-lang/rzk"

docs/docs/en/examples/recId.rzk.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,33 @@ We begin by introducing common HoTT definitions:
1919
-- A is contractible there exists x : A such that for any y : A we have x = y.
2020
#define iscontr (A : U)
2121
: U
22-
:= Σ ( a : A) , (x : A) → a =_{A} x
22+
:= Σ (a : A) , (x : A) → a =_{A} x
2323
2424
-- A is a proposition if for any x, y : A we have x = y
2525
#define isaprop (A : U)
2626
: U
27-
:= ( x : A) → (y : A) → x =_{A} y
27+
:= (x : A) → (y : A) → x =_{A} y
2828
2929
-- A is a set if for any x, y : A the type x =_{A} y is a proposition
3030
#define isaset (A : U)
3131
: U
32-
:= ( x : A) → (y : A) → isaprop (x =_{A} y)
32+
:= (x : A) → (y : A) → isaprop (x =_{A} y)
3333
3434
-- A function f : A → B is an equivalence
3535
-- if there exists g : B → A
3636
-- such that for all x : A we have g (f x) = x
3737
-- and for all y : B we have f (g y) = y
3838
#define isweq (A : U) (B : U) (f : A → B)
3939
: U
40-
:= Σ ( g : B → A)
40+
:= Σ (g : B → A)
4141
, prod
4242
( ( x : A) → g (f x) =_{A} x)
4343
( ( y : B) → f (g y) =_{B} y)
4444
4545
-- Equivalence of types A and B
4646
#define weq (A : U) (B : U)
4747
: U
48-
:= Σ ( f : A → B)
48+
:= Σ (f : A → B)
4949
, isweq A B f
5050
5151
-- Transport along a path
@@ -66,12 +66,12 @@ We can now define relative function extensionality. There are several formulatio
6666
-- [RS17, Axiom 4.6] Relative function extensionality.
6767
#define relfunext
6868
: U
69-
:= ( I : CUBE)
69+
:= (I : CUBE)
7070
→ ( ψ : I → TOPE)
7171
→ ( φ : ψ → TOPE)
7272
→ ( A : ψ → U)
7373
→ ( ( t : ψ) → iscontr (A t))
74-
→ ( a : ( t : φ) → A t)
74+
→ ( a : (t : φ) → A t)
7575
→ ( t : ψ) → A t [ φ t ↦ a t]
7676
7777
-- [RS17, Proposition 4.8] A (weaker) formulation of function extensionality.
@@ -82,9 +82,9 @@ We can now define relative function extensionality. There are several formulatio
8282
→ ( ψ : I → TOPE)
8383
→ ( φ : ψ → TOPE)
8484
→ ( A : ψ → U)
85-
→ ( a : ( t : φ) → A t)
85+
→ ( a : (t : φ) → A t)
8686
→ ( f : (t : ψ) → A t [ φ t ↦ a t ])
87-
→ ( g : ( t : ψ) → A t [ φ t ↦ a t ])
87+
→ ( g : (t : ψ) → A t [ φ t ↦ a t ])
8888
→ weq
8989
( f = g)
9090
( ( t : ψ) → (f t =_{A t} g t) [ φ t ↦ refl ])
@@ -106,13 +106,13 @@ First, we define how to restrict an extension type to a subshape:
106106
107107
-- Restrict extension type to a subshape.
108108
#define restrict_phi
109-
( a : ( t : φ) → A t)
109+
( a : (t : φ) → A t)
110110
: ( t : I | ψ t ∧ φ t) → A t
111111
:= \ t → a t
112112
113113
-- Restrict extension type to a subshape.
114114
#define restrict_psi
115-
( a : ( t : ψ) → A t)
115+
( a : (t : ψ) → A t)
116116
: ( t : I | ψ t ∧ φ t) → A t
117117
:= \ t → a t
118118
```
@@ -122,14 +122,14 @@ Then, how to reformulate an `a` (or `b`) as an extension of its restriction:
122122
```rzk
123123
-- Reformulate extension type as an extension of a restriction.
124124
#define ext-of-restrict_psi
125-
( a : ( t : ψ) → A t)
125+
( a : (t : ψ) → A t)
126126
: ( t : ψ)
127127
→ A t [ ψ t ∧ φ t ↦ restrict_psi a t ]
128128
:= a -- type is coerced automatically here
129129
130130
-- Reformulate extension type as an extension of a restriction.
131131
#define ext-of-restrict_phi
132-
( a : ( t : φ) → A t)
132+
( a : (t : φ) → A t)
133133
: ( t : φ)
134134
→ A t [ ψ t ∧ φ t ↦ restrict_phi a t ]
135135
:= a -- type is coerced automatically here

docs/docs/en/getting-started/dependent-types.rzk.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ which we will discuss soon. For now, we give definition of product types:
7979
#define prod
8080
( A B : U)
8181
: U
82-
:= Σ ( _ : A) , B
82+
:= Σ (_ : A) , B
8383
```
8484

8585
The type `#!rzk prod A B` corresponds to the product type $A \times B$.
@@ -188,7 +188,7 @@ For example, for the product type `#!rzk prod A B`, recursion principle looks li
188188
( C : U)
189189
( f : A → B → C)
190190
: prod A B → C
191-
:= \ ( a , b) → f a b
191+
:= \ (a , b) → f a b
192192
```
193193

194194
For the `#!rzk Unit` type, recursion principle is trivial:
@@ -223,7 +223,7 @@ For example, for the product type `#!rzk prod A B`, induction principle looks li
223223
( C : prod A B → U)
224224
( f : (a : A) → (b : B) → C (a , b))
225225
: ( z : prod A B) → C z
226-
:= \ ( a , b) → f a b
226+
:= \ (a , b) → f a b
227227
```
228228

229229
We can use `#!rzk ind-prod` to prove the uniqueness principle for products.
@@ -313,7 +313,7 @@ The first projection can be easily defined in terms of pattern matching:
313313
( A : U)
314314
( B : A → U)
315315
: ( Σ ( a : A) , B a) → A
316-
:= \ ( a , _) → a
316+
:= \ (a , _) → a
317317
```
318318

319319
However, second projection requires some care. For instance, we might try this:
@@ -339,7 +339,7 @@ To access it, we need a dependent function:
339339
( A : U)
340340
( B : A → U)
341341
: ( z : Σ (a : A) , B a) → B (pr₁ A B z)
342-
:= \ ( _ , b) → b
342+
:= \ (_ , b) → b
343343
```
344344

345345
In Rzk, it is sometimes more convenient to talk about Σ-types as "total" types (as in "total spaces"):
@@ -349,7 +349,7 @@ In Rzk, it is sometimes more convenient to talk about Σ-types as "total" types
349349
( A : U)
350350
( B : A → U)
351351
: U
352-
:= Σ ( a : A) , B a
352+
:= Σ (a : A) , B a
353353
```
354354

355355
We can use pattern matching in the function type and this new definition to write
@@ -376,7 +376,7 @@ the recursion principle for product types:
376376
( C : U)
377377
( f : (a : A) → B a → C)
378378
: total-type A B → C
379-
:= \ ( a , b) → f a b
379+
:= \ (a , b) → f a b
380380
```
381381

382382
The induction principle is, again, a generalization of the recursion
@@ -389,7 +389,7 @@ principle to dependent types:
389389
( C : total-type A B → U)
390390
( f : (a : A) → (b : B a) → C (a , b))
391391
: ( z : total-type A B) → C z
392-
:= \ ( a , b) → f a b
392+
:= \ (a , b) → f a b
393393
```
394394

395395
As before, using `#!rzk ind-Σ` we may prove the uniqueness principle, now for Σ-types:
@@ -424,7 +424,7 @@ Using `#!rzk ind-Σ` we can also prove a type-theoretic axiom of choice:
424424
```rzk
425425
#define AxiomOfChoice
426426
: U
427-
:= ( A : U)
427+
:= (A : U)
428428
→ ( B : U)
429429
→ ( R : A → B → U)
430430
→ ( ( x : A) → Σ (y : B) , R x y)

docs/docs/ru/examples/recId.rzk.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,33 @@ We begin by introducing common HoTT definitions:
1919
-- A is contractible there exists x : A such that for any y : A we have x = y.
2020
#define iscontr (A : U)
2121
: U
22-
:= Σ ( a : A) , (x : A) → a =_{A} x
22+
:= Σ (a : A) , (x : A) → a =_{A} x
2323
2424
-- A is a proposition if for any x, y : A we have x = y
2525
#define isaprop (A : U)
2626
: U
27-
:= ( x : A) → (y : A) → x =_{A} y
27+
:= (x : A) → (y : A) → x =_{A} y
2828
2929
-- A is a set if for any x, y : A the type x =_{A} y is a proposition
3030
#define isaset (A : U)
3131
: U
32-
:= ( x : A) → (y : A) → isaprop (x =_{A} y)
32+
:= (x : A) → (y : A) → isaprop (x =_{A} y)
3333
3434
-- A function f : A → B is an equivalence
3535
-- if there exists g : B → A
3636
-- such that for all x : A we have g (f x) = x
3737
-- and for all y : B we have f (g y) = y
3838
#define isweq (A : U) (B : U) (f : A → B)
3939
: U
40-
:= Σ ( g : B → A)
40+
:= Σ (g : B → A)
4141
, prod
4242
( ( x : A) → g (f x) =_{A} x)
4343
( ( y : B) → f (g y) =_{B} y)
4444
4545
-- Equivalence of types A and B
4646
#define weq (A : U) (B : U)
4747
: U
48-
:= Σ ( f : A → B)
48+
:= Σ (f : A → B)
4949
, isweq A B f
5050
5151
-- Transport along a path
@@ -66,12 +66,12 @@ We can now define relative function extensionality. There are several formulatio
6666
-- [RS17, Axiom 4.6] Relative function extensionality.
6767
#define relfunext
6868
: U
69-
:= ( I : CUBE)
69+
:= (I : CUBE)
7070
→ ( ψ : I → TOPE)
7171
→ ( φ : ψ → TOPE)
7272
→ ( A : ψ → U)
7373
→ ( ( t : ψ) → iscontr (A t))
74-
→ ( a : ( t : φ) → A t)
74+
→ ( a : (t : φ) → A t)
7575
→ ( t : ψ) → A t [ φ t ↦ a t]
7676
7777
-- [RS17, Proposition 4.8] A (weaker) formulation of function extensionality.
@@ -82,9 +82,9 @@ We can now define relative function extensionality. There are several formulatio
8282
→ ( ψ : I → TOPE)
8383
→ ( φ : ψ → TOPE)
8484
→ ( A : ψ → U)
85-
→ ( a : ( t : φ) → A t)
85+
→ ( a : (t : φ) → A t)
8686
→ ( f : (t : ψ) → A t [ φ t ↦ a t ])
87-
→ ( g : ( t : ψ) → A t [ φ t ↦ a t ])
87+
→ ( g : (t : ψ) → A t [ φ t ↦ a t ])
8888
→ weq
8989
( f = g)
9090
( ( t : ψ) → (f t =_{A t} g t) [ φ t ↦ refl ])
@@ -106,13 +106,13 @@ First, we define how to restrict an extension type to a subshape:
106106
107107
-- Restrict extension type to a subshape.
108108
#define restrict_phi
109-
( a : ( t : φ) → A t)
109+
( a : (t : φ) → A t)
110110
: ( t : I | ψ t ∧ φ t) → A t
111111
:= \ t → a t
112112
113113
-- Restrict extension type to a subshape.
114114
#define restrict_psi
115-
( a : ( t : ψ) → A t)
115+
( a : (t : ψ) → A t)
116116
: ( t : I | ψ t ∧ φ t) → A t
117117
:= \ t → a t
118118
```
@@ -122,14 +122,14 @@ Then, how to reformulate an `a` (or `b`) as an extension of its restriction:
122122
```rzk
123123
-- Reformulate extension type as an extension of a restriction.
124124
#define ext-of-restrict_psi
125-
( a : ( t : ψ) → A t)
125+
( a : (t : ψ) → A t)
126126
: ( t : ψ)
127127
→ A t [ ψ t ∧ φ t ↦ restrict_psi a t ]
128128
:= a -- type is coerced automatically here
129129
130130
-- Reformulate extension type as an extension of a restriction.
131131
#define ext-of-restrict_phi
132-
( a : ( t : φ) → A t)
132+
( a : (t : φ) → A t)
133133
: ( t : φ)
134134
→ A t [ ψ t ∧ φ t ↦ restrict_phi a t ]
135135
:= a -- type is coerced automatically here

docs/docs/ru/getting-started/dependent-types.rzk.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Rzk не предоставляет встроенных типов-произв
8383
#define prod
8484
( A B : U)
8585
: U
86-
:= Σ ( _ : A) , B
86+
:= Σ (_ : A) , B
8787
```
8888

8989
Запись `#!rzk prod A B` соответствует типу-произведению $A \times B$.
@@ -193,7 +193,7 @@ Rzk не предоставляет встроенных типов-произв
193193
( C : U)
194194
( f : A → B → C)
195195
: prod A B → C
196-
:= \ ( a , b) → f a b
196+
:= \ (a , b) → f a b
197197
```
198198

199199
Для типа `#!rzk Unit`, принцип рекурсии тривиален:
@@ -228,7 +228,7 @@ Rzk не предоставляет встроенных типов-произв
228228
( C : prod A B → U)
229229
( f : (a : A) → (b : B) → C (a , b))
230230
: ( z : prod A B) → C z
231-
:= \ ( a , b) → f a b
231+
:= \ (a , b) → f a b
232232
```
233233

234234
Мы можем использовать `#!rzk ind-prod` для доказательства принципа уникальности.
@@ -318,7 +318,7 @@ Rzk не предоставляет встроенных типов-произв
318318
( A : U)
319319
( B : A → U)
320320
: ( Σ ( a : A) , B a) → A
321-
:= \ ( a , _) → a
321+
:= \ (a , _) → a
322322
```
323323

324324
Однако, для определения второй проекции нужна осторожность. В частности, следующее определение не сработает:
@@ -344,7 +344,7 @@ undefined variable: a
344344
( A : U)
345345
( B : A → U)
346346
: ( z : Σ (a : A) , B a) → B (pr₁ A B z)
347-
:= \ ( _ , b) → b
347+
:= \ (_ , b) → b
348348
```
349349

350350
Иногда о Σ-типах удобнее говорить как о тотальных (общих?) типах (аналогично "total spaces"):
@@ -354,7 +354,7 @@ undefined variable: a
354354
( A : U)
355355
( B : A → U)
356356
: U
357-
:= Σ ( a : A) , B a
357+
:= Σ (a : A) , B a
358358
```
359359

360360
Мы можем переписать более компактно определение второй проекции,
@@ -381,7 +381,7 @@ undefined variable: a
381381
( C : U)
382382
( f : (a : A) → B a → C)
383383
: total-type A B → C
384-
:= \ ( a , b) → f a b
384+
:= \ (a , b) → f a b
385385
```
386386

387387
Аналогично с принципом индукции:
@@ -393,7 +393,7 @@ undefined variable: a
393393
( C : total-type A B → U)
394394
( f : (a : A) → (b : B a) → C (a , b))
395395
: ( z : total-type A B) → C z
396-
:= \ ( a , b) → f a b
396+
:= \ (a , b) → f a b
397397
```
398398

399399
Как и раньше, мы можем использовать `#!rzk ind-Σ` для доказательства принципа уникальности,
@@ -431,7 +431,7 @@ undefined variable: a
431431
```rzk
432432
#define AxiomOfChoice
433433
: U
434-
:= ( A : U)
434+
:= (A : U)
435435
→ ( B : U)
436436
→ ( R : A → B → U)
437437
→ ( ( x : A) → Σ (y : B) , R x y)

rzk/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@
22
*~
33
*.bak
44
.DS_Store
5-
Test

0 commit comments

Comments
 (0)