-
Notifications
You must be signed in to change notification settings - Fork 0
/
file_sharing.frg
3889 lines (2888 loc) · 97.7 KB
/
file_sharing.frg
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#lang forge/temporal
-- Trace Length
option max_tracelength 18
option min_tracelength 15
-- UNSAT Resolver (uncomment to use)
// option solver MiniSatProver
// option core_minimization rce
// option logtranslation 1
// option coregranularity 1
------------------------ Sigs ------------------------
sig Person {}
one sig Bobbi, Joe, Server extends Person {}
abstract sig PowerState {}
one sig On, Off extends PowerState {}
abstract sig Location {
var location_owner: one Person,
var location_items: set Item,
var power_state: one PowerState
}
sig Drive extends Location {
var shared_with_me: set Item
}
one sig BobbiDrive, JoeDrive extends Drive {}
sig Computer extends Location {}
one sig BobbiComputer, JoeComputer extends Computer {}
sig EmailServer extends Location {}
var abstract sig Item {
var item_creator: one Person,
var item_owner: one Person,
var location: one Location,
var shared_with: set Person
}
var sig File extends Item {
var same_content: set File
}
var sig Folder extends Item {
var folder_items: set File
}
var abstract sig EmailContent {}
var sig Attachment extends EmailContent {
var attached: one Item
}
var sig Text extends EmailContent {}
var sig Link extends EmailContent {
var points_to: one Item
}
var sig Email {
var from: one Person,
var to: set Person,
var email_content: lone EmailContent
}
sig Inbox {
var inbox_owner: one Person,
var received: set Email,
var sent: set Email,
var drafts: set Email,
var threads: set Email->Email
}
one sig BobbiInbox, JoeInbox extends Inbox {}
------------------------ Constraints ------------------------
pred modelProperties {
-- An email in an inbox's drafts implies the email is "from" the inbox owner.
all e: Email, i: Inbox | {e in i.drafts implies e.from = i.inbox_owner}
-- An email in an inbox's sent implies the email is "from" the inbox owner.
all e: Email, i: Inbox | {e in i.sent implies e.from = i.inbox_owner}
-- A file cannot have the same content as itself.
no f: File | f in f.same_content
-- All items specified as being at a given location will be in that location's location_items set.
all l: Location, i: Item | i in l.location_items iff {i.location = l}
-- A item must be in a drive to be shared with someone.
all i: Item | some i.shared_with implies {i.location in Drive}
-- An item cannot be shared with its owner.
no i: Item | i.item_owner in i.shared_with
-- No file can be both in someone's drive & that drive's shared_with_me.
no i: Item, d: Drive | i in d.location_items and i in d.shared_with_me
-- An item's location must have the same location_owner as the item's item_owner.
all f: Item | f.location.location_owner = f.item_owner
-- All items must have the same location as the folder they're in.
all file: File, folder: Folder | file in folder.folder_items implies file.location = folder.location
-- All same_content relations are reciprocal.
all disj f1, f2: File | f2 in f1.same_content iff { f1 in f2.same_content }
-- No item can be in more than one folder's items.
no disj f1, f2: Folder, i: Item |
(i in f1.folder_items) and (i in f2.folder_items)
-- No item can be in more than one location's location_items.
no disj l1, l2: Location, i: Item |
(i in l1.location_items) and (i in l2.location_items)
-- An foler cannot be in its own folder_items or any child folders's items.
no f: Folder | f in f.^folder_items
-- One person can only own one computer, one drive, and one inbox.
-- And all computers, drives, and inboxes must be owned.
#{Computer.location_owner} = #{Computer}
#{Drive.location_owner} = #{Drive}
#{Inbox.inbox_owner} = #{Inbox}
-- No two emails can have the same content.
no disj e1, e2: Email | {e1.email_content = e2.email_content and {e1.email_content + e2.email_content} != none }
-- A item must be in a drive to be in another drive's shared_with_me.
all i: Item | { i in Drive.shared_with_me implies {i.location in Drive}}
-- An item shared with someone must be in that person's drive's shared_with_me.
all i: Item, p: Person | {p in i.shared_with iff {i in ((location_owner.p) & Drive).shared_with_me}}
-- An item NOT shared with someone must NOT be in that person's drive's shared_with_me.
all i: Item, p: Person | {p not in i.shared_with implies {i not in ((location_owner.p) & Drive).shared_with_me}}
-- An item in a folder must inherit the folder's shared_with.
no file: File, folder: Folder | file in folder.folder_items and folder.shared_with not in file.shared_with
-- The email server must be owned by the Server person.
EmailServer in Location implies {EmailServer.location_owner = Server}
-- An attached item must be on the email server.
all a: Attachment | a.attached.location = EmailServer
-- A linked item must be in a Drive.
all l: Link | l.points_to.location in Drive
-- An email in sent or received must have some content & some "to."
all e: Email, i: Inbox | (e in i.sent or e in i.received) implies some e.email_content and some e.to
-- All email content must have some associated email.
all ec: EmailContent | some e: Email | e.email_content = ec
-- Server cannot own a Drive, Computer, or Inbox.
no d: Drive | d.location_owner = Server
no c: Computer | c.location_owner = Server
no i: Inbox | i.inbox_owner = Server
-- Every email must have some "from".
all e: Email | some e.from
-- An email in drafts cannot be in any inbox's sent or received.
all disj i1, i2: Inbox, e: Email | e in i1.drafts implies {
e not in (i2.sent + i2.received + i1.sent + i1.received + i2.drafts)
}
}
pred ownership {
BobbiDrive in Drive implies {BobbiDrive.location_owner = Bobbi}
JoeDrive in Drive implies {JoeDrive.location_owner = Joe}
BobbiComputer in Computer implies {BobbiComputer.location_owner = Bobbi}
JoeComputer in Computer implies {JoeComputer.location_owner = Joe}
BobbiInbox in Inbox implies {BobbiInbox.inbox_owner = Bobbi}
JoeInbox in Inbox implies {JoeInbox.inbox_owner = Joe}
}
------------------------ Transitions ------------------------
pred doNothing {
-- Guard(s):
-- This should only run when the model is in its final state.
finalState
-- Action(s):
-- No persons change.
Person = Person'
Person in Person'
-- No locations or their properties change.
Location = Location'
Location in Location'
all l: Location | {
l.location_owner = l.location_owner'
l.location_owner in l.location_owner'
l.location_items = l.location_items'
l.location_items in l.location_items'
l.power_state = l.power_state'
l.power_state in l.power_state'
-- No drive properties change.
l.shared_with_me = l.shared_with_me'
l.shared_with_me in l.shared_with_me'
}
-- No items or their properties change.
Item = Item'
Item in Item'
File = File'
File in File'
Folder = Folder'
Folder in Folder'
all i: Item | {
i.item_creator = i.item_creator'
i.item_creator in i.item_creator'
i.item_owner = i.item_owner'
i.item_owner in i.item_owner'
i.location = i.location'
i.location in i.location'
i.shared_with = i.shared_with'
i.shared_with in i.shared_with'
-- No file properties change.
i.same_content = i.same_content'
i.same_content in i.same_content'
-- No folder properties change.
i.folder_items = i.folder_items'
i.folder_items in i.folder_items'
}
-- No email contents or their properties change.
EmailContent = EmailContent'
EmailContent in EmailContent'
Text = Text'
Text in Text'
Attachment = Attachment'
Attachment in Attachment'
Link = Link'
Link in Link'
all ec: EmailContent | {
-- No attachment properties change.
ec.attached = ec.attached'
ec.attached in ec.attached'
-- No link properties change.
ec.points_to = ec.points_to'
ec.points_to in ec.points_to'
}
-- No emails or their properties change.
Email = Email'
Email in Email'
all e: Email | {
e.from = e.from'
e.from in e.from'
e.to = e.to'
e.to in e.to'
e.email_content = e.email_content'
e.email_content in e.email_content'
}
-- No inboxes or their properties change.
Inbox = Inbox'
Inbox in Inbox'
all i: Inbox {
i.inbox_owner = i.inbox_owner'
i.inbox_owner in i.inbox_owner'
i.received = i.received'
i.received in i.received'
i.sent = i.sent'
i.sent in i.sent'
i.drafts = i.drafts'
i.drafts in i.drafts'
i.threads = i.threads'
i.threads in i.threads'
}
}
pred createFile[actor: Person, loc: Location] {
-- Guard(s):
-- The actor must own the location.
loc.location_owner = actor
-- The actor cannot be server.
actor != Server
-- The location must be powered on.
loc.power_state = On
-- Action(s):
-- Create a new file.
some f: File' - File {
-- No other items change.
Item' = Item + f
Item in Item'
File' = File + f
File in File'
Folder = Folder'
Folder in Folder'
-- Set the new file's location to the given location.
f.location' = loc
-- Set the new file's creator and owner.
f.item_owner' = actor
f.item_creator' = actor
-- Ensure the new file isn't shared with anyone.
no f.shared_with'
-- Ensure the new content doesn't have any same_content.
no f.same_content'
-- Ensure loc only gains the one new file.
loc.location_items' = loc.location_items + f
loc.location_items in loc.location_items'
}
-- No existing item properties change.
all i: Item | {
i.item_creator = i.item_creator'
i.item_creator in i.item_creator'
i.item_owner = i.item_owner'
i.item_owner in i.item_owner'
i.location = i.location'
i.location in i.location'
i.shared_with = i.shared_with'
i.shared_with in i.shared_with'
-- No file properties change.
i.same_content = i.same_content'
i.same_content in i.same_content'
-- No folder properties change.
i.folder_items = i.folder_items'
i.folder_items in i.folder_items'
}
-- No existing locations or their properties change,
-- except for loc.location_items.
Location = Location'
Location in Location'
all l: Location | {
l.location_owner = l.location_owner'
l.location_owner in l.location_owner'
l.power_state = l.power_state'
l.power_state in l.power_state'
-- No drive properties change.
l.shared_with_me = l.shared_with_me'
l.shared_with_me in l.shared_with_me'
}
all l: (Location - loc) | {
l.location_items = l.location_items'
l.location_items in l.location_items'
}
-- No persons change.
Person = Person'
Person in Person'
-- No email contents or their properties change.
EmailContent = EmailContent'
EmailContent in EmailContent'
Text = Text'
Text in Text'
Attachment = Attachment'
Attachment in Attachment'
Link = Link'
Link in Link'
all ec: EmailContent | {
-- No attachment properties change.
ec.attached = ec.attached'
ec.attached in ec.attached'
-- No link properties change.
ec.points_to = ec.points_to'
ec.points_to in ec.points_to'
}
-- No emails or their properties change.
Email = Email'
Email in Email'
all e: Email | {
e.from = e.from'
e.from in e.from'
e.to = e.to'
e.to in e.to'
e.email_content = e.email_content'
e.email_content in e.email_content'
}
-- No inboxes or their properties change.
Inbox = Inbox'
Inbox in Inbox'
all i: Inbox {
i.inbox_owner = i.inbox_owner'
i.inbox_owner in i.inbox_owner'
i.received = i.received'
i.received in i.received'
i.sent = i.sent'
i.sent in i.sent'
i.drafts = i.drafts'
i.drafts in i.drafts'
i.threads = i.threads'
i.threads in i.threads'
}
}
pred createFolder[actor: Person, loc: Location] {
-- Guard(s):
-- The actor must own the location.
loc.location_owner = actor
-- The actor cannot be server.
actor != Server
-- The location must be powered on.
loc.power_state = On
-- Action(s):
-- Create a new folder.
some f: Folder' - Folder | {
-- No other items change.
Item' = Item + f
Item in Item'
File = File'
File in File'
Folder' = Folder + f
Folder in Folder'
-- Set the new folder's location to the given location.
f.location' = loc
-- Set the new folder's creator and owner.
f.item_owner' = actor
f.item_creator' = actor
-- Ensure the new folder isn't shared with anyone.
no f.shared_with'
-- Ensure the new folder has no items in it.
no f.folder_items'
-- Ensure loc only gains the one new folder.
loc.location_items' = loc.location_items + f
loc.location_items in loc.location_items'
}
-- No existing item properties change.
all i: Item | {
i.item_creator = i.item_creator'
i.item_creator in i.item_creator'
i.item_owner = i.item_owner'
i.item_owner in i.item_owner'
i.location = i.location'
i.location in i.location'
i.shared_with = i.shared_with'
i.shared_with in i.shared_with'
-- No file properties change.
i.same_content = i.same_content'
i.same_content in i.same_content'
-- No folder properties change.
i.folder_items = i.folder_items'
i.folder_items in i.folder_items'
}
-- No existing locations or their properties change,
-- except for loc.location_items.
Location = Location'
Location in Location'
all l: Location | {
l.location_owner = l.location_owner'
l.location_owner in l.location_owner'
l.power_state = l.power_state'
l.power_state in l.power_state'
-- No drive properties change.
l.shared_with_me = l.shared_with_me'
l.shared_with_me in l.shared_with_me'
}
all l: (Location - loc) | {
l.location_items = l.location_items'
l.location_items in l.location_items'
}
-- No persons change.
Person = Person'
Person in Person'
-- No email contents or their properties change.
EmailContent = EmailContent'
EmailContent in EmailContent'
Text = Text'
Text in Text'
Attachment = Attachment'
Attachment in Attachment'
Link = Link'
Link in Link'
all ec: EmailContent | {
-- No attachment properties change.
ec.attached = ec.attached'
ec.attached in ec.attached'
-- No link properties change.
ec.points_to = ec.points_to'
ec.points_to in ec.points_to'
}
-- No emails or their properties change.
Email = Email'
Email in Email'
all e: Email | {
e.from = e.from'
e.from in e.from'
e.to = e.to'
e.to in e.to'
e.email_content = e.email_content'
e.email_content in e.email_content'
}
-- No inboxes or their properties change.
Inbox = Inbox'
Inbox in Inbox'
all i: Inbox {
i.inbox_owner = i.inbox_owner'
i.inbox_owner in i.inbox_owner'
i.received = i.received'
i.received in i.received'
i.sent = i.sent'
i.sent in i.sent'
i.drafts = i.drafts'
i.drafts in i.drafts'
i.threads = i.threads'
i.threads in i.threads'
}
}
pred moveItem[actor: Person, moved: File, destination: Folder] {
-- Guard(s):
-- There can only be one moved file.
one moved
one destination
-- The actor cannot be server.
actor != Server
-- The location must be powered on.
moved.location.power_state = On
-- The items must not be on the EmailServer.
moved.location != EmailServer
-- The actor must own the item to be moved and the destination folder.
moved.item_owner = actor
destination.item_owner = actor
-- The moved item cannot already be in the destination folder.
moved not in destination.folder_items
-- The moved item and destination folder must have the same location.
moved.location = destination.location
-- Action(s):
-- Move the item into the destination folder's items.
destination.folder_items' = destination.folder_items + moved
destination.folder_items in destination.folder_items'
-- If the item is currently in any folder, remove it from that folder's items.
all f: (Folder - destination) | (f.folder_items' = f.folder_items - moved and f.folder_items' in f.folder_items)
-- Reinforce that only one file moves.
one folder_items' - folder_items
-- Reinforce that the moved file only goes to one folder.
one f: Folder | moved in f.folder_items'
no f: Folder - destination | moved in f.folder_items'
-- Update shared_with for the moved item to include those of the destination if not already included.
moved.shared_with' = moved.shared_with + (destination.shared_with - moved.item_owner)
all i: Item - moved | {
i.shared_with' = i.shared_with
}
-- Update the shared_with_me for all drives of persons who are now sharing the moved item,
-- otherwise they remain the same.
all d: Drive | destination in d.shared_with_me => d.shared_with_me' = d.shared_with_me + moved else {
d.shared_with_me' = d.shared_with_me
}
shared_with_me in shared_with_me'
-- No persons change.
Person = Person'
Person in Person'
-- No locations or their properties change,
-- except drive shared_with_me.
Location = Location'
Location in Location'
all l: Location | {
l.location_owner = l.location_owner'
l.location_owner in l.location_owner'
l.location_items = l.location_items'
l.location_items in l.location_items'
l.power_state = l.power_state'
l.power_state in l.power_state'
}
-- No items or their properties change, except moved's shared_with (above).
Item = Item'
Item in Item'
File = File'
File in File'
Folder = Folder'
Folder in Folder'
all i: Item | {
i.item_creator = i.item_creator'
i.item_creator in i.item_creator'
i.item_owner = i.item_owner'
i.item_owner in i.item_owner'
i.location = i.location'
i.location in i.location'
i.shared_with in i.shared_with'
-- No file properties change.
i.same_content = i.same_content'
i.same_content in i.same_content'
}
-- No email contents or their properties change.
EmailContent = EmailContent'
EmailContent in EmailContent'
Text = Text'
Text in Text'
Attachment = Attachment'
Attachment in Attachment'
Link = Link'
Link in Link'
all ec: EmailContent | {
-- No attachment properties change.
ec.attached = ec.attached'
ec.attached in ec.attached'
-- No link properties change.
ec.points_to = ec.points_to'
ec.points_to in ec.points_to'
}
-- No emails or their properties change.
Email = Email'
Email in Email'
all e: Email | {
e.from = e.from'
e.from in e.from'
e.to = e.to'
e.to in e.to'
e.email_content = e.email_content'
e.email_content in e.email_content'
}
-- No inboxes or their properties change.
Inbox = Inbox'
Inbox in Inbox'
all i: Inbox {
i.inbox_owner = i.inbox_owner'
i.inbox_owner in i.inbox_owner'
i.received = i.received'
i.received in i.received'
i.sent = i.sent'
i.sent in i.sent'
i.drafts = i.drafts'
i.drafts in i.drafts'
i.threads = i.threads'
i.threads in i.threads'
}
}
pred createEmail[actor: Person] {
-- Guard(s):
-- The actor cannot be server.
actor != Server
-- Action(s):
-- Create a new email.
some e: Email' - Email | {
-- No other emails change.
Email' = Email + e
Email in Email'
-- Set the new email's location to the actor's inbox.
e in inbox_owner'.actor.drafts'
-- Ensure the email's location's drafts only gains the one new email.
inbox_owner'.actor.drafts' = inbox_owner'.actor.drafts + e
inbox_owner'.actor.drafts in inbox_owner'.actor.drafts'
-- Set the new email's from field to actor.
e.from' = actor
-- Ensure the new email has no "to" field or content.
no e.to'
no e.email_content'
}
-- No persons change.
Person = Person'
Person in Person'
-- No locations or their properties change.
Location = Location'
Location in Location'
all l: Location | {
l.location_owner = l.location_owner'
l.location_owner in l.location_owner'
l.location_items = l.location_items'
l.location_items in l.location_items'
l.power_state = l.power_state'
l.power_state in l.power_state'
-- No drive properties change.
l.shared_with_me = l.shared_with_me'
l.shared_with_me in l.shared_with_me'
}
-- No items or their properties change.
Item = Item'
Item in Item'
File = File'
File in File'
Folder = Folder'
Folder in Folder'
all i: Item | {
i.item_creator = i.item_creator'
i.item_creator in i.item_creator'
i.item_owner = i.item_owner'
i.item_owner in i.item_owner'
i.location = i.location'
i.location in i.location'
i.shared_with = i.shared_with'
i.shared_with in i.shared_with'
-- No file properties change.
i.same_content = i.same_content'
i.same_content in i.same_content'
-- No folder properties change.
i.folder_items = i.folder_items'
i.folder_items in i.folder_items'
}
-- No email contents or their properties change.
EmailContent = EmailContent'
EmailContent in EmailContent'
Text = Text'
Text in Text'
Attachment = Attachment'
Attachment in Attachment'
Link = Link'
Link in Link'
all ec: EmailContent | {
-- No attachment properties change.
ec.attached = ec.attached'
ec.attached in ec.attached'
-- No link properties change.
ec.points_to = ec.points_to'
ec.points_to in ec.points_to'
}
-- No existing emails or their properties change.
Email in Email'
all e: Email | {
e.from = e.from'
e.from in e.from'
e.to = e.to'
e.to in e.to'
e.email_content = e.email_content'
e.email_content in e.email_content'
}
-- No inboxes or their properties change, except the actor's drafts.
Inbox = Inbox'
Inbox in Inbox'
all i: Inbox {
i.inbox_owner = i.inbox_owner'
i.inbox_owner in i.inbox_owner'
i.received = i.received'
i.received in i.received'
i.sent = i.sent'
i.sent in i.sent'
i.threads = i.threads'
i.threads in i.threads'
}
all i: (Inbox - inbox_owner'.actor) | {
i.drafts = i.drafts'
i.drafts in i.drafts'
}
}
pred setRecipients[actor: Person, email: Email, recipients: Person] {
-- Guard(s):
-- The actor cannot be server.
actor != Server
-- Server cannot be in recipients.
Server not in recipients
-- The email must still be in the actor's drafts.
email in inbox_owner.actor.drafts
-- The email's to cannot already be recipients.
email.to != recipients
-- An email can't be sent to one's self.
-- TODO: Remove and account for in send/attach.
actor not in recipients
-- Action(s):
-- Set the specified email's recipients.
email.to' = recipients
-- No existing emails or their properties change, except the specified email's to.
Email = Email'
Email in Email'
all e: Email | {
e.from = e.from'
e.from in e.from'
e.email_content = e.email_content'
e.email_content in e.email_content'
}
all e: (Email - email) | {
e.to = e.to'
e.to in e.to'
}
-- No persons change.
Person = Person'
Person in Person'
-- No locations or their properties change.
Location = Location'
Location in Location'
all l: Location | {
l.location_owner = l.location_owner'
l.location_owner in l.location_owner'
l.location_items = l.location_items'
l.location_items in l.location_items'
l.power_state = l.power_state'
l.power_state in l.power_state'
-- No drive properties change.
l.shared_with_me = l.shared_with_me'
l.shared_with_me in l.shared_with_me'
}
-- No items or their properties change.
Item = Item'
Item in Item'
File = File'
File in File'
Folder = Folder'
Folder in Folder'
all i: Item | {
i.item_creator = i.item_creator'
i.item_creator in i.item_creator'
i.item_owner = i.item_owner'
i.item_owner in i.item_owner'
i.location = i.location'
i.location in i.location'