⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex2

📁 这是用prolog写的几个程序:程序1是一个旅行社关系系统
💻
字号:


        /*************************/
	/*** AGENCE MATRIMONIAL***/
	/*************************/


	/* homme(nom, etat-civil)*/

homme(Patrick,veuf)->;
homme(Daniel,celiba)->;

 
	/* femme(nom, etat-civil)*/

femme(Sarah,celiba)->;
femme(Ibolya,celiba)->;


	/*physique(nom-personne, taille, couleur-des-cheveux, maturite)*/

physique(Sarah,moyenne,roux,jeune)->;
physique(Ibolya,moyenne,brun,jeune)->;
physique(Daniel,moyenne,brun,jeune)->;
physique(Patrick,petite,brun,vieux)->;


	/*situation(nom-personne,profession,salaire,situation-financiere)*/

situation(Ibolya,etudiante,0,moyenne)->;
situation(Sarah,etudiante,5000,moyenne)->;
situation(Patrick,professeur,2500,moyenne)->;
situation(Daniel,etudiant,0,moyenne)->;


	/*gouts(nom-personne,type_de_musique,type_livre,type_sport)*/

gouts(Patrick,classique,aventure,tennis)->;
gouts(Ibolya,pop,policier,velo)->;
gouts(Daniel,classique,aventure,tennis)->;
gouts(Sarah,classique,aventure,tennis)->;


	/*biens(nom-personne,liste_des_biens)*/

biens(Daniel, appartement.voiture.nil)->;
biens(Ibolya, voiture.nil)->;
biens(Patrick, appartement.voiture.nil)->;
biens(Sarah, entreprise.voiture.nil)->;

	/*recherche(nom-personne,etat_civil,taille,couleur_cheveux,maturitte*/
	/*          profession,salaire,situation_financiere,type_sport,liste_biens)*/

recherche(Patrick,veuf,grande,x,vieux,medecin,y,z,tennis,voiture.nil)->;
recherche(Daniel,celiba,moyenne,x,jeune,etudiante,y,z,tennis,voiture.nil)->;
recherche(Sarah,celiba,moyenne,x,jeune,etudiant,y,z,tennis,voiture.nil)->;
recherche(Ibolya,veuf,petite,brun,x,mur,medecin,y,z,tennis,voiture.nil)->;

membre(e,e.q)->;
membre(e,x.q)->membre(e,q)!;

inclu(nil,L)->!;
inclu(x.q,L1)->membre(x,L1) inclu(q,L1) ! ;

	/*pere(nom-pere,nom-enfant)*/
pere(Mihaly,Ibolya)->;
pere(Tom,Daniel)->;
pere(Francois,Sarah)->;
pere(Manuel,Patrick)->;

	/*mere(nom-mere,nom-enfant)*/
mere(Manuela,Patrick)->;
mere(Iren,Ibolya)->;
mere(Tilda,Daniel)->;
mere(Mer,Sarah)->;

	/*Definition de la relation: x est parent de y*/
parent(x,y)->pere(x,y);
parent(x,y)->mere(x,y);

	/*Definition de la relation: x est enfant de y*/
enfant(x,y)->parent(y,x);

	/*Definition de la relation: x est frere(ou soeur) de y*/
frereousoeur(x,y)->parent(p,x) parent(p,y);

	/*Definition de la relation: x est la tante(ou l'oncle) de y*/
oncleoutante(x,y)->parent(p,x) frereousoeur(x,p);


/*Definition de la relation: x est un proche de y*/
proche(x,y)->parent(x,y) val(eql(x,y),0);
proche(x,y)->enfant(x,y) val(eql(x,y),0);
proche(x,y)->frereousoeur(x,y) val(eql(x,y),0);
proche(x,y)->oncleoutante(x,y) val(eql(x,y),0);



/*Definition de la relation: l'homme h convient a la femme f*/
hommeconvient(h,f)->
		recherche(f,e,t,c,m,p,s,g,j,x)
		homme(h,e)
		not(proche(f,h))
		physique(h,t,c,m)
		situation(h,p,s,g)
		gouts(h,w,z,j)
		biens(h,b)
		inclu(x,b);


/*Definition de la relation: la femme f convient a l'homme h*/
femmeconvient(f,h)->
		recherche(h,e,t,c,m,p,s,g,j,x)
		femme(f,e)
		not(proche(h,f))
		physique(f,t,c,m)
		situation(f,p,s,g)
		gouts(f,w,z,j)
		biens(f,b)
		inclu(x,b);

/*Definition de la relation: h et f forment un couple assorti*/
coupleassorti(h,f)->hommeconvient(h,f)
		femmeconvient(f,h)
		memegouts(h,f);

/*Definition de la relation: h et f ont meme gout*/
memegouts(h,f)->gouts(h,x,y,z)
		gouts(f,x,y,z);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -