Troubles by understanding arity of terms in A Course in Universal Algebra.












7














In A Course in Universal Algebra in definition 10.1 terms are introduced.



What puzzles me is the statement about arity:




"A term $p$ is $n$-ary if the number of variables appearing explicitly in $p$ is $leq n$."




Does that mean that the arity of a term $p$ is at most limited but not defined, and can take several values?



If e.g. $p$ is a variable then can every integer $geq1$ be put forward as arity of $p$?



This seems to be confirmed in the definition 10.2 (also troubling me) where for term $p(x_1,dots,x_n):=x_iin X$ a mapping $p^{mathbf A}:A^nto A$ is prescribed by $(a_1,dots,a_n)mapsto a_i$.



I really do not understand this definition.



If I just start with term $x$ wich is a variable then according to def. 10.2 $x^{mathbf A}$ must be some function $A^nto A$. But if so, then what is $n$ (can it take several values?) and how is the function prescribed?










share|cite|improve this question





























    7














    In A Course in Universal Algebra in definition 10.1 terms are introduced.



    What puzzles me is the statement about arity:




    "A term $p$ is $n$-ary if the number of variables appearing explicitly in $p$ is $leq n$."




    Does that mean that the arity of a term $p$ is at most limited but not defined, and can take several values?



    If e.g. $p$ is a variable then can every integer $geq1$ be put forward as arity of $p$?



    This seems to be confirmed in the definition 10.2 (also troubling me) where for term $p(x_1,dots,x_n):=x_iin X$ a mapping $p^{mathbf A}:A^nto A$ is prescribed by $(a_1,dots,a_n)mapsto a_i$.



    I really do not understand this definition.



    If I just start with term $x$ wich is a variable then according to def. 10.2 $x^{mathbf A}$ must be some function $A^nto A$. But if so, then what is $n$ (can it take several values?) and how is the function prescribed?










    share|cite|improve this question



























      7












      7








      7


      1





      In A Course in Universal Algebra in definition 10.1 terms are introduced.



      What puzzles me is the statement about arity:




      "A term $p$ is $n$-ary if the number of variables appearing explicitly in $p$ is $leq n$."




      Does that mean that the arity of a term $p$ is at most limited but not defined, and can take several values?



      If e.g. $p$ is a variable then can every integer $geq1$ be put forward as arity of $p$?



      This seems to be confirmed in the definition 10.2 (also troubling me) where for term $p(x_1,dots,x_n):=x_iin X$ a mapping $p^{mathbf A}:A^nto A$ is prescribed by $(a_1,dots,a_n)mapsto a_i$.



      I really do not understand this definition.



      If I just start with term $x$ wich is a variable then according to def. 10.2 $x^{mathbf A}$ must be some function $A^nto A$. But if so, then what is $n$ (can it take several values?) and how is the function prescribed?










      share|cite|improve this question















      In A Course in Universal Algebra in definition 10.1 terms are introduced.



      What puzzles me is the statement about arity:




      "A term $p$ is $n$-ary if the number of variables appearing explicitly in $p$ is $leq n$."




      Does that mean that the arity of a term $p$ is at most limited but not defined, and can take several values?



      If e.g. $p$ is a variable then can every integer $geq1$ be put forward as arity of $p$?



      This seems to be confirmed in the definition 10.2 (also troubling me) where for term $p(x_1,dots,x_n):=x_iin X$ a mapping $p^{mathbf A}:A^nto A$ is prescribed by $(a_1,dots,a_n)mapsto a_i$.



      I really do not understand this definition.



      If I just start with term $x$ wich is a variable then according to def. 10.2 $x^{mathbf A}$ must be some function $A^nto A$. But if so, then what is $n$ (can it take several values?) and how is the function prescribed?







      soft-question definition universal-algebra






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Dec 26 at 11:27

























      asked Dec 23 at 12:14









      drhab

      97.7k544128




      97.7k544128






















          2 Answers
          2






          active

          oldest

          votes


















          8














          I think you've got it (ugly as it seems). The point is that a term on its own isn't a "complete" object, and so it doesn't have a unique arity.





          Certainly there's no problem talking about the arity of a map from $A^n$ to $A$ (namely, just $n$). The point is that a single term can have multiple different interpretations as functions, and these yield different arities. You point this out yourself.



          Specifically, for any term $p$ and any set $V$ of variables such that every variable occurring in $p$ is in $V$, we can view $p$ as a map $p_V: A^Vrightarrow A$. Note that the translation $(p,V)mapsto p_V$ is completely straightforward; this is why one will (sadly) often conflate $p$ and $p_V$ when $V$ is clear from context.




          • Note that there's no requirement here that $V$ be finite!


          In light of this, it isn't too weird to allow a term to have multiple arities - the point being that in some sense a term on its own is incomplete (for spiritual similarity, one might argue that the graph of a function is incomplete since it doesn't tell you the codomain).






          share|cite|improve this answer























          • Thank you Noah. Light starts shining, but (as always) I need time to digest.
            – drhab
            Dec 23 at 17:26










          • You are saying that every (finite I guess) set $V$ induces together with $p$ a map $p_V:A^{|V|}to A$. I understand, but shouldn't we say that for every linear ordered finite set $V$? If for instance $p$ is variable $x$ then it must be clear which projection (there are $|V|$ in total) is denoted by $p_V$, right? I asked a similar question to @Eran.
            – drhab
            Dec 23 at 19:46












          • @drhab Yes, what you're saying is correct for finitary operations. However, a more general definition would be to interpret to domain $A^V$ as the collection of all functions from $V$ to $A$. Think of these elements of the domain as "$V$-tuples." Then, I would call $f : A^V to A$ a $V$-ary operation on $A$.
            – William DeMeo
            Dec 23 at 19:53










          • @WilliamDeMeo Ah, so actually everything will be okay immediately if we replace $|V|$ by $V$ here so that $p_V:A^Vto A$. Then the order I was asking for is present. Next to that it has the advantage that it eventually can be expanded to infinite $V$. Do I understand you correct?
            – drhab
            Dec 23 at 19:59












          • @drhab Yes, exactly! And see the comment I'm about to post after Erin's answer.
            – William DeMeo
            Dec 23 at 20:03



















          6














          Personally, I wouldn't even define arity for a term; I would only define it for a term operation. Let me try to be more precise:



          Let $X$ be a set of symbols, called variables, and let $mathcal{F}$ be a set of operation symbols such that each operation symbol $f$ has an arity, $mathrm{ar}(f)$, that is a non-negative integer. The set $mathrm{T}(X)$ of all terms in $X$ is defined recursively:




          1. every variable $x$ or operation symbol $c$ with $mathrm{ar}(c)=0$ is in $mathrm{T}(X)$,

          2. if $t_1,dots,t_k$ are terms and $f$ is an operation symbol with $mathrm{ar}(f)=n$, then $f(t_1,dots,t_n)$ is in $mathrm{T}(X)$.


          Now, let $X_k={x_1,dots,x_k}$ and let $mathbf{A}$ be an algebra of type $mathcal{F}$. To every term $t$ in $mathrm{T}(X_k)$ we can define a $k$-ary operation $t^A$ on $A$ as follows:




          1. if $t=x_i$ or $t=c$ with $mathrm{ar}(c)=0$, then $t^A:A^kto A$ is defined by $t^A(a_1,dots,a_k)=a_i$ or $t^A(a_1,dots,a_k)=c^A$, respectively.

          2. if $t=f(t_1,dots,t_n)$, then $t^A(a_1,dots,a_k)=f^A(t_1^A(a_1,dots,a_k),dots,t_n^A(a_1,dots,a_k))$.


          The important thing to notice is that terms are just formal strings of symbols whereas when we assign meaning to a term in a specific algebra that is how we arrive at term operation. Based on this, I feel no reason to define arity for a term and the arity of a term operation is just the arity of the operation. I will conclude with an example:



          Let $mathcal{F}={+,-,0}$. Then $t=(x_1+(-x_2))+x_3$ is in $mathrm{T}(X_3)$, but it is also in $mathrm{T}(X_k)$ for any $kgeq 3$. So, given an algebra $mathbf{A}$ of type $mathcal{F}$, we can define the term operation $t^A:A^3to A$ by $t(a_1,a_2,a_3)=(a_1+(-a_2))+a_3$ or we could define it $t^A:A^kto A$ for any $kgeq 3$ by $t(a_1,dots,a_k)=(a_1+(-a_2))+a_3$. This first term operation has arity equal to 3 and the second one has arity equal to $k$, but there is no reason to define arity for $t$.






          share|cite|improve this answer





















          • Thank you. I will take a good look at this (and also the answer of Noah).
            – drhab
            Dec 23 at 17:34










          • The first 2. in your answer starts with "if $t_1,dots,t_k$.." but I suspect the $k$ must be $n$ here. Correct? Secondly after the second 1. in your answer you define $t^A$ as the $i$-th projection if $t=x_i$. So the index $i$ is determining. Doesn't that ask for a tuple $<x_1,dots,x_n>$ instead of a set $X_k={x_1,dots,x_n}$, or otherwise for a set $X_k$ having $k$ elements that is accompanied by a linear order? Maybe that was done implicitly already by introducing indices for the elements of $X_k$.
            – drhab
            Dec 23 at 19:21












          • @drhab When trying to write programs to handle general operations and terms, (Andrej Bauer showed me) it's easier to handle arities in a more general way. For finitary operations or terms, input arguments are finite tuples, like $a = (a_1, dots, a_n)$, but a tuple is really a function $a : {1,2,dots, n} to A$ (or replace $A$ with $T$ if you want input arguments to be terms). More generally, if $rho : F to alpha$ is a function from operation symbols to the "arity" type $alpha$, then operations have type $f : A^{rho f} to A$. The arity type $alpha$ can be fairly general.
            – William DeMeo
            Dec 23 at 20:04












          • If you know Coq, and you want to see how this is actually implemented (in dependent type theory), look here, or if you know Lean, look here.
            – William DeMeo
            Dec 23 at 20:08










          • Everything is clear to me now, and this answer was very very useful. So was the one of Noah (and also the comments of @WilliamDeMeo). Actually I regret that I can only accept one answer. Thanks a lot!
            – drhab
            Dec 24 at 6:07











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3050296%2ftroubles-by-understanding-arity-of-terms-in-a-course-in-universal-algebra%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          8














          I think you've got it (ugly as it seems). The point is that a term on its own isn't a "complete" object, and so it doesn't have a unique arity.





          Certainly there's no problem talking about the arity of a map from $A^n$ to $A$ (namely, just $n$). The point is that a single term can have multiple different interpretations as functions, and these yield different arities. You point this out yourself.



          Specifically, for any term $p$ and any set $V$ of variables such that every variable occurring in $p$ is in $V$, we can view $p$ as a map $p_V: A^Vrightarrow A$. Note that the translation $(p,V)mapsto p_V$ is completely straightforward; this is why one will (sadly) often conflate $p$ and $p_V$ when $V$ is clear from context.




          • Note that there's no requirement here that $V$ be finite!


          In light of this, it isn't too weird to allow a term to have multiple arities - the point being that in some sense a term on its own is incomplete (for spiritual similarity, one might argue that the graph of a function is incomplete since it doesn't tell you the codomain).






          share|cite|improve this answer























          • Thank you Noah. Light starts shining, but (as always) I need time to digest.
            – drhab
            Dec 23 at 17:26










          • You are saying that every (finite I guess) set $V$ induces together with $p$ a map $p_V:A^{|V|}to A$. I understand, but shouldn't we say that for every linear ordered finite set $V$? If for instance $p$ is variable $x$ then it must be clear which projection (there are $|V|$ in total) is denoted by $p_V$, right? I asked a similar question to @Eran.
            – drhab
            Dec 23 at 19:46












          • @drhab Yes, what you're saying is correct for finitary operations. However, a more general definition would be to interpret to domain $A^V$ as the collection of all functions from $V$ to $A$. Think of these elements of the domain as "$V$-tuples." Then, I would call $f : A^V to A$ a $V$-ary operation on $A$.
            – William DeMeo
            Dec 23 at 19:53










          • @WilliamDeMeo Ah, so actually everything will be okay immediately if we replace $|V|$ by $V$ here so that $p_V:A^Vto A$. Then the order I was asking for is present. Next to that it has the advantage that it eventually can be expanded to infinite $V$. Do I understand you correct?
            – drhab
            Dec 23 at 19:59












          • @drhab Yes, exactly! And see the comment I'm about to post after Erin's answer.
            – William DeMeo
            Dec 23 at 20:03
















          8














          I think you've got it (ugly as it seems). The point is that a term on its own isn't a "complete" object, and so it doesn't have a unique arity.





          Certainly there's no problem talking about the arity of a map from $A^n$ to $A$ (namely, just $n$). The point is that a single term can have multiple different interpretations as functions, and these yield different arities. You point this out yourself.



          Specifically, for any term $p$ and any set $V$ of variables such that every variable occurring in $p$ is in $V$, we can view $p$ as a map $p_V: A^Vrightarrow A$. Note that the translation $(p,V)mapsto p_V$ is completely straightforward; this is why one will (sadly) often conflate $p$ and $p_V$ when $V$ is clear from context.




          • Note that there's no requirement here that $V$ be finite!


          In light of this, it isn't too weird to allow a term to have multiple arities - the point being that in some sense a term on its own is incomplete (for spiritual similarity, one might argue that the graph of a function is incomplete since it doesn't tell you the codomain).






          share|cite|improve this answer























          • Thank you Noah. Light starts shining, but (as always) I need time to digest.
            – drhab
            Dec 23 at 17:26










          • You are saying that every (finite I guess) set $V$ induces together with $p$ a map $p_V:A^{|V|}to A$. I understand, but shouldn't we say that for every linear ordered finite set $V$? If for instance $p$ is variable $x$ then it must be clear which projection (there are $|V|$ in total) is denoted by $p_V$, right? I asked a similar question to @Eran.
            – drhab
            Dec 23 at 19:46












          • @drhab Yes, what you're saying is correct for finitary operations. However, a more general definition would be to interpret to domain $A^V$ as the collection of all functions from $V$ to $A$. Think of these elements of the domain as "$V$-tuples." Then, I would call $f : A^V to A$ a $V$-ary operation on $A$.
            – William DeMeo
            Dec 23 at 19:53










          • @WilliamDeMeo Ah, so actually everything will be okay immediately if we replace $|V|$ by $V$ here so that $p_V:A^Vto A$. Then the order I was asking for is present. Next to that it has the advantage that it eventually can be expanded to infinite $V$. Do I understand you correct?
            – drhab
            Dec 23 at 19:59












          • @drhab Yes, exactly! And see the comment I'm about to post after Erin's answer.
            – William DeMeo
            Dec 23 at 20:03














          8












          8








          8






          I think you've got it (ugly as it seems). The point is that a term on its own isn't a "complete" object, and so it doesn't have a unique arity.





          Certainly there's no problem talking about the arity of a map from $A^n$ to $A$ (namely, just $n$). The point is that a single term can have multiple different interpretations as functions, and these yield different arities. You point this out yourself.



          Specifically, for any term $p$ and any set $V$ of variables such that every variable occurring in $p$ is in $V$, we can view $p$ as a map $p_V: A^Vrightarrow A$. Note that the translation $(p,V)mapsto p_V$ is completely straightforward; this is why one will (sadly) often conflate $p$ and $p_V$ when $V$ is clear from context.




          • Note that there's no requirement here that $V$ be finite!


          In light of this, it isn't too weird to allow a term to have multiple arities - the point being that in some sense a term on its own is incomplete (for spiritual similarity, one might argue that the graph of a function is incomplete since it doesn't tell you the codomain).






          share|cite|improve this answer














          I think you've got it (ugly as it seems). The point is that a term on its own isn't a "complete" object, and so it doesn't have a unique arity.





          Certainly there's no problem talking about the arity of a map from $A^n$ to $A$ (namely, just $n$). The point is that a single term can have multiple different interpretations as functions, and these yield different arities. You point this out yourself.



          Specifically, for any term $p$ and any set $V$ of variables such that every variable occurring in $p$ is in $V$, we can view $p$ as a map $p_V: A^Vrightarrow A$. Note that the translation $(p,V)mapsto p_V$ is completely straightforward; this is why one will (sadly) often conflate $p$ and $p_V$ when $V$ is clear from context.




          • Note that there's no requirement here that $V$ be finite!


          In light of this, it isn't too weird to allow a term to have multiple arities - the point being that in some sense a term on its own is incomplete (for spiritual similarity, one might argue that the graph of a function is incomplete since it doesn't tell you the codomain).







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Dec 23 at 20:15

























          answered Dec 23 at 16:55









          Noah Schweber

          121k10148284




          121k10148284












          • Thank you Noah. Light starts shining, but (as always) I need time to digest.
            – drhab
            Dec 23 at 17:26










          • You are saying that every (finite I guess) set $V$ induces together with $p$ a map $p_V:A^{|V|}to A$. I understand, but shouldn't we say that for every linear ordered finite set $V$? If for instance $p$ is variable $x$ then it must be clear which projection (there are $|V|$ in total) is denoted by $p_V$, right? I asked a similar question to @Eran.
            – drhab
            Dec 23 at 19:46












          • @drhab Yes, what you're saying is correct for finitary operations. However, a more general definition would be to interpret to domain $A^V$ as the collection of all functions from $V$ to $A$. Think of these elements of the domain as "$V$-tuples." Then, I would call $f : A^V to A$ a $V$-ary operation on $A$.
            – William DeMeo
            Dec 23 at 19:53










          • @WilliamDeMeo Ah, so actually everything will be okay immediately if we replace $|V|$ by $V$ here so that $p_V:A^Vto A$. Then the order I was asking for is present. Next to that it has the advantage that it eventually can be expanded to infinite $V$. Do I understand you correct?
            – drhab
            Dec 23 at 19:59












          • @drhab Yes, exactly! And see the comment I'm about to post after Erin's answer.
            – William DeMeo
            Dec 23 at 20:03


















          • Thank you Noah. Light starts shining, but (as always) I need time to digest.
            – drhab
            Dec 23 at 17:26










          • You are saying that every (finite I guess) set $V$ induces together with $p$ a map $p_V:A^{|V|}to A$. I understand, but shouldn't we say that for every linear ordered finite set $V$? If for instance $p$ is variable $x$ then it must be clear which projection (there are $|V|$ in total) is denoted by $p_V$, right? I asked a similar question to @Eran.
            – drhab
            Dec 23 at 19:46












          • @drhab Yes, what you're saying is correct for finitary operations. However, a more general definition would be to interpret to domain $A^V$ as the collection of all functions from $V$ to $A$. Think of these elements of the domain as "$V$-tuples." Then, I would call $f : A^V to A$ a $V$-ary operation on $A$.
            – William DeMeo
            Dec 23 at 19:53










          • @WilliamDeMeo Ah, so actually everything will be okay immediately if we replace $|V|$ by $V$ here so that $p_V:A^Vto A$. Then the order I was asking for is present. Next to that it has the advantage that it eventually can be expanded to infinite $V$. Do I understand you correct?
            – drhab
            Dec 23 at 19:59












          • @drhab Yes, exactly! And see the comment I'm about to post after Erin's answer.
            – William DeMeo
            Dec 23 at 20:03
















          Thank you Noah. Light starts shining, but (as always) I need time to digest.
          – drhab
          Dec 23 at 17:26




          Thank you Noah. Light starts shining, but (as always) I need time to digest.
          – drhab
          Dec 23 at 17:26












          You are saying that every (finite I guess) set $V$ induces together with $p$ a map $p_V:A^{|V|}to A$. I understand, but shouldn't we say that for every linear ordered finite set $V$? If for instance $p$ is variable $x$ then it must be clear which projection (there are $|V|$ in total) is denoted by $p_V$, right? I asked a similar question to @Eran.
          – drhab
          Dec 23 at 19:46






          You are saying that every (finite I guess) set $V$ induces together with $p$ a map $p_V:A^{|V|}to A$. I understand, but shouldn't we say that for every linear ordered finite set $V$? If for instance $p$ is variable $x$ then it must be clear which projection (there are $|V|$ in total) is denoted by $p_V$, right? I asked a similar question to @Eran.
          – drhab
          Dec 23 at 19:46














          @drhab Yes, what you're saying is correct for finitary operations. However, a more general definition would be to interpret to domain $A^V$ as the collection of all functions from $V$ to $A$. Think of these elements of the domain as "$V$-tuples." Then, I would call $f : A^V to A$ a $V$-ary operation on $A$.
          – William DeMeo
          Dec 23 at 19:53




          @drhab Yes, what you're saying is correct for finitary operations. However, a more general definition would be to interpret to domain $A^V$ as the collection of all functions from $V$ to $A$. Think of these elements of the domain as "$V$-tuples." Then, I would call $f : A^V to A$ a $V$-ary operation on $A$.
          – William DeMeo
          Dec 23 at 19:53












          @WilliamDeMeo Ah, so actually everything will be okay immediately if we replace $|V|$ by $V$ here so that $p_V:A^Vto A$. Then the order I was asking for is present. Next to that it has the advantage that it eventually can be expanded to infinite $V$. Do I understand you correct?
          – drhab
          Dec 23 at 19:59






          @WilliamDeMeo Ah, so actually everything will be okay immediately if we replace $|V|$ by $V$ here so that $p_V:A^Vto A$. Then the order I was asking for is present. Next to that it has the advantage that it eventually can be expanded to infinite $V$. Do I understand you correct?
          – drhab
          Dec 23 at 19:59














          @drhab Yes, exactly! And see the comment I'm about to post after Erin's answer.
          – William DeMeo
          Dec 23 at 20:03




          @drhab Yes, exactly! And see the comment I'm about to post after Erin's answer.
          – William DeMeo
          Dec 23 at 20:03











          6














          Personally, I wouldn't even define arity for a term; I would only define it for a term operation. Let me try to be more precise:



          Let $X$ be a set of symbols, called variables, and let $mathcal{F}$ be a set of operation symbols such that each operation symbol $f$ has an arity, $mathrm{ar}(f)$, that is a non-negative integer. The set $mathrm{T}(X)$ of all terms in $X$ is defined recursively:




          1. every variable $x$ or operation symbol $c$ with $mathrm{ar}(c)=0$ is in $mathrm{T}(X)$,

          2. if $t_1,dots,t_k$ are terms and $f$ is an operation symbol with $mathrm{ar}(f)=n$, then $f(t_1,dots,t_n)$ is in $mathrm{T}(X)$.


          Now, let $X_k={x_1,dots,x_k}$ and let $mathbf{A}$ be an algebra of type $mathcal{F}$. To every term $t$ in $mathrm{T}(X_k)$ we can define a $k$-ary operation $t^A$ on $A$ as follows:




          1. if $t=x_i$ or $t=c$ with $mathrm{ar}(c)=0$, then $t^A:A^kto A$ is defined by $t^A(a_1,dots,a_k)=a_i$ or $t^A(a_1,dots,a_k)=c^A$, respectively.

          2. if $t=f(t_1,dots,t_n)$, then $t^A(a_1,dots,a_k)=f^A(t_1^A(a_1,dots,a_k),dots,t_n^A(a_1,dots,a_k))$.


          The important thing to notice is that terms are just formal strings of symbols whereas when we assign meaning to a term in a specific algebra that is how we arrive at term operation. Based on this, I feel no reason to define arity for a term and the arity of a term operation is just the arity of the operation. I will conclude with an example:



          Let $mathcal{F}={+,-,0}$. Then $t=(x_1+(-x_2))+x_3$ is in $mathrm{T}(X_3)$, but it is also in $mathrm{T}(X_k)$ for any $kgeq 3$. So, given an algebra $mathbf{A}$ of type $mathcal{F}$, we can define the term operation $t^A:A^3to A$ by $t(a_1,a_2,a_3)=(a_1+(-a_2))+a_3$ or we could define it $t^A:A^kto A$ for any $kgeq 3$ by $t(a_1,dots,a_k)=(a_1+(-a_2))+a_3$. This first term operation has arity equal to 3 and the second one has arity equal to $k$, but there is no reason to define arity for $t$.






          share|cite|improve this answer





















          • Thank you. I will take a good look at this (and also the answer of Noah).
            – drhab
            Dec 23 at 17:34










          • The first 2. in your answer starts with "if $t_1,dots,t_k$.." but I suspect the $k$ must be $n$ here. Correct? Secondly after the second 1. in your answer you define $t^A$ as the $i$-th projection if $t=x_i$. So the index $i$ is determining. Doesn't that ask for a tuple $<x_1,dots,x_n>$ instead of a set $X_k={x_1,dots,x_n}$, or otherwise for a set $X_k$ having $k$ elements that is accompanied by a linear order? Maybe that was done implicitly already by introducing indices for the elements of $X_k$.
            – drhab
            Dec 23 at 19:21












          • @drhab When trying to write programs to handle general operations and terms, (Andrej Bauer showed me) it's easier to handle arities in a more general way. For finitary operations or terms, input arguments are finite tuples, like $a = (a_1, dots, a_n)$, but a tuple is really a function $a : {1,2,dots, n} to A$ (or replace $A$ with $T$ if you want input arguments to be terms). More generally, if $rho : F to alpha$ is a function from operation symbols to the "arity" type $alpha$, then operations have type $f : A^{rho f} to A$. The arity type $alpha$ can be fairly general.
            – William DeMeo
            Dec 23 at 20:04












          • If you know Coq, and you want to see how this is actually implemented (in dependent type theory), look here, or if you know Lean, look here.
            – William DeMeo
            Dec 23 at 20:08










          • Everything is clear to me now, and this answer was very very useful. So was the one of Noah (and also the comments of @WilliamDeMeo). Actually I regret that I can only accept one answer. Thanks a lot!
            – drhab
            Dec 24 at 6:07
















          6














          Personally, I wouldn't even define arity for a term; I would only define it for a term operation. Let me try to be more precise:



          Let $X$ be a set of symbols, called variables, and let $mathcal{F}$ be a set of operation symbols such that each operation symbol $f$ has an arity, $mathrm{ar}(f)$, that is a non-negative integer. The set $mathrm{T}(X)$ of all terms in $X$ is defined recursively:




          1. every variable $x$ or operation symbol $c$ with $mathrm{ar}(c)=0$ is in $mathrm{T}(X)$,

          2. if $t_1,dots,t_k$ are terms and $f$ is an operation symbol with $mathrm{ar}(f)=n$, then $f(t_1,dots,t_n)$ is in $mathrm{T}(X)$.


          Now, let $X_k={x_1,dots,x_k}$ and let $mathbf{A}$ be an algebra of type $mathcal{F}$. To every term $t$ in $mathrm{T}(X_k)$ we can define a $k$-ary operation $t^A$ on $A$ as follows:




          1. if $t=x_i$ or $t=c$ with $mathrm{ar}(c)=0$, then $t^A:A^kto A$ is defined by $t^A(a_1,dots,a_k)=a_i$ or $t^A(a_1,dots,a_k)=c^A$, respectively.

          2. if $t=f(t_1,dots,t_n)$, then $t^A(a_1,dots,a_k)=f^A(t_1^A(a_1,dots,a_k),dots,t_n^A(a_1,dots,a_k))$.


          The important thing to notice is that terms are just formal strings of symbols whereas when we assign meaning to a term in a specific algebra that is how we arrive at term operation. Based on this, I feel no reason to define arity for a term and the arity of a term operation is just the arity of the operation. I will conclude with an example:



          Let $mathcal{F}={+,-,0}$. Then $t=(x_1+(-x_2))+x_3$ is in $mathrm{T}(X_3)$, but it is also in $mathrm{T}(X_k)$ for any $kgeq 3$. So, given an algebra $mathbf{A}$ of type $mathcal{F}$, we can define the term operation $t^A:A^3to A$ by $t(a_1,a_2,a_3)=(a_1+(-a_2))+a_3$ or we could define it $t^A:A^kto A$ for any $kgeq 3$ by $t(a_1,dots,a_k)=(a_1+(-a_2))+a_3$. This first term operation has arity equal to 3 and the second one has arity equal to $k$, but there is no reason to define arity for $t$.






          share|cite|improve this answer





















          • Thank you. I will take a good look at this (and also the answer of Noah).
            – drhab
            Dec 23 at 17:34










          • The first 2. in your answer starts with "if $t_1,dots,t_k$.." but I suspect the $k$ must be $n$ here. Correct? Secondly after the second 1. in your answer you define $t^A$ as the $i$-th projection if $t=x_i$. So the index $i$ is determining. Doesn't that ask for a tuple $<x_1,dots,x_n>$ instead of a set $X_k={x_1,dots,x_n}$, or otherwise for a set $X_k$ having $k$ elements that is accompanied by a linear order? Maybe that was done implicitly already by introducing indices for the elements of $X_k$.
            – drhab
            Dec 23 at 19:21












          • @drhab When trying to write programs to handle general operations and terms, (Andrej Bauer showed me) it's easier to handle arities in a more general way. For finitary operations or terms, input arguments are finite tuples, like $a = (a_1, dots, a_n)$, but a tuple is really a function $a : {1,2,dots, n} to A$ (or replace $A$ with $T$ if you want input arguments to be terms). More generally, if $rho : F to alpha$ is a function from operation symbols to the "arity" type $alpha$, then operations have type $f : A^{rho f} to A$. The arity type $alpha$ can be fairly general.
            – William DeMeo
            Dec 23 at 20:04












          • If you know Coq, and you want to see how this is actually implemented (in dependent type theory), look here, or if you know Lean, look here.
            – William DeMeo
            Dec 23 at 20:08










          • Everything is clear to me now, and this answer was very very useful. So was the one of Noah (and also the comments of @WilliamDeMeo). Actually I regret that I can only accept one answer. Thanks a lot!
            – drhab
            Dec 24 at 6:07














          6












          6








          6






          Personally, I wouldn't even define arity for a term; I would only define it for a term operation. Let me try to be more precise:



          Let $X$ be a set of symbols, called variables, and let $mathcal{F}$ be a set of operation symbols such that each operation symbol $f$ has an arity, $mathrm{ar}(f)$, that is a non-negative integer. The set $mathrm{T}(X)$ of all terms in $X$ is defined recursively:




          1. every variable $x$ or operation symbol $c$ with $mathrm{ar}(c)=0$ is in $mathrm{T}(X)$,

          2. if $t_1,dots,t_k$ are terms and $f$ is an operation symbol with $mathrm{ar}(f)=n$, then $f(t_1,dots,t_n)$ is in $mathrm{T}(X)$.


          Now, let $X_k={x_1,dots,x_k}$ and let $mathbf{A}$ be an algebra of type $mathcal{F}$. To every term $t$ in $mathrm{T}(X_k)$ we can define a $k$-ary operation $t^A$ on $A$ as follows:




          1. if $t=x_i$ or $t=c$ with $mathrm{ar}(c)=0$, then $t^A:A^kto A$ is defined by $t^A(a_1,dots,a_k)=a_i$ or $t^A(a_1,dots,a_k)=c^A$, respectively.

          2. if $t=f(t_1,dots,t_n)$, then $t^A(a_1,dots,a_k)=f^A(t_1^A(a_1,dots,a_k),dots,t_n^A(a_1,dots,a_k))$.


          The important thing to notice is that terms are just formal strings of symbols whereas when we assign meaning to a term in a specific algebra that is how we arrive at term operation. Based on this, I feel no reason to define arity for a term and the arity of a term operation is just the arity of the operation. I will conclude with an example:



          Let $mathcal{F}={+,-,0}$. Then $t=(x_1+(-x_2))+x_3$ is in $mathrm{T}(X_3)$, but it is also in $mathrm{T}(X_k)$ for any $kgeq 3$. So, given an algebra $mathbf{A}$ of type $mathcal{F}$, we can define the term operation $t^A:A^3to A$ by $t(a_1,a_2,a_3)=(a_1+(-a_2))+a_3$ or we could define it $t^A:A^kto A$ for any $kgeq 3$ by $t(a_1,dots,a_k)=(a_1+(-a_2))+a_3$. This first term operation has arity equal to 3 and the second one has arity equal to $k$, but there is no reason to define arity for $t$.






          share|cite|improve this answer












          Personally, I wouldn't even define arity for a term; I would only define it for a term operation. Let me try to be more precise:



          Let $X$ be a set of symbols, called variables, and let $mathcal{F}$ be a set of operation symbols such that each operation symbol $f$ has an arity, $mathrm{ar}(f)$, that is a non-negative integer. The set $mathrm{T}(X)$ of all terms in $X$ is defined recursively:




          1. every variable $x$ or operation symbol $c$ with $mathrm{ar}(c)=0$ is in $mathrm{T}(X)$,

          2. if $t_1,dots,t_k$ are terms and $f$ is an operation symbol with $mathrm{ar}(f)=n$, then $f(t_1,dots,t_n)$ is in $mathrm{T}(X)$.


          Now, let $X_k={x_1,dots,x_k}$ and let $mathbf{A}$ be an algebra of type $mathcal{F}$. To every term $t$ in $mathrm{T}(X_k)$ we can define a $k$-ary operation $t^A$ on $A$ as follows:




          1. if $t=x_i$ or $t=c$ with $mathrm{ar}(c)=0$, then $t^A:A^kto A$ is defined by $t^A(a_1,dots,a_k)=a_i$ or $t^A(a_1,dots,a_k)=c^A$, respectively.

          2. if $t=f(t_1,dots,t_n)$, then $t^A(a_1,dots,a_k)=f^A(t_1^A(a_1,dots,a_k),dots,t_n^A(a_1,dots,a_k))$.


          The important thing to notice is that terms are just formal strings of symbols whereas when we assign meaning to a term in a specific algebra that is how we arrive at term operation. Based on this, I feel no reason to define arity for a term and the arity of a term operation is just the arity of the operation. I will conclude with an example:



          Let $mathcal{F}={+,-,0}$. Then $t=(x_1+(-x_2))+x_3$ is in $mathrm{T}(X_3)$, but it is also in $mathrm{T}(X_k)$ for any $kgeq 3$. So, given an algebra $mathbf{A}$ of type $mathcal{F}$, we can define the term operation $t^A:A^3to A$ by $t(a_1,a_2,a_3)=(a_1+(-a_2))+a_3$ or we could define it $t^A:A^kto A$ for any $kgeq 3$ by $t(a_1,dots,a_k)=(a_1+(-a_2))+a_3$. This first term operation has arity equal to 3 and the second one has arity equal to $k$, but there is no reason to define arity for $t$.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Dec 23 at 16:51









          Eran

          1,238818




          1,238818












          • Thank you. I will take a good look at this (and also the answer of Noah).
            – drhab
            Dec 23 at 17:34










          • The first 2. in your answer starts with "if $t_1,dots,t_k$.." but I suspect the $k$ must be $n$ here. Correct? Secondly after the second 1. in your answer you define $t^A$ as the $i$-th projection if $t=x_i$. So the index $i$ is determining. Doesn't that ask for a tuple $<x_1,dots,x_n>$ instead of a set $X_k={x_1,dots,x_n}$, or otherwise for a set $X_k$ having $k$ elements that is accompanied by a linear order? Maybe that was done implicitly already by introducing indices for the elements of $X_k$.
            – drhab
            Dec 23 at 19:21












          • @drhab When trying to write programs to handle general operations and terms, (Andrej Bauer showed me) it's easier to handle arities in a more general way. For finitary operations or terms, input arguments are finite tuples, like $a = (a_1, dots, a_n)$, but a tuple is really a function $a : {1,2,dots, n} to A$ (or replace $A$ with $T$ if you want input arguments to be terms). More generally, if $rho : F to alpha$ is a function from operation symbols to the "arity" type $alpha$, then operations have type $f : A^{rho f} to A$. The arity type $alpha$ can be fairly general.
            – William DeMeo
            Dec 23 at 20:04












          • If you know Coq, and you want to see how this is actually implemented (in dependent type theory), look here, or if you know Lean, look here.
            – William DeMeo
            Dec 23 at 20:08










          • Everything is clear to me now, and this answer was very very useful. So was the one of Noah (and also the comments of @WilliamDeMeo). Actually I regret that I can only accept one answer. Thanks a lot!
            – drhab
            Dec 24 at 6:07


















          • Thank you. I will take a good look at this (and also the answer of Noah).
            – drhab
            Dec 23 at 17:34










          • The first 2. in your answer starts with "if $t_1,dots,t_k$.." but I suspect the $k$ must be $n$ here. Correct? Secondly after the second 1. in your answer you define $t^A$ as the $i$-th projection if $t=x_i$. So the index $i$ is determining. Doesn't that ask for a tuple $<x_1,dots,x_n>$ instead of a set $X_k={x_1,dots,x_n}$, or otherwise for a set $X_k$ having $k$ elements that is accompanied by a linear order? Maybe that was done implicitly already by introducing indices for the elements of $X_k$.
            – drhab
            Dec 23 at 19:21












          • @drhab When trying to write programs to handle general operations and terms, (Andrej Bauer showed me) it's easier to handle arities in a more general way. For finitary operations or terms, input arguments are finite tuples, like $a = (a_1, dots, a_n)$, but a tuple is really a function $a : {1,2,dots, n} to A$ (or replace $A$ with $T$ if you want input arguments to be terms). More generally, if $rho : F to alpha$ is a function from operation symbols to the "arity" type $alpha$, then operations have type $f : A^{rho f} to A$. The arity type $alpha$ can be fairly general.
            – William DeMeo
            Dec 23 at 20:04












          • If you know Coq, and you want to see how this is actually implemented (in dependent type theory), look here, or if you know Lean, look here.
            – William DeMeo
            Dec 23 at 20:08










          • Everything is clear to me now, and this answer was very very useful. So was the one of Noah (and also the comments of @WilliamDeMeo). Actually I regret that I can only accept one answer. Thanks a lot!
            – drhab
            Dec 24 at 6:07
















          Thank you. I will take a good look at this (and also the answer of Noah).
          – drhab
          Dec 23 at 17:34




          Thank you. I will take a good look at this (and also the answer of Noah).
          – drhab
          Dec 23 at 17:34












          The first 2. in your answer starts with "if $t_1,dots,t_k$.." but I suspect the $k$ must be $n$ here. Correct? Secondly after the second 1. in your answer you define $t^A$ as the $i$-th projection if $t=x_i$. So the index $i$ is determining. Doesn't that ask for a tuple $<x_1,dots,x_n>$ instead of a set $X_k={x_1,dots,x_n}$, or otherwise for a set $X_k$ having $k$ elements that is accompanied by a linear order? Maybe that was done implicitly already by introducing indices for the elements of $X_k$.
          – drhab
          Dec 23 at 19:21






          The first 2. in your answer starts with "if $t_1,dots,t_k$.." but I suspect the $k$ must be $n$ here. Correct? Secondly after the second 1. in your answer you define $t^A$ as the $i$-th projection if $t=x_i$. So the index $i$ is determining. Doesn't that ask for a tuple $<x_1,dots,x_n>$ instead of a set $X_k={x_1,dots,x_n}$, or otherwise for a set $X_k$ having $k$ elements that is accompanied by a linear order? Maybe that was done implicitly already by introducing indices for the elements of $X_k$.
          – drhab
          Dec 23 at 19:21














          @drhab When trying to write programs to handle general operations and terms, (Andrej Bauer showed me) it's easier to handle arities in a more general way. For finitary operations or terms, input arguments are finite tuples, like $a = (a_1, dots, a_n)$, but a tuple is really a function $a : {1,2,dots, n} to A$ (or replace $A$ with $T$ if you want input arguments to be terms). More generally, if $rho : F to alpha$ is a function from operation symbols to the "arity" type $alpha$, then operations have type $f : A^{rho f} to A$. The arity type $alpha$ can be fairly general.
          – William DeMeo
          Dec 23 at 20:04






          @drhab When trying to write programs to handle general operations and terms, (Andrej Bauer showed me) it's easier to handle arities in a more general way. For finitary operations or terms, input arguments are finite tuples, like $a = (a_1, dots, a_n)$, but a tuple is really a function $a : {1,2,dots, n} to A$ (or replace $A$ with $T$ if you want input arguments to be terms). More generally, if $rho : F to alpha$ is a function from operation symbols to the "arity" type $alpha$, then operations have type $f : A^{rho f} to A$. The arity type $alpha$ can be fairly general.
          – William DeMeo
          Dec 23 at 20:04














          If you know Coq, and you want to see how this is actually implemented (in dependent type theory), look here, or if you know Lean, look here.
          – William DeMeo
          Dec 23 at 20:08




          If you know Coq, and you want to see how this is actually implemented (in dependent type theory), look here, or if you know Lean, look here.
          – William DeMeo
          Dec 23 at 20:08












          Everything is clear to me now, and this answer was very very useful. So was the one of Noah (and also the comments of @WilliamDeMeo). Actually I regret that I can only accept one answer. Thanks a lot!
          – drhab
          Dec 24 at 6:07




          Everything is clear to me now, and this answer was very very useful. So was the one of Noah (and also the comments of @WilliamDeMeo). Actually I regret that I can only accept one answer. Thanks a lot!
          – drhab
          Dec 24 at 6:07


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3050296%2ftroubles-by-understanding-arity-of-terms-in-a-course-in-universal-algebra%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Human spaceflight

          Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

          張江高科駅