File size: 25,201 Bytes
d2a0598
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

:- dynamic term_expansion/2.
:- multifile term_expansion/2.


great_grandfather(X, Y) :-
    great_grandparent(X, Y),
    male(Y).

great_grandchild(X, Y) :-
    great_grandparent(Y, X).

great_grandparent(X, Y) :-
    grandparent(X, Z),
    parent(Z, Y).

:- dynamic library_directory/1.
:- multifile library_directory/1.


great_grandmother(X, Y) :-
    great_grandparent(X, Y),
    female(Y).

:- dynamic goal_expansion/4.
:- multifile goal_expansion/4.


:- dynamic hobby/2.

hobby("Abdul Felker", "birdwatching").
hobby("Adolph Barbee", "geography").
hobby("Alice Lance", "research").
hobby("Allie Barbee", "audiophile").
hobby("Allison Barbee", "knowledge/word games").
hobby("Alvin Lance", "geocaching").
hobby("Andres Barbee", "croquet").
hobby("Andrew Parkinson", "badminton").
hobby("Brooks George", "fossil hunting").
hobby("Clint Rahman", "rail transport modelling").
hobby("Colette Rahman", "jujitsu").
hobby("Courtney Parkinson", "beauty pageants").
hobby("Dalton Parkinson", "softball").
hobby("Dollie Barbee", "golfing").
hobby("Elicia Barbee", "inline skating").
hobby("Elyse Barbee", "radio-controlled model collecting").
hobby("Emma George", "videography").
hobby("Garth Kean", "butterfly watching").
hobby("Guadalupe Barbee", "learning").
hobby("Jenni Felker", "business").
hobby("Karolyn Lance", "curling").
hobby("Kelley Barbee", "magnet fishing").
hobby("Kenny Barbee", "pickleball").
hobby("Kirk Lo", "shuffleboard").
hobby("Konstantin Barbee", "geocaching").
hobby("Korey Kean", "trade fair visiting").
hobby("Krystle Barbee", "lapel pins").
hobby("Kurt Parkinson", "rock balancing").
hobby("Latosha Rahman", "breakdancing").
hobby("Leonila Parkinson", "audiophile").
hobby("Lesley Barbee", "dairy farming").
hobby("Lyndon Barbee", "research").
hobby("Marvin Hope", "mineral collecting").
hobby("Merrill Kean", "research").
hobby("Mitchel George", "mineral collecting").
hobby("Nettie Barbee", "learning").
hobby("Rocco Lance", "magnet fishing").
hobby("Rory George", "whale watching").
hobby("Royce Lo", "research").
hobby("Rudy Barbee", "fusilately").
hobby("Solomon Rahman", "shortwave listening").
hobby("Tracey Kean", "microscopy").
hobby("Twyla Parkinson", "life science").
hobby("Tyrone Parkinson", "meditation").
hobby("Wallace Ragland", "science and technology studies").
hobby("Walter Hope", "frisbee").
hobby("Wanda Lo", "satellite watching").
hobby("Wanita Hope", "chemistry").
hobby("Willie Parkinson", "ballet dancing").
hobby("Yasmin Ragland", "antiquities").

granddaughter(X, Y) :-
    grandchild(X, Y),
    female(Y).

grandson(X, Y) :-
    grandchild(X, Y),
    male(Y).

:- dynamic job/2.

job("Abdul Felker", "police officer").
job("Adolph Barbee", "community education officer").
job("Alice Lance", "herbalist").
job("Allie Barbee", "podiatrist").
job("Allison Barbee", "prison officer").
job("Alvin Lance", "animal technologist").
job("Andres Barbee", "leisure centre manager").
job("Andrew Parkinson", "speech and language therapist").
job("Brooks George", "dietitian").
job("Clint Rahman", "amenity horticulturist").
job("Colette Rahman", "theatre stage manager").
job("Courtney Parkinson", "hydrologist").
job("Dalton Parkinson", "learning mentor").
job("Dollie Barbee", "location manager").
job("Elicia Barbee", "chartered management accountant").
job("Elyse Barbee", "plant breeder").
job("Emma George", "advertising account executive").
job("Garth Kean", "tourism officer").
job("Guadalupe Barbee", "civil service fast streamer").
job("Jenni Felker", "designer").
job("Karolyn Lance", "development worker").
job("Kelley Barbee", "tourist information centre manager").
job("Kenny Barbee", "community education officer").
job("Kirk Lo", "farm manager").
job("Konstantin Barbee", "doctor").
job("Korey Kean", "newspaper journalist").
job("Krystle Barbee", "customer service manager").
job("Kurt Parkinson", "public house manager").
job("Latosha Rahman", "exercise physiologist").
job("Leonila Parkinson", "early years teacher").
job("Lesley Barbee", "chief executive officer").
job("Lyndon Barbee", "bookseller").
job("Marvin Hope", "physiotherapist").
job("Merrill Kean", "occupational hygienist").
job("Mitchel George", "advertising copywriter").
job("Nettie Barbee", "radiographer").
job("Rocco Lance", "mining engineer").
job("Rory George", "warden").
job("Royce Lo", "regulatory affairs officer").
job("Rudy Barbee", "location manager").
job("Solomon Rahman", "producer").
job("Tracey Kean", "teaching laboratory technician").
job("Twyla Parkinson", "orthoptist").
job("Tyrone Parkinson", "agricultural consultant").
job("Wallace Ragland", "quarry manager").
job("Walter Hope", "risk analyst").
job("Wanda Lo", "physiological scientist").
job("Wanita Hope", "equality and diversity officer").
job("Willie Parkinson", "firefighter").
job("Yasmin Ragland", "purchasing manager").

great_uncle(X, Y) :-
    grandparent(X, A),
    brother(A, Y).

:- dynamic save_all_clauses_to_file/1.

save_all_clauses_to_file(A) :-
    open(A, write, B),
    set_output(B),
    listing,
    close(B).

:- dynamic term_expansion/4.
:- multifile term_expansion/4.


grandchild(X, Y) :-
    grandparent(Y, X).

:- dynamic dob/2.

dob("Abdul Felker", "0895-03-24").
dob("Adolph Barbee", "0980-08-29").
dob("Alice Lance", "0951-04-07").
dob("Allie Barbee", "0928-07-23").
dob("Allison Barbee", "1005-06-23").
dob("Alvin Lance", "0950-05-19").
dob("Andres Barbee", "0977-09-16").
dob("Andrew Parkinson", "0952-04-16").
dob("Brooks George", "1006-06-23").
dob("Clint Rahman", "0866-11-02").
dob("Colette Rahman", "0861-05-02").
dob("Courtney Parkinson", "0954-06-24").
dob("Dalton Parkinson", "0984-02-16").
dob("Dollie Barbee", "0975-03-08").
dob("Elicia Barbee", "1040-03-27").
dob("Elyse Barbee", "1033-12-12").
dob("Emma George", "0978-10-20").
dob("Garth Kean", "0954-09-11").
dob("Guadalupe Barbee", "0950-11-19").
dob("Jenni Felker", "0896-03-17").
dob("Karolyn Lance", "0924-11-06").
dob("Kelley Barbee", "0952-08-19").
dob("Kenny Barbee", "0953-06-18").
dob("Kirk Lo", "1091-03-24").
dob("Konstantin Barbee", "1007-05-04").
dob("Korey Kean", "0984-12-02").
dob("Krystle Barbee", "1008-12-24").
dob("Kurt Parkinson", "0924-12-27").
dob("Latosha Rahman", "0840-02-22").
dob("Leonila Parkinson", "0924-09-18").
dob("Lesley Barbee", "1067-06-07").
dob("Lyndon Barbee", "1036-01-09").
dob("Marvin Hope", "1013-11-28").
dob("Merrill Kean", "0981-09-04").
dob("Mitchel George", "1007-06-03").
dob("Nettie Barbee", "1032-05-15").
dob("Rocco Lance", "0924-02-03").
dob("Rory George", "0974-12-02").
dob("Royce Lo", "1059-07-07").
dob("Rudy Barbee", "0927-04-02").
dob("Solomon Rahman", "0837-10-06").
dob("Tracey Kean", "0956-03-15").
dob("Twyla Parkinson", "0949-02-16").
dob("Tyrone Parkinson", "0982-10-06").
dob("Wallace Ragland", "0951-01-09").
dob("Walter Hope", "0980-04-11").
dob("Wanda Lo", "1059-03-28").
dob("Wanita Hope", "0977-12-27").
dob("Willie Parkinson", "0954-09-22").
dob("Yasmin Ragland", "0952-10-08").

:- dynamic file_search_path/2.
:- multifile file_search_path/2.

file_search_path(library, Dir) :-
    library_directory(Dir).
file_search_path(swi, A) :-
    system:current_prolog_flag(home, A).
file_search_path(swi, A) :-
    system:current_prolog_flag(shared_home, A).
file_search_path(library, app_config(lib)).
file_search_path(library, swi(library)).
file_search_path(library, swi(library/clp)).
file_search_path(library, A) :-
    system:'$ext_library_directory'(A).
file_search_path(foreign, swi(A)) :-
    system:
    (   current_prolog_flag(apple_universal_binary, true),
        A='lib/fat-darwin'
    ).
file_search_path(path, A) :-
    system:
    (   getenv('PATH', B),
        current_prolog_flag(path_sep, C),
        atomic_list_concat(D, C, B),
        '$member'(A, D)
    ).
file_search_path(user_app_data, A) :-
    system:'$xdg_prolog_directory'(data, A).
file_search_path(common_app_data, A) :-
    system:'$xdg_prolog_directory'(common_data, A).
file_search_path(user_app_config, A) :-
    system:'$xdg_prolog_directory'(config, A).
file_search_path(common_app_config, A) :-
    system:'$xdg_prolog_directory'(common_config, A).
file_search_path(app_data, user_app_data('.')).
file_search_path(app_data, common_app_data('.')).
file_search_path(app_config, user_app_config('.')).
file_search_path(app_config, common_app_config('.')).
file_search_path(app_preferences, user_app_config('.')).
file_search_path(user_profile, app_preferences('.')).
file_search_path(app, swi(app)).
file_search_path(app, app_data(app)).
file_search_path(autoload, swi(library)).
file_search_path(autoload, pce(prolog/lib)).
file_search_path(autoload, app_config(lib)).
file_search_path(autoload, Dir) :-
    '$autoload':'$ext_library_directory'(Dir).
file_search_path(pack, app_data(pack)).
file_search_path(library, PackLib) :-
    '$pack':pack_dir(_Name, prolog, PackLib).
file_search_path(foreign, PackLib) :-
    '$pack':pack_dir(_Name, foreign, PackLib).
file_search_path(app, AppDir) :-
    '$pack':pack_dir(_Name, app, AppDir).

:- multifile prolog_list_goal/1.


:- dynamic type/2.

type("Abdul Felker", person).
type("Adolph Barbee", person).
type("Alice Lance", person).
type("Allie Barbee", person).
type("Allison Barbee", person).
type("Alvin Lance", person).
type("Andres Barbee", person).
type("Andrew Parkinson", person).
type("Brooks George", person).
type("Clint Rahman", person).
type("Colette Rahman", person).
type("Courtney Parkinson", person).
type("Dalton Parkinson", person).
type("Dollie Barbee", person).
type("Elicia Barbee", person).
type("Elyse Barbee", person).
type("Emma George", person).
type("Garth Kean", person).
type("Guadalupe Barbee", person).
type("Jenni Felker", person).
type("Karolyn Lance", person).
type("Kelley Barbee", person).
type("Kenny Barbee", person).
type("Kirk Lo", person).
type("Konstantin Barbee", person).
type("Korey Kean", person).
type("Krystle Barbee", person).
type("Kurt Parkinson", person).
type("Latosha Rahman", person).
type("Leonila Parkinson", person).
type("Lesley Barbee", person).
type("Lyndon Barbee", person).
type("Marvin Hope", person).
type("Merrill Kean", person).
type("Mitchel George", person).
type("Nettie Barbee", person).
type("Rocco Lance", person).
type("Rory George", person).
type("Royce Lo", person).
type("Rudy Barbee", person).
type("Solomon Rahman", person).
type("Tracey Kean", person).
type("Twyla Parkinson", person).
type("Tyrone Parkinson", person).
type("Wallace Ragland", person).
type("Walter Hope", person).
type("Wanda Lo", person).
type("Wanita Hope", person).
type("Willie Parkinson", person).
type("Yasmin Ragland", person).

grandfather(X, Y) :-
    grandparent(X, Y),
    male(Y).

:- dynamic expand_query/4.
:- multifile expand_query/4.


:- dynamic attribute/1.

attribute("police officer").
attribute("birdwatching").
attribute("community education officer").
attribute("geography").
attribute("herbalist").
attribute("research").
attribute("podiatrist").
attribute("audiophile").
attribute("prison officer").
attribute("knowledge/word games").
attribute("animal technologist").
attribute("geocaching").
attribute("leisure centre manager").
attribute("croquet").
attribute("speech and language therapist").
attribute("badminton").
attribute("dietitian").
attribute("fossil hunting").
attribute("amenity horticulturist").
attribute("rail transport modelling").
attribute("theatre stage manager").
attribute("jujitsu").
attribute("hydrologist").
attribute("beauty pageants").
attribute("learning mentor").
attribute("softball").
attribute("location manager").
attribute("golfing").
attribute("chartered management accountant").
attribute("inline skating").
attribute("plant breeder").
attribute("radio-controlled model collecting").
attribute("advertising account executive").
attribute("videography").
attribute("tourism officer").
attribute("butterfly watching").
attribute("civil service fast streamer").
attribute("learning").
attribute("designer").
attribute("business").
attribute("development worker").
attribute("curling").
attribute("tourist information centre manager").
attribute("magnet fishing").
attribute("community education officer").
attribute("pickleball").
attribute("farm manager").
attribute("shuffleboard").
attribute("doctor").
attribute("geocaching").
attribute("newspaper journalist").
attribute("trade fair visiting").
attribute("customer service manager").
attribute("lapel pins").
attribute("public house manager").
attribute("rock balancing").
attribute("exercise physiologist").
attribute("breakdancing").
attribute("early years teacher").
attribute("audiophile").
attribute("chief executive officer").
attribute("dairy farming").
attribute("bookseller").
attribute("research").
attribute("physiotherapist").
attribute("mineral collecting").
attribute("occupational hygienist").
attribute("research").
attribute("advertising copywriter").
attribute("mineral collecting").
attribute("radiographer").
attribute("learning").
attribute("mining engineer").
attribute("magnet fishing").
attribute("warden").
attribute("whale watching").
attribute("regulatory affairs officer").
attribute("research").
attribute("location manager").
attribute("fusilately").
attribute("producer").
attribute("shortwave listening").
attribute("teaching laboratory technician").
attribute("microscopy").
attribute("orthoptist").
attribute("life science").
attribute("agricultural consultant").
attribute("meditation").
attribute("quarry manager").
attribute("science and technology studies").
attribute("risk analyst").
attribute("frisbee").
attribute("physiological scientist").
attribute("satellite watching").
attribute("equality and diversity officer").
attribute("chemistry").
attribute("firefighter").
attribute("ballet dancing").
attribute("purchasing manager").
attribute("antiquities").

great_aunt(X, Y) :-
    grandparent(X, A),
    sister(A, Y).

grandparent(X, Y) :-
    parent(X, Z),
    parent(Z, Y).

grandmother(X, Y) :-
    grandparent(X, Y),
    female(Y).

:- dynamic friend_/2.

friend_("Abdul Felker", "Jenni Felker").
friend_("Abdul Felker", "Latosha Rahman").
friend_("Abdul Felker", "Rory George").
friend_("Abdul Felker", "Rudy Barbee").
friend_("Abdul Felker", "Tyrone Parkinson").
friend_("Adolph Barbee", "Alice Lance").
friend_("Adolph Barbee", "Kenny Barbee").
friend_("Adolph Barbee", "Wallace Ragland").
friend_("Alice Lance", "Courtney Parkinson").
friend_("Alice Lance", "Lesley Barbee").
friend_("Allie Barbee", "Konstantin Barbee").
friend_("Alvin Lance", "Brooks George").
friend_("Alvin Lance", "Karolyn Lance").
friend_("Alvin Lance", "Rocco Lance").
friend_("Alvin Lance", "Tyrone Parkinson").
friend_("Alvin Lance", "Wanita Hope").
friend_("Andres Barbee", "Dollie Barbee").
friend_("Andres Barbee", "Karolyn Lance").
friend_("Andres Barbee", "Lesley Barbee").
friend_("Andres Barbee", "Marvin Hope").
friend_("Andres Barbee", "Wanita Hope").
friend_("Andrew Parkinson", "Courtney Parkinson").
friend_("Andrew Parkinson", "Krystle Barbee").
friend_("Andrew Parkinson", "Wanita Hope").
friend_("Brooks George", "Dalton Parkinson").
friend_("Brooks George", "Emma George").
friend_("Brooks George", "Guadalupe Barbee").
friend_("Brooks George", "Latosha Rahman").
friend_("Brooks George", "Nettie Barbee").
friend_("Brooks George", "Rocco Lance").
friend_("Brooks George", "Solomon Rahman").
friend_("Clint Rahman", "Leonila Parkinson").
friend_("Clint Rahman", "Walter Hope").
friend_("Colette Rahman", "Emma George").
friend_("Courtney Parkinson", "Elicia Barbee").
friend_("Courtney Parkinson", "Emma George").
friend_("Dalton Parkinson", "Latosha Rahman").
friend_("Elicia Barbee", "Solomon Rahman").
friend_("Elicia Barbee", "Twyla Parkinson").
friend_("Elicia Barbee", "Wallace Ragland").
friend_("Elicia Barbee", "Yasmin Ragland").
friend_("Elyse Barbee", "Rocco Lance").
friend_("Emma George", "Karolyn Lance").
friend_("Emma George", "Lesley Barbee").
friend_("Garth Kean", "Kelley Barbee").
friend_("Garth Kean", "Korey Kean").
friend_("Garth Kean", "Walter Hope").
friend_("Guadalupe Barbee", "Korey Kean").
friend_("Jenni Felker", "Korey Kean").
friend_("Jenni Felker", "Wanda Lo").
friend_("Kelley Barbee", "Latosha Rahman").
friend_("Kelley Barbee", "Leonila Parkinson").
friend_("Kelley Barbee", "Rory George").
friend_("Kenny Barbee", "Latosha Rahman").
friend_("Kenny Barbee", "Lesley Barbee").
friend_("Kirk Lo", "Lesley Barbee").
friend_("Kirk Lo", "Lyndon Barbee").
friend_("Kirk Lo", "Marvin Hope").
friend_("Kirk Lo", "Yasmin Ragland").
friend_("Konstantin Barbee", "Tracey Kean").
friend_("Krystle Barbee", "Leonila Parkinson").
friend_("Krystle Barbee", "Twyla Parkinson").
friend_("Kurt Parkinson", "Latosha Rahman").
friend_("Kurt Parkinson", "Marvin Hope").
friend_("Kurt Parkinson", "Walter Hope").
friend_("Kurt Parkinson", "Wanita Hope").
friend_("Kurt Parkinson", "Yasmin Ragland").
friend_("Leonila Parkinson", "Royce Lo").
friend_("Leonila Parkinson", "Rudy Barbee").
friend_("Leonila Parkinson", "Solomon Rahman").
friend_("Lyndon Barbee", "Tyrone Parkinson").
friend_("Lyndon Barbee", "Wanda Lo").
friend_("Mitchel George", "Wallace Ragland").
friend_("Rudy Barbee", "Walter Hope").
friend_("Rudy Barbee", "Yasmin Ragland").
friend_("Solomon Rahman", "Tyrone Parkinson").
friend_("Solomon Rahman", "Wanda Lo").
friend_("Tracey Kean", "Twyla Parkinson").
friend_("Wanita Hope", "Willie Parkinson").

friend(X, Y) :-
    friend_(X, Y).
friend(X, Y) :-
    friend_(Y, X).

niece(X, Y) :-
    sibling(X, A),
    daughter(A, Y).

nephew(X, Y) :-
    sibling(X, A),
    son(A, Y).

brother_in_law(X, Y) :-
    married(X, A),
    brother(A, Y).

:- multifile message_property/2.


sister_in_law(X, Y) :-
    married(X, A),
    sister(A, Y).

wife(X, Y) :-
    married(X, Y),
    female(Y).

husband(X, Y) :-
    married(X, Y),
    male(Y).

daughter_in_law(X, Y) :-
    child(X, A),
    wife(A, Y).

son_in_law(X, Y) :-
    child(X, A),
    husband(A, Y).

son(X, Y) :-
    child(X, Y),
    male(Y).

female(X) :-
    gender(X, "female").

daughter(X, Y) :-
    child(X, Y),
    female(Y).

father_in_law(X, Y) :-
    married(X, A),
    father(A, Y).

mother_in_law(X, Y) :-
    married(X, A),
    mother(A, Y).

father(X, Y) :-
    parent(X, Y),
    male(Y).

:- multifile prolog_predicate_name/2.


child(X, Y) :-
    parent(Y, X).

male_first_cousin_once_removed(X, Y) :-
    cousin(X, A),
    son(A, Y),
    X\=Y.

:- multifile prolog_clause_name/2.


:- dynamic expand_answer/2.
:- multifile expand_answer/2.


:- dynamic exception/3.
:- multifile exception/3.


female_first_cousin_once_removed(X, Y) :-
    cousin(X, A),
    daughter(A, Y),
    X\=Y.

brother(X, Y) :-
    sibling(X, Y),
    male(Y).

mother(X, Y) :-
    parent(X, Y),
    female(Y).

male_second_cousin(X, Y) :-
    parent(X, A),
    parent(Y, B),
    cousin(A, B),
    male(Y),
    X\=Y.

:- dynamic message_hook/3.
:- multifile message_hook/3.


female_second_cousin(X, Y) :-
    parent(X, A),
    parent(Y, B),
    cousin(A, B),
    female(Y),
    X\=Y.

married(X, Y) :-
    parent(Child, X),
    parent(Child, Y),
    X\=Y.

male(X) :-
    gender(X, "male").

:- dynamic prolog_file_type/2.
:- multifile prolog_file_type/2.

prolog_file_type(pl, prolog).
prolog_file_type(prolog, prolog).
prolog_file_type(qlf, prolog).
prolog_file_type(qlf, qlf).
prolog_file_type(A, executable) :-
    system:current_prolog_flag(shared_object_extension, A).
prolog_file_type(dylib, executable) :-
    system:current_prolog_flag(apple, true).

sister(X, Y) :-
    sibling(X, Y),
    female(Y).

male_cousin(X, Y) :-
    cousin(X, Y),
    male(Y).

:- dynamic nonbinary/1.

nonbinary(X) :-
    gender(X, "nonbinary").

female_cousin(X, Y) :-
    cousin(X, Y),
    female(Y).

sibling(X, Y) :-
    parent(X, A),
    parent(Y, A),
    X\=Y.

:- dynamic portray/1.
:- multifile portray/1.


:- dynamic prolog_load_file/2.
:- multifile prolog_load_file/2.


:- dynamic goal_expansion/2.
:- multifile goal_expansion/2.


:- dynamic parent/2.

parent("Adolph Barbee", "Kelley Barbee").
parent("Adolph Barbee", "Kenny Barbee").
parent("Alice Lance", "Karolyn Lance").
parent("Alice Lance", "Rocco Lance").
parent("Allison Barbee", "Andres Barbee").
parent("Allison Barbee", "Dollie Barbee").
parent("Alvin Lance", "Karolyn Lance").
parent("Alvin Lance", "Rocco Lance").
parent("Andres Barbee", "Kelley Barbee").
parent("Andres Barbee", "Kenny Barbee").
parent("Andrew Parkinson", "Kurt Parkinson").
parent("Andrew Parkinson", "Leonila Parkinson").
parent("Brooks George", "Emma George").
parent("Brooks George", "Rory George").
parent("Clint Rahman", "Latosha Rahman").
parent("Clint Rahman", "Solomon Rahman").
parent("Courtney Parkinson", "Karolyn Lance").
parent("Courtney Parkinson", "Rocco Lance").
parent("Dalton Parkinson", "Courtney Parkinson").
parent("Dalton Parkinson", "Willie Parkinson").
parent("Dollie Barbee", "Wallace Ragland").
parent("Dollie Barbee", "Yasmin Ragland").
parent("Elicia Barbee", "Konstantin Barbee").
parent("Elicia Barbee", "Krystle Barbee").
parent("Emma George", "Courtney Parkinson").
parent("Emma George", "Willie Parkinson").
parent("Guadalupe Barbee", "Allie Barbee").
parent("Guadalupe Barbee", "Rudy Barbee").
parent("Jenni Felker", "Clint Rahman").
parent("Jenni Felker", "Colette Rahman").
parent("Karolyn Lance", "Abdul Felker").
parent("Karolyn Lance", "Jenni Felker").
parent("Kelley Barbee", "Karolyn Lance").
parent("Kelley Barbee", "Rocco Lance").
parent("Kenny Barbee", "Allie Barbee").
parent("Kenny Barbee", "Rudy Barbee").
parent("Kirk Lo", "Royce Lo").
parent("Kirk Lo", "Wanda Lo").
parent("Konstantin Barbee", "Andres Barbee").
parent("Konstantin Barbee", "Dollie Barbee").
parent("Korey Kean", "Garth Kean").
parent("Korey Kean", "Tracey Kean").
parent("Krystle Barbee", "Walter Hope").
parent("Krystle Barbee", "Wanita Hope").
parent("Lesley Barbee", "Elyse Barbee").
parent("Lesley Barbee", "Lyndon Barbee").
parent("Lyndon Barbee", "Konstantin Barbee").
parent("Lyndon Barbee", "Krystle Barbee").
parent("Marvin Hope", "Walter Hope").
parent("Marvin Hope", "Wanita Hope").
parent("Merrill Kean", "Garth Kean").
parent("Merrill Kean", "Tracey Kean").
parent("Mitchel George", "Emma George").
parent("Mitchel George", "Rory George").
parent("Nettie Barbee", "Konstantin Barbee").
parent("Nettie Barbee", "Krystle Barbee").
parent("Tracey Kean", "Karolyn Lance").
parent("Tracey Kean", "Rocco Lance").
parent("Twyla Parkinson", "Kurt Parkinson").
parent("Twyla Parkinson", "Leonila Parkinson").
parent("Tyrone Parkinson", "Courtney Parkinson").
parent("Tyrone Parkinson", "Willie Parkinson").
parent("Wanda Lo", "Elyse Barbee").
parent("Wanda Lo", "Lyndon Barbee").
parent("Willie Parkinson", "Kurt Parkinson").
parent("Willie Parkinson", "Leonila Parkinson").

cousin(X, Y) :-
    parent(X, A),
    parent(Y, B),
    sibling(A, B),
    X\=Y.

uncle(X, Y) :-
    parent(X, A),
    brother(A, Y).

:- dynamic resource/3.
:- multifile resource/3.


:- thread_local thread_message_hook/3.
:- dynamic thread_message_hook/3.
:- volatile thread_message_hook/3.


aunt(X, Y) :-
    parent(X, A),
    sister(A, Y).

second_uncle(X, Y) :-
    great_grandparent(X, A),
    brother(A, Y).

:- dynamic gender/2.

gender("Abdul Felker", "male").
gender("Adolph Barbee", "male").
gender("Alice Lance", "female").
gender("Allie Barbee", "female").
gender("Allison Barbee", "female").
gender("Alvin Lance", "male").
gender("Andres Barbee", "male").
gender("Andrew Parkinson", "male").
gender("Brooks George", "male").
gender("Clint Rahman", "male").
gender("Colette Rahman", "female").
gender("Courtney Parkinson", "female").
gender("Dalton Parkinson", "male").
gender("Dollie Barbee", "female").
gender("Elicia Barbee", "female").
gender("Elyse Barbee", "female").
gender("Emma George", "female").
gender("Garth Kean", "male").
gender("Guadalupe Barbee", "male").
gender("Jenni Felker", "female").
gender("Karolyn Lance", "female").
gender("Kelley Barbee", "female").
gender("Kenny Barbee", "male").
gender("Kirk Lo", "male").
gender("Konstantin Barbee", "male").
gender("Korey Kean", "male").
gender("Krystle Barbee", "female").
gender("Kurt Parkinson", "male").
gender("Latosha Rahman", "female").
gender("Leonila Parkinson", "female").
gender("Lesley Barbee", "male").
gender("Lyndon Barbee", "male").
gender("Marvin Hope", "male").
gender("Merrill Kean", "male").
gender("Mitchel George", "male").
gender("Nettie Barbee", "female").
gender("Rocco Lance", "male").
gender("Rory George", "male").
gender("Royce Lo", "male").
gender("Rudy Barbee", "male").
gender("Solomon Rahman", "male").
gender("Tracey Kean", "female").
gender("Twyla Parkinson", "female").
gender("Tyrone Parkinson", "male").
gender("Wallace Ragland", "male").
gender("Walter Hope", "male").
gender("Wanda Lo", "female").
gender("Wanita Hope", "female").
gender("Willie Parkinson", "male").
gender("Yasmin Ragland", "female").

second_aunt(X, Y) :-
    great_grandparent(X, A),
    sister(A, Y).

great_grandson(X, Y) :-
    great_grandchild(X, Y),
    male(Y).

:- dynamic pyrun/2.

pyrun(A, B) :-
    read_term_from_atom(A, C, [variable_names(B)]),
    call(C).

great_granddaughter(X, Y) :-
    great_grandchild(X, Y),
    female(Y).

:- dynamic resource/2.
:- multifile resource/2.