feat(library/standard): add namespace 'pair'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
10b0dfeb37
commit
d30f387e72
6 changed files with 9 additions and 1 deletions
|
@ -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
|
|
@ -1,5 +1,6 @@
|
|||
import standard
|
||||
using num
|
||||
using pair
|
||||
|
||||
definition H : inhabited (Bool × num × (num → num)) := _
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import standard
|
||||
using num
|
||||
using pair
|
||||
|
||||
theorem H {A B : Type} (H1 : inhabited A) : inhabited (Bool × A × (B → num))
|
||||
:= _
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import standard
|
||||
using num
|
||||
using pair
|
||||
|
||||
section
|
||||
parameter {A : Type}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import standard
|
||||
using pair
|
||||
|
||||
inductive t1 : Type :=
|
||||
| mk1 : t1
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import standard
|
||||
using pair
|
||||
|
||||
-- Test tuple notation
|
||||
check (3, false, 1, true)
|
||||
|
|
Loading…
Reference in a new issue