Bevezet\303\251s a matematik\303\241baJ\303\241rai AntalEzek a programok csak szeml\303\251ltet\303\251sre szolg\303\241lnak1. Halmazokrestart;1.1. Logikai alapok1.1.1. Az axiomatikus m\303\263dszer.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.1.2. Logikai jelek, predik\303\241tumok, formul\303\241k.Logikai jelek:QyRRSyZub3Q7JmFuZDsmb3I7JkltcGxpZXM7JmlmZjsmb3BsdXM7fGdyJlZlcnQ7NiIiIiI=LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnKvantorok:QyRRMCZleGlzdDsmZm9yYWxsOzYiIiIiFormul\303\241k gener\303\241l\303\241sa:QzA+SSZwcG5vdEc2IlEmJm5vdDtGJSEiIj5JJnBwYW5kR0YlUSYmYW5kO0YlRic+SSVwcG9yR0YlUSUmb3I7RiVGJz5JKHBwaW1wbHlHRiVRKiZJbXBsaWVzO0YlRic+SSZwcGlmZkdGJVEmJmlmZjtGJUYnPkkocHBleGlzdEdGJVEoJmV4aXN0O0YlRic+SSlwcGZvcmFsbEdGJVEpJmZvcmFsbDtGJUYnstringseq:=proc() local i,s;
if nargs=0 then return "" fi; s:=convert(args[1],string);
for i from 2 to nargs do s:=cat(s,",",args[i]) od; s; end;
with(combinat):
genform:=proc(L::list(list(string)),n::nonnegint)
local V,VV,i,j,c,a,C,S,SL,SR,sr,sl;
if nops(L)<=1 then return {} fi; S:={}; V:=L[1];
if n=0 then VV:=[]; for i from 2 to nops(L) do
C:=choose(VV,i-2); for c in C do for a in L[i] do
S:=S union {cat(a,"(",stringseq(op(c)),")")};
od; od; VV:=[op(VV),op(V)]; od;
else SL:=genform(L,n-1); C:=choose(V,1);
for sl in SL do S:=S union {cat(ppnot,sl)}; for c in C do
S:=S union {cat("(",ppexist,op(c)," ",sl,")"),
cat("(",ppforall,op(c)," ",sl,")")}
od; od;
for j to n do SL:=genform(L,j-1); SR:=genform(L,n-j);
for sl in SL do for sr in SR do
S:=S union {cat("(",sl,ppand,sr,")"),cat("(",sl,ppor,sr,")"),
cat("(",sl,ppimply,sr,")"),cat("(",sl,ppiff,sr,")")}
od; od;
od; fi; S; end;
genform([["x","y"],["A","B"],["C","D"],["E","F"]],0);
genform([["x","y"],[],["P","E"],["I"]],1);
genform([["x","y"],[],["P"],["I"]],2):Az al\303\241bbi parser program egy sztring elemz\303\251s\303\251t v\303\251gzi, hogy az \303\251rv\303\251nyes formula-e? Ha igen, akkor a true \303\251rt\303\251ket \303\251s p\303\241rok egy list\303\241j\303\241t, \303\251s a marad\303\251k sztringet adja vissza. A p\303\241rok m\303\241sodik koordin\303\241t\303\241ja a megtal\303\241lt szintaktikai alapegys\303\251g. Az els\305\221 koordin\303\241ta az alapegys\303\251g tipusa, az al\303\241bbiak szerint:k kvantorl logikai jelp z\303\241r\303\263jelc vessz\305\221f szabad v\303\241ltoz\303\263b k\303\266t\303\266tt v\303\241ltoz\303\2630,1,... predik\303\241tum, adott sz\303\241m\303\272 v\303\241ltoz\303\263val? predik\303\241tum, m\303\251g ismeretlen sz\303\241m\303\272 v\303\241ltoz\303\263valHiba eset\303\251n false \303\251rt\303\251ket kapunk, a lista \303\251s a marad\303\251k sztring pedig utal a hiba hely\303\251re.A v\303\241ltoz\303\263k \303\251s a predik\303\241tumok neve bet\305\261vel kell kezd\305\221dj\303\266n \303\251s bet\305\261ket \303\251s sz\303\241mjegyeket tartalmazhat. Elv\303\241laszt\303\263 jelk\303\251nt tetsz\305\221leges "whitespace" karakterekb\305\221l \303\241ll\303\263 sorozat haszn\303\241lhat\303\263.Az egyszer\305\261bb elj\303\241r\303\241sokkal kezdj\303\274k:A parseparentheses elj\303\241r\303\241s egy kezd\305\221 z\303\241r\303\263jellel kezd\305\221d\305\221 sztringben megkeresi az ehhez tartoz\303\263 z\303\241r\303\263 z\303\241r\303\263jelet, \303\251s ennek index\303\251t adja vissza. Ha sikertelen, akkor nulla az eredm\303\251ny.A parsename elj\303\241r\303\241s egy sztringet sz\303\251tv\303\241g egy n\303\251vre \303\251s egy marad\303\251kra.A parsevarsec elj\303\241r\303\241s vessz\305\221kel elv\303\241lasztott v\303\241ltoz\303\263k sorozat\303\241t ismeri fel.A parsepredicate elj\303\241r\303\241s egy predik\303\241tumot ismer fel.A f\305\221program a parsesentence elj\303\241r\303\241s.parseparentheses:=proc(s::string) local n,j;
if s="" then return 0 fi; n:=0;
for j to length(s) do
if s[j]="(" then n:=n+1 fi;
if s[j]=")" then n:=n-1; fi;
if n=0 then return j fi;
od; 0; end;
with(StringTools):
parsename:=proc(s::string) local ls,rs;
rs:=TrimLeft(s);
if length(rs)=0 then return "","" fi;
if IsAlpha(rs[1]) then ls:=rs[1]; rs:=Drop(rs,1) else return "",rs fi;
while length(rs)>0 do
if IsAlphaNumeric(rs[1]) then
ls:=cat(ls,rs[1]); rs:=Drop(rs,1);
else return ls,rs fi;
od; ls,rs end;
parsevarseq:=proc(s::string) local L,rs,x;
rs:=TrimLeft(s); L:=[]; if rs="" then return true,L,"" fi;
while true do
x:=parsename(rs);
if x[1]="" then return false,L,x[2] fi;
L:=[op(L),["f",x[1]]];
rs:=TrimLeft(x[2]); if rs="" then return true,L,"" fi;
if rs[1]<>"," then return false,L,rs fi;
L:=[op(L),["c",","]];
rs:=TrimLeft(Drop(rs,1));
if rs="" then return false,L,"" fi;
od; end;
parsepredicate:=proc(s::string) local L,x,ls,rs,j;
x:=parsename(s);ls:=x[1];
if ls="" then return false,[],x[2] fi; rs:=x[2];
if rs="" then return false,["?",ls],"" fi;
if rs[1]<>"(" then return false,["?",ls],rs fi;
j:=parseparentheses(rs);
if j=0 then return false,["?",ls],rs fi;
x:=parsevarseq(rs[2..j-1]);
if x[1] then
if x[2]=[] then
true,[[0,ls],["p","("],["p",")"]],Drop(rs,j)
else
true,[[(nops(x[2])+1)/2,ls],["p","("],op(x[2]),["p",")"]],
Drop(rs,j)
fi;
else x[1],x[2],cat(x[3],Drop(rs,j-1)) fi; end;parsesentence:=proc(s::string) local ls,rs,L,x,j,n;
global ppnot,ppand,ppor,ppimply,ppiff,ppexist,ppforall;
rs:=TrimLeft(s); if rs="" then return false,[],"" fi;
if IsPrefix(ppnot,rs) then
rs:=Drop(rs,length(ppnot));
x:=parsesentence(rs);
x[1],[["l",ppnot],op(x[2])],x[3]
elif rs[1]<>"(" then
parsepredicate(rs)
else
L:=[["p","("]]; j:=parseparentheses(rs);
if j=0 then return false,L,rs[2..-1] fi;
ls:=TrimLeft(rs[2..j-1]); rs:=Drop(rs,j-1);
if IsPrefix(ppexist,ls) or IsPrefix(ppforall,ls) then
if IsPrefix(ppexist,ls) then
L:=[op(L),["k",ppexist]]; ls:=Drop(ls,length(ppexist));
else
L:=[op(L),["k",ppforall]]; ls:=Drop(ls,length(ppforall));
fi;
x:=parsename(ls); if x[1]="" then return false,L,cat(x[2],rs) fi;
n:=x[1];L:=[op(L),["b",n]];
x:=parsesentence(x[2]);
if not x[1] or x[3]<>"" then
return false,[op(L),op(x[2])],cat(x[3],rs) fi;
for j in x[2] do
if j[1]="f" and j[2]=n then
L:=[op(L),["b",n]] else
L:=[op(L),j] fi; od;
L:=[op(L),["p",")"]]; rs:=TrimLeft(Drop(rs,1));
true,L,rs
else
x:=parsesentence(ls);
if not x[1] then return false,x[2],cat(x[3],rs) fi;
L:=[op(L),op(x[2])]; ls:=TrimLeft(x[3]);
if IsPrefix(ppand,ls) or IsPrefix(ppor,ls)
or IsPrefix(ppimply,ls) or IsPrefix(ppiff,ls) then
if IsPrefix(ppand,ls) then
L:=[op(L),["l",ppand]];ls:=Drop(ls,length(ppand))
elif IsPrefix(ppor,ls) then
L:=[op(L),["l",ppor]];ls:=Drop(ls,length(ppor))
elif IsPrefix(ppor,ls) then
L:=[op(L),["l",ppor]];ls:=Drop(ls,length(ppor))
else
L:=[op(L),["l",ppor]];ls:=Drop(ls,length(ppor))
fi;
x:=parsesentence(ls);L:=[op(L),op(x[2])];
if not x[1] or x[3]<>"" then
return false,L,cat(x[3],rs) fi;
L:=[op(L),["p",")"]]; rs:=TrimLeft(Drop(rs,1));
true,L,rs
else
false,L,cat(ls,rs)
fi;
fi;
fi; end;QywtSS5wYXJzZXNlbnRlbmNlRzYiNiNRJ0koeCx5KUYlIiIiLUYkNiNRMSZmb3JhbGw7eH5JKHgseClGJUYoLUYkNiNRMygmZm9yYWxsO3h+SSh4LHgpKUYlRigtRiQ2I1FUKCZmb3JhbGw7eCgmZm9yYWxsO3koJmV4aXN0O3ooSSh4LHopJmFuZDtJKHkseikpKSkpRiVGKC1GJDYjUUIoKEUoeCkmYW5kO0UoeSkpJmFuZDsmbm90O0koeCx5KSlGJUYo1.1.3. Megjegyz\303\251s. 1.1.4. P\303\251lda.1.1.5. P\303\251lda.1.1.6. P\303\251lda.1.1.7. Matematikai elm\303\251letek.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.1.8. Matematikai logika.1.1.9. Egyenl\305\221s\303\251g.1.1.10. Nyelvek m\305\261veletekkel.1.1.11. Az axi\303\263m\303\241k jelent\303\251se.*1.1.12. Az axi\303\263m\303\241k kiv\303\241laszt\303\241sa.->1.1.13. Feladat.->1.1.14. Feladat.->1.1.15. Feladat.->1.1.16. Feladat.1.1.17. Feladat.1.1.18. Feladat.->1.1.19. Feladat.1.1.20. Feladat.->1.1.21. Feladat.->1.1.22. Feladat.1.1.23. Tov\303\241bbi feladatok.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2. Halmazelm\303\251leti alapfogalmakrestart;LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.1. Halmazelm\303\251let.A:={a,b,c}; member(b,A); member(d,A); b in A; evalb(%); d in A; evalb(%);whattype(A); whattype(a); whattype(2); whattype(krikszkraksz); whattype("krikszkraksz");1.2.2. Meghat\303\241rozotts\303\241g.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn{a,a,b,b,a}; {b,a};* 1.2.3. Meghat\303\241rozotts\303\241gi axi\303\263ma.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.4. R\303\251szhalmazok.{a,b} subset {a,b,d};{a,c} subset {a,b,d};{a,b} subset {a,b};X subset X; X subset Y;A:={1,2,3,4,5,6,7}; select(x->isprime(x),A);
* 1.2.5. R\303\251szhalmaz-axi\303\263ma.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn* 1.2.6. T\303\251tel.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn* 1.2.7. Megjegyz\303\251s.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.8. N\303\251h\303\241ny egyszer\305\261 halmaz.{}; {a,b}; {a,a}; {a,b,c};a:=b; {a,b};a:='a'; {a,b};{} subset X;1.2.9. Az \303\274res halmaz axi\303\263m\303\241ja.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.10. P\303\241raxi\303\263ma.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.11. Uni\303\263.QyYtSSZ1bmlvbkclKnByb3RlY3RlZEc2JDwkSSJiRzYiSSJhR0YpPCRGKEkiY0dGKSIiIkYjRi0=Qyo+SScmQXNjcjtHNiI8JzwiPCRJImJHRiVJImFHRiU8I0YqPCUiIiIiIiNGKTwkRilJImNHRiVGLS1JI29wRyUqcHJvdGVjdGVkRzYjRiRGLS1JJnVuaW9uR0YzNiNGMUYtLUY2NidGK0YvRixGJ0YoRi0={a,b} union {b,c}; `union`({a},{b,c},{1,2,b},{},{a,b});
A:={a,b}; B:={b,c}; `union`(A,B);`union`();* 1.2.12. Uni\303\263axi\303\263ma.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.13. \303\201ll\303\255t\303\241s: az uni\303\263 tulajdons\303\241gai.X union {};X union Y; Y union X;(X union Y) union Z; X union (Y union Z);X union X;LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.14. Metszet.{a,b,1} intersect {a,c,2,1};`intersect`({a,b,c,d},{a,b,c,1},{a,b,1,2});A:={a,b}; B:={b,c}; C:={c,a}; A intersect B; B intersect C; C intersect A; `intersect`(A,B); `intersect`(A,B,C);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.15. \303\201ll\303\255t\303\241s: a metszet tulajdons\303\241gai.Az els\305\221 n\303\251gy tulajdons\303\241got a Maple is ismeri:X intersect {};X intersect Y; Y intersect X;X intersect (Y intersect Z); (X intersect Y) intersect Z;X intersect X;LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.2.16. Feladat.->1.2.17. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.2.18. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.2.19. Feladat.1.1.20. Feladat.1.2.21. Feladat.1.2.22. \303\201ll\303\255t\303\241s: disztributivit\303\241si szab\303\241lyok.X intersect (Y union Z); expand(%);X union (Y intersect Z); A:={a,b,c}; B:={b,c,d}; C:={c,d,e}; A union (B intersect C); (A union B) intersect (A union C);LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.2.23. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.24. K\303\274l\303\266nbs\303\251g \303\251s komplementer.A:={a,b}; B:={b,c}; C:={a,b,c,d}; A minus B;
symmdiff(A,B); symmdiff(A,B,C);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.25. \303\201ll\303\255t\303\241s.A; C minus (C minus A);C; C minus {};{}, C minus C;{}; A intersect (C minus A);C; A union (C minus A);B:={a,b,d}; A; C minus B; C minus A;
A; B:={b,c}; C minus (A union B); (C minus A) intersect (C minus B);
C minus (A intersect B); (C minus A) union (C minus B);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.2.26. Feladat.->1.2.27. Feladat.->1.2.28. Feladat.->1.2.29. Feladat.->1.2.30. Feladat.1.2.31. Feladat.1.2.32. Feladat.1.2.33. Feladat.->1.2.34. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.2.35. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.36. Hatv\303\241nyhalmaz.with(combinat,powerset): powerset({a,b,c}); powerset({a,b});
powerset({a}); powerset({});
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn* 1.2.37. Hatv\303\241nyhalmaz-axi\303\263ma.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.2.38. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.2.39. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.40. Feladat.->1.2.41. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn* 1.2.42. V\303\251gtelens\303\251gi axi\303\263ma.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.2.43. Megjegyz\303\251s. 1.2.44. Tov\303\241bbi feladatok r\303\251szletes megold\303\241ssal.1.2.45. Tov\303\241bbi feladatok.1.3. Rel\303\241ci\303\263k1.3.1. Rendezett p\303\241r.A rendezett p\303\241r a Maple-ben [x,y].evalb({{x},{x,y}}={{y},{x,y}});evalb([x,y]=[y,x]);
p:=[x,y]; p[1]; p[2];`type/ordpair`:=proc(x) type(x,list) and nops(x)=2 end;
type([a,b],ordpair); type([1,2,3],ordpair);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.2. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.3. Descartes-szorzat.bincartprod:=proc(X::set,Y::set) local x,y,Z; Z:={};
for x in X do for y in Y do Z:=Z union {[x,y]}; od; od; Z; end;
bincartprod({1,2,3},{a,b});LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.4. Feladat.->1.3.5. Feladat.1.3.6. Feladat.1.3.7. Feladat.1.3.8. Bin\303\251r rel\303\241ci\303\263k.binrel:=proc(R::set(ordpair),X::set,Y::set) local r;
if nargs<1 or nargs>3 then error ": needs 1..3 arguments" fi;
for r in R do
if nargs=2 and not (member(r[1],X) and member(r[2],X)) then
return false;
elif nargs=3 and not (member(r[1],X) and member(r[2],Y)) then
return false
fi;
od; true; end;
binrel({});
R:=bincartprod({1,2,3},{a,b});binrel(R);binrel(R,{0,1,2,3},{a,b,c});
binrel(R,{a,b},{1,2,3});binrel(R,{1,2,3,a,b});
id:=proc(X) local x; map(x->[x,x],X); end; id({1,3,a});
F:={{1},{2},{1,2}}; FF:=bincartprod(F,F); select(x->x[1] subset x[2],FF);select(x->x[1] subset x[2] and not x[1]=x[2],FF);
irem(13,5); X:={1,2,3,4,5,6};XX:=bincartprod(X,X):
R:=select(x->irem(x[2],x[1])=0,XX);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.9. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.10. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.11. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.12. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.13. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.14. Rel\303\241ci\303\263k gr\303\241fja.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.15. \303\211rtelmez\303\251si tartom\303\241ny, \303\251rt\303\251kk\303\251szlet.R:={[1,a],[1,b],[2,b],[3,d],[2,d],[4,e]};
dmn:=proc(R::set(ordpair)) map(x->x[1],R); end; dmn(R);
rng:=proc(R::set(ordpair)) map(x->x[2],R); end; rng(R);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.16. Feladat.1.3.17. Kiterjeszt\303\251s, lesz\305\261k\303\255t\303\251s.R; select(x->(x[1]>1 and x[2]<>b),R);
restrict:=proc(R::set(ordpair),X) select(x->(x[1] in X),R); end;
X:={2,3}; restrict(R,X);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.18. Inverz.relinv:=proc(R::set(ordpair)) map(x->[x[2],x[1]],R); end;
R; dmn(R); rng(R); S:=relinv(R); dmn(S); rng(S); relinv(S);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.19. Halmaz k\303\251pe \303\251s inverz k\303\251pe.mapset:=proc(R::set(ordpair),A::set) rng(restrict(R,A)) end;
invmapset:=proc(R::set(ordpair),A::set) rng(restrict(relinv(R),A)) end;
R; S:=relinv(R); A:={1,4}; B:={b,e}; mapset(R,A); mapset(R,B);
invmapset(R,B); mapset(S,B);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.20. Feladat.->1.3.21. Feladat.->1.3.22. Feladat.->1.3.23. Feladat.1.3.24. Kompoz\303\255ci\303\263.relcomp:=proc(R::set(ordpair),S::set(ordpair)) local r,s,T; T:={};
for r in R do for s in S do
if s[2]=r[1] then T:=T union {[s[1],r[2]]}; fi;
od; od; T; end;
R; S:={[aa,1],[bb,3],[cc,5]}; relcomp(R,S);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.25. Feladat.->1.3.26. Feladat.1.3.27. \303\201ll\303\255t\303\241s.R; S:={[aa,1],[aa,2],[bb,3],[cc,4],[dd,5]}; relcomp(R,S); rng(R); rng(%%);
T:={[xx,aa],[xx,cc]}; relcomp(R,relcomp(S,T)); relcomp(relcomp(R,S),T);
relinv(relcomp(R,S)); relcomp(relinv(S),relinv(R));
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.28. \303\201ll\303\255t\303\241s.R; IX:=id({1,2,3,4,5}); relcomp(R,IX); IY:=id({a,b,c,d,e}); relcomp(IY,R);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.29. Defin\303\255ci\303\263.istransitive:=proc(R::set(ordpair)) local r,s;
for r in R do for s in R do
if r[2]=s[1] and not [r[1],s[2]] in R then
return false fi;
od; od; true; end;
X:={1,2,3,4,5,6}; XX:=bincartprod(X,X):
R:=select(x->irem(x[2],x[1])=0,XX); istransitive(R);
issymmetric:=proc(R::set(ordpair)) local r,s;
for r in R do
if not [r[2],r[1]] in R then return false fi;
od; true; end;
issymmetric(R);
isantisymmetric:=proc(R::set(ordpair)) local r;
for r in R do
if [r[2],r[1]] in R then if r[1]<>r[2] then return false fi; fi;
od; true; end;
isantisymmetric(R);
isstriclyantisymmetric:=proc(R::set(ordpair)) local r;
for r in R do
if [r[2],r[1]] in R then return false fi;
od; true; end;
isstriclyantisymmetric(R);
isreflexive:=proc(X::set,R::set(ordpair)) local x;
if not binrel(R,X) then return false fi;
for x in X do if not [x,x] in R then return false fi; od; true; end;
isreflexive(X,R);
isirreflexive:=proc(X::set,R::set(ordpair)) local x;
if not binrel(R,X) then return false fi;
for x in X do if [x,x] in R then return false fi; od; true; end;
isirreflexive(X,R);
istrichotom:=proc(X::set,R::set(ordpair)) local x,y;
if not binrel(R,X) then return false fi;
for x in X do for y in X do
if x<>y then if ([x,y] in R and [y,x] in R) or
((not [x,y] in R) and (not [y,x] in R)) then return false
fi; fi;
od; od; true; end;
istrichotom(X,R);
isdichotom:=proc(X::set,R::set(ordpair)) local x,y;
if not binrel(R,X) then return false fi;
for x in X do for y in X do
if not([x,y] in R or [y,x] in R) then return false fi;
od; od; true; end;
isdichotom(X,R);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.30. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.31. Feladat.1.3.32. Feladat.->1.3.33. Feladat.1.3.34. Feladat.->1.3.35. Feladat.1.3.36. Feladat.1.3.37. Reflex\303\255v, szimmetrikus illetve tranzit\303\255v rel\303\241ci\303\263k gr\303\241fj\303\241nak egyszer\305\261s\303\255t\303\251se.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.38. Ekvivalenciarel\303\241ci\303\263, oszt\303\241lyoz\303\241s.isequivalence:=proc(X::set,R::set(ordpair))
istransitive(R) and issymmetric(R) and isreflexive(X,R); end;
isequivalence(X,R);
E:=select(x->irem(x[1],3)=irem(x[2],3),XX); isequivalence(X,E);
ispartition:=proc(X::set,cO::set(set)) local Y,Z;
for Y in cO do if Y={} then return false fi;
for Z in cO do if Y<>Z and Y intersect Z<>{} then return false; fi; od; od; if `union`(op(cO))<>X then false else true fi; end;
X; cO:={{1,4},{2,5},{3,6}}; ispartition(X,cO);
cO:={{1},{2,3,4}}; ispartition(X,cO);
cO:={{1,2,3},{4,5,6,7}}; ispartition(X,cO);
cO:={{1,2,3,4},{4,5,6}}; ispartition(X,cO);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.39. T\303\251tel.equi2part:=proc(X::set,E::set(ordpair)) local cO,x,y,tx; cO:={};
for x in X do tx:={};
for y in X do if [x,y] in E then tx:=tx union {y} fi; od;
cO:=cO union {tx}
od; cO; end;
X; E; cO:=equi2part(X,E);
part2equi:=proc(X::set,cO::set(set)) local E,Y,x,y; E:={};
for Y in cO do for x in Y do for y in Y do
E:=E union {[x,y]}
od; od; od; E; end;
part2equi(X,cO);
cO; equi2part(X,part2equi(X,cO)); E; part2equi(X,equi2part(X,E));
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.40. P\303\251lda.->1.3.41. Feladat.->1.3.42. Feladat.->1.3.43. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.44. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.45. R\303\251szbenrendez\303\251s, rendez\303\251s.ispartialordering:=proc(X::set,R::set(ordpair))
istransitive(R) and isantisymmetric(R) and isreflexive(X,R); end;
X; R; ispartialordering(X,R);
iscomparable:=proc(x,y,R::set(ordpair))
evalb([x,y] in R or [y,x] in R); end;
iscomparable(2,6,R); iscomparable(2,3,R);
isordering:=proc(X::set,R::set(ordpair)) local x;
ispartialordering(X,R) and isdichotom(X,R) end;
isordering(X,R); S:=select(x->x[1]<=x[2],XX); isordering(X,S);
ischain:=proc(X::set,R::set(ordpair)) local S;
S:=R intersect bincartprod(X,X);
isordering(X,S); end;
ischain({1,2,4},R); ischain({1,2,3},R);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.46. P\303\251lda.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.47. Szigor\303\272 \303\251s gyenge rel\303\241ci\303\263.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.48. Szigor\303\272 \303\251s gyenge rendez\303\251s.strictrel:=proc(X::set,R::set(ordpair)) R minus id(X); end;
X; R; S:=strictrel(X,R);
weakrel:=proc(X::set,R::set(ordpair)) R union id(X); end;
weakrel(X,R);
istransitive(S); isirreflexive(X,S); isstriclyantisymmetric(S);
istrichotom(X,S);R:=select(x->x[1]<=x[2],XX); S:=strictrel(X,R); istrichotom(X,S);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.49. Feladat.->1.3.50. Feladat.1.3.51. Intervallumok.int_o_o:=proc(X::set,R::set(ordpair),x,y) local S,z; S:={};
for z in X do
if [x,z] in R and x<>z and [z,y] in R and z<>y then S:=S union {z}; fi;
od; S; end;
int_o_c:=proc(X::set,R::set(ordpair),x,y) local S,z; S:={};
for z in X do
if [x,z] in R and x<>z and [z,y] in R then S:=S union {z}; fi;
od; S; end;
int_i_o:=proc(X::set,R::set(ordpair),x) local S,y; S:={};
for y in X do
if [y,x] in R and x<>y then S:=S union {y}; fi;
od; S; end;
X:={1,2,3,4,5,6}; XX:=bincartprod(X,X):
R:=select(x->irem(x[2],x[1])=0,XX);
int_o_o(X,R,1,6); int_o_c(X,R,1,6); int_i_o(X,R,6);
$ 2..6;$ 1..9;LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.52. R\303\251szbenrendez\303\251sek Hasse-diagrammja.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.53. Legkisebb, legnagyobb, minim\303\241lis \303\251s maxim\303\241lis elem.least:=proc(X::set,R::set(ordpair)) local x,y,f;
for x in X do f:=true;
for y in X do if not [x,y] in R then f:=false; break; fi; od;
if f then return x fi;
od; NULL; end;
greatest:=proc(X::set,R::set(ordpair)) local x,y,f;
for x in X do f:=true;
for y in X do if not [y,x] in R then f:=false; break; fi; od;
if f then return x fi;
od; NULL; end;
X; R; least(X,R); greatest(X,R);mins:=proc(X::set,R::set(ordpair)) local x,y,f,S; S:={};
for x in X do f:=true;
for y in X do if [y,x] in R and x<>y then f:=false; break; fi; od;
if f then S:=S union {x}; fi;
od; S; end;
maxs:=proc(X::set,R::set(ordpair)) local x,y,f,S; S:={};
for x in X do f:=true;
for y in X do if [x,y] in R and x<>y then f:=false; break; fi; od;
if f then S:=S union {x}; fi;
od; S; end;
X; R; mins(X,R); maxs(X,R);LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.54. P\303\251lda.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.55. Korl\303\241tok.islowerbound:=proc(X::set,R::set(ordpair),Y::set,x) local y;
for y in Y do if not [x,y] in R then return false fi; od; true; end;
isupperbound:=proc(X::set,R::set(ordpair),Y::set,x) local y;
for y in Y do if not [y,x] in R then return false fi; od; true; end;
X; R; islowerbound(X,R,{2,3,5},1); isupperbound(X,R,{2,3,5},6);
lowerbounds:=proc(X::set,R::set(ordpair),Y::set) local S,x; S:={};
for x in X do if islowerbound(X,R,Y,x) then S:=S union {x} fi; od;
S; end;
upperbounds:=proc(X::set,R::set(ordpair),Y::set) local S,x; S:={};
for x in X do if isupperbound(X,R,Y,x) then S:=S union {x} fi; od;
S; end;
X:={1,2,3,4,5,6}; XX:=bincartprod(X,X):
R:=select(x->irem(x[2],x[1])=0,XX);
lowerbounds(X,R,{2,4}); upperbounds(X,R,{2,4});
inf:=proc(X::set,R::set(ordpair),Y::set)
greatest(lowerbounds(X,R,Y),R); end;
sup:=proc(X::set,R::set(ordpair),Y::set)
least(upperbounds(X,R,Y),R); end;
inf(X,R,{2,4}); sup(X,R,{2,4});
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.56. Feladat.->1.3.57. Feladat.->1.3.58. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.59. Feladat.->1.3.60. Feladat.->1.3.61. Feladat.1.3.62. Feladat.->1.3.63. Feladat.->1.3.64. Feladat: program fut\303\241si sebess\303\251g\303\251nek optimaliz\303\241l\303\241sa r\303\251szbenrendez\303\251s kiterjeszt\303\251seinek seg\303\255ts\303\251g\303\251vel.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.65. J\303\263lrendez\303\251s.iswellordering:=proc(X::set,R::set(ordpair)) local f,Y,P;
f:=isordering(X,R); if not f then return f fi;
P:=powerset(X);
for Y in P do
if Y<>{} then f:=least(Y,R); if f=NULL then return f; fi; fi;
od; true; end;
X; R; iswellordering(X,R);
R:=select(x->x[1]<=x[2],XX);iswellordering(X,R);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.3.66. P\303\251lda.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.67. Feladat.->1.3.68. Feladat.->1.3.69. Feladat.->1.3.70. Feladat.1.3.71. P\303\251ld\303\241k.orderingprod:=proc(X::set,R::set(ordpair),Y::set,S::set(ordpair))
local x,y,xp,yp,RS; RS:={};
for x in X do for y in Y do for xp in X do for yp in Y do
if [x,xp] in R and [y,yp] in S then RS:=RS union {[[x,y],[xp,yp]]}; fi;
od; od; od; od; RS; end;
X:={1,2}; R:={[1,1],[1,2],[2,2]}; isordering(X,R);
Y:={a,b}; S:={[a,a],[a,b],[b,b]}; isordering(Y,S);
XY:=bincartprod(X,Y); RS:=orderingprod(X,R,Y,S);
isordering(XY,RS);
strictorderingprod:=proc(X::set,R::set(ordpair),Y::set,S::set(ordpair)) local x,y,xp,yp,RS; RS:={};
for x in X do for y in Y do for xp in X do for yp in Y do
if [x,xp] in R and x<>xp and [y,yp] in S and y<>yp then
RS:=RS union {[[x,y],[xp,yp]]}; fi;
od; od; od; od; RS; end;
lexorderingprod:=proc(X::set,R::set(ordpair),Y::set,S::set(ordpair))
local x,y,xp,yp,RS; RS:={};
for x in X do for y in Y do for xp in X do for yp in Y do
if ([x,xp] in R and x<>xp) or (x=xp and [y,yp] in S) then
RS:=RS union {[[x,y],[xp,yp]]}; fi;
od; od; od; od; RS; end;
strictrel(XY,RS); strictorderingprod(X,R,Y,S);
strictrel(XY,lexorderingprod(X,R,Y,S));
sort([cc,ca,cb,bb,aa,ab,ba],lexorder);LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.3.72. Feladat.1.3.73. Feladat.->1.3.74. Feladat.1.3.75. Feladat.1.3.76. Feladat.1.2.77. Tov\303\241bbi feladatok r\303\251szletes megold\303\241ssal.1.2.78. Tov\303\241bbi feladatok.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4. F\303\274ggv\303\251nyek1.4.1. F\303\274ggv\303\251ny.isfunction:=proc(f::set(ordpair),X::set,Y::set) local x,y,S;
if not binrel(args) then return false fi;
for x in dmn(f) do S:={}; for y in rng(f) do
if [x,y] in f then S:=S union {y} fi;
od; if nops(S)>1 then return false fi;
od; true; end;
f:=id({a,b}); isfunction(f); isfunction(f,{a,b,1});
isfunction(f,{a,b},{1,2});f:={[a,1],[b,2],[a,2]}; isfunction(f);
isinjective:=proc(f::set(ordpair))
isfunction(f) and isfunction(relinv(f)); end;
isinjective({[a,1],[b,2]}); isinjective({[a,1],[b,1]});
issurjective:=proc(f::set(ordpair),Y::set)
isfunction(f) and rng(f)=Y; end;
issurjective({[a,1],[b,1]},{1,2});
issurjective({[a,1],[b,2]},{1,2});isbijective:=proc(f::set(ordpair),Y::set)
isinjective(f) and issurjective(f,Y); end;
isbijective(id({1,2,3}),{1,2,3});
isbijective({[a,1],[b,2]},{1,2,3});LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Ynf:=x->x^2; f(1);f(2);f(3); eval(f); type(f,procedure);
f:='f'; eval(f); whattype(f);
f(1):=1; eval(f);
f(2):=4; f(3):=8;
f(1);f(2);f(3);f(4);isarrowfromto:=proc(f::procedure,X::set,Y::set) local x;
for x in X do if not f(x) in Y then return false fi; od; true; end;
isarrowfromto(f,{1,2,3},{1,4,8,10});
isarrowfromto(f,{1,2},{1,8});makefunction:=proc(R::set(ordpair)) local x,y,f;
if not isfunction(R) then return NULL fi;
for x in dmn(R) do for y in rng(R) do if [x,y] in R then f(x):=y fi;
od; od; eval(f); end;
f:='f'; R:={[1,1],[2,4],[3,9]}; f(1);f(2);f(3);f(4);
f:=makefunction(R);f(1);f(2);f(3);f(4);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.4.2. Feladat.->1.4.3. Feladat.->1.4.4. Feladat.->1.4.5. Feladat.1.4.6. Feladat.->1.4.7. Feladat.1.4.8. Feladat.1.4.9. Feladat.1.4.10. Feladat.1.4.11. \303\201ll\303\255t\303\241s.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.12. Kanonikus lek\303\251pez\303\251s.makecanonical:=proc(X::set,R::set(ordpair)) local x,rx,y,f;
if not isequivalence(X,R) then return FAIL fi;
for x in X do rx:={}; for y in X do
if [x,y] in R then rx:=rx union {y} fi; od; f(x):=rx
od; eval(f) end;
f:=makecanonical({1,2,3},{[1,1],[1,2],[2,1],[2,2],[3,3]});
f(1);f(2);f(3);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.4.13. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.14. Feladat.1.4.15. Feladat.1.4.16. Feladat.*1.4.17. Feladat.1.4.18. Monoton f\303\274ggv\303\251nyek.Az al\303\241bbi k\303\251t f\303\274ggv\303\251nyben R rendez\303\251s X-en, S pedig rendez\303\251s Y-on.isincreasing:=proc(f::procedure,X::set,R::set(ordpair),Y::set,S::set(ordpair)) local x,y;
if not isarrowfromto(f,X,Y) then return FAIL fi;
if not ispartialordering(X,R) or not ispartialordering(Y,S) then return
FAIL fi;
for x in X do for y in X do
if [x,y] in R and not [f(x),f(y)] in S then return false fi;
od; od; true end;
X:={1,2,3}; XX:=bincartprod(X,X): R:=select(x->irem(x[2],x[1])=0,XX);
Y:=X; S:=select(x->x[1]<=x[2],XX); f:=x->x; isincreasing(f,X,R,Y,S);isincreasing(f,Y,S,X,R);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.4.19. Feladat.->1.4.20. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.21. Indexelt csal\303\241dok.issetfamily:=proc(Iset::set,f::procedure) local i;
for i in Iset do if not type(f(i),set) then return false fi;
od; true; end;
f:='f'; f(1):={a,b};f(2):={b,c,d}; issetfamily({1,2},f);
issetfamily({1,2,3},f);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.22. De Morgan-szab\303\241lyok.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.23. Megjegyz\303\251s.`union`();`intersect`();LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.24. T\303\251tel.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.25. Feladat.->1.4.26. Feladat.1.4.27. Feladat.1.4.28. Feladat.1.4.29. Rel\303\241ci\303\263 \303\251s Descartes-szorzat \303\241ltal\303\241nos esetben.s:=x,y; s[1]; s[2]; t:=y,x; evalb(s=t);
descartesprod:=proc(L::list(set)) local x,y,i,S,SS;
if nops(L)=0 then return {} fi; S:=map(x->[x],L[1]);
for i from 2 to nops(L) do SS:={}; for x in S do for y in L[i] do
SS:=SS union {[op(x),y]}
od; od; S:=SS od; S; end;
descartesprod([]);
descartesprod([{1,2}]);
descartesprod([{1,2},{a,b}]);
descartesprod([{1,2},{}]);
descartesprod([{1,2},{a},{x,y}]);
descartesprod([{1,2},{a,b,c},{x,y}]);
isselection:=proc(Iset::set,f::procedure,x::procedure) local i;
if not issetfamily(Iset,f) then return FAIL fi;
for i in Iset do if not x(i) in f(i) then return false fi; od; true end;
Iset:={a,b,c}; f:='f'; f(a):={1,2};f(b):={1,3};f(c):={2,3};
x(a):=1;x(b):=3;x(c):=3; isselection(Iset,f,x);
x(b):=2; isselection(Iset,f,x);agent:={[D209,"Peti"],[KISZ1,"Fleto"],[Puf3,"Gyula"]};
event:={[KISZ1,"Balaton",19930706],[Puf3,"Nyugati",19561108],[KISZ1,"Motim",19961231],[D209,"Paks",20000103],[KISZ1,"Fittelina",19980320],[D209,"Gresham",20010908],[KISZ1,"Nomentana",19951122]};
descartesprod([agent,event]):select(x->x[1][1]=x[2][1],%):map(x->[x[1][2],x[2][2],x[2][3],x[2][1]],%):active:=select(x->x[3]>19891023,%);
isselection:=proc(Iset::set,f::procedure,x::procedure) local i;
if not issetfamily(Iset,f) then return FAIL fi;
for i in Iset do if not x(i) in f(i) then return false fi; od; true end;
Iset:={a,b,c}; f:='f'; f(a):={1,2};f(b):={1,3};f(c):={2,3};
x(a):=1;x(b):=3;x(c):=3; isselection(Iset,f,x);
x(b):=2; isselection(Iset,f,x);LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.4.30. Feladat.->1.4.31. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.32. Feladat.->1.4.33. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.4.34. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.4.35. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.36. M\305\261veletek.isbinop:=proc(X::set,f::procedure) local x,y;
for x in X do for y in X do
if not f(x,y) in X then return false fi;
od; od; true end;
f:='f'; f(0,0):=0;f(0,1):=1;f(1,0):=1;f(1,1):=0; isbinop({0,1},f);
isbinop({0,1,2},f);&+(0,0):=0;&+(0,1):=1;&+(1,0):=1;&+(1,1):=0;
0&+1;1&+1;&+(0,1);
isbinop({0,1},(x,y)->x &+ y);
isunop:=proc(X::set,f::procedure) local x;
for x in X do if not f(x) in X then return false fi; od; true end;
f:='f'; f(0):=1;f(1):=0; isunop({0,1},f); isunop({0,1,2},f);
&inc(0):=1;&inc(1):=0; &inc 0; &inc 1; isunop({0,1},x->&inc x);9();9(x);9(x,y);isnullop:=proc(X::set,f::procedure) evalb(f() in X) end;
f:='f'; f():=1; eval(f); isnullop({0,1},f); isnullop({0,2},f);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.37. P\303\251lda.1.4.38. P\303\251ld\303\241k.X:={1,2,3}; P:=combinat[powerset](X); isbinop(P,(x,y)->x union y);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.39. P\303\251ld\303\241k: m\305\261velet megad\303\241sa t\303\241bl\303\241zattal.true and true; true and false; false and true; false and false;
T:=table();
T[true,true]:=true;T[true,false]:=false;
T[false,true]:=true;T[false,false]:=false;
print(T);LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.4.40. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn->1.4.41. Feladat.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.42. Feladat.1.4.43. M\305\261veletek f\303\274ggv\303\251nyekkel.f:=x->x^2; g:=x->x^3; (f*g)(2); (f*g)(3); (f/g)(2); (f/g)(0); (g/f)(0);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.44. P\303\251lda.LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.45. P\303\251ld\303\241k.f:=[true,true,false,false];
g:=[true,false,true,false];
zip((x,y)->x and y,f,g);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.46. M\305\261velettart\303\263 lek\303\251pez\303\251sek.ishom:=proc(phi::procedure,X::set,f::procedure,Y::set,g::procedure)
local x,y;
if not isarrowfromto(phi,X,Y) then return FAIL fi;
if not isbinop(X,f) then return FAIL fi;
if not isbinop(Y,g) then return FAIL fi;
for x in X do for y in X do
if phi(f(x,y))<>g(phi(x),phi(y)) then return false fi;
od; od; true end;
X:={true,false}; Y:=X; ishom(x->x,X,(x,y)->x and y,Y,(x,y)->x or y);
ishom(x-> not x,X,(x,y)->x and y,Y,(x,y)->x or y);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.47. P\303\251lda.a:='a'; a^(x+y); expand(%);LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn1.4.48. Feladat.1.4.49. Tov\303\241bbi feladatok.2. Term\303\251szetes sz\303\241mokLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn3. A sz\303\241mfogalom b\305\221v\303\255t\303\251seLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn4. V\303\251ges halmazokLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn5. V\303\251gtelen halmazokLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn6. Sz\303\241melm\303\251letLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn7. Gr\303\241felm\303\251letLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn8. AlgebraLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn9. K\303\263dol\303\241sLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn10. AlgoritmusokLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn