feat(library/standard): add namespace 'pair'

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-07-07 14:48:19 -07:00
parent 10b0dfeb37
commit d30f387e72
6 changed files with 9 additions and 1 deletions

View file

@ -3,6 +3,7 @@
-- Author: Leonardo de Moura
import logic
namespace pair
inductive pair (A : Type) (B : Type) : Type :=
| mk_pair : A → B → pair A B
@ -25,10 +26,12 @@ section
theorem pair_ext (p : pair A B) : mk_pair (fst p) (snd p) = p
:= pair_rec (λ x y, refl (mk_pair x y)) p
end
instance pair_inhabited
instance pair.pair_inhabited
precedence `×`:30
infixr × := pair
-- notation for n-ary tuples
notation `(` h `,` t:(foldl `,` (e r, mk_pair r e) h) `)` := t
end

View file

@ -1,5 +1,6 @@
import standard
using num
using pair
definition H : inhabited (Bool × num × (num → num)) := _

View file

@ -1,5 +1,6 @@
import standard
using num
using pair
theorem H {A B : Type} (H1 : inhabited A) : inhabited (Bool × A × (B → num))
:= _

View file

@ -1,5 +1,6 @@
import standard
using num
using pair
section
parameter {A : Type}

View file

@ -1,4 +1,5 @@
import standard
using pair
inductive t1 : Type :=
| mk1 : t1

View file

@ -1,4 +1,5 @@
import standard
using pair
-- Test tuple notation
check (3, false, 1, true)