Commonsense rules development
A place to develop and maintain commonsense rules for quasimodo etc.
Sisukord
Static knowledge encoding
Description of current Quasimodo/ConceptNet encoding coming soon
Event encoding
We use Neo-Davidsonian encoding with semantic roles:
- actor (subject)
- patient (object)
- ...
Event type is the verb that describes the event.
Example: "Brutus stabbed Caesar in the agora"
event_subject(brutus, ev1). event_object(caesar, ev1). event_type(stab, ev1). event_location(agora, ev1).
Connecting Static Knowledge to Events
This is mostly unsolved. This minimal example may help get things started:
"Did grape juice turn into wine?"
event_subject(grape_juice, ev1). event_type(turn_into, ev1).
There are multiple ways of encoding that this is a question, for example:
event_object(wine, ev1) => $ans(yes).
Assuming we have commonsense knowledge about fermenting grape juice:
be(grape_juice, X) => ovs(wine, turn_into, X). % reflexivity be(X, X).
Proposal SVO triples can be connected to events like this:
ovs(Z, Y, X) & event_type(Y, W) & event_subject(X, W) => event_object(Z, W).
This example does not fully make sense yet, since the event itself lacks context. Work in progress.
High level steps for constructing a logical form
Construction of logical form consists of the following steps:
- Finding predicates and specify their arguments (number, type)
- Concepts and events - predicate/1
- Roles - predicate/2
- Constructing corresponding atoms
- Dividing atoms on same level into groups
- Specifying connectives between atoms of each group and construct corresponding formulas.
- Dividing formulas and/or any of the remaining atoms of the same level into groups. If there are no groups go to step 7
- Specifyng connectives between elements of each group
- Specifying quantifers for the variables.
- Constructing the final FOL formula.
Identifying the predicates
(From Jurafsky: 15.4 "Event and State Representation")
- Events are captured with predicates that take single event variable as an argument. Events are denoted by verbs.
- There is no need to specifiy a fixed number of arguments for a given FOL predicate: as many roles and fillers can be glued on
- No more roles are postulated than are mentioned in input.
- The logical connections between closely related inputs that share same predicate are satisfied without the need for additional inference.
- Syntactic arguments form the arguments of semantic predicates.
Encoding of reasons why something does not have normal capabilities
[
// classes have themselves as classes
["be", "?:P", "?:P"],
// taxonomy
[["be", "bird", "?:X1"], "=>" ,["be", "organism", "?:X1"]],
[["be", "organism", "?:X1"], "=>" ,["be", "object", "?:X1"]],
// default parts (hasa) and capabilities of birds, airplanes, helicopters and generic objects
[["be", "bird", "?:X1"], "=>", [["hasa", "wing", "?:X1"],"|",["$block", 10000, ["$not", ["hasa", "wing", "?:X1"]]]]],
[["be", "bird", "?:X1"], "=>", [["capability", "fly", "?:X1"],"|",["$block", 1000, ["$not",["capability", "fly", "?:X1"]]]]],
[["be", "airplane", "?:X1"], "=>", [["hasa", "wing", "?:X1"],"|",["$block", 10000, ["$not", ["hasa", "wing", "?:X1"]]]]],
[["be", "airplane", "?:X1"], "=>", [["capability", "fly", "?:X1"],"|",["$block", 1000, ["$not",["capability", "fly", "?:X1"]]]]],
[["be", "helicopter", "?:X1"], "=>", [["hasa", "rotor", "?:X1"],"|",["$block", 10000, ["$not", ["hasa", "rotor", "?:X1"]]]]],
[["be", "helicopter", "?:X1"], "=>", [["capability", "fly", "?:X1"],"|",["$block", 1000, ["$not",["capability", "fly", "?:X1"]]]]],
[["be", "object", "?:X1"], "=>", [["-hasa", "wing", "?:X1"],"|",["$block", 10, ["hasa", "wing", "?:X1"]]]],
[["be", "object", "?:X1"], "=>", [["-hasa", "rotor", "?:X1"],"|",["$block", 10, ["hasa", "rotor", "?:X1"]]]],
[["be", "object", "?:X1"], "=>", [["-capability", "fly", "?:X1"],"|",["$block", 1, ["capability", "fly", "?:X1"]]]],
// concepts have unconditionally some parts
//[[["be", "helicopter", "?:X1"], "&", ["concept", "?:X1"]], "=>", ["hasa", "rotor", "?:X1"]],
//{"@role": "axiom", "@logic": [["-be", "bird", "?:O"], ["-hasa", "wing", "bird"], ["hasa","wing","?:O"], ["-capability","fly","?:O"]] },
//{"@role": "axiom", "@logic": [["-be", "?:P", "?:O"], ["-hasa", "wing", "?:P"], ["hasa","wing","?:O"], ["-capability","fly","?:O"]] },
/*
{"@role": "axiom", "@logic": [["-be", "?:P", "?:O"], ["-capability","fly","?:P"], ["-hasa", "wing", "?:P"], ["hasa","wing","?:O"], ["-capability","fly","?:O"], ["$block", 20000, ["capability", "fly", "?:O"]]] },
{"@role": "axiom", "@logic": [["-be", "?:P", "?:O"], ["-capability","fly","?:P"], ["-hasa", "rotor", "?:P"], ["hasa","rotor","?:O"], ["-capability","fly","?:O"], ["$block", 20000, ["capability", "fly", "?:O"]]] },
{"@role": "axiom", "@logic": [["-be", "?:P", "?:O"], ["-capability","fly","?:P"], ["-hasa", "balloon", "?:P"], ["hasa","balloon","?:O"], ["-capability","fly","?:O"], ["$block", 20000, ["capability", "fly", "?:O"]]] },
*/
// if a class has some capability and a specific part which is used for this capability, then an instance of a class
// without this part does not have that capability
{"@role": "axiom",
"@confidence": 90,
"@logic": [["-be", "?:P", "?:O"], ["-hasa", "?:PART", "?:P"], ["-usedfor", "?:C", "?:PART"], //["-concept","?:P"], ["concept","?:O"], // ["-capability","?:C","?:P"],
["hasa","?:PART","?:O"],
["-capability","?:C","?:O"],
["$block", 20000, ["capability", "?:C", "?:O"]]] },
// similar to the previous rule, but an instance of a part is present and is nonfunctional
{"@role": "axiom",
"@confidence": 80,
"@logic": [["-be", "?:P", "?:O"], ["-hasa", "?:PART", "?:P"], ["-usedfor", "?:C", "?:PART"], ["concept","?:PI"], // ["-concept","?:P"], ["concept","?:O"], // ["-capability","?:C","?:P"],
["-hasa", "?:PI", "?:O"], ["-be","?:PART","?:PI"], ["-property","nonfunctional","?:PI"],
["-capability","?:C","?:O"],
["$block", 20000, ["capability", "?:C", "?:O"]]] },
// similar to the previous rule, but all instances of this type of the object are nonfunctional
/*
The forall part is to be negated, hence also skolemized:
.... [forall sk. [((haspart sk O) & (be PART sk)) => (property nonfunctional sk)]] .... => (cannotfly O)
*/
{"@role": "axiom",
"@confidence": 90,
"@logic": [["-be", "?:P", "?:O"], ["-hasa", "?:PART", "?:P"], ["-usedfor", "?:C", "?:PART"], //["-concept","?:P"], ["concept","?:O"], // ["-capability","?:C","?:P"],
//["hasa", ["sk1", "?:P", "?:O", "?:C", "?:PART"], "?:O"], ["be","?:PART",["sk1", "?:P", "?:O", "?:C", "?:PART"]],
["hasa", ["sk1", "?:P", "?:O", "?:C", "?:PART"], "?:O"], //["be","?:PART", "sk1"],
["-capability","?:C","?:O"],
["$block", 20000, ["capability", "?:C", "?:O"]]] },
{"@role": "axiom",
"@confidence": 90,
"@logic": [["-be", "?:P", "?:O"], ["-hasa", "?:PART", "?:P"], ["-usedfor", "?:C", "?:PART"], //["-concept","?:P"], ["concept","?:O"], // ["-capability","?:C","?:P"],
//["hasa", ["sk1", "?:P", "?:O", "?:C", "?:PART"], "?:O"], ["be","?:PART",["sk1", "?:P", "?:O", "?:C", "?:PART"]],
["be","?:PART", ["sk1", "?:P", "?:O", "?:C", "?:PART"]],
["-capability","?:C","?:O"],
["$block", 20000, ["capability", "?:C", "?:O"]]] },
{"@role": "axiom",
"@confidence": 90,
"@logic": [["-be", "?:P", "?:O"], ["-hasa", "?:PART", "?:P"], ["-usedfor", "?:C", "?:PART"], //["-concept","?:P"], ["concept","?:O"], // ["-capability","?:C","?:P"],
//["-property","nonfunctional",["sk1", "?:P", "?:O", "?:C", "?:PART"]],
["-property","nonfunctional",["sk1", "?:P", "?:O", "?:C", "?:PART"]],
["-capability","?:C","?:O"],
["$block", 20000, ["capability", "?:C", "?:O"]]] },
// several things used for flying
["usedfor", "fly", "wing"],
["usedfor", "fly", "rotor"],
["usedfor", "fly", "balloon"],
// concept stuff
/*
["concept","bird"],
["concept","airplane"],
["concept","helicopter"],
["concept","organism"],
["concept","object"],
//[["-concept","?:X"],["$block",0,["concept","?:X"]]],
["-concept", "birdx1"],
["-concept", "birdx2"],
["-concept", "planex1"],
["-concept", "planex2"],
["-concept", "helix1"],
["-concept", "helix2"],
*/
// concrete
// birds birdx1 and birdx2
// airplanes planex1, planex2 and planex3
// helicopters helix1 and helix2
{"@role": "assumption", "@logic": ["be","bird","birdx1"]},
{"@role": "assumption", "@logic": ["be","bird","birdx2"]},
{"@role": "assumption", "@logic": ["be","airplane","planex1"]},
{"@role": "assumption", "@logic": ["be","airplane","planex2"]},
{"@role": "assumption", "@logic": ["be","airplane","planex3"]},
{"@role": "assumption", "@logic": ["be","helicopter","helix1"]},
{"@role": "assumption", "@logic": ["be","helicopter","helix2"]},
// birdx2 is an exemplar of a class of nonwingedbird
{"@role": "assumption", "@logic": ["be","nonwingedbird","birdx2"]},
[["be", "nonwingedbird", "?:X1"], "=>" ,["be", "bird", "?:X1"]],
[["be", "nonwingedbird", "?:X1"], "=>" ,["-hasa", "wing", "?:X1"]],
// defective things are nonfunctional
[["property","defective","?:X"], "=>" , ["property","nonfunctional","?:X"]],
// planex2 has a defective wing
["hasa", "wingx2", "planex2"],
["be", "wing", "wingx2"],
["-concept", "wingx2"],
["property","defective","wingx2"],
// all wings of planex3 are defective
[["-hasa", "?:P", "planex3"], ["-be", "wing", "?:P"], ["property","defective","?:P"]],
// helix2 does not have a rotor
["-hasa", "rotor", "helix2"],
// question
{"@question": ["capability","fly","?:X"]}
//{"@question": [["capability","fly","?:X"],"&",["-concept","?:X"]]}
]