13.07.2015 Views

A Graph-Based Generic Type System for Object-Oriented Programs

A Graph-Based Generic Type System for Object-Oriented Programs

A Graph-Based Generic Type System for Object-Oriented Programs

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Type</strong> Operations 17Table 2: <strong>Type</strong> Equivalencet-eq 0 (X, Y, Q) ̂=(s, t) ∈ Q x ∈ s y ∈ t x −→ a x ′ ∈ X x ′ /∈ Q.sy −→ a y ′ ∈ Y y ′ ∈ t ′ (s ′ , t ′ ) ∈ Q y −→ a y ′ ∈ Y y ′ /∈ Q.tt-eq 0 (X, Y, Q {(s ′ , t ′ )} ∪ {(s ′ ∪ {x ′ }, t ′ )} t-eq 0 (X, Y, Q ∪ {({x ′ }, {y ′ })})false(s, t) ∈ Q x ∈ s y ∈ t y a −→ y ′ ∈ Y y ′ /∈ Q.tt-eq 0 (Y, X, {(v, u) | (u, v) ∈ Q})(s, t), (s ′ 1, t ′ 1), (s ′ 2, t ′ 2) ∈ Q(s ′ 1, t ′ 1) ≠ (s ′ 2, t ′ 2) x 1 , x 2 ∈ s x 1a−→ x′1 , x 2a−→ x′2 ∈ X x ′ 1 ∈ s ′ 1 x ′ 2 ∈ s ′ 2t-eq 0 (X, Y, Q {(s ′ 1, t ′ 1)} {(s ′ 2, t ′ 2)} ∪ {(s ′ 1 ∪ s ′ 2, t ′ 1 ∪ t ′ 2)})(s, t), (s ′ 1, t ′ 1), (s ′ 2, t ′ 2) ∈ Q(s ′ 1, t ′ 1) ≠ (s ′ 2, t ′ 2) y 1 , y 2 ∈ t y 1a−→ y′1 , y 2a−→ y′2 ∈ Y y ′ 1 ∈ t ′ 1 y ′ 2 ∈ t ′ 2t-eq 0 (X, Y, Q {(s ′ 1, t ′ 1)} {(s ′ 2, t ′ 2)} ∪ {(s ′ 1 ∪ s ′ 2, t ′ 1 ∪ t ′ 2)})(s, t) ∈ Qn 1 ≠ n 2n 1 , n 2 ∈ s ∪ t{n 1 , n 2 } Sfalse(s, t) ∈ Q x ∈ s y ∈ t{a | x a −→ · ∈ X} ≠ {b | y b −→ · ∈ Y }false (Q, true) ,where Q is a set of pairs and each pair consists of two sets of equivalent nodes, Q.s = ⋃ (s,t)∈Q s andQ.t = ⋃ (s,t)∈Q t.4 <strong>Type</strong> OperationsIn an rcos/g program, types are specified by type expressions. Besides atomic type expressions,such as primitive types, classes and type variables, a type expression also consists of typeoperations.We have two type operations, class conjunction and class instantiation. Since types are representedby rooted graphs, type operations are defined in terms of graph operations. In thissection, we define conjunction graphs and instantiation graphs <strong>for</strong> class conjunctions and classinstantiations, respectively.The graph operations share a common idea — the result graph is constructed by introducing newstructural nodes and new edges pointing into the operand graphs without changing any existingrooted graphs.Report No. 448, June 2011UNU-IIST, P.O. Box 3058, Macao

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!