<div dir="ltr">Thanks for your quick response Zoltan. I'm not skilled enough in Prolog or Mercury yet to be sure I'm asking the question correctly, but I essentially want to know if the rule <i>mortal(X):-man(X) </i> and the predicate <i>man(X) </i>could be compiled into C# and if new instances such as <i>man(john)</i> and <i>man(bob)</i> could later be created during runtime, e.g. when a user clicks on the "create man" button in the GUI? Is this the purpose of <i>mutables</i> (from section 4 in the transition guide)?<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 5, 2022 at 8:52 PM Zoltan Somogyi <<a href="mailto:zoltan.somogyi@runbox.com">zoltan.somogyi@runbox.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On Wed, 5 Jan 2022 18:42:17 +0200, David Epstein <<a href="mailto:davideps@umich.edu" target="_blank">davideps@umich.edu</a>> wrote:<br>
> For example, given:<br>
> <br>
> mortal(X) :- man(X).<br>
> <br>
> How would I dynamically (from c#) declare "man(Socrates)." and then query<br>
> if "human(Socrates)"?<br>
<br>
While a Prolog program allows the set of clauses in a predicate<br>
to be altered during runtime with assert and retract, Mercury does not.<br>
Please read section 4 of the Prolog to Mercury transition guide<br>
for the reason why it doesn't, and the many other solutions<br>
Mercury programmers can choose from.<br>
<br>
Note that this has nothing to do with C#, or with pragma foreign_export.<br>
<br>
You should also note that a fact of the form "man(Socrates)" would<br>
in fact assert that *everyone* is a man, because<br>
<br>
- "Socrates" starts with an upper case letter, which means it is a variable,<br>
- any value in the declared argument type of the "man/1" predicate,<br>
which presumably is a type representing people, is an instance of this variable.<br>
<br>
Zoltan.<br>
<br>
<br>
<br>
</blockquote></div>