Theory Metamath_Interface

(* 
This file is a part of IsarMathLib - 
a library of formalized mathematics for Isabelle/Isar.

Copyright (C) 2006  Slawomir Kolodynski

This program is free software; Redistribution and use in source and binary forms, 
with or without modification, are permitted provided that the 
following conditions are met:

1. Redistributions of source code must retain the above copyright notice, 
   this list of conditions and the following disclaimer.
   2. Redistributions in binary form must reproduce the above copyright notice, 
   this list of conditions and the following disclaimer in the documentation and/or 
   other materials provided with the distribution.
   3. The name of the author may not be used to endorse or promote products 
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*)

section Metamath interface

theory Metamath_Interface imports Complex_ZF MMI_prelude

begin

textThis theory contains some lemmas that make it possible to use 
  the theorems translated from Metamath in a the complex0› 
  context.

subsectionMMisar0 and complex0 contexts.

textIn the section we show a lemma that the assumptions in 
   complex0› context imply the assumptions of the MMIsar0›
   context. The Metamath_sampler› theory provides examples 
   how this lemma can be used.

textThe next lemma states that we can use 
  the theorems proven in the MMIsar0› context in
  the complex0› context. Unfortunately we have to 
  use low level Isabelle methods "rule" and "unfold" in the proof, simp
  and blast fail on the order axioms.



lemma (in complex0) MMIsar_valid: 
  shows "MMIsar0(,,𝟭,𝟬,𝗂,CplxAdd(R,A),CplxMul(R,A,M),
  StrictVersion(CplxROrder(R,A,r)))"
proof -
  let ?real = ""
  let ?complex = ""
  let ?zero = "𝟬"
  let ?one = "𝟭"
  let ?iunit = "𝗂"
  let ?caddset = "CplxAdd(R,A)"
  let ?cmulset = "CplxMul(R,A,M)"
  let ?lessrrel = "StrictVersion(CplxROrder(R,A,r))"
  have "(a b. a  ?real  b  ?real 
    a, b  ?lessrrel  ¬ (a = b  b, a  ?lessrrel))"
  proof -
    have I:
      "a b. a    b    (a \<lsr> b  ¬(a=b  b \<lsr> a))"
      using pre_axlttri by blast
    { fix a b assume "a  ?real  b  ?real"
      with I have "(a \<lsr> b  ¬(a=b  b \<lsr> a))"
	by blast
      hence
	"a, b  ?lessrrel  ¬ (a = b  b, a  ?lessrrel)"
	by simp
    } thus "(a b. a  ?real  b  ?real 
	(a, b  ?lessrrel  ¬ (a = b  b, a  ?lessrrel)))"
      by blast
  qed
  moreover
  have "(a b c.
    a  ?real  b  ?real  c  ?real 
    a, b  ?lessrrel  b, c  ?lessrrel  a, c  ?lessrrel)"
  proof -
    have II: "a b c.  a    b    c    
      ((a \<lsr> b  b \<lsr> c)  a \<lsr> c)"
      using pre_axlttrn by blast
    { fix a b c assume "a  ?real  b  ?real  c  ?real"
      with II have "(a \<lsr> b  b \<lsr> c)  a \<lsr> c"
	by blast
      hence 	
	"a, b  ?lessrrel  b, c  ?lessrrel  a, c  ?lessrrel"
	by simp
    } thus  "(a b c.
	a  ?real  b  ?real  c  ?real 
	a, b  ?lessrrel  b, c  ?lessrrel  a, c  ?lessrrel)"
      by blast
  qed
  moreover have "(A B C.
    A  ?real  B  ?real  C  ?real 
    A, B  ?lessrrel 
    ?caddset ` C, A, ?caddset ` C, B  ?lessrrel)"
    using pre_axltadd by simp
  moreover have "(A B. A  ?real  B  ?real 
    ?zero, A  ?lessrrel  ?zero, B  ?lessrrel 
    ?zero, ?cmulset ` A, B  ?lessrrel)"
    using pre_axmulgt0 by simp
  moreover have 
    "(S. S  ?real  S  0  (x?real. yS. y, x  ?lessrrel) 
    (x?real.
    (yS. x, y  ?lessrrel) 
    (y?real. y, x  ?lessrrel  (zS. y, z  ?lessrrel))))"
    using pre_axsup by simp
  moreover have "  " using axresscn by simp
  moreover have "𝟭  𝟬" using ax1ne0 by simp
  moreover have " isASet" by simp
  moreover have " CplxAdd(R,A) :  ×   " 
    using axaddopr by simp
  moreover have "CplxMul(R,A,M) :  ×   " 
    using axmulopr by simp
  moreover have 
    "a b. a    b    a b = b  a"
    using axmulcom by simp
  hence "(a b. a    b   
          ?cmulset ` a, b = ?cmulset ` b, a
    )" by simp
  moreover have "a b. a    b    a \<ca> b  "
    using axaddcl by simp
  hence "(a b. a    b    
          ?caddset ` a, b  
      )" by simp
  moreover have "a b. a    b    a  b  "
    using axmulcl by simp
  hence "(a b. a    b    
    ?cmulset ` a, b   )" by simp
  moreover have 
    "a b C. a    b    C    
    a  (b \<ca> C) = a  b \<ca> a  C"
    using axdistr by simp
  hence "a b C.
         a    b    C   
         ?cmulset ` a, ?caddset ` b, C =
         ?caddset `
         ?cmulset ` a, b, ?cmulset ` a, C" 
    by simp
  moreover have "a b. a    b   
         a \<ca> b = b \<ca> a"
    using axaddcom by simp
  hence "a b.
          a    b   
          ?caddset ` a, b = ?caddset ` b, a" by simp
  moreover have "a b C. a    b    C   
      a \<ca> b \<ca> C = a \<ca> (b \<ca> C)"
    using axaddass by simp
  hence "a b C.
          a    b    C   
          ?caddset ` ?caddset ` a, b, C =
          ?caddset ` a, ?caddset ` b, C" by simp
  moreover have 
    "a b c. a    b    c    abc = a(bc)"
    using axmulass by simp
  hence "a b C.
          a    b    C   
          ?cmulset ` ?cmulset ` a, b, C =
          ?cmulset ` a, ?cmulset ` b, C" by simp
  moreover have "𝟭  " using ax1re by simp
  moreover have "𝗂𝗂 \<ca> 𝟭 = 𝟬"
    using axi2m1 by simp
  hence "?caddset ` ?cmulset ` 𝗂, 𝗂, 𝟭 = 𝟬" by simp
  moreover have "a. a    a \<ca> 𝟬 = a"
    using ax0id by simp
  hence "a. a    ?caddset ` a, 𝟬 = a" by simp
  moreover have "𝗂  " using axicn by simp
  moreover have "a. a    (x. a \<ca> x = 𝟬)"
    using axnegex by simp
  hence "a. a    
    (x. ?caddset ` a, x = 𝟬)" by simp
  moreover have "a. a    a  𝟬  (x. a  x = 𝟭)"
    using axrecex by simp
  hence "a. a    a  𝟬  
      ( x. ?cmulset ` a, x = 𝟭 )" by simp
  moreover have "a. a    a𝟭 = a"
    using ax1id by simp
 hence " a. a    
        ?cmulset ` a, 𝟭 = a" by simp
 moreover have "a b. a    b    a \<ca> b  "
   using axaddrcl by simp
 hence "a b. a    b    
     ?caddset ` a, b  " by simp
 moreover have "a b. a    b    a  b  "
   using axmulrcl by simp
 hence "a b. a    b    
     ?cmulset ` a, b  " by simp
 moreover have "a. a    (x. a \<ca> x = 𝟬)"
   using axrnegex by simp
 hence "a. a    
   ( x. ?caddset ` a, x = 𝟬 )" by simp
 moreover have "a. a    a𝟬  (x. a  x = 𝟭)"
   using axrrecex by simp
 hence "a. a    a  𝟬  
   ( x. ?cmulset ` a, x = 𝟭)" by simp
 
  ultimately have 
"(
   (
      (
         ( a b.
           a    b   
           a, b  ?lessrrel 
           ¬ (a = b  b, a  ?lessrrel)
         ) 
       
         ( a b C.
           a    b    C   
           a, b  ?lessrrel 
           b, C  ?lessrrel 
           a, C  ?lessrrel
         ) 
       
         (a b C.
           a    b    C   
           a, b  ?lessrrel 
           ?caddset ` C, a, ?caddset ` C, b 
           ?lessrrel
         )
      ) 
           
      (
         ( a b.
           a    b   
           𝟬, a  ?lessrrel 
           𝟬, b  ?lessrrel 
           𝟬, ?cmulset ` a, b 
           ?lessrrel
         ) 
           
         ( S. S    S  0 
             ( x. yS. y, x  ?lessrrel
             ) 
             ( x. 
                ( yS. x, y  ?lessrrel
                ) 
                ( y. y, x  ?lessrrel 
                   ( zS. y, z  ?lessrrel
                   )
                )
             )
         )
      ) 
      
          
      𝟭  𝟬
   ) 
      
   (  isASet  ?caddset   ×     
    ?cmulset   ×   
   ) 
   
   (
      (a b.
          a    b   
          ?cmulset ` a, b = ?cmulset ` b, a
      ) 
      
      (a b. a    b    
          ?caddset ` a, b  
      )
     
   ) 
     
   (a b. a    b    
      ?cmulset ` a, b  
   ) 
     
   (a b C.
         a    b    C   
         ?cmulset ` a, ?caddset ` b, C =
         ?caddset `
         ?cmulset ` a, b, ?cmulset ` a, C
   )
) 


(
   (
      (a b.
          a    b   
          ?caddset ` a, b = ?caddset ` b, a
      ) 
      
      (a b C.
          a    b    C   
          ?caddset ` ?caddset ` a, b, C =
          ?caddset ` a, ?caddset ` b, C
      ) 
      
      (a b C.
          a    b    C   
          ?cmulset ` ?cmulset ` a, b, C =
          ?cmulset ` a, ?cmulset ` b, C
      )
   ) 
   
   
   (𝟭    
    ?caddset ` ?cmulset ` 𝗂, 𝗂, 𝟭 = 𝟬
   ) 
   
   (a. a    ?caddset ` a, 𝟬 = a
   ) 
    
   𝗂  
) 
   
(
   (a. a    
      (x. ?caddset ` a, x = 𝟬
      )
   ) 
      
   ( a. a    a  𝟬  
      ( x. ?cmulset ` a, x = 𝟭
      )
   ) 
   
   ( a. a    
        ?cmulset ` a, 𝟭 = a
   )
) 
   
(
   ( a b. a    b    
     ?caddset ` a, b  
   ) 
      
   ( a b. a    b    
     ?cmulset ` a, b  
   )
) 
    
( a. a    
   ( x. ?caddset ` a, x = 𝟬
   ) 
) 
   
( a. a    a  𝟬  
   ( x. ?cmulset ` a, x = 𝟭
   )
)"
  by blast
then show "MMIsar0(,,𝟭,𝟬,𝗂,CplxAdd(R,A),CplxMul(R,A,M),
  StrictVersion(CplxROrder(R,A,r)))" unfolding MMIsar0_def by blast
qed
  

end