File size: 25,159 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
872
873
874
875
876

:- 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("Aida Wang", "meditation").
hobby("Alec Sinclair", "meteorology").
hobby("Alfredo Wang", "biology").
hobby("Alison Smock", "meteorology").
hobby("Alvaro Smock", "dolls").
hobby("Alycia Coe", "photography").
hobby("Barabara Beltran", "shogi").
hobby("Brian Beltran", "dominoes").
hobby("Carrol Woodson", "tether car").
hobby("Christina Coe", "architecture").
hobby("Christoper Coe", "geocaching").
hobby("Cortney Parmer", "trainspotting").
hobby("Cythia Smock", "bus spotting").
hobby("Daisy Beltran", "research").
hobby("Dino Beltran", "geography").
hobby("Dominique Smock", "microbiology").
hobby("Dwight Hackworth", "canoeing").
hobby("Earle Coe", "learning").
hobby("Eli Smock", "dairy farming").
hobby("Gayla Woodson", "fossil hunting").
hobby("Gene Smock", "sociology").
hobby("Isiah Lutz", "finance").
hobby("Jamison Baptiste", "meditation").
hobby("Kristen Toombs", "wikipedia editing").
hobby("Lannie Smock", "radio-controlled car racing").
hobby("Leeann Sinclair", "social studies").
hobby("Leisa Lutz", "judo").
hobby("Lesley Lutz", "flying disc").
hobby("Lissa Coe", "cricket").
hobby("Lonny Parmer", "weightlifting").
hobby("Maria Baptiste", "meditation").
hobby("Michelle Hackworth", "ballroom dancing").
hobby("Noelia Lutz", "microscopy").
hobby("Orlando Beltran", "reading").
hobby("Reggie Coe", "laser tag").
hobby("Ricardo Hackworth", "hiking/backpacking").
hobby("Ryan Wang", "audiophile").
hobby("Shannon Beltran", "tennis polo").
hobby("Shelli Beltran", "photography").
hobby("Stacia Toombs", "backgammon").
hobby("Tanner Beltran", "microscopy").
hobby("Tosha Beltran", "herping").
hobby("Tyson Woodson", "philately").
hobby("Ulysses Parmer", "birdwatching").
hobby("Vicki Hackworth", "shogi").
hobby("Vincent Lutz", "magnet fishing").
hobby("Virgil Hackworth", "table tennis").
hobby("Von Sinclair", "scuba diving").
hobby("Wilbert Toombs", "biology").
hobby("Williams Smock", "sea glass collecting").
hobby("Wm Parmer", "research").

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

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

:- dynamic job/2.

job("Aida Wang", "personal assistant").
job("Alec Sinclair", "health promotion specialist").
job("Alfredo Wang", "osteopath").
job("Alison Smock", "broadcast engineer").
job("Alvaro Smock", "oncologist").
job("Alycia Coe", "warehouse manager").
job("Barabara Beltran", "associate professor").
job("Brian Beltran", "sports therapist").
job("Carrol Woodson", "retail manager").
job("Christina Coe", "immunologist").
job("Christoper Coe", "education administrator").
job("Cortney Parmer", "early years teacher").
job("Cythia Smock", "biomedical scientist").
job("Daisy Beltran", "music tutor").
job("Dino Beltran", "clinical cytogeneticist").
job("Dominique Smock", "ecologist").
job("Dwight Hackworth", "barrister's clerk").
job("Earle Coe", "petroleum engineer").
job("Eli Smock", "clinical research associate").
job("Gayla Woodson", "chief of staff").
job("Gene Smock", "occupational therapist").
job("Isiah Lutz", "actuary").
job("Jamison Baptiste", "police officer").
job("Kristen Toombs", "sound technician").
job("Lannie Smock", "theatre manager").
job("Leeann Sinclair", "clinical biochemist").
job("Leisa Lutz", "public relations officer").
job("Lesley Lutz", "music therapist").
job("Lissa Coe", "librarian").
job("Lonny Parmer", "building surveyor").
job("Maria Baptiste", "fitness centre manager").
job("Michelle Hackworth", "oceanographer").
job("Noelia Lutz", "historic buildings inspector").
job("Orlando Beltran", "chief marketing officer").
job("Reggie Coe", "waste management officer").
job("Ricardo Hackworth", "medical sales representative").
job("Ryan Wang", "community pharmacist").
job("Shannon Beltran", "pension scheme manager").
job("Shelli Beltran", "armed forces logistics officer").
job("Stacia Toombs", "environmental education officer").
job("Tanner Beltran", "medical illustrator").
job("Tosha Beltran", "museum conservator").
job("Tyson Woodson", "optometrist").
job("Ulysses Parmer", "further education lecturer").
job("Vicki Hackworth", "dancer").
job("Vincent Lutz", "water engineer").
job("Virgil Hackworth", "intelligence analyst").
job("Von Sinclair", "fashion designer").
job("Wilbert Toombs", "doctor").
job("Williams Smock", "chartered accountant").
job("Wm Parmer", "speech and language therapist").

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("Aida Wang", "0985-05-30").
dob("Alec Sinclair", "1006-07-10").
dob("Alfredo Wang", "1012-02-04").
dob("Alison Smock", "0929-10-28").
dob("Alvaro Smock", "0867-07-12").
dob("Alycia Coe", "0959-01-13").
dob("Barabara Beltran", "0989-06-11").
dob("Brian Beltran", "0927-07-27").
dob("Carrol Woodson", "1033-07-02").
dob("Christina Coe", "0983-02-26").
dob("Christoper Coe", "0957-01-08").
dob("Cortney Parmer", "1014-07-04").
dob("Cythia Smock", "0956-05-12").
dob("Daisy Beltran", "0931-09-21").
dob("Dino Beltran", "0958-08-09").
dob("Dominique Smock", "0897-09-08").
dob("Dwight Hackworth", "1016-12-30").
dob("Earle Coe", "0984-05-03").
dob("Eli Smock", "0901-01-18").
dob("Gayla Woodson", "1035-10-24").
dob("Gene Smock", "0898-08-16").
dob("Isiah Lutz", "1014-10-18").
dob("Jamison Baptiste", "0929-02-07").
dob("Kristen Toombs", "0986-06-27").
dob("Lannie Smock", "0867-08-24").
dob("Leeann Sinclair", "1011-10-25").
dob("Leisa Lutz", "1015-11-21").
dob("Lesley Lutz", "1040-01-31").
dob("Lissa Coe", "1010-08-08").
dob("Lonny Parmer", "1042-08-03").
dob("Maria Baptiste", "0929-10-22").
dob("Michelle Hackworth", "1007-05-01").
dob("Noelia Lutz", "1042-01-27").
dob("Orlando Beltran", "0953-10-23").
dob("Reggie Coe", "1009-07-17").
dob("Ricardo Hackworth", "0983-02-24").
dob("Ryan Wang", "0982-03-17").
dob("Shannon Beltran", "0981-04-26").
dob("Shelli Beltran", "0958-03-08").
dob("Stacia Toombs", "0959-03-22").
dob("Tanner Beltran", "0956-11-17").
dob("Tosha Beltran", "0955-03-27").
dob("Tyson Woodson", "1068-10-22").
dob("Ulysses Parmer", "1015-03-18").
dob("Vicki Hackworth", "0985-05-30").
dob("Vincent Lutz", "1063-07-01").
dob("Virgil Hackworth", "1009-06-23").
dob("Von Sinclair", "1039-02-26").
dob("Wilbert Toombs", "0956-07-26").
dob("Williams Smock", "0926-04-04").
dob("Wm Parmer", "1040-07-04").

:- 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("Aida Wang", person).
type("Alec Sinclair", person).
type("Alfredo Wang", person).
type("Alison Smock", person).
type("Alvaro Smock", person).
type("Alycia Coe", person).
type("Barabara Beltran", person).
type("Brian Beltran", person).
type("Carrol Woodson", person).
type("Christina Coe", person).
type("Christoper Coe", person).
type("Cortney Parmer", person).
type("Cythia Smock", person).
type("Daisy Beltran", person).
type("Dino Beltran", person).
type("Dominique Smock", person).
type("Dwight Hackworth", person).
type("Earle Coe", person).
type("Eli Smock", person).
type("Gayla Woodson", person).
type("Gene Smock", person).
type("Isiah Lutz", person).
type("Jamison Baptiste", person).
type("Kristen Toombs", person).
type("Lannie Smock", person).
type("Leeann Sinclair", person).
type("Leisa Lutz", person).
type("Lesley Lutz", person).
type("Lissa Coe", person).
type("Lonny Parmer", person).
type("Maria Baptiste", person).
type("Michelle Hackworth", person).
type("Noelia Lutz", person).
type("Orlando Beltran", person).
type("Reggie Coe", person).
type("Ricardo Hackworth", person).
type("Ryan Wang", person).
type("Shannon Beltran", person).
type("Shelli Beltran", person).
type("Stacia Toombs", person).
type("Tanner Beltran", person).
type("Tosha Beltran", person).
type("Tyson Woodson", person).
type("Ulysses Parmer", person).
type("Vicki Hackworth", person).
type("Vincent Lutz", person).
type("Virgil Hackworth", person).
type("Von Sinclair", person).
type("Wilbert Toombs", person).
type("Williams Smock", person).
type("Wm Parmer", person).

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

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


:- dynamic attribute/1.

attribute("personal assistant").
attribute("meditation").
attribute("health promotion specialist").
attribute("meteorology").
attribute("osteopath").
attribute("biology").
attribute("broadcast engineer").
attribute("meteorology").
attribute("oncologist").
attribute("dolls").
attribute("warehouse manager").
attribute("photography").
attribute("associate professor").
attribute("shogi").
attribute("sports therapist").
attribute("dominoes").
attribute("retail manager").
attribute("tether car").
attribute("immunologist").
attribute("architecture").
attribute("education administrator").
attribute("geocaching").
attribute("early years teacher").
attribute("trainspotting").
attribute("biomedical scientist").
attribute("bus spotting").
attribute("music tutor").
attribute("research").
attribute("clinical cytogeneticist").
attribute("geography").
attribute("ecologist").
attribute("microbiology").
attribute("barrister's clerk").
attribute("canoeing").
attribute("petroleum engineer").
attribute("learning").
attribute("clinical research associate").
attribute("dairy farming").
attribute("chief of staff").
attribute("fossil hunting").
attribute("occupational therapist").
attribute("sociology").
attribute("actuary").
attribute("finance").
attribute("police officer").
attribute("meditation").
attribute("sound technician").
attribute("wikipedia editing").
attribute("theatre manager").
attribute("radio-controlled car racing").
attribute("clinical biochemist").
attribute("social studies").
attribute("public relations officer").
attribute("judo").
attribute("music therapist").
attribute("flying disc").
attribute("librarian").
attribute("cricket").
attribute("building surveyor").
attribute("weightlifting").
attribute("fitness centre manager").
attribute("meditation").
attribute("oceanographer").
attribute("ballroom dancing").
attribute("historic buildings inspector").
attribute("microscopy").
attribute("chief marketing officer").
attribute("reading").
attribute("waste management officer").
attribute("laser tag").
attribute("medical sales representative").
attribute("hiking/backpacking").
attribute("community pharmacist").
attribute("audiophile").
attribute("pension scheme manager").
attribute("tennis polo").
attribute("armed forces logistics officer").
attribute("photography").
attribute("environmental education officer").
attribute("backgammon").
attribute("medical illustrator").
attribute("microscopy").
attribute("museum conservator").
attribute("herping").
attribute("optometrist").
attribute("philately").
attribute("further education lecturer").
attribute("birdwatching").
attribute("dancer").
attribute("shogi").
attribute("water engineer").
attribute("magnet fishing").
attribute("intelligence analyst").
attribute("table tennis").
attribute("fashion designer").
attribute("scuba diving").
attribute("doctor").
attribute("biology").
attribute("chartered accountant").
attribute("sea glass collecting").
attribute("speech and language therapist").
attribute("research").

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_("Aida Wang", "Lonny Parmer").
friend_("Aida Wang", "Orlando Beltran").
friend_("Aida Wang", "Tyson Woodson").
friend_("Alec Sinclair", "Alfredo Wang").
friend_("Alec Sinclair", "Gayla Woodson").
friend_("Alec Sinclair", "Lonny Parmer").
friend_("Alec Sinclair", "Michelle Hackworth").
friend_("Alec Sinclair", "Noelia Lutz").
friend_("Alec Sinclair", "Ulysses Parmer").
friend_("Alfredo Wang", "Michelle Hackworth").
friend_("Alfredo Wang", "Virgil Hackworth").
friend_("Alfredo Wang", "Wm Parmer").
friend_("Alison Smock", "Cortney Parmer").
friend_("Alison Smock", "Jamison Baptiste").
friend_("Alison Smock", "Wilbert Toombs").
friend_("Alvaro Smock", "Maria Baptiste").
friend_("Alvaro Smock", "Orlando Beltran").
friend_("Alvaro Smock", "Stacia Toombs").
friend_("Alycia Coe", "Lissa Coe").
friend_("Alycia Coe", "Tanner Beltran").
friend_("Alycia Coe", "Tosha Beltran").
friend_("Barabara Beltran", "Carrol Woodson").
friend_("Barabara Beltran", "Gene Smock").
friend_("Barabara Beltran", "Lannie Smock").
friend_("Barabara Beltran", "Lonny Parmer").
friend_("Barabara Beltran", "Vicki Hackworth").
friend_("Barabara Beltran", "Von Sinclair").
friend_("Brian Beltran", "Daisy Beltran").
friend_("Brian Beltran", "Gene Smock").
friend_("Carrol Woodson", "Cortney Parmer").
friend_("Christina Coe", "Cythia Smock").
friend_("Christina Coe", "Dwight Hackworth").
friend_("Christina Coe", "Eli Smock").
friend_("Christina Coe", "Maria Baptiste").
friend_("Christoper Coe", "Vincent Lutz").
friend_("Cortney Parmer", "Dwight Hackworth").
friend_("Cortney Parmer", "Leisa Lutz").
friend_("Cythia Smock", "Dino Beltran").
friend_("Cythia Smock", "Dwight Hackworth").
friend_("Cythia Smock", "Shannon Beltran").
friend_("Daisy Beltran", "Lissa Coe").
friend_("Dino Beltran", "Maria Baptiste").
friend_("Dino Beltran", "Stacia Toombs").
friend_("Dino Beltran", "Virgil Hackworth").
friend_("Dino Beltran", "Wm Parmer").
friend_("Dominique Smock", "Noelia Lutz").
friend_("Dominique Smock", "Vicki Hackworth").
friend_("Dominique Smock", "Von Sinclair").
friend_("Dwight Hackworth", "Lonny Parmer").
friend_("Dwight Hackworth", "Ryan Wang").
friend_("Dwight Hackworth", "Ulysses Parmer").
friend_("Earle Coe", "Gene Smock").
friend_("Earle Coe", "Ulysses Parmer").
friend_("Eli Smock", "Lissa Coe").
friend_("Eli Smock", "Ricardo Hackworth").
friend_("Gayla Woodson", "Isiah Lutz").
friend_("Gayla Woodson", "Ryan Wang").
friend_("Gayla Woodson", "Vicki Hackworth").
friend_("Isiah Lutz", "Leeann Sinclair").
friend_("Jamison Baptiste", "Leeann Sinclair").
friend_("Jamison Baptiste", "Ulysses Parmer").
friend_("Kristen Toombs", "Leeann Sinclair").
friend_("Kristen Toombs", "Williams Smock").
friend_("Lannie Smock", "Tanner Beltran").
friend_("Leeann Sinclair", "Maria Baptiste").
friend_("Leisa Lutz", "Ryan Wang").
friend_("Lesley Lutz", "Von Sinclair").
friend_("Lissa Coe", "Lonny Parmer").
friend_("Lissa Coe", "Von Sinclair").
friend_("Lonny Parmer", "Vincent Lutz").
friend_("Lonny Parmer", "Von Sinclair").
friend_("Maria Baptiste", "Tanner Beltran").
friend_("Michelle Hackworth", "Tyson Woodson").
friend_("Orlando Beltran", "Shannon Beltran").
friend_("Orlando Beltran", "Vicki Hackworth").
friend_("Shannon Beltran", "Vincent Lutz").
friend_("Shelli Beltran", "Williams Smock").
friend_("Stacia Toombs", "Virgil Hackworth").
friend_("Von Sinclair", "Williams Smock").

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("Aida Wang", "Dino Beltran").
parent("Aida Wang", "Shelli Beltran").
parent("Alfredo Wang", "Aida Wang").
parent("Alfredo Wang", "Ryan Wang").
parent("Barabara Beltran", "Dino Beltran").
parent("Barabara Beltran", "Shelli Beltran").
parent("Christina Coe", "Stacia Toombs").
parent("Christina Coe", "Wilbert Toombs").
parent("Cortney Parmer", "Aida Wang").
parent("Cortney Parmer", "Ryan Wang").
parent("Cythia Smock", "Alison Smock").
parent("Cythia Smock", "Williams Smock").
parent("Dino Beltran", "Brian Beltran").
parent("Dino Beltran", "Daisy Beltran").
parent("Dwight Hackworth", "Ricardo Hackworth").
parent("Dwight Hackworth", "Vicki Hackworth").
parent("Earle Coe", "Alycia Coe").
parent("Earle Coe", "Christoper Coe").
parent("Eli Smock", "Alvaro Smock").
parent("Eli Smock", "Lannie Smock").
parent("Gayla Woodson", "Lissa Coe").
parent("Gayla Woodson", "Reggie Coe").
parent("Gene Smock", "Alvaro Smock").
parent("Gene Smock", "Lannie Smock").
parent("Kristen Toombs", "Stacia Toombs").
parent("Kristen Toombs", "Wilbert Toombs").
parent("Leeann Sinclair", "Ricardo Hackworth").
parent("Leeann Sinclair", "Vicki Hackworth").
parent("Leisa Lutz", "Ricardo Hackworth").
parent("Leisa Lutz", "Vicki Hackworth").
parent("Lesley Lutz", "Isiah Lutz").
parent("Lesley Lutz", "Leisa Lutz").
parent("Lonny Parmer", "Cortney Parmer").
parent("Lonny Parmer", "Ulysses Parmer").
parent("Michelle Hackworth", "Ricardo Hackworth").
parent("Michelle Hackworth", "Vicki Hackworth").
parent("Orlando Beltran", "Brian Beltran").
parent("Orlando Beltran", "Daisy Beltran").
parent("Reggie Coe", "Christina Coe").
parent("Reggie Coe", "Earle Coe").
parent("Shannon Beltran", "Orlando Beltran").
parent("Shannon Beltran", "Tosha Beltran").
parent("Shelli Beltran", "Alison Smock").
parent("Shelli Beltran", "Williams Smock").
parent("Stacia Toombs", "Alison Smock").
parent("Stacia Toombs", "Williams Smock").
parent("Tanner Beltran", "Brian Beltran").
parent("Tanner Beltran", "Daisy Beltran").
parent("Tosha Beltran", "Jamison Baptiste").
parent("Tosha Beltran", "Maria Baptiste").
parent("Tyson Woodson", "Carrol Woodson").
parent("Tyson Woodson", "Gayla Woodson").
parent("Vicki Hackworth", "Dino Beltran").
parent("Vicki Hackworth", "Shelli Beltran").
parent("Vincent Lutz", "Lesley Lutz").
parent("Vincent Lutz", "Noelia Lutz").
parent("Virgil Hackworth", "Ricardo Hackworth").
parent("Virgil Hackworth", "Vicki Hackworth").
parent("Von Sinclair", "Alec Sinclair").
parent("Von Sinclair", "Leeann Sinclair").
parent("Williams Smock", "Dominique Smock").
parent("Williams Smock", "Gene Smock").
parent("Wm Parmer", "Cortney Parmer").
parent("Wm Parmer", "Ulysses Parmer").

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("Aida Wang", "female").
gender("Alec Sinclair", "male").
gender("Alfredo Wang", "male").
gender("Alison Smock", "female").
gender("Alvaro Smock", "male").
gender("Alycia Coe", "female").
gender("Barabara Beltran", "female").
gender("Brian Beltran", "male").
gender("Carrol Woodson", "male").
gender("Christina Coe", "female").
gender("Christoper Coe", "male").
gender("Cortney Parmer", "female").
gender("Cythia Smock", "female").
gender("Daisy Beltran", "female").
gender("Dino Beltran", "male").
gender("Dominique Smock", "female").
gender("Dwight Hackworth", "male").
gender("Earle Coe", "male").
gender("Eli Smock", "male").
gender("Gayla Woodson", "female").
gender("Gene Smock", "male").
gender("Isiah Lutz", "male").
gender("Jamison Baptiste", "male").
gender("Kristen Toombs", "female").
gender("Lannie Smock", "female").
gender("Leeann Sinclair", "female").
gender("Leisa Lutz", "female").
gender("Lesley Lutz", "male").
gender("Lissa Coe", "female").
gender("Lonny Parmer", "male").
gender("Maria Baptiste", "female").
gender("Michelle Hackworth", "female").
gender("Noelia Lutz", "female").
gender("Orlando Beltran", "male").
gender("Reggie Coe", "male").
gender("Ricardo Hackworth", "male").
gender("Ryan Wang", "male").
gender("Shannon Beltran", "female").
gender("Shelli Beltran", "female").
gender("Stacia Toombs", "female").
gender("Tanner Beltran", "male").
gender("Tosha Beltran", "female").
gender("Tyson Woodson", "male").
gender("Ulysses Parmer", "male").
gender("Vicki Hackworth", "female").
gender("Vincent Lutz", "male").
gender("Virgil Hackworth", "male").
gender("Von Sinclair", "male").
gender("Wilbert Toombs", "male").
gender("Williams Smock", "male").
gender("Wm Parmer", "male").

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.