This is an example of how to select the last item in a returned set.
(more…)
This is an example of how to select the first item in a returned set.
This is an example of how to select all siblings that come immediately after a specified element.
This is an example of how to select the next sibling element that comes immediately after a specified element.
This is an example of how to select children of a parent element.
This is an example of how to select elements with multiple classes.
This is an example of how to select elements by using multiple selectors.
This is a basic example of how to select a div layer by its identifier and class name.
This is an example of how to select a div layer by its class name.
This is an example of how to select a div layer by its class name. I skipped over the tag and wildcard selector only because that would select every div (tag selector) or everything (wildcard or * selector) on the page and that might confuse some people.
This is an example of how to select a div layer by its identifier
This is a basic list of filters in jQuery (more…)
This is a basic list of selectors in jQuery (more…)
Running code on document ready with jQuery (more…)
Note concerning all math within the algebra category:
Proposition – A declarative sentence is a statement that is either true or false (boolean value) but not both.
1 + 1 = 2
2 + 2 = 3
Examples that would not result in a boolean value are:
x + 1 = 2
2 + x = 3
Even though 2 + x = 3 would result in x = 1, this is still not a boolean value unless x has a specified value.
Propositional variables – variables that represent propositions:
p
q
r
s
Truth values – letter representing a boolean value:
T
F
Propositional calculus – The logic that deals with propositions.
Compound propositions – Propositions formed from existing propositions using logical operators (connectives).
Operators – Creates a new proposition from the result of an existing proposition.
|
Operators |
|
| ¬ | NOT or Negation |
| ˄ | AND or Conjunction |
| ˅ | OR or Disjunction |
| ⊕ | XOR or Exclusive Or |
| → or ≡ | IF…THEN or Conditional |
| ↔ | If…THEN AND IF…THEN or Reconditional |
Let p be a proposition. The negation of p would be defined as “not p“.
p = “It is the case that p.”
¬p = “Not p” or “It is not the case that p.”
Example:
p = “I am at least 210 pounds.”
¬p = “I am less than 210 pounds.”
|
Negation of a Proposition Truth Table |
|
| P | ¬p |
| T | F |
| F | T |
|
Conjunction of a Proposition Truth Table |
||
| p | q | p˄q |
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | F |
Both values must result in true for p˄q to be true.
Example:
T – “I am 165 pounds and I have brown hair.”
F – “I am 165 pounds but I do not have brown hair.”
|
Disjunction of a Proposition Truth Table |
||
| p | q | p˅q |
| T | T | T |
| T | F | T |
| F | T | T |
| F | F | F |
At least one value must be true in order for p˅q to be true.
Example:
T – “I am 165 pounds and I have brown hair.”
T – “I am 165 pounds but I do not have brown hair.”
F – “I am not 165 pounds and I do not have brown hair.”
|
Exclusion Or of a Proposition Truth Table |
||
| p | q | p⊕q |
| T | T | F |
| T | F | T |
| F | T | T |
| F | F | F |
One value must be false while the other is true in order for p⊕q to be true.
|
Conditional of a Proposition Truth Table |
||
| p | q | p→q |
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |
A conditional statement that follows “if…then” scenarios. The p is called the predicate while the q is called the conclusion. The only instance in the truth table where p→q would be false is if the conclusion is false and the predicate is true.
|
Conditional of a Proposition Truth Table |
||
| p “(if) I wear shorts” | q “(then) I have legs” | p→q |
| T | T | T – “I have legs and I wear shorts.” |
| T | F | F – “I do not have legs so therefore I do not wear shorts.” |
| F | T | T – “I have legs but it is not necessary for me to wear shorts.” |
| F | F | T – “I do not wear shorts and I do not have legs.” |
Conditional statements are expressed in one of the following ways:
“if p, then q”
“if p, q”
“p is sufficient for q”
“q if p”
“q when p”
“a necessary condition for p is q”
“q unless ¬p”
“p implies q”
“p only if q”
“a sufficient condition for q is p”
“q whenever p”
“q is necessary for p”
“q follows from p”
|
Conditional of a Proposition Truth Table |
||
| p | q | p↔q |
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | T |
The reconditional statement is only true if the statement is true as a conditional (q→p) and as a conditional reversed (q→p).
|
Conditional of a Proposition Truth Table |
||
| p “(if) I wear shorts” | q “(then) I have legs” | p↔q |
| T | T | T – “I have legs and I wear shorts.” |
| T | F | F – “I do not have legs so therefore I do not wear shorts but if I do not have legs, I cannot wear shorts.” |
| F | T | F – “I have legs but it is not necessary for me to wear shorts but if I have legs, I can still wear shorts.” |
| F | F | T – “I do not wear shorts and I do not have legs.” |
|
Compound Proposition Truth Table (p˅¬q) →(p˄q) |
|||||
| p | q | ¬q | (p ˅¬q) | (p˄q) | (p˅¬q) →(p˄q) |
| T | T | F | T | T | T |
| T | F | T | T | F | F |
| F | T | F | F | F | T |
| F | F | T | T | F | F |
Using the logic truth tables for all operators while separating compound propositions by priority, it is possible to work to the right and result in a conclusion using the base truth tables.
| Operator | Precedence |
| ¬ | 1 |
| ˄ | 2 |
| ˅ | 3 |
| → | 4 |
| ↔ | 5 |
Example of English translation into logical expression and truth table:
“You can access the internet from campus (p) only if (→) you are a computer science major (q) or you are not (¬) a freshmen (r).”
A rule to obey is to NOT use variables other than p, q, r, or s. This can confuse the operations but can be translated later. For example:
p = c (campus)
q = cs (computer science major)
r = f (freshmen)
p→(q ˅¬r)
|
Truth Table for p, q, and r |
||
| p | q | r |
| T | T | T |
| T | T | F |
| T | F | T |
| T | F | F |
| F | T | T |
| F | T | F |
| F | F | T |
| F | F | F |
|
Truth Table for p→(q ˅¬r) |
|||||
| p | q | r | ¬r | (q ˅¬r) | p→(q ˅¬r) |
| T | T | T | F | T | T |
| T | T | F | T | T | T |
| T | F | T | F | F | F |
| T | F | F | T | T | T |
| F | T | T | F | T | T |
| F | T | F | T | T | T |
| F | F | T | F | F | T |
| F | F | F | T | T | T |
|
p→q |
|
| q→p | Converse |
| ¬q→¬p | Contrapositive |
| ¬p→¬q | Inverse |
Tautology – Compound proposition that is always true.
Contradiction – Compound proposition that is always false.
Contingency – Compound proposition that is neither a tautology nor a contradiction.
|
Tautology and Contradiction |
|||
| p | ¬p | p ˅ ¬p | p ˄¬p |
| T | F | T | F |
| F | T | T | F |
|
De Morgan’s Laws |
| ¬(p ˄q) ≡¬p ˅¬q |
| ¬(p ˅q) ≡¬p˄¬q |
|
De Morgan’s Laws Logical Equivalency Truth Table |
||||||
| p | q | p˅q | ¬( p˅q) | ¬p | ¬q | ¬p ˅¬q |
| T | T | T | F | |||
| T | F | T | F | |||
| F | T | T | F | |||
| F | F | F | T | |||
|
Operators |
|
| ¬ | NOT or Negation |
| ˄ | AND or Conjunction |
| ˅ | OR or Disjunction |
| ⊕ | XOR or Exclusive Or |
| → | IF…THEN or Conditional |
| ↔ or ≡ | If…THEN AND IF…THEN or Reconditional |