Advertisement
rsvaco

tal pract 2 ej 1 2

Oct 27th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. Ejercicio1[automata_] := Module[{transiciones, aux, i, j, est, alf},
  2. If[Length[Cases[automata[[3]], {_, {}, _}]] > 0, Return[False];];
  3. For[i = 1, i <= Length[automata[[1]]], i++,
  4. est = automata[[1]][[i]];
  5. For[j = 1, j <= Length[automata[[2]]], j++,
  6. alf = automata[[2]][[j]];
  7. transiciones = Cases[automata[[3]], {est, alf, _}];
  8. If[Length[transiciones] > 1, Return[False]];
  9. ];
  10. ];
  11. Return[True];
  12. ]
  13.  
  14.  
  15.  
  16. Ejercicio2[afd_] := Module[{i, simbolos},
  17. simbolos = Length[afd[[2]]];
  18. For[i = 1, i <= simbolos + 1, i++,
  19. Print[Cases[afd[[3]], {afd[[1]][[i]], _, _}]];
  20. If[Length[Cases[afd[[3]], {afd[[1]][[i]], _, _}]] < simbolos,
  21. Return[False];
  22. ];
  23. ];
  24. Return[True];
  25. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement