Merge branch 'master' of github.com:pepijnkokke/sf
* 'master' of github.com:pepijnkokke/sf: updated stlc
This commit is contained in:
commit
f682a4c8d7
1 changed files with 4 additions and 11 deletions
|
@ -8,7 +8,6 @@ permalink : /Stlc
|
||||||
module Stlc where
|
module Stlc where
|
||||||
\end{code}
|
\end{code}
|
||||||
|
|
||||||
<div class="hidden">
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
open import Maps using (Id; id; _≟_; PartialMap; module PartialMap)
|
open import Maps using (Id; id; _≟_; PartialMap; module PartialMap)
|
||||||
open import Data.Empty using (⊥; ⊥-elim)
|
open import Data.Empty using (⊥; ⊥-elim)
|
||||||
|
@ -19,7 +18,6 @@ open import Function using (_∘_; _$_)
|
||||||
open import Relation.Nullary using (Dec; yes; no)
|
open import Relation.Nullary using (Dec; yes; no)
|
||||||
open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl)
|
open import Relation.Binary.PropositionalEquality using (_≡_; _≢_; refl)
|
||||||
\end{code}
|
\end{code}
|
||||||
</div>
|
|
||||||
|
|
||||||
# The Simply Typed Lambda-Calculus
|
# The Simply Typed Lambda-Calculus
|
||||||
|
|
||||||
|
@ -161,13 +159,9 @@ so we will STLC's function type as `_⇒_`.
|
||||||
data Type : Set where
|
data Type : Set where
|
||||||
bool : Type
|
bool : Type
|
||||||
_⇒_ : Type → Type → Type
|
_⇒_ : Type → Type → Type
|
||||||
\end{code}
|
|
||||||
|
|
||||||
<div class="hidden">
|
|
||||||
\begin{code}
|
|
||||||
infixr 5 _⇒_
|
infixr 5 _⇒_
|
||||||
\end{code}
|
\end{code}
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
### Terms
|
### Terms
|
||||||
|
@ -194,21 +188,20 @@ to Agda (and other functional languages like ML, Haskell, etc.),
|
||||||
which use _type inference_ to fill in missing annotations. We're
|
which use _type inference_ to fill in missing annotations. We're
|
||||||
not considering type inference here.
|
not considering type inference here.
|
||||||
|
|
||||||
Some examples...
|
We introduce $$x, y, z$$ as names for variables. The pragmas ensure
|
||||||
|
that $$id 0, id 1, id 2$$ display as $$x, y, z$$.
|
||||||
|
|
||||||
\begin{code}
|
\begin{code}
|
||||||
x = id 0
|
x = id 0
|
||||||
y = id 1
|
y = id 1
|
||||||
z = id 2
|
z = id 2
|
||||||
\end{code}
|
|
||||||
|
|
||||||
<div class="hidden">
|
|
||||||
\begin{code}
|
|
||||||
{-# DISPLAY id zero = x #-}
|
{-# DISPLAY id zero = x #-}
|
||||||
{-# DISPLAY id (suc zero) = y #-}
|
{-# DISPLAY id (suc zero) = y #-}
|
||||||
{-# DISPLAY id (suc (suc zero)) = z #-}
|
{-# DISPLAY id (suc (suc zero)) = z #-}
|
||||||
\end{code}
|
\end{code}
|
||||||
</div>
|
|
||||||
|
Some examples...
|
||||||
|
|
||||||
$$\text{idB} = \lambda x:bool. x$$.
|
$$\text{idB} = \lambda x:bool. x$$.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue