feat(frontends/lean): rename 'using' command to 'open'

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-09-03 16:00:38 -07:00
parent 6a6f6ed439
commit e51c4ad2e9
155 changed files with 312 additions and 336 deletions

View file

@ -26,7 +26,7 @@ Here is an example
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
variables a b c d e : nat. variables a b c d e : nat.
axiom Ax1 : a = b. axiom Ax1 : a = b.
axiom Ax2 : b = c + 1. axiom Ax2 : b = c + 1.
@ -55,7 +55,7 @@ some form of transitivity. It can even combine different relations.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
theorem T2 (a b c : nat) (H1 : a = b) (H2 : b = c + 1) : a ≠ 0 theorem T2 (a b c : nat) (H1 : a = b) (H2 : b = c + 1) : a ≠ 0
:= calc a = b : H1 := calc a = b : H1

View file

@ -30,7 +30,7 @@ the input value.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
-- defines the double function -- defines the double function
definition double (x : nat) := x + x definition double (x : nat) := x + x
#+END_SRC #+END_SRC
@ -62,7 +62,7 @@ The command =import= loads existing libraries and extensions.
We say =nat.ge= is a hierarchical name comprised of two parts: =nat= and =ge=. We say =nat.ge= is a hierarchical name comprised of two parts: =nat= and =ge=.
The command =using= creates aliases based on a given prefix. The The command =open= creates aliases based on a given prefix. The
command also imports notation, hints, and other features. We will command also imports notation, hints, and other features. We will
discuss its other applications later. Regarding aliases, discuss its other applications later. Regarding aliases,
the following command creates aliases for all objects starting with the following command creates aliases for all objects starting with
@ -70,7 +70,7 @@ the following command creates aliases for all objects starting with
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
check ge -- display the type of nat.ge check ge -- display the type of nat.ge
#+END_SRC #+END_SRC
@ -79,11 +79,11 @@ that =n=, =m= and =o= have type =nat=.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
variable n : nat variable n : nat
variable m : nat variable m : nat
variable o : nat variable o : nat
-- The command 'using nat' also imported the notation defined at the namespace 'nat' -- The command 'open nat' also imported the notation defined at the namespace 'nat'
check n + m check n + m
check n ≤ m check n ≤ m
#+END_SRC #+END_SRC
@ -96,7 +96,7 @@ for =n = n=. In Lean, =refl= is the reflexivity theorem.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
variable n : nat variable n : nat
check refl n check refl n
#+END_SRC #+END_SRC
@ -108,7 +108,7 @@ The following commands postulate two axioms =Ax1= and =Ax2= that state that =n =
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
variables m n o : nat variables m n o : nat
axiom Ax1 : n = m axiom Ax1 : n = m
axiom Ax2 : m = o axiom Ax2 : m = o
@ -146,7 +146,7 @@ example, =symm= is the symmetry theorem.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
theorem nat_trans3 (a b c d : nat) (H1 : a = b) (H2 : c = b) (H3 : c = d) : a = d := theorem nat_trans3 (a b c d : nat) (H1 : a = b) (H2 : c = b) (H3 : c = d) : a = d :=
trans (trans H1 (symm H2)) H3 trans (trans H1 (symm H2)) H3
@ -175,7 +175,7 @@ implicit arguments.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
theorem nat_trans3i {a b c d : nat} (H1 : a = b) (H2 : c = b) (H3 : c = d) : a = d := theorem nat_trans3i {a b c d : nat} (H1 : a = b) (H2 : c = b) (H3 : c = d) : a = d :=
trans (trans H1 (symm H2)) H3 trans (trans H1 (symm H2)) H3
@ -210,7 +210,7 @@ This is useful when debugging non-trivial problems.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
variables a b c : nat variables a b c : nat
axiom H1 : a = b axiom H1 : a = b
@ -361,7 +361,7 @@ examples.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
check fun x : nat, x + 1 check fun x : nat, x + 1
check fun x y : nat, x + 2 * y check fun x y : nat, x + 2 * y
@ -375,7 +375,7 @@ In all examples above, the type can be inferred automatically.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
check fun x, x + 1 check fun x, x + 1
check fun x y, x + 2 * y check fun x y, x + 2 * y
@ -392,7 +392,7 @@ function applications
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
check (fun x y, x + 2 * y) 1 check (fun x y, x + 2 * y) 1
check (fun x y, x + 2 * y) 1 2 check (fun x y, x + 2 * y) 1 2
check (fun x y, not (x ∧ y)) true false check (fun x y, not (x ∧ y)) true false
@ -420,7 +420,7 @@ are equal using just =refl=. Here is a simple example.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
theorem def_eq_th (a : nat) : ((λ x : nat, x + 1) a) = a + 1 := refl (a+1) theorem def_eq_th (a : nat) : ((λ x : nat, x + 1) a) = a + 1 := refl (a+1)
#+END_SRC #+END_SRC
@ -652,7 +652,7 @@ Then we instantiate the axiom using function application.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
variable f : nat → nat variable f : nat → nat
axiom fzero : ∀ x, f x = 0 axiom fzero : ∀ x, f x = 0
@ -668,7 +668,7 @@ abstraction. In the following example, we create a proof term showing that for a
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
variable f : nat → nat variable f : nat → nat
axiom fzero : ∀ x, f x = 0 axiom fzero : ∀ x, f x = 0
@ -693,7 +693,7 @@ for =∃ a : nat, a = w= using
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
theorem nat_trans3i {a b c d : nat} (H1 : a = b) (H2 : c = b) (H3 : c = d) : a = d := theorem nat_trans3i {a b c d : nat} (H1 : a = b) (H2 : c = b) (H3 : c = d) : a = d :=
trans (trans H1 (symm H2)) H3 trans (trans H1 (symm H2)) H3
@ -720,7 +720,7 @@ has different values for the implicit argument =P=.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
check @exists_intro check @exists_intro
variable g : nat → nat → nat variable g : nat → nat → nat
@ -751,7 +751,7 @@ of two even numbers is an even number.
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
definition even (a : nat) := ∃ b, a = 2*b definition even (a : nat) := ∃ b, a = 2*b
theorem EvenPlusEven {a b : nat} (H1 : even a) (H2 : even b) : even (a + b) := theorem EvenPlusEven {a b : nat} (H1 : even a) (H2 : even b) : even (a + b) :=
@ -772,7 +772,7 @@ With this macro we can write the example above in a more natural way
#+BEGIN_SRC lean #+BEGIN_SRC lean
import data.nat import data.nat
using nat open nat
definition even (a : nat) := ∃ b, a = 2*b definition even (a : nat) := ∃ b, a = 2*b
theorem EvenPlusEven {a b : nat} (H1 : even a) (H2 : even b) : even (a + b) := theorem EvenPlusEven {a b : nat} (H1 : even a) (H2 : even b) : even (a + b) :=
obtain (w1 : nat) (Hw1 : a = 2*w1), from H1, obtain (w1 : nat) (Hw1 : a = 2*w1), from H1,

View file

@ -4,7 +4,7 @@
import logic.core.connectives logic.classes.decidable logic.classes.inhabited import logic.core.connectives logic.classes.decidable logic.classes.inhabited
using eq_ops decidable open eq_ops decidable
inductive bool : Type := inductive bool : Type :=
ff : bool, ff : bool,

View file

@ -11,20 +11,13 @@ import ..nat.basic ..nat.order ..nat.sub ..prod ..quotient ..quotient tools.tact
import struc.binary import struc.binary
import tools.fake_simplifier import tools.fake_simplifier
using nat (hiding case) open nat (hiding case)
using quotient open quotient subtype prod relation
using subtype open decidable binary fake_simplifier
using prod open eq_ops
using relation
using decidable
using binary
using fake_simplifier
using eq_ops
namespace int namespace int
-- ## The defining equivalence relation on × -- ## The defining equivalence relation on ×
abbreviation rel (a b : × ) : Prop := pr1 a + pr2 b = pr2 a + pr1 b abbreviation rel (a b : × ) : Prop := pr1 a + pr2 b = pr2 a + pr1 b
theorem rel_comp (n m k l : ) : (rel (pair n m) (pair k l)) ↔ (n + l = m + k) := theorem rel_comp (n m k l : ) : (rel (pair n m) (pair k l)) ↔ (n + l = m + k) :=

View file

@ -9,10 +9,10 @@
import .basic import .basic
using nat (hiding case) open nat (hiding case)
using decidable open decidable
using fake_simplifier open fake_simplifier
using int eq_ops open int eq_ops
namespace int namespace int

View file

@ -14,9 +14,9 @@ import data.nat
import logic tools.helper_tactics import logic tools.helper_tactics
-- import if -- for find -- import if -- for find
using nat open nat
using eq_ops open eq_ops
using helper_tactics open helper_tactics
namespace list namespace list

View file

@ -9,10 +9,10 @@
import logic data.num tools.tactic struc.binary tools.helper_tactics import logic data.num tools.tactic struc.binary tools.helper_tactics
using num tactic binary eq_ops open num tactic binary eq_ops
using decidable (hiding induction_on rec_on) open decidable (hiding induction_on rec_on)
using relation -- for subst_iff open relation -- for subst_iff
using helper_tactics open helper_tactics
-- Definition of the type -- Definition of the type
-- ---------------------- -- ----------------------

View file

@ -11,9 +11,9 @@
import logic .sub struc.relation data.prod import logic .sub struc.relation data.prod
import tools.fake_simplifier import tools.fake_simplifier
using nat relation relation.iff_ops prod open nat relation relation.iff_ops prod
using fake_simplifier decidable open fake_simplifier decidable
using eq_ops open eq_ops
namespace nat namespace nat

View file

@ -10,9 +10,9 @@
import .basic logic.classes.decidable import .basic logic.classes.decidable
import tools.fake_simplifier import tools.fake_simplifier
using nat eq_ops tactic open nat eq_ops tactic
using fake_simplifier open fake_simplifier
using decidable (decidable inl inr) open decidable (decidable inl inr)
namespace nat namespace nat

View file

@ -10,9 +10,9 @@
import data.nat.order import data.nat.order
import tools.fake_simplifier import tools.fake_simplifier
using nat eq_ops tactic open nat eq_ops tactic
using helper_tactics open helper_tactics
using fake_simplifier open fake_simplifier
namespace nat namespace nat

View file

@ -3,7 +3,7 @@
-- Author: Leonardo de Moura -- Author: Leonardo de Moura
import logic.core.eq logic.classes.inhabited logic.classes.decidable import logic.core.eq logic.classes.inhabited logic.classes.decidable
using eq_ops decidable open eq_ops decidable
namespace option namespace option

View file

@ -9,7 +9,7 @@
import logic.classes.inhabited logic.core.eq logic.classes.decidable import logic.classes.inhabited logic.core.eq logic.classes.decidable
using inhabited decidable open inhabited decidable
inductive prod (A B : Type) : Type := inductive prod (A B : Type) : Type :=
pair : A → B → prod A B pair : A → B → prod A B

View file

@ -5,8 +5,8 @@
import logic ..prod struc.relation import logic ..prod struc.relation
import tools.fake_simplifier import tools.fake_simplifier
using prod eq_ops open prod eq_ops
using fake_simplifier open fake_simplifier
namespace quotient namespace quotient

View file

@ -9,8 +9,8 @@ import logic tools.tactic ..subtype logic.core.cast struc.relation data.prod
import logic.core.instances import logic.core.instances
import .aux import .aux
using relation prod inhabited nonempty tactic eq_ops open relation prod inhabited nonempty tactic eq_ops
using subtype relation.iff_ops open subtype relation.iff_ops
namespace quotient namespace quotient

View file

@ -8,7 +8,7 @@ import logic.axioms.classical logic.axioms.hilbert logic.axioms.funext
namespace quotient namespace quotient
using relation nonempty subtype open relation nonempty subtype
-- abstract quotient -- abstract quotient
-- ----------------- -- -----------------

View file

@ -4,7 +4,7 @@
--- Author: Jeremy Avigad, Leonardo de Moura --- Author: Jeremy Avigad, Leonardo de Moura
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
import data.bool import data.bool
using eq_ops bool open eq_ops bool
namespace set namespace set
definition set (T : Type) := definition set (T : Type) :=

View file

@ -4,7 +4,7 @@
import logic.classes.inhabited logic.core.eq import logic.classes.inhabited logic.core.eq
using inhabited open inhabited
inductive sigma {A : Type} (B : A → Type) : Type := inductive sigma {A : Type} (B : A → Type) : Type :=
dpair : Πx : A, B x → sigma B dpair : Πx : A, B x → sigma B

View file

@ -4,7 +4,7 @@
import data.bool import data.bool
using bool inhabited open bool inhabited
namespace string namespace string

View file

@ -4,7 +4,7 @@
import logic.classes.inhabited logic.core.eq logic.classes.decidable import logic.classes.inhabited logic.core.eq logic.classes.decidable
using decidable open decidable
inductive subtype {A : Type} (P : A → Prop) : Type := inductive subtype {A : Type} (P : A → Prop) : Type :=
tag : Πx : A, P x → subtype P tag : Πx : A, P x → subtype P

View file

@ -9,7 +9,7 @@
import logic.core.prop logic.classes.inhabited logic.classes.decidable import logic.core.prop logic.classes.inhabited logic.classes.decidable
using inhabited decidable open inhabited decidable
namespace sum namespace sum

View file

@ -4,7 +4,7 @@
import logic.classes.decidable logic.classes.inhabited import logic.classes.decidable logic.classes.inhabited
using decidable open decidable
namespace unit namespace unit

View file

@ -5,7 +5,7 @@
import data.unit data.bool data.nat import data.unit data.bool data.nat
import data.prod data.sum data.sigma import data.prod data.sum data.sigma
using unit bool nat prod sum sigma open unit bool nat prod sum sigma
inductive fibrant (T : Type) : Type := inductive fibrant (T : Type) : Type :=
fibrant_mk : fibrant T fibrant_mk : fibrant T
@ -32,4 +32,4 @@ instance pi_fibrant
theorem test_fibrant : fibrant (nat × (nat ⊎ nat)) := _ theorem test_fibrant : fibrant (nat × (nat ⊎ nat)) := _
end fibrant end fibrant

View file

@ -10,7 +10,7 @@
import general_notation struc.function import general_notation struc.function
using function open function
-- Path -- Path
-- ---- -- ----
@ -30,7 +30,7 @@ end path
-- TODO: should all this be in namespace path? -- TODO: should all this be in namespace path?
using path (induction_on) open path (induction_on)
-- Concatenation and inverse -- Concatenation and inverse
-- ------------------------- -- -------------------------

View file

@ -7,7 +7,7 @@
import logic.core.quantifiers logic.core.cast struc.relation import logic.core.quantifiers logic.core.cast struc.relation
using eq_ops open eq_ops
axiom prop_complete (a : Prop) : a = true a = false axiom prop_complete (a : Prop) : a = true a = false
@ -48,7 +48,7 @@ propext
(assume H, iff_to_eq H) (assume H, iff_to_eq H)
(assume H, eq_to_iff H) (assume H, eq_to_iff H)
using relation open relation
theorem iff_congruence [instance] (P : Prop → Prop) : congruence iff iff P := theorem iff_congruence [instance] (P : Prop → Prop) : congruence iff iff P :=
congruence_mk congruence_mk
(take (a b : Prop), (take (a b : Prop),

View file

@ -3,7 +3,7 @@
-- Author: Leonardo de Moura -- Author: Leonardo de Moura
import logic.axioms.hilbert logic.axioms.funext import logic.axioms.hilbert logic.axioms.funext
using eq_ops nonempty inhabited open eq_ops nonempty inhabited
-- Diaconescus theorem -- Diaconescus theorem
-- Show that Excluded middle follows from -- Show that Excluded middle follows from

View file

@ -5,7 +5,7 @@
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
import logic.core.eq struc.function import logic.core.eq struc.function
using function open function
-- Function extensionality -- Function extensionality
axiom funext : ∀ {A : Type} {B : A → Type} {f g : Π x, B x} (H : ∀ x, f x = g x), f = g axiom funext : ∀ {A : Type} {B : A → Type} {f g : Π x, B x} (H : ∀ x, f x = g x), f = g

View file

@ -12,7 +12,7 @@ import logic.core.quantifiers
import logic.classes.inhabited logic.classes.nonempty import logic.classes.inhabited logic.classes.nonempty
import data.subtype data.sum import data.subtype data.sum
using subtype inhabited nonempty open subtype inhabited nonempty
-- the axiom -- the axiom

View file

@ -6,7 +6,7 @@
import logic.classes.inhabited logic.core.cast import logic.classes.inhabited logic.core.cast
using inhabited open inhabited
-- Pi extensionality -- Pi extensionality
axiom piext {A : Type} {B B' : A → Type} {H : inhabited (Π x, B x)} : axiom piext {A : Type} {B B' : A → Type} {H : inhabited (Π x, B x)} :

View file

@ -6,7 +6,7 @@
-- =========================== -- ===========================
import logic.axioms.classical logic.axioms.hilbert logic.classes.decidable import logic.axioms.classical logic.axioms.hilbert logic.classes.decidable
using decidable inhabited nonempty open decidable inhabited nonempty
-- Excluded middle + Hilbert implies every proposition is decidable -- Excluded middle + Hilbert implies every proposition is decidable

View file

@ -4,7 +4,7 @@
import .inhabited import .inhabited
using inhabited open inhabited
namespace nonempty namespace nonempty

View file

@ -6,7 +6,7 @@
import .eq .quantifiers import .eq .quantifiers
using eq_ops open eq_ops
definition cast {A B : Type} (H : A = B) (a : A) : B := definition cast {A B : Type} (H : A = B) (a : A) : B :=
eq_rec a H eq_rec a H

View file

@ -40,7 +40,7 @@ namespace eq_ops
infixr `⬝` := trans infixr `⬝` := trans
infixr `▸` := subst infixr `▸` := subst
end eq_ops end eq_ops
using eq_ops open eq_ops
theorem true_ne_false : ¬true = false := theorem true_ne_false : ¬true = false :=
assume H : true = false, assume H : true = false,

View file

@ -4,11 +4,10 @@
import ..instances import ..instances
using relation open relation
open relation.general_operations
using relation.general_operations open relation.iff_ops
using relation.iff_ops open eq_ops
using eq_ops
section section

View file

@ -10,7 +10,7 @@
import logic.core.instances logic.classes.decidable logic.core.quantifiers logic.core.cast import logic.core.instances logic.classes.decidable logic.core.quantifiers logic.core.cast
using relation decidable relation.iff_ops open relation decidable relation.iff_ops
theorem or_right_comm (a b c : Prop) : (a b) c ↔ (a c) b := theorem or_right_comm (a b c : Prop) : (a b) c ↔ (a c) b :=
calc calc

View file

@ -5,7 +5,7 @@
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
import logic.classes.decidable tools.tactic import logic.classes.decidable tools.tactic
using decidable tactic eq_ops open decidable tactic eq_ops
definition ite (c : Prop) {H : decidable c} {A : Type} (t e : A) : A := definition ite (c : Prop) {H : decidable c} {A : Type} (t e : A) : A :=
decidable.rec_on H (assume Hc, t) (assume Hnc, e) decidable.rec_on H (assume Hc, t) (assume Hnc, e)

View file

@ -9,7 +9,7 @@ import logic.core.connectives struc.relation
namespace relation namespace relation
using relation open relation
-- Congruences for logic -- Congruences for logic
-- --------------------- -- ---------------------

View file

@ -4,7 +4,7 @@
import .connectives ..classes.nonempty import .connectives ..classes.nonempty
using inhabited nonempty open inhabited nonempty
inductive Exists {A : Type} (P : A → Prop) : Prop := inductive Exists {A : Type} (P : A → Prop) : Prop :=
exists_intro : ∀ (a : A), P a → Exists P exists_intro : ∀ (a : A), P a → Exists P

View file

@ -1,9 +1,8 @@
-- Copyright (c) 2014 Microsoft Corporation. All rights reserved. -- Copyright (c) 2014 Microsoft Corporation. All rights reserved.
-- Released under Apache 2.0 license as described in the file LICENSE. -- Released under Apache 2.0 license as described in the file LICENSE.
-- Author: Leonardo de Moura -- Author: Leonardo de Moura
import logic.core.eq import logic.core.eq
using eq_ops open eq_ops
namespace binary namespace binary
section section

View file

@ -5,7 +5,7 @@
import logic.axioms.classical logic.axioms.prop_decidable logic.classes.decidable import logic.axioms.classical logic.axioms.prop_decidable logic.classes.decidable
import logic.core.identities import logic.core.identities
using decidable open decidable
-- Well-founded relation definition -- Well-founded relation definition
-- We are essentially saying that a relation R is well-founded -- We are essentially saying that a relation R is well-founded

View file

@ -1,5 +1,5 @@
import .tactic import .tactic
using tactic open tactic
namespace fake_simplifier namespace fake_simplifier

View file

@ -9,7 +9,7 @@
import .tactic import .tactic
using tactic open tactic
namespace helper_tactics namespace helper_tactics
definition apply_refl := apply @refl definition apply_refl := apply @refl

View file

@ -5,8 +5,8 @@
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
import data.string data.num import data.string data.num
using string open string
using num open num
namespace tactic namespace tactic
-- This is just a trick to embed the 'tactic language' as a -- This is just a trick to embed the 'tactic language' as a

View file

@ -11,7 +11,7 @@
'("import" "abbreviation" "opaque_hint" "tactic_hint" "definition" "renaming" '("import" "abbreviation" "opaque_hint" "tactic_hint" "definition" "renaming"
"inline" "hiding" "exposing" "parameter" "parameters" "begin" "proof" "qed" "conjecture" "inline" "hiding" "exposing" "parameter" "parameters" "begin" "proof" "qed" "conjecture"
"hypothesis" "lemma" "corollary" "variable" "variables" "print" "theorem" "hypothesis" "lemma" "corollary" "variable" "variables" "print" "theorem"
"axiom" "inductive" "with" "structure" "universe" "alias" "help" "environment" "context" "open" "axiom" "inductive" "with" "structure" "universe" "alias" "help" "environment"
"options" "precedence" "postfix" "prefix" "calc_trans" "calc_subst" "calc_refl" "options" "precedence" "postfix" "prefix" "calc_trans" "calc_subst" "calc_refl"
"infix" "infixl" "infixr" "notation" "eval" "check" "exit" "coercion" "end" "infix" "infixl" "infixr" "notation" "eval" "check" "exit" "coercion" "end"
"private" "using" "namespace" "builtin" "including" "instance" "class" "section" "private" "using" "namespace" "builtin" "including" "instance" "class" "section"
@ -60,10 +60,6 @@
;; Constants ;; Constants
(,(rx (or "#" "@" "->" "" "" "/" "==" "=" ":=" "<->" "/\\" "\\/" "" "" "" "<" ">" "" "" "¬" "<=" ">=" "⁻¹" "" "" "+" "*" "-" "/")) . 'font-lock-constant-face) (,(rx (or "#" "@" "->" "" "" "/" "==" "=" ":=" "<->" "/\\" "\\/" "" "" "" "<" ">" "" "" "¬" "<=" ">=" "⁻¹" "" "" "+" "*" "-" "/")) . 'font-lock-constant-face)
(,(rx (or "λ" "" "" "" ":=")) . 'font-lock-constant-face ) (,(rx (or "λ" "" "" "" ":=")) . 'font-lock-constant-face )
(,(rx symbol-start
(or "\\b.*_tac" "Cond" "or_else" "then" "try" "when" "assumption" "apply" "back" "beta" "done" "exact")
symbol-end)
. 'font-lock-constant-face)
;; universe/inductive/theorem... "names" ;; universe/inductive/theorem... "names"
(,(rx symbol-start (,(rx symbol-start
(group (or "universe" "inductive" "theorem" "axiom" "lemma" "hypothesis" (group (or "universe" "inductive" "theorem" "axiom" "lemma" "hypothesis"
@ -76,7 +72,12 @@
;; place holder ;; place holder
(,(rx symbol-start "_" symbol-end) . 'font-lock-preprocessor-face) (,(rx symbol-start "_" symbol-end) . 'font-lock-preprocessor-face)
;; modifiers ;; modifiers
(,(rx (or "\[protected\]" "\[private\]" "\[instance\]" "\[coercion\]" "\[inline\]")) . 'font-lock-doc-face) (,(rx (or "\[notation\]" "\[protected\]" "\[private\]" "\[instance\]" "\[coercion\]" "\[inline\]")) . 'font-lock-doc-face)
;; tactics
(,(rx symbol-start
(or "\\b.*_tac" "Cond" "or_else" "then" "try" "when" "assumption" "apply" "back" "beta" "done" "exact" "repeat")
symbol-end)
. 'font-lock-constant-face)
;; sorry ;; sorry
(,(rx symbol-start "sorry" symbol-end) . 'font-lock-warning-face) (,(rx symbol-start "sorry" symbol-end) . 'font-lock-warning-face)
;; ? query ;; ? query

View file

@ -166,9 +166,9 @@ static name parse_class(parser & p) {
else if (p.curr_is_keyword() || p.curr_is_command()) else if (p.curr_is_keyword() || p.curr_is_command())
n = p.get_token_info().value(); n = p.get_token_info().value();
else else
throw parser_error("invalid 'using' command, identifier or symbol expected", p.pos()); throw parser_error("invalid 'open' command, identifier or symbol expected", p.pos());
p.next(); p.next();
p.check_token_next(g_rbracket, "invalid 'using' command, ']' expected"); p.check_token_next(g_rbracket, "invalid 'open' command, ']' expected");
return n; return n;
} else { } else {
return name(); return name();
@ -178,17 +178,17 @@ static name parse_class(parser & p) {
static void check_identifier(parser & p, environment const & env, name const & ns, name const & id) { static void check_identifier(parser & p, environment const & env, name const & ns, name const & id) {
name full_id = ns + id; name full_id = ns + id;
if (!env.find(full_id)) if (!env.find(full_id))
throw parser_error(sstream() << "invalid 'using' command, unknown declaration '" << full_id << "'", p.pos()); throw parser_error(sstream() << "invalid 'open' command, unknown declaration '" << full_id << "'", p.pos());
} }
// using [class] id (id ...) (renaming id->id id->id) (hiding id ... id) // open [class] id (id ...) (renaming id->id id->id) (hiding id ... id)
environment using_cmd(parser & p) { environment open_cmd(parser & p) {
environment env = p.env(); environment env = p.env();
while (true) { while (true) {
name cls = parse_class(p); name cls = parse_class(p);
bool decls = cls.is_anonymous() || cls == g_decls || cls == g_declarations; bool decls = cls.is_anonymous() || cls == g_decls || cls == g_declarations;
auto pos = p.pos(); auto pos = p.pos();
name ns = p.check_id_next("invalid 'using' command, identifier expected"); name ns = p.check_id_next("invalid 'open' command, identifier expected");
optional<name> real_ns = to_valid_namespace_name(env, ns); optional<name> real_ns = to_valid_namespace_name(env, ns);
if (!real_ns) if (!real_ns)
throw parser_error(sstream() << "invalid namespace name '" << ns << "'", pos); throw parser_error(sstream() << "invalid namespace name '" << ns << "'", pos);
@ -205,8 +205,8 @@ environment using_cmd(parser & p) {
while (p.curr_is_identifier()) { while (p.curr_is_identifier()) {
name from_id = p.get_name_val(); name from_id = p.get_name_val();
p.next(); p.next();
p.check_token_next(g_arrow, "invalid 'using' command renaming, '->' expected"); p.check_token_next(g_arrow, "invalid 'open' command renaming, '->' expected");
name to_id = p.check_id_next("invalid 'using' command renaming, identifier expected"); name to_id = p.check_id_next("invalid 'open' command renaming, identifier expected");
check_identifier(p, env, ns, from_id); check_identifier(p, env, ns, from_id);
exceptions.push_back(from_id); exceptions.push_back(from_id);
env = add_expr_alias(env, to_id, ns+from_id); env = add_expr_alias(env, to_id, ns+from_id);
@ -228,11 +228,11 @@ environment using_cmd(parser & p) {
env = add_expr_alias(env, id, ns+id); env = add_expr_alias(env, id, ns+id);
} }
} else { } else {
throw parser_error("invalid 'using' command option, identifier, 'hiding' or 'renaming' expected", p.pos()); throw parser_error("invalid 'open' command option, identifier, 'hiding' or 'renaming' expected", p.pos());
} }
if (found_explicit && !exceptions.empty()) if (found_explicit && !exceptions.empty())
throw parser_error("invalid 'using' command option, mixing explicit and implicit 'using' options", p.pos()); throw parser_error("invalid 'open' command option, mixing explicit and implicit 'open' options", p.pos());
p.check_token_next(g_rparen, "invalid 'using' command option, ')' expected"); p.check_token_next(g_rparen, "invalid 'open' command option, ')' expected");
} }
if (!found_explicit) if (!found_explicit)
env = add_aliases(env, ns, name(), exceptions.size(), exceptions.data()); env = add_aliases(env, ns, name(), exceptions.size(), exceptions.data());
@ -303,7 +303,7 @@ environment erase_cache_cmd(parser & p) {
cmd_table init_cmd_table() { cmd_table init_cmd_table() {
cmd_table r; cmd_table r;
add_cmd(r, cmd_info("using", "create aliases for declarations, and use objects defined in other namespaces", using_cmd)); add_cmd(r, cmd_info("open", "create aliases for declarations, and use objects defined in other namespaces", open_cmd));
add_cmd(r, cmd_info("set_option", "set configuration option", set_option_cmd)); add_cmd(r, cmd_info("set_option", "set configuration option", set_option_cmd));
add_cmd(r, cmd_info("exit", "exit", exit_cmd)); add_cmd(r, cmd_info("exit", "exit", exit_cmd));
add_cmd(r, cmd_info("print", "print a string", print_cmd)); add_cmd(r, cmd_info("print", "print a string", print_cmd));

View file

@ -68,7 +68,7 @@ token_table init_token_table() {
pair<char const *, unsigned> builtin[] = pair<char const *, unsigned> builtin[] =
{{"fun", 0}, {"Pi", 0}, {"let", 0}, {"in", 0}, {"have", 0}, {"show", 0}, {"obtain", 0}, {"by", 0}, {"then", 0}, {{"fun", 0}, {"Pi", 0}, {"let", 0}, {"in", 0}, {"have", 0}, {"show", 0}, {"obtain", 0}, {"by", 0}, {"then", 0},
{"from", 0}, {"(", g_max_prec}, {")", 0}, {"{", g_max_prec}, {"}", 0}, {"_", g_max_prec}, {"from", 0}, {"(", g_max_prec}, {")", 0}, {"{", g_max_prec}, {"}", 0}, {"_", g_max_prec},
{"[", g_max_prec}, {"]", 0}, {"", g_max_prec}, {"", 0}, {".{", 0}, {"Type", g_max_prec}, {"Type'", g_max_prec}, {"[", g_max_prec}, {"]", 0}, {"", g_max_prec}, {"", 0}, {".{", 0}, {"Type", g_max_prec}, {"Type'", g_max_prec}, {"using", 0},
{"|", 0}, {"!", 0}, {"?", 0}, {"with", 0}, {"...", 0}, {",", 0}, {".", 0}, {":", 0}, {"::", 0}, {"calc", 0}, {":=", 0}, {"--", 0}, {"#", 0}, {"|", 0}, {"!", 0}, {"?", 0}, {"with", 0}, {"...", 0}, {",", 0}, {".", 0}, {":", 0}, {"::", 0}, {"calc", 0}, {":=", 0}, {"--", 0}, {"#", 0},
{"(*", 0}, {"/-", 0}, {"begin", g_max_prec}, {"proof", g_max_prec}, {"qed", 0}, {"@", g_max_prec}, {"including", 0}, {"sorry", g_max_prec}, {"(*", 0}, {"/-", 0}, {"begin", g_max_prec}, {"proof", g_max_prec}, {"qed", 0}, {"@", g_max_prec}, {"including", 0}, {"sorry", g_max_prec},
{"+", g_plus_prec}, {g_cup, g_cup_prec}, {"->", g_arrow_prec}, {nullptr, 0}}; {"+", g_plus_prec}, {g_cup, g_cup_prec}, {"->", g_arrow_prec}, {nullptr, 0}};
@ -78,7 +78,7 @@ token_table init_token_table() {
"abbreviation", "opaque_hint", "evaluate", "check", "print", "end", "namespace", "section", "import", "abbreviation", "opaque_hint", "evaluate", "check", "print", "end", "namespace", "section", "import",
"abbreviation", "inductive", "record", "renaming", "extends", "structure", "module", "universe", "abbreviation", "inductive", "record", "renaming", "extends", "structure", "module", "universe",
"precedence", "infixl", "infixr", "infix", "postfix", "prefix", "notation", "context", "precedence", "infixl", "infixr", "infix", "postfix", "prefix", "notation", "context",
"exit", "set_option", "using", "calc_subst", "calc_refl", "calc_trans", "tactic_hint", "exit", "set_option", "open", "calc_subst", "calc_refl", "calc_trans", "tactic_hint",
"add_begin_end_tactic", "set_begin_end_tactic", "instance", "class", "#erase_cache", nullptr}; "add_begin_end_tactic", "set_begin_end_tactic", "instance", "class", "#erase_cache", nullptr};
pair<char const *, char const *> aliases[] = pair<char const *, char const *> aliases[] =

View file

@ -10,16 +10,15 @@ namespace N2
variable foo : val → val → val variable foo : val → val → val
end N2 end N2
using N2 open N2
using N1 open N1
variables a b : num variables a b : num
print raw foo a b print raw foo a b
using N2 open N2
print raw foo a b print raw foo a b
using N1 open N1
print raw foo a b print raw foo a b
using N1 open N1
print raw foo a b print raw foo a b
using N2 open N2
print raw foo a b print raw foo a b

View file

@ -6,7 +6,7 @@ namespace N2
definition pr {A : Type} (a b : A) := b definition pr {A : Type} (a b : A) := b
end N2 end N2
using N1 N2 open N1 N2
variable N : Type.{1} variable N : Type.{1}
variables a b : N variables a b : N
check @pr check @pr

View file

@ -1,5 +1,5 @@
import logic logic.axioms.hilbert import logic logic.axioms.hilbert
using inhabited nonempty open inhabited nonempty
definition v1 : Prop := epsilon (λ x, true) definition v1 : Prop := epsilon (λ x, true)
inductive Empty : Type inductive Empty : Type

View file

@ -1,5 +1,5 @@
import logic tools.tactic import logic tools.tactic
using tactic open tactic
definition simple := apply trivial definition simple := apply trivial

View file

@ -1,5 +1,5 @@
import logic import logic
using bool eq_ops tactic open bool eq_ops tactic
variables a b c : bool variables a b c : bool
axiom H1 : a = b axiom H1 : a = b

View file

@ -1,5 +1,5 @@
import logic.axioms.hilbert data.nat.basic import logic.axioms.hilbert data.nat.basic
using nonempty inhabited nat open nonempty inhabited nat
theorem int_inhabited [instance] : inhabited nat := inhabited_mk zero theorem int_inhabited [instance] : inhabited nat := inhabited_mk zero

View file

@ -1,5 +1,5 @@
import data.num import data.num
using num open num
variable f : num → num → num → num variable f : num → num → num → num

View file

@ -1,5 +1,5 @@
import data.num import data.num
using num open num
variable f : num → num → num → num variable f : num → num → num → num
@ -15,5 +15,3 @@ check
d := 10, d := 10,
e := f (f 10 10 d) (f d 10 10) a e := f (f 10 10 d) (f d 10 10) a
in f a b (f e d 10) in f a b (f e d 10)

View file

@ -1,5 +1,5 @@
import data.num import data.num
using num open num
check 10 check 10
check 20 check 20

View file

@ -5,6 +5,6 @@ namespace foo
definition D := true definition D := true
end foo end foo
using foo open foo
check C check C
check D check D

View file

@ -1,5 +1,5 @@
import logic import logic
using num open num
abbreviation Type1 := Type.{1} abbreviation Type1 := Type.{1}
@ -88,7 +88,7 @@ namespace monoid
definition assoc [inline] {A : Type} (s : monoid_struct A) : is_assoc (mul s) definition assoc [inline] {A : Type} (s : monoid_struct A) : is_assoc (mul s)
:= monoid_struct_rec (fun mul id a i, a) s := monoid_struct_rec (fun mul id a i, a) s
using semigroup open semigroup
definition is_semigroup_struct [inline] [instance] (A : Type) (s : monoid_struct A) : semigroup_struct A definition is_semigroup_struct [inline] [instance] (A : Type) (s : monoid_struct A) : semigroup_struct A
:= mk_semigroup_struct (mul s) (assoc s) := mk_semigroup_struct (mul s) (assoc s)
@ -104,7 +104,7 @@ end monoid
end algebra end algebra
section section
using algebra algebra.semigroup algebra.monoid open algebra algebra.semigroup algebra.monoid
variable M : monoid variable M : monoid
variables a b c : M variables a b c : M
check a*b*c*a*b*c*a*b*a*b*c*a check a*b*c*a*b*c*a*b*a*b*c*a

View file

@ -10,8 +10,8 @@ namespace N2
variable foo : val → val → val variable foo : val → val → val
end N2 end N2
using N1 open N1
using N2 open N2
variables a b : num variables a b : num
variables x y : val variables x y : val
@ -35,7 +35,7 @@ definition aux1 := foo a b -- System elaborated it to N1.foo a b
theorem T2 : aux1 = N1.foo a b theorem T2 : aux1 = N1.foo a b
:= refl _ := refl _
using N1 open N1
definition aux2 := foo a b -- Now N1 is in the end of the queue, this is elaborated to N2.foo (f a) (f b) definition aux2 := foo a b -- Now N1 is in the end of the queue, this is elaborated to N2.foo (f a) (f b)
check aux2 check aux2

View file

@ -10,8 +10,8 @@ namespace N2
variable foo : val → val → val variable foo : val → val → val
end N2 end N2
using N1 open N1
using N2 open N2
variables a b : num variables a b : num
variable f : num → val variable f : num → val
coercion f coercion f
@ -20,4 +20,3 @@ definition aux2 := foo a b
check aux2 check aux2
theorem T3 : aux2 = N1.foo a b theorem T3 : aux2 = N1.foo a b
:= refl _ := refl _

View file

@ -1,4 +1,4 @@
import data.bool import data.bool
using bool open bool
check ff check ff

View file

@ -1,5 +1,5 @@
import data.num import data.num
using num open num
namespace foo namespace foo
variable le : num → num → Prop variable le : num → num → Prop

View file

@ -1,5 +1,5 @@
import data.nat.basic import data.nat.basic
using nat open nat
set_option pp.coercion true set_option pp.coercion true
@ -8,7 +8,7 @@ theorem trans {a b c : nat} (H1 : a = b) (H2 : b = c) : a = c :=
trans H1 H2 trans H1 H2
end foo end foo
using foo open foo
theorem tst (a b : nat) (H0 : b = a) (H : b = 0) : a = 0 theorem tst (a b : nat) (H0 : b = a) (H : b = 0) : a = 0
:= have H1 : a = b, from symm H0, := have H1 : a = b, from symm H0,
@ -17,4 +17,3 @@ theorem tst (a b : nat) (H0 : b = a) (H : b = 0) : a = 0
definition f (a b : nat) := definition f (a b : nat) :=
let x := 3 in let x := 3 in
a + x a + x

View file

@ -1,5 +1,5 @@
import logic data.prod import logic data.prod
using num prod inhabited open num prod inhabited
definition H : inhabited (Prop × num × (num → num)) := _ definition H : inhabited (Prop × num × (num → num)) := _

View file

@ -1,5 +1,5 @@
import logic data.prod import logic data.prod
using num prod nonempty inhabited open num prod nonempty inhabited
theorem H {A B : Type} (H1 : inhabited A) : inhabited (Prop × A × (B → num)) theorem H {A B : Type} (H1 : inhabited A) : inhabited (Prop × A × (B → num))
:= _ := _

View file

@ -1,5 +1,5 @@
import logic data.prod import logic data.prod
using num prod inhabited open num prod inhabited
section section
parameter {A : Type} parameter {A : Type}

View file

@ -23,36 +23,36 @@ namespace nat
end nat end nat
section section
using algebra nat open algebra nat
variables a b c : nat variables a b c : nat
check a * b * c check a * b * c
definition tst1 : nat := a * b * c definition tst1 : nat := a * b * c
end end
section section
using [notation] algebra open [notation] algebra
using nat open nat
-- check mul_struct nat << This is an error, we are using only the notation from algebra -- check mul_struct nat << This is an error, we are open only the notation from algebra
variables a b c : nat variables a b c : nat
check a * b * c check a * b * c
definition tst2 : nat := a * b * c definition tst2 : nat := a * b * c
end end
section section
using nat open nat
-- check mul_struct nat << This is an error, we are using only the notation from algebra -- check mul_struct nat << This is an error, we are open only the notation from algebra
variables a b c : nat variables a b c : nat
check #algebra a*b*c check #algebra a*b*c
definition tst3 : nat := #algebra a*b*c definition tst3 : nat := #algebra a*b*c
end end
section section
using nat open nat
set_option pp.implicit true set_option pp.implicit true
definition add_struct [instance] : algebra.mul_struct nat definition add_struct [instance] : algebra.mul_struct nat
:= algebra.mk_mul_struct add := algebra.mk_mul_struct add
variables a b c : nat variables a b c : nat
check #algebra a*b*c -- << is using add instead of mul check #algebra a*b*c -- << is open add instead of mul
definition tst4 : nat := #algebra a*b*c definition tst4 : nat := #algebra a*b*c
end end

View file

@ -1,5 +1,5 @@
import logic data.prod import logic data.prod
using prod open prod
inductive t1 : Type := inductive t1 : Type :=
mk1 : t1 mk1 : t1

View file

@ -1,5 +1,5 @@
import logic import logic
using num tactic open num tactic
inductive inh (A : Type) : Type := inductive inh (A : Type) : Type :=
inh_intro : A -> inh A inh_intro : A -> inh A

View file

@ -1,5 +1,5 @@
import logic data.prod import logic data.prod
using num tactic prod open num tactic prod
inductive inh (A : Type) : Prop := inductive inh (A : Type) : Prop :=
inh_intro : A -> inh A inh_intro : A -> inh A
@ -30,4 +30,4 @@ theorem T1 {A B C D : Type} {P : C → Prop} (a : A) (H1 : inh B) (H2 : ∃x, P
(* (*
print(get_env():find("T1"):value()) print(get_env():find("T1"):value())
*) *)

View file

@ -1,5 +1,5 @@
import data.num import data.num
using num open num
variables int nat real : Type.{1} variables int nat real : Type.{1}
variable nat_add : nat → nat → nat variable nat_add : nat → nat → nat

View file

@ -1,5 +1,5 @@
import data.nat import data.nat
using nat open nat
definition tst1 : Prop := zero = 0 definition tst1 : Prop := zero = 0
definition tst2 : nat := 0 definition tst2 : nat := 0

View file

@ -1,5 +1,5 @@
import data.nat import data.nat
using nat open nat
inductive list (T : Type) : Type := inductive list (T : Type) : Type :=
nil {} : list T, nil {} : list T,

View file

@ -4,7 +4,7 @@
--- Author: Jeremy Avigad --- Author: Jeremy Avigad
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
import logic.core.connectives struc.function import logic.core.connectives struc.function
using function open function
namespace congr namespace congr

View file

@ -1,5 +1,5 @@
import logic data.unit import logic data.unit
using bool unit decidable open bool unit decidable
variables a b c : bool variables a b c : bool
variables u v : unit variables u v : unit

View file

@ -1,4 +1,3 @@
precedence `+`:65 precedence `+`:65
namespace nat namespace nat
@ -8,7 +7,7 @@ namespace nat
end nat end nat
namespace int namespace int
using nat (nat) open nat (nat)
variable int : Type.{1} variable int : Type.{1}
variable add : int → int → int variable add : int → int → int
infixl + := add infixl + := add
@ -17,8 +16,8 @@ namespace int
end int end int
section section
using nat open nat
using int open int
variables n m : nat variables n m : nat
variables i j : int variables i j : int
@ -36,7 +35,7 @@ section
-- Moving 'nat' to the 'front' -- Moving 'nat' to the 'front'
print ">>> Moving nat notation to the 'front'" print ">>> Moving nat notation to the 'front'"
using nat open nat
print raw i + n print raw i + n
check n + m check n + m
end end

View file

@ -7,7 +7,7 @@ namespace nat
end nat end nat
namespace int namespace int
using nat (nat) open nat (nat)
variable int : Type.{1} variable int : Type.{1}
variable add : int → int → int variable add : int → int → int
infixl + := add infixl + := add
@ -16,18 +16,18 @@ namespace int
end int end int
section section
-- Using "only" the notation and declarations from the namespaces nat and int -- Open "only" the notation and declarations from the namespaces nat and int
using [notation] nat open [notation] nat
using [notation] int open [notation] int
using [decls] nat open [decls] nat
using [decls] int open [decls] int
variables n m : nat variables n m : nat
variables i j : int variables i j : int
check n + m check n + m
check i + j check i + j
-- The following check does not work, since we are not using the coercions -- The following check does not work, since we are not open the coercions
-- check n + i -- check n + i
-- Here is a possible trick for this kind of configuration -- Here is a possible trick for this kind of configuration

View file

@ -7,7 +7,7 @@ namespace nat
end nat end nat
namespace int namespace int
using nat (nat) open nat (nat)
variable int : Type.{1} variable int : Type.{1}
variable add : int → int → int variable add : int → int → int
infixl + := add infixl + := add
@ -19,17 +19,17 @@ variables n m : nat.nat
variables i j : int.int variables i j : int.int
section section
using [notation] nat open [notation] nat
using [notation] int open [notation] int
using [decls] nat open [decls] nat
using [decls] int open [decls] int
check n+m check n+m
check i+j check i+j
-- check i+n -- Error -- check i+n -- Error
end end
namespace int namespace int
using [decls] nat (nat) open [decls] nat (nat)
-- Here is a possible trick for this kind of configuration -- Here is a possible trick for this kind of configuration
definition add_ni (a : nat) (b : int) := (of_nat a) + b definition add_ni (a : nat) (b : int) := (of_nat a) + b
definition add_in (a : int) (b : nat) := a + (of_nat b) definition add_in (a : int) (b : nat) := a + (of_nat b)
@ -38,18 +38,18 @@ namespace int
end int end int
section section
using [notation] nat open [notation] nat
using [notation] int open [notation] int
using [declarations] nat open [declarations] nat
using [declarations] int open [declarations] int
check n+m check n+m
check i+n check i+n
check n+i check n+i
end end
section section
using nat open nat
using int open int
check n+m check n+m
check i+n check i+n
end end

View file

@ -7,7 +7,7 @@ namespace nat
end nat end nat
namespace int namespace int
using nat (nat) open nat (nat)
variable int : Type.{1} variable int : Type.{1}
variable add : int → int → int variable add : int → int → int
infixl + := add infixl + := add
@ -17,10 +17,9 @@ namespace int
end coercions end coercions
end int end int
using nat open nat
using int open int
variables n m : nat variables n m : nat
check n+m -- coercion nat -> int is not available check n+m -- coercion nat -> int is not available
using int.coercions open int.coercions
check n+m -- coercion nat -> int is available check n+m -- coercion nat -> int is available

View file

@ -1,4 +1,3 @@
precedence `+`:65 precedence `+`:65
namespace nat namespace nat
@ -8,7 +7,7 @@ namespace nat
end nat end nat
namespace int namespace int
using nat (nat) open nat (nat)
variable int : Type.{1} variable int : Type.{1}
variable add : int → int → int variable add : int → int → int
infixl + := add infixl + := add
@ -16,8 +15,8 @@ namespace int
coercion of_nat coercion of_nat
end int end int
using int open int
using nat open nat
variables n m : nat variables n m : nat
variables i j : int variables i j : int
@ -29,5 +28,3 @@ check i + n + n + n + n + n + n + n + n + n + n + n +
n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n +
n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n + n +
n + n + n + n + n + n + n + n + n + n + n + n n + n + n + n + n + n + n + n + n + n + n + n

View file

@ -1,4 +1,3 @@
precedence `+`:65 precedence `+`:65
namespace nat namespace nat
@ -8,7 +7,7 @@ namespace nat
end nat end nat
namespace int namespace int
using nat (nat) open nat (nat)
variable int : Type.{1} variable int : Type.{1}
variable add : int → int → int variable add : int → int → int
infixl + := add infixl + := add
@ -16,8 +15,8 @@ namespace int
coercion of_nat coercion of_nat
end int end int
using nat open nat
using int open int
variables n m : nat variables n m : nat
variables i j : int variables i j : int
@ -34,6 +33,6 @@ check #nat n + m
-- Moving 'nat' to the 'front' -- Moving 'nat' to the 'front'
print ">>> Moving nat notation to the 'front'" print ">>> Moving nat notation to the 'front'"
using nat open nat
print raw i + n print raw i + n
check n + m check n + m

View file

@ -7,7 +7,7 @@ namespace nat
end nat end nat
namespace int namespace int
using nat (nat) open nat (nat)
variable int : Type.{1} variable int : Type.{1}
variable add : int → int → int variable add : int → int → int
infixl + := add infixl + := add
@ -15,18 +15,18 @@ namespace int
coercion of_nat coercion of_nat
end int end int
-- Using "only" the notation and declarations from the namespaces nat and int -- Open "only" the notation and declarations from the namespaces nat and int
using [notation] nat open [notation] nat
using [notation] int open [notation] int
using [decls] nat open [decls] nat
using [decls] int open [decls] int
variables n m : nat variables n m : nat
variables i j : int variables i j : int
check n + m check n + m
check i + j check i + j
-- The following check does not work, since we are not using the coercions -- The following check does not work, since we are not open the coercions
-- check n + i -- check n + i
-- Here is a possible trick for this kind of configuration -- Here is a possible trick for this kind of configuration

View file

@ -7,7 +7,7 @@ namespace nat
end nat end nat
namespace int namespace int
using nat (nat) open nat (nat)
variable int : Type.{1} variable int : Type.{1}
variable add : int → int → int variable add : int → int → int
infixl + := add infixl + := add
@ -18,9 +18,9 @@ namespace int_coercions
coercion int.of_nat coercion int.of_nat
end int_coercions end int_coercions
-- Using "only" the notation and declarations from the namespaces nat and int -- Open "only" the notation and declarations from the namespaces nat and int
using nat open nat
using int open int
variables n m : nat variables n m : nat
variables i j : int variables i j : int
@ -29,10 +29,9 @@ check i + j
section section
-- Temporarily use the int_coercions -- Temporarily use the int_coercions
using int_coercions open int_coercions
check n + i check n + i
end end
-- The following one is an error -- The following one is an error
-- check n + i -- check n + i

View file

@ -6,7 +6,7 @@
import logic struc.function import logic struc.function
using function open function
namespace congruence namespace congruence
@ -65,4 +65,4 @@ iff_elim_left (@congr_app _ _ R iff P C a b H) H1
theorem test2 (a b c d e : Prop) (H1 : a ↔ b) (H2 : a c → ¬(d → a)) : b c → ¬(d → b) := theorem test2 (a b c d e : Prop) (H1 : a ↔ b) (H2 : a c → ¬(d → a)) : b c → ¬(d → b) :=
subst_iff H1 H2 subst_iff H1 H2
end congruence end congruence

View file

@ -1,5 +1,5 @@
import logic import logic
using num open num
variable p : num → num → num → Prop variable p : num → num → num → Prop
axiom H1 : ∃ x y z, p x y z axiom H1 : ∃ x y z, p x y z
axiom H2 : ∀ {x y z : num}, p x y z → p x x x axiom H2 : ∀ {x y z : num}, p x y z → p x x x

View file

@ -1,5 +1,5 @@
import logic import logic
using num tactic open num tactic
variable p : num → num → num → Prop variable p : num → num → num → Prop
axiom H1 : ∃ x y z, p x y z axiom H1 : ∃ x y z, p x y z
axiom H2 : ∀ {x y z : num}, p x y z → p x x x axiom H2 : ∀ {x y z : num}, p x y z → p x x x

View file

@ -2,8 +2,8 @@ import logic
namespace foo namespace foo
variable x : num.num variable x : num.num
check x check x
using num open num
check x check x
set_option pp.full_names true set_option pp.full_names true
check x check x
end foo end foo

View file

@ -1,5 +1,5 @@
import logic struc.function import logic struc.function
using function num bool open function num bool
variable f : num → bool variable f : num → bool

View file

@ -1,5 +1,5 @@
import logic import logic
using tactic open tactic
theorem T {a b c d : Prop} (H : a) (H : b) (H : c) (H : d) : a theorem T {a b c d : Prop} (H : a) (H : b) (H : c) (H : d) : a
:= by state; assumption := by state; assumption

View file

@ -1,5 +1,5 @@
import logic import logic
using num open num
section section
parameter {A : Type} parameter {A : Type}

View file

@ -1,5 +1,5 @@
import logic import logic
using num open num
section section
parameter {A : Type} parameter {A : Type}

View file

@ -1,5 +1,5 @@
import logic import logic
using tactic open tactic
variables a b c d : Prop variables a b c d : Prop
axiom Ha : a axiom Ha : a
axiom Hb : b axiom Hb : b
@ -9,4 +9,4 @@ print raw
then have H2 : b, by assumption, then have H2 : b, by assumption,
have H3 : c, by assumption, have H3 : c, by assumption,
then have H4 : d, by assumption, then have H4 : d, by assumption,
H4 H4

View file

@ -1,5 +1,5 @@
import logic import logic
using tactic open tactic
inductive list (A : Type) : Type := inductive list (A : Type) : Type :=
nil {} : list A, nil {} : list A,

View file

@ -10,7 +10,7 @@
-- Basic properties of lists. -- Basic properties of lists.
import data.nat import data.nat
using nat eq_ops open nat eq_ops
inductive list (T : Type) : Type := inductive list (T : Type) : Type :=
nil {} : list T, nil {} : list T,
cons : T → list T → list T cons : T → list T → list T

View file

@ -15,10 +15,8 @@ end bla
variable g : N → N → N variable g : N → N → N
using foo open foo
using bla open bla
print raw a + b -- + is overloaded, it creates a choice print raw a + b -- + is overloaded, it creates a choice
print raw #foo a + b -- + is not overloaded, we are parsing inside #foo print raw #foo a + b -- + is not overloaded, we are parsing inside #foo
print raw g (#foo a + b) (#bla a + b) -- mixing both print raw g (#foo a + b) (#bla a + b) -- mixing both

View file

@ -1,5 +1,5 @@
import data.nat import data.nat
using nat open nat
definition two1 : nat := 2 definition two1 : nat := 2
definition two2 : nat := succ (succ (zero)) definition two2 : nat := succ (succ (zero))

View file

@ -1,5 +1,5 @@
import data.nat import data.nat
using nat open nat
definition two1 : nat := 2 definition two1 : nat := 2
definition two2 : nat := succ (succ (zero)) definition two2 : nat := succ (succ (zero))

View file

@ -1,5 +1,5 @@
import logic import logic
using decidable open decidable
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,

View file

@ -1,5 +1,5 @@
import logic import logic
using num eq_ops open num eq_ops
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,

View file

@ -1,5 +1,5 @@
import logic import logic
using num eq_ops open num eq_ops
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,

View file

@ -1,5 +1,5 @@
import logic import logic
using num eq_ops open num eq_ops
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,

View file

@ -1,5 +1,5 @@
import logic import logic
using num eq_ops open num eq_ops
inductive nat : Type := inductive nat : Type :=
zero : nat, zero : nat,

Some files were not shown because too many files have changed in this diff Show more