Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2743 connectés 

  FORUM HardWare.fr
  Programmation
  Divers

  [prolog] coment on compare deux characteres ?

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[prolog] coment on compare deux characteres ?

n°273299
karim63
Posté le 19-12-2002 à 19:37:49  profilanswer
 

je voudrais trier des listes avec des characeteres dedans.

mood
Publicité
Posté le 19-12-2002 à 19:37:49  profilanswer
 

n°273366
karim63
Posté le 19-12-2002 à 20:46:45  profilanswer
 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%   PROJET'02 : TRANSFORMATIONS EQUIVALENTES  %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% DEFINITIONS DES CONNECTEURS %%%%%%%%%
:-op(600,fy,'~';).      % la negation
:-op(670,yfx,&).       % la conjonction
:-op(675,yfx,'V';).     % la disjonction
:-op(680,yfx, '->';).   % l'implication
:-op(700,yfx,'<->';).   % l'equivalence
 
%%%%%%%%%%%%%%%%%%%%%%%% TRANSFORMATIONS %%%%%%%%%%%%%%%%%%%%%%%%
%% Equivalence :
%%%%%%%%%%%%%%%%%
teq(Form1 '<->' Form2,  Memb1 & Memb2) :-
 !,
  teq(Form1 '->' Form2, Memb1),
  teq(Form2 '->' Form1, Memb2).
teq(Form1 & Form2, Memb1 & Memb2) :-
  !,
  teq(Form1, Memb1),
  teq(Form2, Memb2).
teq(Form1 'V' Form2, Memb1 'V' Memb2) :-
  !,
  teq(Form1, Memb1),
  teq(Form2, Memb2).
teq(Form1 '->' Form2, Memb1 '->' Memb2) :-
  !,
  teq(Form1, Memb1),
  teq(Form2, Memb2).
teq('~' Form, '~' Memb) :-
  !,
  teq(Form, Memb).
teq(P,P).
 
%%%%%%%%%%%%%%%%%%%%%%
%% Implication :
%%%%%%%%%%%%%%%%%%%%%%
 
tim(Form1 '->' Form2, '~' Memb1 'V' Memb2) :-
  !,
  tim(Form1, Memb1),
  tim(Form2, Memb2).
tim(Form1 & Form2, Memb1 & Memb2) :-
  !,
  tim(Form1, Memb1),
  tim(Form2, Memb2).
tim(Form1 'V' Form2, Memb1 'V' Memb2) :-
  !,
  tim(Form1, Memb1),
  tim(Form2, Memb2).
tim('~' Form, '~' Memb) :-
  !,
  tim(Form, Memb).
tim(P,P) :-
  atom(P).
 
%%%%%%%%%%%%%%%%%%%%%%
%% Negation :
%%%%%%%%%%%%%%%%%%%%%%
tng('~' '~' Form, Res) :-
  !,
  tng(Form,Res).
tng('~' (Form1 & Form2), (Res1 'V' Res2)) :-
  !,
  tng('~' Form1, Res1),
  tng('~' Form2, Res2).
tng('~' (Form1 'V' Form2), (Res1 & Res2)) :-
  !,
  tng('~' Form1, Res1),
  tng('~' Form2, Res2).
tng('~' P, '~' P) :-
  !,
  atom(P).
tng(Form1 & Form2, Memb1 & Memb2) :-
  !,
  tng(Form1, Memb1),
  tng(Form2, Memb2).
tng(Form1 'V' Form2, Memb1 'V' Memb2) :-
  !,
  tng(Form1, Memb1),
  tng(Form2, Memb2).
tng(P, P) :-
  atom(P).
 
%%%%%%%%%%%%%%%%%%%%%%
%%  Distributions :
%%%%%%%%%%%%%%%%%%%%%%
%%  & --> 'V'
 
dstrc((G1 'V' G2) & D, R1 'V' R2) :-
  !,
  dstrc(G1 & D,R1),
  dstrc(G2 & D,R2).
dstrc(G & (D1 'V' D2), R1 'V' R2) :-
  !,
  dstrc(G & D1,R1),
  dstrc(G & D2,R2).
dstrc((F1 & F2) & F3, F) :-
  !,
  dstrc(F2 & F3, R1),
  dstrc(F1 & R1, F).
dstrc(F1 'V' F2, R1 'V' R2) :-
  !,
  dstrc(F1, R1),
  dstrc(F2, R2).
dstrc(F, F).
 
%%%%%%%%%%%%%%%%%%%%%%
%%  Distributions :
%%%%%%%%%%%%%%%%%%%%%%
%%  'V' --> &
 
dstrd((G1 & G2) 'V' D, R1 & R2) :-
  !,
  dstrd(G1 'V' D,R1),
  dstrd(G2 'V' D,R2).
dstrd(G 'V' (D1 & D2), R1 & R2) :-
  !,
  dstrd(G 'V' D1,R1),
  dstrd(G 'V' D2,R2).
dstrd((F1 'V' F2) 'V' F3, F) :-
  !,
  dstrd(F2 'V' F3, R1),
  dstrd(F1 'V' R1, F).
dstrd(F1 & F2, R1 & R2) :-
  !,
  dstrd(F1, R1),
  dstrd(F2, R2).
dstrd(F, F).
 
%%%%%%%%%%%%%%%%%%
%% Associativites :
%%%%%%%%%%%%%%%%%%%
 
assg(F1 'V' (F2 'V' F3),R1a 'V' F3a) :-
   !,
   assg(F1 'V' F2,R1a),
   assg(F3, F3a).
 
assg((F1 'V' F2) 'V' F3,R1a 'V' F3a) :-
   !,
   assg(F1 'V' F2,R1a),
   assg(F3, F3a).
 
assg(F,F).
 
assd((F1 'V' F2) 'V' F3, F1a 'V' (F2a 'V' F3a)) :-
   !,
   assd(F1, F1a),
   assd(F2, F2a),
   assd(F3, F3a).
 
assd(F1 'V' (F2 'V' F3), F1a 'V' (F2a 'V' F3a)) :-
   !,
   assd(F1, F1a),
   assd(F2, F2a),
   assd(F3, F3a).
assd(F,F).
 
eassg(F1 & (F2 & F3),(F1a & F2a) & F3a) :-
   !,
   eassg(F1, F1a),
   eassg(F2, F2a),
   eassg(F3, F3a).
 
eassg((F1 & F2) & F3,(F1a & F2a) & F3a) :-
   !,
   eassg(F1, F1a),
   eassg(F2, F2a),
   eassg(F3, F3a).
eassg(F,F).
 
eassd((F1 & F2) & F3, F1a & (F2a & F3a)) :-
   !,
   eassd(F1, F1a),
   eassd(F2, F2a),
   eassd(F3, F3a).
 
eassd(F1 & (F2 & F3), F1a & (F2a & F3a)) :-
   !,
   eassd(F1, F1a),
   eassd(F2, F2a),
   eassd(F3, F3a).
eassd(F,F).

n°273370
lorill
Posté le 19-12-2002 à 20:51:23  profilanswer
 

[:dawa]

n°273459
karim63
Posté le 19-12-2002 à 23:46:27  profilanswer
 

:lol:
 
En fait si j'ai mis ça c'est pour un pote de fac.
Evolution buggait et je pouvais pas lui envoyer le fichier alors j'ai fait copier collé :lol:
 
sinon j'ai resolu mon probleme et ça marche.  :wahoo:


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Divers

  [prolog] coment on compare deux characteres ?

 

Sujets relatifs
Coment faire une newsletter?Coment dessiner sur un JPanel a partir d'une autre classe?
[Prolog] je cherche un prolog gratuit à téléchargercoment mettre vidoe sur site en html?
[Excel] Coment reprendre la valeur d'1 cellule... ?Qui a des cours Prolog sous forme informatique à me passer????
Qui connait le placement des 9 reines sur un échiquier en Prolog ???Livre sur Prolog
Commande de lancement d'un fichier Prolog[OpenGL] Coment activer la synchro verticale?
Plus de sujets relatifs à : [prolog] coment on compare deux characteres ?


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR