The document discusses different ways of thinking about programs, including as mathematical functions and as sequences of states. It argues that the most useful models for understanding programs are functions, which specify what a program does but not how, and sequences of states, which represent a program execution as a behavior consisting of a sequence of states. Some limitations of the functional model are that it does not capture how a program works or handle programs with non-terminating or stateful behaviors.
Create Computer Games - Get Started on Creating Your Own Virtual Worldstoilet08avenue
This document provides guidance on creating computer games from initial concept development through implementation. It recommends starting with well-thought-out game ideas and outlines, including character descriptions, story details, and gameplay descriptions. Proper planning helps avoid "development hell" where projects drag on indefinitely. The document also recommends using rapid application development tools to implement game ideas without extensive programming, and lists some free online tools for creating games in different genres.
The document provides instructions for a 2nd-3rd grade webquest on monarch butterflies. Students use a slideshow and online resources to solve the mystery of the monarch butterfly's lifecycle, body parts, food source, habitat, and migration pattern. The webquest guides students through recording observations and labeling diagrams in a detective notebook.
Jason Yee - Chaos! - Codemotion Rome 2019Codemotion
As applications become more distributed and complex, so do our failure modes. In this presentation, I’ll share why you shouldn’t just embrace failure, but why you should induce it to intentionally cause and learn from failure. Together with the audience, I'll run a Chaos experiment to show how they can start their own Chaos engineering and make their systems more resilient.
"You Can Do It" by Louis Monier (Altavista Co-Founder & CTO) & Gregory Renard (CTO & Artificial Intelligence Lead Architect at Xbrain) for Deep Learning keynote #0 at Holberton School (http://www.meetup.com/Holberton-School/events/228364522/)
If you want to assist to similar keynote for free, checkout http://www.meetup.com/Holberton-School/
Here are some key terms that are similar to "champagne":
- Sparkling wines
- French champagne
- Cognac
- Rosé
- White wine
- Sparkling wine
- Wine
- Burgundy
- Bordeaux
- Cava
- Prosecco
Some specific champagne brands that are similar terms include Moët, Veuve Clicquot, Dom Pérignon, Taittinger, and Bollinger. Grape varieties used in champagne production like Chardonnay and Pinot Noir could also be considered similar terms.
Talk presented to High School students at the Utah DigiForge Student Conference: "Think Like A Programmer". (Attributes: Laziness, Impatience, Hubris. And how algorithms, abstraction, and generalization will help you to achieve those attributes.)
Intuition & Use-Cases of Embeddings in NLP & beyondC4Media
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/2LZgiKO.
Jay Alammar talks about the concept of word embeddings, how they're created, and looks at examples of how these concepts can be carried over to solve problems like content discovery and search ranking in marketplaces and media-consumption services (e.g. movie/music recommendations). Filmed at qconlondon.com.
Jay Alammar is VC and ML Explainer at STVcapital. He has helped tens of thousands of people wrap their heads around complex ML topics. He harnesses a visual, highly-intuitive presentation style to communicate concepts ranging from the most basic intros to data analysis, interactive intros to neural networks, to dissections of state-of-the-art models in Natural Language Processing.
Create Computer Games - Get Started on Creating Your Own Virtual Worldstoilet08avenue
This document provides guidance on creating computer games from initial concept development through implementation. It recommends starting with well-thought-out game ideas and outlines, including character descriptions, story details, and gameplay descriptions. Proper planning helps avoid "development hell" where projects drag on indefinitely. The document also recommends using rapid application development tools to implement game ideas without extensive programming, and lists some free online tools for creating games in different genres.
The document provides instructions for a 2nd-3rd grade webquest on monarch butterflies. Students use a slideshow and online resources to solve the mystery of the monarch butterfly's lifecycle, body parts, food source, habitat, and migration pattern. The webquest guides students through recording observations and labeling diagrams in a detective notebook.
Jason Yee - Chaos! - Codemotion Rome 2019Codemotion
As applications become more distributed and complex, so do our failure modes. In this presentation, I’ll share why you shouldn’t just embrace failure, but why you should induce it to intentionally cause and learn from failure. Together with the audience, I'll run a Chaos experiment to show how they can start their own Chaos engineering and make their systems more resilient.
"You Can Do It" by Louis Monier (Altavista Co-Founder & CTO) & Gregory Renard (CTO & Artificial Intelligence Lead Architect at Xbrain) for Deep Learning keynote #0 at Holberton School (http://www.meetup.com/Holberton-School/events/228364522/)
If you want to assist to similar keynote for free, checkout http://www.meetup.com/Holberton-School/
Here are some key terms that are similar to "champagne":
- Sparkling wines
- French champagne
- Cognac
- Rosé
- White wine
- Sparkling wine
- Wine
- Burgundy
- Bordeaux
- Cava
- Prosecco
Some specific champagne brands that are similar terms include Moët, Veuve Clicquot, Dom Pérignon, Taittinger, and Bollinger. Grape varieties used in champagne production like Chardonnay and Pinot Noir could also be considered similar terms.
Talk presented to High School students at the Utah DigiForge Student Conference: "Think Like A Programmer". (Attributes: Laziness, Impatience, Hubris. And how algorithms, abstraction, and generalization will help you to achieve those attributes.)
Intuition & Use-Cases of Embeddings in NLP & beyondC4Media
Video and slides synchronized, mp3 and slide download available at URL http://bit.ly/2LZgiKO.
Jay Alammar talks about the concept of word embeddings, how they're created, and looks at examples of how these concepts can be carried over to solve problems like content discovery and search ranking in marketplaces and media-consumption services (e.g. movie/music recommendations). Filmed at qconlondon.com.
Jay Alammar is VC and ML Explainer at STVcapital. He has helped tens of thousands of people wrap their heads around complex ML topics. He harnesses a visual, highly-intuitive presentation style to communicate concepts ranging from the most basic intros to data analysis, interactive intros to neural networks, to dissections of state-of-the-art models in Natural Language Processing.
This document discusses computational thinking and provides examples of how it can be applied. It defines computational thinking as using logical reasoning and problem-solving skills to solve problems. It gives examples of computational thinking in everyday life, sciences, archaeology, journalism, and more. The document also discusses teaching computational thinking to others using block-based programming languages like Snap, Scratch, and Pictoblox. Key concepts covered include sequences, loops, conditionals, events, parallelism, operators, and data.
The talk looks at how “pure” randomness can be undesirable in game design because the human brain expects a die to “roll a six”, the epic loot to drop, eventually. Three methods are presented together with a look at how we used them to create procedural content in Bubble Island 2 for Wooga.
This document provides an introduction to using Scratch, a visual programming environment, on the Raspberry Pi. It discusses the basics of Scratch including moving sprites, animation with loops, using a maths cat sprite for calculations, programming artificial intelligence, and creating games. The guide is designed for beginners aged 8 and up and provides files and examples on the SD card to help with the exercises. It aims to teach basic computer science concepts through interactive projects while having fun exploring programming.
Here are the steps to draw your own background in Scratch:
1. Click on the stage in the Sprite List (bottom-right of the screen).
2. Click on the Backgrounds tab for the stage and click on the Edit button.
3. The Paint Editor will open. Draw a stage for your sprite using the various drawing tools.
4. When finished, click OK.
5. You can edit the background further by clicking Edit again in the future.
Alternatively, you can import a ready-made background by:
1. Selecting Stage then Backgrounds.
2. Click on the Import button.
3. Browse through the available backgrounds and
How do you teach computers humor + Text Generators as Creative Partners (May ...Thomas Winters
This guest lecture was given on the 10th of May 2023 at the "Computational Creativity" class of prof. Tim Van de Cruys & on the 16th of May 2023 for the "Humor and Creativity in Language" class by prof. Kurt Feyaerts.
The first part provides an overview on computational humor with a focus on the research work of Thomas Winters.
The second part shows how to generate humor using prompt engineering on GPT models like GPT-4 and ChatGPT.
Extended slide deck of my September 2011 Flash on the Beach presentation "Robotlegs 2 and your brain - a great developer toolchain".
The presentation asks the question - what do programmers need to know about how their brains work? And how did we employ cognitive and neuroscience to make decisions about version 2 of the Robotlegs ActionScript framework.
If you're brand new to Robotlegs then the coverage of the workings of Robotlegs 1 are likely to be insufficient - I'd suggest picking up a copy of ActionScript Developers Guide to Robotlegs first.
More details are available at www.robotlegs.org
The document discusses strategies for keeping team morale high in agile environments. It recommends tricks like never stopping learning, friendly competition, and ensuring the team finds their work cool. A key strategy is using a "Doomboard" project dashboard with fun graphics and integration with tools like GitHub and a continuous integration server to track projects, committers, and build status. The Doomboard aims to be fun to build and use while also encouraging learning and a sense of friendly competition within the team.
This document discusses common sense in machines and intelligence without emotion. It explores how the mind works as a "society of mind" made up of many smaller mental agents or processes. While computers can perform many tasks, common sense involves a large variety of knowledge that is difficult for computers to manage. The author proposes that intelligence arises from the interactions between mental agents, not from any single part. Memory may involve "knowledge lines" that connect ideas to the agents that learned them. Overall, the document speculatively examines challenges for machines to develop common sense and human-like intelligence through understanding the mind as a complex system.
The document discusses the history and future of computing and communication technologies from the 1960s to the present. It notes that early visions from the 1960s envisioned an "intergalactic computer network" that could allow communication with aliens. By the 1970s, models of distributed computing using "particles and fields" were being explored. The document suggests that future technologies may treat applications and services as "aliens" that can communicate through open interfaces. It advocates moving beyond normal conceptions to an intergalactic approach that allows scaling across networks.
This document outlines the schedule and requirements for a class project. Students are assigned to complete projects using various programming libraries and tools like PyGame, Django, and VPython. The preliminary requirements for December 1st include choosing a library, getting the library set up, and doing some preliminary programming. Later deadlines include intermediate progress due on December 7th and the final project due on December 17th. Students will also present their in-progress projects in class on December 6th.
This document provides an introduction to the CS 188: Artificial Intelligence course at UC Berkeley. It discusses key topics that will be covered in the course, including rational decision making, computational rationality, a brief history of AI, current capabilities in areas like natural language processing, computer vision, robotics, and game playing. The course will cover general techniques for designing rational agents and making decisions under uncertainty, with applications to domains like language, vision, games, and more. Students will learn how to apply existing AI techniques to new problem types.
Keynote presented at SATURN (2nd May 2017)
Video available at https://www.youtube.com/watch?v=MS3c9hz0bRg
"It's just a detail." Have you ever said that or been told that? Whether it's about implementation or requirements, we often use the word detail to suggest that something is not important enough to worry about. There are so many things to worry about in software development that we need to prioritize—too much detail, not enough focus. The problem is that in software, the details matter because that is what software is: lots of details brought together in combination. If we don't focus on the details, we get debt, defects, and delays.
Python Crash Course, the instructions for installing Python have been simpli- fied for users of all major operating systems. I now recommend the text editor Sublime Text, which is popular among beginner and professional programmers and works well on all operating systems.
The document provides an overview of a Python programming presentation on the Joy of Computing with Python. It discusses why programming is important, the importance of clear instructions, and introduces concepts like Scratch and loops. The presentation is split into 8 weeks, with topics covered including crowd computing, genetic algorithms, searching and sorting algorithms, recursion, and simulations of games like snakes and ladders and the lottery.
This reflection paper discusses the author's reasons for taking a leadership course and what they have learned. The author wanted to grow in their leadership abilities as a minister. Though they had prior leadership training, they desired to continually learn and improve. The author was surprised to learn new information in the course rather than just being reminded of what they already knew. They have gained new perspectives on ministry and life, and been confronted with new information and ways of thinking about leadership.
Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test.
Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation.
Why is Software Testing Important to a business?
Software testing is a process to determine the quality of the software developed by a developer or programmer. It is a methodological study intended to evaluate the quality-related information of the product. Understanding of the important features and advantages of software testing helps businesses in their day-to-day activities.
Testing can be done in two ways, manual testing and automated testing. Manual software testing is done by human testers, who manually check the code and report bugs in it. In case of automated testing, testing is performed by a computer using software such as WinRunner, LoadRunner, etc.
Game AI 101 - NPCs and Agents and Algorithms... Oh My!Luke Dicken
This is a session originally written for students at Bradley University (Peoria, IL).
It covers a very high level introduction to the concepts behind Game AI, and includes some examples of how we can begin to make characters in a game world perform actions and appear to be making intelligent decisions.
The document provides an introduction to various mathematical concepts commonly used in information retrieval and summarizes several models including vector space models, inductive models like probabilistic and neural networks, and hybrid models. It gives examples of how vector space and probabilistic models can be used for applications like document clustering, targeted advertising, and part-of-speech tagging. It also notes some uncertainties and pitfalls with these models.
In 1971, David Parnas wrote the great paper, "On the criteria to be used decomposing the system into parts," and yet the problem of breaking down big projects into small parts that work well together remains a struggle in the industry. The ability to decompose a problem space and in turn, compose a solution is essential to our work.
Things have gotten worse since 1971. With microservices, big data, and streaming systems, we're all going to be distributed systems engineers sooner or later. In distributed systems, effective decomposition has an even greater impact on the reliability, performance, and availability of our systems as it determines the frequency and weight of communication in the system.
This talk speaks to the essential considerations for defining and evaluating boundaries and behaviors in large-scale distributed systems. It will touch on topics such as bulkhead design and architectural evolution.
Atelier - Innover avec l’IA Générative et les graphes de connaissancesNeo4j
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Allez au-delà du battage médiatique autour de l’IA et découvrez des techniques pratiques pour utiliser l’IA de manière responsable à travers les données de votre organisation. Explorez comment utiliser les graphes de connaissances pour augmenter la précision, la transparence et la capacité d’explication dans les systèmes d’IA générative. Vous partirez avec une expérience pratique combinant les relations entre les données et les LLM pour apporter du contexte spécifique à votre domaine et améliorer votre raisonnement.
Amenez votre ordinateur portable et nous vous guiderons sur la mise en place de votre propre pile d’IA générative, en vous fournissant des exemples pratiques et codés pour démarrer en quelques minutes.
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
More Related Content
Similar to Microsoft Research's Leslie Lamport at Build2014 - Thinking for Programmers
This document discusses computational thinking and provides examples of how it can be applied. It defines computational thinking as using logical reasoning and problem-solving skills to solve problems. It gives examples of computational thinking in everyday life, sciences, archaeology, journalism, and more. The document also discusses teaching computational thinking to others using block-based programming languages like Snap, Scratch, and Pictoblox. Key concepts covered include sequences, loops, conditionals, events, parallelism, operators, and data.
The talk looks at how “pure” randomness can be undesirable in game design because the human brain expects a die to “roll a six”, the epic loot to drop, eventually. Three methods are presented together with a look at how we used them to create procedural content in Bubble Island 2 for Wooga.
This document provides an introduction to using Scratch, a visual programming environment, on the Raspberry Pi. It discusses the basics of Scratch including moving sprites, animation with loops, using a maths cat sprite for calculations, programming artificial intelligence, and creating games. The guide is designed for beginners aged 8 and up and provides files and examples on the SD card to help with the exercises. It aims to teach basic computer science concepts through interactive projects while having fun exploring programming.
Here are the steps to draw your own background in Scratch:
1. Click on the stage in the Sprite List (bottom-right of the screen).
2. Click on the Backgrounds tab for the stage and click on the Edit button.
3. The Paint Editor will open. Draw a stage for your sprite using the various drawing tools.
4. When finished, click OK.
5. You can edit the background further by clicking Edit again in the future.
Alternatively, you can import a ready-made background by:
1. Selecting Stage then Backgrounds.
2. Click on the Import button.
3. Browse through the available backgrounds and
How do you teach computers humor + Text Generators as Creative Partners (May ...Thomas Winters
This guest lecture was given on the 10th of May 2023 at the "Computational Creativity" class of prof. Tim Van de Cruys & on the 16th of May 2023 for the "Humor and Creativity in Language" class by prof. Kurt Feyaerts.
The first part provides an overview on computational humor with a focus on the research work of Thomas Winters.
The second part shows how to generate humor using prompt engineering on GPT models like GPT-4 and ChatGPT.
Extended slide deck of my September 2011 Flash on the Beach presentation "Robotlegs 2 and your brain - a great developer toolchain".
The presentation asks the question - what do programmers need to know about how their brains work? And how did we employ cognitive and neuroscience to make decisions about version 2 of the Robotlegs ActionScript framework.
If you're brand new to Robotlegs then the coverage of the workings of Robotlegs 1 are likely to be insufficient - I'd suggest picking up a copy of ActionScript Developers Guide to Robotlegs first.
More details are available at www.robotlegs.org
The document discusses strategies for keeping team morale high in agile environments. It recommends tricks like never stopping learning, friendly competition, and ensuring the team finds their work cool. A key strategy is using a "Doomboard" project dashboard with fun graphics and integration with tools like GitHub and a continuous integration server to track projects, committers, and build status. The Doomboard aims to be fun to build and use while also encouraging learning and a sense of friendly competition within the team.
This document discusses common sense in machines and intelligence without emotion. It explores how the mind works as a "society of mind" made up of many smaller mental agents or processes. While computers can perform many tasks, common sense involves a large variety of knowledge that is difficult for computers to manage. The author proposes that intelligence arises from the interactions between mental agents, not from any single part. Memory may involve "knowledge lines" that connect ideas to the agents that learned them. Overall, the document speculatively examines challenges for machines to develop common sense and human-like intelligence through understanding the mind as a complex system.
The document discusses the history and future of computing and communication technologies from the 1960s to the present. It notes that early visions from the 1960s envisioned an "intergalactic computer network" that could allow communication with aliens. By the 1970s, models of distributed computing using "particles and fields" were being explored. The document suggests that future technologies may treat applications and services as "aliens" that can communicate through open interfaces. It advocates moving beyond normal conceptions to an intergalactic approach that allows scaling across networks.
This document outlines the schedule and requirements for a class project. Students are assigned to complete projects using various programming libraries and tools like PyGame, Django, and VPython. The preliminary requirements for December 1st include choosing a library, getting the library set up, and doing some preliminary programming. Later deadlines include intermediate progress due on December 7th and the final project due on December 17th. Students will also present their in-progress projects in class on December 6th.
This document provides an introduction to the CS 188: Artificial Intelligence course at UC Berkeley. It discusses key topics that will be covered in the course, including rational decision making, computational rationality, a brief history of AI, current capabilities in areas like natural language processing, computer vision, robotics, and game playing. The course will cover general techniques for designing rational agents and making decisions under uncertainty, with applications to domains like language, vision, games, and more. Students will learn how to apply existing AI techniques to new problem types.
Keynote presented at SATURN (2nd May 2017)
Video available at https://www.youtube.com/watch?v=MS3c9hz0bRg
"It's just a detail." Have you ever said that or been told that? Whether it's about implementation or requirements, we often use the word detail to suggest that something is not important enough to worry about. There are so many things to worry about in software development that we need to prioritize—too much detail, not enough focus. The problem is that in software, the details matter because that is what software is: lots of details brought together in combination. If we don't focus on the details, we get debt, defects, and delays.
Python Crash Course, the instructions for installing Python have been simpli- fied for users of all major operating systems. I now recommend the text editor Sublime Text, which is popular among beginner and professional programmers and works well on all operating systems.
The document provides an overview of a Python programming presentation on the Joy of Computing with Python. It discusses why programming is important, the importance of clear instructions, and introduces concepts like Scratch and loops. The presentation is split into 8 weeks, with topics covered including crowd computing, genetic algorithms, searching and sorting algorithms, recursion, and simulations of games like snakes and ladders and the lottery.
This reflection paper discusses the author's reasons for taking a leadership course and what they have learned. The author wanted to grow in their leadership abilities as a minister. Though they had prior leadership training, they desired to continually learn and improve. The author was surprised to learn new information in the course rather than just being reminded of what they already knew. They have gained new perspectives on ministry and life, and been confronted with new information and ways of thinking about leadership.
Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test.
Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation.
Why is Software Testing Important to a business?
Software testing is a process to determine the quality of the software developed by a developer or programmer. It is a methodological study intended to evaluate the quality-related information of the product. Understanding of the important features and advantages of software testing helps businesses in their day-to-day activities.
Testing can be done in two ways, manual testing and automated testing. Manual software testing is done by human testers, who manually check the code and report bugs in it. In case of automated testing, testing is performed by a computer using software such as WinRunner, LoadRunner, etc.
Game AI 101 - NPCs and Agents and Algorithms... Oh My!Luke Dicken
This is a session originally written for students at Bradley University (Peoria, IL).
It covers a very high level introduction to the concepts behind Game AI, and includes some examples of how we can begin to make characters in a game world perform actions and appear to be making intelligent decisions.
The document provides an introduction to various mathematical concepts commonly used in information retrieval and summarizes several models including vector space models, inductive models like probabilistic and neural networks, and hybrid models. It gives examples of how vector space and probabilistic models can be used for applications like document clustering, targeted advertising, and part-of-speech tagging. It also notes some uncertainties and pitfalls with these models.
In 1971, David Parnas wrote the great paper, "On the criteria to be used decomposing the system into parts," and yet the problem of breaking down big projects into small parts that work well together remains a struggle in the industry. The ability to decompose a problem space and in turn, compose a solution is essential to our work.
Things have gotten worse since 1971. With microservices, big data, and streaming systems, we're all going to be distributed systems engineers sooner or later. In distributed systems, effective decomposition has an even greater impact on the reliability, performance, and availability of our systems as it determines the frequency and weight of communication in the system.
This talk speaks to the essential considerations for defining and evaluating boundaries and behaviors in large-scale distributed systems. It will touch on topics such as bulkhead design and architectural evolution.
Similar to Microsoft Research's Leslie Lamport at Build2014 - Thinking for Programmers (20)
Atelier - Innover avec l’IA Générative et les graphes de connaissancesNeo4j
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Allez au-delà du battage médiatique autour de l’IA et découvrez des techniques pratiques pour utiliser l’IA de manière responsable à travers les données de votre organisation. Explorez comment utiliser les graphes de connaissances pour augmenter la précision, la transparence et la capacité d’explication dans les systèmes d’IA générative. Vous partirez avec une expérience pratique combinant les relations entre les données et les LLM pour apporter du contexte spécifique à votre domaine et améliorer votre raisonnement.
Amenez votre ordinateur portable et nous vous guiderons sur la mise en place de votre propre pile d’IA générative, en vous fournissant des exemples pratiques et codés pour démarrer en quelques minutes.
Software Engineering, Software Consulting, Tech Lead, Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Transaction, Spring MVC, OpenShift Cloud Platform, Kafka, REST, SOAP, LLD & HLD.
What is Augmented Reality Image Trackingpavan998932
Augmented Reality (AR) Image Tracking is a technology that enables AR applications to recognize and track images in the real world, overlaying digital content onto them. This enhances the user's interaction with their environment by providing additional information and interactive elements directly tied to physical images.
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Crescat
Crescat is industry-trusted event management software, built by event professionals for event professionals. Founded in 2017, we have three key products tailored for the live event industry.
Crescat Event for concert promoters and event agencies. Crescat Venue for music venues, conference centers, wedding venues, concert halls and more. And Crescat Festival for festivals, conferences and complex events.
With a wide range of popular features such as event scheduling, shift management, volunteer and crew coordination, artist booking and much more, Crescat is designed for customisation and ease-of-use.
Over 125,000 events have been planned in Crescat and with hundreds of customers of all shapes and sizes, from boutique event agencies through to international concert promoters, Crescat is rigged for success. What's more, we highly value feedback from our users and we are constantly improving our software with updates, new features and improvements.
If you plan events, run a venue or produce festivals and you're looking for ways to make your life easier, then we have a solution for you. Try our software for free or schedule a no-obligation demo with one of our product specialists today at crescat.io
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsPeter Muessig
The UI5 tooling is the development and build tooling of UI5. It is built in a modular and extensible way so that it can be easily extended by your needs. This session will showcase various tooling extensions which can boost your development experience by far so that you can really work offline, transpile your code in your project to use even newer versions of EcmaScript (than 2022 which is supported right now by the UI5 tooling), consume any npm package of your choice in your project, using different kind of proxies, and even stitching UI5 projects during development together to mimic your target environment.
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j
Dr. Jesús Barrasa, Head of Solutions Architecture for EMEA, Neo4j
Découvrez les dernières innovations de Neo4j, et notamment les dernières intégrations cloud et les améliorations produits qui font de Neo4j un choix essentiel pour les développeurs qui créent des applications avec des données interconnectées et de l’IA générative.
Microservice Teams - How the cloud changes the way we workSven Peters
A lot of technical challenges and complexity come with building a cloud-native and distributed architecture. The way we develop backend software has fundamentally changed in the last ten years. Managing a microservices architecture demands a lot of us to ensure observability and operational resiliency. But did you also change the way you run your development teams?
Sven will talk about Atlassian’s journey from a monolith to a multi-tenanted architecture and how it affected the way the engineering teams work. You will learn how we shifted to service ownership, moved to more autonomous teams (and its challenges), and established platform and enablement teams.
OpenMetadata Community Meeting - 5th June 2024OpenMetadata
The OpenMetadata Community Meeting was held on June 5th, 2024. In this meeting, we discussed about the data quality capabilities that are integrated with the Incident Manager, providing a complete solution to handle your data observability needs. Watch the end-to-end demo of the data quality features.
* How to run your own data quality framework
* What is the performance impact of running data quality frameworks
* How to run the test cases in your own ETL pipelines
* How the Incident Manager is integrated
* Get notified with alerts when test cases fail
Watch the meeting recording here - https://www.youtube.com/watch?v=UbNOje0kf6E
Mobile App Development Company In Noida | Drona InfotechDrona Infotech
Looking for a reliable mobile app development company in Noida? Look no further than Drona Infotech. We specialize in creating customized apps for your business needs.
Visit Us For : https://www.dronainfotech.com/mobile-application-development/
Graspan: A Big Data System for Big Code AnalysisAftab Hussain
We built a disk-based parallel graph system, Graspan, that uses a novel edge-pair centric computation model to compute dynamic transitive closures on very large program graphs.
We implement context-sensitive pointer/alias and dataflow analyses on Graspan. An evaluation of these analyses on large codebases such as Linux shows that their Graspan implementations scale to millions of lines of code and are much simpler than their original implementations.
These analyses were used to augment the existing checkers; these augmented checkers found 132 new NULL pointer bugs and 1308 unnecessary NULL tests in Linux 4.4.0-rc5, PostgreSQL 8.3.9, and Apache httpd 2.2.18.
- Accepted in ASPLOS ‘17, Xi’an, China.
- Featured in the tutorial, Systemized Program Analyses: A Big Data Perspective on Static Analysis Scalability, ASPLOS ‘17.
- Invited for presentation at SoCal PLS ‘16.
- Invited for poster presentation at PLDI SRC ‘16.
GraphSummit Paris - The art of the possible with Graph TechnologyNeo4j
Sudhir Hasbe, Chief Product Officer, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Odoo ERP software
Odoo ERP software, a leading open-source software for Enterprise Resource Planning (ERP) and business management, has recently launched its latest version, Odoo 17 Community Edition. This update introduces a range of new features and enhancements designed to streamline business operations and support growth.
The Odoo Community serves as a cost-free edition within the Odoo suite of ERP systems. Tailored to accommodate the standard needs of business operations, it provides a robust platform suitable for organisations of different sizes and business sectors. Within the Odoo Community Edition, users can access a variety of essential features and services essential for managing day-to-day tasks efficiently.
This blog presents a detailed overview of the features available within the Odoo 17 Community edition, and the differences between Odoo 17 community and enterprise editions, aiming to equip you with the necessary information to make an informed decision about its suitability for your business.
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
SOCRadar's Aviation Industry Q1 Incident Report is out now!
The aviation industry has always been a prime target for cybercriminals due to its critical infrastructure and high stakes. In the first quarter of 2024, the sector faced an alarming surge in cybersecurity threats, revealing its vulnerabilities and the relentless sophistication of cyber attackers.
SOCRadar’s Aviation Industry, Quarterly Incident Report, provides an in-depth analysis of these threats, detected and examined through our extensive monitoring of hacker forums, Telegram channels, and dark web platforms.
Artificia Intellicence and XPath Extension FunctionsOctavian Nadolu
The purpose of this presentation is to provide an overview of how you can use AI from XSLT, XQuery, Schematron, or XML Refactoring operations, the potential benefits of using AI, and some of the challenges we face.
2. Why Think?
It helps us do most things:
Hunting a sabre-toothed tiger.
Building a house.
Writing a program.
0
3. Why Think?
It helps us do most things:
Hunting a sabre-toothed tiger.
Building a house.
Writing a program.
0
4. Why Think?
It helps us do most things:
Hunting a sabre-toothed tiger.
Building a house.
Writing a program.
0
5. Why Think?
It helps us do most things:
Hunting a sabre-toothed tiger.
Building a house.
Writing a program.
0
6. Why Think?
It helps us do most things:
Hunting a sabre-toothed tiger.
Building a house.
Writing a program.
0
7. When to Think
Hunting a sabre-toothed tiger.
Before leaving the cave.
Building a house.
Before beginning construction.
Writing a program.
Before writing any code.
1
8. When to Think
Hunting a sabre-toothed tiger.
Before leaving the cave.
Building a house.
Before beginning construction.
Writing a program.
Before writing any code.
1
9. When to Think
Hunting a sabre-toothed tiger.
Before leaving the cave.
Building a house.
Before beginning construction.
Writing a program.
Before writing any code.
1
10. When to Think
Hunting a sabre-toothed tiger.
Before leaving the cave.
Building a house.
Before beginning construction.
Writing a program.
Before writing any code.
1
11. When to Think
Hunting a sabre-toothed tiger.
Before leaving the cave.
Building a house.
Before beginning construction.
Writing a program.
Before writing any code.
1
12. When to Think
Hunting a sabre-toothed tiger.
Before leaving the cave.
Building a house.
Before beginning construction.
Writing a program.
Before writing any code.
1
13. When to Think
Hunting a sabre-toothed tiger.
Before leaving the cave.
Building a house.
Before beginning construction.
Writing a program.
Before writing any code.
1
14. How to Think
“Writing is nature’s way of letting you know how
sloppy your thinking is.”
Guindon
To think, you have to write.
If you’re thinking without writing, you only think you’re thinking.
1
15. How to Think
“Writing is nature’s way of letting you know how
sloppy your thinking is.”
Guindon
To think, you have to write.
If you’re thinking without writing, you only think you’re thinking.
1
16. How to Think
“Writing is nature’s way of letting you know how
sloppy your thinking is.”
Guindon
To think, you have to write.
If you’re thinking without writing, you only think you’re thinking.
1
17. How to Think
“Writing is nature’s way of letting you know how
sloppy your thinking is.”
Guindon
To think, you have to write.
If you’re thinking without writing, you only think you’re thinking.
1
18. What to Write
Hunting a sabre-toothed tiger.
Writing not invented, dangerous activity.
Building a house.
Draw blueprints.
Writing a program.
Write a
2
19. What to Write
Hunting a sabre-toothed tiger.
Writing not invented, dangerous activity.
Building a house.
Draw blueprints.
Writing a program.
Write a
2
20. What to Write
Hunting a sabre-toothed tiger.
Writing not invented, dangerous activity.
Building a house.
Draw blueprints.
Writing a program.
Write a
2
21. What to Write
Hunting a sabre-toothed tiger.
Writing not invented, dangerous activity.
Building a house.
Draw blueprints.
Writing a program.
Write a
2
22. What to Write
Hunting a sabre-toothed tiger.
Writing not invented, dangerous activity.
Building a house.
Draw blueprints.
Writing a program.
Write a
2
23. What to Write
Hunting a sabre-toothed tiger.
Writing not invented, dangerous activity.
Building a house.
Draw blueprints.
Writing a program.
Write a
2
24. What to Write
Hunting a sabre-toothed tiger.
Writing not invented, dangerous activity.
Building a house.
Draw blueprints.
Writing a program.
Write a blueprint
2
25. What to Write
Hunting a sabre-toothed tiger.
Writing not invented, dangerous activity.
Building a house.
Draw blueprints.
Writing a program.
Write a blueprint specification.
2
40. A spectrum of specifications
Prose Mathematical Prose Formal
5
41. A spectrum of specifications
Prose
Most code is really simple.
It can be specified with a couple of lines of prose.
5
42. A spectrum of specifications
Prose
Most code is really simple.
It can be specified with a couple of lines of prose.
5
43. A spectrum of specifications
Mathematical Prose
Some code is subtle.
It requires more thought.
5
44. A spectrum of specifications
Mathematical Prose
Some code is subtle.
It requires more thought.
5
45. A spectrum of specifications
Formal
Some code is complex or very subtle or critical.
5
46. A spectrum of specifications
Formal
Some code is complex or very subtle or critical.
Especially in concurrent/distributed systems.
5
47. A spectrum of specifications
Formal
Some code is complex or very subtle or critical.
We should use tools to check it.
5
48. How to Write a Spec
Writing requires thinking.
5
49. How to Write a Spec
Writing requires thinking.
5
50. How to Think About Programs
Like a Scientist
A very successful way of thinking.
Science makes mathematical models of reality.
Astronomy:
Reality: planets have mountains, oceans, tides, weather, . . .
Model: planet a point mass with position & momentum.
6
51. How to Think About Programs
Like a Scientist
A very successful way of thinking.
Science makes mathematical models of reality.
Astronomy:
Reality: planets have mountains, oceans, tides, weather, . . .
Model: planet a point mass with position & momentum.
6
52. How to Think About Programs
Like a Scientist
A very successful way of thinking.
Science makes mathematical models of reality.
Astronomy:
Reality: planets have mountains, oceans, tides, weather, . . .
Model: planet a point mass with position & momentum.
6
53. How to Think About Programs
Like a Scientist
A very successful way of thinking.
Science makes mathematical models of reality.
Astronomy:
Reality: planets have mountains, oceans, tides, weather, . . .
Model: planet a point mass with position & momentum.
6
54. How to Think About Programs
Like a Scientist
A very successful way of thinking.
Science makes mathematical models of reality.
Astronomy:
Reality: planets have mountains, oceans, tides, weather, . . .
Model: planet a point mass with position & momentum.
6
55. How to Think About Programs
Like a Scientist
A very successful way of thinking.
Science makes mathematical models of reality.
Astronomy:
Reality: planets have mountains, oceans, tides, weather, . . .
Model: planet a point mass with position & momentum.
6
56. How to Think About Programs
Like a Scientist
A very successful way of thinking.
Science makes mathematical models of reality.
Astronomy:
Reality: planets have mountains, oceans, tides, weather, . . .
Model: planet a point mass with position & momentum.
6
57. Computer Science
Reality: Digital systems
a processor chip
a game console
a computer executing a program
...
Models: Turing machines
Partially ordered sets of events
...
6
58. Computer Science
Reality: Digital systems
a processor chip
a game console
a computer executing a program
...
Models: Turing machines
Partially ordered sets of events
...
6
59. Computer Science
Reality: Digital systems
a processor chip
a game console
a computer executing a program
...
Models: Turing machines
Partially ordered sets of events
...
6
60. Computer Science
Reality: Digital systems
a processor chip
a game console
a computer executing a program
...
Models: Turing machines
Partially ordered sets of events
...
6
61. Computer Science
Reality: Digital systems
a processor chip
a game console
a computer executing a program
...
Models: Turing machines
Partially ordered sets of events
...
6
62. Computer Science
Reality: Digital systems
a processor chip
a game console
a computer executing a program
...
Models: Turing machines
Partially ordered sets of events
...
6
63. Computer Science
Reality: Digital systems
a processor chip
a game console
a computer executing a program
...
Models: Turing machines
Partially ordered sets of events
...
6
64. Computer Science
Reality: Digital systems
a processor chip
a game console
a computer executing a program
...
Models: Turing machines
Partially ordered sets of events
...
6
65. Computer Science
Reality: Digital systems
a processor chip
a game console
a computer executing a program
...
Models: Turing machines
Partially ordered sets of events
...
6
66. Computer Science
Reality: Digital systems
a processor chip
a game console
a computer executing a program
...
Models: Turing machines
Partially ordered sets of events
...
6
67. The Two Most Useful Models
Functions
Sequences of States
7
68. The Two Most Useful Models
Functions
Sequences of States
7
69. The Two Most Useful Models
Functions
Sequences of States
7
70. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
8
71. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
8
72. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
8
73. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Not in TLA+
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
8
74. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
8
75. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
square(2) = 4
8
76. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
Domain of square is f0; 1; 2; 3; : : :g a.k.a. Nat
8
77. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
To define a function, specify:
Domain of square = Nat
square(x ) = x 2 for all x in its domain.
8
78. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
To define a function, specify:
Domain of square = Nat
square(x ) = x 2 for all x in its domain.
8
79. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
Functions in math6= functions in programming languages.
8
80. Functions
Model a program as a function mapping input(s) to output(s).
In math, a function is a set of ordered pairs.
Example: the square function on natural numbers
fh0; 0i; h1; 1i; h2; 4i; h3; 9i; : : : g
Functions in math6= functions in programming languages.
Math is much simpler.
8
81. Limitations of the Function Model
Specifies what a program does, but not how.
– Quicksort and bubble sort compute the same function.
Some programs don’t just map inputs to outputs.
– Some programs run “forever”.
– Operating systems
9
82. Limitations of the Function Model
Specifies what a program does, but not how.
– Quicksort and bubble sort compute the same function.
Some programs don’t just map inputs to outputs.
– Some programs run “forever”.
– Operating systems
9
83. Limitations of the Function Model
Specifies what a program does, but not how.
– Quicksort and bubble sort compute the same function.
Some programs don’t just map inputs to outputs.
– Some programs run “forever”.
– Operating systems
9
84. Limitations of the Function Model
Specifies what a program does, but not how.
– Quicksort and bubble sort compute the same function.
Some programs don’t just map inputs to outputs.
– Some programs run “forever”.
– Operating systems
9
85. Limitations of the Function Model
Specifies what a program does, but not how.
– Quicksort and bubble sort compute the same function.
Some programs don’t just map inputs to outputs.
– Some programs run “forever”.
– Operating systems
9
86. Limitations of the Function Model
Specifies what a program does, but not how.
– Quicksort and bubble sort compute the same function.
Some programs don’t just map inputs to outputs.
– Some programs run “forever”.
– Operating systems
9
87. The Standard Behavioral Model
A program execution is represented by a behavior.
A behavior is a sequence of states.
A state is an assignment of values to variables.
A program is modeled by a set of behaviors:
the behaviors representing possible executions.
9
88. The Standard Behavioral Model
A program execution is represented by a behavior.
A behavior is a sequence of states.
A state is an assignment of values to variables.
A program is modeled by a set of behaviors:
the behaviors representing possible executions.
9
89. The Standard Behavioral Model
A program execution is represented by a behavior.
A behavior is a sequence of states.
A state is an assignment of values to variables.
A program is modeled by a set of behaviors:
the behaviors representing possible executions.
9
90. The Standard Behavioral Model
A program execution is represented by a behavior.
A behavior is a sequence of states.
A state is an assignment of values to variables.
A program is modeled by a set of behaviors:
the behaviors representing possible executions.
9
91. The Standard Behavioral Model
A program execution is represented by a behavior.
A behavior is a sequence of states.
A state is an assignment of values to variables.
A program is modeled by a set of behaviors:
the behaviors representing possible executions.
9
92. The Standard Behavioral Model
A program execution is represented by a behavior.
A behavior is a sequence of states.
A state is an assignment of values to variables.
A program is modeled by a set of behaviors:
the behaviors representing possible executions.
9
93. An Example: Euclid’s Algorithm
Computes GCD of M and N by:
– Initialize x to M and y to N.
– Keep subtracting the smaller of x and y from the larger.
– Stop when x = y.
For M = 12 and N = 18, one behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
10
94. An Example: Euclid’s Algorithm
An algorithm is an abstract program.
For M = 12 and N = 18, one behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
10
95. An Example: Euclid’s Algorithm
Computes GCD of M and N by:
– Initialize x to M and y to N.
– Keep subtracting the smaller of x and y from the larger.
– Stop when x = y.
For M = 12 and N = 18, one behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
10
96. An Example: Euclid’s Algorithm
Computes GCD of M and N by:
– Initialize x to M and y to N.
– Keep subtracting the smaller of x and y from the larger.
– Stop when x = y.
For M = 12 and N = 18, one behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
10
97. An Example: Euclid’s Algorithm
Computes GCD of M and N by:
– Initialize x to M and y to N.
– Keep subtracting the smaller of x and y from the larger.
– Stop when x = y.
For M = 12 and N = 18, one behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
10
98. An Example: Euclid’s Algorithm
Computes GCD of M and N by:
– Initialize x to M and y to N.
– Keep subtracting the smaller of x and y from the larger.
– Stop when x = y.
For M = 12 and N = 18, one behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
10
99. How to Describe a Set of Behaviors
With two things:
– The set of possible initial states.
– A next-state relation,
describing all possible successor states of any state.
11
100. How to Describe a Set of Behaviors
With two things:
– The set of possible initial states.
– A next-state relation,
describing all possible successor states of any state.
11
101. How to Describe a Set of Behaviors
With two things:
– The set of possible initial states.
– A next-state relation,
describing all possible successor states of any state.
11
102. How to Describe a Set of Behaviors
With two things:
– The set of possible initial states.
– A next-state relation,
describing all possible successor states of any state.
11
103. How to Describe a Set of Behaviors
With two things:
– The set of possible initial states.
– A next-state relation,
describing all possible successor states of any state.
For infinite behaviors, also need fairness.
11
104. How to Describe a Set of Behaviors
With two things:
– The set of possible initial states.
– A next-state relation,
describing all possible successor states of any state.
For infinite behaviors, also need fairness.
I will ignore this.
11
105. How to Describe a Set of Behaviors
With two things:
– The set of possible initial states.
– A next-state relation,
describing all possible successor states of any state.
What language should we use?
We can use math.
11
106. How to Describe a Set of Behaviors
With two things:
– The set of possible initial states.
– A next-state relation,
describing all possible successor states of any state.
What language should we use?
We can use math.
11
107. The Set of Initial States
Described by a formula.
For Euclid’s Algorithm: (x = M) ^ (y = N)
Only possible initial state: [x = M; y = N]
12
108. The Set of Initial States
Described by a formula.
For Euclid’s Algorithm: (x = M) ^ (y = N)
Only possible initial state: [x = M; y = N]
12
109. The Set of Initial States
Described by a formula.
For Euclid’s Algorithm: (x = M) ^ (y = N)
Only possible initial state: [x = M; y = N]
12
110. The Set of Initial States
Described by a formula.
For Euclid’s Algorithm: (x = M) ^ (y = N)
Only possible initial state: [x = M; y = N]
12
111. The Next-State Relation
Described by a formula.
Unprimed variables for current state,
Primed variables for next state.
For Euclid’s Algorithm: ( x > y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
13
112. The Next-State Relation
Described by a formula.
Unprimed variables for current state,
Primed variables for next state.
For Euclid’s Algorithm: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
13
113. The Next-State Relation
Described by a formula.
Unprimed variables for current state,
Primed variables for next state.
For Euclid’s Algorithm: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
13
114. The Next-State Relation
Described by a formula.
Unprimed variables for current state,
Primed variables for next state.
For Euclid’s Algorithm: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
13
115. The Next-State Relation
Described by a formula.
Unprimed variables for current state,
Primed variables for next state.
For Euclid’s Algorithm: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
13
116. The Next-State Relation
Described by a formula.
Unprimed variables for current state,
Primed variables for next state.
For Euclid’s Algorithm: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
13
117. For Euclid’s Algorithm
Take M = 12, N = 18
Next: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
118. For Euclid’s Algorithm
Take M = 12, N = 18
Next: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
119. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
120. For Euclid’s Algorithm
Init: (x = 12) ^ (y = 18)
Next: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
121. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
122. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next: ( 12 18
^ x 0 = 12 18
^ y0 = 18 )
_ ( 18 12
^ y0 = 18 12
^ x 0 = 12 )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
123. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next : ( 12 18 FALSE
^ x 0 = 12 18
^ y0 = 18 )
_ ( 18 12 TRUE
^ y0 = 18 12
^ x 0 = 12 )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
124. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
^ x 0 = 12 18
HH HH HH H
Next: ( 12 18
FALSE
^ y0 = 18 )
_ ( 18 12
^ y0 = 18 12
^ x 0 = 12 )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
125. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
^ x 0 = 12 18
HH HH HH H
Next: ( 12 18
FALSE
^ y0 = 18 )
_ ( 18 12
^ y0 = 18 12
^ x 0 = 12 )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
126. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
^ x 0 = 12 18
HH HH HH H
Next: ( 12 18
FALSE
^ y0 = 18 )
_ ( 18 12
^ y0 = 18 12
^ x 0 = 12 )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
127. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
128. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next: ( 12 6
^ x 0 = 12 6
^ y0 = 6 )
_ ( 6 12
^ y0 = 6 12
^ x 0 = 12 )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
129. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next : ( 12 6 TRUE
^ x 0 = 12 6
^ y0 = 6 )
_ ( 6 12 FALSE
^ y0 = 6 12
^ x 0 = 12 )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
130. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next: ( 12 6
^ x 0 = 12 6
^ y0 = 6 )
HH HH HH H
^ y0 = 6 12
_ ( 6 12
FALSE
^ x 0 = 12 )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
131. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next: ( 12 6
^ x 0 = 12 6
^ y0 = 6 )
HH HH HH H
^ y0 = 6 12
_ ( 6 12
FALSE
^ x 0 = 12 )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
132. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
133. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
Next : ( 6 6 FALSE
^ x 0 = 6 6
^ y0 = 6 )
_ ( 6 6 FALSE
^ y0 = 6 6
^ x 0 = 6 )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
134. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
^ x 0 = 6 6
HH HH HH H
Next: ( 6 6
FALSE
^ y0 = 6 )
^ y0 = 6 6
HH HH HH H
_ ( 6 6
FALSE
^ x 0 = )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
135. For Euclid’s Algorithm
Init: (x = M) ^ (y = N)
^ x 0 = 6 6
HH HH HH H
Next: ( 6 6
FALSE
^ y0 = 6 )
^ y0 = 6 6
HH HH HH H
_ ( 6 6
FALSE
NO NEXT STATE
^ x 0 = )
Behavior:
[x = 12; y = 18] ! [x = 12; y = 6] ! [x = 6; y = 6]
16
136. What About Formal Specs?
Need them only to apply tools.
Require a formal language.
16
137. What About Formal Specs?
Need them only to apply tools.
Require a formal language.
16
138. What About Formal Specs?
Need them only to apply tools.
Require a formal language.
16
140. The Language: TLA+
This
Init: (x = M) ^ (y = N)
Next: ( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
17
141. The Language: TLA+
becomes
MODULE Euclid
EXTENDS Integers
Init =
(x = M) ^ (y = N)
Next =
( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
17
142. The Language: TLA+
plus some boilerplate.
MODULE Euclid
EXTENDS Integers
Init =
(x = M) ^ (y = N)
Next =
( x y
^ x 0 = x y
^ y0 = y )
_ ( y x
^ y0 = y x
^ x 0 = x )
17
143. The Language: TLA+
You type
--------------- MODULE Euclid ----------------
EXTENDS Integers
Init == (x = M) / (y = N)
Next == ( x y
/ x’ = x - y
/ y’ = y )
/ ( y x
/ y’ = y - x
/ x’ = x )
===============================================
17
144. You can model check TLA+ specs.
You can write formal correctness proofs
and check them mechanically.
But math works only for toy examples.
To model real systems, you need a real language
with types, procedures, objects, etc.
Wrong
18
145. You can model check TLA+ specs.
You can write formal correctness proofs
and check them mechanically.
But math works only for toy examples.
To model real systems, you need a real language
with types, procedures, objects, etc.
Wrong
18
146. You can model check TLA+ specs.
You can write formal correctness proofs
and check them mechanically.
But math works only for toy examples.
To model real systems, you need a real language
with types, procedures, objects, etc.
Wrong
18
147. You can model check TLA+ specs.
You can write formal correctness proofs
and check them mechanically.
But math works only for toy examples.
To model real systems, you need a real language
with types, procedures, objects, etc.
Wrong
18
148. You can model check TLA+ specs.
You can write formal correctness proofs
and check them mechanically.
PP
But math PP PP works PP only for toy examples.
PP PP To model real systems, you PP need PP a real language
with types, procedures, objects, etc.
PP PP PP Wrong
18
150. Design Bugs
Not just simple coding bugs
Serious, often impossible to find by testing.
Ask Chris Newcombe about TLA+.
I’ll talk about informal specs, starting with an example.
19
151. Design Bugs
Not just simple coding bugs
Serious, often impossible to find by testing.
Ask Chris Newcombe about TLA+.
I’ll talk about informal specs, starting with an example.
19
152. Design Bugs
Not just simple coding bugs
Serious, often impossible to find by testing.
Ask Chris Newcombe about TLA+.
I’ll talk about informal specs, starting with an example.
19
153. Design Bugs
Not just simple coding bugs
Serious, often impossible to find by testing.
Ask Chris Newcombe about TLA+.
I’ll talk about informal specs, starting with an example.
19
154. Design Bugs
Not just simple coding bugs
Serious, often impossible to find by testing.
Ask Chris Newcombe about TLA+.
I’ll talk about informal specs, starting with an example.
19
156. TLATEX — the TLA+ pretty-printer
The input:
Foo = / a = b
/ ccc = d
20
157. TLATEX — the TLA+ pretty-printer
The input:
Foo = / a = b
/ ccc = d
The naive output:
Foo ) ^ a = b
^ ccc = d
20
158. TLATEX — the TLA+ pretty-printer
The input:
Foo = / a = b
/ ccc = d
The naive output:
Foo ) ^ a = b
^ ccc = d
The user probably wanted these aligned.
20
159. TLATEX — the TLA+ pretty-printer
The input:
Foo = / a = b
/ ccc = d
The right output:
Foo ) ^ a = b
^ ccc = d
The user probably wanted these aligned.
20
160. TLATEX — the TLA+ pretty-printer
The input:
/ aaa + bb = c
/ iii = jj * k
21
161. TLATEX — the TLA+ pretty-printer
The input:
/ aaa + bb = c
/ iii = jj * k
The naive output:
^ aaa + bb = c
^ iii = jj k
21
162. TLATEX — the TLA+ pretty-printer
The input:
/ aaa + bb = c
/ iii = jj * k
The naive output:
^ aaa + bb = c
^ iii = jj k
The user probably didn’t wanted these aligned.
21
163. TLATEX — the TLA+ pretty-printer
The input:
/ aaa + bb = c
/ iii = jj * k
The right output:
^ aaa + bb = c
^ iii = jj k
The user probably didn’t wanted these aligned.
21
164. There is no precise definition of correct alignment.
We can’t specify mathematically what the user wants.
If we can’t specify correctness, specification is useless.
Wrong.
Not knowing what a program should do means
we have to think even harder.
Which means that a spec is even more important.
What did I do?
Let’s look at my Java code.
21
165. There is no precise definition of correct alignment.
We can’t specify mathematically what the user wants.
If we can’t specify correctness, specification is useless.
Wrong.
Not knowing what a program should do means
we have to think even harder.
Which means that a spec is even more important.
What did I do?
Let’s look at my Java code.
21
166. There is no precise definition of correct alignment.
We can’t specify mathematically what the user wants.
If we can’t specify correctness, specification is useless.
Wrong.
Not knowing what a program should do means
we have to think even harder.
Which means that a spec is even more important.
What did I do?
Let’s look at my Java code.
21
167. There is no precise definition of correct alignment.
We can’t specify mathematically what the user wants.
If we can’t specify correctness, specification is useless.
Wrong.
Not knowing what a program should do means
we have to think even harder.
Which means that a spec is even more important.
What did I do?
Let’s look at my Java code.
21
168. There is no precise definition of correct alignment.
We can’t specify mathematically what the user wants.
If we can’t specify correctness, specification is useless.
Wrong.
Not knowing what a program should do means
we have to think even harder.
Which means that a spec is even more important.
What did I do?
Let’s look at my Java code.
21
169. There is no precise definition of correct alignment.
We can’t specify mathematically what the user wants.
If we can’t specify correctness, specification is useless.
Wrong.
Not knowing what a program should do means
we have to think even harder.
Which means that a spec is even more important.
What did I do?
Let’s look at my Java code.
21
170. There is no precise definition of correct alignment.
We can’t specify mathematically what the user wants.
If we can’t specify correctness, specification is useless.
Wrong.
Not knowing what a program should do means
we have to think even harder.
Which means that a spec is even more important.
What did I do?
Let’s look at my Java code.
21
171. There is no precise definition of correct alignment.
We can’t specify mathematically what the user wants.
If we can’t specify correctness, specification is useless.
Wrong.
Not knowing what a program should do means
we have to think even harder.
Which means that a spec is even more important.
What did I do?
Let’s look at my Java code.
21
172. /***************************************************************************
* CLASS FindAlignments *
* *
* Contains the one public method *
* *
* public static void FindAlignments(Token[][] spec) *
* *
* that sets the aboveAlign, belowAlign, and isAlignmentPoint fields for *
* all tokens in the tokenized spec spec--except for NULL and MULTI *
* comment tokens, for which the aboveAlign field is set by *
* CommentToken.processComments. (This method should be called after *
* CommentToken.processComments.) *
* *
* There are six kinds of alignments, illustrated by the following *
* example: *
* *
* Alignment Type Tokens so aligned *
* -------------- ----------------- *
* FirstNonLeftComment foo, x, + , / , y/comment r, u/comment k *
* LeftComment comments j *
* CommentInner comments p *
* InfixInner ==, = , *
* AfterInfixInner m, c, *
* InfixArg a, z/z, y/z *
* *
* foo == LET x == / a = m * n c *
* | | | | | | | | | | *
* (* j *) | | | | / a = m / q c (* p *) *
* | | | | | | *
* (* j *) | | x == z | *
* | | | | *
* | | + z * p *
* | | | | | *
* 22
173. /***************************************************************************
* CLASS FindAlignments *
* *
* Contains the one public method *
* *
* public static void FindAlignments(Token[][] spec) *
* *
* that sets the aboveAlign, belowAlign, and isAlignmentPoint fields for *
* all tokens in the tokenized spec spec--except for NULL and MULTI *
* comment tokens, for which the aboveAlign field is set by *
* CommentToken.processComments. (This method should be called after *
* CommentToken.processComments.) *
* *
* There are six kinds of alignments, illustrated by the following *
* example: *
* *
* Alignment Type Tokens so aligned *
* -------------- ----------------- *
* FirstNonLeftComment foo, x, + , / , y/comment r, u/comment k *
* LeftComment comments j *
* CommentInner comments p *
* InfixInner ==, = , *
* AfterInfixInner m, c, *
* InfixArg a, z/z, y/z *
* *
* foo == LET x == / a = m * n c *
* | | | | | | | | | | *
* (* j *) | | | | / a = m / q c (* p *) *
* | | | | | | *
* (* j *) | | x == z | *
* | | | | *
* | | + z * p *
* | | | | | *
* 22
174. /***************************************************************************
* CLASS FindAlignments *
* *
* Contains the one public method *
* *
* public static void FindAlignments(Token[][] spec) *
* *
* that sets the aboveAlign, belowAlign, and isAlignmentPoint fields for *
* all tokens in the tokenized spec spec--except for NULL and MULTI *
* comment tokens, for which the aboveAlign field is set by *
* CommentToken.processComments. (This method should be called after *
* CommentToken.processComments.) *
* *
* There are six kinds of alignments, illustrated by the following *
* example: *
* *
* Alignment Type Tokens so aligned *
* -------------- ----------------- *
* FirstNonLeftComment foo, x, + , / , y/comment r, u/comment k *
* LeftComment comments j *
* CommentInner comments p *
* InfixInner ==, = , *
* AfterInfixInner m, c, *
* InfixArg a, z/z, y/z *
* *
* foo == LET x == / a = m * n c *
* | | | | | | | | | | *
* (* j *) | | | | / a = m / q c (* p *) *
* | | | | | | *
* (* j *) | | x == z | *
* | | | | *
* | | + z * p *
* | | | | | *
*
* There are six kinds of alignments, *
* illustrated by the following example: *
22
175. /***************************************************************************
* CLASS FindAlignments *
* *
* Contains the one public method *
* *
* public static void FindAlignments(Token[][] spec) *
* *
* that sets the aboveAlign, belowAlign, and isAlignmentPoint fields for *
* all tokens in the tokenized spec spec--except for NULL and MULTI *
* comment tokens, for which the aboveAlign field is set by *
* CommentToken.processComments. (This method should be called after *
* CommentToken.processComments.) *
* *
* There are six kinds of alignments, illustrated by the following *
* example: *
* *
* Alignment Type Tokens so aligned *
* -------------- ----------------- *
* FirstNonLeftComment foo, x, + , / , y/comment r, u/comment k *
* LeftComment comments j *
* CommentInner comments p *
* InfixInner ==, = , *
* AfterInfixInner m, c, *
* InfixArg a, z/z, y/z *
* *
* foo == LET x == / a = m * n c *
* | | | | | | | | | | *
* (* j *) | | | | / a = m / q c (* p *) *
* | | | | | | *
* (* j *) | | x == z | *
* | | | | *
* | | + z * p *
* | | | | | *
* 22
176. * | | | | (* p *) *
* | | | | | *
* | | + y (* p *) *
* | | | *
* | | * r *
* | | *
* foo == *
* | *
* (* k *) *
* | *
* u + v *
* *
* For InfixInner and CommentInner alignment, a token’s belowAlign *
* field points to the token directly below it with which it is *
* aligned. *
* *
* For all alignment types, if a token t1 is aligned with a token *
* t2 above it, then t1.aboveAlign points to: *
* *
* IF t2 has no aboveAlign pointer THEN t2 *
* ELSE t2.abovealign. *
* *
* Thus, in the example above, the aboveAlign pointer for all the p *
* comments point to the first p comment. *
* *
* To define the types of alignment, we use the following definitions: *
* *
* - A LEFT-COMMENT is a comment that is the first token on its line but *
* not the last token on its line. (The comments (* j *) in the *
* example are left-comments.) For all the types of alignment except *
* CommentInner, left-comments are treated as if they didn’t exist. *
* *
* - A RIGHT-COMMENT is a comment that is the last token on its line. * 22
177. * Any comment other than a left-comment or a right-comment is treated *
* like any other non-built-in token. We also define: *
* *
* - The COVERING TOKEN of a token t is the right-most token ct that *
* covers t on the last line (one with biggest line number) containing *
* a token that covers t, where a token t1 COVERS a token t2 if t1 *
* lies on an earlier line than t2 and t1.column leq t2.column. *
* However, if there is a DASH between ct and t, or *
* on the same line as ct, then t has no covering token. *
* (This definition has two versions, depending on whether or not *
* left-comments are ignored.) *
* *
* - The BLOCKING TOKEN of a token t is the left-most token s with *
* s.column geq t.column on the last line before t’s line containing *
* such a non-left-comment token s. *
* *
* Here are the descriptions of the different types of alignment. *
* *
* CommentInner: *
* Token t at position pos is CommentInner above-aligned with its *
* blocking token bt at position bpos iff: *
* / t is a right-comment *
* / bt is a right-comment *
* / t.column = bt.column *
* / / bt is not above-aligned with anything *
* / bt is CommentInner aligned with a token above it *
* *
* FirstNonLeftComment *
* If t is the first token on a line that is not a left-comment, and is *
* not a right-comment that is CommentInner aligned with a token above *
* it, then t is FirstNonLeftComment aligned with its covering token. *
* *
22
178. * Any comment other than a left-comment or a right-comment is treated *
* like any other non-built-in token. We also define: *
* *
* - The COVERING TOKEN of a token t is the right-most token ct that *
* covers t on the last line (one with biggest line number) containing *
* a token that covers t, where a token t1 COVERS a token t2 if t1 *
* lies on an earlier line than t2 and t1.column leq t2.column. *
* However, if there is a DASH between ct and t, or *
* on the same line as ct, then t has no covering token. *
* (This definition has two versions, depending on whether or not *
* left-comments are ignored.) *
* *
* - The BLOCKING TOKEN of a token t is the left-most token s with *
* s.column geq t.column on the last line before t’s line containing *
* such a non-left-comment token s. *
* *
* Here are the descriptions of the different types of alignment. *
* *
* CommentInner: *
* Token t at position pos is CommentInner above-aligned with its *
* blocking token bt at position bpos iff: *
* / t is a right-comment *
* / bt is a right-comment *
* / t.column = bt.column *
* / / bt is not above-aligned with anything *
* / bt is CommentInner aligned with a token above it *
* *
* FirstNonLeftComment *
* If t is the first token on a line that is not a left-comment, and is *
* not a right-comment that is CommentInner aligned with a token above *
* it, then t is FirstNonLeftComment aligned with its covering token. *
* *
* Here are the descriptions of the different *
* kinds of alignment. *
22
179. * Any comment other than a left-comment or a right-comment is treated *
* like any other non-built-in token. We also define: *
* *
* - The COVERING TOKEN of a token t is the right-most token ct that *
* covers t on the last line (one with biggest line number) containing *
* a token that covers t, where a token t1 COVERS a token t2 if t1 *
* lies on an earlier line than t2 and t1.column leq t2.column. *
* However, if there is a DASH between ct and t, or *
* on the same line as ct, then t has no covering token. *
* (This definition has two versions, depending on whether or not *
* left-comments are ignored.) *
* *
* - The BLOCKING TOKEN of a token t is the left-most token s with *
* s.column geq t.column on the last line before t’s line containing *
* such a non-left-comment token s. *
* *
* Here are the descriptions of the different types of alignment. *
* *
* CommentInner: *
* Token t at position pos is CommentInner above-aligned with its *
* blocking token bt at position bpos iff: *
* / t is a right-comment *
* / bt is a right-comment *
* / t.column = bt.column *
* / / bt is not above-aligned with anything *
* / bt is CommentInner aligned with a token above it *
* *
* FirstNonLeftComment *
* If t is the first token on a line that is not a left-comment, and is *
* not a right-comment that is CommentInner aligned with a token above *
* it, then t is FirstNonLeftComment aligned with its covering token. *
* *
22
180. * *
* LeftComment: *
* If t is a left-comment token, then it is LeftComment aligned *
* with its covering token (where left-comments are visible). *
* *
* InfixInner: *
* Token t at position pos is InfixInner aligned with its covering *
* token ct at position cpos iff t is not FirstNonLeftComment aligned, *
* and both t and ct are built-in symbols with the same nonzero alignment *
* class. (The name InfixInner is misleading because non-infix symbols *
* like : get aligned by this mechanism.) *
* *
* AfterInfixInner: *
* Token t is After InfixInner aligned with the token above it iff *
* *
* LET lt == the token to the left of t *
* alt == the token at position lt.aboveAlign *
* at == the token to the right of alt *
* IN / t is not the first token on the line *
* / lt is InnerAligned with token alt above it *
* / alt is not the last token on its line. *
* / at is the covering token of t *
* / t.column = at.column *
* / at is not a comment *
* (The name AfterInfixInner means after InfixInner alignment. *
* Remember that some non-infix symbols get InfixInner aligned.) *
* *
* InfixArg: *
* Token t is InfixArg aligned with its covering token ct iff: *
* LET lt == the token to the left of t *
* alt == the token at position lt.aboveAlign *
* IN / t is not the first token on the line *
* / lt is the first non-left-comment token *
23
181. * *
* LeftComment: *
* If t is a left-comment token, then it is LeftComment aligned *
* with its covering token (where left-comments are visible). *
* *
* InfixInner: *
* Token t at position pos is InfixInner aligned with its covering *
* token ct at position cpos iff t is not FirstNonLeftComment aligned, *
* and both t and ct are built-in symbols with the same nonzero alignment *
* class. (The name InfixInner is misleading because non-infix symbols *
* like : get aligned by this mechanism.) *
* *
* AfterInfixInner: *
* Token t is After InfixInner aligned with the token above it iff *
* *
* LET lt == the token to the left of t *
* alt == the token at position lt.aboveAlign *
* at == the token to the right of alt *
* IN / t is not the first token on the line *
* / lt is InnerAligned with token alt above it *
* / alt is not the last token on its line. *
* / at is the covering token of t *
* / t.column = at.column *
* / at is not a comment *
* (The name AfterInfixInner means after InfixInner alignment. *
* Remember that some non-infix symbols get InfixInner aligned.) *
* *
* InfixArg: *
* Token t is InfixArg aligned with its covering token ct iff: *
* LET lt == the token to the left of t *
* alt == the token at position lt.aboveAlign *
* IN / t is not the first token on the line *
* / lt is the first non-left-comment token *
* LeftComment:
* If t is a left-comment token, then it is *
* LeftComment aligned with its covering *
* token. *
23
182. * *
* LeftComment: *
* If t is a left-comment token, then it is LeftComment aligned *
* with its covering token (where left-comments are visible). *
* *
* InfixInner: *
* Token t at position pos is InfixInner aligned with its covering *
* token ct at position cpos iff t is not FirstNonLeftComment aligned, *
* and both t and ct are built-in symbols with the same nonzero alignment *
* class. (The name InfixInner is misleading because non-infix symbols *
* like : get aligned by this mechanism.) *
* *
* AfterInfixInner: *
* Token t is After InfixInner aligned with the token above it iff *
* *
* LET lt == the token to the left of t *
* alt == the token at position lt.aboveAlign *
* at == the token to the right of alt *
* IN / t is not the first token on the line *
* / lt is InnerAligned with token alt above it *
* / alt is not the last token on its line. *
* / at is the covering token of t *
* / t.column = at.column *
* / at is not a comment *
* (The name AfterInfixInner means after InfixInner alignment. *
* Remember that some non-infix symbols get InfixInner aligned.) *
* *
* InfixArg: *
* Token t is InfixArg aligned with its covering token ct iff: *
* LET lt == the token to the left of t *
* alt == the token at position lt.aboveAlign *
* IN / t is not the first token on the line *
* / lt is the first non-left-comment token *
* LeftComment:
* If t is a left-comment token, then it is *
* LeftComment aligned with its covering *
* token. *
23
183. * *
* LeftComment: *
* If t is a left-comment token, then it is LeftComment aligned *
* with its covering token (where left-comments are visible). *
* *
* InfixInner: *
* Token t at position pos is InfixInner aligned with its covering *
* token ct at position cpos iff t is not FirstNonLeftComment aligned, *
* and both t and ct are built-in symbols with the same nonzero alignment *
* class. (The name InfixInner is misleading because non-infix symbols *
* like : get aligned by this mechanism.) *
* *
* AfterInfixInner: *
* Token t is After InfixInner aligned with the token above it iff *
* *
* LET lt == the token to the left of t *
* alt == the token at position lt.aboveAlign *
* at == the token to the right of alt *
* IN / t is not the first token on the line *
* / lt is InnerAligned with token alt above it *
* / alt is not the last token on its line. *
* / at is the covering token of t *
* / t.column = at.column *
* / at is not a comment *
* (The name AfterInfixInner means after InfixInner alignment. *
* Remember that some non-infix symbols get InfixInner aligned.) *
* *
* InfixArg: *
* Token t is InfixArg aligned with its covering token ct iff: *
* LET lt == the token to the left of t *
* alt == the token at position lt.aboveAlign *
* IN / t is not the first token on the line *
* / lt is the first non-left-comment token *
23
184. * Any comment other than a left-comment or a right-comment is treated *
* like any other non-built-in token. We also define: *
* *
* - The COVERING TOKEN of a token t is the right-most token ct that *
* covers t on the last line (one with biggest line number) containing *
* a token that covers t, where a token t1 COVERS a token t2 if t1 *
* lies on an earlier line than t2 and t1.column leq t2.column. *
* However, if there is a DASH between ct and t, or *
* on the same line as ct, then t has no covering token. *
* (This definition has two versions, depending on whether or not *
* left-comments are ignored.) *
* *
* - The BLOCKING TOKEN of a token t is the left-most token s with *
* s.column geq t.column on the last line before t’s line containing *
* such a non-left-comment token s. *
* *
* Here are the descriptions of the different types of alignment. *
* *
* CommentInner: *
* Token t at position pos is CommentInner above-aligned with its *
* blocking token bt at position bpos iff: *
* / t is a right-comment *
* / bt is a right-comment *
* / t.column = bt.column *
* / / bt is not above-aligned with anything *
* / bt is CommentInner aligned with a token above it *
* *
* FirstNonLeftComment *
* If t is the first token on a line that is not a left-comment, and is *
* not a right-comment that is CommentInner aligned with a token above *
* it, then t is FirstNonLeftComment aligned with its covering token. *
* *
23
185. * | | | | (* p *) *
* | | | | | *
* | | + y (* p *) *
* | | | *
* | | * r *
* | | *
* foo == *
* | *
* (* k *) *
* | *
* u + v *
* *
* For InfixInner and CommentInner alignment, a token’s belowAlign *
* field points to the token directly below it with which it is *
* aligned. *
* *
* For all alignment types, if a token t1 is aligned with a token *
* t2 above it, then t1.aboveAlign points to: *
* *
* IF t2 has no aboveAlign pointer THEN t2 *
* ELSE t2.abovealign. *
* *
* Thus, in the example above, the aboveAlign pointer for all the p *
* comments point to the first p comment. *
* *
* To define the types of alignment, we use the following definitions: *
* *
* - A LEFT-COMMENT is a comment that is the first token on its line but *
* not the last token on its line. (The comments (* j *) in the *
* example are left-comments.) For all the types of alignment except *
* CommentInner, left-comments are treated as if they didn’t exist. *
* *
23
186. * | | | | (* p *) *
* | | | | | *
* | | + y (* p *) *
* | | | *
* | | * r *
* | | *
* foo == *
* | *
* (* k *) *
* | *
* u + v *
* *
* For InfixInner and CommentInner alignment, a token’s belowAlign *
* field points to the token directly below it with which it is *
* aligned. *
* *
* For all alignment types, if a token t1 is aligned with a token *
* t2 above it, then t1.aboveAlign points to: *
* *
* IF t2 has no aboveAlign pointer THEN t2 *
* ELSE t2.abovealign. *
* *
* Thus, in the example above, the aboveAlign pointer for all the p *
* comments point to the first p comment. *
* *
* To define the types of alignment, we use the following definitions: *
* *
* - A LEFT-COMMENT is a comment that is the first token on its line but *
* not the last token on its line. (The comments (* j *) in the *
* example are left-comments.) For all the types of alignment except *
* CommentInner, left-comments are treated as if they didn’t exist. *
* *
* - A LEFT-COMMENT is a comment that is the *
* first token on its line but not the last *
* token on its line. *
23
187. * | | | | (* p *) *
* | | | | | *
* | | + y (* p *) *
* | | | *
* | | * r *
* | | *
* foo == *
* | *
* (* k *) *
* | *
* u + v *
* *
* For InfixInner and CommentInner alignment, a token’s belowAlign *
* field points to the token directly below it with which it is *
* aligned. *
* *
* For all alignment types, if a token t1 is aligned with a token *
* t2 above it, then t1.aboveAlign points to: *
* *
* IF t2 has no aboveAlign pointer THEN t2 *
* ELSE t2.abovealign. *
* *
* Thus, in the example above, the aboveAlign pointer for all the p *
* comments point to the first p comment. *
* *
* To define the types of alignment, we use the following definitions: *
* *
* - A LEFT-COMMENT is a comment that is the first token on its line but *
* not the last token on its line. (The comments (* j *) in the *
* example are left-comments.) For all the types of alignment except *
* CommentInner, left-comments are treated as if they didn’t exist. *
* *
23
188. And so on for 215 lines.
This is a mathematical-prose spec of alignment.
It consists of 6 rules plus explanation (comments).
24
189. And so on for 215 lines.
This is a mathematical-prose spec of alignment.
It consists of 6 rules plus explanation (comments).
24
190. And so on for 215 lines.
This is a mathematical-prose spec of alignment.
It consists of 6 rules plus explanation (comments).
24
191. Why did I write this spec?
It was a lot easier to understand and debug 6 rules
than 850 lines of code.
I did a lot of debugging of the rules, aided by debugging code
to report what rules were being used.
The few bugs in implementing the rules were easy to catch.
Had I just written code, it would have taken me much longer
and not produced formatting as good.
24
192. Why did I write this spec?
It was a lot easier to understand and debug 6 rules
than 850 lines of code.
I did a lot of debugging of the rules, aided by debugging code
to report what rules were being used.
The few bugs in implementing the rules were easy to catch.
Had I just written code, it would have taken me much longer
and not produced formatting as good.
24
193. Why did I write this spec?
It was a lot easier to understand and debug 6 rules
than 850 lines of code.
I did a lot of debugging of the rules, aided by debugging code
to report what rules were being used.
The few bugs in implementing the rules were easy to catch.
Had I just written code, it would have taken me much longer
and not produced formatting as good.
24
194. Why did I write this spec?
It was a lot easier to understand and debug 6 rules
than 850 lines of code.
I did a lot of debugging of the rules, aided by debugging code
to report what rules were being used.
The few bugs in implementing the rules were easy to catch.
Had I just written code, it would have taken me much longer
and not produced formatting as good.
24
195. Why did I write this spec?
It was a lot easier to understand and debug 6 rules
than 850 lines of code.
I did a lot of debugging of the rules, aided by debugging code
to report what rules were being used.
The few bugs in implementing the rules were easy to catch.
Had I just written code, it would have taken me much longer
and not produced formatting as good.
24
196. Why did I write this spec?
It was a lot easier to understand and debug 6 rules
than 850 lines of code.
I did a lot of debugging of the rules, aided by debugging code
to report what rules were being used.
The few bugs in implementing the rules were easy to catch.
Had I just written code, it would have taken me much longer
and not produced formatting as good.
24
197. About 10 years later I enhanced the program to pretty-print
PlusCal code in comments.
A lot easier to modify a 6-rule spec than 850 lines of code.
Change to spec: Added one rule.
Changes to code:
Added 2 methods.
Changed one old method:
8 calls to an old method ! calls to a new method
Added 1 call to a new method.
Without spec, probably would have completely rewritten code.
25
198. About 10 years later I enhanced the program to pretty-print
PlusCal code in comments.
A lot easier to modify a 6-rule spec than 850 lines of code.
Change to spec: Added one rule.
Changes to code:
Added 2 methods.
Changed one old method:
8 calls to an old method ! calls to a new method
Added 1 call to a new method.
Without spec, probably would have completely rewritten code.
25
199. About 10 years later I enhanced the program to pretty-print
PlusCal code in comments.
A lot easier to modify a 6-rule spec than 850 lines of code.
Change to spec: Added one rule.
Changes to code:
Added 2 methods.
Changed one old method:
8 calls to an old method ! calls to a new method
Added 1 call to a new method.
Without spec, probably would have completely rewritten code.
25
200. About 10 years later I enhanced the program to pretty-print
PlusCal code in comments.
A lot easier to modify a 6-rule spec than 850 lines of code.
Change to spec: Added one rule.
Changes to code:
Added 2 methods.
Changed one old method:
8 calls to an old method ! calls to a new method
Added 1 call to a new method.
Without spec, probably would have completely rewritten code.
25
201. About 10 years later I enhanced the program to pretty-print
PlusCal code in comments.
A lot easier to modify a 6-rule spec than 850 lines of code.
Change to spec: Added one rule.
Changes to code:
Added 2 methods.
Changed one old method:
8 calls to an old method ! calls to a new method
Added 1 call to a new method.
Without spec, probably would have completely rewritten code.
25
202. Why not a formal spec?
Getting it right not that important.
It didn’t have to work on all corner cases.
There were no tools that could help me.
26
203. Why not a formal spec?
Getting it right not that important.
It didn’t have to work on all corner cases.
There were no tools that could help me.
26
204. Why not a formal spec?
Getting it right not that important.
It didn’t have to work on all corner cases.
There were no tools that could help me.
26
205. Why not a formal spec?
Getting it right not that important.
It didn’t have to work on all corner cases.
There were no tools that could help me.
26
206. What is Typical About This Spec
The spec is at a higher-level than the code.
It could have been implemented in any language.
No method or tool for writing better code would have
helped to write the spec
No method or tool for writing better code would have
made the spec unnecessary.
It says nothing about how to write code.
You write a spec to help you think about the problem
before you think about the code. 27
207. What is Typical About This Spec
The spec is at a higher-level than the code.
It could have been implemented in any language.
No method or tool for writing better code would have
helped to write the spec
No method or tool for writing better code would have
made the spec unnecessary.
It says nothing about how to write code.
You write a spec to help you think about the problem
before you think about the code. 27
208. What is Typical About This Spec
The spec is at a higher-level than the code.
It could have been implemented in any language.
No method or tool for writing better code would have
helped to write the spec
No method or tool for writing better code would have
made the spec unnecessary.
It says nothing about how to write code.
You write a spec to help you think about the problem
before you think about the code. 27
209. What is Typical About This Spec
The spec is at a higher-level than the code.
It could have been implemented in any language.
No method or tool for writing better code would have
helped to write the spec
No method or tool for writing better code would have
made the spec unnecessary.
It says nothing about how to write code.
You write a spec to help you think about the problem
before you think about the code. 27
210. What is Typical About This Spec
The spec is at a higher-level than the code.
It could have been implemented in any language.
No method or tool for writing better code would have
helped to write the spec
No method or tool for writing better code would have
made the spec unnecessary.
It says nothing about how to write code.
You write a spec to help you think about the problem
before you think about the code. 27
211. What is Typical About This Spec
The spec is at a higher-level than the code.
It could have been implemented in any language.
No method or tool for writing better code would have
helped to write the spec
No method or tool for writing better code would have
made the spec unnecessary.
It says nothing about how to write code.
You write a spec to help you think about the problem
before you think about the code. 27
212. What is Typical About This Spec
The spec is at a higher-level than the code.
It could have been implemented in any language.
No method or tool for writing better code would have
helped to write the spec
No method or tool for writing better code would have
made the spec unnecessary.
It says nothing about how to write code.
You write a spec to help you think about the problem
before you think about the code. 27
213. What is Not Typical About This Spec
It’s quite subtle.
95% of the code most people write requires less thought;
specs that are shorter and simpler suffice.
It’s a set of rules.
A set of rules/requirements/axioms is usually a bad spec.
It’s hard to understand the consequences of a set of rules.
The best way to write a functional spec is to write a function.
You can then check that the function implies any desired
requirements.
28
214. What is Not Typical About This Spec
It’s quite subtle.
95% of the code most people write requires less thought;
specs that are shorter and simpler suffice.
It’s a set of rules.
A set of rules/requirements/axioms is usually a bad spec.
It’s hard to understand the consequences of a set of rules.
The best way to write a functional spec is to write a function.
You can then check that the function implies any desired
requirements.
28
215. What is Not Typical About This Spec
It’s quite subtle.
95% of the code most people write requires less thought;
specs that are shorter and simpler suffice.
It’s a set of rules.
A set of rules/requirements/axioms is usually a bad spec.
It’s hard to understand the consequences of a set of rules.
The best way to write a functional spec is to write a function.
You can then check that the function implies any desired
requirements.
28
216. What is Not Typical About This Spec
It’s quite subtle.
95% of the code most people write requires less thought;
specs that are shorter and simpler suffice.
It’s a set of rules.
A set of rules/requirements/axioms is usually a bad spec.
It’s hard to understand the consequences of a set of rules.
The best way to write a functional spec is to write a function.
You can then check that the function implies any desired
requirements.
28
217. What is Not Typical About This Spec
It’s quite subtle.
95% of the code most people write requires less thought;
specs that are shorter and simpler suffice.
It’s a set of rules.
A set of rules/requirements/axioms is usually a bad spec.
It’s hard to understand the consequences of a set of rules.
The best way to write a functional spec is to write a function.
You can then check that the function implies any desired
requirements.
28
218. What is Not Typical About This Spec
It’s quite subtle.
95% of the code most people write requires less thought;
specs that are shorter and simpler suffice.
It’s a set of rules.
A set of rules/requirements/axioms is usually a bad spec.
It’s hard to understand the consequences of a set of rules.
The best way to write a functional spec is to write a function.
You can then check that the function implies any desired
requirements.
28
219. What is Not Typical About This Spec
It’s quite subtle.
95% of the code most people write requires less thought;
specs that are shorter and simpler suffice.
It’s a set of rules.
A set of rules/requirements/axioms is usually a bad spec.
It’s hard to understand the consequences of a set of rules.
The best way to write a functional spec is to write a function.
You can then check that the function implies any desired
requirements.
28
220. What is Not Typical About This Spec
It’s quite subtle.
95% of the code most people write requires less thought;
specs that are shorter and simpler suffice.
It’s a set of rules.
A set of rules/requirements/axioms is usually a bad spec.
It’s hard to understand the consequences of a set of rules.
The best way to write a functional spec is to write a function.
You can then check that the function implies any desired
requirements.
28
221. Specifying How to Compute a Function
Specifying what the pretty-printer should do was hard.
Figuring out how to implement it was easy.
Specifying what a sorting program should do is easy.
Figuring out how to implement it efficiently is hard
(if no one has shown you).
It requires thinking, which means writing a specification.
28
222. Specifying How to Compute a Function
Specifying what the pretty-printer should do was hard.
Figuring out how to implement it was easy.
Specifying what a sorting program should do is easy.
Figuring out how to implement it efficiently is hard
(if no one has shown you).
It requires thinking, which means writing a specification.
28
223. Specifying How to Compute a Function
Specifying what the pretty-printer should do was hard.
Figuring out how to implement it was easy.
Specifying what a sorting program should do is easy.
Figuring out how to implement it efficiently is hard
(if no one has shown you).
It requires thinking, which means writing a specification.
28
224. Specifying How to Compute a Function
Specifying what the pretty-printer should do was hard.
Figuring out how to implement it was easy.
Specifying what a sorting program should do is easy.
Figuring out how to implement it efficiently is hard
(if no one has shown you).
It requires thinking, which means writing a specification.
28
225. Specifying How to Compute a Function
Specifying what the pretty-printer should do was hard.
Figuring out how to implement it was easy.
Specifying what a sorting program should do is easy.
Figuring out how to implement it efficiently is hard
(if no one has shown you).
It requires thinking, which means writing a specification.
28
226. Specifying How to Compute a Function
Specifying what the pretty-printer should do was hard.
Figuring out how to implement it was easy.
Specifying what a sorting program should do is easy.
Figuring out how to implement it efficiently is hard
(if no one has shown you).
It requires thinking, which means writing a specification.
28
227. An example: Quicksort
A divide-and-conquer algorithm for sorting an array
A[0], . . . , A[N 1].
For simplicity, assume the A[i ] are numbers.
29
228. An example: Quicksort
A divide-and-conquer algorithm for sorting an array
A[0], . . . , A[N 1].
For simplicity, assume the A[i ] are numbers.
29
229. An example: Quicksort
A divide-and-conquer algorithm for sorting an array
A[0], . . . , A[N 1].
For simplicity, assume the A[i ] are numbers.
29
230. It uses a procedure Partition(lo; hi).
It chooses pivot in lo : : : (hi 1), permutes A[lo]; : : : ;A[hi]
to make A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi],
and returns pivot.
For this example, we don’t care how this procedure
is implemented.
30
231. It uses a procedure Partition(lo; hi).
It chooses pivot in lo : : : (hi 1), permutes A[lo]; : : : ;A[hi]
to make A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi],
and returns pivot.
For this example, we don’t care how this procedure
is implemented.
30
232. It uses a procedure Partition(lo; hi).
It chooses pivot in lo : : : (hi 1), permutes A[lo]; : : : ;A[hi]
to make A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi],
and returns pivot.
For this example, we don’t care how this procedure
is implemented.
30
233. Let’s specify Quicksort in pseudo-code.
procedure Partition(lo; hi ) {
Pick pivot in lo : : : (hi 1);
Permute A[lo]; : : : ;A[hi ] to make
A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi ];
return pivot; }
procedure QS(lo; hi ) { if (lo hi ) { p := Partition(lo; hi );
QS(lo; p);
QS(p + 1; hi ); } }
main { QS(0;N 1) ; }
But is it really Quicksort?
31
234. procedure Partition(lo; hi ) {
Pick pivot in lo : : : (hi 1);
Permute A[lo]; : : : ;A[hi ] to make
A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi ];
return pivot; }
procedure QS(lo; hi ) { if (lo hi ) { p := Partition(lo; hi );
QS(lo; p);
QS(p + 1; hi ); } }
main { QS(0;N 1) ; }
But is it really Quicksort?
31
235. procedure Partition(lo; hi ) {
Pick pivot in lo : : : (hi 1);
Permute A[lo]; : : : ;A[hi ] to make
A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi ];
return pivot; }
procedure QS(lo; hi ) { if (lo hi ) { p := Partition(lo; hi );
QS(lo; p);
QS(p + 1; hi ); } }
main { QS(0;N 1) ; }
But is it really Quicksort?
31
236. procedure Partition(lo; hi ) {
Pick pivot in lo : : : (hi 1);
Permute A[lo]; : : : ;A[hi ] to make
A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi ];
return pivot; }
procedure QS(lo; hi ) { if (lo hi ) { p := Partition(lo; hi );
QS(lo; p);
QS(p + 1; hi ); } }
main { QS(0;N 1) ; }
But is it really Quicksort?
31
237. procedure Partition(lo; hi ) {
Pick pivot in lo : : : (hi 1);
Permute A[lo]; : : : ;A[hi ] to make
A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi ];
return pivot; }
procedure QS(lo; hi ) { if (lo hi ) { p := Partition(lo; hi );
QS(lo; p);
QS(p + 1; hi ); } }
main { QS(0;N 1) ; }
But is it really Quicksort?
31
238. procedure Partition(lo; hi ) {
Pick pivot in lo : : : (hi 1);
Permute A[lo]; : : : ;A[hi ] to make
A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi ];
return pivot; }
procedure QS(lo; hi ) { if (lo hi ) { p := Partition(lo; hi );
QS(lo; p);
QS(p + 1; hi ); } }
main { QS(0;N 1) ; }
Informal: no formal syntax, no declarations, . . .
Easy to understand.
But is it really Quicksort?
31
239. procedure Partition(lo; hi ) {
Pick pivot in lo : : : (hi 1);
Permute A[lo]; : : : ;A[hi ] to make
A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi ];
return pivot; }
procedure QS(lo; hi ) { if (lo hi ) { p := Partition(lo; hi );
QS(lo; p);
QS(p + 1; hi ); } }
main { QS(0;N 1) ; }
Informal: no formal syntax, no declarations, . . .
Easy to understand.
But is it really Quicksort?
31
240. procedure Partition(lo; hi ) {
Pick pivot in lo : : : (hi 1);
Permute A[lo]; : : : ;A[hi ] to make
A[lo]; : : : ;A[pivot] A[pivot + 1]; : : : ;A[hi ];
return pivot; }
procedure QS(lo; hi ) { if (lo hi ) { p := Partition(lo; hi );
QS(lo; p);
QS(p + 1; hi ); } }
main { QS(0;N 1) ; }
But is it really Quicksort?
31
241. It’s the way Quicksort is almost always described.
But recursion is not a fundamental part of Quicksort.
It’s just one way of implementing divide-and-conquer.
It’s probably not the best way for parallel execution.
31
242. It’s the way Quicksort is almost always described.
But recursion is not a fundamental part of Quicksort.
It’s just one way of implementing divide-and-conquer.
It’s probably not the best way for parallel execution.
31
243. It’s the way Quicksort is almost always described.
But recursion is not a fundamental part of Quicksort.
It’s just one way of implementing divide-and-conquer.
It’s probably not the best way for parallel execution.
31
244. It’s the way Quicksort is almost always described.
But recursion is not a fundamental part of Quicksort.
It’s just one way of implementing divide-and-conquer.
It’s probably not the best way for parallel execution.
31
245. Problem: Write a non-recursive version of Quicksort.
Almost no one can do it in 10 minutes.
They try to “compile” the recursive version.
32
246. Problem: Write a non-recursive version of Quicksort.
Almost no one can do it in 10 minutes.
They try to “compile” the recursive version.
32
247. Problem: Write a non-recursive version of Quicksort.
Almost no one can do it in 10 minutes.
They try to “compile” the recursive version.
32
248. Solution:
Maintain a set U of index ranges on which
Partition needs to be called.
Initially, U equals fh0;N 1ig
We could write it in pseudo-code,
but it’s better to simply write Init and Next directly.
32
249. Solution:
Maintain a set U of index ranges on which
Partition needs to be called.
Initially, U equals fh0;N 1ig
We could write it in pseudo-code,
but it’s better to simply write Init and Next directly.
32
250. Solution:
Maintain a set U of index ranges on which
Partition needs to be called.
Initially, U equals fh0;N 1ig
We could write it in pseudo-code,
but it’s better to simply write Init and Next directly.
32
251. Solution:
Maintain a set U of index ranges on which
Partition needs to be called.
Initially, U equals fh0;N 1ig
We could write it in pseudo-code,
but it’s better to simply write Init and Next directly.
32
252. Init: A = any array of numbers of length N
^ U = fh0;N 1ig
Before writing Next, let’s make a definition:
Partitions(B; pivot; lo; hi) =
the set of arrays obtained from B by permuting
B[lo], . . . , B[hi] such that . . .
Next:
A relation between old values of A, U
and new values A0, U0.
33
253. Init: A = any array of numbers of length N
^ U = fh0;N 1ig
Before writing Next, let’s make a definition:
Partitions(B; pivot; lo; hi) =
the set of arrays obtained from B by permuting
B[lo], . . . , B[hi] such that . . .
Next:
A relation between old values of A, U
and new values A0, U0.
33
254. Init: A = any array of numbers of length N
^ U = fh0;N 1ig
Before writing Next, let’s make a definition:
Partitions(B; pivot; lo; hi) =
the set of arrays obtained from B by permuting
B[lo], . . . , B[hi] such that . . .
Next:
A relation between old values of A, U
and new values A0, U0.
33
255. Init: A = any array of numbers of length N
^ U = fh0;N 1ig
Before writing Next, let’s make a definition:
Partitions(B; pivot; lo; hi) =
the set of arrays obtained from B by permuting
B[lo], . . . , B[hi] such that . . .
Next:
A relation between old values of A, U
and new values A0, U0.
33
256. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
35
257. Next:
U6= fg Stop if U = fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
35
258. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
35
259. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
35
260. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
35
261. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
35
262. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
35
263. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
35
264. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
35
265. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
38
266. Why can (almost) no one find this version of Quicksort?
Their minds are stuck in code.
They can’t think at a higher level.
38
267. Why can (almost) no one find this version of Quicksort?
Their minds are stuck in code.
They can’t think at a higher level.
38
268. Why can (almost) no one find this version of Quicksort?
Their minds are stuck in code.
They can’t think at a higher level.
38
269. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
Easy to write this as a formula.
39
270. Next:
U6= fg
^ Pick any hb; ti in U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
Pick an arbitrary value
39
271. Next:
U6= fg
^ 9 hb; ti 2 U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
Pick an arbitrary value is existential quantification.
39
272. Next:
U6= fg
^ 9 hb; ti 2 U :
IF b6= t
THEN Pick any p in b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
Pick an arbitrary value is existential quantification.
39
273. Next:
U6= fg
^ 9 hb; ti 2 U :
IF b6= t
THEN 9 p 2 b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
Pick an arbitrary value is existential quantification.
39
274. Next:
U6= fg
^ 9 hb; ti 2 U :
IF b6= t
THEN 9 p 2 b : : (t1) :
A0 = Any element of Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
Or sometimes
39
275. Next:
U6= fg
^ 9 hb; ti 2 U :
IF b6= t
THEN 9 p 2 b : : (t1) :
A0 2 Partitions(A; p; b; t)
^ U0 = U with hb; ti removed and
hb; pi and hp+1; ti added
ELSE A0 = A
^ U0 = U with hb; ti removed
Or sometimes even simpler.
39
276. Next:
U6= fg
^ 9 hb; ti 2 U :
IF b6= t
THEN 9 p 2 b : : (t1) :
A0 2 Partitions(A; p; b; t)
^ U0 = (U n fhb; tig) [ fhb; pi; hp+1; tig
ELSE A0 = A
^ U0 = U n fhb; tig
And so on.
39
277. Next:
U6= fg
^ 9 hb; ti 2 U :
IF b6= t
THEN 9 p 2 b : : (t1) :
A0 2 Partitions(A; p; b; t)
^ U0 = (U n fhb; tig) [ fhb; pi; hp+1; tig
ELSE A0 = A
^ U0 = U n fhb; tig
A TLA+ formula.
39
278. Next:
U6= fg
^ 9 hb; ti 2 U :
IF b6= t
THEN 9 p 2 b : : (t1) :
A0 2 Partitions(A; p; b; t)
^ U0 = (U n fhb; tig) [ fhb; pi; hp+1; tig
ELSE A0 = A
^ U0 = U n fhb; tig
If you prefer pseudo-code. . .
39
279. PlusCal
Like a toy programming language.
Algorithm appears in a comment in a TLA+ module.
An expression can be any TLA+ expression.
Constructs for nondeterminism.
Compiled to an easy to understand TLA+ spec.
Can apply TLA+ tools.
40
280. PlusCal
Like a toy programming language.
Algorithm appears in a comment in a TLA+ module.
An expression can be any TLA+ expression.
Constructs for nondeterminism.
Compiled to an easy to understand TLA+ spec.
Can apply TLA+ tools.
40
281. PlusCal
Like a toy programming language.
Algorithm appears in a comment in a TLA+ module.
An expression can be any TLA+ expression.
Constructs for nondeterminism.
Compiled to an easy to understand TLA+ spec.
Can apply TLA+ tools.
40
282. PlusCal
Like a toy programming language.
Algorithm appears in a comment in a TLA+ module.
An expression can be any TLA+ expression.
Constructs for nondeterminism.
Compiled to an easy to understand TLA+ spec.
Can apply TLA+ tools.
40
283. PlusCal
Like a toy programming language.
Algorithm appears in a comment in a TLA+ module.
An expression can be any TLA+ expression.
Constructs for nondeterminism.
Compiled to an easy to understand TLA+ spec.
Can apply TLA+ tools.
40
284. PlusCal
Like a toy programming language.
Algorithm appears in a comment in a TLA+ module.
An expression can be any TLA+ expression.
Constructs for nondeterminism.
Compiled to an easy to understand TLA+ spec.
Can apply TLA+ tools.
40
285. PlusCal
Like a toy programming language.
Algorithm appears in a comment in a TLA+ module.
An expression can be any TLA+ expression.
Constructs for nondeterminism.
Compiled to an easy to understand TLA+ spec.
Can apply TLA+ tools.
40
286. Programs that Run Forever
I’ve been talking about programs that compute a function.
Programs that run forever usually involve concurrency:
– Operating systems.
– Distributed systems.
Few people can get them right by just thinking (and writing).
I’m not one of them.
We need tools to check what we do.
Use TLA+/ PlusCal.
41
287. Programs that Run Forever
I’ve been talking about programs that compute a function.
Programs that run forever usually involve concurrency:
– Operating systems.
– Distributed systems.
Few people can get them right by just thinking (and writing).
I’m not one of them.
We need tools to check what we do.
Use TLA+/ PlusCal.
41
288. Programs that Run Forever
I’ve been talking about programs that compute a function.
Programs that run forever usually involve concurrency:
– Operating systems.
– Distributed systems.
Few people can get them right by just thinking (and writing).
I’m not one of them.
We need tools to check what we do.
Use TLA+/ PlusCal.
41
289. Programs that Run Forever
I’ve been talking about programs that compute a function.
Programs that run forever usually involve concurrency:
– Operating systems.
– Distributed systems.
Few people can get them right by just thinking (and writing).
I’m not one of them.
We need tools to check what we do.
Use TLA+/ PlusCal.
41
290. Programs that Run Forever
I’ve been talking about programs that compute a function.
Programs that run forever usually involve concurrency:
– Operating systems.
– Distributed systems.
Few people can get them right by just thinking (and writing).
I’m not one of them.
We need tools to check what we do.
Use TLA+/ PlusCal.
41
291. Programs that Run Forever
I’ve been talking about programs that compute a function.
Programs that run forever usually involve concurrency:
– Operating systems.
– Distributed systems.
Few people can get them right by just thinking (and writing).
I’m not one of them.
We need tools to check what we do.
Use TLA+/ PlusCal.
41
292. Programs that Run Forever
I’ve been talking about programs that compute a function.
Programs that run forever usually involve concurrency:
– Operating systems.
– Distributed systems.
Few people can get them right by just thinking (and writing).
I’m not one of them.
We need tools to check what we do.
Use TLA+/ PlusCal.
41
293. Programs that Run Forever
I’ve been talking about programs that compute a function.
Programs that run forever usually involve concurrency:
– Operating systems.
– Distributed systems.
Few people can get them right by just thinking (and writing).
I’m not one of them.
We need tools to check what we do.
Use TLA+/ PlusCal.
41
294. Programs that Run Forever
I’ve been talking about programs that compute a function.
Programs that run forever usually involve concurrency:
– Operating systems.
– Distributed systems.
Few people can get them right by just thinking (and writing).
I’m not one of them.
We need tools to check what we do.
Use TLA+/ PlusCal.
41
296. The Other 95%
/***********************************************************
* CLASS ResourceFileReader *
* *
* A ResourceFileReader returns an object for reading a *
* resource file, which is a file kept in the same *
* directory as the tlatex.Token class. The constructor *
* takes a file name as argument. The object’s two public *
* methods are *
* *
* getLine() : Returns the next line of the file as a *
* string. Returns null after the last line. *
* *
* close() : Closes the file. *
***********************************************************/
42
297. Why did I write that spec?
To be sure I knew what the code should do before writing it.
Without writing a spec, I only thought I knew what it should do.
Later, I didn’t have to read the code to know what it did.
General rule:
A spec of what the code does should say everything
that anyone needs to know to use the code.
43
298. Why did I write that spec?
To be sure I knew what the code should do before writing it.
Without writing a spec, I only thought I knew what it should do.
Later, I didn’t have to read the code to know what it did.
General rule:
A spec of what the code does should say everything
that anyone needs to know to use the code.
43
299. Why did I write that spec?
To be sure I knew what the code should do before writing it.
Without writing a spec, I only thought I knew what it should do.
Later, I didn’t have to read the code to know what it did.
General rule:
A spec of what the code does should say everything
that anyone needs to know to use the code.
43
300. Why did I write that spec?
To be sure I knew what the code should do before writing it.
Without writing a spec, I only thought I knew what it should do.
Later, I didn’t have to read the code to know what it did.
General rule:
A spec of what the code does should say everything
that anyone needs to know to use the code.
43
301. Why did I write that spec?
To be sure I knew what the code should do before writing it.
Without writing a spec, I only thought I knew what it should do.
Later, I didn’t have to read the code to know what it did.
General rule:
A spec of what the code does should say everything
that anyone needs to know to use the code.
43
302. Why did I write that spec?
To be sure I knew what the code should do before writing it.
Without writing a spec, I only thought I knew what it should do.
Later, I didn’t have to read the code to know what it did.
How the code worked was too simple to require a spec.
43
303. What programmers should know about thinking.
Everyone thinks they think.
If you don’t write down your thoughts,
you’re fooling yourself.
43
304. What everyone should know about thinking.
Everyone thinks they think.
If you don’t write down your thoughts,
you’re fooling yourself.
43
305. What everyone should know about thinking.
Everyone thinks they think.
If you don’t write down your thoughts,
you’re fooling yourself.
43
306. What everyone should know about thinking.
Everyone thinks they think.
If you don’t write down your thoughts,
you’re fooling yourself.
43
307. What programmers should know about thinking.
You should think before you code.
A spec is simply what you write before coding.
43
308. What programmers should know about thinking.
You should think before you code.
A spec is simply what you write before coding.
43
309. What programmers should know about thinking.
You should write before you code.
A spec is simply what you write before coding.
43
310. What programmers should know about thinking.
You should write before you code.
A spec is simply what you write before coding.
43
311. What code should you specify?
Any piece of code that someone else might want to
use or modify.
It could be:
An entire program or system.
A class.
A method.
A tricky piece of code in a method.
44
312. What code should you specify?
Any piece of code that someone else might want to
use or modify.
It could be:
An entire program or system.
A class.
A method.
A tricky piece of code in a method.
44
313. What code should you specify?
you
Any piece of code that someone else
might want to
use or modify in a month.
It could be:
An entire program or system.
A class.
A method.
A tricky piece of code in a method.
44
314. What code should you specify?
you
Any piece of code that someone else
might want to
use or modify in a month.
It could be:
An entire program or system.
A class.
A method.
A tricky piece of code in a method.
44
315. What code should you specify?
you
Any piece of code that someone else
might want to
use or modify in a month.
It could be:
An entire program or system.
A class.
A method.
A tricky piece of code in a method.
44
316. What code should you specify?
you
Any piece of code that someone else
might want to
use or modify in a month.
It could be:
An entire program or system.
A class.
A method.
A tricky piece of code in a method.
44
317. What code should you specify?
you
Any piece of code that someone else
might want to
use or modify in a month.
It could be:
An entire program or system.
A class.
A method.
A tricky piece of code in a method.
44
318. What code should you specify?
you
Any piece of code that someone else
might want to
use or modify in a month.
It could be:
An entire program or system.
A class.
A method.
A tricky piece of code in a method.
44
319. What should you specify about the code?
What it does.
Everything anyone needs to know to use it.
Maybe: how it does it.
The algorithm / high-level design.
44
320. What should you specify about the code?
What it does.
Everything anyone needs to know to use it.
Maybe: how it does it.
The algorithm / high-level design.
44
321. What should you specify about the code?
What it does.
Everything anyone needs to know to use it.
Maybe: how it does it.
The algorithm / high-level design.
44
322. What should you specify about the code?
What it does.
Everything anyone needs to know to use it.
Maybe: how it does it.
The algorithm / high-level design.
44
323. What should you specify about the code?
What it does.
Everything anyone needs to know to use it.
Maybe: how it does it.
The algorithm / high-level design.
44
324. How should you think about / specify the code?
Above the code level.
In terms of states and behaviors.
Mathematically, as rigorously / formally as necessary.
Perhaps with pseudo-code or PlusCal if specifying how.
45
325. How should you think about / specify the code?
Above the code level.
In terms of states and behaviors.
Mathematically, as rigorously / formally as necessary.
Perhaps with pseudo-code or PlusCal if specifying how.
45
326. How should you think about / specify the code?
Above the code level.
In terms of states and behaviors.
Mathematically, as rigorously / formally as necessary.
Perhaps with pseudo-code or PlusCal if specifying how.
45