Quotient-Paper/Paper.thy
changeset 2208 b0b2198040d7
parent 2207 ea7c3f21d6df
child 2209 5952b0f28261
equal deleted inserted replaced
2207:ea7c3f21d6df 2208:b0b2198040d7
       
     1 (* How to change the notation for \<lbrakk> \<rbrakk> meta-level implications? *)
     1 
     2 
     2 (*<*)
     3 (*<*)
     3 theory Paper
     4 theory Paper
     4 imports "Quotient"
     5 imports "Quotient"
     5         "LaTeXsugar"
     6         "LaTeXsugar"
     6         "../Nominal/FSet"
     7         "../Nominal/FSet"
     7 begin
     8 begin
     8 
     9 
       
    10 print_syntax
       
    11 
     9 notation (latex output)
    12 notation (latex output)
    10   rel_conj ("_ OOO _" [53, 53] 52)
    13   rel_conj ("_ OOO _" [53, 53] 52)
    11 and
    14 and
    12   fun_map ("_ ---> _" [51, 51] 50)
    15   "op -->" (infix "\<rightarrow>" 100)
    13 and
    16 and
    14   fun_rel ("_ ===> _" [51, 51] 50)
    17   "==>" (infix "\<Rightarrow>" 100)
       
    18 and
       
    19   fun_map (infix "\<longrightarrow>" 51)
       
    20 and
       
    21   fun_rel (infix "\<Longrightarrow>" 51)
    15 and
    22 and
    16   list_eq (infix "\<approx>" 50) (* Not sure if we want this notation...? *)
    23   list_eq (infix "\<approx>" 50) (* Not sure if we want this notation...? *)
    17 
    24 
    18 ML {*
    25 ML {*
    19 fun nth_conj n (_, r) = nth (HOLogic.dest_conj r) n;
    26 fun nth_conj n (_, r) = nth (HOLogic.dest_conj r) n;
   206   \begin{itemize}
   213   \begin{itemize}
   207   \item @{text "ABS(\<alpha>\<^isub>1, \<alpha>\<^isub>2)"} = @{text "id"}
   214   \item @{text "ABS(\<alpha>\<^isub>1, \<alpha>\<^isub>2)"} = @{text "id"}
   208   \item @{text "REP(\<alpha>\<^isub>1, \<alpha>\<^isub>2)"}  =  @{text "id"}
   215   \item @{text "REP(\<alpha>\<^isub>1, \<alpha>\<^isub>2)"}  =  @{text "id"}
   209   \item @{text "ABS(\<sigma>, \<sigma>)"}  =  @{text "id"}
   216   \item @{text "ABS(\<sigma>, \<sigma>)"}  =  @{text "id"}
   210   \item @{text "REP(\<sigma>, \<sigma>)"}  =  @{text "id"}
   217   \item @{text "REP(\<sigma>, \<sigma>)"}  =  @{text "id"}
   211   \item @{text "ABS(\<sigma>\<^isub>1\<rightarrow>\<sigma>\<^isub>2,\<tau>\<^isub>1\<rightarrow>\<tau>\<^isub>2)"}  =  @{text "REP(\<sigma>\<^isub>1,\<tau>\<^isub>1) ---> ABS(\<sigma>\<^isub>2,\<tau>\<^isub>2)"}
   218   \item @{text "ABS(\<sigma>\<^isub>1\<rightarrow>\<sigma>\<^isub>2,\<tau>\<^isub>1\<rightarrow>\<tau>\<^isub>2)"}  =  @{text "REP(\<sigma>\<^isub>1,\<tau>\<^isub>1) \<longrightarrow> ABS(\<sigma>\<^isub>2,\<tau>\<^isub>2)"}
   212   \item @{text "REP(\<sigma>\<^isub>1\<rightarrow>\<sigma>\<^isub>2,\<tau>\<^isub>1\<rightarrow>\<tau>\<^isub>2)"}  =  @{text "ABS(\<sigma>\<^isub>1,\<tau>\<^isub>1) ---> REP(\<sigma>\<^isub>2,\<tau>\<^isub>2)"}
   219   \item @{text "REP(\<sigma>\<^isub>1\<rightarrow>\<sigma>\<^isub>2,\<tau>\<^isub>1\<rightarrow>\<tau>\<^isub>2)"}  =  @{text "ABS(\<sigma>\<^isub>1,\<tau>\<^isub>1) \<longrightarrow> REP(\<sigma>\<^isub>2,\<tau>\<^isub>2)"}
   213   \item @{text "ABS((\<sigma>\<^isub>1,\<dots>,\<sigma>\<^isub>n))\<kappa>, (\<tau>\<^isub>1,\<dots>,\<tau>\<^isub>n))\<kappa>)"}  =  @{text "(map \<kappa>) (ABS(\<sigma>\<^isub>1,\<tau>\<^isub>1)) \<dots> (ABS(\<sigma>\<^isub>n,\<tau>\<^isub>n))"}
   220   \item @{text "ABS((\<sigma>\<^isub>1,\<dots>,\<sigma>\<^isub>n))\<kappa>, (\<tau>\<^isub>1,\<dots>,\<tau>\<^isub>n))\<kappa>)"}  =  @{text "(map \<kappa>) (ABS(\<sigma>\<^isub>1,\<tau>\<^isub>1)) \<dots> (ABS(\<sigma>\<^isub>n,\<tau>\<^isub>n))"}
   214   \item @{text "REP((\<sigma>\<^isub>1,\<dots>,\<sigma>\<^isub>n))\<kappa>, (\<tau>\<^isub>1,\<dots>,\<tau>\<^isub>n))\<kappa>)"}  =  @{text "(map \<kappa>) (REP(\<sigma>\<^isub>1,\<tau>\<^isub>1)) \<dots> (REP(\<sigma>\<^isub>n,\<tau>\<^isub>n))"}
   221   \item @{text "REP((\<sigma>\<^isub>1,\<dots>,\<sigma>\<^isub>n))\<kappa>, (\<tau>\<^isub>1,\<dots>,\<tau>\<^isub>n))\<kappa>)"}  =  @{text "(map \<kappa>) (REP(\<sigma>\<^isub>1,\<tau>\<^isub>1)) \<dots> (REP(\<sigma>\<^isub>n,\<tau>\<^isub>n))"}
   215   \item @{text "ABS((\<sigma>\<^isub>1,\<dots>,\<sigma>\<^isub>n))\<kappa>\<^isub>1, (\<tau>\<^isub>1,\<dots>,\<tau>\<^isub>m))\<kappa>\<^isub>2)"}  =  @{text "Abs_\<kappa>\<^isub>2 \<circ> (map \<kappa>\<^isub>1) (ABS(\<rho>\<^isub>1,\<nu>\<^isub>1) \<dots> (ABS(\<rho>\<^isub>p,\<nu>\<^isub>p)"} provided @{text "\<eta> \<kappa>\<^isub>2 = (\<alpha>\<^isub>1\<dots>\<alpha>\<^isub>p)\<kappa>\<^isub>1 \<and> \<exists>s. s(\<sigma>s\<kappa>\<^isub>1)=\<rho>s\<kappa>\<^isub>1 \<and> s(\<tau>s\<kappa>\<^isub>2)=\<nu>s\<kappa>\<^isub>2"}
   222   \item @{text "ABS((\<sigma>\<^isub>1,\<dots>,\<sigma>\<^isub>n))\<kappa>\<^isub>1, (\<tau>\<^isub>1,\<dots>,\<tau>\<^isub>m))\<kappa>\<^isub>2)"}  =  @{text "Abs_\<kappa>\<^isub>2 \<circ> (map \<kappa>\<^isub>1) (ABS(\<rho>\<^isub>1,\<nu>\<^isub>1) \<dots> (ABS(\<rho>\<^isub>p,\<nu>\<^isub>p)"} provided @{text "\<eta> \<kappa>\<^isub>2 = (\<alpha>\<^isub>1\<dots>\<alpha>\<^isub>p)\<kappa>\<^isub>1 \<and> \<exists>s. s(\<sigma>s\<kappa>\<^isub>1)=\<rho>s\<kappa>\<^isub>1 \<and> s(\<tau>s\<kappa>\<^isub>2)=\<nu>s\<kappa>\<^isub>2"}
   216   \item @{text "REP((\<sigma>\<^isub>1,\<dots>,\<sigma>\<^isub>n))\<kappa>\<^isub>1, (\<tau>\<^isub>1,\<dots>,\<tau>\<^isub>m))\<kappa>\<^isub>2)"}  =  @{text "(map \<kappa>\<^isub>1) (REP(\<rho>\<^isub>1,\<nu>\<^isub>1) \<dots> (REP(\<rho>\<^isub>p,\<nu>\<^isub>p) \<circ> Rep_\<kappa>\<^isub>2"} provided @{text "\<eta> \<kappa>\<^isub>2 = (\<alpha>\<^isub>1\<dots>\<alpha>\<^isub>p)\<kappa>\<^isub>1 \<and> \<exists>s. s(\<sigma>s\<kappa>\<^isub>1)=\<rho>s\<kappa>\<^isub>1 \<and> s(\<tau>s\<kappa>\<^isub>2)=\<nu>s\<kappa>\<^isub>2"}
   223   \item @{text "REP((\<sigma>\<^isub>1,\<dots>,\<sigma>\<^isub>n))\<kappa>\<^isub>1, (\<tau>\<^isub>1,\<dots>,\<tau>\<^isub>m))\<kappa>\<^isub>2)"}  =  @{text "(map \<kappa>\<^isub>1) (REP(\<rho>\<^isub>1,\<nu>\<^isub>1) \<dots> (REP(\<rho>\<^isub>p,\<nu>\<^isub>p) \<circ> Rep_\<kappa>\<^isub>2"} provided @{text "\<eta> \<kappa>\<^isub>2 = (\<alpha>\<^isub>1\<dots>\<alpha>\<^isub>p)\<kappa>\<^isub>1 \<and> \<exists>s. s(\<sigma>s\<kappa>\<^isub>1)=\<rho>s\<kappa>\<^isub>1 \<and> s(\<tau>s\<kappa>\<^isub>2)=\<nu>s\<kappa>\<^isub>2"}
   217   \end{itemize}
   224   \end{itemize}
   218 
   225 
   219   Apart from the last 2 points the definition is same as the one implemented in
   226   Apart from the last 2 points the definition is same as the one implemented in
   220   in Homeier's HOL package, below is the definition of @{term fconcat}
   227   in Homeier's HOL package. Adding composition in last two cases is necessary
   221   that shows the last points:
   228   for compositional quotients. We ilustrate the different behaviour of the
       
   229   definition by showing the derived definition of @{term fconcat}:
   222 
   230 
   223   @{thm fconcat_def[no_vars]}
   231   @{thm fconcat_def[no_vars]}
   224 
   232 
   225   The aggregate @{term Abs} function takes a finite set of finite sets
   233   The aggregate @{term Abs} function takes a finite set of finite sets
   226   and applies @{term "map rep_fset"} composed with @{term rep_fset} to
   234   and applies @{term "map rep_fset"} composed with @{term rep_fset} to
   245   can be stated as:
   253   can be stated as:
   246 
   254 
   247   @{thm [display] append_rsp[no_vars]}
   255   @{thm [display] append_rsp[no_vars]}
   248 
   256 
   249   \noindent
   257   \noindent
   250   Which after unfolding @{term "op ===>"} is equivalent to:
   258   Which after unfolding @{term "op \<Longrightarrow>"} is equivalent to:
   251 
   259 
   252   @{thm [display] append_rsp_unfolded[no_vars]}
   260   @{thm [display] append_rsp_unfolded[no_vars]}
   253 
   261 
   254   An aggregate relation is defined in terms of relation composition,
   262   An aggregate relation is defined in terms of relation composition,
   255   so we define it first:
   263   so we define it first:
   361   implementation.
   369   implementation.
   362 
   370 
   363   We first define the statement of the regularized theorem based
   371   We first define the statement of the regularized theorem based
   364   on the original theorem and the goal theorem. Then we define
   372   on the original theorem and the goal theorem. Then we define
   365   the statement of the injected theorem, based on the regularized
   373   the statement of the injected theorem, based on the regularized
   366   theorem and the goal. We then show the 3 proofs as all three
   374   theorem and the goal. We then show the 3 proofs, as all three
   367   can be performed independently from each other.
   375   can be performed independently from each other.
   368 
   376 
   369 *}
   377 *}
   370 
   378 
   371 subsection {* Regularization and Injection statements *}
   379 subsection {* Regularization and Injection statements *}
   416   For existential quantifiers and unique existential quantifiers it is
   424   For existential quantifiers and unique existential quantifiers it is
   417   defined similarily to the universal one.
   425   defined similarily to the universal one.
   418 
   426 
   419 *}
   427 *}
   420 
   428 
   421 subsection {* Proof of Regularization *}
   429 subsection {* Proof procedure *}
   422 
   430 
   423 text {*
   431 (* In the below the type-guiding 'QuotTrue' assumption is removed; since we
   424   Example of non-regularizable theorem ($0 = 1$).
   432    present in a paper a version with typed-variables it is not necessary *)
       
   433 
       
   434 text {*
       
   435 
       
   436   With the above definitions of @{text "REG"} and @{text "INJ"} we can show
       
   437   how the proof is performed. The first step is always the application of
       
   438   of the following lemma:
       
   439 
       
   440   @{term "[|A; A --> B; B = C; C = D|] ==> D"}
       
   441 
       
   442   With @{text A} instantiated to the original raw theorem, 
       
   443        @{text B} instantiated to @{text "REG(A)"},
       
   444        @{text C} instantiated to @{text "INJ(REG(A))"},
       
   445    and @{text D} instantiated to the statement of the lifted theorem.
       
   446   The first assumption can be immediately discharged using the original
       
   447   theorem and the three left subgoals are exactly the subgoals of regularization,
       
   448   injection and cleaning. The three can be proved independently by the
       
   449   framework and in case there are non-solved subgoals they can be left
       
   450   to the user.
       
   451 
       
   452   The injection and cleaning subgoals are always solved if the appropriate
       
   453   respectfulness and preservation theorems are given. It is not the case
       
   454   with regularization; sometimes a theorem given by the user does not
       
   455   imply a regularized version and a stronger one needs to be proved. This
       
   456   is outside of the scope of the quotient package, so the user is then left
       
   457   with such obligations. As an example lets see the simplest possible
       
   458   non-liftable theorem for integers: When we want to prove @{term "0 \<noteq> 1"}
       
   459   on integers the fact that @{term "\<not> (0, 0) = (1, 0)"} is not enough. It
       
   460   only shows that particular items in the equivalence classes are not equal,
       
   461   a more general statement saying that the classes are not equal is necessary.
       
   462 *}
       
   463 
       
   464 subsection {* Proving Regularization *}
       
   465 
       
   466 text {*
       
   467   Isabelle provides 
       
   468 
   425 
   469 
   426 
   470 
   427   Separtion of regularization from injection thanks to the following 2 lemmas:
   471   Separtion of regularization from injection thanks to the following 2 lemmas:
   428   \begin{lemma}
   472   \begin{lemma}
   429   If @{term R2} is an equivalence relation, then:
   473   If @{term R2} is an equivalence relation, then: