SlideShare a Scribd company logo
1 of 36
Download to read offline
Omega test and
                beyond
                    酒井 政裕

                Proof Summit 2012




12年9月2日日曜日
目次
             • 自己紹介とか

             • 算術とは

             • Omegaの中身

             • まとめ




12年9月2日日曜日
自己紹介

             酒井 政裕
        • Blog: ヒビルテ

        • Twitter: @masahiro_sakai


        • Haskeller
        • Agda: Agda1のころ遊んでた。Agda2は少しだけ。

        • Coq: 初心者 (多分、Coq力 0.3 くらいの雑魚)

        • 昨年、Alloy本の翻訳を出版 (共訳)

        • Proofsummi2011 では自動定理証明の簡単な紹介

12年9月2日日曜日
宣伝: Alloy本 & TAPL
             •   抽象によるソフトウェア設計(Daniel Jackson 著)

                 •   中島震監訳 今井健男・酒井政裕・遠藤侑介・片岡欣夫共訳
                     オーム社


                                Types and Programming Language (TAPL)
                                         Benjamin C. Pierce 著



                                  現在翻訳中



12年9月2日日曜日
最近の興味:
                 色々な決定手続きのオモチャ実装

             •   Presburger Arithmetics               •   Gomory’s Cut

                 •   Omega Test                       •   Conti-Traverso

                 •   Cooper’s Algorithm           •   SAT / MaxSAT / Pseudo
                                                      Boolean (DPLL, CDCL)
             •   Real Arithmetics
                                                  •   Uninterpreted function
                 •   Fourier-Motzkin variable         (Congruence Closure)
                     elimination
                                                  •   実装したいと思ってるもの
                 •   Simplex method

                 •   Gröbner basis (Buchberger)       •   CAD (Cylindrical Algebraic
                                                          Decomposition)
             •   (Mixed) Integer Programming
                                                      •   cut-sat (Cutting to the
                 •   Branch-and-bound                     Chase)


                        github.com/msakai/toysolver
12年9月2日日曜日
最近の興味:
                 色々な決定手続きのオモチャ実装

             •   Presburger Arithmetics                   •   Gomory’s Cut

                 •   Omega Test                           •   Conti-Traverso

                 •   Cooper’s Algorithm               •
                                                     SAT / MaxSAT / Pseudo
                                                本当は実数には限らないけれど。
                                                     Boolean (DPLL, CDCL)
             •   Real Arithmetics
                                                あと、きっと@erutuf13さんが、
                                                   • Uninterpreted function
                 •   Fourier-Motzkin variable          (Congruence Closure)
                                                    熱く語ってくれるはず
                     elimination
                                                      •   実装したいと思ってるもの
                 •   Simplex method

                 •   Gröbner basis (Buchberger)           •   CAD (Cylindrical Algebraic
                                                              Decomposition)
             •   (Mixed) Integer Programming
                                                          •   cut-sat (Cutting to the
                 •   Branch-and-bound                         Chase)


                        github.com/msakai/toysolver
12年9月2日日曜日
今日の話: Omega
             • そのなかの Omega Test
              ≒ Coq の omega タクティック

             • 自然数や整数に関する自動証明




12年9月2日日曜日
今日の話: Omega
             • そのなかの Omega Test
              ≒ Coq の omega タクティック

             • 自然数や整数に関する自動証明



             Q. omegaを使ったことある人?


12年9月2日日曜日
Omega使用例
             Require Import Omega.
             Open Scope Z_scope.


             Goal forall m n, 1 + 2 * m <> 2 * n.
              intros.
              omega.
             Qed.




12年9月2日日曜日
目次
             • 自己紹介とか

             • 算術とは

             • Omegaの中身

             • まとめ




12年9月2日日曜日
算術
             • 算術 = 自然数に関する理論
              • 自然数ではなく整数を対象にすることもあるが、本質的には
                変わらない
             • 様々な算術の体系
              • ペアノ算術 PA (1889)

                • ゲーデルが決定不能性を証明 (1930)
              • ロビンソン算術 Q (1950) ≒ PA − 帰納法

                • PAより相当弱いが決定不能
              • Presburger 算術 (1929)   ≒ PA − 掛け算
                • 決定可能!


12年9月2日日曜日
算術の体系と問題クラス(?)
             真の算術                                 多分、色々
                                                 間違ってるけど
         Peano Arithmetics

                        Presburger Arithmetics
                         (掛け算なし = 線形)


                                   QF_LIA        ディオファントス
                                                    方程式
             Robinson’s Q         整数線形計画
             (帰納法無し)
                                                 ∀無し (Σ1?)

12年9月2日日曜日
Presburger 算術
             • 公理

              • ¬(0 = x + 1)

              • x+1=y+1→x=y

              • x+0=x

              • (x + y) + 1 = x + (y + 1)

              • (P(0) "∀x(P(x) → P(x + 1))) → ∀y P(y).

             • 注: 定数との掛け算は、足し算の繰り返しで書けるので、
              表現可能 (e.g. 3×a = a+a+a) 。線形多項式は扱える。


12年9月2日日曜日
目次
             • 自己紹介とか

             • 算術とは

             • Omegaの中身

             • まとめ




12年9月2日日曜日
Omegaの中身
             • Presburger 算術は決定可能 ⇒ 自動証明可能

             • CoqのomegaタクティックはPresburger算術
               の自動証明をする

              • 本体はCoqのプラグイン (omega.ml)

              • Coqの証明項(Gallina)を生成

              • 生成された証明項で使う補題等 (OmegaLemmas.v)




12年9月2日日曜日
Omegaの中身
             • Presburger 算術は決定可能 ⇒ 自動証明可能

             • CoqのomegaタクティックはPresburger算術
               の自動証明をする

              • 本体はCoqのプラグイン (omega.ml)

              • Coqの証明項(Gallina)を生成

              • 生成された証明項で使う補題等 (OmegaLemmas.v)



        Q. omegaの中身を知っている人いる?
12年9月2日日曜日
Omegaの元ネタ
             • "The omega test: a fast and practical integer
               programming algorithm for dependence
               analysis," by W. Pugh

               • in Proceedings of the 1991 ACM/IEEE conference on
                 Supercomputing, ser. Supercomputing '91.

               • http://www.cs.umd.edu/~pugh/papers/omega.pdf

               • 並列化のため、ループの依存性を、添字に関
                  するPresburger算術の論理式の真偽で判定


12年9月2日日曜日
Omega Test の仕組み
        • 実数の場合の量化子除去手法
             Fourier-Motzkin variable elimination を応用して実現

        • 量化子除去 (Quantifier elimination; QE)

             • 量化子を含む論理式と同値で量化子を含まない論理式を
                求める。

             • 例: ∀x : R. 2 < x % x ≦ 3 ⇔ ¬∃x : R. 2 ≧ x " x > 3 ⇔ ¬(2 > 3)

             • 量化子を含まない論理式は真偽が自明


12年9月2日日曜日
Fourier-Motzkin variable
                   elimination: 射影
                               ∃x. ∃y. ∃z. P(x,y,z) ⇔ ∃x. ∃y. Q(x,y)

                                                                                                        P(x,y,z) が真になる領域




                                                                                                    影
                                                                                                    = ∃z. P(x,y,z) が真になる領域
                                                                                                    = Q(x,y) が真になる領域
       The Omega Test: a fast and practical integer programming algorithm for dependence analysis



                                     射影を繰り返していくと、変数が消えていく


12年9月2日日曜日
Fourier-Motzkin variable
                elimination の基本
  1. P = ∃x. Q1(x)"…"Qn(x) で Qi(x) が x を含む不等式とする

     • ただし不等号は≦,≧に限る

     • 例: ∃x. x ≧ 1 " 3x ≧ 4 " 2x - 3 ≦ 0 " x ≦ 4

  2. 各 Qi(x) を x について解いて ∃x. (L1 ≦ x " … " Lp ≦ x) " (x ≦ U1 " … " x ≦ Uq)

     • 例: ∃x. 1 ≦ x " 4/3 ≦ x " x ≦ 3/2 " x ≦ 4

  3. max { Li }i ≦ x ≦ min { Uj }j の範囲のxが条件を満たすが、

      この範囲が空でないのは "i "j Li ≦ Uj と同値
                                                       1   4/3   3/2    4
     • 例: 1≦3/2 " 1≦4 " 4/3 ≦ 3/2 " 4/3≦4



                                                             {
12年9月2日日曜日
Fourier-Motzkin variable
             elimination: 一般の場合(1)
             • 厳密不等号 (<, >)を扱うには、
              下界 Li ◁ x と上界 x ◁’ Uj を組み合わせるとき

              • ◁ = < もしくは ◁’ = < ならば Li < Uj にする。

                • 例: (∃x. 2 < x " x ≦ 3) ⇔ 2<3

              • ◁ = ◁’ = ≦ ならば、これまで通り Li ≦ Uj にする。

             • 本体 Qi にxが現れない場合: くくりだして帰着

              • ∃x. Q(x) " Qi ⇔ (∃x. P(x)) " Qi


12年9月2日日曜日
Fourier-Motzkin variable
             elimination: 一般の場合(2)
             • 本体がDNFの場合:
                 ∃x. (Q1,1 " … ) % … % (Qn,1 " … )
                 ⇔
                 (∃x. Q1,1 " … ) % … % (∃x. Qn,1 " … )
                 なので、量化子を分配すれば帰着できる

             •   DNF = Disjunctive Normal Form (選言標準形)
                 原子論理式の連言(and)の選言(or)




12年9月2日日曜日
Fourier-Motzkin variable
             elimination: 一般の場合(3)
             • toDNF : Formula → DNF
               toDNF = …

             • elim : Var × DNF → DNF
               elim(x, P) = (∃x. P)を量化子除去した結果

             • FMVE : Formula → DNF
               FMVE(P) = toDNF(P) if P が量化子を含まない
               FMVE(C[∃x. P]) = FMVE(C[ elim(x, FMVE(P)) ])
               FMVE(C[∀x. P]) = FMVE(C[¬∃x. ¬P])


12年9月2日日曜日
Fourier-Motzkin variable
                 elimination: Coq
             • Coq にも fourierタクティックがあるよ。

              • omegaほどには知られてないけど

              • 使用例:

              Require Import Fourier.
              Goal forall x y : R, x-y>1 -> x-2*y<0 -> x>1.
               intros.
               fourier.
              Qed.

12年9月2日日曜日
Omega Test: 概要
                • Fourier-Motzkin variable elimination で射影

                • ただし、 射影結果に格子点が含まれても、
                  射影元に格子点が含まれるとは限らない

                                                                                                          P(x,y,z) が真になる領域




                                                                                                            FMVEで射影した影
                                                                                                              (real shadow)


             The Omega Test: a fast and practical integer programming algorithm for dependence analysis


12年9月2日日曜日
Omega Test: 工夫
             •   Omega Test の工夫

                 •   射影元が充分厚い部分なら、影の格子点の上には、必ず格子点がある
                     (影の黒い部分 dark shadow)

                 •   定理1: (a − 1)(b − 1) ≤ ad − bc ⇒ (∃x : Z. c ≤ a*x " b*x ≤ d)
                          dark shadow を表す式                    射影元の領域




                        The Omega Test: a fast and practical integer programming algorithm for dependence analysis
12年9月2日日曜日
Omega Test: 流れ
             ∃x : Z. P(x) の真偽を判定したい

         1. P の real shadow と dark shadow を計算

         2. real shadow に格子点が含まれない ⇒ 偽

         3. real shadow = dark shadow ⇒ FMVEと同じ

         4. dark shadow に格子点が含まれる ⇒ 真

         5. それ以外 (Omega Test Nightmare) ⇒
             real shadow の格子点の上の格子点を網羅チェック


12年9月2日日曜日
Omega Test: その他
      •       網羅的チェックは説明が面倒なので略

      •       量化子除去: ∃x. P(x) ⇔ (dark shadow % 網羅的な場合の式)

      •       様々な工夫

          •    等号の方が効率的に処理可能なので、できるだけ等号を使う

          •    GCD Test: a1x1 + … + anxn = c は c が gcd { ai } i で割り切れないなら充足不能

          •    ∃ x y z. P(x,y,z) なら x, y, z のうち
               real shadow と dark shadow が一致する変数から除去
               (網羅的なチェックによる分岐を出来るだけ先送り ⇒ 組み合わせ爆発を回避)

          •    などなど




12年9月2日日曜日
Coqのomegaタクティック
        • Coq のomegaタクティック

             • 残念ながら Omega Test Nightmare の場合の処理は実装さ
               れてない。 (名前負けしてるぞ∼)

             • なので、完全な決定手続きではなく、解けない場合も……


                   Require Import Omega.
                   Open Scope Z_scope.
                   Goal forall x y,
                       27 <= 11 * x + 13 * y <= 45 ->
                       -10 <= 7 * x - 9 * y <= 4 -> False.
                    intros.
                    omega.
                   ⇒ Error: Omega can't solve this system
12年9月2日日曜日
Coqのomegaタクティック
             • omegaの代替としてPsatzがあり、
                そのliaタクティックなら解けるらしいが…
     Require Import Psatz.
     Require Import ZArith.
     Open Scope Z_scope.
     Goal forall x y,
          27 <= 11 * x + 13 * y <= 45 ->
          -10 <= 7 * x - 9 * y <= 4 -> False.
      intros.
      lia.




12年9月2日日曜日
Coqのomegaタクティック
             • omegaの代替としてPsatzがあり、
                そのliaタクティックなら解けるらしいが…
     Require Import Psatz.
     Require Import ZArith.
     Open Scope Z_scope.
     Goal forall x y,
          27 <= 11 * x + 13 * y <= 45 ->
          -10 <= 7 * x - 9 * y <= 4 -> False.
      intros.
      lia.

       ⇒
       Anomaly: Uncaught exception Unix.Unix_error(1, "open", "lia.cache").
       Please report.
12年9月2日日曜日
Coqのomegaタクティック
             • omegaの代替としてPsatzがあり、
                そのliaタクティックなら解けるらしいが…
     Require Import Psatz.
     Require Import ZArith.
     Open Scope Z_scope.
     Goal forall x y,
                                                (´・ω・`)
          27 <= 11 * x + 13 * y <= 45 ->
          -10 <= 7 * x - 9 * y <= 4 -> False.
      intros.
      lia.

       ⇒
       Anomaly: Uncaught exception Unix.Unix_error(1, "open", "lia.cache").
       Please report.
12年9月2日日曜日
Coqのomegaタクティック
             • omegaの代替としてPsatzがあり、
                そのliaタクティックなら解けるらしいが…
     Require Import Psatz.
     Require Import ZArith.
     Open Scope Z_scope.
     Goal forall x y,
                                                 (´・ω・`)
          27 <= 11 * x + 13 * y <= 45 ->
          -10 <= 7 * x - 9 * y <= 4 -> False.
                                                 【追記】 CoqIDEを実行している
      intros.
      lia.                                      カレントディレクトリが書き込み不能
                                                     という原因でした
       ⇒
       Anomaly: Uncaught exception Unix.Unix_error(1, "open", "lia.cache").
       Please report.
12年9月2日日曜日
まとめ
             • 実数・整数に関する線形式の決定手続と量化子除去を紹介

              • Fourier-Motzkin variable elimination
              • Omega Test
             • タクティックの意義
                                                       一般の論理     決定可能な
              • 決定不能な論理の表現力と                                      論理

              • 決定手続による自動化の
                                              表現力        高い       低い
              • いいとこ取り

             • 決定手続き自体も面白いので                                     決定可能
                                                       半決定可能
               一緒に遊びませんか?                    自動証明                (それなりに
                                                       (爆発しがち)
                                                                 スケール)

12年9月2日日曜日
まとめ


              Happy
             Theorem
             Proving
12年9月2日日曜日
おまけ: 非線形の場合
             • 実数に関する線形多項式を扱うFourier-Motzkin

             • 整数に関する線形多項式を扱うOmega Test

             • を紹介したけど、実数なら非線形でも実は解ける (実閉体)


                                  実数                      整数


                                                  Omega Test, Cooper's
                             Fourier-Motzkin
               線形                                         method
                          (double-exponential)
                                                   (triple-exponential)

                          Cylindrical Algebraic
               非線形           Decomposition           (undecidable)
                          (double-exponential)

12年9月2日日曜日

More Related Content

More from Masahiro Sakai

DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningDeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningMasahiro Sakai
 
Towards formal verification of neural networks
Towards formal verification of neural networksTowards formal verification of neural networks
Towards formal verification of neural networksMasahiro Sakai
 
関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習Masahiro Sakai
 
Writing a SAT solver as a hobby project
Writing a SAT solver as a hobby projectWriting a SAT solver as a hobby project
Writing a SAT solver as a hobby projectMasahiro Sakai
 
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...Masahiro Sakai
 
SAT/SMT solving in Haskell
SAT/SMT solving in HaskellSAT/SMT solving in Haskell
SAT/SMT solving in HaskellMasahiro Sakai
 
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)Masahiro Sakai
 
自動定理証明の紹介
自動定理証明の紹介自動定理証明の紹介
自動定理証明の紹介Masahiro Sakai
 
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...Masahiro Sakai
 
“Design and Implementation of Generics for the .NET Common Language Runtime”他...
“Design and Implementation of Generics for the .NET Common Language Runtime”他...“Design and Implementation of Generics for the .NET Common Language Runtime”他...
“Design and Implementation of Generics for the .NET Common Language Runtime”他...Masahiro Sakai
 
Relaxed Dependency Analysis
Relaxed Dependency AnalysisRelaxed Dependency Analysis
Relaxed Dependency AnalysisMasahiro Sakai
 
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...Masahiro Sakai
 
自然言語をラムダ式で解釈する体系PTQのHaskell実装
自然言語をラムダ式で解釈する体系PTQのHaskell実装自然言語をラムダ式で解釈する体系PTQのHaskell実装
自然言語をラムダ式で解釈する体系PTQのHaskell実装Masahiro Sakai
 
Whole Program Paths 等の紹介@PLDIr#3
Whole Program Paths 等の紹介@PLDIr#3Whole Program Paths 等の紹介@PLDIr#3
Whole Program Paths 等の紹介@PLDIr#3Masahiro Sakai
 
Run-time Code Generation and Modal-ML の紹介@PLDIr#2
Run-time Code Generation and Modal-ML の紹介@PLDIr#2Run-time Code Generation and Modal-ML の紹介@PLDIr#2
Run-time Code Generation and Modal-ML の紹介@PLDIr#2Masahiro Sakai
 
Introduction to Categorical Programming (Revised)
Introduction to Categorical Programming (Revised)Introduction to Categorical Programming (Revised)
Introduction to Categorical Programming (Revised)Masahiro Sakai
 
Introduction to Categorical Programming
Introduction to Categorical ProgrammingIntroduction to Categorical Programming
Introduction to Categorical ProgrammingMasahiro Sakai
 
融合変換による最適化の理論的基盤と正当性 (2006-06-27)
融合変換による最適化の理論的基盤と正当性 (2006-06-27)融合変換による最適化の理論的基盤と正当性 (2006-06-27)
融合変換による最適化の理論的基盤と正当性 (2006-06-27)Masahiro Sakai
 
融合変換による最適化の理論的基盤と正当性 (2006-06-20)
融合変換による最適化の理論的基盤と正当性 (2006-06-20)融合変換による最適化の理論的基盤と正当性 (2006-06-20)
融合変換による最適化の理論的基盤と正当性 (2006-06-20)Masahiro Sakai
 
Ruby-GNOME2におけるGC問題
Ruby-GNOME2におけるGC問題Ruby-GNOME2におけるGC問題
Ruby-GNOME2におけるGC問題Masahiro Sakai
 

More from Masahiro Sakai (20)

DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningDeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep Learning
 
Towards formal verification of neural networks
Towards formal verification of neural networksTowards formal verification of neural networks
Towards formal verification of neural networks
 
関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習関数プログラマから見たPythonと機械学習
関数プログラマから見たPythonと機械学習
 
Writing a SAT solver as a hobby project
Writing a SAT solver as a hobby projectWriting a SAT solver as a hobby project
Writing a SAT solver as a hobby project
 
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
RClassify: Classifying Race Conditions in Web Applications via Deterministic ...
 
SAT/SMT solving in Haskell
SAT/SMT solving in HaskellSAT/SMT solving in Haskell
SAT/SMT solving in Haskell
 
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
萩野服部研究室 スキー合宿 2012 自己紹介(酒井)
 
自動定理証明の紹介
自動定理証明の紹介自動定理証明の紹介
自動定理証明の紹介
 
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
“Adoption and Focus: Practical Linear Types for Imperative Programming”他の紹介@P...
 
“Design and Implementation of Generics for the .NET Common Language Runtime”他...
“Design and Implementation of Generics for the .NET Common Language Runtime”他...“Design and Implementation of Generics for the .NET Common Language Runtime”他...
“Design and Implementation of Generics for the .NET Common Language Runtime”他...
 
Relaxed Dependency Analysis
Relaxed Dependency AnalysisRelaxed Dependency Analysis
Relaxed Dependency Analysis
 
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
“Symbolic bounds analysis of pointers, array indices, and accessed memory reg...
 
自然言語をラムダ式で解釈する体系PTQのHaskell実装
自然言語をラムダ式で解釈する体系PTQのHaskell実装自然言語をラムダ式で解釈する体系PTQのHaskell実装
自然言語をラムダ式で解釈する体系PTQのHaskell実装
 
Whole Program Paths 等の紹介@PLDIr#3
Whole Program Paths 等の紹介@PLDIr#3Whole Program Paths 等の紹介@PLDIr#3
Whole Program Paths 等の紹介@PLDIr#3
 
Run-time Code Generation and Modal-ML の紹介@PLDIr#2
Run-time Code Generation and Modal-ML の紹介@PLDIr#2Run-time Code Generation and Modal-ML の紹介@PLDIr#2
Run-time Code Generation and Modal-ML の紹介@PLDIr#2
 
Introduction to Categorical Programming (Revised)
Introduction to Categorical Programming (Revised)Introduction to Categorical Programming (Revised)
Introduction to Categorical Programming (Revised)
 
Introduction to Categorical Programming
Introduction to Categorical ProgrammingIntroduction to Categorical Programming
Introduction to Categorical Programming
 
融合変換による最適化の理論的基盤と正当性 (2006-06-27)
融合変換による最適化の理論的基盤と正当性 (2006-06-27)融合変換による最適化の理論的基盤と正当性 (2006-06-27)
融合変換による最適化の理論的基盤と正当性 (2006-06-27)
 
融合変換による最適化の理論的基盤と正当性 (2006-06-20)
融合変換による最適化の理論的基盤と正当性 (2006-06-20)融合変換による最適化の理論的基盤と正当性 (2006-06-20)
融合変換による最適化の理論的基盤と正当性 (2006-06-20)
 
Ruby-GNOME2におけるGC問題
Ruby-GNOME2におけるGC問題Ruby-GNOME2におけるGC問題
Ruby-GNOME2におけるGC問題
 

Recently uploaded

My Inspire High Award 2024    「孤独は敵なのか?」
My Inspire High Award 2024    「孤独は敵なのか?」My Inspire High Award 2024    「孤独は敵なのか?」
My Inspire High Award 2024    「孤独は敵なのか?」inspirehighstaff03
 
My Inspire High Award 2024 「AIと仲良くなるには?」
My Inspire High Award 2024 「AIと仲良くなるには?」My Inspire High Award 2024 「AIと仲良くなるには?」
My Inspire High Award 2024 「AIと仲良くなるには?」inspirehighstaff03
 
My Inspire High Award 2024「なぜ、好きなことにいつかは飽きるの」
My Inspire High Award 2024「なぜ、好きなことにいつかは飽きるの」My Inspire High Award 2024「なぜ、好きなことにいつかは飽きるの」
My Inspire High Award 2024「なぜ、好きなことにいつかは飽きるの」inspirehighstaff03
 
My Inspire High Award 2024「なぜ議会への関心が低いのか?」
My Inspire High Award 2024「なぜ議会への関心が低いのか?」My Inspire High Award 2024「なぜ議会への関心が低いのか?」
My Inspire High Award 2024「なぜ議会への関心が低いのか?」inspirehighstaff03
 
リアル戦国探究in米沢 事前講座2スライド(スタッフ共有用)『両雄の強さの秘密』についてのスライド
リアル戦国探究in米沢 事前講座2スライド(スタッフ共有用)『両雄の強さの秘密』についてのスライドリアル戦国探究in米沢 事前講座2スライド(スタッフ共有用)『両雄の強さの秘密』についてのスライド
リアル戦国探究in米沢 事前講座2スライド(スタッフ共有用)『両雄の強さの秘密』についてのスライドKen Fukui
 
My Inspire High Award 2024「他者と自分、対立を防ぐには?」
My Inspire High Award 2024「他者と自分、対立を防ぐには?」My Inspire High Award 2024「他者と自分、対立を防ぐには?」
My Inspire High Award 2024「他者と自分、対立を防ぐには?」inspirehighstaff03
 
My Inspire High Award 2024「Yakushima Islandってなんか変じゃない?」.pdf
My Inspire High Award 2024「Yakushima Islandってなんか変じゃない?」.pdfMy Inspire High Award 2024「Yakushima Islandってなんか変じゃない?」.pdf
My Inspire High Award 2024「Yakushima Islandってなんか変じゃない?」.pdfinspirehighstaff03
 
My Inspire High Award 2024「なぜ人は他人と違うところがあってもそれをなかなか誇れないのか?」
My Inspire High Award 2024「なぜ人は他人と違うところがあってもそれをなかなか誇れないのか?」My Inspire High Award 2024「なぜ人は他人と違うところがあってもそれをなかなか誇れないのか?」
My Inspire High Award 2024「なぜ人は他人と違うところがあってもそれをなかなか誇れないのか?」inspirehighstaff03
 
My Inspire High Award 2024「スーパーマーケットで回収されたキャベツ外葉は廃棄されているの?」
My Inspire High Award 2024「スーパーマーケットで回収されたキャベツ外葉は廃棄されているの?」My Inspire High Award 2024「スーパーマーケットで回収されたキャベツ外葉は廃棄されているの?」
My Inspire High Award 2024「スーパーマーケットで回収されたキャベツ外葉は廃棄されているの?」inspirehighstaff03
 
TEAMIN Service overview for customer_20240422.pdf
TEAMIN Service overview for customer_20240422.pdfTEAMIN Service overview for customer_20240422.pdf
TEAMIN Service overview for customer_20240422.pdfyukisuga3
 
リアル戦国探究in米沢 当日講座1(スタッフ共有用)『兵は詐をもって立つ』についてのスライド
リアル戦国探究in米沢 当日講座1(スタッフ共有用)『兵は詐をもって立つ』についてのスライドリアル戦国探究in米沢 当日講座1(スタッフ共有用)『兵は詐をもって立つ』についてのスライド
リアル戦国探究in米沢 当日講座1(スタッフ共有用)『兵は詐をもって立つ』についてのスライドKen Fukui
 
リアル戦国探究in米沢 事前講座1スライド(スタッフ共有用)『川中島の謎』についてのスライド
リアル戦国探究in米沢 事前講座1スライド(スタッフ共有用)『川中島の謎』についてのスライドリアル戦国探究in米沢 事前講座1スライド(スタッフ共有用)『川中島の謎』についてのスライド
リアル戦国探究in米沢 事前講座1スライド(スタッフ共有用)『川中島の謎』についてのスライドKen Fukui
 
My Inspire High Award 2024  「正義って存在するの?」
My Inspire High Award 2024  「正義って存在するの?」My Inspire High Award 2024  「正義って存在するの?」
My Inspire High Award 2024  「正義って存在するの?」inspirehighstaff03
 
My Inspire High Award 2024「老いることは不幸なこと?」
My Inspire High Award 2024「老いることは不幸なこと?」My Inspire High Award 2024「老いることは不幸なこと?」
My Inspire High Award 2024「老いることは不幸なこと?」inspirehighstaff03
 
My Inspire High Award 2024 「本当の『悪者』って何?」
My Inspire High Award 2024 「本当の『悪者』って何?」My Inspire High Award 2024 「本当の『悪者』って何?」
My Inspire High Award 2024 「本当の『悪者』って何?」inspirehighstaff03
 
【ゲーム理論入門】ChatGPTが作成した ゲーム理論の問題を解く #3 Slide
【ゲーム理論入門】ChatGPTが作成した ゲーム理論の問題を解く #3 Slide【ゲーム理論入門】ChatGPTが作成した ゲーム理論の問題を解く #3 Slide
【ゲーム理論入門】ChatGPTが作成した ゲーム理論の問題を解く #3 Slidessusere0a682
 
リアル戦国探究in米沢 当日講座2スライド(スタッフ共有用)『人を致すも人に致されず』についてのスライド
リアル戦国探究in米沢 当日講座2スライド(スタッフ共有用)『人を致すも人に致されず』についてのスライドリアル戦国探究in米沢 当日講座2スライド(スタッフ共有用)『人を致すも人に致されず』についてのスライド
リアル戦国探究in米沢 当日講座2スライド(スタッフ共有用)『人を致すも人に致されず』についてのスライドKen Fukui
 
My Inspire High Award 2024「世の中の流行はどのようにして生まれるのか」
My Inspire High Award 2024「世の中の流行はどのようにして生まれるのか」My Inspire High Award 2024「世の中の流行はどのようにして生まれるのか」
My Inspire High Award 2024「世の中の流行はどのようにして生まれるのか」inspirehighstaff03
 
My Inspire High Award2024「外国人が日本のテーブルマナーに驚く理由は?」
My Inspire High Award2024「外国人が日本のテーブルマナーに驚く理由は?」My Inspire High Award2024「外国人が日本のテーブルマナーに驚く理由は?」
My Inspire High Award2024「外国人が日本のテーブルマナーに驚く理由は?」inspirehighstaff03
 
My Inspire High Award 2024      「家族とは何か」
My Inspire High Award 2024      「家族とは何か」My Inspire High Award 2024      「家族とは何か」
My Inspire High Award 2024      「家族とは何か」inspirehighstaff03
 

Recently uploaded (20)

My Inspire High Award 2024    「孤独は敵なのか?」
My Inspire High Award 2024    「孤独は敵なのか?」My Inspire High Award 2024    「孤独は敵なのか?」
My Inspire High Award 2024    「孤独は敵なのか?」
 
My Inspire High Award 2024 「AIと仲良くなるには?」
My Inspire High Award 2024 「AIと仲良くなるには?」My Inspire High Award 2024 「AIと仲良くなるには?」
My Inspire High Award 2024 「AIと仲良くなるには?」
 
My Inspire High Award 2024「なぜ、好きなことにいつかは飽きるの」
My Inspire High Award 2024「なぜ、好きなことにいつかは飽きるの」My Inspire High Award 2024「なぜ、好きなことにいつかは飽きるの」
My Inspire High Award 2024「なぜ、好きなことにいつかは飽きるの」
 
My Inspire High Award 2024「なぜ議会への関心が低いのか?」
My Inspire High Award 2024「なぜ議会への関心が低いのか?」My Inspire High Award 2024「なぜ議会への関心が低いのか?」
My Inspire High Award 2024「なぜ議会への関心が低いのか?」
 
リアル戦国探究in米沢 事前講座2スライド(スタッフ共有用)『両雄の強さの秘密』についてのスライド
リアル戦国探究in米沢 事前講座2スライド(スタッフ共有用)『両雄の強さの秘密』についてのスライドリアル戦国探究in米沢 事前講座2スライド(スタッフ共有用)『両雄の強さの秘密』についてのスライド
リアル戦国探究in米沢 事前講座2スライド(スタッフ共有用)『両雄の強さの秘密』についてのスライド
 
My Inspire High Award 2024「他者と自分、対立を防ぐには?」
My Inspire High Award 2024「他者と自分、対立を防ぐには?」My Inspire High Award 2024「他者と自分、対立を防ぐには?」
My Inspire High Award 2024「他者と自分、対立を防ぐには?」
 
My Inspire High Award 2024「Yakushima Islandってなんか変じゃない?」.pdf
My Inspire High Award 2024「Yakushima Islandってなんか変じゃない?」.pdfMy Inspire High Award 2024「Yakushima Islandってなんか変じゃない?」.pdf
My Inspire High Award 2024「Yakushima Islandってなんか変じゃない?」.pdf
 
My Inspire High Award 2024「なぜ人は他人と違うところがあってもそれをなかなか誇れないのか?」
My Inspire High Award 2024「なぜ人は他人と違うところがあってもそれをなかなか誇れないのか?」My Inspire High Award 2024「なぜ人は他人と違うところがあってもそれをなかなか誇れないのか?」
My Inspire High Award 2024「なぜ人は他人と違うところがあってもそれをなかなか誇れないのか?」
 
My Inspire High Award 2024「スーパーマーケットで回収されたキャベツ外葉は廃棄されているの?」
My Inspire High Award 2024「スーパーマーケットで回収されたキャベツ外葉は廃棄されているの?」My Inspire High Award 2024「スーパーマーケットで回収されたキャベツ外葉は廃棄されているの?」
My Inspire High Award 2024「スーパーマーケットで回収されたキャベツ外葉は廃棄されているの?」
 
TEAMIN Service overview for customer_20240422.pdf
TEAMIN Service overview for customer_20240422.pdfTEAMIN Service overview for customer_20240422.pdf
TEAMIN Service overview for customer_20240422.pdf
 
リアル戦国探究in米沢 当日講座1(スタッフ共有用)『兵は詐をもって立つ』についてのスライド
リアル戦国探究in米沢 当日講座1(スタッフ共有用)『兵は詐をもって立つ』についてのスライドリアル戦国探究in米沢 当日講座1(スタッフ共有用)『兵は詐をもって立つ』についてのスライド
リアル戦国探究in米沢 当日講座1(スタッフ共有用)『兵は詐をもって立つ』についてのスライド
 
リアル戦国探究in米沢 事前講座1スライド(スタッフ共有用)『川中島の謎』についてのスライド
リアル戦国探究in米沢 事前講座1スライド(スタッフ共有用)『川中島の謎』についてのスライドリアル戦国探究in米沢 事前講座1スライド(スタッフ共有用)『川中島の謎』についてのスライド
リアル戦国探究in米沢 事前講座1スライド(スタッフ共有用)『川中島の謎』についてのスライド
 
My Inspire High Award 2024  「正義って存在するの?」
My Inspire High Award 2024  「正義って存在するの?」My Inspire High Award 2024  「正義って存在するの?」
My Inspire High Award 2024  「正義って存在するの?」
 
My Inspire High Award 2024「老いることは不幸なこと?」
My Inspire High Award 2024「老いることは不幸なこと?」My Inspire High Award 2024「老いることは不幸なこと?」
My Inspire High Award 2024「老いることは不幸なこと?」
 
My Inspire High Award 2024 「本当の『悪者』って何?」
My Inspire High Award 2024 「本当の『悪者』って何?」My Inspire High Award 2024 「本当の『悪者』って何?」
My Inspire High Award 2024 「本当の『悪者』って何?」
 
【ゲーム理論入門】ChatGPTが作成した ゲーム理論の問題を解く #3 Slide
【ゲーム理論入門】ChatGPTが作成した ゲーム理論の問題を解く #3 Slide【ゲーム理論入門】ChatGPTが作成した ゲーム理論の問題を解く #3 Slide
【ゲーム理論入門】ChatGPTが作成した ゲーム理論の問題を解く #3 Slide
 
リアル戦国探究in米沢 当日講座2スライド(スタッフ共有用)『人を致すも人に致されず』についてのスライド
リアル戦国探究in米沢 当日講座2スライド(スタッフ共有用)『人を致すも人に致されず』についてのスライドリアル戦国探究in米沢 当日講座2スライド(スタッフ共有用)『人を致すも人に致されず』についてのスライド
リアル戦国探究in米沢 当日講座2スライド(スタッフ共有用)『人を致すも人に致されず』についてのスライド
 
My Inspire High Award 2024「世の中の流行はどのようにして生まれるのか」
My Inspire High Award 2024「世の中の流行はどのようにして生まれるのか」My Inspire High Award 2024「世の中の流行はどのようにして生まれるのか」
My Inspire High Award 2024「世の中の流行はどのようにして生まれるのか」
 
My Inspire High Award2024「外国人が日本のテーブルマナーに驚く理由は?」
My Inspire High Award2024「外国人が日本のテーブルマナーに驚く理由は?」My Inspire High Award2024「外国人が日本のテーブルマナーに驚く理由は?」
My Inspire High Award2024「外国人が日本のテーブルマナーに驚く理由は?」
 
My Inspire High Award 2024      「家族とは何か」
My Inspire High Award 2024      「家族とは何か」My Inspire High Award 2024      「家族とは何か」
My Inspire High Award 2024      「家族とは何か」
 

Omega test and beyond

  • 1. Omega test and beyond 酒井 政裕 Proof Summit 2012 12年9月2日日曜日
  • 2. 目次 • 自己紹介とか • 算術とは • Omegaの中身 • まとめ 12年9月2日日曜日
  • 3. 自己紹介 酒井 政裕 • Blog: ヒビルテ • Twitter: @masahiro_sakai • Haskeller • Agda: Agda1のころ遊んでた。Agda2は少しだけ。 • Coq: 初心者 (多分、Coq力 0.3 くらいの雑魚) • 昨年、Alloy本の翻訳を出版 (共訳) • Proofsummi2011 では自動定理証明の簡単な紹介 12年9月2日日曜日
  • 4. 宣伝: Alloy本 & TAPL • 抽象によるソフトウェア設計(Daniel Jackson 著) • 中島震監訳 今井健男・酒井政裕・遠藤侑介・片岡欣夫共訳 オーム社 Types and Programming Language (TAPL) Benjamin C. Pierce 著 現在翻訳中 12年9月2日日曜日
  • 5. 最近の興味: 色々な決定手続きのオモチャ実装 • Presburger Arithmetics • Gomory’s Cut • Omega Test • Conti-Traverso • Cooper’s Algorithm • SAT / MaxSAT / Pseudo Boolean (DPLL, CDCL) • Real Arithmetics • Uninterpreted function • Fourier-Motzkin variable (Congruence Closure) elimination • 実装したいと思ってるもの • Simplex method • Gröbner basis (Buchberger) • CAD (Cylindrical Algebraic Decomposition) • (Mixed) Integer Programming • cut-sat (Cutting to the • Branch-and-bound Chase) github.com/msakai/toysolver 12年9月2日日曜日
  • 6. 最近の興味: 色々な決定手続きのオモチャ実装 • Presburger Arithmetics • Gomory’s Cut • Omega Test • Conti-Traverso • Cooper’s Algorithm • SAT / MaxSAT / Pseudo 本当は実数には限らないけれど。 Boolean (DPLL, CDCL) • Real Arithmetics あと、きっと@erutuf13さんが、 • Uninterpreted function • Fourier-Motzkin variable (Congruence Closure) 熱く語ってくれるはず elimination • 実装したいと思ってるもの • Simplex method • Gröbner basis (Buchberger) • CAD (Cylindrical Algebraic Decomposition) • (Mixed) Integer Programming • cut-sat (Cutting to the • Branch-and-bound Chase) github.com/msakai/toysolver 12年9月2日日曜日
  • 7. 今日の話: Omega • そのなかの Omega Test ≒ Coq の omega タクティック • 自然数や整数に関する自動証明 12年9月2日日曜日
  • 8. 今日の話: Omega • そのなかの Omega Test ≒ Coq の omega タクティック • 自然数や整数に関する自動証明 Q. omegaを使ったことある人? 12年9月2日日曜日
  • 9. Omega使用例 Require Import Omega. Open Scope Z_scope. Goal forall m n, 1 + 2 * m <> 2 * n. intros. omega. Qed. 12年9月2日日曜日
  • 10. 目次 • 自己紹介とか • 算術とは • Omegaの中身 • まとめ 12年9月2日日曜日
  • 11. 算術 • 算術 = 自然数に関する理論 • 自然数ではなく整数を対象にすることもあるが、本質的には 変わらない • 様々な算術の体系 • ペアノ算術 PA (1889) • ゲーデルが決定不能性を証明 (1930) • ロビンソン算術 Q (1950) ≒ PA − 帰納法 • PAより相当弱いが決定不能 • Presburger 算術 (1929) ≒ PA − 掛け算 • 決定可能! 12年9月2日日曜日
  • 12. 算術の体系と問題クラス(?) 真の算術 多分、色々 間違ってるけど Peano Arithmetics Presburger Arithmetics (掛け算なし = 線形) QF_LIA ディオファントス 方程式 Robinson’s Q 整数線形計画 (帰納法無し) ∀無し (Σ1?) 12年9月2日日曜日
  • 13. Presburger 算術 • 公理 • ¬(0 = x + 1) • x+1=y+1→x=y • x+0=x • (x + y) + 1 = x + (y + 1) • (P(0) "∀x(P(x) → P(x + 1))) → ∀y P(y). • 注: 定数との掛け算は、足し算の繰り返しで書けるので、 表現可能 (e.g. 3×a = a+a+a) 。線形多項式は扱える。 12年9月2日日曜日
  • 14. 目次 • 自己紹介とか • 算術とは • Omegaの中身 • まとめ 12年9月2日日曜日
  • 15. Omegaの中身 • Presburger 算術は決定可能 ⇒ 自動証明可能 • CoqのomegaタクティックはPresburger算術 の自動証明をする • 本体はCoqのプラグイン (omega.ml) • Coqの証明項(Gallina)を生成 • 生成された証明項で使う補題等 (OmegaLemmas.v) 12年9月2日日曜日
  • 16. Omegaの中身 • Presburger 算術は決定可能 ⇒ 自動証明可能 • CoqのomegaタクティックはPresburger算術 の自動証明をする • 本体はCoqのプラグイン (omega.ml) • Coqの証明項(Gallina)を生成 • 生成された証明項で使う補題等 (OmegaLemmas.v) Q. omegaの中身を知っている人いる? 12年9月2日日曜日
  • 17. Omegaの元ネタ • "The omega test: a fast and practical integer programming algorithm for dependence analysis," by W. Pugh • in Proceedings of the 1991 ACM/IEEE conference on Supercomputing, ser. Supercomputing '91. • http://www.cs.umd.edu/~pugh/papers/omega.pdf • 並列化のため、ループの依存性を、添字に関 するPresburger算術の論理式の真偽で判定 12年9月2日日曜日
  • 18. Omega Test の仕組み • 実数の場合の量化子除去手法 Fourier-Motzkin variable elimination を応用して実現 • 量化子除去 (Quantifier elimination; QE) • 量化子を含む論理式と同値で量化子を含まない論理式を 求める。 • 例: ∀x : R. 2 < x % x ≦ 3 ⇔ ¬∃x : R. 2 ≧ x " x > 3 ⇔ ¬(2 > 3) • 量化子を含まない論理式は真偽が自明 12年9月2日日曜日
  • 19. Fourier-Motzkin variable elimination: 射影 ∃x. ∃y. ∃z. P(x,y,z) ⇔ ∃x. ∃y. Q(x,y) P(x,y,z) が真になる領域 影 = ∃z. P(x,y,z) が真になる領域 = Q(x,y) が真になる領域 The Omega Test: a fast and practical integer programming algorithm for dependence analysis 射影を繰り返していくと、変数が消えていく 12年9月2日日曜日
  • 20. Fourier-Motzkin variable elimination の基本 1. P = ∃x. Q1(x)"…"Qn(x) で Qi(x) が x を含む不等式とする • ただし不等号は≦,≧に限る • 例: ∃x. x ≧ 1 " 3x ≧ 4 " 2x - 3 ≦ 0 " x ≦ 4 2. 各 Qi(x) を x について解いて ∃x. (L1 ≦ x " … " Lp ≦ x) " (x ≦ U1 " … " x ≦ Uq) • 例: ∃x. 1 ≦ x " 4/3 ≦ x " x ≦ 3/2 " x ≦ 4 3. max { Li }i ≦ x ≦ min { Uj }j の範囲のxが条件を満たすが、 この範囲が空でないのは "i "j Li ≦ Uj と同値 1 4/3 3/2 4 • 例: 1≦3/2 " 1≦4 " 4/3 ≦ 3/2 " 4/3≦4 { 12年9月2日日曜日
  • 21. Fourier-Motzkin variable elimination: 一般の場合(1) • 厳密不等号 (<, >)を扱うには、 下界 Li ◁ x と上界 x ◁’ Uj を組み合わせるとき • ◁ = < もしくは ◁’ = < ならば Li < Uj にする。 • 例: (∃x. 2 < x " x ≦ 3) ⇔ 2<3 • ◁ = ◁’ = ≦ ならば、これまで通り Li ≦ Uj にする。 • 本体 Qi にxが現れない場合: くくりだして帰着 • ∃x. Q(x) " Qi ⇔ (∃x. P(x)) " Qi 12年9月2日日曜日
  • 22. Fourier-Motzkin variable elimination: 一般の場合(2) • 本体がDNFの場合: ∃x. (Q1,1 " … ) % … % (Qn,1 " … ) ⇔ (∃x. Q1,1 " … ) % … % (∃x. Qn,1 " … ) なので、量化子を分配すれば帰着できる • DNF = Disjunctive Normal Form (選言標準形) 原子論理式の連言(and)の選言(or) 12年9月2日日曜日
  • 23. Fourier-Motzkin variable elimination: 一般の場合(3) • toDNF : Formula → DNF toDNF = … • elim : Var × DNF → DNF elim(x, P) = (∃x. P)を量化子除去した結果 • FMVE : Formula → DNF FMVE(P) = toDNF(P) if P が量化子を含まない FMVE(C[∃x. P]) = FMVE(C[ elim(x, FMVE(P)) ]) FMVE(C[∀x. P]) = FMVE(C[¬∃x. ¬P]) 12年9月2日日曜日
  • 24. Fourier-Motzkin variable elimination: Coq • Coq にも fourierタクティックがあるよ。 • omegaほどには知られてないけど • 使用例: Require Import Fourier. Goal forall x y : R, x-y>1 -> x-2*y<0 -> x>1. intros. fourier. Qed. 12年9月2日日曜日
  • 25. Omega Test: 概要 • Fourier-Motzkin variable elimination で射影 • ただし、 射影結果に格子点が含まれても、 射影元に格子点が含まれるとは限らない P(x,y,z) が真になる領域 FMVEで射影した影 (real shadow) The Omega Test: a fast and practical integer programming algorithm for dependence analysis 12年9月2日日曜日
  • 26. Omega Test: 工夫 • Omega Test の工夫 • 射影元が充分厚い部分なら、影の格子点の上には、必ず格子点がある (影の黒い部分 dark shadow) • 定理1: (a − 1)(b − 1) ≤ ad − bc ⇒ (∃x : Z. c ≤ a*x " b*x ≤ d) dark shadow を表す式 射影元の領域 The Omega Test: a fast and practical integer programming algorithm for dependence analysis 12年9月2日日曜日
  • 27. Omega Test: 流れ ∃x : Z. P(x) の真偽を判定したい 1. P の real shadow と dark shadow を計算 2. real shadow に格子点が含まれない ⇒ 偽 3. real shadow = dark shadow ⇒ FMVEと同じ 4. dark shadow に格子点が含まれる ⇒ 真 5. それ以外 (Omega Test Nightmare) ⇒ real shadow の格子点の上の格子点を網羅チェック 12年9月2日日曜日
  • 28. Omega Test: その他 • 網羅的チェックは説明が面倒なので略 • 量化子除去: ∃x. P(x) ⇔ (dark shadow % 網羅的な場合の式) • 様々な工夫 • 等号の方が効率的に処理可能なので、できるだけ等号を使う • GCD Test: a1x1 + … + anxn = c は c が gcd { ai } i で割り切れないなら充足不能 • ∃ x y z. P(x,y,z) なら x, y, z のうち real shadow と dark shadow が一致する変数から除去 (網羅的なチェックによる分岐を出来るだけ先送り ⇒ 組み合わせ爆発を回避) • などなど 12年9月2日日曜日
  • 29. Coqのomegaタクティック • Coq のomegaタクティック • 残念ながら Omega Test Nightmare の場合の処理は実装さ れてない。 (名前負けしてるぞ∼) • なので、完全な決定手続きではなく、解けない場合も…… Require Import Omega. Open Scope Z_scope. Goal forall x y, 27 <= 11 * x + 13 * y <= 45 -> -10 <= 7 * x - 9 * y <= 4 -> False. intros. omega. ⇒ Error: Omega can't solve this system 12年9月2日日曜日
  • 30. Coqのomegaタクティック • omegaの代替としてPsatzがあり、 そのliaタクティックなら解けるらしいが… Require Import Psatz. Require Import ZArith. Open Scope Z_scope. Goal forall x y, 27 <= 11 * x + 13 * y <= 45 -> -10 <= 7 * x - 9 * y <= 4 -> False. intros. lia. 12年9月2日日曜日
  • 31. Coqのomegaタクティック • omegaの代替としてPsatzがあり、 そのliaタクティックなら解けるらしいが… Require Import Psatz. Require Import ZArith. Open Scope Z_scope. Goal forall x y, 27 <= 11 * x + 13 * y <= 45 -> -10 <= 7 * x - 9 * y <= 4 -> False. intros. lia. ⇒ Anomaly: Uncaught exception Unix.Unix_error(1, "open", "lia.cache"). Please report. 12年9月2日日曜日
  • 32. Coqのomegaタクティック • omegaの代替としてPsatzがあり、 そのliaタクティックなら解けるらしいが… Require Import Psatz. Require Import ZArith. Open Scope Z_scope. Goal forall x y, (´・ω・`) 27 <= 11 * x + 13 * y <= 45 -> -10 <= 7 * x - 9 * y <= 4 -> False. intros. lia. ⇒ Anomaly: Uncaught exception Unix.Unix_error(1, "open", "lia.cache"). Please report. 12年9月2日日曜日
  • 33. Coqのomegaタクティック • omegaの代替としてPsatzがあり、 そのliaタクティックなら解けるらしいが… Require Import Psatz. Require Import ZArith. Open Scope Z_scope. Goal forall x y, (´・ω・`) 27 <= 11 * x + 13 * y <= 45 -> -10 <= 7 * x - 9 * y <= 4 -> False. 【追記】 CoqIDEを実行している intros. lia. カレントディレクトリが書き込み不能 という原因でした ⇒ Anomaly: Uncaught exception Unix.Unix_error(1, "open", "lia.cache"). Please report. 12年9月2日日曜日
  • 34. まとめ • 実数・整数に関する線形式の決定手続と量化子除去を紹介 • Fourier-Motzkin variable elimination • Omega Test • タクティックの意義 一般の論理 決定可能な • 決定不能な論理の表現力と 論理 • 決定手続による自動化の 表現力 高い 低い • いいとこ取り • 決定手続き自体も面白いので 決定可能 半決定可能 一緒に遊びませんか? 自動証明 (それなりに (爆発しがち) スケール) 12年9月2日日曜日
  • 35. まとめ Happy Theorem Proving 12年9月2日日曜日
  • 36. おまけ: 非線形の場合 • 実数に関する線形多項式を扱うFourier-Motzkin • 整数に関する線形多項式を扱うOmega Test • を紹介したけど、実数なら非線形でも実は解ける (実閉体) 実数 整数 Omega Test, Cooper's Fourier-Motzkin 線形 method (double-exponential) (triple-exponential) Cylindrical Algebraic 非線形 Decomposition (undecidable) (double-exponential) 12年9月2日日曜日