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

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

"lim4j-samples": Example 10_1

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

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


sample代码如下:

	public static void main(String[] args) throws Exception {
		PureHypotheticalSyllogism phsy1 = new PureHypotheticalSyllogism("① If the first soldier tells the truth, then this is the gate of life. "
				+ "② If this is the gate of life, then the other gate is the gate of death. "
				+ "Therefore, if the first soldier tells the truth, then the other gate is the gate of death.");

		HypotheticalProposition hpp1 = new HypotheticalProposition("If the first soldier tells the truth, then this is the gate of life.");
		HypotheticalProposition hpp2 = new HypotheticalProposition("If this is the gate of life, then the other gate is the gate of death.");
		HypotheticalProposition hpp3 = new HypotheticalProposition("If the first soldier tells the truth, then the other gate is the gate of death.");

		Statement s1 = new Statement("the first soldier tells the truth");
		Statement s2 = new Statement("this is the gate of life");

		JudgedStatement js1 = new Proposition("this is the gate of life.");
		JudgedStatement js2 = new Proposition("the other gate is the gate of death.");

		HypotheticalCondition hcd1 = new HypotheticalCondition(s1);
		HypotheticalCondition hcd2 = new HypotheticalCondition(s2);
		Condition cd1 = new Condition("There are two gates, one for life and one for death.", true);

		hpp1.setAntecedentAndConsequent(hcd1, js1);
		hpp2.setAntecedentAndConsequent(hcd2, js2);
		hpp3.setAntecedentAndConsequent(hcd1, js2);
		hpp2.addCondition(cd1);

		phsy1.setElementsOfSyllogism(hpp1, hpp2, hpp3);
		phsy1.addCondition(hcd1, hcd2);

		Root root = new Root(phsy1);

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


输出结果:



    
        
            
            
            
        
        
        ① If the first soldier tells the truth, then this is the gate of life. ② If this is the gate of life, then the other gate is the gate of death. Therefore, if the first soldier tells the truth, then the other gate is the gate of death.
        
        
        
        
    
    
        
            
            
        
        If the first soldier tells the truth, then this is the gate of life.
    
    
        
            
            
        
        If this is the gate of life, then the other gate is the gate of death.
        
    
    
        
            
            
        
        If the first soldier tells the truth, then the other gate is the gate of death.
    
    
        the first soldier tells the truth
    
    
        this is the gate of life
    
    
        this is the gate of life.
    
    
        the other gate is the gate of death.
    
    
        
            
        
    
    
        
            
        
    
    
        There are two gates, one for life and one for death.
    
    
        
            
        
    
    
        
            
            
            
        
    
    
        
            
            
        
        
    
    
        
        
    
    
        
            
            
        
    
    
        
            
            
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
        
        
    
    
        
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
        
    
    
        
            
            
        
    

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

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

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

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