1. POLÍTICAS EDUCATIVAS Y ENFOQUES EN LA EVALUACIÓN
1.6 Reflexiones acerca de la Evaluación en Matemáticas y Física
We set D = R+0 ∪ {∞}, i.e., the set of nonnegative real numbers together
with an element∞. Ordering and addition onR+0 extend to Dby∞+x=
x+∞=∞ and x≤ ∞.
Definition 3.2.1 We define the set VC of views coinductively by
• ♦(·) assigns to each view r∈VC and class C∈C a number ♦(Cr).
• Aget(·,·) assigns to each view r ∈ VC and class C ∈ C and field
a∈A(C) a views=Aget(Cr, a).
• Aset(·,·) assigns to each view r ∈ VC and class C ∈ C and field
a∈A(C) a views0 =Aset(Cr, a).
1
1
1
1
..
.
...
1
..
.
...
g s1
1
..
.
...
1
..
.
...
g s g sFigure 3.3: Infinite tree representing view rich. We remark that a view can be regarded as an infinite tree given by
VC ={t|t:L∗C →D} where the set of labelsLC is defined as follows:
LC ={Ck.aj.t|Ck∈C, aj ∈A(Ck), t∈ {get,set}}
Further, we say that a view isregular if it is a regular infinite tree, i.e. if it contains a finite number of different sub-trees. For instance, the view rich described in Section 3.1.4 can be represented as the regular infinite tree dis- played in Fig. 3.2.1 wheregstands for Cons.next.getandsfor Cons.next.set. We define an inequality relation between viewsrvscoinductively.
Definition 3.2.2 (rvs) Let r, s∈VC. We define rvs coinductively by
∀C∈C.♦(Cr)≥♦(Cs) (3.2.1) ∀C∈C∀a∈A(C) .Aget(Cr, a)vAget(Cs, a) (3.2.2) ∀C ∈C ∀a∈A(C) .Aset(Cs, a)vAset(Cr, a) (3.2.3) Notice that the defined preorder v on views is covariant in the get views and contravariant in the set views.
We define the operations ∨ : VC ×VC → VC and ∧ : VC ×VC → VC simultaneously. Lets1, s2 ∈VC, then, for each C∈C anda∈A(C) we set:
♦(Cs1∨s2) = min(♦(Cs1),♦(Cs2))
Aget(Cs1∨s2, a) = Aget(Cs1, a)∨Aget(Cs2, a)
Aset(Cs1∨s2, a) = Aset(Cs1, a)∧Aset(Cs2, a) ♦(Cs1∧s2) = max(♦(Cs1),♦(Cs2))
Aget(Cs1∧s2, a) = Aget(Cs1, a)∧Aget(Cs2, a)
Lemma 3.2.3 Let s1, s2 ∈VC. Then for alli∈ {1,2} holds 1. si vs1∨s2.
2. s1∧s2 vsi.
Proof. Simultaneously by coinduction.
1. We show (3.2.1), (3.2.2) and (3.2.3). LetC ∈C and a∈A(C). Then: (a) (3.2.1) follows by ♦(Csi)≥ min(♦(Cs1),♦(Cs2)).
(b) (3.2.2) follows by Aget(Csi, a) v Aget(Cs1, a)∨Aget(Cs2, a), which
follows by the coinduction hypothesis (1).
(c) (3.2.3) follows by Aset(Cs1, a) ∧Aset(Cs2, a) v Aset(Csi, a), which
follows by the coinduction hypothesis (2).
2. We show (3.2.1), (3.2.2) and (3.2.3). LetC ∈C and a∈A(C). Then: (a) (3.2.1) follows by max(♦(Cs1),♦(Cs2))≥♦(Csi).
(b) (3.2.2) follows by Aget(Cs1, a) ∧Aget(Cs2, a) v Aget(Csi, a), which
follows by the coinduction hypothesis (2).
(c) (3.2.3) follows by Aset(Csi, a) v Aset(Cs1, a)∨ Aset(Cs2, a), which
follows by the coinduction hypothesis (1).
2
Lemma 3.2.4 Let s1, s2, r∈VC. Then for alli∈ {1,2} holds 1. If si vr thens1∨s2 vr.
2. If rvsi thenr vs1∧s2.
Proof. Simultaneously by coinduction.
1. We show (3.2.1), (3.2.2) and (3.2.3). LetC ∈C and a∈A(C). Then: (a) (3.2.1) follows by min(♦(Cs1),♦(Cs2))≥♦(Cr), which follows by
the assumption♦(Csi)≥♦(Cr).
(b) (3.2.2) follows by Aget(Csi, a) v Aget(Cr, a) implies Aget(Cs1, a) ∨
Aget(Cs2, a) v Aget(Cr, a), which follows by the coinduction hy-
pothesis (1).
(c) (3.2.3) follows by Aset(Cr, a) v Aset(Csi, a) implies Aset(Cr, a) v
Aset(Cs1, a)∧Aset(Cs2, a), which follows by the coinduction hypoth-
esis (2).
2. We show (3.2.1), (3.2.2) and (3.2.3). LetC ∈C and a∈A(C). Then: (a) (3.2.1) follows by♦(Cr)≥ max(♦(Cs1),♦(Cs2)), which follows by
(b) (3.2.2) follows by Aget(Cr, a) v Aget(Csi, a) implies Aget(Cr, a) v
Aget(Cs1, a)∧Aget(Cs2, a), which follows by the coinduction hypoth-
esis (2).
(c) (3.2.3) follows by Aset(Csi, a) v Aset(Cr, a) implies Aset(Cs1, a) ∨
Aset(Cs2, a)vAset(Cr, a), which follows by the coinduction hypoth-
esis (1).
2
Corollary 3.2.5 (Least upper bound and greatest lower bound) 1. s1∨s2 is the least upper bound of s1 and s2.
2. s1∧s2 is the greatest lower bound of s1 and s2.
Proof. Follows by the Lemmas 3.2.3 and 3.2.4. 2
Lemma 3.2.6 (Monotonicity of ∧ and ∨) Let r, r0, s, s0 ∈VC. Then: 1. if rvr0 and svs0 thenr∧svr0∧s0.
2. if r0 vr and s0vsthenr0∨s0 vr∨s.
Proof. Simultaneously by coinduction. 2
We define the addition operations on views ⊕ : VC ×VC → VC and
: VC ×VC → VC simultaneously as follows. Let s1, s2 ∈ VC, then,
for each C∈C,a∈A(C) we set:
♦(Cs1⊕s2) = ♦(Cs1) +♦(Cs2)
Aget(Cs1⊕s2, a) = Aget(Cs1, a)⊕Aget(Cs2, a)
Aset(Cs1⊕s2, a) = Aset(Cs1, a)Aset(Cs2, a) ♦Cs1s2 = min(♦(Cs1),♦(Cs2))
AgetCs1s2, a = Aget(Cs1, a)Aget(Cs2, a)
AsetCs1s2, a = Aset(Cs1, a)⊕Aset(Cs2, a)
Lemma 3.2.7 Let r, s1, s2 ∈VC and let i∈ {1,2}. Then: 1. If rvs1⊕s2 thenr vsi.
2. If s1s2 vr thensi vr.
Lemma 3.2.8 (Monotonicity of ⊕ and .) Let r, r0, s, s0 ∈VC and let
i∈ {1,2}.
1. If rvr0 and svs0 thenr⊕svr0⊕s0. 2. If r0vr and s0vsthenr0s0 vrs.
Proof. Simultaneously by coinduction. 2
ARAJA type orrefined typeconsists of a classCand a viewrand is written Cr. IfCris a refined type then we denote by|Cr|=C the underlying FJEU
typeCand by hhCrii=r its view. We extend the subtyping of FJEU classes (Fig. 2.2) to refined types as follows.
Definition 3.2.9 (Cr <:Ds) We extend subtyping to refined types by
Cr<:Ds ⇐⇒ C <:D and rvs (3.2.4) Notice that since both vand <: on FJEU are reflexive and transitive so is <: on RAJA. In the following, when we refer to subtyping, unless specified otherwise, we mean subtyping of refined types.
In contrast to the original RAJA system [HJ06], our modified system does not require the set view of a fieldaof a refined typeCsto be a subtype
of its get view in all cases, i.e. we do not require Aset(Cs, a) v Aget(Cs, a) to hold for every refined type Cs and field a ∈ A(C). We shall see later that, for proving soundness, Aset(Cs, a)vAget(Cs, a) is only required for the
dynamic type of a location in a heap and all its fields, and the main view that corresponds to that location. The advantage of this modification will become clear in Chapter 5, when we present a type inference algorithm for the system based on constraint generation; the modification will cause that less constraints are generated, which increases efficiency.
Definition 3.2.10 Let Cr be a refined type. We say that Cr is a main RAJA typeand write Cr main, if ∀a∈A(C) .Aset(Cr, a)vAget(Cr, a).