Add more examples to playground
Add two new exercises to the Rules of Inference Playground, making a total of three accessible examples.
This commit is contained in:
parent
13062b5fa3
commit
970f503da5
1 changed files with 112 additions and 0 deletions
|
|
@ -71,6 +71,73 @@ const EXAMPLES: ExampleDef[] = [
|
|||
"¬p ∨ s",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "ex-modus-ponens-1",
|
||||
title: "A → B ∧ (C ∨ D), A, ¬C ⊢ D",
|
||||
premises: ["A → B ∧ (C ∨ D)", "A", "¬C"],
|
||||
conclusion: "D",
|
||||
rules: [
|
||||
{
|
||||
id: "modus-ponens",
|
||||
label: "Modus Ponens: A, A → B ⊢ B",
|
||||
help: "From A and A → B you may derive B.",
|
||||
},
|
||||
{
|
||||
id: "simplification",
|
||||
label: "Simplification: A ∧ B ⊢ A, A ∧ B ⊢ B",
|
||||
help: "From A ∧ B you may derive A or B.",
|
||||
},
|
||||
{
|
||||
id: "disjunctive-syllogism",
|
||||
label: "Disjunctive Syllogism: A ∨ B, ¬A ⊢ B",
|
||||
help: "From A ∨ B and ¬A you may derive B.",
|
||||
},
|
||||
],
|
||||
pool: [
|
||||
"B ∧ (C ∨ D)",
|
||||
"C ∨ D",
|
||||
"D", // target
|
||||
// distractors
|
||||
"A",
|
||||
"B",
|
||||
"C",
|
||||
"¬C",
|
||||
"A ∧ B",
|
||||
"B ∨ D",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "ex-hypothetical-syllogism",
|
||||
title: "p → q, ¬p → r, r → s ⊢ ¬q → s",
|
||||
premises: ["p → q", "¬p → r", "r → s"],
|
||||
conclusion: "¬q → s",
|
||||
rules: [
|
||||
{
|
||||
id: "contrapositive",
|
||||
label: "Contrapositive: A → B ≡ ¬B → ¬A",
|
||||
help: "From A → B you may derive ¬B → ¬A.",
|
||||
},
|
||||
{
|
||||
id: "hypothetical-syllogism",
|
||||
label: "Hypothetical Syllogism: A → B, B → C ⊢ A → C",
|
||||
help: "From A → B and B → C you may derive A → C.",
|
||||
},
|
||||
],
|
||||
pool: [
|
||||
"¬q → ¬p",
|
||||
"¬q → r",
|
||||
"¬q → s", // target
|
||||
// distractors
|
||||
"p",
|
||||
"q",
|
||||
"r",
|
||||
"s",
|
||||
"¬p",
|
||||
"¬q",
|
||||
"p → r",
|
||||
"q → s",
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
// Small helper to attach drag payload
|
||||
|
|
@ -192,6 +259,51 @@ export default function RulesOfInferencePlayground({ onComplete }: { onComplete?
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else if (example.id === "ex-modus-ponens-1") {
|
||||
switch (rule) {
|
||||
case "modus-ponens": {
|
||||
// From A and A → B ∧ (C ∨ D) derive B ∧ (C ∨ D)
|
||||
if (selected.includes("A") && selected.includes("A → B ∧ (C ∨ D)") && selected.length === 2) {
|
||||
return ["B ∧ (C ∨ D)"];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "simplification": {
|
||||
// From B ∧ (C ∨ D) derive B or (C ∨ D)
|
||||
if (selected.includes("B ∧ (C ∨ D)") && selected.length === 1) {
|
||||
return ["C ∨ D"];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "disjunctive-syllogism": {
|
||||
// From C ∨ D and ¬C derive D
|
||||
if (selected.includes("C ∨ D") && selected.includes("¬C") && selected.length === 2) {
|
||||
return ["D"];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (example.id === "ex-hypothetical-syllogism") {
|
||||
switch (rule) {
|
||||
case "contrapositive": {
|
||||
// From p → q derive ¬q → ¬p
|
||||
if (selected.includes("p → q") && selected.length === 1) {
|
||||
return ["¬q → ¬p"];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "hypothetical-syllogism": {
|
||||
// From ¬q → ¬p and ¬p → r derive ¬q → r
|
||||
if (selected.includes("¬q → ¬p") && selected.includes("¬p → r") && selected.length === 2) {
|
||||
return ["¬q → r"];
|
||||
}
|
||||
// From ¬q → r and r → s derive ¬q → s
|
||||
if (selected.includes("¬q → r") && selected.includes("r → s") && selected.length === 2) {
|
||||
return ["¬q → s"];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue