post
poster: G-man
description: Please don't get upset with me Tor, I had to use Gargy's account because I forgot mine, and this is for him anyways. It's for a temporary description of a forum system in a formal methods language. (This is oddballz194, BTW).
language: plain text
[download]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
UNIQUE tuple forumsite (
ID as String UNIQUE
)

tuple Category (
ID as String UNIQUE,
ParentID as String
)

tuple Board (
ID as String UNIQUE,
ParentID as String, //can be Category or Board
Name as String,
LastPostID as String
)

tuple Thread (
ID as String UNIQUE,
ParentID as String, //must be Board
OriginalPoster as String,
Title as String,
SmileyName as String,
LastPostID as String
)

tuple Post (
ID as String UNIQUE,
ParentID as String, //must be Thread
Title as String,
SmileyName as String,
Text as String,
OriginalPosterID as String,
DateTime as String //YYYYMMDD, using negative for BC (although rare!)
)

tuple User (
ID as String UNIQUE,
UserName as String UNIQUE,
DisplayTitle as String UNIQUE,
PasswordEncrypted as String,
PasswordSalt as String,
DeletedUser as Boolean    //Although a user can be deleted, we want to keep their data for consistency -- and
            //to undelete if it's requested!
)

invariant
{
  for all p in Post, there exists t in Thread | p.ParentID=t.ID
  for all p in Post, there exists u in User | p.OriginalPosterID=u.ID
  for all t in Thread, there exists b in Board | t.ParentID=b.ID
  for all b in Board, there exists c in Category | b.ParentID=C.ID
  for all c in Category | c.ParentID=forumsite.ID
  for all u,u2 in User | if u != u2, u.DisplayTitle != u2.DisplayTitle && u.DisplayTitle != u2.UserName
}