Вы находитесь на странице: 1из 6

% ESPECIFICACION DE REGLAS

%================================================
padre(X, Y) :- proge(X, Y), varon(X).
madre(X, Y) :- proge(X, Y), mujer(X).
hijo(X, Y) :- proge(Y, X), varon(X).
hija(X, Y) :- proge(Y, X), mujer(X).
abuelo(X, Y) :- padre(X, Z), proge(Z, Y).
abuela(X, Y) :- madre(X, Z), proge(Z, Y).
bisabuela(X, Y) :-madre(X, Z), abuelo(Z, Y).
bisabuela(X, Y) :-madre(X, Z), abuela(Z, Y).
bisabuelo(X, Y) :-padre(X, Z), abuelo(Z, Y).
bisabuelo(X, Y) :-padre(X, Z), abuela(Z, Y).
nieto(X, Y) :- proge(Y, Z), proge(Z, X), varon(X).
nieto(X, Y) :- abuelo(Y, X), varon(X).
nieto(X, Y) :- abuela(Y, X), varon(X).
nieta(X, Y) :- abuelo(Y, X), mujer(X).
nieta(X, Y) :- abuela(Y, X), mujer(X).
bisnieto(X, Y) :- bisabuelo(Y, X), varon(X).
bisnieto(X, Y) :- bisabuela(Y, X), varon(X).
bisnieta(X, Y) :- bisabuelo(Y, X), mujer(X).
bisnieta(X, Y) :- bisabuela(Y, X), mujer(X).
mismo(X, X).
diferente(X, Y) :- not(mismo(X, Y)).
hermanos(X, Y) :- proge(Z, X), proge(Z, Y), diferente(X, Y).
tio(X, Y) :- hermanos(X, Z), antepasado(Z, Y), varon(X).
tio(X, Y) :- primohermano(X, Z), antepasado(Z, Y), varon(X).
tia(X, Y) :- hermanos(X, Z), antepasado(Z, Y), mujer(X).
tia(X, Y) :- primahermana(X, Z), antepasado(Z, Y), mujer(X).
tioabuelo(X, Y) :-hermanos(X, Z), abuelo(Z, Y), varon(X).
tiaabuela(X, Y) :-hermanos(X, Z), abuela(Z, Y), mujer(X).
sobrino(X, Y) :- tio(Y, X), varon(X).
sobrino(X, Y) :- tia(Y, X), varon(X).
sobrina(X, Y) :- tio(Y, X), mujer(X).
sobrina(X, Y) :- tia(Y, X), mujer(X).
primohermano(X, Y) :- padre(Z, X), tio(Z, Y), varon(X).
primohermano(X, Y) :- madre(Z, X), tia(Z, Y), varon(X).
primahermana(X, Y) :- padre(Z, X), tio(Z, Y), mujer(X).
primahermana(X, Y) :- madre(Z, X), tia(Z, Y), mujer(X).
primo(X, Y) :-proge(Z, X), proge(W, Y), hermanos(Z, W), varon(X).
prima(X, Y) :-proge(Z, X), proge(W, Y), hermanos(Z, W), mujer(X).
cuado(X, Y) :- proge(Y, Z), proge(W, Z), diferente(Y, W), hermanos(X, W), varon(X).
cuado(Y, X) :- proge(Y, Z), proge(W, Z), diferente(Y, W), hermanos(X, W), varon(Y).
cuada(X, Y) :- proge(Y, Z), proge(W, Z), diferente(Y, W), hermanos(X, W), mujer(X).
cuada(Y, X) :- proge(Y, Z), proge(W, Z), diferente(Y, W), hermanos(X, W), mujer(Y).
suegro(X, Y) :- proge(Y, Z), proge(W, Z), diferente(Y, W), proge(X, W), varon(X).
suegra(X, Y) :- proge(Y, Z), proge(W, Z), diferente(Y, W), proge(X, W), mujer(X).
yerno(X, Y) :- suegro(Y, X), varon(X).
yerno(X, Y) :- suegra(Y, X), varon(X).
nuera(X, Y) :- suegro(Y, X), mujer(X).
nuera(X, Y) :- suegra(Y, X), mujer(X).
hijastro(X, Y) :- proge(Y, Z), proge(W, Z), diferente(Y, W), proge(W, X), not(proge(Y, X)),
varon(X).
hijastra(X, Y) :- proge(Y, Z), proge(W, Z), diferente(Y, W), proge(W, X), not(proge(Y, X)),
mujer(X).
hermanastro(X, Y) :- proge(Z, Y), hijastro(X, Z), varon(X).
hermanastra(X, Y) :- proge(Z, Y), hijastro(X, Z), mujer(X).
mediohermana(X, Y) :- proge(Z, Y), proge(Z, X), not(hermanos(X, Y)), mujer(X).
mediohermano(X, Y) :- proge(Z, Y), proge(Z, X), not(hermanos(X, Y)), varon(X).
%RECURSIVIDAD { antepasado(x, y) = x es antepasado de y}
antepasado(X, Y) :- proge(X, Y).
antepasado(X, Y) :- proge(X, Z), antepasado(Z, Y).
%================================================
% ESPECIFICACION DE HECHOS
%================================================
proge(enrique, vicente).
proge(enrique, cristobal).
proge(enrique, cesar).
proge(enrique, juana).
proge(genara, vicente).
proge(genara, cristobal).
proge(genara, cesar).
proge(genara, juana).
proge(juana, eddy).
proge(juana, alvaro).
proge(americo, eddy).
proge(americo, alvaro).
proge(luis, esther).
proge(luis, mirtha).
proge(luis, riquelme).
proge(luis, americo).
proge(maria, esther).
proge(maria, mirtha).
proge(maria, riquelme).
proge(maria, americo).
proge(esther, jeanette).
proge(esther, jubitsa).
proge(esther, johnny).
proge(pascual, jeanette).
proge(pascual, jubitsa).
proge(pascual, johnny).
proge(mirtha, raul).
proge(mirtha, ricardo).
proge(mirtha, omar).
proge(avelino, raul).
proge(avelino, ricardo).
proge(avelino, omar).
proge(riquelme, yesenia).
proge(riquelme, stephanie).
proge(catalina, yesenia).
proge(catalina, stephanie).
proge(ricardo, atenea).
proge(lili, atenea).
varon(enrique).
varon(luis).
varon(vicente).
varon(cristobal).
varon(americo).
varon(pascual).
varon(avelino).
varon(riquelme).
varon(alvaro).
varon(eddy).
varon(raul).
varon(ricardo).
varon(omar).
varon(johnny).
mujer(genara).
mujer(juana).
mujer(maria).
mujer(mirtha).
mujer(esther).
mujer(catalina).
mujer(yesenia).
mujer(stephanie).
mujer(jeanette).
mujer(jubitsa).
mujer(lili).
mujer(atenea).
PRUEBAS
1 ?- abuelo(luis, eddy).
true .
2 ?- abuelo(luis, X).
X = jeanette;
X = jubitsa;
X = johnny;
X = raul;
X = ricardo;
X = omar;
X = yesenia;
X = stephanie;
X = eddy;
X = alvaro.
3 ?- abuelo(X, eddy).
X = enrique;
X = luis;
4 ?- padre(luis, americo).
true.
5 ?- padre(X, eddy).
X = americo;
6 ?- bisnieta(X, luis).
X = atenea;
7 ?- nieto(eddy, enrique).
True.
8 ?- nieto(alvaro, genara).
true .
zea valdera

Вам также может понравиться

  • Libro de Vocabulario Bielorruso: Un Método Basado en Estrategia
    Libro de Vocabulario Bielorruso: Un Método Basado en Estrategia
    От Everand
    Libro de Vocabulario Bielorruso: Un Método Basado en Estrategia
    Оценок пока нет
  • Prolog
    Prolog
    Документ1 страница
    Prolog
    Marvin Valdospin
    Оценок пока нет
  • Predicados y Vriables
    Predicados y Vriables
    Документ2 страницы
    Predicados y Vriables
    sandra ramirez
    Оценок пока нет
  • PROGRAMACIÓN
    PROGRAMACIÓN
    Документ10 страниц
    PROGRAMACIÓN
    VALERIA ABIGAIL BURGOS MONTENEGRO
    Оценок пока нет
  • Prolog
    Prolog
    Документ9 страниц
    Prolog
    Renzo Israel Tovar Moscol
    Оценок пока нет
  • Tarea#3 - Grupal
    Tarea#3 - Grupal
    Документ22 страницы
    Tarea#3 - Grupal
    Daniel Montaño vargas
    Оценок пока нет
  • Prolog
    Prolog
    Документ10 страниц
    Prolog
    Renzo Israel Tovar Moscol
    Оценок пока нет
  • DiegoCervantes ArbolG
    DiegoCervantes ArbolG
    Документ2 страницы
    DiegoCervantes ArbolG
    Diego Cervantes
    Оценок пока нет
  • Prolog
    Prolog
    Документ9 страниц
    Prolog
    BRAYAN FERNEY RODRIGUEZ PUENTES
    Оценок пока нет
  • Ejer PL Aula Solucion
    Ejer PL Aula Solucion
    Документ7 страниц
    Ejer PL Aula Solucion
    Mónica Villacorta Rivera
    Оценок пока нет
  • Arbol Genealogico
    Arbol Genealogico
    Документ4 страницы
    Arbol Genealogico
    Alonzo Huamani Sanchez
    Оценок пока нет
  • Arbol Genealogico en Prolog
    Arbol Genealogico en Prolog
    Документ7 страниц
    Arbol Genealogico en Prolog
    Alonzo Huamani Sanchez
    Оценок пока нет
  • Examen Final - DESARROLLO PARA ENTORNOS INTELIGENTES
    Examen Final - DESARROLLO PARA ENTORNOS INTELIGENTES
    Документ6 страниц
    Examen Final - DESARROLLO PARA ENTORNOS INTELIGENTES
    Meco :v
    Оценок пока нет
  • HVH - IA Guia Laboratorio Prolog
    HVH - IA Guia Laboratorio Prolog
    Документ24 страницы
    HVH - IA Guia Laboratorio Prolog
    Eduardo S.L.
    Оценок пока нет
  • Resumen Prolog
    Resumen Prolog
    Документ6 страниц
    Resumen Prolog
    Marvin Lopez
    Оценок пока нет
  • Ejemplos en Prolog
    Ejemplos en Prolog
    Документ9 страниц
    Ejemplos en Prolog
    Joaquin Coy
    Оценок пока нет
  • Clase Prolog
    Clase Prolog
    Документ5 страниц
    Clase Prolog
    Edson William Agrada Berrios
    Оценок пока нет
  • Ingles 2
    Ingles 2
    Документ8 страниц
    Ingles 2
    Maria Florencia Sugasty
    Оценок пока нет
  • Programas Prolog PDF
    Programas Prolog PDF
    Документ6 страниц
    Programas Prolog PDF
    Aby123peqee
    Оценок пока нет
  • Prolog Ejercico1
    Prolog Ejercico1
    Документ2 страницы
    Prolog Ejercico1
    jean gamarra
    Оценок пока нет
  • Prolog Ejercico1
    Prolog Ejercico1
    Документ2 страницы
    Prolog Ejercico1
    juan
    Оценок пока нет
  • Artículos y Sustantivos
    Artículos y Sustantivos
    Документ22 страницы
    Artículos y Sustantivos
    Alex Reyes
    Оценок пока нет
  • Textos Latín 1 Declinación
    Textos Latín 1 Declinación
    Документ7 страниц
    Textos Latín 1 Declinación
    Israel
    100% (1)
  • Lesson #2 - Vocabularios - La Frase PDF
    Lesson #2 - Vocabularios - La Frase PDF
    Документ5 страниц
    Lesson #2 - Vocabularios - La Frase PDF
    Enrique Salvatierra
    Оценок пока нет
  • Probabilidad Marginal
    Probabilidad Marginal
    Документ4 страницы
    Probabilidad Marginal
    Victor Ivan Farias Rosas
    40% (5)
  • Maple
    Maple
    Документ12 страниц
    Maple
    Pak Arie Nyank Cakep
    Оценок пока нет
  • Pequeño Diccionario de Griego
    Pequeño Diccionario de Griego
    Документ31 страница
    Pequeño Diccionario de Griego
    ScareWay
    Оценок пока нет
  • Articulos y Sustantivos
    Articulos y Sustantivos
    Документ14 страниц
    Articulos y Sustantivos
    Diego Augusto Soto
    Оценок пока нет
  • Paradigma de Programacion Prolog
    Paradigma de Programacion Prolog
    Документ74 страницы
    Paradigma de Programacion Prolog
    Percy Quispe
    Оценок пока нет
  • Aplicaciones de La Derivación
    Aplicaciones de La Derivación
    Документ2 страницы
    Aplicaciones de La Derivación
    Yahir AS
    Оценок пока нет
  • Diccionario Griego Español - Español Griego-1-54
    Diccionario Griego Español - Español Griego-1-54
    Документ54 страницы
    Diccionario Griego Español - Español Griego-1-54
    Gerardo Pamela Velázquez
    Оценок пока нет
  • Prog Log
    Prog Log
    Документ21 страница
    Prog Log
    Carlos Meza
    Оценок пока нет
  • Guía Genética de Poblaciones
    Guía Genética de Poblaciones
    Документ7 страниц
    Guía Genética de Poblaciones
    Pía Fernanda
    Оценок пока нет
  • Solución TP 2 - 1a Declinación
    Solución TP 2 - 1a Declinación
    Документ2 страницы
    Solución TP 2 - 1a Declinación
    Judith Corteze
    100% (1)
  • Morfologia de La Palabra
    Morfologia de La Palabra
    Документ21 страница
    Morfologia de La Palabra
    Albrech Stay Seancas Calderon
    Оценок пока нет
  • Curso de Ingles - 1
    Curso de Ingles - 1
    Документ46 страниц
    Curso de Ingles - 1
    Danny BRs
    100% (1)
  • Ulpan1 04 Student ES
    Ulpan1 04 Student ES
    Документ13 страниц
    Ulpan1 04 Student ES
    Rav Gadiel
    Оценок пока нет
  • Eustaquio Echauri Verbos Latin
    Eustaquio Echauri Verbos Latin
    Документ36 страниц
    Eustaquio Echauri Verbos Latin
    deltois
    Оценок пока нет
  • Sepa Si Es de Origen Judío
    Sepa Si Es de Origen Judío
    Документ12 страниц
    Sepa Si Es de Origen Judío
    Muñe Ka
    Оценок пока нет
  • Program RTaller 2
    Program RTaller 2
    Документ4 страницы
    Program RTaller 2
    laura
    Оценок пока нет
  • Actividad Sistemas Basados en Conocimiento
    Actividad Sistemas Basados en Conocimiento
    Документ6 страниц
    Actividad Sistemas Basados en Conocimiento
    CESAR URIEL HERNANDEZ ALTAMIRANO
    Оценок пока нет
  • Singular and Plural Nouns
    Singular and Plural Nouns
    Документ8 страниц
    Singular and Plural Nouns
    german211990
    Оценок пока нет
  • Prolog
    Prolog
    Документ3 страницы
    Prolog
    deimy
    Оценок пока нет
  • Consanguinidad y Parentesco. Texto.
    Consanguinidad y Parentesco. Texto.
    Документ4 страницы
    Consanguinidad y Parentesco. Texto.
    Rocio Dabos
    Оценок пока нет
  • Segunda Declinación - Vocabulario
    Segunda Declinación - Vocabulario
    Документ1 страница
    Segunda Declinación - Vocabulario
    Manuel Fernández Fraile
    0% (1)
  • 4 A Gender of Nouns
    4 A Gender of Nouns
    Документ39 страниц
    4 A Gender of Nouns
    Titser Yasi
    Оценок пока нет
  • Ejercicios Prolog - 2
    Ejercicios Prolog - 2
    Документ3 страницы
    Ejercicios Prolog - 2
    K J
    Оценок пока нет
  • Griego Final
    Griego Final
    Документ6 страниц
    Griego Final
    Ana Belén Cantero Paz
    Оценок пока нет
  • Apoyo de Axiomas de Los Numeros Reales
    Apoyo de Axiomas de Los Numeros Reales
    Документ108 страниц
    Apoyo de Axiomas de Los Numeros Reales
    Diacono10
    Оценок пока нет
  • 7 Sustantivos
    7 Sustantivos
    Документ3 страницы
    7 Sustantivos
    Amparo Lafuente Ayala
    Оценок пока нет
  • Diccionario Nasa Yuwe - Castellano
    Diccionario Nasa Yuwe - Castellano
    Документ199 страниц
    Diccionario Nasa Yuwe - Castellano
    Ale Ramirez Saavedra
    87% (93)
  • Vocabulario Básico GRIEGO I PDF
    Vocabulario Básico GRIEGO I PDF
    Документ8 страниц
    Vocabulario Básico GRIEGO I PDF
    Sergio
    Оценок пока нет
  • Manual Ingles Español
    Manual Ingles Español
    Документ92 страницы
    Manual Ingles Español
    Carlos Chicay P
    Оценок пока нет
  • Gramática Italiana
    Gramática Italiana
    Документ24 страницы
    Gramática Italiana
    Oscar L. Ravacci
    Оценок пока нет
  • Endogamia y Sistemas de Endocría
    Endogamia y Sistemas de Endocría
    Документ18 страниц
    Endogamia y Sistemas de Endocría
    Mirian Rosmery P Mamani
    Оценок пока нет
  • Lista de Sufijos Del Español
    Lista de Sufijos Del Español
    Документ5 страниц
    Lista de Sufijos Del Español
    pao rios
    Оценок пока нет
  • Vocabulario Minimo Latín
    Vocabulario Minimo Latín
    Документ7 страниц
    Vocabulario Minimo Latín
    Mercedes Lopez Ordiales
    Оценок пока нет
  • Vocabulario Básico de Griego
    Vocabulario Básico de Griego
    Документ14 страниц
    Vocabulario Básico de Griego
    Angel Ruiz
    83% (6)
  • Taller LCAT 11
    Taller LCAT 11
    Документ3 страницы
    Taller LCAT 11
    Andres Chavarro
    Оценок пока нет
  • Constitución de Una EIRL
    Constitución de Una EIRL
    Документ1 страница
    Constitución de Una EIRL
    Zeña Valdera Joze David
    Оценок пока нет
  • 30comunicación de Datos
    30comunicación de Datos
    Документ44 страницы
    30comunicación de Datos
    Zeña Valdera Joze David
    Оценок пока нет
  • Tabla AA
    Tabla AA
    Документ40 страниц
    Tabla AA
    Zeña Valdera Joze David
    Оценок пока нет
  • Proyecto Corregido Elena Eymi Rubí
    Proyecto Corregido Elena Eymi Rubí
    Документ86 страниц
    Proyecto Corregido Elena Eymi Rubí
    Zeña Valdera Joze David
    Оценок пока нет
  • Aplicación de Mineria de Datos para Predecir Fuga
    Aplicación de Mineria de Datos para Predecir Fuga
    Документ16 страниц
    Aplicación de Mineria de Datos para Predecir Fuga
    Zeña Valdera Joze David
    Оценок пока нет
  • Prueba de Turing PDF
    Prueba de Turing PDF
    Документ15 страниц
    Prueba de Turing PDF
    Zeña Valdera Joze David
    Оценок пока нет
  • Tesis Unprg PDF
    Tesis Unprg PDF
    Документ214 страниц
    Tesis Unprg PDF
    Zeña Valdera Joze David
    Оценок пока нет
  • Tesis Unprg
    Tesis Unprg
    Документ214 страниц
    Tesis Unprg
    Zeña Valdera Joze David
    Оценок пока нет
  • Ensayo Sobre La Inteligencia Artificial
    Ensayo Sobre La Inteligencia Artificial
    Документ7 страниц
    Ensayo Sobre La Inteligencia Artificial
    Zeña Valdera Joze David
    Оценок пока нет