CN103020714B - Solution method for cognitive description program based on generation-verification - Google Patents

Solution method for cognitive description program based on generation-verification Download PDF

Info

Publication number
CN103020714B
CN103020714B CN201210529095.7A CN201210529095A CN103020714B CN 103020714 B CN103020714 B CN 103020714B CN 201210529095 A CN201210529095 A CN 201210529095A CN 103020714 B CN103020714 B CN 103020714B
Authority
CN
China
Prior art keywords
word
program
rule
subjective
predicate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210529095.7A
Other languages
Chinese (zh)
Other versions
CN103020714A (en
Inventor
崔荣存
张志政
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Southeast University
Original Assignee
Southeast University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Southeast University filed Critical Southeast University
Priority to CN201210529095.7A priority Critical patent/CN103020714B/en
Publication of CN103020714A publication Critical patent/CN103020714A/en
Application granted granted Critical
Publication of CN103020714B publication Critical patent/CN103020714B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a solution method for a cognitive description program based on generation-verification. When one cognitive description program is input: firstly, a predicate dependency graph of the cognitive description program is firstly constructed based on morphology and grammar correctness analysis and safety check, block-shaped topological sorting of program blocks is generated, then a forward reasoning technology is used to sequentially generate instantiation program blocks according to the topological sorting, and finally the instantiation cognitive description program is generated; secondly, a constant-true constant-false character set of the instantiation cognitive description program is obtained and used for deleting redundancy rules and redundancy characters so as to simplify the program; then, dependency relationship of subjective characters is confirmed according to the predicate dependency graph, and possible solution of the program is generated in a heuristic mode according to the dependency relationship of subjective characters; and after that, subjective character values are verified to be correct or not, and whether the possible solution is of the cognitive description program or not is confirmed. The whole solution method adopts a backtracking process to generate all of possible solutions and verify obtained all of solutions.

Description

A kind of cognition based on generating-verifying describes the method for solving of program
Technical field
The present invention relates to the method for solving that a kind of cognition based on generating-verifying describes program, the method, based on nonmonotonic logic inference theory, adopts program predicate dependency graph and heuristic search technique, comprises instantiation, program simplification, generation may be separated, determined last solution four steps by test.Belong to logic programming, knowledge representation and reasoning field.
Background technology
Rebound strength curve program (answer set program) has stronger non-monotonic reasoning ability, and access expansion language, therefore becomes the instrument of a kind of important knowledge representation and reasonings in field such as planning, diagnosis, information management, Knowledge based engineering question and answer, constraint solving.Along with the appearance of the efficient rebound strength curve PROGRAM REASONING IN TEMPORAL LOGIC machine such as Smodels, DLV, Clasp, the application prospect of rebound strength curve program is more and more extensive.But it is found that rebound strength curve program existing defects in the expression and reasoning of Incomplete information, therefore Michael Gelfond proposed a kind of rebound strength curve program of expansion in 1991---cognitive description program (Epistemic Specifications).Cognitive description program is expanded as the one of rebound strength curve program, is made up of some rules, and wherein the form of rule is as follows:
L 1or...or l k← g k+1..., g m, not l m+1..., not l nby adding cognitive operational symbol K, can when conviction collection be not unique, the cognitive Inference knowledge represented compactly based on imperfect information directly perceived, and in this case, adopt traditional rebound strength curve program cannot Correct and reasoning, M.Gelfond have expressed the motivation proposing cognitive description program intuitively by lower example.
Example: certain school uses four rules below to go to determine the whether qualified acquisition scholarship of student.A) student that credit is high can obtain scholarship, b) credit medium but be that the student of ethnic group can obtain the low student of scholarship, c) credit and cannot obtain scholarship, d) cannot determine the classmate of whether qualified acquisition scholarship according to three rules above, institute needs to carry out interview to determine its whether qualified acquisition scholarship.If given such Incomplete information " credit of Mike may for height also may be in ".Obviously, according to above-mentioned four rules, Mike needs to go interview, because can not determine the certain qualified acquisition scholarship of Mike and necessarily do not have qualification to obtain scholarship.And this problem uses rebound strength curve program construction inquiry system to inquire about Mike whether will to go interview, can not draw correct conclusion, but use cognitive description program but can obtain correct conclusion.
M.Truszczynski is perfect further cognitive description program in 2010, and he proposes a kind of new model of cognitive description program, and demonstrates grammer that this new form and M.Gelfond defined in 1991 and semanteme coincide.By new form, M.Truszczynski analyzes the complexity of this language realization and uses the method for digraph to go to build cognitive description PROGRAM REASONING IN TEMPORAL LOGIC machine.But in some separate procedure, there is the defect obtaining incorrect solution in the semanteme of this language.M.Gelfond have modified the semanteme of cognitive description program in 2011, perfect further cognitive description program.Semanteme is defined as follows:
Assuming that S is the set of the set of objective word in cognitive description program, the K divided out in cognitive description program according to S and-K, make cognitive description program become common logical program, if the solution of General Logic program and S-phase etc., then S is the solution of this cognitive description program.
Due to the amendment of semanteme, thus meet natural language better, and ensure that cognitive description program correctness.So far the semanteme being familiar with description program is more perfect, and for being applied to multi-Agent further, software test, theoretical foundation has been laid in the fields such as knowledge-based question answering system.
In addition, in view of widespread use and the demand of epistemic logic, the cognition as epistemic logic language subset describes program and is considered to be effectively applied to based on multi-Agent inference system, question answering system, the field such as software test and decision system.But up to now, also do not occur the inference machine of this program, the cognitive design and implimentation describing PROGRAM REASONING IN TEMPORAL LOGIC machine can make this language obtain practical application, the cognitive program solution that describes is the problem of complexity, but this method for solving efficiency is lower and complicated.
Summary of the invention
Goal of the invention: for problems of the prior art with not enough, the invention provides the method for solving that a kind of cognition verified based on generation one describes program, and design method for solving also proposes and adopts efficient optimization method to be the key of this invention.The present invention adopts program predicate dependency graph and heuristic generation one verification technique to realize solving of cognitive description program, comprises instantiation, program simplification, generation may be separated, determined last solution four steps by test.The iterations in instantiation process is reduced by program dependency graph, utilization solves logically true logically false word collection and simplifies loading routine, search volume is decreased by heuristic search, improve the efficiency of inference machine, this language can be applied to during practical problems solves, this is particularly important in large-scale problem solving.
Technical scheme: a kind of cognition verified based on generation one describes the method for solving of program, and its step comprises:
Step 1: correct to morphology and grammer, the cognition of rule safety describes program construction predicate dependency graph, and step comprises:
11) generate the morphology of inference machine and syntax Analysis Module by Lex and Yacc, check that whether loading routine is that the correct cognition of grammer describes program;
12) security inspection of rule
For a rule, all appear in positive subjective word or objective word if there is the variable at regular head, then this rule is safe, otherwise it is unsafe;
13) predicate dependency graph is built
If i) predicate p is the predicate of a certain regular head word in program, and another predicate q to be present in the rule body of this rule in objective word or positive subjective word, so just sets up the strong dependence edge of p to q;
Ii) if predicate predicate p is the predicate of a certain regular head word in program, and another predicate q to be present in the rule body of this rule in weak privative or negative subjective word, so just sets up the weak dependence edge of p to q;
Step 2: the predicate predicate dependency graph utilizing step l to generate, carry out instantiation to program, step comprises:
21) deblocking:
According to the predicate predicate dependency graph that step 1 generates, find out all strong continune subgraphs in figure successively, a piecemeal of each strong continune subgraph determination program;
22) topological sorting:
The topological sorting between program block is determined according to following rule;
If i) there is a strong dependence edge to strong continune subgraph B in strong continune subgraph A, then the block that the block that strong continune subgraph A determines is determined prior to strong continune subgraph B;
Ii) if strong continune subgraph A and strong continune subgraph B does not exist any strong dependence edge, and there is a weak dependence edge to strong continune subgraph B in strong continune subgraph A, then the block that the block that strong continune subgraph A determines is determined prior to strong continune subgraph B;
23) substep instantiation:
Based on forward reasoning technology, successively instantiation is carried out to each program block;
Step 3: simplify procedures, when ensureing to separate constant, delete redundancy rule and redundancy word step in all the other regular rule bodies of cancellation comprises:
31) logically true logically false word collection is asked
The cognition asking for instantiation describes all logically true logically false word collection of program.This is the process of an iteration, till logically true and logically false word collection no longer increases;
32) redundancy rule and word is deleted
According to logically true logically false word collection, delete redundancy rule and redundancy word in all the other regular rule bodies of cancellation, thus simplify and cognitively describe journey, simplify complexity of reasoning;
Step 4: the value guessing subjective word, generator program may be separated:
41) dependence between subjective word is determined
According to the predicate dependency graph that step 1 generates, determine the dependence between all subjective words.If the predicate namely from the predicate of subjective word A to subjective word B, there is a path be made up of strong dependence edge, then subjective word B depends on subjective word A;
42) generate and may separate
Adopt heuristic, according to the dependence between subjective word, guess the value of all subjective words.Thus to transform cognitive description program be rebound strength curve logical program, and generate may separating of a cognitive description program of whole rebound strength curve compositions of rebound strength curve logical program.
Step 5: with the conjecture value checking subjective word may be separated, if this solution may meet the conjecture value of all subjective words, then this may be separated is exactly a solution of cognitive description program;
Adopt the value of all subjective words of trace-back process conjecture, the solution that generator program is all.
In described step 1, to the logical program rule containing subjective word, the security of decision rule in the positive subjective word of rule body and objective word whether is appeared at according to the variable in regular head, decision condition is: for a rule, all appear in positive subjective word or objective word if there is the variable at regular head, then this rule is safe, otherwise it is unsafe.Cognitive description program is the strictly all rules in safe and if only if program is all safe.
Utilize logically true logically false word collection to simplify cognitive description program, rule of simplification is as follows: for a rule r,
I) concentrate when the positive subjective word Ka in rule body is present in logically true word, then from this regular rule body, delete Ka;
Ii) concentrate when the objective word l in rule body is present in logically true word, then from this regular rule body, delete l;
Iii) concentrate when the negative subjective word-Ka in rule body is present in logically false word, then from this regular rule body, delete-Ka;
Iv) concentrate when the weak privative not l in rule body is present in logically false word, then from this regular rule body, delete not l;
V) concentrate when the positive subjective word Ka in rule body is present in logically false word, remove this rule;
Vi) concentrate when the objective word l in rule body is present in logically false word, remove this rule;
Vii) concentrate when the negative subjective word-Ka in rule body is present in logically true word, remove this rule;
Viii) concentrate when the weak privative not l in rule body is present in logically true word, remove this rule.
In described step 4, using the dependence between subjective word as heuristic information, search for subjective word valued space, it is a rebound strength curve program that the possible value of the subjective word searched with each describes Program transformation cognition, asks for all rebound strength curve of this rebound strength curve program and forms of cognitive description program and may separate.Heuristic information is adopted to guess that the strategy of subjective word value is specific as follows:
I) according to the precedence of subjective word dependence,
Ii) value of subjective word that the value of follow-up subjective word is relied on by it determines, if namely subjective word A depends on subjective word B, when subjective word B value is true, then the value of subjective word A is also true.When subjective word B value is false, then subjective word A value is also false.
Iii) to the subjective word not relying on any other subjective word, a true value is given.
Beneficial effect: the present invention mainly contains following advantage:
(1) by defining the safety rule of cognitive description program, make the semanteme of cognitive description program more perfect, user is used during cognitive description program and can use variable, and be all meaningful containing the rule of variable and fuzzy rules after instantiation limited;
(2) by defining the program predicate dependency graph of cognitive description program, making to describe program to cognition can topological sorting between piecemeal and block.Again adopt the forward reasoning technology each program block of instantiation successively, thus decrease the iterations of instantiation, improve the instantiation efficiency of cognitive description program.In addition piecemeal also makes cognitive describe program parallelization instantiation and become possibility, between the block not having a dependence, concurrent technique can be used the example, improve the efficiency of cognitive description program example;
(3) by obtaining the logically true logically false word collection of program, deleting redundancy rule and redundancy word in all the other regular rule bodies of cancellation, thus simplifying cognitive description program, improve the efficiency that inference machine solves;
(4) the present invention first utilize logically true and logically false word collection to eliminate part can the subjective word of yojan, the method for the heuristic generation-checking of the employing for the subjective word of remainder.Then according to transformation rule, cognition being described Program transformation is rebound strength curve program, finally obtains all solutions of cognitive description program.In the present invention, only need guess remaining subjective word, not need to guess all subjective words, drastically increase the efficiency of inference machine;
(5) the present invention proposes the technology based on heuristic search, for all subjective words, first utilize program predicate dependency graph to determine its dependence, then guess subjective word successively.Decrease the conjecture that some are unnecessary, reduce the number of times generating and generate in test, drastically increase the efficiency generating test.
Accompanying drawing explanation
Fig. 1 is the systematic schematic diagram of the embodiment of the present invention;
Fig. 2 is the program predicate dependency graph of example procedure 1 in the embodiment of the present invention;
Fig. 3 is the process flow diagram of inference machine instantiation in the embodiment of the present invention;
Fig. 4 is the process flow diagram that in the embodiment of the present invention, inference machine solves;
Fig. 5 is the procedure chart solving logically true logically false word collection in the embodiment of the present invention;
Fig. 6 is the procedure chart of heuristic generation-checking in the embodiment of the present invention.
Embodiment
Below in conjunction with specific embodiment, illustrate the present invention further, these embodiments should be understood only be not used in for illustration of the present invention and limit the scope of the invention, after having read the present invention, the amendment of those skilled in the art to the various equivalent form of value of the present invention has all fallen within the application's claims limited range.
Technical scheme of the present invention will be introduced below from architecture and method flow two aspects.
1) architecture: Fig. 1 gives the architecture that a kind of cognition describes the realization of PROGRAM REASONING IN TEMPORAL LOGIC machine.Provide illustrating of several major part below.
Syntax analyzer
Syntax analyzer inspection inputs the correctness of the grammer of cognitive description program and whether cognitive description program is that safe cognition describes program, when user's loading routine grammer is incorrect or be not that safe cognition describes program, then provides the Error Location of program.
The cognition being input as user's input of syntax analyzer module describes program, exports and describes program for the correct and cognition of safety of grammer or describe program and error reporting for the cognition of mistake.
Construction procedures predicate dependency graph
The predicate dependency graph of program P is made up of summit and directed edge, i.e. Dep (P)=(V, E).Wherein the set V on summit is made up of the name of predicates all in program P.The set E on limit is by the generate rule in program.
If i) predicate p is the predicate of the head word of a certain rule in program, and another predicate q to be present in the rule body of this rule in objective word or positive subjective word, so just sets up the strong dependence edge of p to q.
Ii) if predicate predicate p is the predicate of the head word of a certain rule in program, and another predicate q to be present in the rule body of this rule in weak privative or negative subjective word, so just sets up the weak dependence edge of p to q.
The program predicate dependency graph of the cognitive description program 1 of example below Fig. 2.
Student (Zhang San).
Medium (the X) ← student (X) of outstanding (X) or, teacher not (X).
Scholarship (X) ← K outstanding (X).
Exempt from tuition fee (X) ← K scholarship (X)
Program 1
Construction procedures predicate dependency graph module be input as that grammer is correct and the cognition of safety describes program, build the program predicate dependency graph of loading routine according to the definition of predicate dependency graph, export as program predicate dependency graph.
Deblocking and sequence
According to program predicate dependency graph, find out all strong continune subgraphs in figure successively, determine each program block according to strong continune subgraph.Then utilize predicate dependency graph, determine the dependence of each program block.
The program that the is input as predicate dependency graph of deblocking and order module and cognitive description program, export as orderly modular cognitive description program.
Program example
Namely program exampleization uses all variablees in constant replacement program.Based on forward reasoning technology, first obtain the predicate of all instantiations, the output according to block sorting module uses predicate set each program block of instantiation successively of instantiation.For arbitrary program block, this program block of instantiation and the new predicate of generation are the processes of an iteration, until this program block no longer produces new predicate.When the whole instantiation of all program blocks, program example end-of-module runs, and the cognition exporting instantiation describes.
Program example module be input as orderly modular cognitive description program, export then for the cognition after instantiation describes program.
Solve logically true logically false collection (as shown in Figure 4), simplify procedures
Logically true and logically false collection is made up of the set of two kinds of words, i.e. SM (P)=(LFP, MFS).Wherein LFP is made up of the word necessarily set up, and MFS is made up of certain invalid word.According to logically true logically false word collection, delete redundancy rule and redundancy word in all the other regular rule bodies of cancellation, thus simplify and cognitively describe journey, simplify complexity of reasoning.
Solve logically true logically false module be input as instantiation after cognition program is described, solve the logically true logically false collection of present procedure, then go to simplify procedures according to these two set.This process is the process of an iteration, until logically true logically false collection not till increase and program can not simplify.The output of this module is that the cognition after simplifying describes program and logically true logically false collection.
Heuristic search (as shown in Figure 6)
Generation checking is a mature technology in artificial intelligence, the present invention proposes a kind of heuristic generation verification method, solves the solution of cognitive description program.First according to the program predicate dependency graph built, the dependence of all subjective words (Subjective Literal) in cognitive description program is determined, wherein the word K l or-K l of subjective word namely containing cognitive operational symbol.Guess the value of subjective word successively, then according to the subjective word value of conjecture, cognition is described program and become common rebound strength curve program, obtain all rebound strength curve of rebound strength curve program, and all rebound strength curve are described the possible solution of of program, by verifying that subjective word determines whether the solution into program as cognition.By the possible value adopting trace-back process to guess subjective word, until complete all conjectures, solve all solutions of cognitive description program.
The cognitive description program of input of heuristic generation authentication module and stable model, it exports all solutions for cognitive description program.
2) method flow: the present invention proposes a kind of cognition based on generating-verifying and describe PROGRAM REASONING IN TEMPORAL LOGIC machine implementation method, comprise instantiation, program simplification, generation may be separated, determined last solution four steps by test.When the cognitive description program of input one, first, check on basis in morphology, grammaticality, build the predicate dependency graph of cognitive description program, accordingly the topological sorting of block generates to deblocking, then, use forward inference technology, according to topological sorting, carry out safety rule inspection and embodiment successively to program, the final cognition generating instantiation describes program.Secondly, its logically true and logically false word collection of program solution is described to the cognition of instantiation, simplifies procedures.This process is the process of an iteration, ensure that iteration can stop according to fixed point theorem.Then, determine the dependence between subjective word according to predicate dependency graph, guess the value of subjective word according to this, thus to transform cognitive description program be rebound strength curve logical program, and solve whole rebound strength curve of this program.So far, required rebound strength curve is exactly that inputted cognition describes of program and may separate.After this, by verifying that subjective word value is whether correct, determine that whether this may solution be the solution of cognitive description program.By the possible value adopting trace-back process to guess subjective word, until complete all conjectures, solve all solutions of cognitive description program.The step of the method comprises:
Step 1: correct to morphology and grammer, the cognition of rule safety describes program construction predicate dependency graph, and step comprises:
11) check that whether loading routine is that the correct cognition of grammer describes program.Generated morphology and the syntax Analysis Module of inference machine in this step by Lex and Yacc, when grammar mistake, provide the position of makeing mistakes, otherwise will the security inspection of rule be entered.
12) security inspection of rule
If in a rule, the variable appearing at regular head all appears in positive subjective word or objective word, then this rule is safe, otherwise it is unsafe.All rules containing variable in this module checking routine, when the unsafe rule of appearance, program is made mistakes and is provided errors present.
13) predicate dependency graph is built
If i) predicate p is the predicate of the head word of a certain rule in program, and another predicate q to be present in the rule body of this rule in objective word or positive subjective word, so just sets up the strong dependence edge of p to q.
Ii) if predicate predicate p is the predicate of the head word of a certain rule in program, and another predicate q to be present in the rule body of this rule in weak privative or negative subjective word, so just sets up the weak dependence edge of p to q.
Program, according to above-mentioned two rules, builds the program predicate dependency graph of cognitive description program.
Step 2: utilize predicate dependency graph in step 1, carry out piecemeal instantiation to program, step comprises:
21) deblocking:
According to the predicate dependency graph in step 1, find out all strong continune subgraphs in figure successively, according to strong continune subgraph, original program is divided into each program block.
22) topological sorting:
Dependence is determined by two rules below:
If i) there is a strong dependence edge to strong continune subgraph B in strong continune subgraph A, then the block that the block that strong continune subgraph A determines is determined prior to strong continune subgraph B.
Ii) if strong continune subgraph A and strong continune subgraph B does not exist any strong dependence edge, and there is a weak dependence edge to strong continune subgraph B in strong continune subgraph A, then the block that the block that strong continune subgraph A determines is determined prior to strong continune subgraph B.
23) substep instantiation:
Based on forward reasoning technology, successively instantiation is carried out to each program block, and export the cognition after instantiation and describe program.The word of all instantiations in first acquisition program, adds to S set, namely travels through the strictly all rules in cognitive description program, will not add to S set containing the word of the regular head (head) of variable.The program block that instantiation is all successively, every rule body in S and program block is compared, if this rule can by S instantiation, namely the word containing variable in this rule body exists in S, then generate one not containing the rule of variable with interchangeable word, and the word in the head of new regulation is added in S set.This is the process of an iteration, until do not produce the word of new instantiation in S.
The algorithm of program example is shown in algorithm 1.
Step 3: simplify procedures, when ensureing to separate constant, reducing the fuzzy rules of program, reducing the number of word in rule body.
According to description program cognitive after instantiation, ask for logically true and true and false word collection all in program and simplify cognitive description program.This is the process of an iteration, until logically true and logically false word collection not till increase.First all facts in cognition description program are added to LFP, the word only occurred in rule body is added to MFS.Reuse the cognitive description program of logically true logically false word reduction, rule of simplification is as follows: for a rule r,
I) concentrate when the positive subjective word Ka in rule body is present in logically true word, then from this regular rule body, delete Ka;
Ii) concentrate when the objective word l in rule body is present in logically true word, then from this regular rule body, delete l;
Iii) concentrate when the negative subjective word-Ka in rule body is present in logically false word, then from this regular rule body, delete-Ka;
Iv) concentrate when the weak privative not l in rule body is present in logically false word, then from this regular rule body, delete not l;
V) concentrate when the positive subjective word Ka in rule body is present in logically false word, remove this rule;
Vi) concentrate when the objective word l in rule body is present in logically false word, remove this rule;
Vii) concentrate when the negative subjective word-Ka in rule body is present in logically true word, remove this rule;
Viii) concentrate when the weak privative not l in rule body is present in logically true word, remove this rule;
Again upgrade logically true logically false collection, and go to simplify cognitive description program with the word collection after upgrading.This is also the process of an iteration, and till LFP and MFS no longer increases, algorithm is shown in algorithm 2.
Step 4: the value guessing subjective word, generator program may be separated:
41) dependence between subjective word is determined
According to the predicate dependency graph that step 1 generates, determine the dependence between all subjective words.If the predicate namely from the predicate of subjective word A to subjective word B, there is a path be made up of strong dependence edge, then subjective word B depends on subjective word A.
42) generate and may separate
Adopt heuristic, according to the dependence between subjective word, guess the value of all subjective words.Thus to transform cognitive description program be rebound strength curve logical program, its transformation rule is as follows:
● when comprising the subjective word that true value is vacation in rule body, remove this rule
● when the true value of K l is true, replace K l with l
● when the true value of-K l is true, from rule body, remove-K l
Use the true value of three rules and conjecture above cognition to be described program and become common rebound strength curve program, and using the word in the LFP in stable model as the fact, using the word in MFS as constraint, transfer to the inference machine of rebound strength curve program to solve all rebound strength curve together, all rebound strength curve form cognitive description program one and may separate.
Step 5: with may separate the conjecture value checking subjective word, if this solution may meet the conjecture value of all subjective words, then this may be separated is exactly a solution of cognitive description program.The rule that checking uses is as follows:
● the true value of-K l is true value that is false or K l is true, then all need in all rebound strength curve to comprise l, and rebound strength curve can not be empty
● the true value of-K l is true or the true value of K l is false, then at least exist in a rebound strength curve and do not comprise l, and rebound strength curve can be empty
According to the true value of conjecture of all subjective words of above two rules checking, checking may solution be successfully then a solution of cognitive description program.Backtracking ground guesses that all subjective words are until the possible value of the complete all subjective words of all conjectures, the solution that generator program is all.Its algorithm is shown in algorithm 3.
The cognition that suppose there is following input describes program:
Student (Zhang San). 1
Outstanding (the X) ← student (X) of medium (X) or, teacher not (X). 2
Scholarship (X) ← K outstanding (X). 3
Exempt from tuition fee (X) ← K scholarship (X) 4
Program 1
We solve loading routine in accordance with the following steps:
(1) grammatical analysis and safety rule inspection: first check whether the rule that the grammer of every rule and cognitive description program comprise is safety rule.For program 1, we are known, 4 rules are all legal rule, in rule, all bodies (body) are all made up of subjective word, objective word or weak privative, there is no unallowable instruction digit, head in rule forms by objective word, and for a rule, all appears in positive subjective word or objective word if there is the variable at regular head.So program 1 to be grammer correct and safety.
(2) predicate dependency graph is built, piecemeal and sequence: according to the program 1 of input, traversal strictly all rules, according to the definition of above-mentioned predicate dependency graph, generate program predicate dependency graph as shown in Figure 2, namely there are the limits of student to outstanding and medium two strong dependences, two teachers are to the limit of outstanding and medium weak dependence,, an outstanding strong dependence edge to scholarship, a scholarship is to the strong dependence edge of exempting from tuition fee.Then use the algorithm finding strong continune subgraph, find out strong continune subgraphs all in Fig. 2, be each blockette of program.Four rules all in figure are by formation four program blocks, and wherein program block 1 is rule 1, and program block 2 is rule 2, and program block 3 is rule 3, and program block 4 is rule 4.Its topological sorting is 1-2-3-4.
(3) program example (according to Fig. 3): the word first finding out instantiation in program, and add to S set, i.e. S={ student (Zhang San) }.Due to program block instantiation, therefore program uses S instantiation procedure block 2 first iteratively, till S set no longer increases.Obviously, after an iteration, program block 2 instantiation terminates, medium (Zhang San) and outstanding (Zhang San) will add in S set, and the rule produced after a new instantiation, medium (the Zhang San) ← student (Zhang San) of outstanding (Zhang San) or, teacher not (Zhang San)..Then program will use S to continue instantiation procedure block 3, and after program block 3 instantiation terminates, scholarship (Zhang San) adds to S set, and increases new rule, scholarship (Zhang San) ← K outstanding (Zhang San).Then, program is by instantiation procedure block 4.The new rule of increase is exempted from tuition fee (Zhang San) ← K scholarship (Zhang San)..To the word after following instance be comprised in S set, student (Zhang San), outstanding (Zhang San), medium (Zhang San), scholarship (Zhang San), exempts from tuition fee (Zhang San) }.Program after instantiation is as follows:
Student (Zhang San). 1
Medium (the Zhang San) ← student (Zhang San) of outstanding (Zhang San) or, teacher not (Zhang San) .2
Scholarship (Zhang San) ← K outstanding (Zhang San) .3
Exempt from tuition fee (Zhang San) ← K scholarship (Zhang San) 4
Program 2
(4) solve logically true logically false word collection (according to Fig. 5), simplify procedures:
According to the program (i.e. program 2) after instantiation, program by according to above-mentioned introduced method solver logically true logically false word collection and simplify procedures.This is the process of an iteration, till logically true logically false word collection no longer increases and can not simplify with program.Program will obtain logically true logically false word collection { { man (Zhang San) .}, { teacher (Zhang San) } }.Then use logically true logically false word collection to simplify procedures, the program after simplification is as follows:
Student (Zhang San). 1
Outstanding (Zhang San) or medium (Zhang San). 2
Scholarship (Zhang San) ← K outstanding (Zhang San). 3
Exempt from tuition fee (Zhang San) ← K scholarship (Zhang San) 4
Program 3
Again solve logically true logically false word collection and simplify procedures.Obvious stable model has reached stable, and logically true logically false word collection and program can not simplify, and therefore program will enter next step.
(5) guess the value of subjective word, generator program may be separated:
Program, first according to predicate dependency graph, determines the dependence of the subjective word of cognitive description program.What obvious known K exempted from tuition fee (Zhang San) (being assumed to subjective word 2) depends on K outstanding (Zhang San) (being assumed to subjective word 1).Therefore K outstanding (Zhang San) true value, i.e. subjective word 1 is assigned.Suppose that subjective word 1 assigns true value to be false, ask for the logically true logically false word collection of program and simplify procedures.Obviously known, the true value of subjective word 2 is also false, and rule 2 will be removed from program, then rule 3 also must be removed from rule, so program is converted into rebound strength curve program, and it is following form:
Student (Zhang San). 1
Medium (Zhang San) or outstanding (Zhang San). 2
Program 4
By said procedure, logically true word collection is as the fact, and logically false word collection sends into rebound strength curve PROGRAM REASONING IN TEMPORAL LOGIC machine in the lump as constraint.A solution { { student (Zhang San), medium (Zhang San) }, { student (Zhang San), outstanding (Zhang San) } } will be obtained.Verify subjective word 1 and subjective word 2, then can find satisfied two subjective words, this is a solution of cognitive description program.
(6) verify the conjecture of subjective word according to rebound strength curve, if meet the conjecture of all subjective words, then all rebound strength curve form the solution of a cognitive description program.Backtracking ground guesses that all subjective words are until the possible value of the complete all subjective words of all conjectures, the solution that generator program is all.Continuing the subjective word 1 of hypothesis assigns true value to be true, then the true value of known subjective word 2 is also true, so program is converted into rebound strength curve program, and it is following form:
Student (Zhang San). 1
Medium (Zhang San) or outstanding (Zhang San). 2
Scholarship (Zhang San) ← outstanding (Zhang San). 3
Exempt from tuition fee (Zhang San) ← scholarship (Zhang San) 4
Program 5
By said procedure, logically true word collection is as the fact, and logically false word collection sends into rebound strength curve PROGRAM REASONING IN TEMPORAL LOGIC machine in the lump as constraint.A solution { { student (Zhang San), medium (Zhang San) }, { scholarship (Zhang San), exempts from tuition fee (Zhang San) for student (Zhang San), outstanding (Zhang San) } } will be obtained.Verify all subjective words, find that the true value of conjecture all can not meet, so this may solution not be a solution of program.So far, the value that all subjective word of program guesses is possible.Therefore, program obtains the solution that is nibbled: { { student (Zhang San), medium (Zhang San) }, { student (Zhang San), outstanding (Zhang San) } }.

Claims (4)

1. describe a method for solving for program based on the cognition generating-verify, it is characterized in that, its step comprises:
Step 1: correct to morphology and grammer, the cognition of rule safety describes program construction predicate dependency graph, and step comprises:
11) generate the morphology of inference machine and syntax Analysis Module by Lex and Yacc, check that whether loading routine is that the correct cognition of grammer describes program;
12) security inspection of rule
For a rule, all appear in positive subjective word or objective word if there is the variable at regular head, then this rule is safe, otherwise it is unsafe;
13) predicate dependency graph is built
If i) predicate p is the predicate of a certain regular head word in program, and another predicate q to be present in the rule body of this rule in objective word or positive subjective word, so just sets up the strong dependence edge of p to q;
If ii) predicate predicate p is the predicate of a certain regular head word in program, and another predicate q to be present in the rule body of this rule in weak privative or negative subjective word, so just sets up the weak dependence edge of p to q;
Step 2: the predicate predicate dependency graph utilizing step l to generate, carry out instantiation to program, step comprises:
21) deblocking:
According to the predicate predicate dependency graph that step 1 generates, find out all strong continune subgraphs in figure successively, a piecemeal of each strong continune subgraph determination program;
22) topological sorting:
The topological sorting between program block is determined according to following rule;
If i) there is a strong dependence edge to strong continune subgraph B in strong continune subgraph A, then the block that the block that strong continune subgraph A determines is determined prior to strong continune subgraph B;
If ii) strong continune subgraph A and strong continune subgraph B does not exist any strong dependence edge, and there is a weak dependence edge to strong continune subgraph B in strong continune subgraph A, then the block that the block that strong continune subgraph A determines is determined prior to strong continune subgraph B;
23) substep instantiation:
Based on forward reasoning technology, successively instantiation is carried out to each program block;
Step 3: simplify procedures, when ensureing to separate constant, delete redundancy rule and redundancy word step in all the other regular rule bodies of cancellation comprises:
31) logically true logically false word collection is asked
The cognition asking for instantiation describes all logically true logically false word collection of program; This is the process of an iteration, till logically true and logically false word collection no longer increases;
32) redundancy rule and word is deleted
According to logically true logically false word collection, delete redundancy rule and redundancy word in all the other regular rule bodies of cancellation, thus simplify and cognitively describe journey, simplify complexity of reasoning;
Step 4: the value guessing subjective word, generator program may be separated:
41) dependence between subjective word is determined
According to the predicate dependency graph that step 1 generates, determine the dependence between all subjective words; If the predicate namely from the predicate of subjective word A to subjective word B, there is a path be made up of strong dependence edge, then subjective word B depends on subjective word A;
42) generate and may separate
Adopt heuristic, according to the dependence between subjective word, guess the value of all subjective words; Thus to transform cognitive description program be rebound strength curve logical program, and generate may separating of a cognitive description program of whole rebound strength curve compositions of rebound strength curve logical program;
Step 5: with the conjecture value checking subjective word may be separated, if this solution may meet the conjecture value of all subjective words, then this may be separated is exactly a solution of cognitive description program;
Adopt the value of all subjective words of trace-back process conjecture, the solution that generator program is all.
2. the method for solving of program is described based on the cognition generating-verify as claimed in claim 1, it is characterized in that: in described step 1, to the logical program rule containing subjective word, the security of decision rule in the positive subjective word of rule body and objective word whether is appeared at according to the variable in regular head, decision condition is: for a rule, all appear in positive subjective word or objective word if there is the variable at regular head, then this rule is safe, otherwise it is unsafe; Cognitive description program is the strictly all rules in safe and if only if program is all safe.
3. describe the method for solving of program as claimed in claim 1 based on the cognition generating-verify, it is characterized in that: utilize logically true logically false word collection to simplify cognitive description program, rule of simplification is as follows: for a rule r,
I) when the positive subjective word in rule body kabe present in logically true word to concentrate, then delete from this regular rule body ka;
Ii) when the objective word in rule body lbe present in logically true word to concentrate, then delete from this regular rule body l;
Iii) when the negative subjective word in rule body -Kabe present in logically false word to concentrate, then delete from this regular rule body- ka;
Iv) when the weak privative in rule body not lbe present in logically false word to concentrate, then delete from this regular rule body not l;
V) when the positive subjective word in rule body kabe present in logically false word to concentrate, remove this rule;
Vi) when the objective word in rule body lbe present in logically false word to concentrate, remove this rule;
Vii) when the negative subjective word in rule body -Kabe present in logically true word to concentrate, remove this rule;
Viii) when the weak privative in rule body not lbe present in logically true word to concentrate, remove this rule.
4. the method for solving of program is described based on the cognition generating-verify as claimed in claim 1, it is characterized in that: in described step 4, using the dependence between subjective word as heuristic information, search for subjective word valued space, it is a rebound strength curve program that the possible value of the subjective word searched with each describes Program transformation cognition, asks for all rebound strength curve of this rebound strength curve program and forms of cognitive description program and may separate; Heuristic information is adopted to guess that the strategy of subjective word value is specific as follows:
I) according to the precedence of subjective word dependence,
Ii) the value of subjective word that the value of follow-up subjective word is relied on by it determines, if namely subjective word A depends on subjective word B, when subjective word B value is true, then the value of subjective word A is also true; When subjective word B value is false, then subjective word A value is also false;
Iii) to the subjective word not relying on any other subjective word, a true value is given.
CN201210529095.7A 2012-12-10 2012-12-10 Solution method for cognitive description program based on generation-verification Active CN103020714B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210529095.7A CN103020714B (en) 2012-12-10 2012-12-10 Solution method for cognitive description program based on generation-verification

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210529095.7A CN103020714B (en) 2012-12-10 2012-12-10 Solution method for cognitive description program based on generation-verification

Publications (2)

Publication Number Publication Date
CN103020714A CN103020714A (en) 2013-04-03
CN103020714B true CN103020714B (en) 2015-04-15

Family

ID=47969300

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210529095.7A Active CN103020714B (en) 2012-12-10 2012-12-10 Solution method for cognitive description program based on generation-verification

Country Status (1)

Country Link
CN (1) CN103020714B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104007981B (en) * 2014-06-13 2017-04-12 河海大学常州校区 Human-computer interaction interface design method based on error-cognition mapping model
CN107092515B (en) * 2017-03-16 2020-09-11 东南大学 LPMLN reasoning method and system based on answer set logic program

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101512505A (en) * 2006-09-11 2009-08-19 微软公司 Security language translations with logic resolution

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110244434A1 (en) * 2006-01-27 2011-10-06 University Of Utah Research Foundation System and Method of Analyzing Freeform Mathematical Responses

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101512505A (en) * 2006-09-11 2009-08-19 微软公司 Security language translations with logic resolution

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
A modal logic for authorization specification and reasoning;Yun Bai;《2009 IEEE International Conference on Intelligent Computing and Intelligent Systems (ICIS 2009)》;20091122;第264-268页 *
ESParser: An Epistemic Specification Grounder;Rongcun Cui等;《2012 International Conference on Computer Science and Service System (CSSS)》;20120813;第1823-1827页 *
一种求解认知难题的模型检测方法;骆翔宇;《计算机学报》;20100315;第33卷(第3期);第406-414页 *

Also Published As

Publication number Publication date
CN103020714A (en) 2013-04-03

Similar Documents

Publication Publication Date Title
Pedersen et al. Validating design methods and research: the validation square
Dal Lago et al. Probabilistic operational semantics for the lambda calculus
Petnga et al. An ontological framework for knowledge modeling and decision support in cyber-physical systems
Wang et al. Exploration of neural machine translation in autoformalization of mathematics in Mizar
Pratt A practical decision method for propositional dynamic logic (Preliminary Report)
Fionda et al. LTL on finite and process traces: complexity results and a practical reasoner
Foulds The heuristic problem-solving approach
Hájek et al. On generation of inductive hypotheses
CN103020714B (en) Solution method for cognitive description program based on generation-verification
Stachowitz et al. Building validation tools for knowledge-based systems
Balduccini et al. PDDL+ planning via constraint answer set programming
Reger et al. Instantiation and Pretending to be an SMT Solver with Vampire.
Cropper et al. Learning programs by combining programs
Zhang et al. A LLM-Based Simulation Scenario Aided Generation Method
Radke A Theory of HR* Graph Conditions and their Application to Meta-Modeling
Sun et al. Problem specific genetic differential evolution algorithm for multi-skill resource-constrained project scheduling of collaborative multi-robot systems for search and rescue
Doré et al. The Elfe System-Verifying mathematical proofs of undergraduate students
CN109408542B (en) Fault reasoning method of expert system based on symptoms
Mohebali A method for solving NP search based on model expansion and grounding
Loup On solving real-algebraic formulas in a satisfiability-modulo-theories framework
Yamakami The world of combinatorial fuzzy problems and the efficiency of fuzzy approximation algorithms
Wurm Kleene algebras, regular languages and substructural logics
Kong et al. An overview of artificial transportation systems
Liu et al. Verification and validation of fuzzy rules-based human behavior models
Zhou Specification-guided imitation learning

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant