From ae9d25bcccdc220534b86e5092532541299f99f0 Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Tue, 21 Dec 2021 00:48:15 +0900 Subject: Update README.md --- README.md | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 6cf36aa..1bdd814 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,7 @@ Inpla is a multi-threaded parallel interpreter of interaction nets. Once you wri - [Example: Operations on unary natural numbers](#example-operations-on-unary-natural-numbers) * [Built-in Agents](#built-in-agents) * [Attributes (integers)](#attributes-integers) + - [Built-in anonymous agent for attributes](#built-in-anonymous-agent-for-attributes) - [Arithmetic expressions on attributes](#arithmetic-expressions-on-attributes) - [Interaction rules with expressions on attributes](#interaction-rules-with-expressions-on-attributes) - [Built-in rules of attributes in the anonymous agents](#built-in-rules-of-attributes-in-the-anonymous-agents) @@ -556,9 +557,9 @@ Append(r, listB) ~ listA --> r ~ (listA ++ listB) // pseudo code ## Attributes (integers) -Agents can have integers as their ports. These integers are called *attributes*. +Agents can be extended so that these can have integers as their ports. These integers are called *attributes*. -* For instance, `A(100)` is evaluated as an agent `A` that holds an attribute of an integer value 100. +* For instance, `A(100)` is evaluated as an agent `A` that holds an attribute of an integer value `100`. ``` >>> x~A(100); @@ -569,15 +570,20 @@ Agents can have integers as their ports. These integers are called *attributes*. >>> ``` -It is possible to use integers the same as agents, but these are recognised as attributes of an anonymous built-in agent in Inpla: -``` ->>> x~100; -(0 interactions, 0.00 sec) ->>> x; -100 ->>> free x; ->>> -``` + +### Built-in anonymous agent for attributes +It is possible to use integers the same as agents, but these are recognised as attributes of a built-in *anonymous agent* in Inpla. For instance, when we write just `x~100`, then the `100` is regarded as an attribute of the anonymous agent. + +* The following is another version of the above example in the case of using the anonymous agent: + + ``` + >>> x~100; // The `100' is regarded as an attribute of an anonymous agent + (0 interactions, 0.00 sec) + >>> x; + 100 + >>> free x; + >>> + ``` @@ -630,7 +636,7 @@ The symbol of addition, subtraction, multiplication, division and modulo are `+` ### Interaction rules with expressions on attributes -In interaction rules, attributes can be recognised by the modifier `int` in order to apply arithmetic expressions. **We can use the same variable with the modifier `int` many times (of course, zero times is also OK) in the connection parts of interaction rules**. +In interaction rules, attributes are recognised by a modifier `int` in order to apply arithmetic expressions. **We can use the same variable with the modifier `int` many times (of course, zero times is also OK) in the connection parts of interaction rules**. * Example: Incrementor on an attribute: ``` @@ -644,7 +650,7 @@ In interaction rules, attributes can be recognised by the modifier `int` in orde ``` -- Example: Duplicator of integer lists: +- Example: Duplicator of integer lists. We note that, in the rule of the first line in the below example, the twice occurrences of *i* in the right-hand side is allowed because the *i* is a variable for attributes: ![dup_list](pic/dup_list.png) -- cgit v1.2.3 From 60e15d444b0ada3dfaf7bf2e5bfe969396bcc236 Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Tue, 21 Dec 2021 00:57:43 +0900 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1bdd814..fece4fe 100644 --- a/README.md +++ b/README.md @@ -650,7 +650,7 @@ In interaction rules, attributes are recognised by a modifier `int` in order to ``` -- Example: Duplicator of integer lists. We note that, in the rule of the first line in the below example, the twice occurrences of *i* in the right-hand side is allowed because the *i* is a variable for attributes: +- Example: Duplicator of integer lists. We note that, at the first line of the below example, the rule is allowed to have more than twice (here, it is three times) occurrences of *i* because the *i* is a variable for attributes: ![dup_list](pic/dup_list.png) -- cgit v1.2.3 From 206e651fc95c4c9d0590a93fcb87e5375a6c486b Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Tue, 21 Dec 2021 00:59:17 +0900 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fece4fe..a06f1b8 100644 --- a/README.md +++ b/README.md @@ -650,7 +650,7 @@ In interaction rules, attributes are recognised by a modifier `int` in order to ``` -- Example: Duplicator of integer lists. We note that, at the first line of the below example, the rule is allowed to have more than twice (here, it is three times) occurrences of *i* because the *i* is a variable for attributes: +- Example: Duplicator of integer lists. We note that, at the first line of the below example, the rule is allowed to have more than twice occurrences of *i* (here, it is three times) because the *i* is a variable for attributes: ![dup_list](pic/dup_list.png) -- cgit v1.2.3 From 7663449bb9fc1f1f3967bbc2560fc94f1e19edba Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Tue, 21 Dec 2021 01:02:17 +0900 Subject: Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a06f1b8..42ec6d8 100644 --- a/README.md +++ b/README.md @@ -650,10 +650,12 @@ In interaction rules, attributes are recognised by a modifier `int` in order to ``` -- Example: Duplicator of integer lists. We note that, at the first line of the below example, the rule is allowed to have more than twice occurrences of *i* (here, it is three times) because the *i* is a variable for attributes: +- Example: Duplicator of integer lists. - ![dup_list](pic/dup_list.png) + We note that, at the first line of the below example, the rule is allowed to have not twice occurrences of *i* (here, it is three times) because the *i* is a variable for attributes: + ![dup_list](pic/dup_list.png) + ``` >>> dup(a1,a2) >< (int i):xs => a1~(i:xs1), a2~(i:xs2), dup(xs1,xs2)~xs; @@ -665,7 +667,7 @@ In interaction rules, attributes are recognised by a modifier `int` in order to >>> free a b; >>> ``` - + **We have to be careful for operations of two attributes on distinct agents**. For instance, we take the following rule of an `add` agent: -- cgit v1.2.3