fact
stringlengths
5
7.52k
type
stringclasses
9 values
library
stringclasses
2 values
imports
listlengths
0
15
filename
stringclasses
121 values
symbolic_name
stringlengths
1
53
docstring
stringlengths
6
446
linear2 := optimization (x y : ℝ) minimize 40 * x + 30 * y subject to c₁ : 12 ≤ x + y c₂ : 16 ≤ 2 * x + y
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/Linear.lean
linear2
null
linear2Solution : Solution linear2 := { point := ⟨4, 8⟩, isOptimal := by split_ands <;> try norm_num intros x' y' h_feas simp [feasible, linear2] at h_feas ⊢ linarith } solve linear2 #print linear2.conicForm #eval linear2.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval linear2.value -- 400.000000 #eval linear2.solution -- (4.000000, 8.000000)
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/Linear.lean
linear2Solution
null
linear3 := optimization (x : Fin 2 → ℝ) minimize (5 * (x 0) - 4 * (x 1)) subject to h₁ : 3 ≤ (x 0) + (x 1) h₂ : (x 1) ≤ 7 + (x 0) solve linear3 #print linear3.conicForm #eval linear3.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval linear3.value -- -30.000000 #eval linear3.solution 0 -- -2.000000 #eval linear3.solution 1 -- 5.000000
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/Linear.lean
linear3
null
linear4 := optimization (x : Fin 5 → ℝ) (y z : ℝ) minimize (Vec.sum x + 10 * (y + z)) subject to h₁ : 4.0 ≤ y h₂ : 2.5 ≤ z h₃ : y + z ≤ Vec.sum x solve linear4 #print linear4.conicForm #eval linear4.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval linear4.value -- 71.500000 #eval linear4.solution.1 0 -- 6.500000 #eval linear4.solution.1 1 -- 0.000000 #eval linear4.solution.1 2 -- 0.000000 #eval linear4.solution.1 3 -- 0.000000 #eval linear4.solution.1 4 -- 0.000000 #eval linear4.solution.2.1 -- 4.000000 #eval linear4.solution.2.2 -- 2.500000 @[optimization_param]
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/Linear.lean
linear4
null
A5 : Matrix (Fin 4) (Fin 4) ℝ := fun i j => (#[#[ 0.51417013, -1.40067196, 0.71943208, 0.58510080] , #[-0.53401066, 1.65680551, 0.13519183, 0.29269704] , #[ 0.39224659, -0.61942485, 1.73666095, 2.46240110] , #[ 1.76713469, 0.61389781, 0.80559111, -0.12640489]][i.val]!)[j.val]! @[optimization_param]
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/Linear.lean
A5
null
b5 : Fin 4 → ℝ := fun i => #[ 10.56567387, 21.07609985, 23.43361457, 15.14706378][i.val]! @[optimization_param]
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/Linear.lean
b5
null
c5 : Fin 4 → ℝ := fun i => #[ 0.14794342, -0.19493149, 0.31361829, 1.13959857][i.val]! open Matrix
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/Linear.lean
c5
null
linear5 := optimization (x : Fin 4 → ℝ) maximize (c5 ⬝ᵥ x) subject to h₁ : A5.mulVec x ≤ b5 h₂ : 0 ≤ x solve linear5 #print linear5.conicForm #eval linear5.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval linear5.value -- 11.814741 #eval linear5.solution 0 -- 0.000005 #eval linear5.solution 1 -- 10.569962 #eval linear5.solution 2 -- 0.000000 #eval linear5.solution 3 -- 12.175479
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/Linear.lean
linear5
null
log1 := optimization (x : ℝ) minimize (x) subject to h₁ : 10 ≤ log x h₂ : 0 < x solve log1 #print log1.conicForm #eval log1.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval log1.value -- 22026.464907 #eval log1.solution -- 22026.464907
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/Log.lean
log1
null
log2 := optimization (x : ℝ) maximize (log x) subject to h₁ : x ≤ 10 h₂ : 0 < x solve log2 #print log2.conicForm #eval log2.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval log2.value -- 2.302585 #eval log2.solution -- 10.000000
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/Log.lean
log2
null
logDet1 := optimization (X : Matrix (Fin 2) (Fin 2) ℝ) minimize (Matrix.trace X) subject to c1 : 10 ≤ log X.det c2 : X.PosDef solve logDet1 #eval logDet1.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval logDet1.value -- 296.826317 #eval logDet1.solution 0 0 -- 148.413156 #eval logDet1.solution 0 1 -- 0.000000 #eval logDet1.solution 1 0 -- 0.000000 #eval logDet1.solution 1 1 -- 148.413156
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/LogDet.lean
logDet1
null
logDet2 := optimization (X : Matrix (Fin 2) (Fin 2) ℝ) maximize (log X.det) subject to c1 : X.PosDef c2 : X 0 0 + X 0 1 + X 1 1 ≤ 50 solve logDet2 #print logDet2.conicForm #eval logDet2.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval logDet2.value -- 6.725434 #eval logDet2.solution 0 0 -- 33.336064 #eval logDet2.solution 0 1 -- -16.665855 #eval logDet2.solution 1 0 -- -16.665855 #eval logDet2.solution 1 1 -- 33.329791
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/LogDet.lean
logDet2
null
A1 : Matrix (Fin 2) (Fin 2) ℝ := fun i j => (#[#[23.90853599, 0.40930502] , #[ 0.79090389, 21.30303590]][i.val]!)[j.val]! @[optimization_param]
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/SDP.lean
A1
null
b1 : ℝ := 8.0 @[optimization_param]
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/SDP.lean
b1
null
C1 : Matrix (Fin 2) (Fin 2) ℝ := fun i j => (#[#[0.31561605, 0.97905625] , #[0.84321261, 0.06878862]][i.val]!)[j.val]!
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/SDP.lean
C1
null
sdp1 := optimization (X : Matrix (Fin 2) (Fin 2) ℝ) minimize (Matrix.trace (C1 * X)) subject to h₁ : Matrix.trace (A1 * X) <= b1 h₂ : Matrix.PosSemidef X solve sdp1 #print sdp1.conicForm #eval sdp1.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval sdp1.value -- -0.266754 #eval sdp1.solution 0 0 -- 0.151223 #eval sdp1.solution 0 1 -- -0.180731 #eval sdp1.solution 1 0 -- -0.180731 #eval sdp1.solution 1 1 -- 0.215997
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/SDP.lean
sdp1
null
so1 := optimization (x y : ℝ) maximize sqrt (x - y) subject to c1 : y = 2 * x - 3 c2 : x ^ (2 : ℝ) ≤ 2 c3 : 0 ≤ x - y solve so1 #print so1.conicForm #eval so1.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval so1.value -- 2.101003 #eval so1.solution -- (-1.414214, -5.828427)
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/SO.lean
so1
null
so2 := optimization (x : ℝ) minimize (x) subject to hx : 1 / 1000 ≤ x h : exp (-x) ≤ sqrt x solve so2 #print so2.conicForm #eval so2.status -- "PRIMAL_AND_DUAL_FEASIBLE" #eval so2.value -- 0.426303 #eval so2.solution -- 0.426303
def
CvxLean
[ "import CvxLean.Command.Solve" ]
CvxLean/Test/Solve/Problems/SO.lean
so2
null