Big Picture TRS yes implement no Literature CSI maybe - - PowerPoint PPT Presentation

big picture
SMART_READER_LITE
LIVE PREVIEW

Big Picture TRS yes implement no Literature CSI maybe - - PowerPoint PPT Presentation

Layer Systems for Confluence Formalized 1 Bertram Felgenhauer , Franziska Rapp University of Innsbruck, Allgemeines Rechenzentrum Innsbruck ICTAC, Stellenbosch 2018-10-16 1 supported by FWF project P27528 Motivation Big Picture TRS yes


slide-1
SLIDE 1

Layer Systems for Confluence — Formalized1

Bertram Felgenhauer, Franziska Rapp

University of Innsbruck, Allgemeines Rechenzentrum Innsbruck

ICTAC, Stellenbosch 2018-10-16

1supported by FWF project P27528

slide-2
SLIDE 2

Motivation

Big Picture

TRS Literature CSI yes no maybe implement

  • automated confluence of first-order term rewrite systems

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 2/22

slide-3
SLIDE 3

Motivation

Big Picture

TRS Literature CSI yes no maybe proof Ce T A yes no maybe IsaFoR implement formalize generate

  • certified automated confluence of first-order term rewrite systems

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 2/22

slide-4
SLIDE 4

Motivation

Big Picture

TRS Literature CSI yes no maybe proof Ce T A yes no maybe IsaFoR implement formalize generate

  • certified automated confluence of first-order term rewrite systems
  • here: formalizing layer systems

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 2/22

slide-5
SLIDE 5

Motivation

Term Rewriting

+(x, 0) → x +(x, S(y)) → S(+(x, y)) +(0, +(0, S(S(0))))

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 3/22

slide-6
SLIDE 6

Motivation

Term Rewriting

+(x, 0) → x +(x, S(y)) → S(+(x, y)) +(0, +(0, S(S(0)))) +(0, S(+(0, S(0))))

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 3/22

slide-7
SLIDE 7

Motivation

Term Rewriting

+(x, 0) → x +(x, S(y)) → S(+(x, y)) +(0, +(0, S(S(0)))) +(0, S(+(0, S(0)))) S(+(0, +(0, S(0)))) +(0, S(S(+(0, 0))))

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 3/22

slide-8
SLIDE 8

Motivation

Term Rewriting

+(x, 0) → x +(x, S(y)) → S(+(x, y)) +(0, +(0, S(S(0)))) +(0, S(+(0, S(0)))) S(+(0, +(0, S(0)))) +(0, S(S(+(0, 0)))) S(+(0, S(+(0, 0)))) +(0, S(S(0))) S(S(+(0, +(0, 0)))) S(+(0, S(0))) S(S(+(0, 0))) S(S(0))

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 3/22

slide-9
SLIDE 9

Motivation

Confluence

s t u v

∗ ∗ ∗ ∗

Definition

  • ∗← · →∗ ⊆ →∗ · ∗←

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 4/22

slide-10
SLIDE 10

Motivation

Confluence

s t u v

∗ ∗ ∗ ∗

Definition

  • ∗← · →∗ ⊆ →∗ · ∗←

Criteria for TRSs

  • orthogonality: left-linear, no critical pairs
  • Knuth-Bendix: terminating, joinable critical pairs
  • . . .

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 4/22

slide-11
SLIDE 11

Motivation

Example

@(@(K, x), y) → x @(@(@(S, x), y), z) → @(@(x, z), @(y, z)) e(x, x) → ⊤ Orthogonal?

  • not left-linear
  • no critical pairs

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 5/22

slide-12
SLIDE 12

Motivation

Example

@(@(K, x), y) → x @(@(@(S, x), y), z) → @(@(x, z), @(y, z)) e(x, x) → ⊤ Orthogonal?

  • not left-linear
  • no critical pairs

Knuth-Bendix?

  • non-terminating

@(@(@(S, I), I), @(@(S, I), I)) →+ @(@(@(S, I), I), @(@(S, I), I)) where I = @(@(S, K), K)

  • joinable critical pairs

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 5/22

slide-13
SLIDE 13

Motivation

Modularity

Theorem

Let R1, R2 be TRSs over disjoint signatures. Then CR(R1 ∪ R2) ⇐ ⇒ CR(R1) ∧ CR(R2)

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 6/22

slide-14
SLIDE 14

Motivation

Modularity

Theorem

Let R1, R2 be TRSs over disjoint signatures. Then CR(R1 ∪ R2) ⇐ ⇒ CR(R1) ∧ CR(R2) Example @(@(K, x), y) → x @(@(@(S, x), y), z) → @(@(x, z), @(y, z)) e(x, x) → ⊤

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 6/22

slide-15
SLIDE 15

Motivation

Modularity

Theorem

Let R1, R2 be TRSs over disjoint signatures. Then CR(R1 ∪ R2) ⇐ ⇒ CR(R1) ∧ CR(R2) Example @(@(K, x), y) → x @(@(@(S, x), y), z) → @(@(x, z), @(y, z)) e(x, x) → ⊤

  • first two rules are orthogonal

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 6/22

slide-16
SLIDE 16

Motivation

Modularity

Theorem

Let R1, R2 be TRSs over disjoint signatures. Then CR(R1 ∪ R2) ⇐ ⇒ CR(R1) ∧ CR(R2) Example @(@(K, x), y) → x @(@(@(S, x), y), z) → @(@(x, z), @(y, z)) e(x, x) → ⊤

  • first two rules are orthogonal
  • last rule is terminating, and has no critical pairs

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 6/22

slide-17
SLIDE 17

Motivation

Modularity

Theorem

Let R1, R2 be TRSs over disjoint signatures. Then CR(R1 ∪ R2) ⇐ ⇒ CR(R1) ∧ CR(R2) Example @(@(K, x), y) → x @(@(@(S, x), y), z) → @(@(x, z), @(y, z)) e(x, x) → ⊤

  • first two rules are orthogonal
  • last rule is terminating, and has no critical pairs
  • disjoint signatures =

⇒ confluent by modularity

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 6/22

slide-18
SLIDE 18

Layer Systems

Table of Contents

Motivation Layer Systems Formalization Implementation

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 7/22

slide-19
SLIDE 19

Layer Systems

Proving Modularity

History

  • Toyama 1987
  • Klop et al. 1994
  • van Oostrom 2008
  • . . .

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 8/22

slide-20
SLIDE 20

Layer Systems

Proving Modularity

History

  • Toyama 1987
  • Klop et al. 1994
  • van Oostrom 2008
  • . . .

Proof idea

  • =

⇒ is easy (homogeneous terms are closed under rewriting)

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 8/22

slide-21
SLIDE 21

Layer Systems

Proving Modularity

History

  • Toyama 1987
  • Klop et al. 1994
  • van Oostrom 2008
  • . . .

Proof idea

  • =

⇒ is easy (homogeneous terms are closed under rewriting)

  • decompose terms into maximal top and aliens recursively

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 8/22

slide-22
SLIDE 22

Layer Systems

Example

@(@(K, x), y) → x @(@(@(S, x), y), z) → @(@(x, z), @(y, z)) e(x, x) → ⊤

  • e(@(x, e(S, x)), K)

e @ x e S x K

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 9/22

slide-23
SLIDE 23

Layer Systems

Example

@(@(K, x), y) → x @(@(@(S, x), y), z) → @(@(x, z), @(y, z)) e(x, x) → ⊤

  • e(@(x, e(S, x)), K)

e @ x e S x K e @ x e S x K

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 9/22

slide-24
SLIDE 24

Layer Systems

Example

@(@(K, x), y) → x @(@(@(S, x), y), z) → @(@(x, z), @(y, z)) e(x, x) → ⊤

  • e(@(x, e(S, x)), K)

e @ x e S x K e @ x e S x K

  • max-top e(, ), aliens @(x, e(S, x)) and K, rank 4

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 9/22

slide-25
SLIDE 25

Layer Systems

Proving Modularity

History

  • Toyama 1987
  • Klop et al. 1994
  • van Oostrom 2008
  • . . .

Proof idea

  • =

⇒ is easy (homogeneous terms are closed under rewriting)

  • decompose terms into maximal top and aliens recursively
  • use induction on rank

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 10/22

slide-26
SLIDE 26

Layer Systems

Proving Modularity

History

  • Toyama 1987
  • Klop et al. 1994
  • van Oostrom 2008
  • . . .

Proof idea

  • =

⇒ is easy (homogeneous terms are closed under rewriting)

  • decompose terms into maximal top and aliens recursively
  • use induction on rank
  • . . . details are complicated

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 10/22

slide-27
SLIDE 27

Layer Systems

Related Results

Results

  • persistence (Aoto and Toyama 1997)
  • layer preservation (Ohlebusch 1994)
  • currying (Kahrs 1995)
  • . . .

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 11/22

slide-28
SLIDE 28

Layer Systems

Related Results

Results

  • persistence (Aoto and Toyama 1997)
  • layer preservation (Ohlebusch 1994)
  • currying (Kahrs 1995)
  • . . .

Proof idea

  • similar to modularity
  • different decomposition into max-top and aliens

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 11/22

slide-29
SLIDE 29

Layer Systems

Layer Systems in a Nutshell

Idea

  • layer system L: set of admissible tops

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 12/22

slide-30
SLIDE 30

Layer Systems

Layer Systems in a Nutshell

Idea

  • layer system L: set of admissible tops
  • theorem: if R is confluent on L then R is confluent

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 12/22

slide-31
SLIDE 31

Layer Systems

Layer Systems in a Nutshell

Idea

  • layer system L: set of admissible tops
  • theorem: if R is confluent on L then R is confluent
  • adapt modularity proof

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 12/22

slide-32
SLIDE 32

Layer Systems

Layer Systems in a Nutshell

Idea

  • layer system L: set of admissible tops
  • theorem: if R is confluent on L then R is confluent
  • adapt modularity proof

Complications

  • max-tops must be unique

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 12/22

slide-33
SLIDE 33

Layer Systems

Layer Systems in a Nutshell

Idea

  • layer system L: set of admissible tops
  • theorem: if R is confluent on L then R is confluent
  • adapt modularity proof

Complications

  • max-tops must be unique
  • rewriting must not increase rank

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 12/22

slide-34
SLIDE 34

Layer Systems

Layer Systems in a Nutshell

Idea

  • layer system L: set of admissible tops
  • theorem: if R is confluent on L then R is confluent
  • adapt modularity proof

Complications

  • max-tops must be unique
  • rewriting must not increase rank
  • several restrictions on fusion

f H c →H(x)→x f c

  • f

c

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 12/22

slide-35
SLIDE 35

Layer Systems

Layer Systems Definition

Definition

Under the following conditions, the TRS R is layered wrt L ⊆ C(F, V): L1 Every term in T (F, V) has a non-empty top L2 If x ∈ V and C ∈ C, then C[x]p ∈ L if and only if C[]p ∈ L L3 If L, N ∈ L, p ∈ PosF(L), and L|p ⊔ N is defined then L[L|p ⊔ N]p ∈ L W If M is the max-top of s, p ∈ PosF(M), and s →p,ℓ→r t with ℓ → r ∈ R, then M →p,ℓ→r L for some L ∈ L C1 In (W), either L is the max-top of t or L = C2 If L, N ∈ L and L ⊑ N, then L[N|p]p ∈ L for any p ∈ Pos(L)

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 13/22

slide-36
SLIDE 36

Layer Systems

Layer Systems Definition

Definition

Under the following conditions, the TRS R is layered wrt L ⊆ C(F, V): L1 Every term in T (F, V) has a non-empty top L2 If x ∈ V and C ∈ C, then C[x]p ∈ L if and only if C[]p ∈ L L3 If L, N ∈ L, p ∈ PosF(L), and L|p ⊔ N is defined then L[L|p ⊔ N]p ∈ L W If M is the max-top of s, p ∈ PosF(M), and s →p,ℓ→r t with ℓ → r ∈ R, then M →p,ℓ→r L for some L ∈ L C1 In (W), either L is the max-top of t or L = C2 If L, N ∈ L and L ⊑ N, then L[N|p]p ∈ L for any p ∈ Pos(L)

DON’T PANIC

it’s formalized

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 13/22

slide-37
SLIDE 37

Layer Systems

Using Layer Systems

Main result(s)

  • R layered by L and rank 1 terms confluent =

⇒ R confluent

  • . . .

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 14/22

slide-38
SLIDE 38

Layer Systems

Using Layer Systems

Main result(s)

  • R layered by L and rank 1 terms confluent =

⇒ R confluent

  • . . .

Applications

  • modularity: R1 ∪ R2 is layered by C(F1, V) ∪ C(F2, V).
  • persistence: R is layered by well-sorted contexts
  • currying: PP(R) is layered by. . .

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 14/22

slide-39
SLIDE 39

Formalization

Table of Contents

Motivation Layer Systems Formalization Implementation

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 15/22

slide-40
SLIDE 40

Formalization

Challenges

Software engineering

  • interface between confluence result and applications

(separation of concerns)

  • structuring the big induction proof

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 16/22

slide-41
SLIDE 41

Formalization

Challenges

Software engineering

  • interface between confluence result and applications

(separation of concerns)

  • structuring the big induction proof

Miscellanea

  • obvious
  • express properties algebraically
  • open: nice abstraction for multi-hole contexts

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 16/22

slide-42
SLIDE 42

Formalization

Using Locales

layer system sig layer system (L1,L2,L3) weakly layered (W) layered (C1,C2) Locales

  • bundle assumptions and conclusions (the interface)
  • can be instantiated (for applications)

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 17/22

slide-43
SLIDE 43

Formalization

Using Locales

layer system sig layer system (L1,L2,L3) weakly layered (W) layered (C1,C2) Locales

  • bundle assumptions and conclusions (the interface)
  • can be instantiated (for applications)
  • main result is in layered locale

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 17/22

slide-44
SLIDE 44

Formalization

Using Locales

layer system sig layer system (L1,L2,L3) weakly layered (W) layered (C1,C2) Locales

  • bundle assumptions and conclusions (the interface)
  • can be instantiated (for applications)
  • main result is in layered locale
  • we also use locales for the induction on rank

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 17/22

slide-45
SLIDE 45

Formalization

Results and Effort

  • definitions, basic results about layers

3.2k

  • if R is layered by L, and R is confluent on L, then R is confluent

2.0k

  • for disjoint R1 and R2, R1 ∪ R2 is layered by homogeneous terms

= ⇒ modularity 0.8k

  • for many-sorted R, R is layered by well-typed terms

= ⇒ persistence 1.5k

  • for any R, Cu(R) is layered by a layer system

= ⇒ preservation of confluence by currying 3.8k

  • executable persistent decomposition check for Ce

T A 0.6k Σ 12k lines of Isar

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 18/22

slide-46
SLIDE 46

Formalization

Results and Effort

  • definitions, basic results about layers

3.2k (20×)

  • if R is layered by L, and R is confluent on L, then R is confluent

2.0k (13×)

  • for disjoint R1 and R2, R1 ∪ R2 is layered by homogeneous terms

= ⇒ modularity 0.8k (30×)

  • for many-sorted R, R is layered by well-typed terms

= ⇒ persistence 1.5k (50×)

  • for any R, Cu(R) is layered by a layer system

= ⇒ preservation of confluence by currying 3.8k (40×)

  • executable persistent decomposition check for Ce

T A 0.6k Σ 12k lines of Isar

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 18/22

slide-47
SLIDE 47

Implementation

Table of Contents

Motivation Layer Systems Formalization Implementation

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 19/22

slide-48
SLIDE 48

Implementation

Implementation

Ce T A

  • extend CPF format
  • formalize persistent decomposition
  • define executable code

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 20/22

slide-49
SLIDE 49

Implementation

Implementation

Ce T A

  • extend CPF format
  • formalize persistent decomposition
  • define executable code

CSI

  • order-sorted persistence was there
  • add many-sorted persistence
  • add proof output

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 20/22

slide-50
SLIDE 50

Implementation

Experiments

CSI +pd CSI yes 148 154 244 no 162 162 162 maybe 127 121 31 total 437 437 437

http://cl-informatik.uibk.ac.at/software/lisa/ictac2018/

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 21/22

slide-51
SLIDE 51

Implementation

Conclusion

Contributions

  • formalization of layer systems in Isabelle/HOL
  • first formalization of Toyama’s theorem
  • persistence, currying
  • certification for persistence-based decomposition

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 22/22

slide-52
SLIDE 52

Implementation

Conclusion

Contributions

  • formalization of layer systems in Isabelle/HOL
  • first formalization of Toyama’s theorem
  • persistence, currying
  • certification for persistence-based decomposition

Future work

  • order-sorted persistence
  • further applications
  • currying is foundation for efficient ground TRS confluence check

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 22/22

slide-53
SLIDE 53

Implementation

Conclusion

Contributions

  • formalization of layer systems in Isabelle/HOL
  • first formalization of Toyama’s theorem
  • persistence, currying
  • certification for persistence-based decomposition

Future work

  • order-sorted persistence
  • further applications
  • currying is foundation for efficient ground TRS confluence check

Thanks!

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 22/22

slide-54
SLIDE 54

Implementation

Non-Modularity of Termination

F(0, 1, x) → F(x, x, x) h(x, y) → x h(x, y) → y F(0, 1, h(0, 1)) − → F(h(0, 1), h(0, 1), h(0, 1)) ∗ − → F(0, 1, h(0, 1)) − → . . .

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 23/22

slide-55
SLIDE 55

Implementation

Related Work — First-Order TRSs

Formalization and certification

  • CiME3 – generates Coq scripts (Knuth-Bendix criterion)
  • trs – PVS (Knuth-Bendix criterion, orthogonality)
  • Ruiz-Reina et al., 2002 – ACL2 (Knuth-Bendix criterion)

Tools

  • ACP
  • CoLL-Saigawa

Bertram Felgenhauer (UIBK) Layer Systems — Formalized ICTAC 2018 24/22