0

I have these three tables:

 Customer
 Rent
 Book

The cardinality between the Customer and the Rent table is (1,6) and the cardinality between the Rent and the Book table is (1,infinity).

Using relational calculus's syntax, I would define a (0,1) cardinality like this:

∀x∀y∀z(rent(x,y)∧rent(x,z) → y =z)

But how can I define a (1,6) cardinality?

4

1 に答える 1

0

次のように(質問を表現したように、述語計算で)表現できます。

∀ x (x ∈ Customers →  ∃ y rent(x,y))

∧

∀ x (x ∈ Customers → cardinality ({ y | rent(x,y)}) ≤ 6)

cardinality(set) ≤ n必要に応じて、次の形式の複雑な論理式で条件を記述できます。

∀y1∀y2 ... ∀yn (rent(x,y1) ∧ rent(x,y2) ∧ ... ∧ rent(x,yn)
                  ∧ y1 ≠ y2 ^ ... (all the possible pairs) ... 
  → ∄ ys (rent(x,ys)  ∧ ys ≠ y1 ^ ys ≠ y2 ^ ... ^ ys ≠ yn)

またはより簡潔な方法で(@philipxyのメモを参照):

∀y0∀y1 ... ∀yn (rent(x,y0) ∧ rent(x,y1) ∧ ... ∧ rent(x,yn) → y0 = y1 ∨ ... 
于 2016-09-28T05:22:16.000 に答える