Nominal Techniques or, How Not to be Intimidated by the Variable - - PowerPoint PPT Presentation

nominal techniques
SMART_READER_LITE
LIVE PREVIEW

Nominal Techniques or, How Not to be Intimidated by the Variable - - PowerPoint PPT Presentation

Nominal Techniques or, How Not to be Intimidated by the Variable Convention Christian Urban (TU Munich) ttst Variable Convention: If


slide-1
SLIDE 1

Nominal Techniques

  • r, How Not to be Intimidated by the

Variable Convention

Christian Urban (TU Munich)

❤tt♣✿✴✴✐s❛❜❡❧❧❡✳✐♥✳t✉♠✳❞❡✴♥♦♠✐♥❛❧✴

Variable Convention: If ▼✶❀ ✿ ✿ ✿ ❀ ▼♥ occur in a certain mathematical context (e.g. definition, proof), then in these terms all bound variables are chosen to be different from the free variables.

Barendregt in “The Lambda-Calculus: Its Syntax and Semantics”

Eugene, 24. July 2008 – p. 1/37

slide-2
SLIDE 2

Nominal Techniques

In 2000 I did my PhD on a strong normalisation

  • result. I had very good reviewers:

Andy Pitts Henk Barendregt

Eugene, 24. July 2008 – p. 2/37

slide-3
SLIDE 3

Nominal Techniques

In 2000 I did my PhD on a strong normalisation

  • result. I had very good reviewers:

Andy Pitts Henk Barendregt

Kleene in a journal paper: “We thank T. Thacher Robinson for showing us on August 19, 1962 by a counterexample the existence of an error in our handling of bound variables.”

Eugene, 24. July 2008 – p. 2/37

slide-4
SLIDE 4

Nominal Techniques

Xavier Leroy in his PhD: We define the set SchTyp of type schemes, with typical element ✛, by the following grammar:

✛ ✿✿❂ ✽❢☛✶✿✿☛♥❣✿✜

In this syntax, the quantified variables ☛✶..☛♥ are treated as a set of variables: their relative order is not significant, and they are assumed to be distinct. ... We identify two type schemes that differ only by a renaming of the variables bound by ✽ (☛-conversion operation), and by the introduction or suppression of quantified variables that are not free in the type part. More precisely, we quotient the set of schemes by the following two equations:

✽❢☛✶✿✿☛♥❣✿✜ ❂ ✽❢☞✶✿✿☞♥❣✿✭✜❬☛✶ ✿❂☞✶✿✿☛♥ ✿❂☞♥❪✮ ✽❢☛❀ ☛✶✿✿☛♥❣✿✜ ❂ ✽❢☛✶✿✿☛♥❣✿✜

if ☛ not in fv✭✜✮

Eugene, 24. July 2008 – p. 3/37

slide-5
SLIDE 5

Nominal Techniques

Xavier Leroy in his PhD: We define the set SchTyp of type schemes, with typical element ✛, by the following grammar:

✛ ✿✿❂ ✽❢☛✶✿✿☛♥❣✿✜

In this syntax, the quantified variables ☛✶..☛♥ are treated as a set of variables: their relative order is not significant, and they are assumed to be distinct. ... We identify two type schemes that differ only by a renaming of the variables bound by ✽ (☛-conversion operation), and by the introduction or suppression of quantified variables that are not free in the type part. More precisely, we quotient the set of schemes by the following two equations:

✽❢☛✶✿✿☛♥❣✿✜ ❂ ✽❢☞✶✿✿☞♥❣✿✭✜❬☛✶ ✿❂☞✶✿✿☛♥ ✿❂☞♥❪✮ ✽❢☛❀ ☛✶✿✿☛♥❣✿✜ ❂ ✽❢☛✶✿✿☛♥❣✿✜

if ☛ not in fv✭✜✮

Eugene, 24. July 2008 – p. 3/37

✽❢☛❣✿☛ ✦ ☛ ❂☛ ✽❢☞❣✿☛ ✦ ☞

slide-6
SLIDE 6

Nominal Techniques

Moral of my PhD: The reviewers did not find any errors, also the reviewers of a conference and journal paper.

Eugene, 24. July 2008 – p. 4/37

slide-7
SLIDE 7

Nominal Techniques

Moral of my PhD: The reviewers did not find any errors, also the reviewers of a conference and journal paper. The result was correct, but I did find errors in the proof (in quite central lemmas).

Eugene, 24. July 2008 – p. 4/37

slide-8
SLIDE 8

Nominal Techniques

Moral of my PhD: The reviewers did not find any errors, also the reviewers of a conference and journal paper. The result was correct, but I did find errors in the proof (in quite central lemmas). Starting from around 2000, Andy Pitts introduced many ideas about the proper handling

  • f bound names. One central idea of him is:

Use permutations instead of renaming substitutions.

Eugene, 24. July 2008 – p. 4/37

slide-9
SLIDE 9

Plan of the Lectures

1.) Thursday: How to deal with the variable convention: “Can always pick bound variables to avoid clashes with other variables”. 2.) Friday: How to deal with stetaments such as “Expressions differing only in names of bound variables are equivalent”. 3.) Saturday: The Real Thing: I hope to walk you through a formalisation of a small CK Machine.

Eugene, 24. July 2008 – p. 5/37

slide-10
SLIDE 10

Plan of the Lectures

1.) Thursday: How to deal with the variable convention: “Can always pick bound variables to avoid clashes with other variables”. 2.) Friday: How to deal with stetaments such as “Expressions differing only in names of bound variables are equivalent”. 3.) Saturday: The Real Thing: I hope to walk you through a formalisation of a small CK Machine. I will show you formalised proofs, but the lectures won’t be hands-on. If you need help, I am here until Thursday. Please ask me!!

Eugene, 24. July 2008 – p. 5/37

slide-11
SLIDE 11

Plan

We will have a look at the substitution and weakening lemma. I will show you an example where the variable convention leads to faulty reasoning. We derive a structural induction principle for lambda-terms that is safe and has the variable convention already built in.

Eugene, 24. July 2008 – p. 6/37

slide-12
SLIDE 12

Plan

We will have a look at the substitution and weakening lemma. I will show you an example where the variable convention leads to faulty reasoning. We derive a structural induction principle for lambda-terms that is safe and has the variable convention already built in. The main point of nominal techniques is to make sense out of informal reasoning.

Eugene, 24. July 2008 – p. 6/37

slide-13
SLIDE 13

Substitution Lemma: If ① ✻✑ ② and ① ✻✷ fv✭▲✮, then

▼❬① ✿❂ ◆❪❬② ✿❂ ▲❪ ✑ ▼❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪

Proof: By induction on the structure of ▼. Case 1: ▼ is a variable. Case 1.1. ▼ ✑ ①. Then both sides equal ◆❬② ✿❂ ▲❪ since

① ✻✑ ②.

Case 1.2. ▼ ✑ ②. Then both sides equal ▲, for ① ✻✷ fv✭▲✮ implies ▲❬① ✿❂ ✿ ✿ ✿❪ ✑ ▲. Case 1.3. ▼ ✑ ③ ✻✑ ①❀ ②. Then both sides equal ③. Case 2: ▼ ✑ ✕③✿▼✶. By the variable convention we may assume that ③ ✻✑ ①❀ ② and ③ is not free in ◆❀ ▲.

✭✕③✿▼✶✮❬①✿❂◆❪❬② ✿❂▲❪ ✑ ✕③✿✭▼✶❬①✿❂◆❪❬② ✿❂▲❪✮ ✑ ✕③✿✭▼✶❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪✮ ✑ ✭✕③✿▼✶✮❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪.

Case 3: ▼ ✑ ▼✶▼✷. The statement follows again from the induction hypothesis.

Eugene, 24. July 2008 – p. 7/37

② ✻❂ ① ① ✻✷ ✭◆✮ ✭✕②✿▼✮❬① ✿❂ ◆❪ ❂ ✕②✿✭▼❬① ✿❂ ◆❪✮ ✭✕③✿▼✶✮❬① ✿❂ ◆❪❬② ✿❂ ▲❪ ✑ ✭✕③✿✭▼✶❬① ✿❂ ◆❪✮✮❬② ✿❂ ▲❪

✥ ✑ ✕③✿✭▼✶❬① ✿❂ ◆❪❬② ✿❂ ▲❪✮

✥ ✑ ✕③✿✭▼✶❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪✮ ✑ ✭✕③✿✭▼✶❬② ✿❂ ▲❪✮✮❬① ✿❂ ◆❬② ✿❂ ▲❪❪✮

✦ ✑ ✭✕③✿▼✶✮❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪

slide-14
SLIDE 14

Substitution Lemma: If ① ✻✑ ② and ① ✻✷ fv✭▲✮, then

▼❬① ✿❂ ◆❪❬② ✿❂ ▲❪ ✑ ▼❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪

Proof: By induction on the structure of ▼. Case 1: ▼ is a variable. Case 1.1. ▼ ✑ ①. Then both sides equal ◆❬② ✿❂ ▲❪ since

① ✻✑ ②.

Case 1.2. ▼ ✑ ②. Then both sides equal ▲, for ① ✻✷ fv✭▲✮ implies ▲❬① ✿❂ ✿ ✿ ✿❪ ✑ ▲. Case 1.3. ▼ ✑ ③ ✻✑ ①❀ ②. Then both sides equal ③. Case 2: ▼ ✑ ✕③✿▼✶. By the variable convention we may assume that ③ ✻✑ ①❀ ② and ③ is not free in ◆❀ ▲.

✭✕③✿▼✶✮❬①✿❂◆❪❬② ✿❂▲❪ ✑ ✕③✿✭▼✶❬①✿❂◆❪❬② ✿❂▲❪✮ ✑ ✕③✿✭▼✶❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪✮ ✑ ✭✕③✿▼✶✮❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪.

Case 3: ▼ ✑ ▼✶▼✷. The statement follows again from the induction hypothesis.

Eugene, 24. July 2008 – p. 7/37

② ✻❂ ① ① ✻✷ ✭◆✮ ✭✕②✿▼✮❬① ✿❂ ◆❪ ❂ ✕②✿✭▼❬① ✿❂ ◆❪✮ ✭✕③✿▼✶✮❬① ✿❂ ◆❪❬② ✿❂ ▲❪ ✑ ✭✕③✿✭▼✶❬① ✿❂ ◆❪✮✮❬② ✿❂ ▲❪

✥ ✑ ✕③✿✭▼✶❬① ✿❂ ◆❪❬② ✿❂ ▲❪✮

✥ ✑ ✕③✿✭▼✶❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪✮ ✑ ✭✕③✿✭▼✶❬② ✿❂ ▲❪✮✮❬① ✿❂ ◆❬② ✿❂ ▲❪❪✮

✦ ✑ ✭✕③✿▼✶✮❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪

slide-15
SLIDE 15

Substitution Lemma: If ① ✻✑ ② and ① ✻✷ fv✭▲✮, then

▼❬① ✿❂ ◆❪❬② ✿❂ ▲❪ ✑ ▼❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪

Proof: By induction on the structure of ▼. Case 1: ▼ is a variable. Case 1.1. ▼ ✑ ①. Then both sides equal ◆❬② ✿❂ ▲❪ since

① ✻✑ ②.

Case 1.2. ▼ ✑ ②. Then both sides equal ▲, for ① ✻✷ fv✭▲✮ implies ▲❬① ✿❂ ✿ ✿ ✿❪ ✑ ▲. Case 1.3. ▼ ✑ ③ ✻✑ ①❀ ②. Then both sides equal ③. Case 2: ▼ ✑ ✕③✿▼✶. By the variable convention we may assume that ③ ✻✑ ①❀ ② and ③ is not free in ◆❀ ▲.

✭✕③✿▼✶✮❬①✿❂◆❪❬② ✿❂▲❪ ✑ ✕③✿✭▼✶❬①✿❂◆❪❬② ✿❂▲❪✮ ✑ ✕③✿✭▼✶❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪✮ ✑ ✭✕③✿▼✶✮❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪.

Case 3: ▼ ✑ ▼✶▼✷. The statement follows again from the induction hypothesis.

Eugene, 24. July 2008 – p. 7/37

② ✻❂ ① ① ✻✷ ✭◆✮ ✭✕②✿▼✮❬① ✿❂ ◆❪ ❂ ✕②✿✭▼❬① ✿❂ ◆❪✮ ✭✕③✿▼✶✮❬① ✿❂ ◆❪❬② ✿❂ ▲❪ ✑ ✭✕③✿✭▼✶❬① ✿❂ ◆❪✮✮❬② ✿❂ ▲❪

✥ ✑ ✕③✿✭▼✶❬① ✿❂ ◆❪❬② ✿❂ ▲❪✮

✥ ✑ ✕③✿✭▼✶❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪✮ ✑ ✭✕③✿✭▼✶❬② ✿❂ ▲❪✮✮❬① ✿❂ ◆❬② ✿❂ ▲❪❪✮

✦ ✑ ✭✕③✿▼✶✮❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪

slide-16
SLIDE 16

Substitution Lemma: If ① ✻✑ ② and ① ✻✷ fv✭▲✮, then

▼❬① ✿❂ ◆❪❬② ✿❂ ▲❪ ✑ ▼❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪

Proof: By induction on the structure of ▼. Case 1: ▼ is a variable. Case 1.1. ▼ ✑ ①. Then both sides equal ◆❬② ✿❂ ▲❪ since

① ✻✑ ②.

Case 1.2. ▼ ✑ ②. Then both sides equal ▲, for ① ✻✷ fv✭▲✮ implies ▲❬① ✿❂ ✿ ✿ ✿❪ ✑ ▲. Case 1.3. ▼ ✑ ③ ✻✑ ①❀ ②. Then both sides equal ③. Case 2: ▼ ✑ ✕③✿▼✶. By the variable convention we may assume that ③ ✻✑ ①❀ ② and ③ is not free in ◆❀ ▲.

✭✕③✿▼✶✮❬①✿❂◆❪❬② ✿❂▲❪ ✑ ✕③✿✭▼✶❬①✿❂◆❪❬② ✿❂▲❪✮ ✑ ✕③✿✭▼✶❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪✮ ✑ ✭✕③✿▼✶✮❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪.

Case 3: ▼ ✑ ▼✶▼✷. The statement follows again from the induction hypothesis.

Eugene, 24. July 2008 – p. 7/37

② ✻❂ ① ① ✻✷ ✭◆✮ ✭✕②✿▼✮❬① ✿❂ ◆❪ ❂ ✕②✿✭▼❬① ✿❂ ◆❪✮ ✭✕③✿▼✶✮❬① ✿❂ ◆❪❬② ✿❂ ▲❪ ✑ ✭✕③✿✭▼✶❬① ✿❂ ◆❪✮✮❬② ✿❂ ▲❪

✥ ✑ ✕③✿✭▼✶❬① ✿❂ ◆❪❬② ✿❂ ▲❪✮

✥ ✑ ✕③✿✭▼✶❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪✮ ✑ ✭✕③✿✭▼✶❬② ✿❂ ▲❪✮✮❬① ✿❂ ◆❬② ✿❂ ▲❪❪✮

✦ ✑ ✭✕③✿▼✶✮❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪

slide-17
SLIDE 17

Substitution Lemma: If ① ✻✑ ② and ① ✻✷ fv✭▲✮, then

▼❬① ✿❂ ◆❪❬② ✿❂ ▲❪ ✑ ▼❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪

Proof: By induction on the structure of ▼. Case 1: ▼ is a variable. Case 1.1. ▼ ✑ ①. Then both sides equal ◆❬② ✿❂ ▲❪ since

① ✻✑ ②.

Case 1.2. ▼ ✑ ②. Then both sides equal ▲, for ① ✻✷ fv✭▲✮ implies ▲❬① ✿❂ ✿ ✿ ✿❪ ✑ ▲. Case 1.3. ▼ ✑ ③ ✻✑ ①❀ ②. Then both sides equal ③. Case 2: ▼ ✑ ✕③✿▼✶. By the variable convention we may assume that ③ ✻✑ ①❀ ② and ③ is not free in ◆❀ ▲.

✭✕③✿▼✶✮❬①✿❂◆❪❬② ✿❂▲❪ ✑ ✕③✿✭▼✶❬①✿❂◆❪❬② ✿❂▲❪✮ ✑ ✕③✿✭▼✶❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪✮ ✑ ✭✕③✿▼✶✮❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪.

Case 3: ▼ ✑ ▼✶▼✷. The statement follows again from the induction hypothesis.

Eugene, 24. July 2008 – p. 7/37

Remember only if ② ✻❂ ① and ① ✻✷ fv✭◆✮ then

✭✕②✿▼✮❬① ✿❂ ◆❪ ❂ ✕②✿✭▼❬① ✿❂ ◆❪✮ ✭✕③✿▼✶✮❬① ✿❂ ◆❪❬② ✿❂ ▲❪ ✑ ✭✕③✿✭▼✶❬① ✿❂ ◆❪✮✮❬② ✿❂ ▲❪

✥ ✑ ✕③✿✭▼✶❬① ✿❂ ◆❪❬② ✿❂ ▲❪✮

✥ ✑ ✕③✿✭▼✶❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪✮

IH

✑ ✭✕③✿✭▼✶❬② ✿❂ ▲❪✮✮❬① ✿❂ ◆❬② ✿❂ ▲❪❪✮

✦ ! ✑ ✭✕③✿▼✶✮❬② ✿❂ ▲❪❬① ✿❂ ◆❬② ✿❂ ▲❪❪.

slide-18
SLIDE 18

Nominal Datatypes

Define lambda-terms as: atom_decl name nominal_datatype lam = Var "name"

❥ App "lam" "lam" ❥ Lam "«name»lam" ("Lam [_]._")

These are named alpha-equivalence classes, for example Lam [a].(Var a) ❂ Lam [b].(Var b)

Eugene, 24. July 2008 – p. 8/37

slide-19
SLIDE 19

lemma forget: assumes a: "x ★ L" shows "L[x::=P] = L" using a by (nominal_induct L avoiding: x P rule: lam.strong_induct) (auto simp add: abs_fresh fresh_atm) lemma fresh_fact: fixes z::"name" assumes a: "z ★ N" "z ★ L" shows "z ★ N[y::=L]" using a by (nominal_induct N avoiding: z y L rule: lam.strong_induct) (auto simp add: abs_fresh fresh_atm) lemma substitution_lemma: assumes a: "x ✻❂ y" "x ★ L" shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]" using a by (nominal_induct M avoiding: x y N L rule: lam.strong_induct) (auto simp add: fresh_fact forget)

Eugene, 24. July 2008 – p. 9/37

slide-20
SLIDE 20

lemma forget: assumes a: "x ★ L" shows "L[x::=P] = L" using a by (nominal_induct L avoiding: x P rule: lam.strong_induct) (auto simp add: abs_fresh fresh_atm) lemma fresh_fact: fixes z::"name" assumes a: "z ★ N" "z ★ L" shows "z ★ N[y::=L]" using a by (nominal_induct N avoiding: z y L rule: lam.strong_induct) (auto simp add: abs_fresh fresh_atm) lemma substitution_lemma: assumes a: "x ✻❂ y" "x ★ L" shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]" using a by (nominal_induct M avoiding: x y N L rule: lam.strong_induct) (auto simp add: fresh_fact forget)

Eugene, 24. July 2008 – p. 9/37

stands for ① ✻✷ fv✭▲✮ reads as “① fresh for ▲”

slide-21
SLIDE 21

lemma forget: assumes a: "x ★ L" shows "L[x::=P] = L" using a by (nominal_induct L avoiding: x P rule: lam.strong_induct) (auto simp add: abs_fresh fresh_atm) lemma fresh_fact: fixes z::"name" assumes a: "z ★ N" "z ★ L" shows "z ★ N[y::=L]" using a by (nominal_induct N avoiding: z y L rule: lam.strong_induct) (auto simp add: abs_fresh fresh_atm) lemma substitution_lemma: assumes a: "x ✻❂ y" "x ★ L" shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]" using a by (nominal_induct M avoiding: x y N L rule: lam.strong_induct) (auto simp add: fresh_fact forget)

Eugene, 24. July 2008 – p. 9/37

slide-22
SLIDE 22

(Weak) Induction Principles

The usual induction principle is as follows:

✽①✿ P ① ✽t✶ t✷✿ P t✶ ❫ P t✷ ✮ P ✭t✶ t✷✮ ✽① t✿ P t ✮ P ✭✕①✿t✮ P t

It requires us in the lambda-case to show the property P for all binders ①. (This nearly always requires renamings and they can be tricky to automate.)

Eugene, 24. July 2008 – p. 10/37

slide-23
SLIDE 23

Strong Induction Principles

Therefore we will use the following strong induction principle:

✽① ❝✿ P ❝ ① ✽t✶ t✷ ❝✿ ✭✽❞✿ P ❞ t✶✮ ❫ ✭✽❞✿P ❞ t✷✮ ✮ P ❝ ✭t✶ t✷✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❞✿P ❞ t✮ ✮ P ❝ ✭✕①✿t✮ P ❝ t

Eugene, 24. July 2008 – p. 11/37

slide-24
SLIDE 24

Strong Induction Principles

Therefore we will use the following strong induction principle:

✽① ❝✿ P ❝ ① ✽t✶ t✷ ❝✿ ✭✽❞✿ P ❞ t✶✮ ❫ ✭✽❞✿P ❞ t✷✮ ✮ P ❝ ✭t✶ t✷✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❞✿P ❞ t✮ ✮ P ❝ ✭✕①✿t✮ P ❝ t

Eugene, 24. July 2008 – p. 11/37

The variable over which the induction proceeds: “. . . By induction over the structure of ▼. . . ”

slide-25
SLIDE 25

Strong Induction Principles

Therefore we will use the following strong induction principle:

✽① ❝✿ P ❝ ① ✽t✶ t✷ ❝✿ ✭✽❞✿ P ❞ t✶✮ ❫ ✭✽❞✿P ❞ t✷✮ ✮ P ❝ ✭t✶ t✷✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❞✿P ❞ t✮ ✮ P ❝ ✭✕①✿t✮ P ❝ t

Eugene, 24. July 2008 – p. 11/37

The context of the induction; i.e. what the binder should be fresh for

✮ ✭①❀ ②❀ ◆❀ ▲✮:

“. . . By the variable convention we can assume

③ ✻✑ ①❀ ② and ③ not free in ◆,▲. . . ”

slide-26
SLIDE 26

Strong Induction Principles

Therefore we will use the following strong induction principle:

✽① ❝✿ P ❝ ① ✽t✶ t✷ ❝✿ ✭✽❞✿ P ❞ t✶✮ ❫ ✭✽❞✿P ❞ t✷✮ ✮ P ❝ ✭t✶ t✷✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❞✿P ❞ t✮ ✮ P ❝ ✭✕①✿t✮ P ❝ t

Eugene, 24. July 2008 – p. 11/37

The property to be proved by induction:

✕✭①❀②❀◆❀▲✮✿ ✕▼✿ ① ✻❂ ② ❫ ① ★ ▲ ✮ ▼❬①✿❂◆❪❬② ✿❂▲❪ ❂ ▼❬② ✿❂▲❪❬①✿❂◆❬② ✿❂▲❪❪

slide-27
SLIDE 27

Eugene, 24. July 2008 – p. 12/37

proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct) case (Var z) show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS") proof - { assume "z=x" have "(1)": "?LHS = N[y::=L]" using ‘z=x‘ by simp have "(2)": "?RHS = N[y::=L]" using ‘z=x‘ ‘x✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } moreover { assume "z=y" and "z✻❂x" have "(1)": "?LHS = L" using ‘z✻❂x‘ ‘z=y‘ by simp have "(2)": "?RHS = L[x::=N[y::=L]]" using ‘z=y‘ by simp have "(3)": "L[x::=N[y::=L]] = L" using ‘x★L‘ by (simp add: forget) from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp } moreover { assume "z✻❂x" and "z✻❂y" have "(1)": "?LHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp have "(2)": "?RHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } ultimately show "?LHS = ?RHS" by blast qed next ✿ ✿ ✿

slide-28
SLIDE 28

Eugene, 24. July 2008 – p. 12/37

proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct) case (Var z) show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS") proof - { assume "z=x" have "(1)": "?LHS = N[y::=L]" using ‘z=x‘ by simp have "(2)": "?RHS = N[y::=L]" using ‘z=x‘ ‘x✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } moreover { assume "z=y" and "z✻❂x" have "(1)": "?LHS = L" using ‘z✻❂x‘ ‘z=y‘ by simp have "(2)": "?RHS = L[x::=N[y::=L]]" using ‘z=y‘ by simp have "(3)": "L[x::=N[y::=L]] = L" using ‘x★L‘ by (simp add: forget) from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp } moreover { assume "z✻❂x" and "z✻❂y" have "(1)": "?LHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp have "(2)": "?RHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } ultimately show "?LHS = ?RHS" by blast qed next ✿ ✿ ✿

slide-29
SLIDE 29

Eugene, 24. July 2008 – p. 12/37

proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct) case (Var z) show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS") proof - { assume "z=x" have "(1)": "?LHS = N[y::=L]" using ‘z=x‘ by simp have "(2)": "?RHS = N[y::=L]" using ‘z=x‘ ‘x✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } moreover { assume "z=y" and "z✻❂x" have "(1)": "?LHS = L" using ‘z✻❂x‘ ‘z=y‘ by simp have "(2)": "?RHS = L[x::=N[y::=L]]" using ‘z=y‘ by simp have "(3)": "L[x::=N[y::=L]] = L" using ‘x★L‘ by (simp add: forget) from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp } moreover { assume "z✻❂x" and "z✻❂y" have "(1)": "?LHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp have "(2)": "?RHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } ultimately show "?LHS = ?RHS" by blast qed next ✿ ✿ ✿

slide-30
SLIDE 30

Eugene, 24. July 2008 – p. 12/37

proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct) case (Var z) show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS") proof - { assume "z=x" have "(1)": "?LHS = N[y::=L]" using ‘z=x‘ by simp have "(2)": "?RHS = N[y::=L]" using ‘z=x‘ ‘x✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } moreover { assume "z=y" and "z✻❂x" have "(1)": "?LHS = L" using ‘z✻❂x‘ ‘z=y‘ by simp have "(2)": "?RHS = L[x::=N[y::=L]]" using ‘z=y‘ by simp have "(3)": "L[x::=N[y::=L]] = L" using ‘x★L‘ by (simp add: forget) from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp } moreover { assume "z✻❂x" and "z✻❂y" have "(1)": "?LHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp have "(2)": "?RHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } ultimately show "?LHS = ?RHS" by blast qed next ✿ ✿ ✿

slide-31
SLIDE 31

Eugene, 24. July 2008 – p. 12/37

proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct) case (Var z) show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS") proof - { assume "z=x" have "(1)": "?LHS = N[y::=L]" using ‘z=x‘ by simp have "(2)": "?RHS = N[y::=L]" using ‘z=x‘ ‘x✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } moreover { assume "z=y" and "z✻❂x" have "(1)": "?LHS = L" using ‘z✻❂x‘ ‘z=y‘ by simp have "(2)": "?RHS = L[x::=N[y::=L]]" using ‘z=y‘ by simp have "(3)": "L[x::=N[y::=L]] = L" using ‘x★L‘ by (simp add: forget) from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp } moreover { assume "z✻❂x" and "z✻❂y" have "(1)": "?LHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp have "(2)": "?RHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } ultimately show "?LHS = ?RHS" by blast qed next ✿ ✿ ✿

slide-32
SLIDE 32

Eugene, 24. July 2008 – p. 12/37

proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct) case (Var z) show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS") proof - { assume "z=x" have "(1)": "?LHS = N[y::=L]" using ‘z=x‘ by simp have "(2)": "?RHS = N[y::=L]" using ‘z=x‘ ‘x✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } moreover { assume "z=y" and "z✻❂x" have "(1)": "?LHS = L" using ‘z✻❂x‘ ‘z=y‘ by simp have "(2)": "?RHS = L[x::=N[y::=L]]" using ‘z=y‘ by simp have "(3)": "L[x::=N[y::=L]] = L" using ‘x★L‘ by (simp add: forget) from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp } moreover { assume "z✻❂x" and "z✻❂y" have "(1)": "?LHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp have "(2)": "?RHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } ultimately show "?LHS = ?RHS" by blast qed next ✿ ✿ ✿

slide-33
SLIDE 33

Eugene, 24. July 2008 – p. 12/37

proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct) case (Var z) show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS") proof - { assume "z=x" have "(1)": "?LHS = N[y::=L]" using ‘z=x‘ by simp have "(2)": "?RHS = N[y::=L]" using ‘z=x‘ ‘x✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } moreover { assume "z=y" and "z✻❂x" have "(1)": "?LHS = L" using ‘z✻❂x‘ ‘z=y‘ by simp have "(2)": "?RHS = L[x::=N[y::=L]]" using ‘z=y‘ by simp have "(3)": "L[x::=N[y::=L]] = L" using ‘x★L‘ by (simp add: forget) from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp } moreover { assume "z✻❂x" and "z✻❂y" have "(1)": "?LHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp have "(2)": "?RHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } ultimately show "?LHS = ?RHS" by blast qed next ✿ ✿ ✿

slide-34
SLIDE 34

Eugene, 24. July 2008 – p. 12/37

proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct) case (Var z) show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS") proof - { assume "z=x" have "(1)": "?LHS = N[y::=L]" using ‘z=x‘ by simp have "(2)": "?RHS = N[y::=L]" using ‘z=x‘ ‘x✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } moreover { assume "z=y" and "z✻❂x" have "(1)": "?LHS = L" using ‘z✻❂x‘ ‘z=y‘ by simp have "(2)": "?RHS = L[x::=N[y::=L]]" using ‘z=y‘ by simp have "(3)": "L[x::=N[y::=L]] = L" using ‘x★L‘ by (simp add: forget) from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp } moreover { assume "z✻❂x" and "z✻❂y" have "(1)": "?LHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp have "(2)": "?RHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } ultimately show "?LHS = ?RHS" by blast qed next ✿ ✿ ✿

slide-35
SLIDE 35

Eugene, 24. July 2008 – p. 12/37

proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct) case (Var z) show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS") proof - { assume "z=x" have "(1)": "?LHS = N[y::=L]" using ‘z=x‘ by simp have "(2)": "?RHS = N[y::=L]" using ‘z=x‘ ‘x✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } moreover { assume "z=y" and "z✻❂x" have "(1)": "?LHS = L" using ‘z✻❂x‘ ‘z=y‘ by simp have "(2)": "?RHS = L[x::=N[y::=L]]" using ‘z=y‘ by simp have "(3)": "L[x::=N[y::=L]] = L" using ‘x★L‘ by (simp add: forget) from "(1)" "(2)" "(3)" have "?LHS = ?RHS" by simp } moreover { assume "z✻❂x" and "z✻❂y" have "(1)": "?LHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp have "(2)": "?RHS = Var z" using ‘z✻❂x‘ ‘z✻❂y‘ by simp from "(1)" "(2)" have "?LHS = ?RHS" by simp } ultimately show "?LHS = ?RHS" by blast qed next ✿ ✿ ✿

slide-36
SLIDE 36

Eugene, 24. July 2008 – p. 13/37

next case (Lam z M✶) have ih: "❬

❬x✻❂y; x★L❪ ❪ ❂ ✮ M✶[x::=N][y::=L] = M✶[y::=L][x::=N[y::=L]]" by fact

have "x✻❂y" by fact have "x★L" by fact have vc: "z★x" "z★y" "z★N" "z★L" by fact+ then have "z★N[y::=L]" by (simp add: fresh_fact) show "(Lam [z].M✶)[x::=N][y::=L]=(Lam [z].M✶)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") proof - have "?LHS = Lam [z].(M✶[x::=N][y::=L])" using vc by simp also from ih have "✿✿✿ = Lam [z].(M✶[y::=L][x::=N[y::=L]])" using ‘x✻❂y‘ ‘x★L‘ by simp also have "✿✿✿ = (Lam [z].(M✶[y::=L]))[x::=N[y::=L]]" using ‘z★x‘ ‘z★N[y::=L]‘ by simp also have "✿✿✿ = ?RHS" using ‘z★y‘ ‘z★L‘ by simp finally show "?LHS = ?RHS" . qed next case (App M✶ M✷) then show "(App M✶ M✷)[x::=N][y::=L] = (App M✶ M✷)[y::=L][x::=N[y::=L]]" by simp qed

slide-37
SLIDE 37

Eugene, 24. July 2008 – p. 13/37

next case (Lam z M✶) have ih: "❬

❬x✻❂y; x★L❪ ❪ ❂ ✮ M✶[x::=N][y::=L] = M✶[y::=L][x::=N[y::=L]]" by fact

have "x✻❂y" by fact have "x★L" by fact have vc: "z★x" "z★y" "z★N" "z★L" by fact+ then have "z★N[y::=L]" by (simp add: fresh_fact) show "(Lam [z].M✶)[x::=N][y::=L]=(Lam [z].M✶)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") proof - have "?LHS = Lam [z].(M✶[x::=N][y::=L])" using vc by simp also from ih have "✿✿✿ = Lam [z].(M✶[y::=L][x::=N[y::=L]])" using ‘x✻❂y‘ ‘x★L‘ by simp also have "✿✿✿ = (Lam [z].(M✶[y::=L]))[x::=N[y::=L]]" using ‘z★x‘ ‘z★N[y::=L]‘ by simp also have "✿✿✿ = ?RHS" using ‘z★y‘ ‘z★L‘ by simp finally show "?LHS = ?RHS" . qed next case (App M✶ M✷) then show "(App M✶ M✷)[x::=N][y::=L] = (App M✶ M✷)[y::=L][x::=N[y::=L]]" by simp qed

slide-38
SLIDE 38

Eugene, 24. July 2008 – p. 13/37

next case (Lam z M✶) have ih: "❬

❬x✻❂y; x★L❪ ❪ ❂ ✮ M✶[x::=N][y::=L] = M✶[y::=L][x::=N[y::=L]]" by fact

have "x✻❂y" by fact have "x★L" by fact have vc: "z★x" "z★y" "z★N" "z★L" by fact+ then have "z★N[y::=L]" by (simp add: fresh_fact) show "(Lam [z].M✶)[x::=N][y::=L]=(Lam [z].M✶)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") proof - have "?LHS = Lam [z].(M✶[x::=N][y::=L])" using vc by simp also from ih have "✿✿✿ = Lam [z].(M✶[y::=L][x::=N[y::=L]])" using ‘x✻❂y‘ ‘x★L‘ by simp also have "✿✿✿ = (Lam [z].(M✶[y::=L]))[x::=N[y::=L]]" using ‘z★x‘ ‘z★N[y::=L]‘ by simp also have "✿✿✿ = ?RHS" using ‘z★y‘ ‘z★L‘ by simp finally show "?LHS = ?RHS" . qed next case (App M✶ M✷) then show "(App M✶ M✷)[x::=N][y::=L] = (App M✶ M✷)[y::=L][x::=N[y::=L]]" by simp qed

slide-39
SLIDE 39

Eugene, 24. July 2008 – p. 13/37

next case (Lam z M✶) have ih: "❬

❬x✻❂y; x★L❪ ❪ ❂ ✮ M✶[x::=N][y::=L] = M✶[y::=L][x::=N[y::=L]]" by fact

have "x✻❂y" by fact have "x★L" by fact have vc: "z★x" "z★y" "z★N" "z★L" by fact+ then have "z★N[y::=L]" by (simp add: fresh_fact) show "(Lam [z].M✶)[x::=N][y::=L]=(Lam [z].M✶)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") proof - have "?LHS = Lam [z].(M✶[x::=N][y::=L])" using vc by simp also from ih have "✿✿✿ = Lam [z].(M✶[y::=L][x::=N[y::=L]])" using ‘x✻❂y‘ ‘x★L‘ by simp also have "✿✿✿ = (Lam [z].(M✶[y::=L]))[x::=N[y::=L]]" using ‘z★x‘ ‘z★N[y::=L]‘ by simp also have "✿✿✿ = ?RHS" using ‘z★y‘ ‘z★L‘ by simp finally show "?LHS = ?RHS" . qed next case (App M✶ M✷) then show "(App M✶ M✷)[x::=N][y::=L] = (App M✶ M✷)[y::=L][x::=N[y::=L]]" by simp qed

slide-40
SLIDE 40

Eugene, 24. July 2008 – p. 13/37

next case (Lam z M✶) have ih: "❬

❬x✻❂y; x★L❪ ❪ ❂ ✮ M✶[x::=N][y::=L] = M✶[y::=L][x::=N[y::=L]]" by fact

have "x✻❂y" by fact have "x★L" by fact have vc: "z★x" "z★y" "z★N" "z★L" by fact+ then have "z★N[y::=L]" by (simp add: fresh_fact) show "(Lam [z].M✶)[x::=N][y::=L]=(Lam [z].M✶)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") proof - have "?LHS = Lam [z].(M✶[x::=N][y::=L])" using vc by simp also from ih have "✿✿✿ = Lam [z].(M✶[y::=L][x::=N[y::=L]])" using ‘x✻❂y‘ ‘x★L‘ by simp also have "✿✿✿ = (Lam [z].(M✶[y::=L]))[x::=N[y::=L]]" using ‘z★x‘ ‘z★N[y::=L]‘ by simp also have "✿✿✿ = ?RHS" using ‘z★y‘ ‘z★L‘ by simp finally show "?LHS = ?RHS" . qed next case (App M✶ M✷) then show "(App M✶ M✷)[x::=N][y::=L] = (App M✶ M✷)[y::=L][x::=N[y::=L]]" by simp qed

slide-41
SLIDE 41

Eugene, 24. July 2008 – p. 13/37

next case (Lam z M✶) have ih: "❬

❬x✻❂y; x★L❪ ❪ ❂ ✮ M✶[x::=N][y::=L] = M✶[y::=L][x::=N[y::=L]]" by fact

have "x✻❂y" by fact have "x★L" by fact have vc: "z★x" "z★y" "z★N" "z★L" by fact+ then have "z★N[y::=L]" by (simp add: fresh_fact) show "(Lam [z].M✶)[x::=N][y::=L]=(Lam [z].M✶)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") proof - have "?LHS = Lam [z].(M✶[x::=N][y::=L])" using vc by simp also from ih have "✿✿✿ = Lam [z].(M✶[y::=L][x::=N[y::=L]])" using ‘x✻❂y‘ ‘x★L‘ by simp also have "✿✿✿ = (Lam [z].(M✶[y::=L]))[x::=N[y::=L]]" using ‘z★x‘ ‘z★N[y::=L]‘ by simp also have "✿✿✿ = ?RHS" using ‘z★y‘ ‘z★L‘ by simp finally show "?LHS = ?RHS" . qed next case (App M✶ M✷) then show "(App M✶ M✷)[x::=N][y::=L] = (App M✶ M✷)[y::=L][x::=N[y::=L]]" by simp qed

slide-42
SLIDE 42

Eugene, 24. July 2008 – p. 13/37

next case (Lam z M✶) have ih: "❬

❬x✻❂y; x★L❪ ❪ ❂ ✮ M✶[x::=N][y::=L] = M✶[y::=L][x::=N[y::=L]]" by fact

have "x✻❂y" by fact have "x★L" by fact have vc: "z★x" "z★y" "z★N" "z★L" by fact+ then have "z★N[y::=L]" by (simp add: fresh_fact) show "(Lam [z].M✶)[x::=N][y::=L]=(Lam [z].M✶)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") proof - have "?LHS = Lam [z].(M✶[x::=N][y::=L])" using vc by simp also from ih have "✿✿✿ = Lam [z].(M✶[y::=L][x::=N[y::=L]])" using ‘x✻❂y‘ ‘x★L‘ by simp also have "✿✿✿ = (Lam [z].(M✶[y::=L]))[x::=N[y::=L]]" using ‘z★x‘ ‘z★N[y::=L]‘ by simp also have "✿✿✿ = ?RHS" using ‘z★y‘ ‘z★L‘ by simp finally show "?LHS = ?RHS" . qed next case (App M✶ M✷) then show "(App M✶ M✷)[x::=N][y::=L] = (App M✶ M✷)[y::=L][x::=N[y::=L]]" by simp qed

slide-43
SLIDE 43

Eugene, 24. July 2008 – p. 13/37

next case (Lam z M✶) have ih: "❬

❬x✻❂y; x★L❪ ❪ ❂ ✮ M✶[x::=N][y::=L] = M✶[y::=L][x::=N[y::=L]]" by fact

have "x✻❂y" by fact have "x★L" by fact have vc: "z★x" "z★y" "z★N" "z★L" by fact+ then have "z★N[y::=L]" by (simp add: fresh_fact) show "(Lam [z].M✶)[x::=N][y::=L]=(Lam [z].M✶)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") proof - have "?LHS = Lam [z].(M✶[x::=N][y::=L])" using vc by simp also from ih have "✿✿✿ = Lam [z].(M✶[y::=L][x::=N[y::=L]])" using ‘x✻❂y‘ ‘x★L‘ by simp also have "✿✿✿ = (Lam [z].(M✶[y::=L]))[x::=N[y::=L]]" using ‘z★x‘ ‘z★N[y::=L]‘ by simp also have "✿✿✿ = ?RHS" using ‘z★y‘ ‘z★L‘ by simp finally show "?LHS = ?RHS" . qed next case (App M✶ M✷) then show "(App M✶ M✷)[x::=N][y::=L] = (App M✶ M✷)[y::=L][x::=N[y::=L]]" by simp qed

slide-44
SLIDE 44

Eugene, 24. July 2008 – p. 13/37

next case (Lam z M✶) have ih: "❬

❬x✻❂y; x★L❪ ❪ ❂ ✮ M✶[x::=N][y::=L] = M✶[y::=L][x::=N[y::=L]]" by fact

have "x✻❂y" by fact have "x★L" by fact have vc: "z★x" "z★y" "z★N" "z★L" by fact+ then have "z★N[y::=L]" by (simp add: fresh_fact) show "(Lam [z].M✶)[x::=N][y::=L]=(Lam [z].M✶)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") proof - have "?LHS = Lam [z].(M✶[x::=N][y::=L])" using vc by simp also from ih have "✿✿✿ = Lam [z].(M✶[y::=L][x::=N[y::=L]])" using ‘x✻❂y‘ ‘x★L‘ by simp also have "✿✿✿ = (Lam [z].(M✶[y::=L]))[x::=N[y::=L]]" using ‘z★x‘ ‘z★N[y::=L]‘ by simp also have "✿✿✿ = ?RHS" using ‘z★y‘ ‘z★L‘ by simp finally show "?LHS = ?RHS" . qed next case (App M✶ M✷) then show "(App M✶ M✷)[x::=N][y::=L] = (App M✶ M✷)[y::=L][x::=N[y::=L]]" by simp qed

slide-45
SLIDE 45

Eugene, 24. July 2008 – p. 13/37

next case (Lam z M✶) have ih: "❬

❬x✻❂y; x★L❪ ❪ ❂ ✮ M✶[x::=N][y::=L] = M✶[y::=L][x::=N[y::=L]]" by fact

have "x✻❂y" by fact have "x★L" by fact have vc: "z★x" "z★y" "z★N" "z★L" by fact+ then have "z★N[y::=L]" by (simp add: fresh_fact) show "(Lam [z].M✶)[x::=N][y::=L]=(Lam [z].M✶)[y::=L][x::=N[y::=L]]" (is "?LHS=?RHS") proof - have "?LHS = Lam [z].(M✶[x::=N][y::=L])" using vc by simp also from ih have "✿✿✿ = Lam [z].(M✶[y::=L][x::=N[y::=L]])" using ‘x✻❂y‘ ‘x★L‘ by simp also have "✿✿✿ = (Lam [z].(M✶[y::=L]))[x::=N[y::=L]]" using ‘z★x‘ ‘z★N[y::=L]‘ by simp also have "✿✿✿ = ?RHS" using ‘z★y‘ ‘z★L‘ by simp finally show "?LHS = ?RHS" . qed next case (App M✶ M✷) then show "(App M✶ M✷)[x::=N][y::=L] = (App M✶ M✷)[y::=L][x::=N[y::=L]]" by simp qed

slide-46
SLIDE 46

An Isar Proof ...

Eugene, 24. July 2008 – p. 14/37

The Isar proof language has been conceived by Markus Wenzel, the main developer behind Isabelle.

slide-47
SLIDE 47

An Isar Proof ...

Eugene, 24. July 2008 – p. 14/37

The Isar proof language has been conceived by Markus Wenzel, the main developer behind Isabelle.

goal stepping stones . . . stepping stones assumptions

slide-48
SLIDE 48

Strong Induction Principles

✽① ❝✿ P ❝ ① ✽t✶ t✷ ❝✿ ✭✽❞✿ P ❞ t✶✮ ❫ ✭✽❞✿P ❞ t✷✮ ✮ P ❝ ✭t✶ t✷✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❞✿P ❞ t✮ ✮ P ❝ ✭✕①✿t✮ P ❝ t

Eugene, 24. July 2008 – p. 15/37

There is a condition for when Barendregt’s variable convention is applicable—it is almost always satisfied, but not always: The induction context ❝ needs to be finitely supported (is not allowed to mention all names as free).

slide-49
SLIDE 49

Strong Induction Principles

✽① ❝✿ P ❝ ① ✽t✶ t✷ ❝✿ ✭✽❞✿ P ❞ t✶✮ ❫ ✭✽❞✿P ❞ t✷✮ ✮ P ❝ ✭t✶ t✷✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❞✿P ❞ t✮ ✮ P ❝ ✭✕①✿t✮ P ❝ t

In the case of the substitution lemma:

Eugene, 24. July 2008 – p. 15/37

proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct)

✿ ✿ ✿

slide-50
SLIDE 50

Same Problem with Rule Inductions

We can specify typing-rules for lambda-terms as:

✭①✿✜✮ ✷

valid

❵ ① ✿ ✜ ❵ t✶ ✿ ✛ ✦✜ ❵ t✷ ✿ ✛ ❵ t✶ t✷ ✿ ✜ ① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

valid ❬❪

① ★

valid valid ✭①✿✜✮✿✿ If ✶ ❵ t ✿ ✜ and valid ✷, ✶ ✒ ✷ then ✷ ❵ t ✿ ✜.

Eugene, 24. July 2008 – p. 16/37

slide-51
SLIDE 51

Same Problem with Rule Inductions

We can specify typing-rules for lambda-terms as:

✭①✿✜✮ ✷

valid

❵ ① ✿ ✜ ❵ t✶ ✿ ✛ ✦✜ ❵ t✷ ✿ ✛ ❵ t✶ t✷ ✿ ✜ ① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

valid ❬❪

① ★

valid valid ✭①✿✜✮✿✿ If ✶ ❵ t ✿ ✜ and valid ✷, ✶ ✒ ✷ then ✷ ❵ t ✿ ✜.

Eugene, 24. July 2008 – p. 16/37

The proof of the weakening lemma is said to be trivial / obvious / routine /. . . in many places. (I am actually still looking for a place in the lit- erature where a trivial / obvious / routine /. . . proof is spelled out — I know of proofs by Gal- lier, McKinna & Pollack and Pitts, but I would not call them trivial / obvious / routine /. . . )

slide-52
SLIDE 52

Recall: Rule Inductions

prem✶ ✿ ✿ ✿ prem♥ scs concl rule

Rule Inductions: 1.) Assume the property for the premises. Assume the side-conditions. 2.) Show the property for the conclusion.

Eugene, 24. July 2008 – p. 17/37

slide-53
SLIDE 53

Induction Principle for Typing

The induction principle that comes with the typing definition is as follows:

✽ ① ✜✿ ✭①✿✜✮ ✷ ❫ valid ✮ P ✭①✮ ✜ ✽ t✶ t✷ ✛ ✜✿ P t✶ ✭✛ ✦✜✮ ❫ P t✷ ✛ ✮ P ✭t✶ t✷✮ ✜ ✽ ① t ✛ ✜✿ ① ★ ❫ P ✭✭①✿✛✮✿✿ ✮ t ✜ ✮ P ✭✕①✿t✮ ✭✛ ✦✜✮ ❵ t ✿ ✜ ✮ P t ✜

Eugene, 24. July 2008 – p. 18/37

Note the quantifiers!

slide-54
SLIDE 54

Proof of Weakening Lemma

① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

If ✶ ❵t✿✜ then ✽✷✿ valid ✷ ❫ ✶ ✒✷ ✮✷ ❵t✿✜

✶ ① t ✛ ✜ ✽✷✿ ✷ ❫ ✭①✿✛✮✿✿✶ ✒✷ ✮ ✷ ❵t✿✜ ① ★ ✶ ✷ ❫ ✶ ✒✷ ✷ ❫ ✶ ✒✷ ✮

Eugene, 24. July 2008 – p. 19/37

slide-55
SLIDE 55

Proof of Weakening Lemma

① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

If ✶ ❵t✿✜ then ✽✷✿ valid ✷ ❫ ✶ ✒✷ ✮✷ ❵t✿✜ For all ✶, ①, t, ✛ and ✜: We know:

✽✷✿ valid ✷ ❫ ✭①✿✛✮✿✿✶ ✒✷ ✮ ✷ ❵t✿✜ ① ★ ✶ ✷ ❫ ✶ ✒✷ ✷ ❫ ✶ ✒✷ ✮

We have to show:

✽✷✿ valid ✷ ❫ ✶ ✒✷ ✮ ✷ ❵✕①✿t✿✛ ✦✜

Eugene, 24. July 2008 – p. 19/37

slide-56
SLIDE 56

Proof of Weakening Lemma

① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

If ✶ ❵t✿✜ then ✽✷✿ valid ✷ ❫ ✶ ✒✷ ✮✷ ❵t✿✜ For all ✶, ①, t, ✛ and ✜: We know:

✽✷✿ valid ✷ ❫ ✭①✿✛✮✿✿✶ ✒✷ ✮ ✷ ❵t✿✜ ① ★ ✶

valid ✷ ❫ ✶ ✒✷ valid ✷ ❫ ✶ ✒✷ ✮ We have to show:

✷ ❵✕①✿t✿✛ ✦✜

Eugene, 24. July 2008 – p. 19/37

slide-57
SLIDE 57

Proof of Weakening Lemma

① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

If ✶ ❵t✿✜ then ✽✷✿ valid ✷ ❫ ✶ ✒✷ ✮✷ ❵t✿✜ For all ✶, ①, t, ✛ and ✜: We know:

✽✷✿ valid ✷ ❫ ✭①✿✛✮✿✿✶ ✒✷ ✮ ✷ ❵t✿✜ ① ★ ✶

valid ✷ ❫ ✶ ✒✷ valid ✷ ❫ ✶ ✒✷ ✮ We have to show:

✷ ❵✕①✿t✿✛ ✦✜

Eugene, 24. July 2008 – p. 19/37

slide-58
SLIDE 58

Proof of Weakening Lemma

① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

If ✶ ❵t✿✜ then ✽✷✿ valid ✷ ❫ ✶ ✒✷ ✮✷ ❵t✿✜ For all ✶, ①, t, ✛ and ✜: We know:

✽✷✿ valid ✷ ❫ ✭①✿✛✮✿✿✶ ✒✷ ✮ ✷ ❵t✿✜ ① ★ ✶

valid ✷ ❫ ✶ ✒✷ valid ✷ ❫ ✶ ✒✷ ✮ We have to show:

✷ ❵✕①✿t✿✛ ✦✜

Eugene, 24. July 2008 – p. 19/37

✷ ✼✦ ✭①✿✛✮✿✿✷

slide-59
SLIDE 59

Proof of Weakening Lemma

① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

If ✶ ❵t✿✜ then ✽✷✿ valid ✷ ❫ ✶ ✒✷ ✮✷ ❵t✿✜ For all ✶, ①, t, ✛ and ✜: We know:

✽✷✿ valid ✷ ❫ ✭①✿✛✮✿✿✶ ✒✷ ✮ ✷ ❵t✿✜ ① ★ ✶

valid ✷ ❫ ✶ ✒✷ ✮ ✭①✿✛✮✿✿✶ ✒✭①✿✛✮✿✿✷ valid ✷ ❫ ✶ ✒✷ ✮ We have to show:

✷ ❵✕①✿t✿✛ ✦✜

Eugene, 24. July 2008 – p. 19/37

✷ ✼✦ ✭①✿✛✮✿✿✷

slide-60
SLIDE 60

Proof of Weakening Lemma

① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

If ✶ ❵t✿✜ then ✽✷✿ valid ✷ ❫ ✶ ✒✷ ✮✷ ❵t✿✜ For all ✶, ①, t, ✛ and ✜: We know:

✽✷✿ valid ✷ ❫ ✭①✿✛✮✿✿✶ ✒✷ ✮ ✷ ❵t✿✜ ① ★ ✶

valid ✷ ❫ ✶ ✒✷ ✮ ✭①✿✛✮✿✿✶ ✒✭①✿✛✮✿✿✷ valid ✷ ❫ ✶ ✒✷ ✮ valid ✭①✿✛✮✿✿✷ ??? We have to show:

✷ ❵✕①✿t✿✛ ✦✜

Eugene, 24. July 2008 – p. 19/37

✷ ✼✦ ✭①✿✛✮✿✿✷

slide-61
SLIDE 61

Eugene, 24. July 2008 – p. 20/37

The usual proof of strong normalisation for simply- typed lambda-terms establishes first: Lemma: If for all reducible s, t❬①✿❂ s❪ is reducible, then ✕①✿t is reducible. Then one shows for a closing (simultaneous) substitution: Theorem: If ❵ t ✿ ✜, then for all closing sub- stitutions ✒ containing reducible terms only, ✒✭t✮ is reducible. Lambda-Case: By ind. we know ✭①✼✦s ❬ ✒✮✭t✮ is reducible with s being reducible. This is equal✄ to

✭✒✭t✮✮❬①✿❂s❪. Therefore, we can apply the lemma and

get ✕①✿✭✒✭t✮✮ is reducible. Because this is equal✄ to

✒✭✕①✿t✮, we are done.

✄you have to take a deep breath

slide-62
SLIDE 62

Strong Induction Principle

Eugene, 24. July 2008 – p. 21/37

Instead we are going to use the strong induction principle and set up the induction so that it “avoids” ✷ (in case of the weakening lemma) and

✒ (in case of SN). ✽ ① ✜

❝✿ ✭①✿✜✮ ✷ ❫ valid ✮ P ❝ ✭①✮ ✜

✽ t✶ t✷ ✛ ✜

❝✿ ✭✽❞✿P ❞ t✶ ✭✛ ✦✜✮✮ ❫ ✭✽❞✿P ❞ t✷ ✛ ✮

✮ P

❝ ✭t✶ t✷✮ ✜

✽ ① t ✛ ✜

❝✿

① ★ ❫

① ★ ❝ ❫ ✭✽❞✿P ❞ ✭✭①✿✛✮✿✿ ✮ t ✜ ✮ ✮ P ❝ ✭✕①✿t✮ ✭✛ ✦✜✮

❵ t ✿ ✜ ✮ P

❝ t ✜
slide-63
SLIDE 63

Proof of Weakening Lemma

① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

If ✶ ❵t✿✜ then valid ✷ ❫ ✶ ✒✷ ✮✷ ❵t✿✜ For all ✶, ①, t, ✛ and ✜: We know:

✽✷✿ valid ✷ ❫ ✭①✿✛✮✿✿✶ ✒✷ ✮✷ ❵t✿✜ ① ★ ✶

valid ✷ ❫ ✶ ✒✷

① ★ ✷

We have to show:

✷ ❵✕①✿t✿✛ ✦✜

Eugene, 24. July 2008 – p. 22/37

slide-64
SLIDE 64

Proof of Weakening Lemma

① ★ ✭①✿✛✮✿✿ ❵ t ✿ ✜ ❵ ✕①✿t ✿ ✛ ✦✜

If ✶ ❵t✿✜ then valid ✷ ❫ ✶ ✒✷ ✮✷ ❵t✿✜ For all ✶, ①, t, ✛ and ✜: We know:

✽✷✿ valid ✷ ❫ ✭①✿✛✮✿✿✶ ✒✷ ✮✷ ❵t✿✜ ① ★ ✶

valid ✷ ❫ ✶ ✒✷

✮ ✭①✿✛✮✿✿✶ ✒✭①✿✛✮✿✿✷ ① ★ ✷ ✮ valid ✭①✿✛✮✿✿✷

We have to show:

✷ ❵✕①✿t✿✛ ✦✜

Eugene, 24. July 2008 – p. 22/37

slide-65
SLIDE 65

In Nominal Isabelle

abbreviation "sub_ctx" :: "(name✂ty) list ✮ (name✂ty) list ✮ bool" ("_ ✒ _") where " ✶ ✒ ✷ ✑ ✽ x T. (x,T) ✷ set ✶

✦ (x,T) ✷ set ✷"

lemma weakening_lemma: fixes ✶ ✷::"(name✂ty) list" assumes a: " ✶ ❵ t : T" and b: "valid ✷" and c: " ✶ ✒ ✷" shows " ✷ ❵ t : T" using a b c by (nominal_induct ✶ t T avoiding: ✷ rule: typing.strong_induct) (auto simp add: atomize_all atomize_imp)

Eugene, 24. July 2008 – p. 23/37

slide-66
SLIDE 66

SN (Again)

Theorem: If ❵ t ✿ ✜, then for all closing sub- stitutions ✒ containing reducible terms only, ✒✭t✮ is reducible. Since we say that the strong induction should avoid ✒, we get the assumption ① ★ ✒ then: Lambda-Case: By ind. we know ✭①✼✦s ❬ ✒✮✭t✮ is reducible with s being reducible. This is equal to

✭✒✭t✮✮❬①✿❂s❪. Therefore, we can apply the

lemma and get ✕①✿✭✒✭t✮✮ is reducible. Because this is equal to ✒✭✕①✿t✮, we are done.

① ★ ✒ ✮ ✭①✼✦s ❬ ✒✮✭t✮ ❂ ✭✒✭t✮✮❬①✿❂s❪ ✒✭✕①✿t✮ ❂ ✕①✿✭✒✭t✮✮

Eugene, 24. July 2008 – p. 24/37

slide-67
SLIDE 67

So Far So Good

A Faulty Lemma with the Variable Convention?

Variable Convention: If ▼✶❀ ✿ ✿ ✿ ❀ ▼♥ occur in a certain mathematical context (e.g. definition, proof), then in these terms all bound variables are chosen to be different from the free variables.

Barendregt in “The Lambda-Calculus: Its Syntax and Semantics”

Inductive Definitions: prem✶ ✿ ✿ ✿ prem♥ scs concl Rule Inductions: 1.) Assume the property for the premises. Assume the side-conditions. 2.) Show the property for the conclusion.

Eugene, 24. July 2008 – p. 25/37

slide-68
SLIDE 68

Faulty Reasoning

Consider the two-place relation foo:

① ✼✦ ① t✶ t✷ ✼✦ t✶ t✷ t ✼✦ t✵ ✕①✿t ✼✦ t✵ t ✼✦ t✵ ② ★ t ② ★ t✵

Eugene, 24. July 2008 – p. 26/37

slide-69
SLIDE 69

Faulty Reasoning

Consider the two-place relation foo:

① ✼✦ ① t✶ t✷ ✼✦ t✶ t✷ t ✼✦ t✵ ✕①✿t ✼✦ t✵

The lemma we going to prove: Let t ✼✦ t✵. If ② ★ t then ② ★ t✵.

Eugene, 24. July 2008 – p. 26/37

slide-70
SLIDE 70

Faulty Reasoning

Consider the two-place relation foo:

① ✼✦ ① t✶ t✷ ✼✦ t✶ t✷ t ✼✦ t✵ ✕①✿t ✼✦ t✵

The lemma we going to prove: Let t ✼✦ t✵. If ② ★ t then ② ★ t✵. Cases 1 and 2 are trivial: If ② ★ ① then ② ★ ①. If ② ★ t✶ t✷ then ② ★ t✶ t✷.

Eugene, 24. July 2008 – p. 26/37

slide-71
SLIDE 71

Faulty Reasoning

Consider the two-place relation foo:

① ✼✦ ① t✶ t✷ ✼✦ t✶ t✷ t ✼✦ t✵ ✕①✿t ✼✦ t✵

The lemma we going to prove: Let t ✼✦ t✵. If ② ★ t then ② ★ t✵. Case 3: We know ② ★ ✕①✿t. We have to show ② ★ t✵. The IH says: if ② ★ t then ② ★ t✵.

② ★ t ② ★ t✵

Eugene, 24. July 2008 – p. 26/37

slide-72
SLIDE 72

Faulty Reasoning

Consider the two-place relation foo:

① ✼✦ ① t✶ t✷ ✼✦ t✶ t✷ t ✼✦ t✵ ✕①✿t ✼✦ t✵

The lemma we going to prove: Let t ✼✦ t✵. If ② ★ t then ② ★ t✵. Case 3: We know ② ★ ✕①✿t. We have to show ② ★ t✵. The IH says: if ② ★ t then ② ★ t✵.

② ★ t ② ★ t✵

Eugene, 24. July 2008 – p. 26/37

Variable Convention:

If ▼✶❀ ✿ ✿ ✿ ❀ ▼♥ occur in a certain mathematical context (e.g. definition, proof), then in these terms all bound vari- ables are chosen to be different from the free variables.

In our case: The free variables are ② and t✵; the bound one is ①. By the variable convention we conclude that ① ✻❂ ②.

slide-73
SLIDE 73

Faulty Reasoning

Consider the two-place relation foo:

① ✼✦ ① t✶ t✷ ✼✦ t✶ t✷ t ✼✦ t✵ ✕①✿t ✼✦ t✵

The lemma we going to prove: Let t ✼✦ t✵. If ② ★ t then ② ★ t✵. Case 3: We know ② ★ ✕①✿t. We have to show ② ★ t✵. The IH says: if ② ★ t then ② ★ t✵.

② ★ t ② ★ t✵

Eugene, 24. July 2008 – p. 26/37

② ✻✷fv✭✕①✿t✮ ✭ ✮ ② ✻✷fv✭t✮❢①❣

①✻❂②

✭ ✮ ② ✻✷fv✭t✮

Variable Convention:

If ▼✶❀ ✿ ✿ ✿ ❀ ▼♥ occur in a certain mathematical context (e.g. definition, proof), then in these terms all bound vari- ables are chosen to be different from the free variables.

In our case: The free variables are ② and t✵; the bound one is ①. By the variable convention we conclude that ① ✻❂ ②.

slide-74
SLIDE 74

Faulty Reasoning

Consider the two-place relation foo:

① ✼✦ ① t✶ t✷ ✼✦ t✶ t✷ t ✼✦ t✵ ✕①✿t ✼✦ t✵

The lemma we going to prove: Let t ✼✦ t✵. If ② ★ t then ② ★ t✵. Case 3: We know ② ★ ✕①✿t. We have to show ② ★ t✵. The IH says: if ② ★ t then ② ★ t✵. So we have ② ★ t. Hence ② ★ t✵ by IH. Done!

Eugene, 24. July 2008 – p. 26/37

② ✻✷fv✭✕①✿t✮ ✭ ✮ ② ✻✷fv✭t✮❢①❣

①✻❂②

✭ ✮ ② ✻✷fv✭t✮

Variable Convention:

If ▼✶❀ ✿ ✿ ✿ ❀ ▼♥ occur in a certain mathematical context (e.g. definition, proof), then in these terms all bound vari- ables are chosen to be different from the free variables.

In our case: The free variables are ② and t✵; the bound one is ①. By the variable convention we conclude that ① ✻❂ ②.

slide-75
SLIDE 75

Faulty Reasoning

Consider the two-place relation foo:

① ✼✦ ① t✶ t✷ ✼✦ t✶ t✷ t ✼✦ t✵ ✕①✿t ✼✦ t✵

The lemma we going to prove: Let t ✼✦ t✵. If ② ★ t then ② ★ t✵. Case 3: We know ② ★ ✕①✿t. We have to show ② ★ t✵. The IH says: if ② ★ t then ② ★ t✵. So we have ② ★ t. Hence ② ★ t✵ by IH. Done!

Eugene, 24. July 2008 – p. 26/37

slide-76
SLIDE 76

VC-Compatibility

We introduced two conditions that make the VC safe to use in rule inductions: the relation needs to be equivariant, and the binder is not allowed to occur in the support of the conclusion (not free in the conclusion) Once a relation satisfies these two conditions, then Nominal Isabelle derives the strong induction principle automatically.

Eugene, 24. July 2008 – p. 27/37

slide-77
SLIDE 77

VC-Compatibility

We introduced two conditions that make the VC safe to use in rule inductions: the relation needs to be equivariant, and the binder is not allowed to occur in the support of the conclusion (not free in the conclusion) Once a relation satisfies these two conditions, then Nominal Isabelle derives the strong induction principle automatically.

Eugene, 24. July 2008 – p. 27/37

A relation ❘ is equivariant iff

✽✙ t✶ ✿ ✿ ✿ t♥ ❘ t✶ ✿ ✿ ✿ t♥ ✮ ❘✭✙✁t✶✮ ✿ ✿ ✿ ✭✙✁t♥✮

This means the relation has to be invariant under permutative renaming of variables.

(This property can be checked automatically if the inductive definition is composed of equivariant “things”.)

slide-78
SLIDE 78

VC-Compatibility

We introduced two conditions that make the VC safe to use in rule inductions: the relation needs to be equivariant, and the binder is not allowed to occur in the support of the conclusion (not free in the conclusion) Once a relation satisfies these two conditions, then Nominal Isabelle derives the strong induction principle automatically.

Eugene, 24. July 2008 – p. 27/37

slide-79
SLIDE 79

Honest Toil, No Theft!

The sacred principle of HOL: “The method of ‘postulating’ what we want has many advantages; they are the same as the advantages of theft over honest toil.”

  • B. Russell, Introduction of Mathematical Philosophy

I will show next that the weak structural induction principle implies the strong structural induction principle. (I am only going to show the lambda-case.)

Eugene, 24. July 2008 – p. 28/37

slide-80
SLIDE 80

Permutations

A permutation acts on variable names as follows:

❬❪✁❛

def

❂ ❛ ✭✭❛✶ ❛✷✮✿✿✙✮✁❛

def

❂ ✽ ❃ ❁ ❃ ✿ ❛✶

if ✙✁❛ ❂ ❛✷

❛✷

if ✙✁❛ ❂ ❛✶

✙✁❛

  • therwise

❬❪ stands for the empty list (the identity

permutation), and

✭❛✶ ❛✷✮✿✿✙ stands for the permutation ✙

followed by the swapping ✭❛✶ ❛✷✮.

Eugene, 24. July 2008 – p. 29/37

slide-81
SLIDE 81

Permutations on Lambda-Terms

Permutations act on lambda-terms as follows:

✙✁ ①

def

“action on variables”

✙✁ ✭t✶ t✷✮

def

❂ ✭✙✁t✶✮ ✭✙✁t✷✮ ✙✁✭✕①✿t✮

def

❂ ✕✭✙✁①✮✿✭✙✁t✮

Alpha-equivalence can be defined as:

t✶ ❂ t✷ ✕①✿t✶ ❂ ✕①✿t✷ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ① ★ t✷ ✕①✿t✶ ❂ ✕②✿t✷

Eugene, 24. July 2008 – p. 30/37

slide-82
SLIDE 82

Permutations on Lambda-Terms

Permutations act on lambda-terms as follows:

✙✁ ①

def

“action on variables”

✙✁ ✭t✶ t✷✮

def

❂ ✭✙✁t✶✮ ✭✙✁t✷✮ ✙✁✭✕①✿t✮

def

❂ ✕✭✙✁①✮✿✭✙✁t✮

Alpha-equivalence can be defined as:

t✶ ❂ t✷ ✕①✿t✶ ❂ ✕①✿t✷ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ① ★ t✷ ✕①✿t✶ ❂ ✕②✿t✷

Eugene, 24. July 2008 – p. 30/37

Notice, I wrote equality here!

slide-83
SLIDE 83

My Claim

✽①✿ P ① ✽t✶ t✷✿ P t✶ ❫ P t✷ ✮ P ✭t✶ t✷✮ ✽① t✿ P t ✮ P ✭✕①✿t✮ P t

implies

✽① ❝✿ P ❝ ① ✽t✶ t✷ ❝✿ ✭✽❞✿ P ❞ t✶✮ ❫ ✭✽❞✿ P ❞ t✷✮ ✮ P ❝ ✭t✶ t✷✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❞✿ P ❞ t✮ ✮ P ❝ ✭✕①✿t✮ P ❝ t

Eugene, 24. July 2008 – p. 31/37

slide-84
SLIDE 84

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove P ❝ t by induction on t.

P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ✽✙ ❝✿ P ❝ ✭✙✁t✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮ ② ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮ ✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮ ✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-85
SLIDE 85

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t.

P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ✽✙ ❝✿ P ❝ ✭✙✁t✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮ ② ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮ ✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮ ✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-86
SLIDE 86

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t. I.e., we have to show P ❝ ✭✙✁✭✕①✿t✮✮.

✽✙ ❝✿ P ❝ ✭✙✁t✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮ ② ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮ ✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮ ✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-87
SLIDE 87

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t. I.e., we have to show P ❝ ✕✭✙✁①✮✿✭✙✁t✮.

✽✙ ❝✿ P ❝ ✭✙✁t✮ ✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮ ② ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮ ✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮ ✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-88
SLIDE 88

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t. I.e., we have to show P ❝ ✕✭✙✁①✮✿✭✙✁t✮. We have ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction.

✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮ ② ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮ ✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮ ✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-89
SLIDE 89

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t. I.e., we have to show P ❝ ✕✭✙✁①✮✿✭✙✁t✮. We have ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction. Our weaker precondition says that:

✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮ ② ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮ ✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮ ✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-90
SLIDE 90

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t. I.e., we have to show P ❝ ✕✭✙✁①✮✿✭✙✁t✮. We have ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction. Our weaker precondition says that:

✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮

We choose a fresh ② such that ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮.

✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮ ✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-91
SLIDE 91

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t. I.e., we have to show P ❝ ✕✭✙✁①✮✿✭✙✁t✮. We have ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction. Our weaker precondition says that:

✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮

We choose a fresh ② such that ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮. Now we can use ✽❝✿ P ❝ ✭✭✭② ✙✁①✮✿✿✙✮✁t✮

✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-92
SLIDE 92

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t. I.e., we have to show P ❝ ✕✭✙✁①✮✿✭✙✁t✮. We have ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction. Our weaker precondition says that:

✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮

We choose a fresh ② such that ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮. Now we can use ✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮

✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-93
SLIDE 93

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t. I.e., we have to show P ❝ ✕✭✙✁①✮✿✭✙✁t✮. We have ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction. Our weaker precondition says that:

✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮

We choose a fresh ② such that ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮. Now we can use ✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮ to infer

P ❝ ✕②✿✭✭② ✙✁①✮✁✙✁t✮ ✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-94
SLIDE 94

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t. I.e., we have to show P ❝ ✕✭✙✁①✮✿✭✙✁t✮. We have ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction. Our weaker precondition says that:

✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮

We choose a fresh ② such that ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮. Now we can use ✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮ to infer

P ❝ ✕②✿✭✭② ✙✁①✮✁✙✁t✮

However

✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮ P ❝ ✕✭✙✁①✮✿✭✙✁t✮ ① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-95
SLIDE 95

Proof for the Strong Induction Principle

Eugene, 24. July 2008 – p. 32/37

We prove ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction on t. I.e., we have to show P ❝ ✕✭✙✁①✮✿✭✙✁t✮. We have ✽✙ ❝✿ P ❝ ✭✙✁t✮ by induction. Our weaker precondition says that:

✽① t ❝✿ ① ★ ❝ ❫ ✭✽❝✿ P ❝ t✮ ✮ P ❝ ✭✕①✿t✮

We choose a fresh ② such that ② ★ ✭✙✁①❀ ✙✁t❀ ❝✮. Now we can use ✽❝✿ P ❝ ✭✭② ✙✁①✮✁✙✁t✮ to infer

P ❝ ✕②✿✭✭② ✙✁①✮✁✙✁t✮

However

✕②✿✭✭② ✙✁①✮✁✙✁t✮ ❂ ✕✭✙✁①✮✿✭✙✁t✮

Therefore P ❝ ✕✭✙✁①✮✿✭✙✁t✮ and we are done.

① ✻❂ ② t✶ ❂ ✭① ②✮✁t✷ ② ★ t✷ ✕②✿t✶ ❂ ✕①✿t✷

slide-96
SLIDE 96

This Proof in Isabelle

Eugene, 24. July 2008 – p. 33/37

lemma lam_strong_induct: fixes c::"’a::fs_name" assumes h✶: "❱ x c. P c (Var x)" and h✷: "❱ t✶ t✷ c. ❬

❬✽ d. P d t✶; ✽ d. P d t✷❪ ❪ ❂ ✮ P c (App t✶ t✷)"

and h✸: "❱ x t c. ❬

❬x★c; ✽ d. P d t❪ ❪ ❂ ✮ P c (Lam [x].t)"

shows "P c t" proof - have "✽ (✙::name prm) c. P c (✙✁t)"

✿ ✿ ✿

interesting bit then have "P c (([]::name prm)✁t)" by blast then show "P c t" by simp qed

slide-97
SLIDE 97

Interesting Bit

Eugene, 24. July 2008 – p. 34/37

❱ ❬ ❬ ★ ✽ ❪ ❪ ❂ ✮ ✿ ✿ ✿

have "✽ (✙::name prm) c. P c (✙✁t)" proof (induct t rule: lam.induct) case (Lam x t) have ih: "✽ (✙::name prm) c. P c (✙✁t)" by fact { fix ✙::"name prm" and c::"’a::fs_name"

  • btain y::"name" where fc: "y★(✙✁x,✙✁t,c)"

by (rule exists_fresh) (auto simp add: fs_name1) from ih have "✽ c. P c (([(y,✙✁x)]@✙)✁t)" by simp then have "✽ c. P c ([(y,✙✁x)]✁(✙✁t))" by (auto simp only: pt_name2) with h✸ have "P c (Lam [y].[(y,✙✁x)]✁(✙✁t))" using fc by (simp add: fresh_prod) moreover have "Lam [y].[(y,✙✁x)]✁(✙✁t) = Lam [(✙✁x)].(✙✁t)" using fc by (simp add: lam.inject alpha fresh_atm fresh_prod) ultimately have "P c (Lam [(✙✁x)].(✙✁t))" by simp } then have "✽ (✙::name prm) c. P c (Lam [(✙✁x)].(✙✁t))" by simp then show "✽ (✙::name prm) c. P c (✙✁(Lam [x].t))" by simp qed (auto intro: h✶ h✷)

✿ ✿ ✿

slide-98
SLIDE 98

Interesting Bit

Eugene, 24. July 2008 – p. 34/37

❱ ❬ ❬ ★ ✽ ❪ ❪ ❂ ✮ ✿ ✿ ✿

have "✽ (✙::name prm) c. P c (✙✁t)" proof (induct t rule: lam.induct) case (Lam x t) have ih: "✽ (✙::name prm) c. P c (✙✁t)" by fact { fix ✙::"name prm" and c::"’a::fs_name"

  • btain y::"name" where fc: "y★(✙✁x,✙✁t,c)"

by (rule exists_fresh) (auto simp add: fs_name1) from ih have "✽ c. P c (([(y,✙✁x)]@✙)✁t)" by simp then have "✽ c. P c ([(y,✙✁x)]✁(✙✁t))" by (auto simp only: pt_name2) with h✸ have "P c (Lam [y].[(y,✙✁x)]✁(✙✁t))" using fc by (simp add: fresh_prod) moreover have "Lam [y].[(y,✙✁x)]✁(✙✁t) = Lam [(✙✁x)].(✙✁t)" using fc by (simp add: lam.inject alpha fresh_atm fresh_prod) ultimately have "P c (Lam [(✙✁x)].(✙✁t))" by simp } then have "✽ (✙::name prm) c. P c (Lam [(✙✁x)].(✙✁t))" by simp then show "✽ (✙::name prm) c. P c (✙✁(Lam [x].t))" by simp qed (auto intro: h✶ h✷)

✿ ✿ ✿

slide-99
SLIDE 99

Interesting Bit

Eugene, 24. July 2008 – p. 34/37

❱ ❬ ❬ ★ ✽ ❪ ❪ ❂ ✮ ✿ ✿ ✿

have "✽ (✙::name prm) c. P c (✙✁t)" proof (induct t rule: lam.induct) case (Lam x t) have ih: "✽ (✙::name prm) c. P c (✙✁t)" by fact { fix ✙::"name prm" and c::"’a::fs_name"

  • btain y::"name" where fc: "y★(✙✁x,✙✁t,c)"

by (rule exists_fresh) (auto simp add: fs_name1) from ih have "✽ c. P c (([(y,✙✁x)]@✙)✁t)" by simp then have "✽ c. P c ([(y,✙✁x)]✁(✙✁t))" by (auto simp only: pt_name2) with h✸ have "P c (Lam [y].[(y,✙✁x)]✁(✙✁t))" using fc by (simp add: fresh_prod) moreover have "Lam [y].[(y,✙✁x)]✁(✙✁t) = Lam [(✙✁x)].(✙✁t)" using fc by (simp add: lam.inject alpha fresh_atm fresh_prod) ultimately have "P c (Lam [(✙✁x)].(✙✁t))" by simp } then have "✽ (✙::name prm) c. P c (Lam [(✙✁x)].(✙✁t))" by simp then show "✽ (✙::name prm) c. P c (✙✁(Lam [x].t))" by simp qed (auto intro: h✶ h✷)

✿ ✿ ✿

slide-100
SLIDE 100

Interesting Bit

Eugene, 24. July 2008 – p. 34/37

❱ ❬ ❬ ★ ✽ ❪ ❪ ❂ ✮ ✿ ✿ ✿

have "✽ (✙::name prm) c. P c (✙✁t)" proof (induct t rule: lam.induct) case (Lam x t) have ih: "✽ (✙::name prm) c. P c (✙✁t)" by fact { fix ✙::"name prm" and c::"’a::fs_name"

  • btain y::"name" where fc: "y★(✙✁x,✙✁t,c)"

by (rule exists_fresh) (auto simp add: fs_name1) from ih have "✽ c. P c (([(y,✙✁x)]@✙)✁t)" by simp then have "✽ c. P c ([(y,✙✁x)]✁(✙✁t))" by (auto simp only: pt_name2) with h✸ have "P c (Lam [y].[(y,✙✁x)]✁(✙✁t))" using fc by (simp add: fresh_prod) moreover have "Lam [y].[(y,✙✁x)]✁(✙✁t) = Lam [(✙✁x)].(✙✁t)" using fc by (simp add: lam.inject alpha fresh_atm fresh_prod) ultimately have "P c (Lam [(✙✁x)].(✙✁t))" by simp } then have "✽ (✙::name prm) c. P c (Lam [(✙✁x)].(✙✁t))" by simp then show "✽ (✙::name prm) c. P c (✙✁(Lam [x].t))" by simp qed (auto intro: h✶ h✷)

✿ ✿ ✿

slide-101
SLIDE 101

Interesting Bit

Eugene, 24. July 2008 – p. 34/37

❱ ❬ ❬ ★ ✽ ❪ ❪ ❂ ✮ ✿ ✿ ✿

have "✽ (✙::name prm) c. P c (✙✁t)" proof (induct t rule: lam.induct) case (Lam x t) have ih: "✽ (✙::name prm) c. P c (✙✁t)" by fact { fix ✙::"name prm" and c::"’a::fs_name"

  • btain y::"name" where fc: "y★(✙✁x,✙✁t,c)"

by (rule exists_fresh) (auto simp add: fs_name1) from ih have "✽ c. P c (([(y,✙✁x)]@✙)✁t)" by simp then have "✽ c. P c ([(y,✙✁x)]✁(✙✁t))" by (auto simp only: pt_name2) with h✸ have "P c (Lam [y].[(y,✙✁x)]✁(✙✁t))" using fc by (simp add: fresh_prod) moreover have "Lam [y].[(y,✙✁x)]✁(✙✁t) = Lam [(✙✁x)].(✙✁t)" using fc by (simp add: lam.inject alpha fresh_atm fresh_prod) ultimately have "P c (Lam [(✙✁x)].(✙✁t))" by simp } then have "✽ (✙::name prm) c. P c (Lam [(✙✁x)].(✙✁t))" by simp then show "✽ (✙::name prm) c. P c (✙✁(Lam [x].t))" by simp qed (auto intro: h✶ h✷)

✿ ✿ ✿

slide-102
SLIDE 102

Interesting Bit

Eugene, 24. July 2008 – p. 34/37

❱ ❬ ❬ ★ ✽ ❪ ❪ ❂ ✮ ✿ ✿ ✿

have "✽ (✙::name prm) c. P c (✙✁t)" proof (induct t rule: lam.induct) case (Lam x t) have ih: "✽ (✙::name prm) c. P c (✙✁t)" by fact { fix ✙::"name prm" and c::"’a::fs_name"

  • btain y::"name" where fc: "y★(✙✁x,✙✁t,c)"

by (rule exists_fresh) (auto simp add: fs_name1) from ih have "✽ c. P c (([(y,✙✁x)]@✙)✁t)" by simp then have "✽ c. P c ([(y,✙✁x)]✁(✙✁t))" by (auto simp only: pt_name2) with h✸ have "P c (Lam [y].[(y,✙✁x)]✁(✙✁t))" using fc by (simp add: fresh_prod) moreover have "Lam [y].[(y,✙✁x)]✁(✙✁t) = Lam [(✙✁x)].(✙✁t)" using fc by (simp add: lam.inject alpha fresh_atm fresh_prod) ultimately have "P c (Lam [(✙✁x)].(✙✁t))" by simp } then have "✽ (✙::name prm) c. P c (Lam [(✙✁x)].(✙✁t))" by simp then show "✽ (✙::name prm) c. P c (✙✁(Lam [x].t))" by simp qed (auto intro: h✶ h✷)

✿ ✿ ✿

slide-103
SLIDE 103

Interesting Bit

Eugene, 24. July 2008 – p. 34/37

h✸: “❱ x t c. ❬

❬x ★ c; ✽ d. P d t❪ ❪ ❂ ✮ P c Lam [x].t” ✿ ✿ ✿

have "✽ (✙::name prm) c. P c (✙✁t)" proof (induct t rule: lam.induct) case (Lam x t) have ih: "✽ (✙::name prm) c. P c (✙✁t)" by fact { fix ✙::"name prm" and c::"’a::fs_name"

  • btain y::"name" where fc: "y★(✙✁x,✙✁t,c)"

by (rule exists_fresh) (auto simp add: fs_name1) from ih have "✽ c. P c (([(y,✙✁x)]@✙)✁t)" by simp then have "✽ c. P c ([(y,✙✁x)]✁(✙✁t))" by (auto simp only: pt_name2) with h✸ have "P c (Lam [y].[(y,✙✁x)]✁(✙✁t))" using fc by (simp add: fresh_prod) moreover have "Lam [y].[(y,✙✁x)]✁(✙✁t) = Lam [(✙✁x)].(✙✁t)" using fc by (simp add: lam.inject alpha fresh_atm fresh_prod) ultimately have "P c (Lam [(✙✁x)].(✙✁t))" by simp } then have "✽ (✙::name prm) c. P c (Lam [(✙✁x)].(✙✁t))" by simp then show "✽ (✙::name prm) c. P c (✙✁(Lam [x].t))" by simp qed (auto intro: h✶ h✷)

✿ ✿ ✿

slide-104
SLIDE 104

Interesting Bit

Eugene, 24. July 2008 – p. 34/37

❱ ❬ ❬ ★ ✽ ❪ ❪ ❂ ✮ ✿ ✿ ✿

have "✽ (✙::name prm) c. P c (✙✁t)" proof (induct t rule: lam.induct) case (Lam x t) have ih: "✽ (✙::name prm) c. P c (✙✁t)" by fact { fix ✙::"name prm" and c::"’a::fs_name"

  • btain y::"name" where fc: "y★(✙✁x,✙✁t,c)"

by (rule exists_fresh) (auto simp add: fs_name1) from ih have "✽ c. P c (([(y,✙✁x)]@✙)✁t)" by simp then have "✽ c. P c ([(y,✙✁x)]✁(✙✁t))" by (auto simp only: pt_name2) with h✸ have "P c (Lam [y].[(y,✙✁x)]✁(✙✁t))" using fc by (simp add: fresh_prod) moreover have "Lam [y].[(y,✙✁x)]✁(✙✁t) = Lam [(✙✁x)].(✙✁t)" using fc by (simp add: lam.inject alpha fresh_atm fresh_prod) ultimately have "P c (Lam [(✙✁x)].(✙✁t))" by simp } then have "✽ (✙::name prm) c. P c (Lam [(✙✁x)].(✙✁t))" by simp then show "✽ (✙::name prm) c. P c (✙✁(Lam [x].t))" by simp qed (auto intro: h✶ h✷)

✿ ✿ ✿

slide-105
SLIDE 105

Interesting Bit

Eugene, 24. July 2008 – p. 34/37

❱ ❬ ❬ ★ ✽ ❪ ❪ ❂ ✮ ✿ ✿ ✿

have "✽ (✙::name prm) c. P c (✙✁t)" proof (induct t rule: lam.induct) case (Lam x t) have ih: "✽ (✙::name prm) c. P c (✙✁t)" by fact { fix ✙::"name prm" and c::"’a::fs_name"

  • btain y::"name" where fc: "y★(✙✁x,✙✁t,c)"

by (rule exists_fresh) (auto simp add: fs_name1) from ih have "✽ c. P c (([(y,✙✁x)]@✙)✁t)" by simp then have "✽ c. P c ([(y,✙✁x)]✁(✙✁t))" by (auto simp only: pt_name2) with h✸ have "P c (Lam [y].[(y,✙✁x)]✁(✙✁t))" using fc by (simp add: fresh_prod) moreover have "Lam [y].[(y,✙✁x)]✁(✙✁t) = Lam [(✙✁x)].(✙✁t)" using fc by (simp add: lam.inject alpha fresh_atm fresh_prod) ultimately have "P c (Lam [(✙✁x)].(✙✁t))" by simp } then have "✽ (✙::name prm) c. P c (Lam [(✙✁x)].(✙✁t))" by simp then show "✽ (✙::name prm) c. P c (✙✁(Lam [x].t))" by simp qed (auto intro: h✶ h✷)

✿ ✿ ✿

slide-106
SLIDE 106

Interesting Bit

Eugene, 24. July 2008 – p. 34/37

❱ ❬ ❬ ★ ✽ ❪ ❪ ❂ ✮ ✿ ✿ ✿

have "✽ (✙::name prm) c. P c (✙✁t)" proof (induct t rule: lam.induct) case (Lam x t) have ih: "✽ (✙::name prm) c. P c (✙✁t)" by fact { fix ✙::"name prm" and c::"’a::fs_name"

  • btain y::"name" where fc: "y★(✙✁x,✙✁t,c)"

by (rule exists_fresh) (auto simp add: fs_name1) from ih have "✽ c. P c (([(y,✙✁x)]@✙)✁t)" by simp then have "✽ c. P c ([(y,✙✁x)]✁(✙✁t))" by (auto simp only: pt_name2) with h✸ have "P c (Lam [y].[(y,✙✁x)]✁(✙✁t))" using fc by (simp add: fresh_prod) moreover have "Lam [y].[(y,✙✁x)]✁(✙✁t) = Lam [(✙✁x)].(✙✁t)" using fc by (simp add: lam.inject alpha fresh_atm fresh_prod) ultimately have "P c (Lam [(✙✁x)].(✙✁t))" by simp } then have "✽ (✙::name prm) c. P c (Lam [(✙✁x)].(✙✁t))" by simp then show "✽ (✙::name prm) c. P c (✙✁(Lam [x].t))" by simp qed (auto intro: h✶ h✷)

✿ ✿ ✿

slide-107
SLIDE 107

Some Examples

x ★ (x, T✶):: ❵ t : T✷

❵ Lam [x].t : T✶ ✦ T✷ ✼✦ ✼✦ ❵✝

✶ ✶

❵✝

✷ ✷

❵✝

✶ ✷

✶ ✷

✜ ✶ ✁ ❵✝ ✱ ✜ ✷ ★ ✁ ✁ ❵✝ ✱ ✜ ✶ ✦ ✜ ✷

Eugene, 24. July 2008 – p. 35/37

slide-108
SLIDE 108

Some Examples

x ★ (x, T✶):: ❵ t : T✷

❵ Lam [x].t : T✶ ✦ T✷

t ✼✦ t’ Lam [x].t ✼✦ t’

❵✝

✶ ✶

❵✝

✷ ✷

❵✝

✶ ✷

✶ ✷

✜ ✶ ✁ ❵✝ ✱ ✜ ✷ ★ ✁ ✁ ❵✝ ✱ ✜ ✶ ✦ ✜ ✷

Eugene, 24. July 2008 – p. 35/37

slide-109
SLIDE 109

Some Examples

x ★ (x, T✶):: ❵ t : T✷

❵ Lam [x].t : T✶ ✦ T✷

t ✼✦ t’ Lam [x].t ✼✦ t’

❵✝

✶ ✶

❵✝

✷ ✷

❵✝

✶ ✷

✶ ✷

✜ ✶ ✁ ❵✝ ✱ ✜ ✷ ★ ✁ ✁ ❵✝ ✱ ✜ ✶ ✦ ✜ ✷

Eugene, 24. July 2008 – p. 35/37

slide-110
SLIDE 110

Some Examples

x ★ (x, T✶):: ❵ t : T✷

❵ Lam [x].t : T✶ ✦ T✷

t ✼✦ t’ Lam [x].t ✼✦ t’

❵✝ A✶ : Type

(x, A✶):: ❵✝ M✷ : A✷ x ★ ( , A✶)

❵✝ Lam [x:A✶].M✷ : ✆[x:A✶].A✷ ✜ ✶ ✁ ❵✝ ✱ ✜ ✷ ★ ✁ ✁ ❵✝ ✱ ✜ ✶ ✦ ✜ ✷

Eugene, 24. July 2008 – p. 35/37

slide-111
SLIDE 111

Some Examples

x ★ (x, T✶):: ❵ t : T✷

❵ Lam [x].t : T✶ ✦ T✷

t ✼✦ t’ Lam [x].t ✼✦ t’

❵✝ A✶ : Type

(x, A✶):: ❵✝ M✷ : A✷ x ★ ( , A✶)

❵✝ Lam [x:A✶].M✷ : ✆[x:A✶].A✷ ✜ ✶ ✁ ❵✝ ✱ ✜ ✷ ★ ✁ ✁ ❵✝ ✱ ✜ ✶ ✦ ✜ ✷

Eugene, 24. July 2008 – p. 35/37

bound bound free

slide-112
SLIDE 112

Some Examples

x ★ (x, T✶):: ❵ t : T✷

❵ Lam [x].t : T✶ ✦ T✷

t ✼✦ t’ Lam [x].t ✼✦ t’

❵✝ A✶ : Type

(x, A✶):: ❵✝ M✷ : A✷ x ★ ( , A✶)

❵✝ Lam [x:A✶].M✷ : ✆[x:A✶].A✷

(x, ✜ ✶)::✁ ❵✝ App M (Var x) ✱ App N (Var x) : ✜ ✷ x ★ (✁, M, N)

✁ ❵✝ M ✱ N : ✜ ✶ ✦ ✜ ✷

Eugene, 24. July 2008 – p. 35/37

free free free

slide-113
SLIDE 113

Some Examples

x ★ (x, T✶):: ❵ t : T✷

❵ Lam [x].t : T✶ ✦ T✷

t ✼✦ t’ Lam [x].t ✼✦ t’

❵✝ A✶ : Type

(x, A✶):: ❵✝ M✷ : A✷ x ★ ( , A✶)

❵✝ Lam [x:A✶].M✷ : ✆[x:A✶].A✷

(x, ✜ ✶)::✁ ❵✝ App M (Var x) ✱ App N (Var x) : ✜ ✷ x ★ (✁, M, N)

✁ ❵✝ M ✱ N : ✜ ✶ ✦ ✜ ✷

Eugene, 24. July 2008 – p. 35/37

slide-114
SLIDE 114

Conclusions

The Nominal Isabelle automatically derives the strong structural induction principle for all nominal datatypes (not just the lambda-calculus); also for rule inductions (though they have to satisfy a vc-condition). They are easy to use: you just have to think carefully what the variable convention should be. We can explore the dark corners of the variable convention: when and where it can actually be used.

Eugene, 24. July 2008 – p. 36/37

slide-115
SLIDE 115

Conclusions

The Nominal Isabelle automatically derives the strong structural induction principle for all nominal datatypes (not just the lambda-calculus); also for rule inductions (though they have to satisfy a vc-condition). They are easy to use: you just have to think carefully what the variable convention should be. We can explore the dark corners of the variable convention: when and where it can actually be used. Main Point: Actually these proofs using the variable convention are all trivial / obvious /

  • routine. . . provided you use Nominal Isabelle. ;o)

Eugene, 24. July 2008 – p. 36/37

slide-116
SLIDE 116

Next

How do we deal with statements such as “Expressions differing only in names of bound variables are equivalent”.

✕①✿① ❂ ✕②✿②

Exercise: Find a short proof for the weakening lemma that does not rely on the variable convention.

Eugene, 24. July 2008 – p. 37/37