feat(frontends/lean): rename command Set to SetOption
It is not nice to have Set as a reserved keyword. See example examples/lean/set.lean Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
d7886c4f5f
commit
dd72269b13
49 changed files with 111 additions and 111 deletions
|
@ -30,6 +30,6 @@ Theorem T2 : (h a (h a b)) = (h a (h c e)) :=
|
||||||
Show Environment 2
|
Show Environment 2
|
||||||
|
|
||||||
(* Show implicit arguments *)
|
(* Show implicit arguments *)
|
||||||
Set lean::pp::implicit true
|
SetOption lean::pp::implicit true
|
||||||
Set pp::width 150
|
SetOption pp::width 150
|
||||||
Show Environment 2
|
Show Environment 2
|
||||||
|
|
|
@ -5,7 +5,7 @@ Theorem simple (p q r : Bool) : (p ⇒ q) ∧ (q ⇒ r) ⇒ p ⇒ r :=
|
||||||
P_q := MP P_pq H_p
|
P_q := MP P_pq H_p
|
||||||
in MP P_qr P_q))
|
in MP P_qr P_q))
|
||||||
|
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Show Environment 1
|
Show Environment 1
|
||||||
|
|
||||||
Theorem simple2 (a b c : Bool) : (a ⇒ b ⇒ c) ⇒ (a ⇒ b) ⇒ a ⇒ c :=
|
Theorem simple2 (a b c : Bool) : (a ⇒ b ⇒ c) ⇒ (a ⇒ b) ⇒ a ⇒ c :=
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
Definition set (A : Type) : Type := A -> Bool
|
Definition Set (A : Type) : Type := A -> Bool
|
||||||
|
|
||||||
Definition element {A : Type} (x : A) (s : set A) := s x
|
Definition element {A : Type} (x : A) (s : Set A) := s x
|
||||||
Infix 60 ∈ : element
|
Infix 60 ∈ : element
|
||||||
|
|
||||||
Definition subset {A : Type} (s1 : set A) (s2 : set A) := ∀ x, x ∈ s1 ⇒ x ∈ s2
|
Definition subset {A : Type} (s1 : Set A) (s2 : Set A) := ∀ x, x ∈ s1 ⇒ x ∈ s2
|
||||||
Infix 50 ⊆ : subset
|
Infix 50 ⊆ : subset
|
||||||
|
|
||||||
Theorem SubsetProp {A : Type} {s1 s2 : set A} {x : A} (H1 : s1 ⊆ s2) (H2 : x ∈ s1) : x ∈ s2 :=
|
Theorem SubsetProp {A : Type} {s1 s2 : Set A} {x : A} (H1 : s1 ⊆ s2) (H2 : x ∈ s1) : x ∈ s2 :=
|
||||||
MP (ForallElim H1 x) H2
|
MP (ForallElim H1 x) H2
|
||||||
|
|
||||||
Theorem SubsetTrans {A : Type} {s1 s2 s3 : set A} (H1 : s1 ⊆ s2) (H2 : s2 ⊆ s3) : s1 ⊆ s3 :=
|
Theorem SubsetTrans {A : Type} {s1 s2 s3 : Set A} (H1 : s1 ⊆ s2) (H2 : s2 ⊆ s3) : s1 ⊆ s3 :=
|
||||||
ForallIntro (λ x,
|
ForallIntro (λ x,
|
||||||
Discharge (λ Hin : x ∈ s1,
|
Discharge (λ Hin : x ∈ s1,
|
||||||
let L1 : x ∈ s2 := SubsetProp H1 Hin,
|
let L1 : x ∈ s2 := SubsetProp H1 Hin,
|
||||||
|
@ -23,8 +23,8 @@ Theorem SubsetTrans2 {A : Type} : transitive (subset::explicit A) :=
|
||||||
Discharge (λ H1, (Discharge (λ H2,
|
Discharge (λ H1, (Discharge (λ H2,
|
||||||
SubsetTrans H1 H2)))))).
|
SubsetTrans H1 H2)))))).
|
||||||
|
|
||||||
Theorem SubsetRefl {A : Type} (s : set A) : s ⊆ s :=
|
Theorem SubsetRefl {A : Type} (s : Set A) : s ⊆ s :=
|
||||||
ForallIntro (λ x, Discharge (λ H : x ∈ s, H))
|
ForallIntro (λ x, Discharge (λ H : x ∈ s, H))
|
||||||
|
|
||||||
Definition union {A : Type} (s1 : set A) (s2 : set A) := λ x, x ∈ s1 ∨ x ∈ s2
|
Definition union {A : Type} (s1 : Set A) (s2 : Set A) := λ x, x ∈ s1 ∨ x ∈ s2
|
||||||
Infix 55 ∪ : union
|
Infix 55 ∪ : union
|
||||||
|
|
|
@ -90,7 +90,7 @@ static name g_infixl_kwd("Infixl");
|
||||||
static name g_infixr_kwd("Infixr");
|
static name g_infixr_kwd("Infixr");
|
||||||
static name g_notation_kwd("Notation");
|
static name g_notation_kwd("Notation");
|
||||||
static name g_echo_kwd("Echo");
|
static name g_echo_kwd("Echo");
|
||||||
static name g_set_kwd("Set");
|
static name g_set_kwd("SetOption");
|
||||||
static name g_options_kwd("Options");
|
static name g_options_kwd("Options");
|
||||||
static name g_env_kwd("Environment");
|
static name g_env_kwd("Environment");
|
||||||
static name g_import_kwd("Import");
|
static name g_import_kwd("Import");
|
||||||
|
@ -1958,7 +1958,7 @@ class parser::imp {
|
||||||
regular(m_io_state) << msg << endl;
|
regular(m_io_state) << msg << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Parse 'Set' [id] [value] */
|
/** Parse 'SetOption' [id] [value] */
|
||||||
void parse_set() {
|
void parse_set() {
|
||||||
next();
|
next();
|
||||||
auto id_pos = pos();
|
auto id_pos = pos();
|
||||||
|
@ -2065,7 +2065,7 @@ class parser::imp {
|
||||||
<< " Push create a scope (it is just an alias for the command Scope)" << endl
|
<< " Push create a scope (it is just an alias for the command Scope)" << endl
|
||||||
<< " Pop discard the current scope" << endl
|
<< " Pop discard the current scope" << endl
|
||||||
<< " Scope create a scope" << endl
|
<< " Scope create a scope" << endl
|
||||||
<< " Set [id] [value] set option [id] with value [value]" << endl
|
<< " SetOption [id] [value] set option [id] with value [value]" << endl
|
||||||
<< " Show [expr] pretty print the given expression" << endl
|
<< " Show [expr] pretty print the given expression" << endl
|
||||||
<< " Show Options show current the set of assigned options" << endl
|
<< " Show Options show current the set of assigned options" << endl
|
||||||
<< " Show Environment show objects in the environment, if [Num] provided, then show only the last [Num] objects" << endl
|
<< " Show Environment show objects in the environment, if [Num] provided, then show only the last [Num] objects" << endl
|
||||||
|
|
|
@ -93,11 +93,11 @@ static void tst3() {
|
||||||
parse_error(env, ios, "Check U");
|
parse_error(env, ios, "Check U");
|
||||||
parse(env, ios, "Variable h : Real -> Real -> Real. Notation 10 [ _ ; _ ] : h. Check [ 10.3 ; 20.1 ].");
|
parse(env, ios, "Variable h : Real -> Real -> Real. Notation 10 [ _ ; _ ] : h. Check [ 10.3 ; 20.1 ].");
|
||||||
parse_error(env, ios, "Variable h : Real -> Real -> Real. Notation 10 [ _ ; _ ] : h. Check [ 10.3 | 20.1 ].");
|
parse_error(env, ios, "Variable h : Real -> Real -> Real. Notation 10 [ _ ; _ ] : h. Check [ 10.3 | 20.1 ].");
|
||||||
parse_error(env, ios, "Set pp::indent true");
|
parse_error(env, ios, "SetOption pp::indent true");
|
||||||
parse(env, ios, "Set pp::indent 10");
|
parse(env, ios, "SetOption pp::indent 10");
|
||||||
parse_error(env, ios, "Set pp::colors foo");
|
parse_error(env, ios, "SetOption pp::colors foo");
|
||||||
parse_error(env, ios, "Set pp::colors \"foo\"");
|
parse_error(env, ios, "SetOption pp::colors \"foo\"");
|
||||||
parse(env, ios, "Set pp::colors true");
|
parse(env, ios, "SetOption pp::colors true");
|
||||||
parse_error(env, ios, "Notation 10 : Int::add");
|
parse_error(env, ios, "Notation 10 : Int::add");
|
||||||
parse_error(env, ios, "Notation 10 _ : Int::add");
|
parse_error(env, ios, "Notation 10 _ : Int::add");
|
||||||
parse(env, ios, "Notation 10 _ ++ _ : Int::add. Eval 10 ++ 20.");
|
parse(env, ios, "Notation 10 _ ++ _ : Int::add. Eval 10 ++ 20.");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Axiom PlusComm(a b : Int) : a + b == b + a.
|
Axiom PlusComm(a b : Int) : a + b == b + a.
|
||||||
Variable a : Int.
|
Variable a : Int.
|
||||||
Check (Abst (fun x : Int, (PlusComm a x))).
|
Check (Abst (fun x : Int, (PlusComm a x))).
|
||||||
Set pp::implicit true.
|
SetOption pp::implicit true.
|
||||||
Check (Abst (fun x : Int, (PlusComm a x))).
|
Check (Abst (fun x : Int, (PlusComm a x))).
|
||||||
|
|
|
@ -9,9 +9,9 @@ Variable n : Nat
|
||||||
Variable m : Nat
|
Variable m : Nat
|
||||||
Show n + m
|
Show n + m
|
||||||
Show n + x + m
|
Show n + x + m
|
||||||
Set lean::pp::coercion true
|
SetOption lean::pp::coercion true
|
||||||
Show n + x + m + 10
|
Show n + x + m + 10
|
||||||
Show x + n + m + 10
|
Show x + n + m + 10
|
||||||
Show n + m + 10 + x
|
Show n + m + 10 + x
|
||||||
Set lean::pp::notation false
|
SetOption lean::pp::notation false
|
||||||
Show n + m + 10 + x
|
Show n + m + 10 + x
|
||||||
|
|
|
@ -5,7 +5,7 @@ Variable x : Real
|
||||||
Variable i : Int
|
Variable i : Int
|
||||||
Variable n : Nat
|
Variable n : Nat
|
||||||
Show x + i + 1 + n
|
Show x + i + 1 + n
|
||||||
Set lean::pp::coercion true
|
SetOption lean::pp::coercion true
|
||||||
Show x + i + 1 + n
|
Show x + i + 1 + n
|
||||||
Show x * i + x
|
Show x * i + x
|
||||||
Show x - i + x - x >= 0
|
Show x - i + x - x >= 0
|
||||||
|
|
|
@ -3,7 +3,7 @@ Eval 8 div 4
|
||||||
Eval 7 div 3
|
Eval 7 div 3
|
||||||
Eval 7 mod 3
|
Eval 7 mod 3
|
||||||
Show -8 mod 3
|
Show -8 mod 3
|
||||||
Set lean::pp::notation false
|
SetOption lean::pp::notation false
|
||||||
Show -8 mod 3
|
Show -8 mod 3
|
||||||
Eval -8 mod 3
|
Eval -8 mod 3
|
||||||
Eval (-8 div 3)*3 + (-8 mod 3)
|
Eval (-8 div 3)*3 + (-8 mod 3)
|
|
@ -1,4 +1,4 @@
|
||||||
Set pp::unicode false
|
SetOption pp::unicode false
|
||||||
Show 3 | 6
|
Show 3 | 6
|
||||||
Eval 3 | 6
|
Eval 3 | 6
|
||||||
Eval 3 | 7
|
Eval 3 | 7
|
||||||
|
@ -8,5 +8,5 @@ Variable x : Int
|
||||||
Eval x | 3
|
Eval x | 3
|
||||||
Eval 3 | x
|
Eval 3 | x
|
||||||
Eval 6 | 3
|
Eval 6 | 3
|
||||||
Set pp::notation false
|
SetOption pp::notation false
|
||||||
Show 3 | x
|
Show 3 | x
|
|
@ -11,6 +11,6 @@ Eval |x + 1| > 0
|
||||||
Variable y : Int
|
Variable y : Int
|
||||||
Eval |x + y|
|
Eval |x + y|
|
||||||
Show |x + y| > x
|
Show |x + y| > x
|
||||||
Set pp::notation false
|
SetOption pp::notation false
|
||||||
Show |x + y| > x
|
Show |x + y| > x
|
||||||
Show |x + y| + |y + x| > x
|
Show |x + y| + |y + x| > x
|
|
@ -7,6 +7,6 @@ Definition n3 : list Int := cons 10 nil
|
||||||
Definition n4 : list Int := nil
|
Definition n4 : list Int := nil
|
||||||
Definition n5 : _ := cons 10 nil
|
Definition n5 : _ := cons 10 nil
|
||||||
|
|
||||||
Set pp::coercion true
|
SetOption pp::coercion true
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Show Environment 1.
|
Show Environment 1.
|
|
@ -6,6 +6,6 @@ Axiom H : (A -> B) = (A' -> B')
|
||||||
Variable a : A
|
Variable a : A
|
||||||
Check DomInj H
|
Check DomInj H
|
||||||
Theorem BeqB' : B = B' := RanInj H a
|
Theorem BeqB' : B = B' := RanInj H a
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Show DomInj H
|
Show DomInj H
|
||||||
Show RanInj H a
|
Show RanInj H a
|
||||||
|
|
|
@ -8,25 +8,25 @@ Show g a a
|
||||||
Variable b : R
|
Variable b : R
|
||||||
Show g a b
|
Show g a b
|
||||||
Show g b a
|
Show g b a
|
||||||
Set lean::pp::coercion true
|
SetOption lean::pp::coercion true
|
||||||
Show g a a
|
Show g a a
|
||||||
Show g a b
|
Show g a b
|
||||||
Show g b a
|
Show g b a
|
||||||
Set lean::pp::coercion false
|
SetOption lean::pp::coercion false
|
||||||
Variable S : Type
|
Variable S : Type
|
||||||
Variable s : S
|
Variable s : S
|
||||||
Variable r : S
|
Variable r : S
|
||||||
Variable h : S -> S -> S
|
Variable h : S -> S -> S
|
||||||
Infixl 10 ++ : g
|
Infixl 10 ++ : g
|
||||||
Infixl 10 ++ : h
|
Infixl 10 ++ : h
|
||||||
Set lean::pp::notation false
|
SetOption lean::pp::notation false
|
||||||
Show a ++ b ++ a
|
Show a ++ b ++ a
|
||||||
Show r ++ s ++ r
|
Show r ++ s ++ r
|
||||||
Check a ++ b ++ a
|
Check a ++ b ++ a
|
||||||
Check r ++ s ++ r
|
Check r ++ s ++ r
|
||||||
Set lean::pp::coercion true
|
SetOption lean::pp::coercion true
|
||||||
Show a ++ b ++ a
|
Show a ++ b ++ a
|
||||||
Show r ++ s ++ r
|
Show r ++ s ++ r
|
||||||
Set lean::pp::notation true
|
SetOption lean::pp::notation true
|
||||||
Show a ++ b ++ a
|
Show a ++ b ++ a
|
||||||
Show r ++ s ++ r
|
Show r ++ s ++ r
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
(* Set default configuration for tests *)
|
(* SetOption default configuration for tests *)
|
||||||
Set pp::colors false
|
SetOption pp::colors false
|
||||||
Set pp::unicode true
|
SetOption pp::unicode true
|
||||||
|
|
|
@ -8,5 +8,5 @@ Variable R {A A' : Type} {B : A -> Type} {B' : A' -> Type} (H : (Pi x : A, B x)
|
||||||
Theorem R2 : Pi (A1 A2 B1 B2 : Type) (H : (A1 -> B1) = (A2 -> B2)) (a : A1), B1 = B2 :=
|
Theorem R2 : Pi (A1 A2 B1 B2 : Type) (H : (A1 -> B1) = (A2 -> B2)) (a : A1), B1 = B2 :=
|
||||||
fun A1 A2 B1 B2 H a, R H a
|
fun A1 A2 B1 B2 H a, R H a
|
||||||
|
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Show Environment 7.
|
Show Environment 7.
|
||||||
|
|
|
@ -8,5 +8,5 @@ Variable R {A A' : Type} {B : A -> Type} {B' : A' -> Type} (H : (Pi x : A, B x)
|
||||||
Theorem R2 : Pi (A1 A2 B1 B2 : Type), ((A1 -> B1) = (A2 -> B2)) -> A1 -> (B1 = B2) :=
|
Theorem R2 : Pi (A1 A2 B1 B2 : Type), ((A1 -> B1) = (A2 -> B2)) -> A1 -> (B1 = B2) :=
|
||||||
fun A1 A2 B1 B2 H a, R H a
|
fun A1 A2 B1 B2 H a, R H a
|
||||||
|
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Show Environment 7.
|
Show Environment 7.
|
||||||
|
|
|
@ -19,5 +19,5 @@ Theorem T2 : (fun (x1 : A) (x2 : B), F1 x1 x2) = F2 := Abst (fun a, (Abst (fun b
|
||||||
Theorem T3 : F1 = (fun (x1 : A) (x2 : B), F2 x1 x2) := Abst (fun a, (Abst (fun b, H a b)))
|
Theorem T3 : F1 = (fun (x1 : A) (x2 : B), F2 x1 x2) := Abst (fun a, (Abst (fun b, H a b)))
|
||||||
Theorem T4 : (fun (x1 : A) (x2 : B), F1 x1 x2) = (fun (x1 : A) (x2 : B), F2 x1 x2) := Abst (fun a, (Abst (fun b, H a b)))
|
Theorem T4 : (fun (x1 : A) (x2 : B), F1 x1 x2) = (fun (x1 : A) (x2 : B), F2 x1 x2) := Abst (fun a, (Abst (fun b, H a b)))
|
||||||
Show Environment 4
|
Show Environment 4
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Show Environment 4
|
Show Environment 4
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
Variable i : Int
|
Variable i : Int
|
||||||
Check i = 0
|
Check i = 0
|
||||||
Set pp::coercion true
|
SetOption pp::coercion true
|
||||||
Check i = 0
|
Check i = 0
|
||||||
|
|
|
@ -3,5 +3,5 @@ Variable nil {A : Type} : List A
|
||||||
Variable cons {A : Type} (head : A) (tail : List A) : List A
|
Variable cons {A : Type} (head : A) (tail : List A) : List A
|
||||||
Variable l : List Int.
|
Variable l : List Int.
|
||||||
Check l = nil.
|
Check l = nil.
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Check l = nil.
|
Check l = nil.
|
||||||
|
|
|
@ -8,5 +8,5 @@ Variable v3 : Vector (0 + n)
|
||||||
Axiom H1 : v1 == v2
|
Axiom H1 : v1 == v2
|
||||||
Axiom H2 : v2 == v3
|
Axiom H2 : v2 == v3
|
||||||
Check TransExt H1 H2
|
Check TransExt H1 H2
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Check TransExt H1 H2
|
Check TransExt H1 H2
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
(* comment *)
|
(* comment *)
|
||||||
(* (* nested comment *) *)
|
(* (* nested comment *) *)
|
||||||
Show true
|
Show true
|
||||||
Set lean::pp::notation false
|
SetOption lean::pp::notation false
|
||||||
Show true && false
|
Show true && false
|
||||||
Set pp::unicode false
|
SetOption pp::unicode false
|
||||||
Show true && false
|
Show true && false
|
||||||
Variable a : Bool
|
Variable a : Bool
|
||||||
Variable a : Bool
|
Variable a : Bool
|
||||||
|
@ -13,7 +13,7 @@ Variable A : Type
|
||||||
Check a && A
|
Check a && A
|
||||||
Show Environment 1
|
Show Environment 1
|
||||||
Show Options
|
Show Options
|
||||||
Set lean::p::notation true
|
SetOption lean::p::notation true
|
||||||
Set lean::pp::notation 10
|
SetOption lean::pp::notation 10
|
||||||
Set lean::pp::notation true
|
SetOption lean::pp::notation true
|
||||||
Show a && b
|
Show a && b
|
||||||
|
|
|
@ -19,7 +19,7 @@ Arguments types:
|
||||||
A : Type
|
A : Type
|
||||||
Variable A : Type
|
Variable A : Type
|
||||||
(lean::pp::notation := false, pp::unicode := false, pp::colors := false)
|
(lean::pp::notation := false, pp::unicode := false, pp::colors := false)
|
||||||
Error (line: 16, pos: 4) unknown option 'lean::p::notation', type 'Help Options.' for list of available options
|
Error (line: 16, pos: 10) unknown option 'lean::p::notation', type 'Help Options.' for list of available options
|
||||||
Error (line: 17, pos: 23) invalid option value, given option is not an integer
|
Error (line: 17, pos: 29) invalid option value, given option is not an integer
|
||||||
Set: lean::pp::notation
|
Set: lean::pp::notation
|
||||||
a /\ b
|
a /\ b
|
||||||
|
|
|
@ -5,5 +5,5 @@ Variable a : T
|
||||||
Check myeq _ true a
|
Check myeq _ true a
|
||||||
Variable myeq2 {A:Type} (a b : A) : Bool
|
Variable myeq2 {A:Type} (a b : A) : Bool
|
||||||
Infix 50 === : myeq2
|
Infix 50 === : myeq2
|
||||||
Set lean::pp::implicit true
|
SetOption lean::pp::implicit true
|
||||||
Check true === a
|
Check true === a
|
|
@ -4,7 +4,7 @@ Show forall a b, f a b > 0
|
||||||
Variable g : Int -> Real -> Int
|
Variable g : Int -> Real -> Int
|
||||||
Show forall a b, g a b > 0
|
Show forall a b, g a b > 0
|
||||||
Show forall a b, g a (f a b) > 0
|
Show forall a b, g a (f a b) > 0
|
||||||
Set pp::coercion true
|
SetOption pp::coercion true
|
||||||
Show forall a b, g a (f a b) > 0
|
Show forall a b, g a (f a b) > 0
|
||||||
Show fun a, a + 1
|
Show fun a, a + 1
|
||||||
Show fun a b, a + b
|
Show fun a b, a + b
|
||||||
|
|
|
@ -7,6 +7,6 @@ Check g 10 20 true
|
||||||
Check let r : Real -> Real -> Real := g 10 20
|
Check let r : Real -> Real -> Real := g 10 20
|
||||||
in r
|
in r
|
||||||
Check g 10
|
Check g 10
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Check let r : Real -> Real -> Real := g 10 20
|
Check let r : Real -> Real -> Real := g 10 20
|
||||||
in r
|
in r
|
||||||
|
|
|
@ -3,7 +3,7 @@ Variable f : Int -> Int -> Int
|
||||||
Variable g : Int -> Int -> Int -> Int
|
Variable g : Int -> Int -> Int -> Int
|
||||||
Notation 10 _ ++ _ : f
|
Notation 10 _ ++ _ : f
|
||||||
Notation 10 _ ++ _ : g
|
Notation 10 _ ++ _ : g
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Set pp::notation false
|
SetOption pp::notation false
|
||||||
Show (10 ++ 20)
|
Show (10 ++ 20)
|
||||||
Show (10 ++ 20) 10
|
Show (10 ++ 20) 10
|
||||||
|
|
|
@ -3,8 +3,8 @@ Infixl 65 + : f
|
||||||
Show true + false
|
Show true + false
|
||||||
Show 10 + 20
|
Show 10 + 20
|
||||||
Show 10 + (- 20)
|
Show 10 + (- 20)
|
||||||
Set pp::notation false
|
SetOption pp::notation false
|
||||||
Set pp::coercion true
|
SetOption pp::coercion true
|
||||||
Show true + false
|
Show true + false
|
||||||
Show 10 + 20
|
Show 10 + 20
|
||||||
Show 10 + (- 20)
|
Show 10 + (- 20)
|
||||||
|
|
|
@ -10,9 +10,9 @@ Notation 100 _ ; _ ; _ : f
|
||||||
Notation 100 _ ; _ ; _ : g
|
Notation 100 _ ; _ ; _ : g
|
||||||
Check 10 ; true ; false
|
Check 10 ; true ; false
|
||||||
Check 10 ; 10 ; true
|
Check 10 ; 10 ; true
|
||||||
Set pp::notation false
|
SetOption pp::notation false
|
||||||
Check 10 ; true ; false
|
Check 10 ; true ; false
|
||||||
Check 10 ; 10 ; true
|
Check 10 ; 10 ; true
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Check 10 ; true ; false
|
Check 10 ; true ; false
|
||||||
Check 10 ; 10 ; true
|
Check 10 ; 10 ; true
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
(* Set default configuration for tests *)
|
(* SetOption default configuration for tests *)
|
||||||
Set pp::colors false
|
SetOption pp::colors false
|
||||||
Set pp::unicode true
|
SetOption pp::unicode true
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
Set tactic::proof_state::goal_names true.
|
SetOption tactic::proof_state::goal_names true.
|
||||||
Theorem T (a : Bool) : a => a /\ a.
|
Theorem T (a : Bool) : a => a /\ a.
|
||||||
apply imp_tac.
|
apply imp_tac.
|
||||||
apply Conj.
|
apply Conj.
|
||||||
|
|
|
@ -5,7 +5,7 @@ Check let a : Nat := 10 in a + 1
|
||||||
Eval let a : Nat := 20 in a + 10
|
Eval let a : Nat := 20 in a + 10
|
||||||
Eval let a := 20 in a + 10
|
Eval let a := 20 in a + 10
|
||||||
Check let a : Int := 20 in a + 10
|
Check let a : Int := 20 in a + 10
|
||||||
Set pp::coercion true
|
SetOption pp::coercion true
|
||||||
Show let a : Int := 20 in a + 10
|
Show let a : Int := 20 in a + 10
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
Variable magic : Pi (H : Bool), H
|
Variable magic : Pi (H : Bool), H
|
||||||
|
|
||||||
Set pp::notation false
|
SetOption pp::notation false
|
||||||
Set pp::coercion true
|
SetOption pp::coercion true
|
||||||
Show let a : Int := 1,
|
Show let a : Int := 1,
|
||||||
H : a > 0 := magic (a > 0)
|
H : a > 0 := magic (a > 0)
|
||||||
in H
|
in H
|
|
@ -40,7 +40,7 @@ let a := 10,
|
||||||
v2 : vector Int a := v1
|
v2 : vector Int a := v1
|
||||||
in v2
|
in v2
|
||||||
|
|
||||||
Set pp::coercion true
|
SetOption pp::coercion true
|
||||||
|
|
||||||
Show
|
Show
|
||||||
let a := 10,
|
let a := 10,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Variable x : Int
|
Variable x : Int
|
||||||
Set pp::notation false
|
SetOption pp::notation false
|
||||||
(**
|
(**
|
||||||
print(get_options())
|
print(get_options())
|
||||||
**)
|
**)
|
||||||
|
|
|
@ -4,7 +4,7 @@ Variable g : N -> N -> N
|
||||||
Infixl 10 ++ : f
|
Infixl 10 ++ : f
|
||||||
Infixl 10 ++ : g
|
Infixl 10 ++ : g
|
||||||
Show true ++ false ++ true
|
Show true ++ false ++ true
|
||||||
Set lean::pp::notation false
|
SetOption lean::pp::notation false
|
||||||
Show true ++ false ++ true
|
Show true ++ false ++ true
|
||||||
Variable a : N
|
Variable a : N
|
||||||
Variable b : N
|
Variable b : N
|
||||||
|
|
|
@ -8,8 +8,8 @@ Coercion t2r
|
||||||
Variable f : T -> R -> T
|
Variable f : T -> R -> T
|
||||||
Variable a : T
|
Variable a : T
|
||||||
Variable b : R
|
Variable b : R
|
||||||
Set lean::pp::coercion true
|
SetOption lean::pp::coercion true
|
||||||
Set lean::pp::notation false
|
SetOption lean::pp::notation false
|
||||||
Show f a b
|
Show f a b
|
||||||
Show f b a
|
Show f b a
|
||||||
Variable g : R -> T -> R
|
Variable g : R -> T -> R
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
(* Set default configuration for tests *)
|
(* SetOption default configuration for tests *)
|
||||||
Set pp::colors false
|
SetOption pp::colors false
|
||||||
Set pp::unicode true
|
SetOption pp::unicode true
|
||||||
|
|
|
@ -2,6 +2,6 @@ Definition f1 (f : Int -> Int) (x : Int) : Int := f (f (f (f x)))
|
||||||
Definition f2 (f : Int -> Int) (x : Int) : Int := f1 (f1 (f1 (f1 f))) x
|
Definition f2 (f : Int -> Int) (x : Int) : Int := f1 (f1 (f1 (f1 f))) x
|
||||||
Definition f3 (f : Int -> Int) (x : Int) : Int := f1 (f2 (f2 f)) x
|
Definition f3 (f : Int -> Int) (x : Int) : Int := f1 (f2 (f2 f)) x
|
||||||
Variable f : Int -> Int.
|
Variable f : Int -> Int.
|
||||||
Set pp::width 80.
|
SetOption pp::width 80.
|
||||||
Set lean::pp::max_depth 2000.
|
SetOption lean::pp::max_depth 2000.
|
||||||
Eval f3 f 0.
|
Eval f3 f 0.
|
|
@ -3,7 +3,7 @@ Variable n : Nat
|
||||||
Axiom H1 : a + a + a = 10
|
Axiom H1 : a + a + a = 10
|
||||||
Axiom H2 : a = n
|
Axiom H2 : a = n
|
||||||
Theorem T : a + n + a = 10 := Subst H1 H2
|
Theorem T : a + n + a = 10 := Subst H1 H2
|
||||||
Set pp::coercion true
|
SetOption pp::coercion true
|
||||||
Set pp::notation false
|
SetOption pp::notation false
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
Show Environment 1.
|
Show Environment 1.
|
||||||
|
|
|
@ -23,7 +23,7 @@ Theorem VectorPlus0 (A : Type U) (n : Nat) : (Vector A (n + 0)) === (Vector A n)
|
||||||
EqSubst (fun x : Nat, (Vector A x) === (Vector A n))
|
EqSubst (fun x : Nat, (Vector A x) === (Vector A n))
|
||||||
(EqRefl (Vector A n))
|
(EqRefl (Vector A n))
|
||||||
(EqSymm (Plus0 n))
|
(EqSymm (Plus0 n))
|
||||||
Set pp::implicit true
|
SetOption pp::implicit true
|
||||||
(* Check fun (A : Type) (n : Nat), VectorPlus0 A n *)
|
(* Check fun (A : Type) (n : Nat), VectorPlus0 A n *)
|
||||||
Axiom AppendNil {A : Type} {n : Nat} (v : Vector A n) : (EqCast (VectorPlus0 A n) (append v empty)) === v
|
Axiom AppendNil {A : Type} {n : Nat} (v : Vector A n) : (EqCast (VectorPlus0 A n) (append v empty)) === v
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ Show Options
|
||||||
Variable a : Bool
|
Variable a : Bool
|
||||||
Variable b : Bool
|
Variable b : Bool
|
||||||
Show a/\b
|
Show a/\b
|
||||||
Set lean::pp::notation false
|
SetOption lean::pp::notation false
|
||||||
Show Options
|
Show Options
|
||||||
Show a/\b
|
Show a/\b
|
||||||
Show Environment 2
|
Show Environment 2
|
||||||
Set lean::pp::notation true
|
SetOption lean::pp::notation true
|
||||||
Show Options
|
Show Options
|
||||||
Show a/\b
|
Show a/\b
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
Set lean::parser::verbose false.
|
SetOption lean::parser::verbose false.
|
||||||
Notation 10 if _ then _ : implies.
|
Notation 10 if _ then _ : implies.
|
||||||
Show Environment 1.
|
Show Environment 1.
|
||||||
Show if true then false.
|
Show if true then false.
|
||||||
Variable a : Bool.
|
Variable a : Bool.
|
||||||
Show if true then if a then false.
|
Show if true then if a then false.
|
||||||
Set lean::pp::notation false.
|
SetOption lean::pp::notation false.
|
||||||
Show if true then if a then false.
|
Show if true then if a then false.
|
||||||
Variable A : Type.
|
Variable A : Type.
|
||||||
Variable f : A -> A -> A -> Bool.
|
Variable f : A -> A -> A -> Bool.
|
||||||
|
@ -14,29 +14,29 @@ Variable c : A.
|
||||||
Variable d : A.
|
Variable d : A.
|
||||||
Variable e : A.
|
Variable e : A.
|
||||||
Show c |- d ; e.
|
Show c |- d ; e.
|
||||||
Set lean::pp::notation true.
|
SetOption lean::pp::notation true.
|
||||||
Show c |- d ; e.
|
Show c |- d ; e.
|
||||||
Variable fact : A -> A.
|
Variable fact : A -> A.
|
||||||
Notation 20 _ ! : fact.
|
Notation 20 _ ! : fact.
|
||||||
Show c! !.
|
Show c! !.
|
||||||
Set lean::pp::notation false.
|
SetOption lean::pp::notation false.
|
||||||
Show c! !.
|
Show c! !.
|
||||||
Set lean::pp::notation true.
|
SetOption lean::pp::notation true.
|
||||||
Variable g : A -> A -> A.
|
Variable g : A -> A -> A.
|
||||||
Notation 30 [ _ ; _ ] : g
|
Notation 30 [ _ ; _ ] : g
|
||||||
Show [c;d].
|
Show [c;d].
|
||||||
Show [c ; [d;e] ].
|
Show [c ; [d;e] ].
|
||||||
Set lean::pp::notation false.
|
SetOption lean::pp::notation false.
|
||||||
Show [c ; [d;e] ].
|
Show [c ; [d;e] ].
|
||||||
Set lean::pp::notation true.
|
SetOption lean::pp::notation true.
|
||||||
Variable h : A -> A -> A.
|
Variable h : A -> A -> A.
|
||||||
Notation 40 _ << _ end : h.
|
Notation 40 _ << _ end : h.
|
||||||
Show Environment 1.
|
Show Environment 1.
|
||||||
Show d << e end.
|
Show d << e end.
|
||||||
Show [c ; d << e end ].
|
Show [c ; d << e end ].
|
||||||
Set lean::pp::notation false.
|
SetOption lean::pp::notation false.
|
||||||
Show [c ; d << e end ].
|
Show [c ; d << e end ].
|
||||||
Set lean::pp::notation true.
|
SetOption lean::pp::notation true.
|
||||||
Variable r : A -> A -> A.
|
Variable r : A -> A -> A.
|
||||||
Infixl 30 ++ : r.
|
Infixl 30 ++ : r.
|
||||||
Variable s : A -> A -> A.
|
Variable s : A -> A -> A.
|
||||||
|
@ -46,13 +46,13 @@ Variable p1 : Bool.
|
||||||
Variable p2 : Bool.
|
Variable p2 : Bool.
|
||||||
Variable p3 : Bool.
|
Variable p3 : Bool.
|
||||||
Show p1 || p2 && p3.
|
Show p1 || p2 && p3.
|
||||||
Set lean::pp::notation false.
|
SetOption lean::pp::notation false.
|
||||||
Show c ** d ++ e ** c.
|
Show c ** d ++ e ** c.
|
||||||
Show p1 || p2 && p3.
|
Show p1 || p2 && p3.
|
||||||
Set lean::pp::notation true.
|
SetOption lean::pp::notation true.
|
||||||
Show c = d || d = c.
|
Show c = d || d = c.
|
||||||
Show not p1 || p2.
|
Show not p1 || p2.
|
||||||
Show p1 && p3 || p2 && p3.
|
Show p1 && p3 || p2 && p3.
|
||||||
Set lean::pp::notation false.
|
SetOption lean::pp::notation false.
|
||||||
Show not p1 || p2.
|
Show not p1 || p2.
|
||||||
Show p1 && p3 || p2 && p3.
|
Show p1 && p3 || p2 && p3.
|
||||||
|
|
|
@ -2,7 +2,7 @@ Variable f {A : Type} (a b : A) : A
|
||||||
Variable N : Type
|
Variable N : Type
|
||||||
Variable n1 : N
|
Variable n1 : N
|
||||||
Variable n2 : N
|
Variable n2 : N
|
||||||
Set lean::pp::implicit true
|
SetOption lean::pp::implicit true
|
||||||
Show f n1 n2
|
Show f n1 n2
|
||||||
Show f (fun x : N -> N, x) (fun y : _, y)
|
Show f (fun x : N -> N, x) (fun y : _, y)
|
||||||
Variable EqNice {A : Type} (lhs rhs : A) : Bool
|
Variable EqNice {A : Type} (lhs rhs : A) : Bool
|
||||||
|
|
|
@ -3,7 +3,7 @@ Variable a : N
|
||||||
Variable b : N
|
Variable b : N
|
||||||
Show a = b
|
Show a = b
|
||||||
Check a = b
|
Check a = b
|
||||||
Set lean::pp::implicit true
|
SetOption lean::pp::implicit true
|
||||||
Show a = b
|
Show a = b
|
||||||
Show (Type 1) = (Type 1)
|
Show (Type 1) = (Type 1)
|
||||||
Show true = false
|
Show true = false
|
||||||
|
|
|
@ -5,11 +5,11 @@ Theorem CongrH {a1 a2 b1 b2 : N} (H1 : a1 = b1) (H2 : a2 = b2) : (h a1 a2) = (h
|
||||||
Congr (Congr (Refl h) H1) H2
|
Congr (Congr (Refl h) H1) H2
|
||||||
|
|
||||||
(* Display the theorem showing implicit arguments *)
|
(* Display the theorem showing implicit arguments *)
|
||||||
Set lean::pp::implicit true
|
SetOption lean::pp::implicit true
|
||||||
Show Environment 2
|
Show Environment 2
|
||||||
|
|
||||||
(* Display the theorem hiding implicit arguments *)
|
(* Display the theorem hiding implicit arguments *)
|
||||||
Set lean::pp::implicit false
|
SetOption lean::pp::implicit false
|
||||||
Show Environment 2
|
Show Environment 2
|
||||||
|
|
||||||
Theorem Example1 (a b c d : N) (H: (a = b ∧ b = c) ∨ (a = d ∧ d = c)) : (h a b) = (h c b) :=
|
Theorem Example1 (a b c d : N) (H: (a = b ∧ b = c) ∨ (a = d ∧ d = c)) : (h a b) = (h c b) :=
|
||||||
|
@ -20,7 +20,7 @@ Theorem Example1 (a b c d : N) (H: (a = b ∧ b = c) ∨ (a = d ∧ d = c)) : (h
|
||||||
CongrH (Trans (Conjunct1 H1) (Conjunct2 H1)) (Refl b))
|
CongrH (Trans (Conjunct1 H1) (Conjunct2 H1)) (Refl b))
|
||||||
|
|
||||||
(* Show proof of the last theorem with all implicit arguments *)
|
(* Show proof of the last theorem with all implicit arguments *)
|
||||||
Set lean::pp::implicit true
|
SetOption lean::pp::implicit true
|
||||||
Show Environment 1
|
Show Environment 1
|
||||||
|
|
||||||
(* Using placeholders to hide the type of H1 *)
|
(* Using placeholders to hide the type of H1 *)
|
||||||
|
@ -31,7 +31,7 @@ Theorem Example2 (a b c d : N) (H: (a = b ∧ b = c) ∨ (a = d ∧ d = c)) : (h
|
||||||
(fun H1 : _,
|
(fun H1 : _,
|
||||||
CongrH (Trans (Conjunct1 H1) (Conjunct2 H1)) (Refl b))
|
CongrH (Trans (Conjunct1 H1) (Conjunct2 H1)) (Refl b))
|
||||||
|
|
||||||
Set lean::pp::implicit true
|
SetOption lean::pp::implicit true
|
||||||
Show Environment 1
|
Show Environment 1
|
||||||
|
|
||||||
(* Same example but the first conjuct has unnecessary stuff *)
|
(* Same example but the first conjuct has unnecessary stuff *)
|
||||||
|
@ -42,7 +42,7 @@ Theorem Example3 (a b c d e : N) (H: (a = b ∧ b = e ∧ b = c) ∨ (a = d ∧
|
||||||
(fun H1 : _,
|
(fun H1 : _,
|
||||||
CongrH (Trans (Conjunct1 H1) (Conjunct2 H1)) (Refl b))
|
CongrH (Trans (Conjunct1 H1) (Conjunct2 H1)) (Refl b))
|
||||||
|
|
||||||
Set lean::pp::implicit false
|
SetOption lean::pp::implicit false
|
||||||
Show Environment 1
|
Show Environment 1
|
||||||
|
|
||||||
Theorem Example4 (a b c d e : N) (H: (a = b ∧ b = e ∧ b = c) ∨ (a = d ∧ d = c)) : (h a c) = (h c a) :=
|
Theorem Example4 (a b c d e : N) (H: (a = b ∧ b = e ∧ b = c) ∨ (a = d ∧ d = c)) : (h a c) = (h c a) :=
|
||||||
|
@ -54,5 +54,5 @@ Theorem Example4 (a b c d e : N) (H: (a = b ∧ b = e ∧ b = c) ∨ (a = d ∧
|
||||||
let AeqC := Trans (Conjunct1 H1) (Conjunct2 H1)
|
let AeqC := Trans (Conjunct1 H1) (Conjunct2 H1)
|
||||||
in CongrH AeqC (Symm AeqC))
|
in CongrH AeqC (Symm AeqC))
|
||||||
|
|
||||||
Set lean::pp::implicit false
|
SetOption lean::pp::implicit false
|
||||||
Show Environment 1
|
Show Environment 1
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
Show true /\ false
|
Show true /\ false
|
||||||
Set pp::unicode false
|
SetOption pp::unicode false
|
||||||
Show true /\ false
|
Show true /\ false
|
||||||
Set pp::unicode true
|
SetOption pp::unicode true
|
||||||
Set lean::pp::notation false
|
SetOption lean::pp::notation false
|
||||||
Show true /\ false
|
Show true /\ false
|
||||||
Set pp::unicode false
|
SetOption pp::unicode false
|
||||||
Show true /\ false
|
Show true /\ false
|
||||||
|
|
|
@ -8,8 +8,8 @@ Variables i j : Int
|
||||||
Variables p q : Bool
|
Variables p q : Bool
|
||||||
Notation 100 _ ++ _ : f
|
Notation 100 _ ++ _ : f
|
||||||
Notation 100 _ ++ _ : g
|
Notation 100 _ ++ _ : g
|
||||||
Set pp::colors true
|
SetOption pp::colors true
|
||||||
Set pp::width 300
|
SetOption pp::width 300
|
||||||
]], env)
|
]], env)
|
||||||
print(get_options())
|
print(get_options())
|
||||||
assert(get_options():get{"pp", "colors"})
|
assert(get_options():get{"pp", "colors"})
|
||||||
|
|
|
@ -3,14 +3,14 @@ parse_lean_cmds([[
|
||||||
Variable N : Type
|
Variable N : Type
|
||||||
Variables x y : N
|
Variables x y : N
|
||||||
Variable f : N -> N -> N
|
Variable f : N -> N -> N
|
||||||
Set pp::colors false
|
SetOption pp::colors false
|
||||||
]], env)
|
]], env)
|
||||||
local f, x, y = Consts("f, x, y")
|
local f, x, y = Consts("f, x, y")
|
||||||
print(env:check_type(f(x, y)))
|
print(env:check_type(f(x, y)))
|
||||||
assert(env:check_type(f(x, y)) == Const("N"))
|
assert(env:check_type(f(x, y)) == Const("N"))
|
||||||
assert(not get_options():get{"pp", "colors"})
|
assert(not get_options():get{"pp", "colors"})
|
||||||
parse_lean_cmds([[
|
parse_lean_cmds([[
|
||||||
Set pp::colors true
|
SetOption pp::colors true
|
||||||
]], env)
|
]], env)
|
||||||
assert(get_options():get{"pp", "colors"})
|
assert(get_options():get{"pp", "colors"})
|
||||||
local o = get_options()
|
local o = get_options()
|
||||||
|
@ -18,7 +18,7 @@ o:update({"lean", "pp", "notation"}, false)
|
||||||
assert(not o:get{"lean", "pp", "notation"})
|
assert(not o:get{"lean", "pp", "notation"})
|
||||||
o = parse_lean_cmds([[
|
o = parse_lean_cmds([[
|
||||||
Check fun x : N, y
|
Check fun x : N, y
|
||||||
Set pp::notation true
|
SetOption pp::notation true
|
||||||
Check fun x : N, y
|
Check fun x : N, y
|
||||||
]], env, o)
|
]], env, o)
|
||||||
print(o)
|
print(o)
|
||||||
|
|
Loading…
Reference in a new issue