Call-by-name Evaluation
We have previously seen the call-by-value rule:
Consider the functions in the program :
This rule can get problematic for certain computations such as:
In order to model call-by-name evaluations, we replace the call-by-value rule with following call-by-name rule:
Example: Show call-by-name evaluation of program
Let program be:
Using call-by-name semantics the term also has the value , . However in contrast to call-by-value, because the argument is discarded without evaluation:
Types for SFUN
The grammar defining the syntax of SFUN allows us to build terms such as which do not make sense. In the definition of the semantics of SFUN we only consider well-typed terms.
The base types, , and the types of SFUN are defined as follows:
In the case of a type such that (function with no arguments), may be written as .
Well-typed terms
The set of well-typed terms can be defined using the relation:
- Where is the variable environment which maps some variables to types. It is a finite partial function assignment.
- Where is the function environment which maps each fn. to a type specifying arity.
- Where is an SFUN term.
- Where is a type.
“If the variable has type for each and the functions have types then the term has type .”
Typing SFUN terms
The well-typed relation is inductively defined by the following system of axioms and rules. In case the case of the application of a function where then the rule reduces to an axiom, because there are no arguments to check.

Example: Give the derivation for the typing of term .
Example: Give derivation of typing of term .
Given that . And that . We have that:
Typing SFUN programs
Given a program in SFUN:
and a function environment , is typeable, if for each equation , there exists an environment and a type , such that:
Example: Is program typeable?
Let program be:
And given a function environment where:
is a typeable program. All the equations are typeable with type , the first in an empty environment and the latter two using an environment , such that .
Proving properties of SFUN programs
We can use proof by induction on SFUN programs directly.
Example: Given that , prove that for all natural numbers .
Base Case: Show that . By definition of , evalutes to , and then by the left-hand side of the conditional, , as expected. Induction Hypothesis: Assume . Induction Step: Show that . will evaluate to . By the right-hand side of the conditional, which is equal to . By the inductive hypothesis, this is equal to , which is simply .