Elixir for rules - as an alternative to Prolog or CLIPS?

I’ve been scratching out an idea in Prolog. But I’m wondering how Elixir’s functional paradigm would handle this kind of knowledge base. Has anyone done similar work?

At first glance, these look like multi-headed functions:

 * Crimes within the jurisdiction of the International Criminal Court.
 * https://world.public.law/rome_statute/article_5_crimes_within_the_jurisdiction_of_the_court

 * A first, simple attempt at Protected Persons under
 * the Geneva Conventions of 1949.
protected_by_geneva_convention(P) :- civilian(P).
protected_by_geneva_convention(P) :- prisoner_of_war(P).
protected_by_geneva_convention(P) :- medical_personnel(P).
protected_by_geneva_convention(P) :- religious_personnel(P).

 * D = Defendant
 * V = Victim

 * Genocide
 * https://world.public.law/rome_statute/article_6_genocide
criminal_liability(genocide, Statute, D, V) :-
	elements(Statute, D, V).

 * War crimes
 * https://world.public.law/rome_statute/article_8_war_crimes
criminal_liability(war_crime, Statute, D, V) :-
	international_conflict(D, V),
	elements(Statute, D, V).

elements(article_8_2_a_i, D, V) :-
	act(D, killed, V).

elements(article_8_2_a_ii, D, V) :-
	act(D, tortured, V).     

That similarity isn’t an accident:

  • Elixir’s multi-headed functions with pattern-matching are a direct translation of the Erlang features
  • Erlang specifically cites Prolog’s syntax as inspiration, though with imperative semantics
  • Erlang’s earliest prehistory is as a Prolog program (way back in 1986) - see the history in the introduction to Joe Armstrong’s thesis

Also check out this thread:

1 Like