Theory Metamath_sampler

Up to index of Isabelle/ZF/IsarMathLib

theory Metamath_sampler
imports Metamath_interface MMI_Complex_ZF_1
begin

(* 
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.

*)

header {*\isaheader{Metamath\_sampler.thy}*}

theory Metamath_sampler imports Metamath_interface MMI_Complex_ZF_1

begin

text{*This theory file contains some examples of theorems 
 translated fro Metamath and formulated in the @{text "complex0"} context.*}

text{*Metamath uses the set of real numbers extended with $+\infty$ and $-\infty$. 
  The $+\infty$ and $-\infty$ symbols are defined quite arbitrarily as $\mathbb{C}$
  and $\mathbb{\{ C\} }$, respectively. The next lemma that corresponds to 
  Metamath's @{text "renfdisj"} states that $+\infty$ and $-\infty$ are not 
  elements of $\mathbb{R}$.*}

lemma (in complex0) renfdisj: shows "\<real> ∩ {\<cpnf>,\<cmnf>} = 0"
proof -
  let ?real = "\<real>"
  let ?complex = "\<complex>"
  let ?one = "\<one>"
  let ?zero = "\<zero>"
  let ?iunit = "\<i>"
  let ?caddset = "CplxAdd(R,A)"
  let ?cmulset= "CplxMul(R,A,M)"
  let ?lessrrel = "StrictVersion(CplxROrder(R,A,r))"
  have "MMIsar0
    (?real, ?complex, ?one, ?zero, ?iunit, ?caddset, ?cmulset, ?lessrrel)"
    using MMIsar_valid by simp;
  then have "?real ∩ {?complex, {?complex}} = 0"
    by (rule MMIsar0.MMI_renfdisj);
  thus "\<real> ∩ {\<cpnf>,\<cmnf>} = 0" by simp;
qed;
  
text{*  The order relation used most often in Metamath is defined on 
  the set of complex reals extended with   $+\infty$ and $-\infty$. 
  The next lemma
  allows to use Metamath's @{text "xrltso"} that states that the @{text "\<ls>"}
  relations is a strict linear order on the extended set.*}

lemma (in complex0) xrltso: "\<cltrrset> Orders \<real>*"
proof -
  let ?real = "\<real>"
  let ?complex = "\<complex>"
  let ?one = "\<one>"
  let ?zero = "\<zero>"
  let ?iunit = "\<i>"
  let ?caddset = "CplxAdd(R,A)"
  let ?cmulset= "CplxMul(R,A,M)"
  let ?lessrrel = "StrictVersion(CplxROrder(R,A,r))"
  have "MMIsar0
    (?real, ?complex, ?one, ?zero, ?iunit, ?caddset, ?cmulset, ?lessrrel)"
    using MMIsar_valid by simp;
  then have 
    "(?lessrrel ∩ ?real × ?real ∪ 
    {⟨{?complex}, ?complex⟩} ∪ ?real × {?complex} ∪
      {{?complex}} × ?real) Orders (?real ∪ {?complex, {?complex}})"
    by (rule MMIsar0.MMI_xrltso);
  moreover have "?lessrrel ∩ ?real × ?real = ?lessrrel"
    using cplx_strict_ord_on_cplx_reals by auto
  ultimately show "\<cltrrset> Orders \<real>*" by simp;
qed;

end

lemma renfdisj:

  complex0(R, A, M, r)
  ==> {⟨r, TheNeutralElement(R, A)⟩ . rR} ∩ {R × R, {R × R}} = 0

lemma xrltso:

  complex0(R, A, M, r)
  ==> (StrictVersion(CplxROrder(R, A, r)) ∪ {⟨{R × R}, R × R⟩} ∪
       {⟨r, TheNeutralElement(R, A)⟩ . rR} × {R × R} ∪
       {{R × R}} × {⟨r, TheNeutralElement(R, A)⟩ . rR}) Orders
      ({⟨r, TheNeutralElement(R, A)⟩ . rR} ∪ {R × R, {R × R}})