<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
		<id>http://d2.reldb.org/index.php?action=history&amp;feed=atom&amp;title=PhilipTutorial</id>
		<title>PhilipTutorial - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://d2.reldb.org/index.php?action=history&amp;feed=atom&amp;title=PhilipTutorial"/>
		<link rel="alternate" type="text/html" href="http://d2.reldb.org/index.php?title=PhilipTutorial&amp;action=history"/>
		<updated>2026-05-06T14:07:57Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.26.2</generator>

	<entry>
		<id>http://d2.reldb.org/index.php?title=PhilipTutorial&amp;diff=156&amp;oldid=prev</id>
		<title>Dandl: Initial creation from TTM post</title>
		<link rel="alternate" type="text/html" href="http://d2.reldb.org/index.php?title=PhilipTutorial&amp;diff=156&amp;oldid=prev"/>
				<updated>2017-09-24T14:29:59Z</updated>
		
		<summary type="html">&lt;p&gt;Initial creation from TTM post&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is a verbatim copy of text posted by Philip to the TTM mailing list, lightly edited for continuity and formatting.&lt;br /&gt;
&lt;br /&gt;
Hopefully Philip will improve it, but (of course) he may just delete it. Over to Philip.&lt;br /&gt;
&lt;br /&gt;
== PREAMBLE ==&lt;br /&gt;
&lt;br /&gt;
Below is an edited message that quoted others with some RM semantics, my &amp;#039;tutorial&amp;#039; &amp;amp; my &amp;#039;quiz&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
I have sent many messages about RM query meanings. The recent intro/tutorial/quiz that this is from is not intended &lt;br /&gt;
to be an ideal presentation. &lt;br /&gt;
If one bumped up against not understanding something in reading an example or not knowing something in answering the quiz, &lt;br /&gt;
presumably one would ask a question or point out a contradiction.&lt;br /&gt;
&lt;br /&gt;
== INTRODUCTION ==&lt;br /&gt;
&lt;br /&gt;
Each relvar name has a dba-given predicate and each operator has a Codd-given transformation on predicates. &lt;br /&gt;
Each query subexpression (relation or wff) has a predicate built from its mentioned relvar names and operators. &lt;br /&gt;
This is in fact how we actually know what queries mean.&lt;br /&gt;
&lt;br /&gt;
Every relvar has a predicate (parameterized statement about the &lt;br /&gt;
world), with attributes the free variables. Every relation operator &lt;br /&gt;
has a corresponding predicate transform, eg JOIN/AND. So every &lt;br /&gt;
relation expression has a corresponding predicate, and vice versa. The &lt;br /&gt;
design of the relation operators is such that IF the relvars&amp;#039; values are their predicates&amp;#039;&lt;br /&gt;
extensions THEN an expression&amp;#039;s value is its predicate&amp;#039;s extension. &lt;br /&gt;
The value of a relvar after an assignment is the value of the query &lt;br /&gt;
evaluated before the assignment. Which means the extension of the &lt;br /&gt;
relvar predicate in the new state is the extension of the expression predicate in the old state.&lt;br /&gt;
When I say that is all you need to know, THAT IS ALL YOU NEED TO KNOW.&lt;br /&gt;
&lt;br /&gt;
The predicate of a relation expression that is a name of a relation &lt;br /&gt;
variable or constant is its predicate. The predicate of a relation &lt;br /&gt;
expression that is a JOIN is the AND of the predicates its operands; &lt;br /&gt;
of a UNION is the OR; of a MINUS is the AND NOT; of a RESTRICT X=Y or &lt;br /&gt;
of an ADD X AS Y is the AND X=Y; and of a PROJECTALLBUT X is the &lt;br /&gt;
EXISTS X.&lt;br /&gt;
&lt;br /&gt;
RE: delete-through-restrict - logical basis&lt;br /&gt;
&lt;br /&gt;
 query    wff    predicate:&lt;br /&gt;
 n     n(x,y)     &amp;#039;x likes y&amp;#039;&lt;br /&gt;
 m     m(z)     &amp;#039;i like z&amp;#039;&lt;br /&gt;
 n where y=3     n(x,y) and y=3    &amp;#039;x likes y and y=3&amp;#039;&lt;br /&gt;
 (n where y=3){allbut y}    exists y [n(x,y) and y=3]    &amp;#039;x likes 3&amp;#039;&lt;br /&gt;
 (n where y=3){allbut y}    n(x, 3)    &amp;#039;x likes 3&amp;#039;&lt;br /&gt;
 m rename z to x     m(x)     &amp;#039;i like x&amp;#039;&lt;br /&gt;
 (n where y=3) join (m rename z to x)     n(x, y) and y=3 and m(x)&lt;br /&gt;
      &amp;#039;x likes y and y=3 and i like x&amp;#039; ie  &amp;#039;x likes 3 and y=3 and i like x&amp;#039;&lt;br /&gt;
 (n where y=3){allbut y} join (m rename z to x)    n(x, 3) and m(x)&lt;br /&gt;
      &amp;#039;x likes 3 and i like x&amp;#039;&lt;br /&gt;
&lt;br /&gt;
----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
The value of every subexpression is the extension of its predicate.&lt;br /&gt;
I append (a) an excerpt tracing and justifying an illustrating example and (b) a self-quiz excerpt.&lt;br /&gt;
&lt;br /&gt;
== TUTORIAL ==&lt;br /&gt;
&lt;br /&gt;
Here is how a relational database works.&lt;br /&gt;
&lt;br /&gt;
 type T={a, b}&lt;br /&gt;
 relvar r RELATION{X T} &amp;quot;i like X&amp;quot;&lt;br /&gt;
 Relvar predicate for relvar r is &amp;quot;i like X&amp;quot;.&lt;br /&gt;
 r:=RELATION{TUPLE{X a}} // i like a and i don&amp;#039;t like b.&lt;br /&gt;
 Relvar r value, relvar r (and database) proposition is &amp;quot;i like a and i don&amp;#039;t like b&amp;quot;.&lt;br /&gt;
 r:=RELATION{TUPLE{X a},TUPLE{X b}} // now i like a and i like b.&lt;br /&gt;
 Relvar r value, relvar r (and database) proposition is &amp;quot;i like a and i like b&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
hmm... if i assume that a relvar holds those tuples that make its predicate true&lt;br /&gt;
(in which case, for each present tuple, that tuple put into the &lt;br /&gt;
predicate is true, and in which case, for each absent tuple, that &lt;br /&gt;
tuple put into the predicate is false) then a certain conjunction mapped from its tuples is true.&lt;br /&gt;
&lt;br /&gt;
Namely:&lt;br /&gt;
      (AND for t in r of the predicate of r applied to t)&lt;br /&gt;
   AND (AND for t not in r of NOT(the predicate of r applied to t)) &lt;br /&gt;
or if you prefer:&lt;br /&gt;
      (FORALL t in r : the predicate of r applied to t)&lt;br /&gt;
   AND (FORALL t not in r : NOT (the predicate of r applied to t))&lt;br /&gt;
&lt;br /&gt;
So if i assume that a relvar value is the extension of its predicate then it seems to state what i expect!&lt;br /&gt;
&lt;br /&gt;
Namely that if a tuple is in a relvar then it asserts the relvar &lt;br /&gt;
predicate applied to it and that if a tuple is not in a relvar then it &lt;br /&gt;
asserts the negation of the relvar predicate applied to it. &lt;br /&gt;
(Informally, present tuples are true and absent tuples are false.)&lt;br /&gt;
&lt;br /&gt;
 print r // RELATION{TUPLE{X a},TUPLE{X b}}&lt;br /&gt;
&lt;br /&gt;
hmm... this is the extension of the predicate of r.&lt;br /&gt;
&lt;br /&gt;
hmm... a query expression that is a relvar name seems to be the &lt;br /&gt;
extension of a predicate that is the relvar&amp;#039;s predicate.&lt;br /&gt;
&lt;br /&gt;
 print RELATION{TUPLE{X b}} // RELATION{TUPLE{X b}} &lt;br /&gt;
 &lt;br /&gt;
hmm... this is the extension of X=b.&lt;br /&gt;
&lt;br /&gt;
hmm... a relation expression RELATION{TUPLE{A1 v1, ...}, ...} seems &lt;br /&gt;
to be the extension of a predicate (A1=v1 AND ...) OR ....&lt;br /&gt;
&lt;br /&gt;
Or if it&amp;#039;s clearer: (A1=v11 AND A2=v12 AND...) OR (A1=v21 AND A2=v22 &lt;br /&gt;
AND...) OR .... Ie the disjunction of the conjunction of the equalites &lt;br /&gt;
of attributes names and values.&lt;br /&gt;
&lt;br /&gt;
 print r PROJECT ALL BUT X // RELATION{TUPLE{}}&lt;br /&gt;
&lt;br /&gt;
hmm... relation expression e PROJECT ALL BUT A seems to be the &lt;br /&gt;
extension of (EXISTS A: the predicate of e).&lt;br /&gt;
&lt;br /&gt;
 print r UNION RELATION{TUPLE{X b}} // RELATION{TUPLE{X a},TUPLE{X b}} &lt;br /&gt;
&lt;br /&gt;
hmm... relation expression e UNION f seems to be the extension of &lt;br /&gt;
(the predicate of e OR the predicate of f).&lt;br /&gt;
&lt;br /&gt;
 print (r UNION RELATION{TUPLE{X b}}) MINUS RELATION{TUPLE{X a}} // RELATION{TUPLE{X b}} &lt;br /&gt;
&lt;br /&gt;
hmm... relation expression (e UNION f) MINUS g &lt;br /&gt;
seems to be the extension of ((the predicate of e OR the predicate of &lt;br /&gt;
f) AND NOT the predicate of g) &lt;br /&gt;
&lt;br /&gt;
hmm... relation expression e MINUS f &lt;br /&gt;
seems to be the extension of (the predicate of e AND NOT the &lt;br /&gt;
predicate of f).&lt;br /&gt;
&lt;br /&gt;
hmm... every relation seems to be the extension of a certain &lt;br /&gt;
transformation of its arguments&amp;#039; predicates.&lt;br /&gt;
&lt;br /&gt;
hmm... seems that a query expression that is a relvar name has as &lt;br /&gt;
value the extension of the relvar predicate and that a query &lt;br /&gt;
expression that is a literal has as value the extension of the &lt;br /&gt;
disjunction-conjunction-equality from its tuples and that a query &lt;br /&gt;
expression that is an operator call has as value the extension of a &lt;br /&gt;
certain transformation of its arguments&amp;#039; predicates, and that &lt;br /&gt;
(consequently) an arbitrary query expression has as value the &lt;br /&gt;
extension of a thus-built predicate.&lt;br /&gt;
&lt;br /&gt;
So if i assume that a query expression predicate is thus-built then &lt;br /&gt;
the query is the extension of its predicate!&lt;br /&gt;
And so the query tuples are the ones that make a certain predicate true!&lt;br /&gt;
&lt;br /&gt;
Namely the thus-built query expression predicate.&lt;br /&gt;
And so a certain conjunction mapped from its tuples is true!&lt;br /&gt;
&lt;br /&gt;
Namely the same proposition as expressed twice above, but for the &lt;br /&gt;
query instead of the relvar:&lt;br /&gt;
      (AND for t in value of query of the predicate of query applied to t)&lt;br /&gt;
   AND (AND for t not in value of query of NOT(the predicate of query applied to t)) &lt;br /&gt;
or if you prefer:&lt;br /&gt;
      (FORALL t in value of query : the predicate of query applied to t)&lt;br /&gt;
   AND (FORALL t not in value of query : NOT (the predicate of query applied to t))&lt;br /&gt;
&lt;br /&gt;
So if i assume that a query value is the extension of its predicate &lt;br /&gt;
then it seems to state what i expect&lt;br /&gt;
&lt;br /&gt;
Namely that if a tuple is in a query then it asserts the query &lt;br /&gt;
predicate applied to it and that if a tuple is not in a query then it &lt;br /&gt;
asserts the negation of the query predicate applied to it. &lt;br /&gt;
(Informally, present tuples are true and absent tuples are false.) &lt;br /&gt;
(Note that if missing tuples are not false, then you can&amp;#039;t use &lt;br /&gt;
MINUS/NOTMATCHING.)&lt;br /&gt;
&lt;br /&gt;
b. QUIZ&lt;br /&gt;
&lt;br /&gt;
* What are the names of your relation variables and constants?&lt;br /&gt;
* What is the characteristic predicate (parameterized statement about the world) for each?&lt;br /&gt;
* What is the formal wff for each? Why?&lt;br /&gt;
* What are the attributes for each? Why?&lt;br /&gt;
* What is your (example) query relation expression?&lt;br /&gt;
* What is the characteristic predicate of its result? Why?&lt;br /&gt;
* What are the (example) values of your relation variables?&lt;br /&gt;
* What statement does each make about the world? Why?&lt;br /&gt;
* What statement does the database make about the world? Why?&lt;br /&gt;
* What is the value of your query relation expression? Why?&lt;br /&gt;
* What statement does this value make about the world in the context of this query relation expression? Why?&lt;br /&gt;
* What statement does a query result make about the world regardless of its query relation expression? Why?&lt;br /&gt;
&lt;br /&gt;
The most important things to understand are that:&lt;br /&gt;
&lt;br /&gt;
# each relation expression corresponds to a certain wff and &lt;br /&gt;
# equivalent relation expressions correspond to equivalent wffs &lt;br /&gt;
&lt;br /&gt;
The relational algebra is just another syntax for FOPL.&lt;/div&gt;</summary>
		<author><name>Dandl</name></author>	</entry>

	</feed>