Structural Induction

Similar documents
1 Solutions to Tute09

COMPUTER SCIENCE 20, SPRING 2014 Homework Problems Recursive Definitions, Structural Induction, States and Invariants

Lecture l(x) 1. (1) x X

CSE 21 Winter 2016 Homework 6 Due: Wednesday, May 11, 2016 at 11:59pm. Instructions

MSU CSE Spring 2011 Exam 2-ANSWERS

A relation on 132-avoiding permutation patterns

Introduction to Greedy Algorithms: Huffman Codes

AVL Trees. The height of the left subtree can differ from the height of the right subtree by at most 1.

The Real Numbers. Here we show one way to explicitly construct the real numbers R. First we need a definition.

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Homework #4. CMSC351 - Spring 2013 PRINT Name : Due: Thu Apr 16 th at the start of class

arxiv: v1 [math.co] 31 Mar 2009

SET 1C Binary Trees. 2. (i) Define the height of a binary tree or subtree and also define a height balanced (AVL) tree. (2)

Notes on Natural Logic

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

An effective perfect-set theorem

Best response cycles in perfect information games

NOTES ON FIBONACCI TREES AND THEIR OPTIMALITY* YASUICHI HORIBE INTRODUCTION 1. FIBONACCI TREES

Practice Second Midterm Exam II

The Turing Definability of the Relation of Computably Enumerable In. S. Barry Cooper

Generalising the weak compactness of ω

Lecture 5: Tuesday, January 27, Peterson s Algorithm satisfies the No Starvation property (Theorem 1)

Lecture 2: The Simple Story of 2-SAT

Stanford University, CS 106X Homework Assignment 5: Priority Queue Binomial Heap Optional Extension

In this lecture, we will use the semantics of our simple language of arithmetic expressions,

TABLEAU-BASED DECISION PROCEDURES FOR HYBRID LOGIC

R-automata. 1 Introduction. Parosh Aziz Abdulla, Pavel Krcal, and Wang Yi

On the Optimality of a Family of Binary Trees Techical Report TR

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

LECTURE 2: MULTIPERIOD MODELS AND TREES

The suffix binary search tree and suffix AVL tree

Gödel algebras free over finite distributive lattices

Fundamental Algorithms - Surprise Test

MAT25 LECTURE 10 NOTES. = a b. > 0, there exists N N such that if n N, then a n a < ɛ

Lecture 6. 1 Polynomial-time algorithms for the global min-cut problem

MAC Learning Objectives. Learning Objectives (Cont.)

Algorithmic Game Theory and Applications. Lecture 11: Games of Perfect Information

The Limiting Distribution for the Number of Symbol Comparisons Used by QuickSort is Nondegenerate (Extended Abstract)

Lecture 14: Basic Fixpoint Theorems (cont.)

The Probabilistic Method - Probabilistic Techniques. Lecture 7: Martingales

Heap Building Bounds

Computing Unsatisfiable k-sat Instances with Few Occurrences per Variable

Ch 10 Trees. Introduction to Trees. Tree Representations. Binary Tree Nodes. Tree Traversals. Binary Search Trees

Sublinear Time Algorithms Oct 19, Lecture 1

The Traveling Salesman Problem. Time Complexity under Nondeterminism. A Nondeterministic Algorithm for tsp (d)

Computing Unsatisfiable k-sat Instances with Few Occurrences per Variable

On the Optimality of a Family of Binary Trees

Lecture 4: Divide and Conquer

Finding Equilibria in Games of No Chance

Essays on Some Combinatorial Optimization Problems with Interval Data

TR : Knowledge-Based Rational Decisions and Nash Paths

Lattices and the Knaster-Tarski Theorem

IEOR E4004: Introduction to OR: Deterministic Models

Global Joint Distribution Factorizes into Local Marginal Distributions on Tree-Structured Graphs

UPWARD STABILITY TRANSFER FOR TAME ABSTRACT ELEMENTARY CLASSES

COMP Analysis of Algorithms & Data Structures

Design and Analysis of Algorithms 演算法設計與分析. Lecture 9 November 19, 2014 洪國寶

Pareto-Optimal Assignments by Hierarchical Exchange

arxiv: v1 [math.lo] 24 Feb 2014

Data Structures. Binomial Heaps Fibonacci Heaps. Haim Kaplan & Uri Zwick December 2013

Notes on the symmetric group

Hyperidentities in (xx)y xy Graph Algebras of Type (2,0)

CSE 417 Algorithms. Huffman Codes: An Optimal Data Compression Method

Search Space and Average Proof Length of Resolution. H. Kleine Buning T. Lettmann. Universitat { GH { Paderborn. Postfach 16 21

Smoothed Analysis of Binary Search Trees

Design and Analysis of Algorithms

A Testing Read-Once Formula Satisfaction

Bounds on coloring numbers

Decidability and Recursive Languages

The potential function φ for the amortized analysis of an operation on Fibonacci heap at time (iteration) i is given by the following equation:

Supporting Information

DESCENDANTS IN HEAP ORDERED TREES OR A TRIUMPH OF COMPUTER ALGEBRA

Q1. [?? pts] Search Traces

Design and Analysis of Algorithms. Lecture 9 November 20, 2013 洪國寶

Continuous images of closed sets in generalized Baire spaces ESI Workshop: Forcing and Large Cardinals

Yao s Minimax Principle

Course Information and Introduction

Maximizing the Spread of Influence through a Social Network Problem/Motivation: Suppose we want to market a product or promote an idea or behavior in

Binary Tree Applications

Virtual Demand and Stable Mechanisms

On the Efficiency of Sequential Auctions for Spectrum Sharing

Crash-tolerant Consensus in Directed Graph Revisited

COMBINATORICS OF REDUCTIONS BETWEEN EQUIVALENCE RELATIONS

The ruin probabilities of a multidimensional perturbed risk model

Game Theory: Normal Form Games

1 Binomial Tree. Structural Properties:

3 Arbitrage pricing theory in discrete time.

2 Deduction in Sentential Logic

The Binomial Theorem and Consequences

Arborescent Architecture for Decentralized Supervisory Control of Discrete Event Systems

The Pill Problem, Lattice Paths and Catalan Numbers

Algebra homework 8 Homomorphisms, isomorphisms

Hierarchical Exchange Rules and the Core in. Indivisible Objects Allocation

5 Deduction in First-Order Logic

HW 1 Reminder. Principles of Programming Languages. Lets try another proof. Induction. Induction on Derivations. CSE 230: Winter 2007

BAYESIAN GAMES: GAMES OF INCOMPLETE INFORMATION

4 Martingales in Discrete-Time

Binary and Binomial Heaps. Disclaimer: these slides were adapted from the ones by Kevin Wayne

Alain Hertz 1 and Sacha Varone 2. Introduction A NOTE ON TREE REALIZATIONS OF MATRICES. RAIRO Operations Research Will be set by the publisher

FORCING AND THE HALPERN-LÄUCHLI THEOREM. 1. Introduction This document is a continuation of [1]. It is intended to be part of a larger paper.

Transcription:

Structural Induction Jason Filippou CMSC250 @ UMCP 07-05-2016 Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 1 / 26

Outline 1 Recursively defined structures 2 Proofs Binary Trees Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 2 / 26

Recursively defined structures Recursively defined structures Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 3 / 26

Recursively defined structures Recursively defined structures Many structures in Computer Science are recursively defined, i.e parts of them exhibit the same characteristics and have the same properties as the whole! They are also well-ordered, in the sense that they exhibit a well-founded partial order, like the order of Z or for sets. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 4 / 26

Recursively defined structures Structural induction as a proof methodology Structural induction is a proof methodology similar to mathematical induction, only instead of working in the domain of positive integers (N) it works in the domain of such recursively defined structures! It is terrifically useful for proving properties of such structures. Its structure is sometimes looser than that of mathematical induction. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 5 / 26

Proofs Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 6 / 26

Binary Trees Binary Trees Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 7 / 26

Binary Trees Pictorially Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 8 / 26

Binary Trees Pictorially Height: 2 # Nodes: 7 Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 9 / 26

Binary Trees Pictorially Root r Height: 2 # Nodes: 7 Height: 1 # Nodes: 3 Height: 1 # Nodes: 3 Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 10 / 26

Binary Trees A recursive definition and statement on binary trees Definition (Non-empty binary tree) A non-empty binary tree T is either: Base case: A root node r with no pointers, or Recursive (or inductive) step: A root node r pointing to 2 non-empty binary trees T L and T R Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 11 / 26

Binary Trees A recursive definition and statement on binary trees Definition (Non-empty binary tree) A non-empty binary tree T is either: Base case: A root node r with no pointers, or Recursive (or inductive) step: A root node r pointing to 2 non-empty binary trees T L and T R Claim: V = E + 1 The number of vertices ( V ) of a non-empty binary tree T is the number of its edges ( E ) plus one. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 11 / 26

Binary Trees First structurally inductive proof Proof (via structural induction on non-empty binary trees). Let T be a non-empty binary tree and P the proposition we want to hold.. 1 Inductive Base: If T consists of a single root node r (base case for a non-empty binary tree), then V = 1 and E = 0, so P (r) holds. 2 Inductive Hypothesis: In the recursive part of the definition for a non-empty binary tree, T may consist of a root node r pointing to 1 or 2 non-empty binary trees T L and T R. Without loss of generality, we can assume that both T L and T R are defined, and we assume P (T L) and P (T R). 3 Inductive Step: We prove now that P (T ) must hold. Denote by V L, E L, V R, E R the vertex and edge sets of the left and right subtrees respectively. We obtain: V = V L + V R + 1 (By definition of non-empty binary trees) = ( E L + 1) + ( E R + 1) + 1 (By the Inductive Hypothesis) = ( E L + E R + 2) + 1 (By grouping terms) = E + 1 (By definition of non-empty binary trees) So P (T ) holds. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 12 / 26

Binary Trees Here s one for you! Definition (Height of a non-empty binary tree) The height h(t ) of a non-empty binary tree T is defined as follows: (Base case:) If T is a single root node r, h(r) = 0. (Recursive step:) If T is a root node connected to two sub-trees T L and T R, h(t ) = max{h(t R ), h(t L )} + 1 Theorem (m(t ) as a function of h(t )) A non-empty binary tree T of height h(t ) has at most 2 h(t )+1 1 nodes. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 13 / 26

Binary Trees General Structure of structurally inductive proofs on trees 1 Prove P ( ) for the base-case of the tree. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 14 / 26

Binary Trees General Structure of structurally inductive proofs on trees 1 Prove P ( ) for the base-case of the tree. This can either be an empty tree, or a trivial root node, say r. That is, you will prove something like P (null) or P (r). Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 14 / 26

Binary Trees General Structure of structurally inductive proofs on trees 1 Prove P ( ) for the base-case of the tree. This can either be an empty tree, or a trivial root node, say r. That is, you will prove something like P (null) or P (r). As always, prove explicitly! Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 14 / 26

Binary Trees General Structure of structurally inductive proofs on trees 1 Prove P ( ) for the base-case of the tree. This can either be an empty tree, or a trivial root node, say r. That is, you will prove something like P (null) or P (r). As always, prove explicitly! 2 Assume the inductive hypothesis for an arbitrary tree T, i.e assume P (T ). Valid to do so, since at least for the trivial case we have explicit proof! Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 14 / 26

Binary Trees General Structure of structurally inductive proofs on trees 1 Prove P ( ) for the base-case of the tree. This can either be an empty tree, or a trivial root node, say r. That is, you will prove something like P (null) or P (r). As always, prove explicitly! 2 Assume the inductive hypothesis for an arbitrary tree T, i.e assume P (T ). Valid to do so, since at least for the trivial case we have explicit proof! 3 Use the inductive / recursive part of the tree s definition to build a new tree, say T, from existing (sub-)trees T i, and prove P (T )! Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 14 / 26

Binary Trees General Structure of structurally inductive proofs on trees 1 Prove P ( ) for the base-case of the tree. This can either be an empty tree, or a trivial root node, say r. That is, you will prove something like P (null) or P (r). As always, prove explicitly! 2 Assume the inductive hypothesis for an arbitrary tree T, i.e assume P (T ). Valid to do so, since at least for the trivial case we have explicit proof! 3 Use the inductive / recursive part of the tree s definition to build a new tree, say T, from existing (sub-)trees T i, and prove P (T )! Use the Inductive Hypothesis on the T i! Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 14 / 26

Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 15 / 26

Recursive definitions of sets can be defined recursively! Our goal is to find a flat definition of them (a closed-form description), much in the same way we did with recursive sequences and strong induction. Consider the following: ason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 16 / 26

Recursive definitions of sets can be defined recursively! Our goal is to find a flat definition of them (a closed-form description), much in the same way we did with recursive sequences and strong induction. Consider the following: 1 S 1 is such that 3 S 1 (base case) and if x, y S 1, then x + y S 1 (recursive step). ason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 16 / 26

Recursive definitions of sets can be defined recursively! Our goal is to find a flat definition of them (a closed-form description), much in the same way we did with recursive sequences and strong induction. Consider the following: 1 S 1 is such that 3 S 1 (base case) and if x, y S 1, then x + y S 1 (recursive step). 2 S 2 is such that 2 S 2 and if x S 2, then x 2 S 2. ason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 16 / 26

Recursive definitions of sets can be defined recursively! Our goal is to find a flat definition of them (a closed-form description), much in the same way we did with recursive sequences and strong induction. Consider the following: 1 S 1 is such that 3 S 1 (base case) and if x, y S 1, then x + y S 1 (recursive step). 2 S 2 is such that 2 S 2 and if x S 2, then x 2 S 2. 3 S 3 is such that 0 S 3 and if y S 3, then y + 1 S 3. ason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 16 / 26

Recursive definitions of sets can be defined recursively! Our goal is to find a flat definition of them (a closed-form description), much in the same way we did with recursive sequences and strong induction. Consider the following: 1 S 1 is such that 3 S 1 (base case) and if x, y S 1, then x + y S 1 (recursive step). 2 S 2 is such that 2 S 2 and if x S 2, then x 2 S 2. 3 S 3 is such that 0 S 3 and if y S 3, then y + 1 S 3. Vote (> 1 possible)! 2 S 1 S 2 S 3 ason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 16 / 26

Recursive definitions of sets can be defined recursively! Our goal is to find a flat definition of them (a closed-form description), much in the same way we did with recursive sequences and strong induction. Consider the following: 1 S 1 is such that 3 S 1 (base case) and if x, y S 1, then x + y S 1 (recursive step). 2 S 2 is such that 2 S 2 and if x S 2, then x 2 S 2. 3 S 3 is such that 0 S 3 and if y S 3, then y + 1 S 3. Vote (> 1 possible)! 2 S 1 S 2 S 3 16 S 1 S 2 S 3 Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 16 / 26

Recursive definitions of sets can be defined recursively! Our goal is to find a flat definition of them (a closed-form description), much in the same way we did with recursive sequences and strong induction. Consider the following: 1 S 1 is such that 3 S 1 (base case) and if x, y S 1, then x + y S 1 (recursive step). 2 S 2 is such that 2 S 2 and if x S 2, then x 2 S 2. 3 S 3 is such that 0 S 3 and if y S 3, then y + 1 S 3. Vote (> 1 possible)! 2 S 1 S 2 S 3 16 S 1 S 2 S 3 21 S 1 S 2 S 3 Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 16 / 26

Practice! 4 S 4 is such that 1 S 4 and if x, y S 4, then x( y) S 4. 5 S 5 is such that S 5 and a S 5 {a} S 5. 6 S 6 is such that S 6 and a, b S 6 a b S 6. 7 S 7 is such that {0} S 7 and (x S 7) (i N ) x {i} S 7. 8 S 8 is such that i N {i} {i + 1} S 8. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 17 / 26

Practice! 4 S 4 is such that 1 S 4 and if x, y S 4, then x( y) S 4. 5 S 5 is such that S 5 and a S 5 {a} S 5. 6 S 6 is such that S 6 and a, b S 6 a b S 6. 7 S 7 is such that {0} S 7 and (x S 7) (i N ) x {i} S 7. 8 S 8 is such that i N {i} {i + 1} S 8. S 4 = 0 1 2 + Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 17 / 26

Practice! 4 S 4 is such that 1 S 4 and if x, y S 4, then x( y) S 4. 5 S 5 is such that S 5 and a S 5 {a} S 5. 6 S 6 is such that S 6 and a, b S 6 a b S 6. 7 S 7 is such that {0} S 7 and (x S 7) (i N ) x {i} S 7. 8 S 8 is such that i N {i} {i + 1} S 8. S 4 = 0 1 2 + S 5 = 0 1 2 + Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 17 / 26

Practice! 4 S 4 is such that 1 S 4 and if x, y S 4, then x( y) S 4. 5 S 5 is such that S 5 and a S 5 {a} S 5. 6 S 6 is such that S 6 and a, b S 6 a b S 6. 7 S 7 is such that {0} S 7 and (x S 7) (i N ) x {i} S 7. 8 S 8 is such that i N {i} {i + 1} S 8. S 4 = 0 1 2 + S 5 = 0 1 2 + S 6 = 0 1 2 + Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 17 / 26

Practice! 4 S 4 is such that 1 S 4 and if x, y S 4, then x( y) S 4. 5 S 5 is such that S 5 and a S 5 {a} S 5. 6 S 6 is such that S 6 and a, b S 6 a b S 6. 7 S 7 is such that {0} S 7 and (x S 7) (i N ) x {i} S 7. 8 S 8 is such that i N {i} {i + 1} S 8. S 4 = 0 1 2 + S 5 = 0 1 2 + S 6 = 0 1 2 + S 7 = 0 1 2 + Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 17 / 26

Practice! 4 S 4 is such that 1 S 4 and if x, y S 4, then x( y) S 4. 5 S 5 is such that S 5 and a S 5 {a} S 5. 6 S 6 is such that S 6 and a, b S 6 a b S 6. 7 S 7 is such that {0} S 7 and (x S 7) (i N ) x {i} S 7. 8 S 8 is such that i N {i} {i + 1} S 8. S 4 = 0 1 2 + S 5 = 0 1 2 + S 6 = 0 1 2 + S 7 = 0 1 2 + S 8 = 0 1 2 + Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 17 / 26

Our first structurally inductive proof on sets A proposition on a recursively defined set Let S be a set defined as follows: Base case: 4 S Recursive / Inductive step: If x S, then x 2 S. Then, prove that x S, x is even. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 18 / 26

Our first structurally inductive proof on sets A proposition on a recursively defined set Let S be a set defined as follows: Base case: 4 S Recursive / Inductive step: If x S, then x 2 S. Then, prove that x S, x is even. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 18 / 26

Proof Proof (via structural induction on S). Let P be the proposition we want to prove. We proceed inductively: Inductive base: In the base case of the definition of S, we have that 4 S. Since 4 is an even number, P ({4}) holds. Inductive hypothesis: The inductive definition of S successively builds sets S from previous versions of S. We assume that S : S 1 and P (S ). Inductive step: We will prove that P (S {x 2 x S }) holds. Let x 0 be an arbitrarily selected element of S. From the inductive hypothesis, we know that x 0 is even. From a known theorem, we know that x 2 0 is even. But this means that P ({x 0}), and since x 0 was arbitrarily selected within S, P (S {x 2 x S }) holds. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 19 / 26

A proof on the Cartesian Plane An inequality proof Let S be the subset of Z Z = Z 2 defined as follows: Base case: (0, 0) S Recursive step: (a, b) S (((a, b+1) S) ((a+1, b+1) S) (a+2, b+1) S). Prove that (a, b) S, a 2b. Suggestion: To make sure you understand the exercise, first list 5 elements in S. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 20 / 26

Cartesian plane exercise, proof In class! Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 21 / 26

Set equality and structural induction The set of positive multiples of 3 Let the set S be such that: (Base case:) 3 S (Recursive step:) (x S) (y S) (x + y) S Then, S = {3n, n N }. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 22 / 26

Set equality and structural induction The set of positive multiples of 3 Let the set S be such that: (Base case:) 3 S (Recursive step:) (x S) (y S) (x + y) S Then, S = {3n, n N }. What do I need to do in order to prove this statement? Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 22 / 26

Set equality and structural induction The set of positive multiples of 3 Let the set S be such that: (Base case:) 3 S (Recursive step:) (x S) (y S) (x + y) S Then, S = {3n, n N }. What do I need to do in order to prove this statement? A S Contradiction Cases Mathematical induction Structural Induction Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 22 / 26

Set equality and structural induction The set of positive multiples of 3 Let the set S be such that: (Base case:) 3 S (Recursive step:) (x S) (y S) (x + y) S Then, S = {3n, n N }. What do I need to do in order to prove this statement? A S Contradiction Cases Mathematical induction Structural Induction S A Contradiction Cases Mathematical induction Structural Induction Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 22 / 26

Proof Proof (via weak induction on n and structural induction on S!) Let A = {3n, n N }. To prove S = A, we need to prove that S A and A S. First, we prove that A S. The proof is via weak induction on n. Let r be a generic particular for N and P (n) be the statement we want to prove. a We proceed inductively: 1 Inductive base: For r = 1, 3r = 3 1 S. Therefore, P (1) holds. 2 Inductive hypothesis: We assume that for some value of r 1, P (r) holds, i.e 3r S 3 Inductive step: We want to prove P (r + 1), that is, 3(r + 1) S. We know that 3r S and 3 S by the inductive base and hypothesis. By the definition of S, this means that 3r + 3 S (Algebra) 3(r + 1) S. So, P (r + 1) holds. Since r N was arbitrarily chosen, the result holds for all n N. a We can do this, since A is parameterized by n. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 23 / 26

Proof (continued) Proof: S A part. We now prove that S A. 1 Inductive base: By the base case of the definition of S, we have that 3 S. Since 3 = 3 1 and 1 N, we have that 3 A. So P (3). 2 Inductive hypothesis: Assume that x, y S are also contained by A, i.e x, y A. So P (x), P (y). 3 Inductive step: We must show that P (x + y), i.e x + y A, because if we do show this, we will have covered the recursive step of A s definition. From the inductive hypothesis, we have that x, y A i, j N : x = 3i, y = 3j. Therefore, x + y = 3 (i + j) x + y A. Therefore, P (x + y). }{{} z N Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 24 / 26

Recursively defined languages! Definition A recursively defined language Let Σ = {a, b} be an alphabet. We define the language L as follows: (Base case:) ɛ L (Recursive step:) If x L, axa L and bxb L. a a σ 1σ 2 is the concatenation of σ 1 and σ 2. Concatenation can be applied to n strings, n = 1, 2, 3,.... σ n is the concatenation of σ n many times. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 25 / 26

Recursively defined languages! Definition A recursively defined language Let Σ = {a, b} be an alphabet. We define the language L as follows: (Base case:) ɛ L (Recursive step:) If x L, axa L and bxb L. a a σ 1σ 2 is the concatenation of σ 1 and σ 2. Concatenation can be applied to n strings, n = 1, 2, 3,.... σ n is the concatenation of σ n many times. Claim σ L, σ is even. a a σ is the number of characters in σ. Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 25 / 26

General structure on inductive proofs on sets 1 In the inductive base, prove P ( ) for all the base elements of the recursively defined set S. ason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 26 / 26

General structure on inductive proofs on sets 1 In the inductive base, prove P ( ) for all the base elements of the recursively defined set S. This gives us that P ( ) holds for sets up to some cardinality n 0. ason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 26 / 26

General structure on inductive proofs on sets 1 In the inductive base, prove P ( ) for all the base elements of the recursively defined set S. This gives us that P ( ) holds for sets up to some cardinality n 0. 2 In the inductive hypothesis, assume S : S n 0 and P (S). ason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 26 / 26

General structure on inductive proofs on sets 1 In the inductive base, prove P ( ) for all the base elements of the recursively defined set S. This gives us that P ( ) holds for sets up to some cardinality n 0. 2 In the inductive hypothesis, assume S : S n 0 and P (S). Reminds us of weak mathematical induction? ason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 26 / 26

General structure on inductive proofs on sets 1 In the inductive base, prove P ( ) for all the base elements of the recursively defined set S. This gives us that P ( ) holds for sets up to some cardinality n 0. 2 In the inductive hypothesis, assume S : S n 0 and P (S). Reminds us of weak mathematical induction? 3 In the inductive step, use the recursive part of the definition of S to prove that the new set constructed (call it S ) satisfies the proposition (so P (S )). The inductive hypothesis will undoubtedly be used. ason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 26 / 26