Skip to content

Commit eabfe3c

Browse files
committed
Merge branch 'release-v0.7.1'
* release-v0.7.1: Bump version and update changelogs Format recId.rzk.md Fix the LSP flag/CPP Fix rzk/ChangeLog.md Fix MkDocs workflow: remove --rebase for mike
2 parents 372328b + 0a271e6 commit eabfe3c

File tree

7 files changed

+151
-90
lines changed

7 files changed

+151
-90
lines changed

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.0
11+
version: 0.7.1
1212
url: "https://github.com/rzk-lang/rzk"

docs/docs/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to the
77
[Haskell Package Versioning Policy](https://pvp.haskell.org/).
88

9+
## v0.7.1 — 2023-12-08
10+
11+
- Fix default build to include Rzk Language Server (`rzk lsp`) (see [`9b78a15`](https://github.com/rzk-lang/rzk/commit/9b78a15c750699afa93c4dab3735c2aa31e6faac));
12+
- Apply formatting to `recId.rzk.md` example (see [`4032724`](https://github.com/rzk-lang/rzk/commit/40327246954332f40cd82c48d102bf4257ad719e));
13+
914
## v0.7.0 — 2023-12-08
1015

1116
Major changes:

docs/docs/examples/recId.rzk.md

Lines changed: 106 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,50 @@ We begin by introducing common HoTT definitions:
1313
#lang rzk-1
1414
1515
-- A is contractible there exists x : A such that for any y : A we have x = y.
16-
#define iscontr (A : U) : U
17-
:= Σ (a : A), (x : A) → a =_{A} x
16+
#define iscontr (A : U)
17+
: U
18+
:= Σ ( a : A) , (x : A) → a =_{A} x
1819
1920
-- A is a proposition if for any x, y : A we have x = y
20-
#define isaprop (A : U) : U
21-
:= (x : A) → (y : A) → x =_{A} y
21+
#define isaprop (A : U)
22+
: U
23+
:= ( x : A) → (y : A) → x =_{A} y
2224
2325
-- A is a set if for any x, y : A the type x =_{A} y is a proposition
24-
#define isaset (A : U) : U
25-
:= (x : A) → (y : A) → isaprop (x =_{A} y)
26+
#define isaset (A : U)
27+
: U
28+
:= ( x : A) → (y : A) → isaprop (x =_{A} y)
2629
2730
-- Non-dependent product of A and B
28-
#define prod (A : U) (B : U) : U
29-
:= Σ (x : A), B
31+
#define prod (A : U) (B : U)
32+
: U
33+
:= Σ ( x : A) , B
3034
3135
-- A function f : A → B is an equivalence
3236
-- if there exists g : B → A
3337
-- such that for all x : A we have g (f x) = x
3438
-- and for all y : B we have f (g y) = y
35-
#define isweq (A : U) (B : U) (f : A → B) : U
36-
:= Σ (g : B → A), prod ((x : A) → g (f x) =_{A} x) ((y : B) → f (g y) =_{B} y)
39+
#define isweq (A : U) (B : U) (f : A → B)
40+
: U
41+
:= Σ ( g : B → A)
42+
, prod
43+
( ( x : A) → g (f x) =_{A} x)
44+
( ( y : B) → f (g y) =_{B} y)
3745
3846
-- Equivalence of types A and B
39-
#define weq (A : U) (B : U) : U
40-
:= Σ (f : A → B), isweq A B f
47+
#define weq (A : U) (B : U)
48+
: U
49+
:= Σ ( f : A → B)
50+
, isweq A B f
4151
4252
-- Transport along a path
4353
#define transport
44-
(A : U)
45-
(C : A → U)
46-
(x y : A)
47-
(p : x =_{A} y)
48-
: C x → C y
49-
:= \ cx → idJ(A, x, (\z q → C z), cx, y, p)
54+
( A : U)
55+
( C : A → U)
56+
( x y : A)
57+
( p : x =_{A} y)
58+
: C x → C y
59+
:= \ cx → idJ(A , x , (\ z q → C z) , cx , y , p)
5060
```
5161

5262
## Relative function extensionality
@@ -55,26 +65,30 @@ We can now define relative function extensionality. There are several formulatio
5565

5666
```rzk
5767
-- [RS17, Axiom 4.6] Relative function extensionality.
58-
#define relfunext : U
59-
:= (I : CUBE)
60-
→ (ψ : I → TOPE)
61-
→ (φ : ψ → TOPE)
62-
→ (A : ψ → U)
63-
→ ((t : ψ) → iscontr (A t))
64-
→ (a : (t : φ) → A t)
65-
→ (t : ψ) → A t [ φ t ↦ a t]
68+
#define relfunext
69+
: U
70+
:= ( I : CUBE)
71+
→ ( ψ : I → TOPE)
72+
→ ( φ : ψ → TOPE)
73+
→ ( A : ψ → U)
74+
→ ( ( t : ψ) → iscontr (A t))
75+
→ ( a : ( t : φ) → A t)
76+
→ ( t : ψ) → A t [ φ t ↦ a t]
6677
6778
-- [RS17, Proposition 4.8] A (weaker) formulation of function extensionality.
68-
#define relfunext2 : U
69-
:= (I : CUBE)
70-
→ (ψ : I → TOPE)
71-
→ (φ : ψ → TOPE)
72-
→ (A : ψ → U)
73-
→ (a : (t : φ) → A t)
74-
→ (f : (t : ψ) → A t [ φ t ↦ a t ])
75-
→ (g : (t : ψ) → A t [ φ t ↦ a t ])
76-
→ weq (f = g)
77-
((t : ψ) → (f t =_{A t} g t) [ φ t ↦ refl ])
79+
#define relfunext2
80+
: U
81+
:=
82+
( I : CUBE)
83+
→ ( ψ : I → TOPE)
84+
→ ( φ : ψ → TOPE)
85+
→ ( A : ψ → U)
86+
→ ( a : ( t : φ) → A t)
87+
→ ( f : (t : ψ) → A t [ φ t ↦ a t ])
88+
→ ( g : ( t : ψ) → A t [ φ t ↦ a t ])
89+
→ weq
90+
( f = g)
91+
( ( t : ψ) → (f t =_{A t} g t) [ φ t ↦ refl ])
7892
```
7993

8094
## Construction of `recId`
@@ -93,14 +107,14 @@ First, we define how to restrict an extension type to a subshape:
93107
94108
-- Restrict extension type to a subshape.
95109
#define restrict_phi
96-
(a : (t : φ) → A t)
97-
: (t : I | ψ t ∧ φ t) → A t
110+
( a : ( t : φ) → A t)
111+
: ( t : I | ψ t ∧ φ t) → A t
98112
:= \ t → a t
99113
100114
-- Restrict extension type to a subshape.
101115
#define restrict_psi
102-
(a : (t : ψ) → A t)
103-
: (t : I | ψ t ∧ φ t) → A t
116+
( a : ( t : ψ) → A t)
117+
: ( t : I | ψ t ∧ φ t) → A t
104118
:= \ t → a t
105119
```
106120

@@ -109,14 +123,16 @@ Then, how to reformulate an `a` (or `b`) as an extension of its restriction:
109123
```rzk
110124
-- Reformulate extension type as an extension of a restriction.
111125
#define ext-of-restrict_psi
112-
(a : (t : ψ) → A t)
113-
: (t : ψ) → A t [ ψ t ∧ φ t ↦ restrict_psi a t ]
126+
( a : ( t : ψ) → A t)
127+
: ( t : ψ)
128+
→ A t [ ψ t ∧ φ t ↦ restrict_psi a t ]
114129
:= a -- type is coerced automatically here
115130
116131
-- Reformulate extension type as an extension of a restriction.
117132
#define ext-of-restrict_phi
118-
(a : (t : φ) → A t)
119-
: (t : φ) → A t [ ψ t ∧ φ t ↦ restrict_phi a t ]
133+
( a : ( t : φ) → A t)
134+
: ( t : φ)
135+
→ A t [ ψ t ∧ φ t ↦ restrict_phi a t ]
120136
:= a -- type is coerced automatically here
121137
```
122138

@@ -125,17 +141,20 @@ Now, assuming relative function extensionality, we construct a path between rest
125141
```rzk
126142
-- Transform extension of an identity into an identity of restrictions.
127143
#define restricts-path
128-
(a_psi : (t : ψ) → A t)
129-
(a_phi : (t : φ) → A t)
130-
(e : (t : I | ψ t ∧ φ t) → a_psi t = a_phi t)
131-
: restrict_psi a_psi = restrict_phi a_phi
132-
:= (first (second (r I
133-
(\t → ψ t ∧ φ t)
134-
(\t → BOT)
135-
(\t → A t)
136-
(\t → recBOT)
137-
(\t → a_psi t)
138-
(\t → a_phi t)))) e
144+
( a_psi : (t : ψ) → A t)
145+
( a_phi : (t : φ) → A t)
146+
: ( e : (t : I | ψ t ∧ φ t) → a_psi t = a_phi t)
147+
→ restrict_psi a_psi = restrict_phi a_phi
148+
:=
149+
first
150+
( second
151+
( r I
152+
( \ t → ψ t ∧ φ t)
153+
( \ t → BOT)
154+
( \ t → A t)
155+
( \ t → recBOT)
156+
( \ t → a_psi t)
157+
( \ t → a_phi t)))
139158
```
140159

141160
Finally, we bring everything together into `recId`:
@@ -145,20 +164,22 @@ Finally, we bring everything together into `recId`:
145164
-- recOR(ψ, φ, a, b) demands that for ψ ∧ φ we have a == b (definitionally)
146165
-- (recId ψ φ a b e) demands that e is the proof that a = b (intensionally) for ψ ∧ φ
147166
#define recId uses (r) -- we declare that recId is using r on purpose
148-
(a_psi : (t : ψ) → A t)
149-
(a_phi : (t : φ) → A t)
150-
(e : (t : I | ψ t ∧ φ t) → a_psi t = a_phi t)
151-
: (t : I | ψ t ∨ φ t) → A t
152-
:= \t → recOR(
153-
ψ t ↦ transport
154-
((s : I | ψ s ∧ φ s) → A s)
155-
(\ra → (s : ψ) → A s [ ψ s ∧ φ s ↦ ra s ])
156-
(restrict_psi a_psi)
157-
(restrict_phi a_phi)
158-
(restricts-path a_psi a_phi e)
159-
(ext-of-restrict_psi a_psi)
160-
t,
161-
φ t ↦ ext-of-restrict_phi a_phi t
167+
( a_psi : (t : ψ) → A t)
168+
( a_phi : (t : φ) → A t)
169+
( e : (t : I | ψ t ∧ φ t) → a_psi t = a_phi t)
170+
: ( t : I | ψ t ∨ φ t) → A t
171+
:= \ t → recOR(
172+
ψ t ↦
173+
transport
174+
( ( s : I | ψ s ∧ φ s) → A s)
175+
( \ ra → (s : ψ) → A s [ ψ s ∧ φ s ↦ ra s ])
176+
( restrict_psi a_psi)
177+
( restrict_phi a_phi)
178+
( restricts-path a_psi a_phi e)
179+
( ext-of-restrict_psi a_psi)
180+
( t)
181+
, φ t ↦
182+
ext-of-restrict_phi a_phi t
162183
)
163184
164185
#end construction-of-recId
@@ -173,18 +194,20 @@ whenever we can show that they are equal on the intersection of shapes:
173194
-- If two extension types are equal along two subshapes,
174195
-- then they are also equal along their union.
175196
#define id-along-border
176-
(r : relfunext2)
177-
(I : CUBE)
178-
(ψ : I → TOPE)
179-
(φ : I → TOPE)
180-
(A : (t : I | ψ t ∨ φ t) → U)
181-
(a b : (t : I | ψ t ∨ φ t) → A t)
182-
(e_psi : (t : ψ) → a t = b t)
183-
(e_phi : (t : φ) → a t = b t)
184-
(border-is-a-set : (t : I | ψ t ∧ φ t) → isaset (A t))
185-
: (t : I | ψ t ∨ φ t) → a t = b t
186-
:= recId r I ψ φ
187-
(\t → a t = b t)
188-
e_psi e_phi
189-
(\t → border-is-a-set t (a t) (b t) (e_psi t) (e_phi t))
197+
( r : relfunext2)
198+
( I : CUBE)
199+
( ψ : I → TOPE)
200+
( φ : I → TOPE)
201+
( A : (t : I | ψ t ∨ φ t) → U)
202+
( a b : (t : I | ψ t ∨ φ t) → A t)
203+
( e_psi : (t : ψ) → a t = b t)
204+
( e_phi : (t : φ) → a t = b t)
205+
( border-is-a-set : (t : I | ψ t ∧ φ t) → isaset (A t))
206+
: ( t : I | ψ t ∨ φ t) → a t = b t
207+
:=
208+
recId r I ψ φ
209+
( \ t → a t = b t)
210+
( e_psi)
211+
( e_phi)
212+
( \ t → border-is-a-set t (a t) (b t) (e_psi t) (e_phi t))
190213
```

rzk/ChangeLog.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,33 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to the
77
[Haskell Package Versioning Policy](https://pvp.haskell.org/).
88

9+
## v0.7.1 — 2023-12-08
10+
11+
- Fix default build to include Rzk Language Server (`rzk lsp`) (see [`9b78a15`](https://github.com/rzk-lang/rzk/commit/9b78a15c750699afa93c4dab3735c2aa31e6faac));
12+
- Apply formatting to `recId.rzk.md` example (see [`4032724`](https://github.com/rzk-lang/rzk/commit/40327246954332f40cd82c48d102bf4257ad719e));
13+
914
## v0.7.0 — 2023-12-08
1015

16+
Major changes:
17+
18+
- Add an experimental `rzk format` command (by [Abdelrahman Abounegm](https://github.com/aabounegm), with feedback by [Fredrik Bakke](https://github.com/fredrik-bakke) (see [sHoTT#142](https://github.com/rzk-lang/sHoTT/pull/142)) and [Nikolai Kudasov](https://github.com/fizruk)):
19+
- Automatically format files, partially automating the [Code Style of the sHoTT project](https://rzk-lang.github.io/sHoTT/STYLEGUIDE/)
20+
- Notable features:
21+
- Adds a space after the opening parenthesis to help with the [code tree structure](https://rzk-lang.github.io/sHoTT/STYLEGUIDE/#the-tree-structure-of-constructions)
22+
- Puts the definition conclusion (type, starting with `:`) and construction (body, starting with `:=`) on new lines
23+
- Adds a space after the `\` of a lambda term and around binary operators (like `,`)
24+
- Moves binary operators to the beginning of the next line if they appear at the end of the previous one.
25+
- Replaces [common ASCII sequences](https://rzk-lang.github.io/sHoTT/STYLEGUIDE/#use-of-unicode-characters) with their Unicode equivalent
26+
- A CLI subcommand (`rzk format`) with `--check` and `--write` options
27+
- Known limitations
28+
- The 80 character line limit is currently not enforced due to the difficulty of determining where to add line breaks (for reference, check out [this post](https://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/) by a Dart `fmt` engineer)
29+
- Fixing indentation is not yet implemented due to the need for more semantics than the lexer provides to determine indentation level.
30+
- There may be rare edge cases in which applying the formatter twice could result in additional edits that were not detected the first time.
31+
32+
Minor changes:
1133

34+
- Fix "latest" Rzk Playground link (see [#137](https://github.com/rzk-lang/rzk/pull/137));
35+
- Add more badges to README (see [#136](https://github.com/rzk-lang/rzk/pull/136));
1236

1337
## v0.6.7 — 2023-10-07
1438

rzk/app/Main.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import Language.Rzk.VSCode.Lsp (runLsp)
2323
import Options.Generic
2424
import System.Exit (exitFailure, exitSuccess)
2525

26-
import Data.Functor ((<&>))
26+
import Data.Functor (void, (<&>))
2727
import Paths_rzk (version)
2828
import Rzk.Format (formatFile, formatFileWrite,
2929
isWellFormattedFile)
@@ -90,4 +90,3 @@ main = do
9090
exitSuccess
9191

9292
Version -> putStrLn (showVersion version)
93-

rzk/package.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: rzk
2-
version: 0.7.0
2+
version: 0.7.1
33
github: "rzk-lang/rzk"
44
license: BSD3
55
author: "Nikolai Kudasov"
@@ -26,6 +26,10 @@ flags:
2626
manual: true
2727
default: true
2828

29+
when:
30+
- condition: flag(lsp) && !impl(ghcjs)
31+
cpp-options: -DLSP
32+
2933
custom-setup:
3034
dependencies:
3135
base: ">= 4.11.0.0 && < 5.0"
@@ -86,7 +90,6 @@ library:
8690
lsp: ">= 2.2.0.0"
8791
lsp-types: ">= 2.0.2.0"
8892
stm: ">= 2.5.0.0"
89-
cpp-options: -DLSP
9093

9194
executables:
9295
rzk:

0 commit comments

Comments
 (0)