{"id":293,"date":"2007-01-29T20:08:22","date_gmt":"2007-01-29T20:08:22","guid":{"rendered":"http:\/\/scientopia.org\/blogs\/goodmath\/2007\/01\/29\/basics-syntax-and-semantics\/"},"modified":"2007-01-29T20:08:22","modified_gmt":"2007-01-29T20:08:22","slug":"basics-syntax-and-semantics","status":"publish","type":"post","link":"http:\/\/www.goodmath.org\/blog\/2007\/01\/29\/basics-syntax-and-semantics\/","title":{"rendered":"Basics: Syntax and Semantics"},"content":{"rendered":"<p>Another great basics topic, which came up in the comments from last fridays &#8220;logic&#8221; post, is the<br \/>\ndifference between syntax and semantics. This is an important distinction, made in logic, math, and<br \/>\ncomputer science.<\/p>\n<p> The short version of it is: syntax is what a language <em>looks like<\/em>; semantics is what<br \/>\na language <em>means<\/em>. It&#8217;s basically the distinction between numerals (syntax) and<br \/>\nnumbers (semantics).<\/p>\n<p><!--more--><\/p>\n<p> In terms of logic, the syntax is a description of what a valid statement looks like: what the pieces of a statement are, and all of the different ways that the pieces can get put together to<br \/>\nform valid statements. The way that they&#8217;re put together also imply how you can take them apart &#8211; that is, if you know that a predicate is a predicate name, followed by parens containing arguments to the predicate separated by commas, then given a valid predicate, you can say what the predicate name is, and what the arguments to the predicate in that statement are.<\/p>\n<p> The semantics are the <em>meanings<\/em> of the statements &#8211; and the rules that tell you how to<br \/>\ntake a syntactically valid statement, and figure out what it means. So, for example, it includes rules that describe how to find out what object\/entity is referred to by a particular primitive name, and what kind of property is meant by a particular predicate.<\/p>\n<p> So, for example, I can show you a simple statement: <code>P(\"m\",\"f\")<\/code>. Just by looking at it, you now that it&#8217;s a simple predicate statement over two primitives. You can tell that the<br \/>\n<em>name<\/em> of the predicate is &#8220;P&#8221;, and that the two arguments to the predicate are &#8220;m&#8221; and &#8220;f&#8221;. But what does it <em>mean<\/em>? That, you can&#8217;t find out until I tell you what the <em>semantics<\/em> of the statement are.<\/p>\n<p> Now, suppose I tell you &#8220;P&#8221; is a predicate with two parameters, that says the <em>second<\/em><br \/>\nparameter is a parent of the first; that &#8220;m&#8221; is me; and that &#8220;f&#8221; is my father, then you can see that the meaning of the statement is &#8220;My father is one of my parents&#8221;.<\/p>\n<p> One of the interesting things about logic inference rules is that they are <em>semantics independent<\/em> &#8211; given a set of statements in FOPL, I <em>don&#8217;t need to know<\/em> what the predicates mean, or what objects are represented by the primitives. I can still perform inferences,<br \/>\ngenerating <em>new<\/em> true statements without knowing what they mean. But after I&#8217;ve got the<br \/>\nresult of the inferences, if you tell me what the predicates mean and what the primitives represent, the statements that I inferred <em>will<\/em> be true &#8211; even though I didn&#8217;t know what I was reasoning about when I did the inference.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Another great basics topic, which came up in the comments from last fridays &#8220;logic&#8221; post, is the difference between syntax and semantics. This is an important distinction, made in logic, math, and computer science. The short version of it is: syntax is what a language looks like; semantics is what a language means. It&#8217;s basically [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[74,33],"tags":[],"class_list":["post-293","post","type-post","status-publish","format-standard","hentry","category-basics","category-logic"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4lzZS-4J","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/comments?post=293"}],"version-history":[{"count":0,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/293\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/media?parent=293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/categories?post=293"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/tags?post=293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}