• Home
  • Blog
  • Prolog Assigment (writing set of facts, rules and queries)

Prolog Assigment (writing set of facts, rules and queries)

0 comments

Hello, I need your help on my prolog assigment.

Please use the basic logic (if, and…) as much as possible. This is the first assigment of prolog in my class.

I will post a quick sumary here, but please read the attachment for details.

I need your help on two files: the first one will contain a set of facts and rules, and the second one will contain 10 queries.

These types of data items:

SSN – a 3 digit ID number (unique for each employee)

NAME – a list of 2 or 3 items; [bob, smith] or [edgar, allan, poe]

TITLE – a job title; president, vice_president, department_head, worker, etc.

COMP – a company name; sysco, ibm, etc.

DATE – a four-digit year

FACTS: The only type of facts are listed here. You can assume that while someone

may change titles at one company, they are not rehired there after quitting. Writing:

emp_name(SSN, NAME).

job_hist(SSN, TITLE, DATE, COMP). {DATE is the starting date.}

quit(SSN, DATE, COMP). {DATE is the departure date.}

supervisor(SSN1,SSN2). {SSN1 is above SSN2 in the current hierarchy}

RULES: You will write the following rules:

current_job(SSN, TITLE, COMP).

samelastname(SSN1, SSN2, COMP). Are there two people at the same company

with the same last name?

worktogether(SSN1, SSN2). Did these two people work together at the

same company during the same year?

above(SSN1, SSN2). Is first above second in the hierarchy?

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}