src/HOL/Matrix/cplex/Cplex.thy
author hoelzl
Thu, 05 Feb 2009 11:45:15 +0100
changeset 29804 e15b74577368
parent 29667 53103fc8ffa3
child 31816 ffaf6dd53045
permissions -rw-r--r--
Added new Float theory and moved old Library/Float.thy to ComputeFloat
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16784
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
     1
(*  Title:      HOL/Matrix/cplex/Cplex.thy
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
     2
    ID:         $Id$
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
     3
    Author:     Steven Obua
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
     4
*)
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
     5
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
     6
theory Cplex 
29804
e15b74577368 Added new Float theory and moved old Library/Float.thy to ComputeFloat
hoelzl
parents: 29667
diff changeset
     7
imports SparseMatrix LP "~~/src/HOL/Tools/ComputeFloat" "~~/src/HOL/Tools/ComputeNumeral"
28637
7aabaf1ba263 reactivated HOL-Matrix;
wenzelm
parents: 27484
diff changeset
     8
uses "Cplex_tools.ML" "CplexMatrixConverter.ML" "FloatSparseMatrixBuilder.ML"
7aabaf1ba263 reactivated HOL-Matrix;
wenzelm
parents: 27484
diff changeset
     9
  "fspmlp.ML" ("matrixlp.ML")
16784
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
    10
begin
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
    11
27484
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    12
lemma spm_mult_le_dual_prts: 
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    13
  assumes
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    14
  "sorted_sparse_matrix A1"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    15
  "sorted_sparse_matrix A2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    16
  "sorted_sparse_matrix c1"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    17
  "sorted_sparse_matrix c2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    18
  "sorted_sparse_matrix y"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    19
  "sorted_sparse_matrix r1"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    20
  "sorted_sparse_matrix r2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    21
  "sorted_spvec b"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    22
  "le_spmat ([], y)"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    23
  "sparse_row_matrix A1 \<le> A"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    24
  "A \<le> sparse_row_matrix A2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    25
  "sparse_row_matrix c1 \<le> c"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    26
  "c \<le> sparse_row_matrix c2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    27
  "sparse_row_matrix r1 \<le> x"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    28
  "x \<le> sparse_row_matrix r2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    29
  "A * x \<le> sparse_row_matrix (b::('a::lordered_ring) spmat)"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    30
  shows
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    31
  "c * x \<le> sparse_row_matrix (add_spmat (mult_spmat y b,
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    32
  (let s1 = diff_spmat c1 (mult_spmat y A2); s2 = diff_spmat c2 (mult_spmat y A1) in 
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    33
  add_spmat (mult_spmat (pprt_spmat s2) (pprt_spmat r2), add_spmat (mult_spmat (pprt_spmat s1) (nprt_spmat r2), 
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    34
  add_spmat (mult_spmat (nprt_spmat s2) (pprt_spmat r1), mult_spmat (nprt_spmat s1) (nprt_spmat r1)))))))"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    35
  apply (simp add: Let_def)
28637
7aabaf1ba263 reactivated HOL-Matrix;
wenzelm
parents: 27484
diff changeset
    36
  apply (insert assms)
29667
53103fc8ffa3 Replaced group_ and ring_simps by algebra_simps;
nipkow
parents: 28637
diff changeset
    37
  apply (simp add: sparse_row_matrix_op_simps algebra_simps)  
53103fc8ffa3 Replaced group_ and ring_simps by algebra_simps;
nipkow
parents: 28637
diff changeset
    38
  apply (rule mult_le_dual_prts[where A=A, simplified Let_def algebra_simps])
27484
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    39
  apply (auto)
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    40
  done
16784
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
    41
27484
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    42
lemma spm_mult_le_dual_prts_no_let: 
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    43
  assumes
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    44
  "sorted_sparse_matrix A1"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    45
  "sorted_sparse_matrix A2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    46
  "sorted_sparse_matrix c1"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    47
  "sorted_sparse_matrix c2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    48
  "sorted_sparse_matrix y"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    49
  "sorted_sparse_matrix r1"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    50
  "sorted_sparse_matrix r2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    51
  "sorted_spvec b"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    52
  "le_spmat ([], y)"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    53
  "sparse_row_matrix A1 \<le> A"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    54
  "A \<le> sparse_row_matrix A2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    55
  "sparse_row_matrix c1 \<le> c"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    56
  "c \<le> sparse_row_matrix c2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    57
  "sparse_row_matrix r1 \<le> x"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    58
  "x \<le> sparse_row_matrix r2"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    59
  "A * x \<le> sparse_row_matrix (b::('a::lordered_ring) spmat)"
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    60
  shows
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    61
  "c * x \<le> sparse_row_matrix (add_spmat (mult_spmat y b,
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    62
  mult_est_spmat r1 r2 (diff_spmat c1 (mult_spmat y A2)) (diff_spmat c2 (mult_spmat y A1))))"
28637
7aabaf1ba263 reactivated HOL-Matrix;
wenzelm
parents: 27484
diff changeset
    63
  by (simp add: assms mult_est_spmat_def spm_mult_le_dual_prts[where A=A, simplified Let_def])
16784
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
    64
27484
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    65
use "matrixlp.ML"
16784
92ff7c903585 - added cplex package to HOL/Matrix
obua
parents:
diff changeset
    66
27484
dbb9981c3d18 added marginal setup for code generation
haftmann
parents: 23665
diff changeset
    67
end