<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Adam Taylor &#187; Software Engineering</title>
	<atom:link href="http://www.adamjctaylor.com/category/software-engineering/feed" rel="self" type="application/rss+xml" />
	<link>http://www.adamjctaylor.com</link>
	<description>Software Engineering, Marketing &#38; Business.</description>
	<lastBuildDate>Tue, 18 May 2010 11:52:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-beta1</generator>
		<item>
		<title>The Agile Manifesto</title>
		<link>http://www.adamjctaylor.com/the-agile-manifesto</link>
		<comments>http://www.adamjctaylor.com/the-agile-manifesto#comments</comments>
		<pubDate>Tue, 18 May 2010 11:51:46 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[agile]]></category>

		<guid isPermaLink="false">http://www.adamjctaylor.com/?p=808</guid>
		<description><![CDATA[The agile manifesto is a set of 12 principles for developing software in an agile manner, somewhat similar to eXtreme Programming. Our highest priority is to satisfy the customer through early and continuous delivery of valuable software. Welcome changing requirements, even late in development. Agile processes harness change for the customer&#8217;s competitive advantage. Deliver working [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>The agile manifesto is a set of 12 principles for developing software in an agile manner, somewhat similar to <a href="http://www.adamjctaylor.com/a-brief-overview-of-extreme-programming">eXtreme Programming</a>.</p>
<ol>
<li>Our highest priority is to satisfy the customer through early and continuous delivery of valuable software.</li>
<li>Welcome changing requirements, even late in development. Agile processes harness change for the customer&#8217;s competitive advantage.</li>
<li>Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter timescale.</li>
<li>Business people and developers must work together daily throughout the project.</li>
<li>Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.</li>
<li>The most efficient and effective method of conveying information to and within a development team is face-to-face conversation.</li>
<li>Working software is the primary measure of progress.</li>
<li>Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely.</li>
<li>Continuous attention to technical excellence and good design enhances agility.</li>
<li>Simplicity &#8211; the art of maximizing the amount of work not done &#8211; is essential.</li>
<li>The best architectures, requirements, and designs emerge from self-organizing teams.</li>
<li>At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.</li>
</ol>
<p>Shame <a href="http://agilemanifesto.org/">their website</a> is so ugly.</p>


<p>Related posts:<ol><li><a href='http://www.adamjctaylor.com/a-brief-overview-of-extreme-programming' rel='bookmark' title='Permanent Link: A Brief Overview of eXtreme Programming'>A Brief Overview of eXtreme Programming</a></li><li><a href='http://www.adamjctaylor.com/the-mechanics-of-interaction' rel='bookmark' title='Permanent Link: The Mechanics of Interaction'>The Mechanics of Interaction</a></li><li><a href='http://www.adamjctaylor.com/user-centered-interaction-design' rel='bookmark' title='Permanent Link: User-Centered Interaction Design'>User-Centered Interaction Design</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.adamjctaylor.com/the-agile-manifesto/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Brief Overview of eXtreme Programming</title>
		<link>http://www.adamjctaylor.com/a-brief-overview-of-extreme-programming</link>
		<comments>http://www.adamjctaylor.com/a-brief-overview-of-extreme-programming#comments</comments>
		<pubDate>Tue, 18 May 2010 11:28:17 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[agile]]></category>

		<guid isPermaLink="false">http://www.adamjctaylor.com/?p=797</guid>
		<description><![CDATA[eXtreme Programming (XP) is an agile development methodology developed by Kent Beck et al. It emphasises the human aspect of software development and how issues such as respect, trust and communication are key issues along with purely technical aspects of software development. It is agile in the sense that Beck is strongly against giant requirement [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>eXtreme Programming (XP) is an agile development methodology developed by <a href="http://www.extremeprogramming.org/">Kent Beck et al</a>.  It emphasises the human aspect of software development and how issues such as respect, trust and communication are key issues along with purely technical aspects of software development.</p>
<p>It is agile in the sense that Beck is strongly against giant requirement documents and the waterfall model of software development in general, preferring to build the simplest system that solves the current customers problems, and iterating from there with rapid (weekly/monthly) feedback loops.</p>
<p>The core ideology of XP is explained in a series of complementary values, principles and practices.</p>
<p><span id="more-797"></span></p>
<h3>Core Values of eXtreme Programming</h3>
<p>Values are the abstract issues and ideas that XP practitioners feel are important for a project to be a success, they guide the principles and practices.</p>
<ul>
<li><strong>Communication</strong> &#8211; communication is important for creating a sense of team and effective communication.  Most often when you encounter a problem, someone else on the team already knows the solution.</li>
<li><strong>Simplicity</strong> &#8211; develop the simplest system <em>that could possibly work</em>.</li>
<li><strong>Feedback</strong> &#8211; change in a project is inevitable, so rapid feedback is required to adapt the project to changing requirements.</li>
<li><strong>Courage</strong> &#8211; effective action in the face of fear.  Knowing there is a problem and having the courage to fix it.</li>
<li><strong>Respect</strong> &#8211; the contributions of each person on the team need to be respected.</li>
<li><strong>Others</strong> &#8211; there may be other values that are particularly important to certain types of projects, such as safety and security.</li>
</ul>
<h3>Core Principles of eXtreme Programming</h3>
<p>Values are too abstract to directly guide behaviour.  Specific principles are needed to guide the practices of software development.</p>
<ul>
<li><strong>Humanity</strong> &#8211; people develop software, therefore software development must meet basic human needs such as: safety, accomplishment, belonging and growth.</li>
<li><strong>Economics</strong> &#8211; the project must have business value, meet business goals and serve business needs.</li>
<li><strong>Mutual Benefit</strong> &#8211; every activity should benefit all involved. A practice should benefit you now, you in the future and your customer.</li>
<li><strong>Self-Similarity</strong> &#8211; try copying the structure of one solution into a new context.</li>
<li><strong>Improvement</strong> &#8211; get an activity started right away but refine the results over time (iterative development).</li>
<li><strong>Diversity</strong> &#8211; teams need a variety of skills, attitudes and perspectives to see problems and pitfalls.</li>
<li><strong>Reflection</strong> &#8211; good teams don&#8217;t hide their mistakes, they expose them and learn from them.</li>
<li><strong>Flow</strong> &#8211; deliver a steady flow of valuable software by engaging in all the activities of development simultaneously.</li>
<li><strong>Opportunity</strong> &#8211; problems need to turn into opportunities for learning and improvement, not just survival.</li>
<li><strong>Redundancy</strong> &#8211; the critical, difficult problems in software development should be solved in several different ways.</li>
<li><strong>Failure</strong> &#8211; if you&#8217;re having trouble succeeding, fail. Risking failure can sometimes be the shortest road to success.</li>
<li><strong>Quality</strong> &#8211; sacrificing quality is not effective as a means of control.</li>
<li><strong>Baby Steps</strong> &#8211; baby steps acknowledge that the overhead of small steps is much less than when a team wastefully aborts big changes.</li>
<li><strong>Accepted Responsibility</strong> &#8211; the above practices reflect accepted responsibility by, for example, suggesting that whoever signs up to do work also estimates it.</li>
</ul>
<h3>Primary Practices of eXtreme Programming</h3>
<p>The practices are the things XP teams do day-to-day.  The primary practices are the key practices that need to be fully adopted before the secondary practices can be adopted.</p>
<ul>
<li><strong>Sit Together</strong> &#8211; having a big, open space, where people can sit together encourages communication, collaboration and co-operation. Privacy needs can be meet by secluded workstations around the edge of the area.</li>
<li><strong>Whole Team</strong> &#8211; include on the team people with all the skills and perspectives necessary for the project to succeed.</li>
<li><strong>Informative Workspace</strong> &#8211; make the workspace about the work. It should be informative: stories on one wall, tasks on another, etc.</li>
<li><strong>Energised Work</strong> &#8211; work only as many hours as you can be productive and only as many hours as you can sustain.</li>
<li><strong>Pair Programming</strong> &#8211; write all the production code with two people sitting at one machine.</li>
<li><strong>Stories</strong> &#8211; plan using units of customer-visible functionality. As soon as a story is written, try to estimate the development effort necessary to implement it.</li>
<li><strong>Weekly Cycle</strong> &#8211; plan work a week at a time. Have a meeting at the start of the week to review progress, have customers pick a weeks worth of stories and break the stories into tasks.</li>
<li><strong>Quarterly Cycle</strong> &#8211; plan work a quarter at a time. Once a quarter reflect on the team, the project, its progress, and its alignment with larger goals.</li>
<li><strong>Slack</strong> &#8211; in any plan, include some minor tasks that can be dropped if you get behind.</li>
<li><strong>Ten-Minute Build</strong> &#8211; automatically build the whole system and run all the tests in ten minutes, any longer, and it will be used less often, missing the opportunity for feedback.</li>
<li><strong>Continuous Integration</strong> &#8211; integrate and test changes after no more than a couple of hours. The longer you wait to integrate, the more it costs and the more unpredictable it becomes.</li>
<li><strong>Test-First Programming</strong> &#8211; write a failing automated test before changing any code. This helps address scope creep, coupling and cohesion, and trust.</li>
<li><strong>Incremental Design</strong> &#8211; strive to make the design of the system an excellent fit for the needs of the system that day.</li>
</ul>
<h3>Secondary Practices of eXtreme Programming</h3>
<p>The secondary practices should only be adopted after successful adoption of the primary practices. It would be dangerous to deploy everyday without a low defect rate (due to test-first programming, continuous integration etc.).</p>
<ul>
<li><strong>Real Customer Involvement</strong> &#8211; people whos lives and business are affected by your system should be part of the team. Visionary customers could be part of the quarterly or weekly planning.</li>
<li><strong>Incremental Deployment</strong> &#8211; big &#8220;D Day&#8221; deployment hardly ever works. Deploy limited functionality at a time and run both systems in parallel.</li>
<li><strong>Team Continuity</strong> &#8211; keep effective teams together.</li>
<li><strong>Shrinking Teams</strong> &#8211; as a team grows in capability, keep its workload constant but gradually reduce its size.</li>
<li><strong>Root-Cause Analysis</strong> &#8211; every time a defect is found after deployment, eliminate the defect and its cause. The goal is to make sure the team will never make the same kind of mistake again.</li>
<li><strong>Shared Code</strong> &#8211; anyone on the team can improve any part of the system at any time.</li>
<li><strong>Code and Tests</strong> &#8211; maintain only the code and tests as permanent artifacts. Generate other documents from code and tests.</li>
<li><strong>Single Code Base</strong> &#8211; there is only a single code stream. You can develop in a temporary branch, but never let it live longer than a few hours.</li>
<li><strong>Daily Deployment</strong> &#8211; put new software into production every night. Any gap between what is on a programmer&#8217;s desk and what is in production is a risk.</li>
<li><strong>Negotiated Scope Project</strong> &#8211; write contracts for software development that fix time, costs and quality but call for an ongoing negotiation of the precise scope of the system.</li>
<li><strong>Pay-Per-Use</strong> &#8211; with a pay-per-use system, you charge for every time the system is used. Money is the ultimate feedback.</li>
</ul>
<p>So that covers the basic values, principles and practices of XP. For a more detailed look check out Beck&#8217;s book, <a href="http://bit.ly/9q6Rp2">eXtreme Programming Explained</a> [aff].</p>


<p>Related posts:<ol><li><a href='http://www.adamjctaylor.com/the-agile-manifesto' rel='bookmark' title='Permanent Link: The Agile Manifesto'>The Agile Manifesto</a></li><li><a href='http://www.adamjctaylor.com/what-is-interaction-design' rel='bookmark' title='Permanent Link: What Is Interaction Design?'>What Is Interaction Design?</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.adamjctaylor.com/a-brief-overview-of-extreme-programming/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Deductive Reasoning Agents</title>
		<link>http://www.adamjctaylor.com/deductive-reasoning-agents</link>
		<comments>http://www.adamjctaylor.com/deductive-reasoning-agents#comments</comments>
		<pubDate>Fri, 07 May 2010 22:15:34 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[mas]]></category>

		<guid isPermaLink="false">http://www.adamjctaylor.com/?p=793</guid>
		<description><![CDATA[A deductive reasoning agent is one that contains an explicitily represented, symbolic model of the world. It then makes decisions via symbolic reasoning. Limitations When building an agent this way there are two key problems that have to be solved. The Transduction Problem This is the problem of translating the real world into accurate, adequate [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>A deductive reasoning agent is one that contains an explicitily represented, symbolic model of the world.  It then makes decisions via symbolic reasoning.</p>
<h3>Limitations</h3>
<p>When building an agent this way there are two key problems that have to be solved.</p>
<h4>The Transduction Problem</h4>
<p>This is the problem of translating the real world into accurate, adequate symbolic description, in time for that description to be useful&#8230;</p>
<p>These are problems of vision, speech understanding, learning etc.</p>
<h4>The Representation/Reasoning Problem</h4>
<p>This is the problem of how to symbolically represent information about complex real-world entities and processes and how to get agents to reason with this information in time for the results to be useful&#8230;</p>
<p>These are problems of knowledge representation, automated reasoning, automatic planning etc.</p>


<p>Related posts:<ol><li><a href='http://www.adamjctaylor.com/agent-architecture' rel='bookmark' title='Permanent Link: Agent Architecture'>Agent Architecture</a></li><li><a href='http://www.adamjctaylor.com/what-is-an-agent' rel='bookmark' title='Permanent Link: What is an Agent?'>What is an Agent?</a></li><li><a href='http://www.adamjctaylor.com/program-comprehension-strategies' rel='bookmark' title='Permanent Link: Program Comprehension Strategies'>Program Comprehension Strategies</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.adamjctaylor.com/deductive-reasoning-agents/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Agent Tasks</title>
		<link>http://www.adamjctaylor.com/agent-tasks</link>
		<comments>http://www.adamjctaylor.com/agent-tasks#comments</comments>
		<pubDate>Mon, 03 May 2010 18:41:49 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[mas]]></category>

		<guid isPermaLink="false">http://www.adamjctaylor.com/?p=790</guid>
		<description><![CDATA[After defining some basic concepts related to agent architecture it is important that we understand how to provide agents with the means to complete tasks. We want agents to be able to complete the tasks we specify but without us having to tell them how to complete the task. Utility One possibility of having agents [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>After defining some basic <a href="http://www.adamjctaylor.com/agent-architecture">concepts related to agent architecture</a> it is important that we understand how to provide agents with the means to complete tasks.</p>
<p>We want agents to be able to complete the tasks we specify but without us having to tell them how to complete the task.</p>
<p><span id="more-790"></span></p>
<h3>Utility</h3>
<p>One possibility of having agents complete tasks is to associate <em>utilities</em> with individual states and then have the agent aim to bring about states that maximise utility.</p>
<p>A task specification is a function: <code>u : E -> R</code> (where R is a real number). So we associate a value with every environment state.</p>
<p>But with this idea, what is the utility of a run (remember that a run is a set of states)&#8230; ?</p>
<p>Another possibility is to assign a utility to runs themselves:</p>
<p><code>u : <em>R</em> -> R</code>.  </p>
<p>This takes a more long term view than the previous approach.</p>
<h3>Optimal Agents</h3>
<p>The optimal agent in an environment is the one that maximises the expected utility.</p>
<p>Some agents cannot be implemented on some computers (some functions may require more memory than is available).</p>
<p>A <em>bounded optimal agent</em> is the agent,  that can be implemented, that maximises expected utility.</p>
<h3>Task Specification</h3>
<p>0 or 1 can be assigned to previous runs, where 1 indicates that the agent succeeds, otherwise it fails.</p>
<p>These are known as <em>predicate task specifications</em>.</p>
<p>A task environment is a pair of enviornments and predicate task specifications.</p>
<h3>Achievement and Maintenance Tasks</h3>
<p>The two most common types of tasks are achievement and maintenance tasks.</p>
<p>An achievement task is one of the form: &#8220;achieve state of affairs&#8221;.</p>
<p>A maintenance task is one of the form: &#8220;maintain state of affairs&#8221;.</p>


<p>Related posts:<ol><li><a href='http://www.adamjctaylor.com/agent-architecture' rel='bookmark' title='Permanent Link: Agent Architecture'>Agent Architecture</a></li><li><a href='http://www.adamjctaylor.com/what-is-an-agent' rel='bookmark' title='Permanent Link: What is an Agent?'>What is an Agent?</a></li><li><a href='http://www.adamjctaylor.com/deductive-reasoning-agents' rel='bookmark' title='Permanent Link: Deductive Reasoning Agents'>Deductive Reasoning Agents</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.adamjctaylor.com/agent-tasks/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Agent Architecture</title>
		<link>http://www.adamjctaylor.com/agent-architecture</link>
		<comments>http://www.adamjctaylor.com/agent-architecture#comments</comments>
		<pubDate>Mon, 03 May 2010 17:38:02 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[mas]]></category>

		<guid isPermaLink="false">http://www.adamjctaylor.com/?p=773</guid>
		<description><![CDATA[Following on from our introduction to agents it&#8217;s important to understand the architecture of agents. Abstract Architecture Environment We assume the environment may be in any of a finate set of discrete, instantaneous states, defined as: E = {e,e,,...}. Actions Agents are assumed to have a repertoire of possible actions: Ac = {α,α,,...}. Run A [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Following on from our <a href="http://www.adamjctaylor.com/what-is-an-agent">introduction to agents</a> it&#8217;s important to understand the architecture of agents.</p>
<h3>Abstract Architecture</h3>
<h4>Environment</h4>
<p>We assume the environment may be in any of a finate set of discrete, instantaneous states, defined as:</p>
<p><code>E = {e,e<sup>,</sup>,...}.</code></p>
<h4>Actions</h4>
<p>Agents are assumed to have a repertoire of possible actions:</p>
<p><code>Ac = {α,α<sup>,</sup>,...}.</code></p>
<h4>Run</h4>
<p>A run of an agent in an environment is a sequence of interleaved environment states and actions:</p>
<p><span id="more-773"></span></p>
<p><code> α<sub>0</sub> α<sub>1</sub> α<sub>2</sub> α<sub>n</sub><br />
<code>r : e<sub>0</sub> -&gt; e<sub>1</sub> -&gt; e<sub>2</sub> -&gt; ... -&gt; e<sub>n</sub></code></code></p>
<h4>State Transformer</h4>
<p>Let <code>R</code> be the set of all possible finate sequences over E and Ac.</p>
<p>Let <code>R<sup>Ac</sup></code> be the subset of these that end in an action.</p>
<p>Le <code>R<sup>E</sup></code> be the supset of these that end with an environment state.</p>
<p>A state transformer function represents behaviour of the environment:</p>
<p><code> t : R<sup>Ac</sup> -&gt; 2<sup>E</sup></code></p>
<p>If <code>t(r) = the empty set</code>, then there are no possible successor states to r and the system has <em>ended its run</em>.</p>
<h4>Agent</h4>
<p>An agent is a function that maps runs into actions:</p>
<p><code>Ag: R<sup>E</sup> -&gt; Ac</code></p>
<p>An agent makes a decision about what to perform based on the history of the system that it has witnessed to date.</p>
<h3>Perception</h3>
<p>An agent can determine atrributes of the environment through sensors.</p>
<p>The <em>see</em> function is the agent&#8217;s ability to observe its environment, whereas the <em>action</em> function is the agent&#8217;s decision making process.</p>
<p>The output of the see function is a percept:</p>
<p><code>see : Per* -&gt; Ac</code></p>
<p>Also, action is now a function, it maps sequences of percepts to actions:</p>
<p><code>action : Per* -&gt; Ac</code></p>
<h3>Reactive Agents</h3>
<p>Reactive agents decide what to do without reference to history.  They base their decision making entirely on the present.  They have actions corrosponding to particular percepts, and perform them when they sense them.</p>
<h3>Agents with State</h3>
<p>Some agents maintain state.  They have an internal data structure used to record information about the environment state.</p>
<p>Let <em>I</em> be the set of internal states of the agent.  The agent function action is now defined as a mapping from internal states to actions:</p>
<p><code>action : <em>I</em> -&gt; Ac</code></p>
<p>An additional function, next, is also introduced to map an internal state and a percept to another internal state:</p>
<p><code>next : <em>I</em> x Per -&gt; <em>I</em></code></p>
<h4>Agent Control Loop</h4>
<ol>
<li>Agent starts in some initial internal state <code>i<sub>0</sub></code></li>
<li>Observes it&#8217;s environment state <code>e</code>, and generates a percept <code>see(e)</code></li>
<li>Internal state of the agent is then updated via <code>next</code> function, becoming <code>next(i<sub>0</sub>, see(e))</code></li>
<li>The action selected by the agent is <code>action(next(i<sub>0</sub>, see(e)))</code></li>
<li>Goto 2</li>
</ol>
<h3>Agent Architectures</h3>
<p>There are three particular types of agent architectures: deductive reasoning agents, practical reasoning agents and reactive/hybrid agents.</p>


<p>Related posts:<ol><li><a href='http://www.adamjctaylor.com/what-is-an-agent' rel='bookmark' title='Permanent Link: What is an Agent?'>What is an Agent?</a></li><li><a href='http://www.adamjctaylor.com/agent-tasks' rel='bookmark' title='Permanent Link: Agent Tasks'>Agent Tasks</a></li><li><a href='http://www.adamjctaylor.com/deductive-reasoning-agents' rel='bookmark' title='Permanent Link: Deductive Reasoning Agents'>Deductive Reasoning Agents</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.adamjctaylor.com/agent-architecture/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What is an Agent?</title>
		<link>http://www.adamjctaylor.com/what-is-an-agent</link>
		<comments>http://www.adamjctaylor.com/what-is-an-agent#comments</comments>
		<pubDate>Thu, 29 Apr 2010 18:20:44 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[mas]]></category>

		<guid isPermaLink="false">http://www.adamjctaylor.com/?p=766</guid>
		<description><![CDATA[An agent is a computer system that is capable of independent action on behalf its user/owner (figuring out what to be done to satisfy design objectives, not constantly being told). The main idea behind agents is the idea that they are autonomous: they are able act independently, exhibiting control over their internal state. Definition An [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>An agent is a computer system that is capable of <em>independent</em> action on behalf its user/owner (figuring out what to be done to satisfy design objectives, not constantly being told).</p>
<p>The main idea behind agents is the idea that they are autonomous: they are able act independently, exhibiting control over their internal state.</p>
<h3>Definition</h3>
<p>An agent is a computer system capable of autonomous action in some environment in order to meet its design objectives.</p>
<p><span id="more-766"></span></p>
<h3>Agent Environments</h3>
<p>There are various types of environments an agent can exist in:</p>
<ul>
<li>Accessible vs. inaccessible</li>
<li>Deterministic vs. non-deterministic</li>
<li>Episodic vs. non-episodic</li>
<li>Static vs. dynamic</li>
<li>Discrete vs. continuous</li>
</ul>
<p>An <em>accessible environment</em> is one where the agent can obtain complete, accurate, up-to-date information about the environment&#8217;s state.  Most moderately complex environments are inaccessible.</p>
<p>A <em>deterministic environment</em> is one in which any agent action has a single guaranteed effect.  In a non-deterministic environment an action could have many possible effects/outcomes.</p>
<p>In an <em>episodic environment</em> an agent sees the environment as separate &#8220;episodes&#8221; and need not worry about past or present &#8220;episodes&#8221; when making a decision.</p>
<p>In a <em>static environment</em> only the actions of the agent causes changes in the state of the environment.</p>
<p>An environment is <em>discrete</em> if there are only a certain number of actions and percepts in it, e.g. a chess board.</p>
<h3>Agent Properties</h3>
<p>There are some trivial examples of agents, e.g. a thermostat (if the temperature drops below x, turn the heating on) but an intelligent agent has a number of properties that allow it to perform flexible, autonomous actions within an environment.</p>
<h4>Reactive</h4>
<p>A <em>reactive</em> system is one that maintains an ongoing interaction with its environment, and responds to changes that occur within it.</p>
<h4>Proactive</h4>
<p>Proactiveness is about agents taking the initiative and seizing opportunities by generating and attempting to achieve goals.</p>
<h4>Social Ability</h4>
<p>The real world is a multi-agent environment, it&#8217;s not possible to achieve goals without taking others into account.</p>
<p>An agent&#8217;s <em>social ability</em> is the agent&#8217;s ability to interact with other agents (and possibly humans) through some kind of agent-communication language.</p>


<p>Related posts:<ol><li><a href='http://www.adamjctaylor.com/agent-architecture' rel='bookmark' title='Permanent Link: Agent Architecture'>Agent Architecture</a></li><li><a href='http://www.adamjctaylor.com/agent-tasks' rel='bookmark' title='Permanent Link: Agent Tasks'>Agent Tasks</a></li><li><a href='http://www.adamjctaylor.com/deductive-reasoning-agents' rel='bookmark' title='Permanent Link: Deductive Reasoning Agents'>Deductive Reasoning Agents</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.adamjctaylor.com/what-is-an-agent/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Project Management for Adults &#8211; Why bother with Risk Managament?</title>
		<link>http://www.adamjctaylor.com/project-management-for-adults-why-bother-with-risk-managament</link>
		<comments>http://www.adamjctaylor.com/project-management-for-adults-why-bother-with-risk-managament#comments</comments>
		<pubDate>Sun, 25 Apr 2010 20:55:04 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[risk]]></category>

		<guid isPermaLink="false">http://www.adamjctaylor.com/?p=762</guid>
		<description><![CDATA[If a project has no risk, don&#8217;t do it! Risks and benefits always go hand in hand. A Risk Metaphor Imagine your company, and your competitors as a set of down escalators. You are obliged to climb the escalator. If you pause, even for a second, you will begin to fall behind. Whoever, reaches the [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>If a project has no risk, don&#8217;t do it!  Risks and benefits always go hand in hand.</p>
<h3>A Risk Metaphor</h3>
<p>Imagine your company, and your competitors as a set of down escalators.  You are obliged to climb the escalator. If you pause, even for a second, you will begin to fall behind.  Whoever, reaches the top of their escalator will find a leaver, allowing them to control the speed of their and their competitors escalators.  It&#8217;s the risks you take that speed up the stairs for everyone else.  Not taking them just ensures your world will be shaped and dominated by someone else.</p>
<p>In this era, <em>risk taking is rewarded</em>.</p>
<p><span id="more-762"></span></p>
<h3>Project Management for Adults</h3>
<p>Risk management can be thought of as project management for adults.  When project managers do not explicitly manage risk, they are being childlike.</p>
<p>When a project manager considers only the rosy scenario, and ignores risks in the project plan, they are behaving like a kid.</p>
<p>Project managers need to grow up and take explicit note of the risks and plan accordingly.</p>
<h3>Risk: A definition</h3>
<p>Risk can be defined as:</p>
<p><em><strong>risk</strong> n 1: a possible future event that will lead to an undesirable outcome 2: the undesirable outcome itself</em></p>
<p>Risks can also be related to problems, consider the following:</p>
<p>A <em>risk</em> is a problem that has yet to occur, a <em>problem</em> is a risk that has already materialised.</p>
<h3>Transition and Mitigation</h3>
<p>For every risk to be managed, there will be some kind of transition indicator.  The reason to pay attention to the transition, is that when the indicator fires, the manager must take action.</p>
<p>Before the transition, it&#8217;s too early to take action &#8211; it may be too expensive or time consuming.  However, some actions must be taken to allow you to keep your options open and make the correction after the transition, this work is called <em>mitigation</em>.</p>
<h3>The Practice of Risk Management</h3>
<ul>
<li><em>risk discovery:</em> your initial risk brainstorm and subsequent triage, plus whatever mechanism you put in place to keep the process going</li>
<li><em>exposure analysis:</em> quantification of each risk in terms of its probability of materialising and its potential damage</li>
<li><em>contingency planning:</em> what you expect to do if and when the risk materialises</li>
<li><em>mitigation:</em> steps that must be taken before the transition in order to make the planned contingency actions possible and effective when required</li>
<li><em>ongoing transition monitoring:</em> tracking of managed risks, looking for materialisation</li>
</ul>
<h3>Why Manage Risk?</h3>
<p>Imagine a software project manager approaches you and clearly states his uncertainty about your proposed project:</p>
<blockquote><p>&#8220;there are unknowns here, and we have catalogued the following risks.  Taken together these unknowns give us a fairly wide window of uncertainty around the delivery date.</p>
<p>But here is our plan for how we will act to contain and minimise the various downside risks, and here is how you will know at any point in the project how we are fairing.&#8221;</p></blockquote>
<p>Now you can know where you stand.  The willingness to commit to a risky project is a direct function of how well you can logically conclude that the risks have been assessed, quantified and confronted.</p>
<p>Other reasons to manage risk:</p>
<ul>
<li><em>Risk management decriminalises risk</em> &#8211; risk management is a <em>can&#8217;t-do</em> activity.  Announcing risks can have the announcer written off as a whiner.  Formal risk management authorises people to think negatively, at least some of the time.</li>
<li><em>Risk management sets up projects for success</em> &#8211; in the absence of risk management, achieving anything but the most optimistic result is a failure.</li>
<li><em>Risk management bounds uncertainty</em> &#8211; risk management allows you to make thoughtful, informed decisions about how to proceed.</li>
<li><em>Risk management provides minimum-cost downside protection</em> &#8211; risk management allows you to know how much time and money to give yourself as sensible protection from risks.</li>
<li><em>Risk management protects against invisible transfers of responsibility</em> &#8211; in the absence of risk management, subtle transfers of risk responsibility may often go unnoticed.</li>
<li><em>Risk management can save part of a failed effort</em> &#8211; the failure of one component should not jeopardise the whole project.</li>
<li><em>Risk management maximises opportunity for personal growth</em> &#8211; by not taking risk, consequently, companies do not move into new territory, which is boring for employees, and the best may leave.</li>
<li><em>Risk management maximises protects management from getting blindsided</em> &#8211; risk management assures that risk won&#8217;t appear from out of the blue.</li>
<li><em>Risk management focuses attention where it is needed</em> &#8211; risk management is a focussing mechanism, one that puts resources where they belong.</li>
</ul>


<p>Related posts:<ol><li><a href='http://www.adamjctaylor.com/current-geek-reading-list' rel='bookmark' title='Permanent Link: Current Geek Reading List'>Current Geek Reading List</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.adamjctaylor.com/project-management-for-adults-why-bother-with-risk-managament/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Floyd-Hoare Logic</title>
		<link>http://www.adamjctaylor.com/floyd-hoare-logic</link>
		<comments>http://www.adamjctaylor.com/floyd-hoare-logic#comments</comments>
		<pubDate>Sun, 25 Apr 2010 14:05:44 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[verification]]></category>

		<guid isPermaLink="false">http://www.adamjctaylor.com/?p=735</guid>
		<description><![CDATA[Floyd-Hoare Logic is a formal system with a set of logical rules for reasoning rigorously about the correctness of computer programmes. The central feature is the Hoare triple. Hoare Triples A Hoare triple {P} C {Q} is a formula. P, Q are fomulae in a base logic (e.g. full predicate logic etc.) and C is [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Floyd-Hoare Logic is a formal system with a set of logical rules for reasoning rigorously about the correctness of computer programmes. The central feature is the <em>Hoare triple</em>.</p>
<h3>Hoare Triples</h3>
<p>A Hoare triple <code>{P} C {Q}</code> is a formula.</p>
<p>P, Q are fomulae in a base logic (e.g. full predicate logic etc.) and C is a programme in <a href="http://www.adamjctaylor.com/stacks-heaps-variables-and-pointers">our imperative language</a>.</p>
<p><span id="more-735"></span></p>
<p>P is known as the <em>precondition</em>, while Q is known as the <em>postcondition</em>.</p>
<p>This is known as a <em>partial correctness specification</em> and is valid, <em>if and only if</em>, starting from a state (s1,h1) satisfying P:</p>
<ul>
<li>No execution of C access an unallocated heap cell (no memory error).</li>
<li>Whenever an execution of C terminates in state (s2,h2), then (s2,h2) |= Q.</li>
</ul>
<h3>Assignment Axiom</h3>
<p>The assignment axiom applies to the following programme constructs:</p>
<p><code>E ::= x | n | E+E | -E | ...</code> &#8211; Heap-independent expressions, where <code>x = variable</code> and <code>n = constant</code>.<br />
<code>C :: x := E</code> &#8211; Assignment statements.</p>
<h4>Hoare Inference Rule</h4>
<p><code>{P[x -> E]} x := E {P}</code> &#8211; All free occurrences of the variable x, are replaced by the variable E.</p>
<h4>Free and Bound Variables</h4>
<p>When a quantifier is used on a variable, this occurrence of the variable is <em>bound</em>. An occurrence of a variable that is not bound by a quantifier or set equal to a particular variable is <em>free</em>.</p>
<p>In the statement <code>∃x(x + y = 1)</code>, the variable x is <em>bound</em> by the existential quantification <code>∃x</code>, but the variable y is free because it is not bound by a quantifier and no value is assigned to this variable.</p>
<p>However, in the statement <code>∃x(P(x) ∧ Q(x)) ∨ ∀xR(x)</code> all variables are bound.</p>
<h4>Examples:</h4>
<p><code>{ (x + z . y)<sup>2</sup> > 25 } x := x + z * y { x<sup>2</sup> > 25 }</code><br />
<code>{ (z . y > 5) ∧ (∃x. y = x<sup>x</sup>) } x := z * y { (x > 5) ∧ (∃x. y = x<sup>x</sup>) }</code></p>
<p><!-- add explanation --></p>
<h3>Sequential Composition Rule</h3>
<p>The sequential composition rule applies to the following programme construct:</p>
<p><code>C ::= C1, C2</code> &#8211; The sequencing of commands.</p>
<h4>Hoare Inference Rule</h4>
<p><code>{P} C<sub>1</sub> {R}</code> &nbsp;&nbsp;&nbsp;&nbsp; <code>{R} C<sub>2</sub> {Q}</code></p>
<p>becomes&#8230;</p>
<p><code>{P} C<sub>1</sub>; C<sub>2</sub> {Q}</code></p>
<h4>Examples:</h4>
<p><code>{y + z > 4} y := y + z - 1 {y > 3}</code> &nbsp;&nbsp;&nbsp;&nbsp; <code>{y > 3} x := y + 2 {x > 5}</code></p>
<p>becomes&#8230;</p>
<p><code>{y + z > 4} y := y + z - 1; x := y + 2 {x > 5}</code></p>
<h3>Rules of Consequence</h3>
<h4>Hoare Inference Rule</h4>
<p><code>P ⇒ P<sub>1</sub></code> &nbsp;&nbsp;&nbsp;&nbsp; <code>{P<sub>1</sub>} C {Q<sub>1</sub>}</code> &nbsp;&nbsp;&nbsp;&nbsp; <code>Q<sub>1</sub> ⇒ Q</code></p>
<p>becomes&#8230;</p>
<p><code>{P} C {Q}</code></p>
<h4>Examples:</h4>
<p><code>(y > 4) ∧ (z > 1) ⇒ (y + z > 5)</code><br />
<code>{y + z >5} y := y + z {y > 5}</code><br />
<code>(y > 5) ⇒ (y > 3)</code></p>
<p>So by the rule of consequence, we can rewrite the second fragment as:</p>
<p><code>{(y > 4) ∧ (z > 1)} y := y + z {y > 3}</code></p>
<h3>Conditional Rule</h3>
<p>The conditional rule applies to the following programme constructs:</p>
<p><code>E ::= x | n | E+E | -E | ...</code> &#8211; Heap independent expressions.<br />
<code>B ::= E=E | E>=E | B∧B | !B</code> &#8211; Boolean conditions.<br />
<code>C ::= if B then C1 else C2</code> &#8211; Conditional statements.</p>
<h4>Hoare Inference Rule</h4>
<p><code>{P ∧ B } C<sub>1</sub> {Q}</code> &nbsp;&nbsp;&nbsp;&nbsp; <code>{P ∧ !B} C<sub>2</sub> {Q}</code></p>
<p>becomes&#8230;</p>
<p><code>{P} if B then C<sub>1</sub> else C<sub>2</sub> {Q}</code></p>
<h4>Examples:</h4>
<p><code>{(y > 4) ∧ (z > 1)} y := y + z {y > 3}</code> &nbsp;&nbsp;&nbsp;&nbsp; <code>{(y > 4) ∧ !(z > 1)} y := y - 1 {y > 3}</code></p>
<p>becomes&#8230;</p>
<p><code>{y > 4} if (z > 1) then y : y + z else y := y - 1 {y > 3}</code></p>
<h3>While-Loop Rule</h3>
<p>The while-loop rule applies to the following programme constructs:</p>
<p><code>E ::= x | n | E+E | -E | ...</code> &#8211; Heap-independent expressions.<br />
<code>B ::= E=E | E>=E | B∧B | !B </code> &#8211; Boolean conditions.<br />
<code>C ::= while B C</code> &#8211; While loops.</p>
<h4>Hoare Inference Rule</h4>
<p><code>{P ∧ B} C {P}</code></p>
<p>becomes&#8230;</p>
<p><code>{P} while B C {P ∧ !B}</code></p>
<p>P is a <em>loop invariant</em>.  Because we are looking at partial correctness, the semantics say that, if the loop does not terminate, the Hoare triple is vacuously satisfied.  However, if it terminates, <code>P ∧ !B</code> must be satisfied.</p>
<h4>Examples:</h4>
<p><code>{(y = x + z) ∧ (z != 0)} x := x + 1; z := z - 1 {y = x + z}</code></p>
<p>becomes&#8230;</p>
<p><code>{y = x + z} while (z != 0) x := x + 1; z := z -1 {(y = x + z) ∧ (z = 0)}</code></p>


<p>Related posts:<ol><li><a href='http://www.adamjctaylor.com/stacks-heaps-variables-and-pointers' rel='bookmark' title='Permanent Link: Stacks, Heaps, Variables and Pointers'>Stacks, Heaps, Variables and Pointers</a></li><li><a href='http://www.adamjctaylor.com/a-simple-assertion-language-for-formal-verification' rel='bookmark' title='Permanent Link: A Simple Assertion Language for Formal Verification'>A Simple Assertion Language for Formal Verification</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.adamjctaylor.com/floyd-hoare-logic/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Simple Assertion Language for Formal Verification</title>
		<link>http://www.adamjctaylor.com/a-simple-assertion-language-for-formal-verification</link>
		<comments>http://www.adamjctaylor.com/a-simple-assertion-language-for-formal-verification#comments</comments>
		<pubDate>Wed, 21 Apr 2010 21:49:55 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[verification]]></category>

		<guid isPermaLink="false">http://www.adamjctaylor.com/?p=710</guid>
		<description><![CDATA[Following on from our introduction of the basic concepts required to start to understand formal verification, we shall define a simple assertion language. An assertion is a logic formula describing a set of states with some &#8220;interesting&#8221; property. Also, recall that States = Stacks x Heaps, so an assertion can refer to both stack and [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Following on from our <a href="http://www.adamjctaylor.com/stacks-heaps-variables-and-pointers">introduction of the basic concepts required to start to understand formal verification</a>, we shall define a simple assertion language.</p>
<p>An assertion is a <em>logic formula</em> describing a set of states with some &#8220;interesting&#8221; property.  Also, recall that <code>States = Stacks x Heaps</code>, so an assertion can refer to both stack and heap.</p>
<p><code>E, F ::= x | n | E + F | -E | ...</code> &#8211; Heap-independent expressions.<br />
<code>P, Q ::= E = F | E >= F</code> &#8211; Boolean conditions.<br />
<code> | true | P ^ Q | !P | ∀x.P</code> &#8211; Classical logic formula.<br />
<code> | emp | E -> F</code> &#8211; Atomic predicates on heap.  Where <code>emp = empty heap</code> and <code> -></code> = single cell of the heap.</p>
<p><span id="more-710"></span></p>
<h3>Semantics of Assertions</h3>
<p>An expression is a map between a stack to an integer:</p>
<p><code>[[E]] : Stacks -> Vals</code> &#8211; expressions are clearly heap independent.</p>
<p>The semantics of an assertion are given by a satisfaction relation between states and assertions:</p>
<p><code>(s,h) |= P</code> &#8211; where s = stack, h = heap (s and h together = the state) and P = assertion.</p>
<p>Example assertions:</p>
<p><code>(s,h) |= E >= F iff [[E]]s, [[F]s ∈ Vals and [[E]]s >= [[F]s</code><br />
The assertion is true, <em>if and only if</em>,  the expression E and the expression F, on the stack, are members of the set of values and that the value E is greater than or equal to the value F.</p>
<p><code>(s,h) |= true</code><br />
This assertion is always true.</p>
<p><code>(s,h) |= P ^ Q iff (s,h) |= P and (s,h) |= Q</code><br />
The assertion is true, <em>if and only if</em>, both P is true and Q is true.</p>
<p><code>(s,h) |= !P iff not (s,h) |= P</code><br />
The assertion is true, <em>if and only if</em>, P is not true.</p>
<p><code>(s,h) |= ∀x.P iff ∀v ∈ Vals.(s[x -> v],h) |= P</code><br />
The assertion is true, <em>if and only if</em>, for all the possible values of x, P is true.  </p>
<p><code>(s,h) |= emp iff h = []</code><br />
The assertion is true, <em>if and only if</em>,  the domain of the heap is equivalent to the empty set.</p>
<h3>Example</h3>
<p>Consider a program with two variables, x and y, both initialised to 0.</p>
<p>The assertion: <code>P: x -> y</code> and <code>Q: y<sup>2</sup> >= 20</code>.</p>
<table>
<thead>
<tr>
<th scope="col">PC</th>
<th scope="col">Program</th>
<th scope="col">Stack</th>
<th scope="col">Heap</th>
<th scope="col">Satisfy P?</th>
<th scope="col">Satisfy Q?</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>x := new (1);</td>
<td>x : 230, y : 0</td>
<td>230 : 2547</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>2</td>
<td>y := 37;</td>
<td>x : 230, y : 37</td>
<td>230 : 2547</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>3</td>
<td>[x] := y;</td>
<td>x : 230, y : 37</td>
<td>230 : 37</td>
<td>Yes</td>
<td>Yes</td>
</tr>
<tr>
<td>4</td>
<td>x := new (1);</td>
<td>x : 40, y : 37</td>
<td>230 : 37, 40 : 54</td>
<td>No</td>
<td>Yes</td>
</tr>
</tbody>
</table>
<p>Apologies the table doesn&#8217;t fit so well but let me walk through the programme:</p>
<p>At PC = 1 we assign x to a new pointer variable, this then places the value of x, or in this case, the memory location of x (230), onto the stack; while the value of y is still 0.  So in the heap is an entry for 230 (the memory location of x) with a value 2547 left from some previous programme or execution.  Neither assertion is true in this case because 0 is not greater than or equal to 20 and x is not pointing to y.</p>
<p>At PC = 2 we assign y to the value 37, which places the value 37 onto the stack.  Everything else remains the same.  The assertion P is still false but 37<sup>2></sup> <em>is</em> greater than or equal to 20, so the assertion Q is satisfied.</p>
<p>At PC = 3 we point the variable x to the value of y, which overwrites the old value for x in the heap with the new value, 37.  In this case both assertions, P and Q are satisfied.</p>
<p>At PC = 4, we assign x to a new pointer variable.  This updates the value for x in the stack, to the new memory location (40), and adds a new entry to the heap (the memory location of x and an old value).  In this case Q holds true while P is not true.</p>


<p>Related posts:<ol><li><a href='http://www.adamjctaylor.com/stacks-heaps-variables-and-pointers' rel='bookmark' title='Permanent Link: Stacks, Heaps, Variables and Pointers'>Stacks, Heaps, Variables and Pointers</a></li><li><a href='http://www.adamjctaylor.com/floyd-hoare-logic' rel='bookmark' title='Permanent Link: Floyd-Hoare Logic'>Floyd-Hoare Logic</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.adamjctaylor.com/a-simple-assertion-language-for-formal-verification/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stacks, Heaps, Variables and Pointers</title>
		<link>http://www.adamjctaylor.com/stacks-heaps-variables-and-pointers</link>
		<comments>http://www.adamjctaylor.com/stacks-heaps-variables-and-pointers#comments</comments>
		<pubDate>Wed, 21 Apr 2010 21:47:33 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[verification]]></category>

		<guid isPermaLink="false">http://www.adamjctaylor.com/?p=698</guid>
		<description><![CDATA[It is important to have a solid understanding of the difference between stacks and heaps, and variables and pointers, before one can embark on the task of learning about Formal Verification of C-like languages. What&#8217;s Formal Verification? Formal Verification is a branch of Computer Science responsible for formally proving the &#8220;correctness&#8221; of programmes. Usually, this [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>It is important to have a solid understanding of the difference between stacks and heaps, and variables and pointers, before one can embark on the task of learning about <em>Formal Verification</em> of C-like languages.</p>
<h3>What&#8217;s Formal Verification?</h3>
<p>Formal Verification is a branch of Computer Science responsible for formally proving the &#8220;correctness&#8221; of programmes.  Usually, this would be overkill but for certain classes of mission/safety-critical programmes, it is becoming more popular.  A short intro to formal verification can be found on <a href="http://en.wikipedia.org/wiki/Formal_verification" rel="nofollow">wikipedia</a> &#8211; otherwise stick around, we&#8217;ll be getting to formal verification shortly.</p>
<p><span id="more-698"></span></p>
<h3>Primer: LValues and RValues</h3>
<p>In C there is a concept of LValues and RValues.  </p>
<p>LValues are values that have an address, meaning that they are variables or dereferenced references to a certain memory location.  Conversely, RValues are <em>not</em> LValues.</p>
<p>An LValue, initially referred to values on the left side of an assignment operator, hence the name.  An example of an RValue is an &#8220;immediate value&#8221;, such as the expression <code>13 + 4</code>. There is no explicit memory location of that value.  On the other hand: <code>x = 13 + 4</code> &#8211; x is an LValue holding a reference to the memory location of the value of the expression.</p>
<h3>Primer: Variables</h3>
<p>A variable is simply a construct such as: <code>y = 3</code> (or in our simple language, see below: <code>y := 3</code>).  The variable is stored on the stack with a reference to the value.</p>
<h3>Primer: Pointers</h3>
<p>A pointer is a special type of variable that in the stack, instead of referencing the value, references a memory location, and at that memory location is the value of the variable.</p>
<p>In our simple language (see below) a pointer is constructed in the following manner:</p>
<p><code>x := new(1)</code> &#8211; create a new pointer variable at a random, free memory location (it may already contain a value if that particular memory location was previously written to).<br />
<code>[x] := 3</code> &#8211; at the memory location, referenced by the pointer, set the value to 3.</p>
<h3>Primer: [Call] Stacks</h3>
<p>A stack is a last-in, first-out (LIFO) data structure.  The easiest way to visualise it is to think of a stack of plates.  The last plate placed (pushed) onto the stack, will be the first plate pulled (popped) off the stack.  A stack, in this case, is a fixed area of memory, accessed in a last-in, first-out manner.  The stack has a limited/fixed size but generally has quicker allocation time than the heap (see below).</p>
<p>The call stack, often just called <em>the stack</em>, is used to store data about a program during its execution.  That data includes space for storing local variables within subroutines.</p>
<p>The stack <em>always</em> (in our simplified language at least, see below) maintains a value for each variable in the programme.  This is regardless of whether or not the variable is a pointer.</p>
<p>So for example, if <code>y = 43</code>, in the stack will be the variable <code>y</code> with a reference to the value <code>43</code>. If however, <code>y = new(1)</code> (new pointer), then in the stack will be the variable <code>y</code> with a reference to the memory address/location of the value of y.</p>
<h3>Primer: Heaps</h3>
<p>The heap, in this case, is a large pool of unused (free) memory address space.</p>
<h3>A Simple Imperative Language</h3>
<p>To simplify the verification work a simple, imperative language is defined, similar to a C-like language:</p>
<p><code>E ::= x | n | E+E | -E | ...</code> &#8211; Heap-independent expressions.<br />
<code>B ::= E=E | E>=E | B^B | !B |</code> &#8211; Boolean conditions.<br />
<code>C ::= x:=E | C;C | if B then C else C</code> &#8211; Standard constructs.<br />
<code>| while B C</code> &#8211; Looping constructs.<br />
<code>| X := new(E<sub>1</sub>,...En)</code> &#8211; Allocation on heap.<br />
<code>| x := [E]</code> &#8211; Lookup of heap.<br />
<code>| [E1] := E2</code> &#8211; Mutation of heap.<br />
<code>| dispose (E)</code> &#8211; Deallocation of heap.</p>
<h3>A Simple Storage Model</h3>
<p>Along with our simple imperative language, we have a simple storage model:</p>
<p><code>Variables = { x, y, z, ... }</code><br />
<code>Locations = { 1, 2, 3, 4, ... }</code> &#8211; as in memory locations.<br />
<code>Heaps = Locations -> Values</code> &#8211; A heap entry is a location pointing to a value.<br />
<code>Stacks = Variables -> Values</code> &#8211; A stack entry is a variable pointing to a value.<br />
<code>States = Stacks x Heaps</code> &#8211; A state is a pair of stacks and heaps.</p>


<p>Related posts:<ol><li><a href='http://www.adamjctaylor.com/a-simple-assertion-language-for-formal-verification' rel='bookmark' title='Permanent Link: A Simple Assertion Language for Formal Verification'>A Simple Assertion Language for Formal Verification</a></li><li><a href='http://www.adamjctaylor.com/floyd-hoare-logic' rel='bookmark' title='Permanent Link: Floyd-Hoare Logic'>Floyd-Hoare Logic</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.adamjctaylor.com/stacks-heaps-variables-and-pointers/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
