home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 June / Chip_2002-06_cd1.bin / zkuste / derive / download / Setup.exe / %MAINDIR% / Users / Logic_mu.mth < prev    next >
Encoding:
Text File  |  2002-05-15  |  2.3 KB  |  84 lines

  1. "*****************************************************************************"
  2.  
  3. "*           Constructing TRUTH TABLES and comparing propositions            *"
  4.  
  5. "*             in a max/min MULTI-VALUED (w-valued) modal LOGIC              *"
  6.  
  7. "* (c)Eugenio Roanes-Lozano (Dept. Algebra, Univ. Complutense Madrid) Jan 00 *"
  8.  
  9. "*****************************************************************************"
  10.  
  11. "-----------------------------------------------------------------------------"
  12.  
  13. "w-valued modal Logic (w should be a prime number), 0=false, 1=true.          "
  14.  
  15. "Connectives begin with an ``M'' (multivalued) not to interfere the built-in. "
  16.  
  17. "-----------------------------------------------------------------------------"
  18.  
  19. "The propositional variables: p,q,r,s,u,v"
  20.  
  21. p:=1/(w-1)*MOD(FLOOR(j_/w^0),w)
  22.  
  23. q:=1/(w-1)*MOD(FLOOR(j_/w^1),w)
  24.  
  25. r:=1/(w-1)*MOD(FLOOR(j_/w^2),w)
  26.  
  27. s:=1/(w-1)*MOD(FLOOR(j_/w^3),w)
  28.  
  29. u:=1/(w-1)*MOD(FLOOR(j_/w^4),w)
  30.  
  31. v:=1/(w-1)*MOD(FLOOR(j_/w^5),w)
  32.  
  33. "List of propositional variables (more could be added above):"
  34.  
  35. vp:=[p,q,r,s,u,v]
  36.  
  37. "Tautology and contradiction"
  38.  
  39. t:=1
  40.  
  41. c:=0
  42.  
  43. "Logic connectives: negation, possible, necessary, or, and (prefix form)"
  44.  
  45. MNEG(a_):=1-a_
  46.  
  47. MPOS(a_):=1-FLOOR(1-a_)
  48.  
  49. MNEC(a_):=FLOOR(a_)
  50.  
  51. MOR(a_,b_):=MAX(a_,b_)
  52.  
  53. MAND(a_,b_):=MIN(a_,b_)
  54.  
  55. "Truth tables: propositional variables that can be used in TT(m_,a_,b_):"
  56.  
  57. "the first m_ in P,Q,R,S,U,V plus tautology (T) and contradiction (C).  "
  58.  
  59. TT(m_,a_,b_):=VECTOR(APPEND(VECTOR(vp SUB i_,i_,1,m_),[a_,b_]),j_,0,w^m_-1)
  60.  
  61. "-----------------------------------------------------------------------------"
  62.  
  63. "Conditional and biconditional (Kleene-style)"
  64.  
  65. MIMP(a_,b_):=MOR(MNEG(a_),b_)
  66.  
  67. MIFF(a_,b_):=MAND(MIMP(a_,b_),MIMP(b_,a_))
  68.  
  69. "-----------------------------------------------------------------------------"
  70.  
  71. "Is it a tautology? (i.e.: Is it always true?). Answers: 1->yes, 0->no"
  72.  
  73. ISTAUT(m_,a_):=IF(PRODUCT(a_,j_,0,w^m_-1)=1,1,0)
  74.  
  75. "-----------------------------------------------------------------------------"
  76.  
  77. "Is ``b'' a tautological consequence of ``a''? (i.e.: Is the consequent true"
  78.  
  79. "whenever the antecedent is true?). Answers: 1->yes, 0->no"
  80.  
  81. ISCONSTAUT(m_,a_,b_):=IF(PRODUCT(IF(a_=1,b_,1),j_,0,w^m_-1)=1,1,0)
  82.  
  83. "---------------------------  END  OF .MTH  FILE  ---------------------------"
  84.