<?php
/*
 * Interaction/showResultsCoqJN.php
 * 
 * Copyright 2009, 2018 Pedro Quaresma <pedro@mat.uc.pt>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */


// Versão Coq+Area Method by J. Narboux

// select the theorem name from the database
$sqlTeoName = "SELECT teoName
                 FROM theorems
                WHERE teoId='$vTeoId'";
$resultadoTeoName = mysqli_query($ligacao,$sqlTeoName);
$linhaTeoName = mysqli_fetch_assoc($resultadoTeoName);
$vTeoNameAux=trim($linhaTeoName['teoName']);
echo "<td width='100%' colspan='6' align='center'><b>Theorem - $vTeoNameAux</b></td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='6' align='center'><hr></td>";
echo "</tr>";

// vai obter o resultado da tentativa de prova assim como as medidas
// de eficiência.
// Estão organizadas desta forma:
// status ; sTime ; computer .
// Por exemplo
// 1 ; 0.001000 ; Intel(R) Pentium(R) 4.0, 3GHz, 2.0GB .
// no campo status tem-se
//   1 = proved (if the conjecture was proved valid)
//   0 = disproved (if the conjecture was proved invalid)
//   2 = Failed to prove the conjecture (if neither of above two)
//              showResultsCoqJN.php
preg_match("§([0-9]+) ; ([0-9.]+) ; ([A-Za-z0-9,. ()]+)§",$pProofResults,$matches);

$vResult    = $matches[1];
$sTime      = $matches[2]; 
$computer   = $matches[3]; 

//   No caso do Coq só temos um valor possível 1 = proved (if the
//   conjecture was proved valid), todas as outras situações são
//   situações de erro
echo "<tr>";
echo "<td width='100%' colspan='6' align='center'>Proved</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='6' align='center'><hr></td>";
echo "</tr>";
echo "<td width='100%' colspan='6' align='center'><b>Measures of efficiency</b></td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='6' align='center'><hr></td>";
echo "</tr>";
echo "<tr>";
echo "<td width='33.3%' colspan='2'><span class='ficha'>Time spent (seconds)</span></td>";
echo "<td width='66.7%' colspan='4' align='left'>$sTime</td>";
echo "</tr>";
echo "<tr>";
echo "<td width='33.3%' colspan='2'><span class='ficha'>Computer</span></td>";
echo "<td width='66.7%' colspan='4' align='left'>$computer</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan='6' align='center'><hr></td>";
echo "</tr>";
echo "</table>";
echo "</td>";

?>