Skip to content

Instantly share code, notes, and snippets.

@b-coimbra
Created August 22, 2017 01:16
Show Gist options
  • Save b-coimbra/7be92f7cd4895c45290ad152800fde36 to your computer and use it in GitHub Desktop.
Save b-coimbra/7be92f7cd4895c45290ad152800fde36 to your computer and use it in GitHub Desktop.
elementary propositional logic in APL
⍝ ex. 1
~((1 ∧ 0) ∨ (0 ↔ 1)) → ~(1 ∨ 0)
⍝ ~(0 ∨ 0) → ~(1 ∨ 0)
⍝ 1 → ~1
⍝ 1 → 0
⍝ 0
⍝ ex. 2
⍝ considering:
⍝ v(p) = 0
⍝ v(q) = 1
⍝ v(r) = 1
⍝ ex. 3
(p → ~q) ∨ ~(r ∧ q)
⍝ (0 → ~1) ∨ ~(1 ∧ 1)
⍝ (0 → 0) ∨ ~1
⍝ 1 ∨ 0
⍝ 1
⍝ ex. 4
(~ (p ↔ q) ∧ r) ∧ (p ∧ q ∧ ~ r)
⍝ (~ (0 ↔ 1) ∧ 1) ∧ (0 ∧ 1 ∧ ~ 1)
⍝ (~ 0 ∧ 1) ∧ (1 ∧ ~ 0)
⍝ ~ 1 ∧ (1 ∧ 1)
⍝ 0 ∧ 1
⍝ 0
⍝ ex. 5
((p ↔ q) ^ r) ∨ (p ^ q ^ ~ r)
⍝ ((0 ↔ 1) ^ 1) ∨ (0 ^ 1 ^ ~ 1)
⍝ (0 ^ 1) ∨ (0 ^ ~ 1)
⍝ 0 ∨ (0 ^ 0)
⍝ 0 ∨ 0
⍝ 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment