fix(tests/lean): adjust tests

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-01-17 19:27:32 -08:00
parent 534838a36c
commit 40b7ed13c2
4 changed files with 13 additions and 21 deletions

View file

@ -4,8 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#include "library/expr_pair.h"
#include "kernel/kernel.h"
#include "library/expr_pair.h"
namespace lean {
bool is_equality(expr const & e) {
@ -13,13 +13,10 @@ bool is_equality(expr const & e) {
}
bool is_equality(expr const & e, expr & lhs, expr & rhs) {
if (is_eq(e)) {
lhs = arg(e, 2);
rhs = arg(e, 3);
return true;
} else if (is_iff(e)) {
lhs = arg(e, 1);
rhs = arg(e, 2);
if (is_eq(e) || is_iff(e)) {
unsigned num = num_args(e);
lhs = arg(e, num - 2);
rhs = arg(e, num - 1);
return true;
} else {
return false;
@ -27,12 +24,7 @@ bool is_equality(expr const & e, expr & lhs, expr & rhs) {
}
expr_pair get_equality_args(expr const & e) {
if (is_eq(e)) {
return mk_pair(arg(e, 2), arg(e, 3));
} else if (is_iff(e)) {
return mk_pair(arg(e, 1), arg(e, 2));
} else {
lean_unreachable(); // LCOV_EXCL_LINE
}
unsigned num = num_args(e);
return mk_pair(arg(e, num - 2), arg(e, num - 1));
}
}

View file

@ -7,7 +7,7 @@
2
Assumed: y
if (0 ≤ -3 + y) then -3 + y else -1 * (-3 + y)
if 0 ≤ -3 + y then -3 + y else -1 * (-3 + y)
| x + y | > x
Set: lean::pp::notation
Int::gt (Int::abs (Int::add x y)) x

View file

@ -21,12 +21,12 @@ axiom two_lt_three : two < three
definition vector (A : Type) (n : N) : Type := ∀ (i : N), i < n → A
definition const {A : Type} (n : N) (d : A) : vector A n := λ (i : N) (H : i < n), d
definition update {A : Type} {n : N} (v : vector A n) (i : N) (d : A) : vector A n :=
λ (j : N) (H : j < n), if (j = i) then d else v j H
λ (j : N) (H : j < n), if j = i then d else v j H
definition select {A : Type} {n : N} (v : vector A n) (i : N) (H : i < n) : A := v i H
definition map {A B C : Type} {n : N} (f : A → B → C) (v1 : vector A n) (v2 : vector B n) : vector C n :=
λ (i : N) (H : i < n), f (v1 i H) (v2 i H)
select (update (const three ⊥) two ) two two_lt_three : Bool
if (two = two) then else ⊥
if two = two then else ⊥
update (const three ⊥) two : vector Bool three
--------
@ -46,4 +46,4 @@ map normal form -->
f (v1 i H) (v2 i H)
update normal form -->
λ (A : Type) (n : N) (v : ∀ (i : N), i < n → A) (i : N) (d : A) (j : N) (H : j < n), if (j = i) then d else v j H
λ (A : Type) (n : N) (v : ∀ (i : N), i < n → A) (i : N) (d : A) (j : N) (H : j < n), if j = i then d else v j H

View file

@ -2,11 +2,11 @@
Set: pp::unicode
Imported 'if_then_else'
Notation has been redefined, the existing notation:
notation 60 if _ then _ else _
notation 45 if _ then _ else _
has been replaced with:
notation 10 if _ then _
because they conflict with each other.
The precedence of 'then' changed from 60 to 10.
The precedence of 'then' changed from 45 to 10.
notation 10 if _ then _ : implies
if then ⊥
if then (if a then ⊥)