# Using the RM for ADTs

Date: Thu, 2 Jul 2009 02:28:54 -0700 (PDT)

Message-ID: <2fb127c0-13e3-45e6-a93b-3afe7dead964_at_d4g2000yqa.googlegroups.com>

Consider a requirement to record electronic circuits in a relational database. Circuits are abstract mathematical objects (i.e. "values") independent of physical layout. There is no requirement to label individual components (e.g. all 1 ohm resistors are indistinguishable), nor any requirement to label circuit nodes.

The reason for recording circuit values in a physical database is outside the scope of this discussion.

Two circuits are equivalent if they are isomorphic. A model for a circuit value must define exactly when circuits are identical. Failure to do so would mean for example that a set of circuit values is illdefined (e.g. one cannot determine the cardinality of the set).

In principle a very large circuit can consist of thousands of components, wired up in a complex network. Recursive types cannot eliminate the need for abstract identifiers.

One approach is to use abstract identifiers for the circuit nodes, and use relations such as:

resistor(N1,N2,R) :- there is a resistor of value R

connected between nodes N1,N2.

This raises the question of whether the following symmetry

resistor(N1,N2,R) <=> resistor(N2,N1,R)

resistor'(N1,N2,R,M) :- there are M resistors

of value R connected (in parallel) between nodes N1,N2.

I find it curious that we would only tend to record the tuples where M>0. Normally under a closed world assumption one expects the set of tuples for a given relation to be uniquely defined. However in this case, under CWA, a tuple with M=0 can be removed without changing the circuit value. Note as well that a similar issue would occur in the relation

resistor''(N1,N2,C) :- there is a resistor with

conductance C (in siemens) connected between nodes N1,N2.

because resistors with zero conductance are equivalent to no resistor at all. I find this interesting because it complicates the definition of circuit identity. One could apply the integrity constraint C>0, however that somehow seems artificial in a logical model, and more like a rule an implementation would impose.

I'd like to know whether circuit identity can be implicit in the database schema by treating abstract identifiers specially. If there's still ambiguity in the model then a comparison operator must be separately and explicitly defined. Is that acceptable given that C.Date says the relations *are* the logical model?