Fixed broken local links; added jekyll-feed back into the plugins.
This commit is contained in:
parent
ecde68df1e
commit
a56370369c
12 changed files with 32 additions and 33 deletions
6
Makefile
6
Makefile
|
@ -5,9 +5,9 @@ markdown := $(subst src/,out/,$(subst .lagda,.md,$(agda)))
|
||||||
all: $(markdown)
|
all: $(markdown)
|
||||||
|
|
||||||
test: $(markdown)
|
test: $(markdown)
|
||||||
ruby -S bundle exec jekyll clean
|
ruby -S bundle exec jekyll clean -d _test
|
||||||
ruby -S bundle exec jekyll build -d _site/sf/
|
ruby -S bundle exec jekyll build -d _test/sf/
|
||||||
ruby -S bundle exec htmlproofer _site --disable-external
|
ruby -S bundle exec htmlproofer _test
|
||||||
|
|
||||||
out/:
|
out/:
|
||||||
mkdir -p out/
|
mkdir -p out/
|
||||||
|
|
|
@ -24,6 +24,8 @@ disqus:
|
||||||
|
|
||||||
baseurl: "/sf"
|
baseurl: "/sf"
|
||||||
url: "https://wenkokke.github.io"
|
url: "https://wenkokke.github.io"
|
||||||
|
plugins:
|
||||||
|
- jekyll-feed
|
||||||
markdown: kramdown
|
markdown: kramdown
|
||||||
theme: minima
|
theme: minima
|
||||||
exclude:
|
exclude:
|
||||||
|
|
|
@ -212,8 +212,7 @@ data Value : ∀ {Γ A} → Γ ⊢ A → Set where
|
||||||
→ Value (ƛ N)
|
→ Value (ƛ N)
|
||||||
\end{code}
|
\end{code}
|
||||||
|
|
||||||
Here `` `zero `` requires an implicit parameter to aid inference
|
Here `zero` requires an implicit parameter to aid inference (much in the same way that `[]` did in [Lists]({{ site.baseurl }}{% link out/plta/Lists.md %})).
|
||||||
(much in the same way that `[]` did in [Lists](Lists)).
|
|
||||||
|
|
||||||
## Reduction step
|
## Reduction step
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,7 @@ open import Function using (_∘_)
|
||||||
|
|
||||||
## Evidence vs Computation
|
## Evidence vs Computation
|
||||||
|
|
||||||
Recall that Chapter [Relations](Relations) defined comparison
|
Recall that Chapter [Relations]({{ site.baseurl }}{% link out/plta/Relations.md %}) defined comparison an inductive datatype, which provides *evidence* that one number is less than or equal to another.
|
||||||
an inductive datatype, which provides *evidence* that one number
|
|
||||||
is less than or equal to another.
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
infix 4 _≤_
|
infix 4 _≤_
|
||||||
|
|
||||||
|
@ -499,8 +497,7 @@ on which matches; but either is equally valid.
|
||||||
|
|
||||||
## Decidability of All
|
## Decidability of All
|
||||||
|
|
||||||
Recall that in Chapter [Lists](Lists#All) we defined a predicate `All P`
|
Recall that in Chapter [Lists]({{ site.baseurl }}{% link out/plta/Lists.md %}#All) we defined a predicate `All P` that holds if a given predicate is satisfied by every element of a list.
|
||||||
that holds if a given predicate is satisfied by every element of a list.
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
data All {A : Set} (P : A → Set) : List A → Set where
|
data All {A : Set} (P : A → Set) : List A → Set where
|
||||||
[] : All P []
|
[] : All P []
|
||||||
|
@ -516,7 +513,7 @@ all p = foldr _∧_ true ∘ map p
|
||||||
\end{code}
|
\end{code}
|
||||||
The function can be written in a particularly compact style by
|
The function can be written in a particularly compact style by
|
||||||
using the higher-order functions `map` and `foldr` as defined in
|
using the higher-order functions `map` and `foldr` as defined in
|
||||||
the sections on [Map](Lists#Map) and [Fold](Lists#Fold).
|
the sections on [Map]({{ site.baseurl }}{% link out/plta/Lists.md %}#Map) and [Fold]({{ site.baseurl }}{% link out/plta/Lists.md %}#Fold).
|
||||||
|
|
||||||
As one would hope, if we replace booleans by decidables there is again
|
As one would hope, if we replace booleans by decidables there is again
|
||||||
an analogue of `All`. First, return to the notion of a predicate `P` as
|
an analogue of `All`. First, return to the notion of a predicate `P` as
|
||||||
|
|
|
@ -28,13 +28,13 @@ recursive function definitions.
|
||||||
|
|
||||||
This chapter formalises the simply-typed lambda calculus, giving its
|
This chapter formalises the simply-typed lambda calculus, giving its
|
||||||
syntax, small-step semantics, and typing rules. The next chapter
|
syntax, small-step semantics, and typing rules. The next chapter
|
||||||
[LambdaProp](LambdaProp) reviews its main properties, including
|
[LambdaProp]({{ site.baseurl }}{% link out/plta/LambdaProp.md %}) reviews its main properties, including
|
||||||
progress and preservation. Following chapters will look at a number
|
progress and preservation. Following chapters will look at a number
|
||||||
of variants of lambda calculus.
|
of variants of lambda calculus.
|
||||||
|
|
||||||
Be aware that the approach we take here is _not_ our recommended
|
Be aware that the approach we take here is _not_ our recommended
|
||||||
approach to formalisation. Using De Bruijn indices and
|
approach to formalisation. Using De Bruijn indices and
|
||||||
inherently-typed terms, as we will do in Chapter [DeBruijn](DeBruijn),
|
inherently-typed terms, as we will do in Chapter [DeBruijn]({{ site.baseurl }}{% link out/plta/DeBruijn.md %}),
|
||||||
leads to a more compact formulation. Nonetheless, we begin with named
|
leads to a more compact formulation. Nonetheless, we begin with named
|
||||||
variables, partly because such terms are easier to read and partly
|
variables, partly because such terms are easier to read and partly
|
||||||
because the development is more traditional.
|
because the development is more traditional.
|
||||||
|
@ -144,7 +144,7 @@ four : Term
|
||||||
four = plus · two · two
|
four = plus · two · two
|
||||||
\end{code}
|
\end{code}
|
||||||
The recursive definition of addition is similar to our original
|
The recursive definition of addition is similar to our original
|
||||||
definition of `_+_` for naturals, as given in Chapter [Natural](Naturals).
|
definition of `_+_` for naturals, as given in Chapter [Naturals]({{ site.baseurl }}{% link out/plta/Naturals.md %}).
|
||||||
Later we will confirm that two plus two is four, in other words that
|
Later we will confirm that two plus two is four, in other words that
|
||||||
the term
|
the term
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ names, `x` and `x′`.
|
||||||
We only consider reduction of _closed_ terms,
|
We only consider reduction of _closed_ terms,
|
||||||
those that contain no free variables. We consider
|
those that contain no free variables. We consider
|
||||||
a precise definition of free variables in Chapter
|
a precise definition of free variables in Chapter
|
||||||
[LambdaProp](LambdaProp).
|
[LambdaProp]({{ site.baseurl }}{% link out/plta/LambdaProp.md %}).
|
||||||
|
|
||||||
*rewrite (((*
|
*rewrite (((*
|
||||||
A term is a value if it is fully reduced.
|
A term is a value if it is fully reduced.
|
||||||
|
@ -326,7 +326,7 @@ An alternative is not to focus on closed terms,
|
||||||
to treat variables as values, and to treat
|
to treat variables as values, and to treat
|
||||||
`ƛ x ⇒ N` as a value only if `N` is a value.
|
`ƛ x ⇒ N` as a value only if `N` is a value.
|
||||||
Indeed, this is how Agda normalises terms.
|
Indeed, this is how Agda normalises terms.
|
||||||
We consider this approach in a [later chapter](Untyped).
|
We consider this approach in a [later chapter]({{ site.baseurl }}{% link out/plta/Untyped.md %}).
|
||||||
|
|
||||||
## Substitution
|
## Substitution
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ are written as follows.
|
||||||
L ⟹* N
|
L ⟹* N
|
||||||
|
|
||||||
Here it is formalised in Agda, along similar lines to what
|
Here it is formalised in Agda, along similar lines to what
|
||||||
we used for reasoning about [Equality](Equality).
|
we used for reasoning about [Equality]({{ site.baseurl }}{% link out/plta/Equality.md %}).
|
||||||
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
infix 2 _⟹*_
|
infix 2 _⟹*_
|
||||||
|
|
|
@ -34,7 +34,7 @@ postulate
|
||||||
extensionality : ∀ {A B : Set} {f g : A → B} → (∀ (x : A) → f x ≡ g x) → f ≡ g
|
extensionality : ∀ {A B : Set} {f g : A → B} → (∀ (x : A) → f x ≡ g x) → f ≡ g
|
||||||
\end{code}
|
\end{code}
|
||||||
|
|
||||||
[extensionality]: Equality#extensionality
|
[extensionality]: {{ site.baseurl }}{% link out/plta/Equality.md %}#extensionality
|
||||||
|
|
||||||
|
|
||||||
## Lists
|
## Lists
|
||||||
|
@ -862,7 +862,7 @@ _∘′_ : ∀ {ℓ₁ ℓ₂ ℓ₃ : Level} {A : Set ℓ₁} {B : Set ℓ₂}
|
||||||
(g ∘′ f) x = g (f x)
|
(g ∘′ f) x = g (f x)
|
||||||
\end{code}
|
\end{code}
|
||||||
|
|
||||||
[unipoly]: Equality/index.html#unipoly
|
[unipoly]: {{ site.baseurl }}{% link out/plta/Equality.md %}#unipoly
|
||||||
|
|
||||||
Show that `Any` and `All` satisfy a version of De Morgan's Law.
|
Show that `Any` and `All` satisfy a version of De Morgan's Law.
|
||||||
\begin{code}
|
\begin{code}
|
||||||
|
|
|
@ -38,7 +38,8 @@ postulate
|
||||||
extensionality : ∀ {A B : Set} {f g : A → B} → (∀ (x : A) → f x ≡ g x) → f ≡ g
|
extensionality : ∀ {A B : Set} {f g : A → B} → (∀ (x : A) → f x ≡ g x) → f ≡ g
|
||||||
\end{code}
|
\end{code}
|
||||||
|
|
||||||
[extensionality]: Equality#extensionality
|
[extensionality]: {{ site.baseurl }}{% link out/plta/Equality.md %}#extensionality
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Modules
|
## Modules
|
||||||
|
|
|
@ -269,7 +269,7 @@ specifies operators to support reasoning about equivalence, and adds
|
||||||
all the names specified in the `using` clause into the current scope.
|
all the names specified in the `using` clause into the current scope.
|
||||||
In this case, the names added are `begin_`, `_≡⟨⟩_`, and `_∎`. We
|
In this case, the names added are `begin_`, `_≡⟨⟩_`, and `_∎`. We
|
||||||
will see how these are used below. We take all these as givens for now,
|
will see how these are used below. We take all these as givens for now,
|
||||||
but will see how they are defined in Chapter [Equality](Equality).
|
but will see how they are defined in Chapter [Equality]({{ site.baseurl }}{% link out/plta/Equality.md %}).
|
||||||
|
|
||||||
Agda uses underbars to indicate where terms appear in infix or mixfix
|
Agda uses underbars to indicate where terms appear in infix or mixfix
|
||||||
operators. Thus, `_≡_` and `_≡⟨⟩_` are infix (each operator is written
|
operators. Thus, `_≡_` and `_≡⟨⟩_` are infix (each operator is written
|
||||||
|
|
|
@ -142,13 +142,13 @@ when `A` is anything other than `⊥` itself.
|
||||||
|
|
||||||
### Exercise (`≢`, `<-irrerflexive`)
|
### Exercise (`≢`, `<-irrerflexive`)
|
||||||
|
|
||||||
Using negation, show that [strict inequality](Relations/#strict-inequality)
|
Using negation, show that [strict inequality]({{ site.baseurl }}{% link out/plta/Relations.md %}/#strict-inequality)
|
||||||
is irreflexive, that is, `n < n` holds for no `n`.
|
is irreflexive, that is, `n < n` holds for no `n`.
|
||||||
|
|
||||||
|
|
||||||
### Exercise (`trichotomy`)
|
### Exercise (`trichotomy`)
|
||||||
|
|
||||||
Show that strict inequality satisfies [trichotomy](Relations/#trichotomy),
|
Show that strict inequality satisfies [trichotomy]({{ site.baseurl }}{% link out/plta/Relations.md %}/#trichotomy),
|
||||||
that is, for any naturals `m` and `n` exactly one of the following holds:
|
that is, for any naturals `m` and `n` exactly one of the following holds:
|
||||||
|
|
||||||
* `m < n`
|
* `m < n`
|
||||||
|
|
|
@ -534,7 +534,7 @@ which is left as an exercise for the reader.
|
||||||
|
|
||||||
Write out what is known about associativity on each of the first four
|
Write out what is known about associativity on each of the first four
|
||||||
days using a finite story of creation, as
|
days using a finite story of creation, as
|
||||||
[earlier](Naturals/index.html#finite-creation).
|
[earlier]({{ site.baseurl }}{% link out/plta/Naturals.md %}#finite-creation).
|
||||||
|
|
||||||
|
|
||||||
## Associativity with rewrite
|
## Associativity with rewrite
|
||||||
|
|
|
@ -32,7 +32,7 @@ postulate
|
||||||
extensionality : ∀ {A B : Set} {f g : A → B} → (∀ (x : A) → f x ≡ g x) → f ≡ g
|
extensionality : ∀ {A B : Set} {f g : A → B} → (∀ (x : A) → f x ≡ g x) → f ≡ g
|
||||||
\end{code}
|
\end{code}
|
||||||
|
|
||||||
[extensionality]: Equality/index.html#extensionality
|
[extensionality]: {{ site.baseurl }}{% link out/plta/Equality.md %}#extensionality
|
||||||
|
|
||||||
|
|
||||||
## Universals
|
## Universals
|
||||||
|
@ -92,7 +92,7 @@ Show that universals distribute over conjunction.
|
||||||
∀-Distrib-× = ∀ {A : Set} {B C : A → Set} →
|
∀-Distrib-× = ∀ {A : Set} {B C : A → Set} →
|
||||||
(∀ (x : A) → B x × C x) ≃ (∀ (x : A) → B x) × (∀ (x : A) → C x)
|
(∀ (x : A) → B x × C x) ≃ (∀ (x : A) → B x) × (∀ (x : A) → C x)
|
||||||
\end{code}
|
\end{code}
|
||||||
Compare this with the result (`→-distrib-×`) in Chapter [Connectives](Connectives).
|
Compare this with the result (`→-distrib-×`) in Chapter [Connectives]({{ site.baseurl }}{% link out/plta/Connectives.md %}).
|
||||||
|
|
||||||
### Exercise (`⊎∀-implies-∀⊎`)
|
### Exercise (`⊎∀-implies-∀⊎`)
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ The result can be viewed as a generalisation of currying. Indeed, the code to
|
||||||
establish the isomorphism is identical to what we wrote when discussing
|
establish the isomorphism is identical to what we wrote when discussing
|
||||||
[implication][implication].
|
[implication][implication].
|
||||||
|
|
||||||
[implication]: Connectives/index.html#implication
|
[implication]: {{ site.baseurl }}{% link out/plta/Connectives.md %}/index.html#implication
|
||||||
|
|
||||||
### Exercise (`∃-distrib-⊎`)
|
### Exercise (`∃-distrib-⊎`)
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ Does the converse hold? If so, prove; if not, explain why.
|
||||||
|
|
||||||
## An existential example
|
## An existential example
|
||||||
|
|
||||||
Recall the definitions of `even` and `odd` from Chapter [Relations](Relations).
|
Recall the definitions of `even` and `odd` from Chapter [Relations]({{ site.baseurl }}{% link out/plta/Relations.md %}).
|
||||||
\begin{code}
|
\begin{code}
|
||||||
data even : ℕ → Set
|
data even : ℕ → Set
|
||||||
data odd : ℕ → Set
|
data odd : ℕ → Set
|
||||||
|
|
|
@ -128,7 +128,7 @@ either `(1 ≤ 2) ≤ 3` or `1 ≤ (2 ≤ 3)`.
|
||||||
|
|
||||||
Given two numbers, it is straightforward to compute whether or not the first is
|
Given two numbers, it is straightforward to compute whether or not the first is
|
||||||
less than or equal to the second. We don't give the code for doing so here, but
|
less than or equal to the second. We don't give the code for doing so here, but
|
||||||
will return to this point in Chapter [Decidability](Decidability).
|
will return to this point in Chapter [Decidable]({{ site.baseurl }}{% link out/plta/Decidable.md %}).
|
||||||
|
|
||||||
|
|
||||||
## Properties of ordering relations
|
## Properties of ordering relations
|
||||||
|
@ -418,7 +418,7 @@ transitivity proves `m + p ≤ n + q`, as was to be shown.
|
||||||
|
|
||||||
The proof of monotonicity (and the associated lemmas) can be written
|
The proof of monotonicity (and the associated lemmas) can be written
|
||||||
in a more readable form by using an anologue of our notation for
|
in a more readable form by using an anologue of our notation for
|
||||||
`≡-reasoning`. Read ahead to chapter [Equivalence](Equivalence) to
|
`≡-reasoning`. Read ahead to chapter [Equality]({{ site.baseurl }}{% link out/plta/Equality.md %}) to
|
||||||
see how `≡-reasoning` is defined, define `≤-reasoning` analogously,
|
see how `≡-reasoning` is defined, define `≤-reasoning` analogously,
|
||||||
and use it to write out an alternative proof that addition is
|
and use it to write out an alternative proof that addition is
|
||||||
monotonic with regard to inequality.
|
monotonic with regard to inequality.
|
||||||
|
@ -448,7 +448,7 @@ It is also monotonic with regards to addition and multiplication.
|
||||||
Most of the above are considered in exercises below. Irreflexivity
|
Most of the above are considered in exercises below. Irreflexivity
|
||||||
requires negation, as does the fact that the three cases in
|
requires negation, as does the fact that the three cases in
|
||||||
trichotomy are mutually exclusive, so those points are deferred
|
trichotomy are mutually exclusive, so those points are deferred
|
||||||
to the chapter that introduces [negation](Negation).
|
to the chapter that introduces [negation]({{ site.baseurl }}{% link out/plta/Negation.md %}).
|
||||||
|
|
||||||
It is straightforward to show that `suc m ≤ n` implies `m < n`,
|
It is straightforward to show that `suc m ≤ n` implies `m < n`,
|
||||||
and conversely. One can then give an alternative derivation of the
|
and conversely. One can then give an alternative derivation of the
|
||||||
|
@ -469,7 +469,7 @@ the sense that for any `m` and `n` that one of the following holds:
|
||||||
This only involves two relations, as we define `m > n` to
|
This only involves two relations, as we define `m > n` to
|
||||||
be the same as `n < m`. You will need a suitable data declaration,
|
be the same as `n < m`. You will need a suitable data declaration,
|
||||||
similar to that used for totality. (We will show that the three cases
|
similar to that used for totality. (We will show that the three cases
|
||||||
are exclusive after [negation](Negation) is introduced.)
|
are exclusive after [negation]({{ site.baseurl }}{% link out/plta/Negation.md %}) is introduced.)
|
||||||
|
|
||||||
### Exercise (`+-mono-<`)
|
### Exercise (`+-mono-<`)
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ import Data.Nat.Properties using (≤-refl; ≤-trans; ≤-antisym; ≤-total;
|
||||||
+-monoʳ-≤; +-monoˡ-≤; +-mono-≤)
|
+-monoʳ-≤; +-monoˡ-≤; +-mono-≤)
|
||||||
\end{code}
|
\end{code}
|
||||||
In the standard library, `≤-total` is formalised in terms of
|
In the standard library, `≤-total` is formalised in terms of
|
||||||
disjunction (which we define in Chapter [Connectives](Connectives)),
|
disjunction (which we define in Chapter [Connectives]({{ site.baseurl }}{% link out/plta/Connectives.md %})),
|
||||||
and `+-monoʳ-≤`, `+-monoˡ-≤`, `+-mono-≤` are proved differently than here
|
and `+-monoʳ-≤`, `+-monoˡ-≤`, `+-mono-≤` are proved differently than here
|
||||||
as well as taking as implicit arguments that here are explicit.
|
as well as taking as implicit arguments that here are explicit.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue