/-AI-Convert-clause-form-and-Resolution-reputation

주어진 logic operation을 clausal form으로 변환 및 resolution reputation을 수행

Primary LanguageC

Convert-clause-form-and-Resolution-reputation

  • 2017년 1학기 성균관대학교 이지형 교수님 인공지능 수업 2번째 과제
  • 주어진 logic operation을 clausal form으로 변환 및 resolution reputation을 수행하는 문제
  • 2017 1st semester Sungkyunkwan University professor Jee Hyong Lee's Artificial Intelligence class, 2nd assignment
  • Converting a given logic operation into a clausal form and performing resolution reputation

1. Problem

  • 모든 명제(propositions)는 알파벳 소문자로 되어있다고 가정한다.

  • Logic operation인 ‘negation’, ‘and’, ‘or’, ‘implication’ 그리고 ‘if and if only’는 각각 ‘~’, ‘*’, ‘+’, ‘>’ 그리고 ‘=’로 표시한다.

  • logic 표현에 괄호(parenthesis)가 사용된다.

  • 모든 logic expression에는 문법적 에러(grammatical error)가 없다고 가정한다.

  • 예시)

    image

(1) Convert to clausal form

  • 주어진 logic 표현을 clausal form으로 변환하여 출력하는 프로그램을 작성하라.

  • 단순함을 위해, 명제의 부정(negation)을 알파벳 대문자로 표시하고, clasual form은 'or'를 생략하여 표시한다.

  • 예시)

    input : ~(a*b) || output : AB (= ~a+b)

    input : ~(a+b) || output : A b (two clauses)

    input : (a>b)+~(c*~d) || output : AbCd

(2) Resolution reputation for predication logic

  • 주어진 predication logic에 대해 resolution reputation을 수행하는 프로그램을 작성하라.

  • 먼저, 프로그램은 goal을 부정하고, 모든 logic 표현을 clausal form으로 변환한다.

  • 추론 중의 모든 과정은 출력되어야 한다.

  • 최종 output은 "The goal is TRUE" 또는 "Unable to prove"이다.

  • 추론은 다음과 같은 breadth first 전략을 통해 이루어진다.

    image

  • 예시)

    image

2. Environment

  • language : C++
  • IDE : Microsoft Visual studio 2017

3. Result

(1) Convert to clausal form

  • input : ~(a*b) || output : AB (= ~a+b)

    image

  • input : ~(a+~b) || output : A b (two clauses)

    image

  • input : (a>b)+~(c*~d) || output : AbCd

    image

(2) Resolution reputation for predication logic

  • 예시)에 대한 결과

    image

  • "The goal is TRUE" 결과

    image

4. Future work

  • 전체 코드가 600줄이 넘을 정도로 매우 길다. 코드를 정리하고, c++의 객체(클래스) 특성을 이용하여 간결화할 필요가 있다.

무분별한 for문과 while문을 빼자.