Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to use Metatheory.jl in a Reasoning System. #99

Open
AIxer opened this issue Feb 25, 2022 · 0 comments
Open

Try to use Metatheory.jl in a Reasoning System. #99

AIxer opened this issue Feb 25, 2022 · 0 comments

Comments

@AIxer
Copy link

AIxer commented Feb 25, 2022

Hi, I am working on a Reasoning System, it has some syllogistic rules like:

"""
{<S --> M>, <M -->P>} |- <S --> P>
{<S ==> M>, <M ==>P>} |- <S ==> P>
{<P --> T>, (*, P, S)} |- <(*,P,S) --> T>
...
"""

complete rules in Prolog: nal.pl
what I'm doing now:

abstract type Term end

struct Atom <: Term
    val::Symbol
end

struct Inheritance <: Term
    comps::Vector{Term}
end

function dispatch(term1, term2, ...)
    # a big switch table
    if ...
        ...
    elseif ...
        ...
    elseif ...
        deduction(term1, term2) # OK find a suitable rule
    end
end

function deduction(term1::Inheritance, term2::Inheritance)
    conclusion = if term1[2] == term2[1]
        Inheritance(term1[1], temr2[2])
    elseif term1[1] = term2[2]
        ...
    elseif term1[1] = term2[1]
        ...
    elseif term1[2] == term2[2]
        ...
    end
end

Are there ways to make it simple? the old way above is just rule translation.
This is another implementation uses C macro:

//!Consequent substitutions
R2( (A =/> B), (S ==> B), |-, (A =/> S), Truth_Induction )
R2( (A =/> (P --> B)), (P <-> S), |-, (A =/> (S --> B)), Truth_Analogy )
R2( (A =/> (B --> P)), (P <-> S), |-, (A =/> (B --> S)), Truth_Analogy )
//!First sequence element substitution (deeper isn't currently linked)
R2( ((A &/ B) =/> C), (A ==> S), |-, ((S &/ B) =/> C), Truth_Induction )
R2( ((A &/ B) =/> C), (S ==> A), |-, ((S &/ B) =/> C), Truth_Deduction )
#endif

Is there a declarative way in Metatheory.jl to achieve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant