Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
b47a5c84
Commit
b47a5c84
authored
Nov 14, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
funclang series2: Added report.
parent
ce96be5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
161 additions
and
0 deletions
+161
-0
funclang-taddeus/series2/series2.tex
funclang-taddeus/series2/series2.tex
+161
-0
No files found.
funclang-taddeus/series2/series2.tex
0 → 100644
View file @
b47a5c84
\documentclass
[10pt,a4paper]
{
article
}
\usepackage
[english]
{
babel
}
\usepackage
[utf8]
{
inputenc
}
\usepackage
{
amsmath,hyperref,graphicx,booktabs,float,listings
}
% Paragraph indentation
\setlength
{
\parindent
}{
0pt
}
\setlength
{
\parskip
}{
1ex plus 0.5ex minus 0.2ex
}
\title
{
Functional Languages - Assignment series 2
}
\author
{
Tadde
\"
us Kroes (6054129)
}
\begin{document}
\maketitle
\section
{
Assignment 4
}
Assignment:
\emph
{
Define the Boolean functions negation, disjunction and
conjunction as
$
\lambda
$
-terms.
}
\newcommand
{
\s
}{
\hspace
{
2mm
}}
\newcommand
{
\true
}{
\lambda
a.
\lambda
b.a
}
\newcommand
{
\truea
}{
\lambda
u.
\lambda
v.u
}
\newcommand
{
\false
}{
\lambda
a.
\lambda
b.b
}
\newcommand
{
\falsea
}{
\lambda
u.
\lambda
v.v
}
\subsection
{
Negation
}
Negation flips the value of a boolean (TRUE becomes FALSE and vice versa).
Consider
$
\neg
=
\lambda
b.
\lambda
x.
\lambda
y.
((
b
\s
y
)
\s
x
)
$
.
Given that
$
TRUE
=
\true
$
and
$
FALSE
=
\false
$
, we can make the following
derivations:
\begin{table}
[H]
\begin{tabular}
{
rl
}
$
\neg
TRUE
$
&
$
=
(
\lambda
b.
\lambda
x.
\lambda
y.
((
b
\s
y
)
\s
x
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
\lambda
x.
\lambda
y.
((
\true
\s
y
)
\s
x
)
$
\\
&
$
\rightarrow
_{
\beta
}
\lambda
x.
\lambda
y.
(
\lambda
b.y
\s
x
)
$
\\
&
$
\rightarrow
_{
\beta
}
\lambda
x.
\lambda
y.y
$
\\
&
$
\equiv
_{
\alpha
}
FALSE
$
\\
&
\\
$
\neg
FALSE
$
&
$
=
(
\lambda
b.
\lambda
x.
\lambda
y.
((
b
\s
y
)
\s
x
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
\lambda
x.
\lambda
y.
((
\false
\s
y
)
\s
x
)
$
\\
&
$
\rightarrow
_{
\beta
}
\lambda
x.
\lambda
y.
(
\lambda
b.b
\s
x
)
$
\\
&
$
\rightarrow
_{
\beta
}
\lambda
x.
\lambda
y.x
$
\\
&
$
\equiv
_{
\alpha
}
TRUE
$
\\
\end{tabular}
\end{table}
TRUE and FALSE are both flipped, so the function
$
\neg
$
is correct.
\pagebreak
\subsection
{
Disjunction
}
The disjunction function
$
\vee
$
should have the following properties:
\\
TRUE
$
\vee
$
TRUE = TRUE
\\
TRUE
$
\vee
$
FALSE = TRUE
\\
FALSE
$
\vee
$
TRUE = TRUE
\\
FALSE
$
\vee
$
FALSE = FALSE
Consider
$
\vee
=
\lambda
p.
\lambda
q.
((
p
\s
p
)
\s
q
)
$
. Given the functions for
TRUE and FALSE, the combination of the following derivations proves that the
function
$
\vee
$
is correct:
\begin{table}
[H]
\begin{tabular}
{
rl
}
$
TRUE
\s\vee\s
TRUE
$
&
$
=
(
\lambda
p.
(
\lambda
q.
((
p
\s
p
)
\s
q
)
\s
\true
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
q.
((
\true
\s
\true
)
\s
q
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
((
\true
\s
\true
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\alpha
,
\beta
}
(
\lambda
b.
\truea
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
\truea
$
\\
&
$
\equiv
_{
\alpha
}
TRUE
$
\\
&
\\
$
TRUE
\s\vee\s
FALSE
$
&
$
=
(
\lambda
p.
(
\lambda
q.
((
p
\s
p
)
\s
q
)
\s
\false
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
q.
((
\true
\s
\true
)
\s
q
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
((
\true
\s
\true
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\alpha
,
\beta
}
(
\lambda
b.
\truea
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
\truea
$
\\
&
$
\equiv
_{
\alpha
}
TRUE
$
\\
&
\\
$
FALSE
\s\vee\s
TRUE
$
&
$
=
(
\lambda
p.
(
\lambda
q.
((
p
\s
p
)
\s
q
)
\s
\true
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
q.
((
\false
\s
\false
)
\s
q
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
((
\false
\s
\false
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
b.b
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
\true
$
\\
&
$
\equiv
_{
\alpha
}
TRUE
$
\\
&
\\
$
FALSE
\s\vee\s
FALSE
$
&
$
=
(
\lambda
p.
(
\lambda
q.
((
p
\s
p
)
\s
q
)
\s
\false
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
q.
((
\false
\s
\false
)
\s
q
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
((
\false
\s
\false
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
b.b
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
\false
$
\\
&
$
\equiv
_{
\alpha
}
FALSE
$
\\
\end{tabular}
\end{table}
\pagebreak
\subsection
{
Conjunction
}
The disjunction function
$
\wedge
$
should have the following properties:
\\
TRUE
$
\wedge
$
TRUE = TRUE
\\
TRUE
$
\wedge
$
FALSE = FALSE
\\
FALSE
$
\wedge
$
TRUE = FALSE
\\
FALSE
$
\wedge
$
FALSE = FALSE
Consider
$
\wedge
=
\lambda
p.
\lambda
q.
((
p
\s
q
)
\s
p
)
$
. Given the functions for
TRUE and FALSE, the combination of the following derivations proves that the
function
$
\wedge
$
is correct:
\begin{table}
[H]
\begin{tabular}
{
rl
}
$
TRUE
\s\wedge\s
TRUE
$
&
$
=
(
\lambda
p.
(
\lambda
q.
((
p
\s
q
)
\s
p
)
\s
\true
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
q.
((
\true
\s
q
)
\s
\true
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
((
\true
\s
\true
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\alpha
,
\beta
}
(
\lambda
b.
\truea
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
\truea
$
\\
&
$
\equiv
_{
\alpha
}
TRUE
$
\\
&
\\
$
TRUE
\s\wedge\s
FALSE
$
&
$
=
(
\lambda
p.
(
\lambda
q.
((
p
\s
q
)
\s
p
)
\s
\false
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
q.
((
\true
\s
q
)
\s
\true
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
((
\true
\s
\false
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\alpha
,
\beta
}
(
\lambda
b.
\falsea
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
\falsea
$
\\
&
$
\equiv
_{
\alpha
}
FALSE
$
\\
&
\\
$
FALSE
\s\wedge\s
TRUE
$
&
$
=
(
\lambda
p.
(
\lambda
q.
((
p
\s
q
)
\s
p
)
\s
\true
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
q.
((
\false
\s
q
)
\s
\false
)
\s
\true
)
$
\\
&
$
\rightarrow
_{
\beta
}
((
\false
\s
\true
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
b.b
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
\false
$
\\
&
$
\equiv
_{
\alpha
}
FALSE
$
\\
&
\\
$
FALSE
\s\wedge\s
FALSE
$
&
$
=
(
\lambda
p.
(
\lambda
q.
((
p
\s
q
)
\s
p
)
\s
\false
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
q.
((
\false
\s
q
)
\s
\false
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
((
\false
\s
\false
)
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
(
\lambda
b.b
\s
\false
)
$
\\
&
$
\rightarrow
_{
\beta
}
\false
$
\\
&
$
\equiv
_{
\alpha
}
FALSE
$
\\
\end{tabular}
\end{table}
\section
{
Assignment 5
}
See appendix
\ref
{
appendix:ass5
}
(file
\emph
{
ass5.ml
}
) for my implementation
of the functions
\texttt
{
isLeapYear
}
,
\texttt
{
date2str
}
,
\texttt
{
digitRoot
}
and
\texttt
{
isPalindrome
}
.
\pagebreak
\appendix
\section
{
ass5.ml
}
\label
{
appendix:ass5
}
\lstinputlisting
{
ass5.ml
}
\end{document}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment