逻辑信息模型(Logical Information Model) for Java:Example 18

逻辑信息模型(Logical Information Model) for Java:Example 18

"lim4j-samples": Example 18

逻辑信息模型(Logical Information Model) for Java:Example 18_第1张图片

 逻辑信息模型(Logical Information Model) for Java:Example 18_第2张图片

 逻辑信息模型(Logical Information Model) for Java:Example 18_第3张图片


sample代码如下:

	public static void main(String[] args) throws Exception {
		Argument a1 = new Argument("∵ax²+bx+c=0, ∴x=(-b±√(b²-4ac))/2a");
		Argument a2 = new Argument("∵ax²+bx+c=0, ∴x²+(b/a)x+(c/a)=0");
		Argument a3 = new Argument("∵x²+(b/a)x+(c/a)=0, ∴x²+2(b/2a)x+(b/2a)²=-(c/a)+(b/2a)²");
		Argument a4 = new Argument("∵x²+2(b/2a)x+(b/2a)²=-(c/a)+(b/2a)², ∴(x+(b/2a))²=(b²-4ac)/4a²");
		Argument a5 = new Argument("∵(x+(b/2a))²=(b²-4ac)/4a², ∴x+(b/2a)=√(b²-4ac)/2a");
		Argument a6 = new Argument("∵x+(b/2a)=√(b²-4ac)/2a, ∴x=(-b±√(b²-4ac))/2a");

		JudgedStatement js1 = new Definition("ax²+bx+c=0");
		JudgedStatement js2 = new Definition("x=(-b±√(b²-4ac))/2a");
		JudgedStatement js3 = new Definition("x²+(b/a)x+(c/a)=0");
		JudgedStatement js4 = new Definition("x²+2(b/2a)x+(b/2a)²=-(c/a)+(b/2a)²");
		JudgedStatement js5 = new Definition("(x+(b/2a))²=(b²-4ac)/4a²");
		JudgedStatement js6 = new Definition("x+(b/2a)=±√(b²-4ac)/2a");
		JudgedStatement js7 = new HypotheticalProposition("If ac=bc, and c≠0, then a=b. (cancellation law of multiplication)");
		JudgedStatement js8 = new HypotheticalProposition("If a+c=b+c, then a=b. (cancellation law of addition)");
		JudgedStatement js9 = new Definition("x²+2kx+k²=(x+k)², k∈R");
		JudgedStatement js10 = new HypotheticalProposition("If a²=b², then a=±b.");
		
		Condition cd1 = new Condition("a,b,c∈R, a≠0");

		a2.addEvidence(js1, js7);
		a2.addConclusion(js3);
		a2.addCondition(cd1);
		a2.setValidity(new Validity(1));
		a3.addEvidence(js3, js8);
		a3.addConclusion(js4);
		a3.addCondition(cd1);
		a3.setValidity(new Validity(1));
		a4.addEvidence(js4, js9);
		a4.addConclusion(js5);
		a4.addCondition(cd1);
		a4.setValidity(new Validity(1));
		a5.addEvidence(js5, js10);
		a5.addConclusion(js6);
		a5.addCondition(cd1);
		a5.setValidity(new Validity(1));
		a6.addEvidence(js6, js8);
		a6.addConclusion(js2);
		a6.addCondition(cd1);
		a6.setValidity(new Validity(1));

		a1.addEvidence(js1);
		a1.addConclusion(js2);
		a1.addCondition(cd1);
		a1.addSubArgument(a2, a3, a4, a5, a6);
		a1.setValidity(new Validity(1));

		Root root = new Root(a1);

		root.marshalToXml(true, System.out);
	}

 
输出结果:



    
        
        ∵ax²+bx+c=0, ∴x=(-b±√(b²-4ac))/2a
        
        
        
        
        
        
    
    
        
        ∵ax²+bx+c=0, ∴x²+(b/a)x+(c/a)=0
        
        
        
        
        
    
    
        
        ∵x²+(b/a)x+(c/a)=0, ∴x²+2(b/2a)x+(b/2a)²=-(c/a)+(b/2a)²
        
        
        
        
        
    
    
        
        ∵x²+2(b/2a)x+(b/2a)²=-(c/a)+(b/2a)², ∴(x+(b/2a))²=(b²-4ac)/4a²
        
        
        
        
        
    
    
        
        ∵(x+(b/2a))²=(b²-4ac)/4a², ∴x+(b/2a)=√(b²-4ac)/2a
        
        
        
        
        
    
    
        
        ∵x+(b/2a)=√(b²-4ac)/2a, ∴x=(-b±√(b²-4ac))/2a
        
        
        
        
        
    
    
        ax²+bx+c=0
    
    
        x=(-b±√(b²-4ac))/2a
    
    
        x²+(b/a)x+(c/a)=0
    
    
        x²+2(b/2a)x+(b/2a)²=-(c/a)+(b/2a)²
    
    
        (x+(b/2a))²=(b²-4ac)/4a²
    
    
        x+(b/2a)=±√(b²-4ac)/2a
    
    
        If ac=bc, and c≠0, then a=b. (cancellation law of multiplication)
    
    
        If a+c=b+c, then a=b. (cancellation law of addition)
    
    
        x²+2kx+k²=(x+k)², k∈R
    
    
        If a²=b², then a=±b.
    
    
        a,b,c∈R, a≠0
    
    
        
            
            
        
        
    
    
        
        
    
    
        
            
            
            
        
    
    
        
            
            
        
    
    
        
            
            
            
        
    
    
        
            
        
    
    
        
            
            
            
        
    
    
        
            
        
        
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        VALID
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
        
    
    
        
        
    
    
        
            
            
            
        
    
    
        
            
            
        
    
    
        
            
            
            
        
    
    
        
            
        
    
    
        
            
            
            
        
    
    
        
            
        
        
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        VALID
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
        
    
    
        
        
    
    
        
            
            
            
        
    
    
        
            
            
        
    
    
        
            
            
            
        
    
    
        
            
        
    
    
        
            
            
            
        
    
    
        
            
        
        
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        VALID
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
        
    
    
        
        
    
    
        
            
            
            
        
    
    
        
            
            
        
    
    
        
            
            
            
        
    
    
        
            
        
    
    
        
            
            
            
        
    
    
        
            
        
        
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        VALID
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
        
    
    
        
        
    
    
        
            
            
            
        
    
    
        
            
            
        
    
    
        
            
            
            
        
    
    
        
            
        
    
    
        
            
            
            
        
    
    
        
            
        
        
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        VALID
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
        
        
    
    
        
        
    
    
        
            
            
            
        
    
    
        
            
            
        
    
    
        
            
            
            
        
    
    
        
            
        
    
    
        
            
            
        
    
    
        
            
        
        
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        
            
            
            
            
            
        
    
    
        VALID
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    

=============================

源代码:
lim4j-samples:https://github.com/CodeJStudio/lim4j-samples
lim4j:        https://github.com/CodeJStudio/lim4j

参考文献:
《逻辑信息模型与逻辑信息网络》 / "Theory of Logical Information Model & Logical Information Network"
《从逻辑信息模型,到逻辑信息网络,直至实现通用人工智能》
 

你可能感兴趣的:(通用人工智能,逻辑学,Java,java,人工智能,知识图谱,数据结构,图论)