diff --git a/library/data/equiv.lean b/library/data/equiv.lean index e8b78af8f..586934352 100644 --- a/library/data/equiv.lean +++ b/library/data/equiv.lean @@ -50,22 +50,22 @@ lemma arrow_congr {A₁ B₁ A₂ B₂ : Type} : A₁ ≃ A₂ → B₁ ≃ B₂ section open unit -lemma arrow_unit_equiv_unit [rewrite] (A : Type) : (A → unit) ≃ unit := +lemma arrow_unit_equiv_unit [simp] (A : Type) : (A → unit) ≃ unit := mk (λ f, star) (λ u, (λ f, star)) (λ f, funext (λ x, by cases (f x); reflexivity)) (λ u, by cases u; reflexivity) -lemma unit_arrow_equiv [rewrite] (A : Type) : (unit → A) ≃ A := +lemma unit_arrow_equiv [simp] (A : Type) : (unit → A) ≃ A := mk (λ f, f star) (λ a, (λ u, a)) (λ f, funext (λ x, by cases x; reflexivity)) (λ u, rfl) -lemma empty_arrow_equiv_unit [rewrite] (A : Type) : (empty → A) ≃ unit := +lemma empty_arrow_equiv_unit [simp] (A : Type) : (empty → A) ≃ unit := mk (λ f, star) (λ u, λ e, empty.rec _ e) (λ f, funext (λ x, empty.rec _ x)) (λ u, by cases u; reflexivity) -lemma false_arrow_equiv_unit [rewrite] (A : Type) : (false → A) ≃ unit := +lemma false_arrow_equiv_unit [simp] (A : Type) : (false → A) ≃ unit := calc (false → A) ≃ (empty → A) : arrow_congr false_equiv_empty !equiv.refl ... ≃ unit : empty_arrow_equiv_unit end @@ -78,13 +78,13 @@ lemma prod_congr {A₁ B₁ A₂ B₂ : Type} : A₁ ≃ A₂ → B₁ ≃ B₂ (λ p, begin cases p, esimp, rewrite [l₁, l₂] end) (λ p, begin cases p, esimp, rewrite [r₁, r₂] end) -lemma prod_comm [rewrite] (A B : Type) : (A × B) ≃ (B × A) := +lemma prod_comm [simp] (A B : Type) : (A × B) ≃ (B × A) := mk (λ p, match p with (a, b) := (b, a) end) (λ p, match p with (b, a) := (a, b) end) (λ p, begin cases p, esimp end) (λ p, begin cases p, esimp end) -lemma prod_assoc [rewrite] (A B C : Type) : ((A × B) × C) ≃ (A × (B × C)) := +lemma prod_assoc [simp] (A B C : Type) : ((A × B) × C) ≃ (A × (B × C)) := mk (λ t, match t with ((a, b), c) := (a, (b, c)) end) (λ t, match t with (a, (b, c)) := ((a, b), c) end) (λ t, begin cases t with ab c, cases ab, esimp end) @@ -92,20 +92,20 @@ mk (λ t, match t with ((a, b), c) := (a, (b, c)) end) section open unit prod.ops -lemma prod_unit_right [rewrite] (A : Type) : (A × unit) ≃ A := +lemma prod_unit_right [simp] (A : Type) : (A × unit) ≃ A := mk (λ p, p.1) (λ a, (a, star)) (λ p, begin cases p with a u, cases u, esimp end) (λ a, rfl) -lemma prod_unit_left [rewrite] (A : Type) : (unit × A) ≃ A := +lemma prod_unit_left [simp] (A : Type) : (unit × A) ≃ A := calc (unit × A) ≃ (A × unit) : prod_comm ... ≃ A : prod_unit_right -lemma prod_empty_right [rewrite] (A : Type) : (A × empty) ≃ empty := +lemma prod_empty_right [simp] (A : Type) : (A × empty) ≃ empty := mk (λ p, empty.rec _ p.2) (λ e, empty.rec _ e) (λ p, empty.rec _ p.2) (λ e, empty.rec _ e) -lemma prod_empty_left [rewrite] (A : Type) : (empty × A) ≃ empty := +lemma prod_empty_left [simp] (A : Type) : (empty × A) ≃ empty := calc (empty × A) ≃ (A × empty) : prod_comm ... ≃ empty : prod_empty_right end @@ -127,25 +127,25 @@ mk (λ b, match b with tt := inl star | ff := inr star end) (λ b, begin cases b, esimp, esimp end) (λ s, begin cases s with u u, {cases u, esimp}, {cases u, esimp} end) -lemma sum_comm [rewrite] (A B : Type) : (A + B) ≃ (B + A) := +lemma sum_comm [simp] (A B : Type) : (A + B) ≃ (B + A) := mk (λ s, match s with inl a := inr a | inr b := inl b end) (λ s, match s with inl b := inr b | inr a := inl a end) (λ s, begin cases s, esimp, esimp end) (λ s, begin cases s, esimp, esimp end) -lemma sum_assoc [rewrite] (A B C : Type) : ((A + B) + C) ≃ (A + (B + C)) := +lemma sum_assoc [simp] (A B C : Type) : ((A + B) + C) ≃ (A + (B + C)) := mk (λ s, match s with inl (inl a) := inl a | inl (inr b) := inr (inl b) | inr c := inr (inr c) end) (λ s, match s with inl a := inl (inl a) | inr (inl b) := inl (inr b) | inr (inr c) := inr c end) (λ s, begin cases s with ab c, cases ab, repeat esimp end) (λ s, begin cases s with a bc, esimp, cases bc, repeat esimp end) -lemma sum_empty_right [rewrite] (A : Type) : (A + empty) ≃ A := +lemma sum_empty_right [simp] (A : Type) : (A + empty) ≃ A := mk (λ s, match s with inl a := a | inr e := empty.rec _ e end) (λ a, inl a) (λ s, begin cases s with a e, esimp, exact empty.rec _ e end) (λ a, rfl) -lemma sum_empty_left [rewrite] (A : Type) : (empty + A) ≃ A := +lemma sum_empty_left [simp] (A : Type) : (empty + A) ≃ A := calc (empty + A) ≃ (A + empty) : sum_comm ... ≃ A : sum_empty_right end @@ -191,23 +191,23 @@ mk (λ n, match n with 0 := inr star | succ a := inl a end) (λ n, begin cases n, repeat esimp end) (λ s, begin cases s with a u, esimp, {cases u, esimp} end) -lemma nat_sum_unit_equiv_nat [rewrite] : (nat + unit) ≃ nat := +lemma nat_sum_unit_equiv_nat [simp] : (nat + unit) ≃ nat := equiv.symm nat_equiv_nat_sum_unit -lemma nat_prod_nat_equiv_nat [rewrite] : (nat × nat) ≃ nat := +lemma nat_prod_nat_equiv_nat [simp] : (nat × nat) ≃ nat := mk (λ p, mkpair p.1 p.2) (λ n, unpair n) (λ p, begin cases p, apply unpair_mkpair end) (λ n, mkpair_unpair n) -lemma nat_sum_bool_equiv_nat [rewrite] : (nat + bool) ≃ nat := +lemma nat_sum_bool_equiv_nat [simp] : (nat + bool) ≃ nat := calc (nat + bool) ≃ (nat + (unit + unit)) : sum_congr !equiv.refl bool_equiv_unit_sum_unit ... ≃ ((nat + unit) + unit) : sum_assoc ... ≃ (nat + unit) : sum_congr nat_sum_unit_equiv_nat !equiv.refl ... ≃ nat : nat_sum_unit_equiv_nat open decidable -lemma nat_sum_nat_equiv_nat [rewrite] : (nat + nat) ≃ nat := +lemma nat_sum_nat_equiv_nat [simp] : (nat + nat) ≃ nat := mk (λ s, match s with inl n := 2*n | inr n := 2*n+1 end) (λ n, if even n then inl (n div 2) else inr ((n - 1) div 2)) (λ s, begin diff --git a/library/data/finset/basic.lean b/library/data/finset/basic.lean index d3fcbe602..e5cc033c6 100644 --- a/library/data/finset/basic.lean +++ b/library/data/finset/basic.lean @@ -84,7 +84,7 @@ theorem mem_list_of_mem {a : A} {l : nodup_list A} : a ∈ ⟦l⟧ → a ∈ elt definition singleton (a : A) : finset A := to_finset_of_nodup [a] !nodup_singleton -theorem mem_singleton [rewrite] (a : A) : a ∈ singleton a := +theorem mem_singleton [simp] (a : A) : a ∈ singleton a := mem_of_mem_list !mem_cons theorem eq_of_mem_singleton {x a : A} : x ∈ singleton a → x = a := @@ -119,10 +119,10 @@ to_finset_of_nodup [] nodup_nil notation `∅` := !empty -theorem not_mem_empty [rewrite] (a : A) : a ∉ ∅ := +theorem not_mem_empty [simp] (a : A) : a ∉ ∅ := λ aine : a ∈ ∅, aine -theorem mem_empty_iff [rewrite] (x : A) : x ∈ ∅ ↔ false := +theorem mem_empty_iff [simp] (x : A) : x ∈ ∅ ↔ false := iff.mpr !iff_false_iff_not !not_mem_empty theorem mem_empty_eq (x : A) : x ∈ ∅ = false := diff --git a/library/data/list/basic.lean b/library/data/list/basic.lean index e8917c404..f046a57db 100644 --- a/library/data/list/basic.lean +++ b/library/data/list/basic.lean @@ -21,7 +21,7 @@ notation `[` l:(foldr `,` (h t, cons h t) nil `]`) := l variable {T : Type} -lemma cons_ne_nil [rewrite] (a : T) (l : list T) : a::l ≠ [] := +lemma cons_ne_nil [simp] (a : T) (l : list T) : a::l ≠ [] := by contradiction lemma head_eq_of_cons_eq {A : Type} {h₁ h₂ : A} {t₁ t₂ : list A} : @@ -43,17 +43,17 @@ definition append : list T → list T → list T notation l₁ ++ l₂ := append l₁ l₂ -theorem append_nil_left [rewrite] (t : list T) : [] ++ t = t +theorem append_nil_left [simp] (t : list T) : [] ++ t = t -theorem append_cons [rewrite] (x : T) (s t : list T) : (x::s) ++ t = x::(s ++ t) +theorem append_cons [simp] (x : T) (s t : list T) : (x::s) ++ t = x::(s ++ t) -theorem append_nil_right [rewrite] : ∀ (t : list T), t ++ [] = t +theorem append_nil_right [simp] : ∀ (t : list T), t ++ [] = t | [] := rfl | (a :: l) := calc (a :: l) ++ [] = a :: (l ++ []) : rfl ... = a :: l : append_nil_right l -theorem append.assoc [rewrite] : ∀ (s t u : list T), s ++ t ++ u = s ++ (t ++ u) +theorem append.assoc [simp] : ∀ (s t u : list T), s ++ t ++ u = s ++ (t ++ u) | [] t u := rfl | (a :: l) t u := show a :: (l ++ t ++ u) = (a :: l) ++ (t ++ u), @@ -64,11 +64,11 @@ definition length : list T → nat | [] := 0 | (a :: l) := length l + 1 -theorem length_nil [rewrite] : length (@nil T) = 0 +theorem length_nil [simp] : length (@nil T) = 0 -theorem length_cons [rewrite] (x : T) (t : list T) : length (x::t) = length t + 1 +theorem length_cons [simp] (x : T) (t : list T) : length (x::t) = length t + 1 -theorem length_append [rewrite] : ∀ (s t : list T), length (s ++ t) = length s + length t +theorem length_append [simp] : ∀ (s t : list T), length (s ++ t) = length s + length t | [] t := calc length ([] ++ t) = length t : rfl ... = length [] + length t : zero_add @@ -94,9 +94,9 @@ definition concat : Π (x : T), list T → list T | a [] := [a] | a (b :: l) := b :: concat a l -theorem concat_nil [rewrite] (x : T) : concat x [] = [x] +theorem concat_nil [simp] (x : T) : concat x [] = [x] -theorem concat_cons [rewrite] (x y : T) (l : list T) : concat x (y::l) = y::(concat x l) +theorem concat_cons [simp] (x y : T) (l : list T) : concat x (y::l) = y::(concat x l) theorem concat_eq_append (a : T) : ∀ (l : list T), concat a l = l ++ [a] | [] := rfl @@ -104,7 +104,7 @@ theorem concat_eq_append (a : T) : ∀ (l : list T), concat a l = l ++ [a] show b :: (concat a l) = (b :: l) ++ (a :: []), by rewrite concat_eq_append -theorem concat_ne_nil [rewrite] (a : T) : ∀ (l : list T), concat a l ≠ [] := +theorem concat_ne_nil [simp] (a : T) : ∀ (l : list T), concat a l ≠ [] := by intro l; induction l; repeat contradiction /- last -/ @@ -114,16 +114,16 @@ definition last : Π l : list T, l ≠ [] → T | [a] h := a | (a₁::a₂::l) h := last (a₂::l) !cons_ne_nil -lemma last_singleton [rewrite] (a : T) (h : [a] ≠ []) : last [a] h = a := +lemma last_singleton [simp] (a : T) (h : [a] ≠ []) : last [a] h = a := rfl -lemma last_cons_cons [rewrite] (a₁ a₂ : T) (l : list T) (h : a₁::a₂::l ≠ []) : last (a₁::a₂::l) h = last (a₂::l) !cons_ne_nil := +lemma last_cons_cons [simp] (a₁ a₂ : T) (l : list T) (h : a₁::a₂::l ≠ []) : last (a₁::a₂::l) h = last (a₂::l) !cons_ne_nil := rfl theorem last_congr {l₁ l₂ : list T} (h₁ : l₁ ≠ []) (h₂ : l₂ ≠ []) (h₃ : l₁ = l₂) : last l₁ h₁ = last l₂ h₂ := by subst l₁ -theorem last_concat [rewrite] {x : T} : ∀ {l : list T} (h : concat x l ≠ []), last (concat x l) h = x +theorem last_concat [simp] {x : T} : ∀ {l : list T} (h : concat x l ≠ []), last (concat x l) h = x | [] h := rfl | [a] h := rfl | (a₁::a₂::l) h := @@ -142,13 +142,13 @@ definition reverse : list T → list T | [] := [] | (a :: l) := concat a (reverse l) -theorem reverse_nil [rewrite] : reverse (@nil T) = [] +theorem reverse_nil [simp] : reverse (@nil T) = [] -theorem reverse_cons [rewrite] (x : T) (l : list T) : reverse (x::l) = concat x (reverse l) +theorem reverse_cons [simp] (x : T) (l : list T) : reverse (x::l) = concat x (reverse l) -theorem reverse_singleton [rewrite] (x : T) : reverse [x] = [x] +theorem reverse_singleton [simp] (x : T) : reverse [x] = [x] -theorem reverse_append [rewrite] : ∀ (s t : list T), reverse (s ++ t) = (reverse t) ++ (reverse s) +theorem reverse_append [simp] : ∀ (s t : list T), reverse (s ++ t) = (reverse t) ++ (reverse s) | [] t2 := calc reverse ([] ++ t2) = reverse t2 : rfl ... = (reverse t2) ++ [] : append_nil_right @@ -161,7 +161,7 @@ theorem reverse_append [rewrite] : ∀ (s t : list T), reverse (s ++ t) = (rever ... = reverse t2 ++ concat a2 (reverse s2) : concat_eq_append ... = reverse t2 ++ reverse (a2 :: s2) : rfl -theorem reverse_reverse [rewrite] : ∀ (l : list T), reverse (reverse l) = l +theorem reverse_reverse [simp] : ∀ (l : list T), reverse (reverse l) = l | [] := rfl | (a :: l) := calc reverse (reverse (a :: l)) = reverse (concat a (reverse l)) : rfl @@ -181,9 +181,9 @@ definition head [h : inhabited T] : list T → T | [] := arbitrary T | (a :: l) := a -theorem head_cons [rewrite] [h : inhabited T] (a : T) (l : list T) : head (a::l) = a +theorem head_cons [simp] [h : inhabited T] (a : T) (l : list T) : head (a::l) = a -theorem head_append [rewrite] [h : inhabited T] (t : list T) : ∀ {s : list T}, s ≠ [] → head (s ++ t) = head s +theorem head_append [simp] [h : inhabited T] (t : list T) : ∀ {s : list T}, s ≠ [] → head (s ++ t) = head s | [] H := absurd rfl H | (a :: s) H := show head (a :: (s ++ t)) = head (a :: s), @@ -193,9 +193,9 @@ definition tail : list T → list T | [] := [] | (a :: l) := l -theorem tail_nil [rewrite] : tail (@nil T) = [] +theorem tail_nil [simp] : tail (@nil T) = [] -theorem tail_cons [rewrite] (a : T) (l : list T) : tail (a::l) = l +theorem tail_cons [simp] (a : T) (l : list T) : tail (a::l) = l theorem cons_head_tail [h : inhabited T] {l : list T} : l ≠ [] → (head l)::(tail l) = l := list.cases_on l @@ -211,13 +211,13 @@ definition mem : T → list T → Prop notation e ∈ s := mem e s notation e ∉ s := ¬ e ∈ s -theorem mem_nil_iff [rewrite] (x : T) : x ∈ [] ↔ false := +theorem mem_nil_iff [simp] (x : T) : x ∈ [] ↔ false := iff.rfl theorem not_mem_nil (x : T) : x ∉ [] := iff.mp !mem_nil_iff -theorem mem_cons [rewrite] (x : T) (l : list T) : x ∈ x :: l := +theorem mem_cons [simp] (x : T) (l : list T) : x ∈ x :: l := or.inl rfl theorem mem_cons_of_mem (y : T) {x : T} {l : list T} : x ∈ l → x ∈ y :: l := @@ -346,16 +346,16 @@ definition sublist (l₁ l₂ : list T) := ∀ ⦃a : T⦄, a ∈ l₁ → a ∈ infix `⊆` := sublist -theorem nil_sub [rewrite] (l : list T) : [] ⊆ l := +theorem nil_sub [simp] (l : list T) : [] ⊆ l := λ b i, false.elim (iff.mp (mem_nil_iff b) i) -theorem sub.refl [rewrite] (l : list T) : l ⊆ l := +theorem sub.refl [simp] (l : list T) : l ⊆ l := λ b i, i theorem sub.trans {l₁ l₂ l₃ : list T} (H₁ : l₁ ⊆ l₂) (H₂ : l₂ ⊆ l₃) : l₁ ⊆ l₃ := λ b i, H₂ (H₁ i) -theorem sub_cons [rewrite] (a : T) (l : list T) : l ⊆ a::l := +theorem sub_cons [simp] (a : T) (l : list T) : l ⊆ a::l := λ b i, or.inr i theorem sub_of_cons_sub {a : T} {l₁ l₂ : list T} : a::l₁ ⊆ l₂ → l₁ ⊆ l₂ := @@ -366,10 +366,10 @@ theorem cons_sub_cons {l₁ l₂ : list T} (a : T) (s : l₁ ⊆ l₂) : (a::l (λ e : b = a, or.inl e) (λ i : b ∈ l₁, or.inr (s i)) -theorem sub_append_left [rewrite] (l₁ l₂ : list T) : l₁ ⊆ l₁++l₂ := +theorem sub_append_left [simp] (l₁ l₂ : list T) : l₁ ⊆ l₁++l₂ := λ b i, iff.mpr (mem_append_iff b l₁ l₂) (or.inl i) -theorem sub_append_right [rewrite] (l₁ l₂ : list T) : l₂ ⊆ l₁++l₂ := +theorem sub_append_right [simp] (l₁ l₂ : list T) : l₂ ⊆ l₁++l₂ := λ b i, iff.mpr (mem_append_iff b l₁ l₂) (or.inr i) theorem sub_cons_of_sub (a : T) {l₁ l₂ : list T} : l₁ ⊆ l₂ → l₁ ⊆ (a::l₂) := @@ -405,7 +405,7 @@ definition find : T → list T → nat | a [] := 0 | a (b :: l) := if a = b then 0 else succ (find a l) -theorem find_nil [rewrite] (x : T) : find x [] = 0 +theorem find_nil [simp] (x : T) : find x [] = 0 theorem find_cons (x y : T) (l : list T) : find x (y::l) = if x = y then 0 else succ (find x l) @@ -467,9 +467,9 @@ definition nth : list T → nat → option T | (a :: l) 0 := some a | (a :: l) (n+1) := nth l n -theorem nth_zero [rewrite] (a : T) (l : list T) : nth (a :: l) 0 = some a +theorem nth_zero [simp] (a : T) (l : list T) : nth (a :: l) 0 = some a -theorem nth_succ [rewrite] (a : T) (l : list T) (n : nat) : nth (a::l) (succ n) = nth l n +theorem nth_succ [simp] (a : T) (l : list T) (n : nat) : nth (a::l) (succ n) = nth l n theorem nth_eq_some : ∀ {l : list T} {n : nat}, n < length l → Σ a : T, nth l n = some a | [] n h := absurd h !not_lt_zero diff --git a/library/data/nat/basic.lean b/library/data/nat/basic.lean index 02d037993..792c8c5c1 100644 --- a/library/data/nat/basic.lean +++ b/library/data/nat/basic.lean @@ -49,10 +49,10 @@ by contradiction -- add_rewrite succ_ne_zero -theorem pred_zero [rewrite] : pred 0 = 0 := +theorem pred_zero [simp] : pred 0 = 0 := rfl -theorem pred_succ [rewrite] (n : ℕ) : pred (succ n) = n := +theorem pred_succ [simp] (n : ℕ) : pred (succ n) = n := rfl theorem eq_zero_or_eq_succ_pred (n : ℕ) : n = 0 ∨ n = succ (pred n) := @@ -103,13 +103,13 @@ general m /- addition -/ -theorem add_zero [rewrite] (n : ℕ) : n + 0 = n := +theorem add_zero [simp] (n : ℕ) : n + 0 = n := rfl -theorem add_succ [rewrite] (n m : ℕ) : n + succ m = succ (n + m) := +theorem add_succ [simp] (n m : ℕ) : n + succ m = succ (n + m) := rfl -theorem zero_add [rewrite] (n : ℕ) : 0 + n = n := +theorem zero_add [simp] (n : ℕ) : 0 + n = n := nat.induction_on n !add_zero (take m IH, show 0 + succ m = succ m, from @@ -117,7 +117,7 @@ nat.induction_on n 0 + succ m = succ (0 + m) : add_succ ... = succ m : IH) -theorem succ_add [rewrite] (n m : ℕ) : (succ n) + m = succ (n + m) := +theorem succ_add [simp] (n m : ℕ) : (succ n) + m = succ (n + m) := nat.induction_on m (!add_zero ▸ !add_zero) (take k IH, calc @@ -125,7 +125,7 @@ nat.induction_on m ... = succ (succ (n + k)) : IH ... = succ (n + succ k) : add_succ) -theorem add.comm [rewrite] (n m : ℕ) : n + m = m + n := +theorem add.comm [simp] (n m : ℕ) : n + m = m + n := nat.induction_on m (!add_zero ⬝ !zero_add⁻¹) (take k IH, calc @@ -136,7 +136,7 @@ nat.induction_on m theorem succ_add_eq_succ_add (n m : ℕ) : succ n + m = n + succ m := !succ_add ⬝ !add_succ⁻¹ -theorem add.assoc [rewrite] (n m k : ℕ) : (n + m) + k = n + (m + k) := +theorem add.assoc [simp] (n m k : ℕ) : (n + m) + k = n + (m + k) := nat.induction_on k (!add_zero ▸ !add_zero) (take l IH, @@ -146,7 +146,7 @@ nat.induction_on k ... = n + succ (m + l) : add_succ ... = n + (m + succ l) : add_succ) -theorem add.left_comm [rewrite] (n m k : ℕ) : n + (m + k) = m + (n + k) := +theorem add.left_comm [simp] (n m k : ℕ) : n + (m + k) = m + (n + k) := left_comm add.comm add.assoc n m k theorem add.right_comm (n m k : ℕ) : n + m + k = n + k + m := @@ -186,7 +186,7 @@ eq_zero_of_add_eq_zero_right (!add.comm ⬝ H) theorem eq_zero_and_eq_zero_of_add_eq_zero {n m : ℕ} (H : n + m = 0) : n = 0 ∧ m = 0 := and.intro (eq_zero_of_add_eq_zero_right H) (eq_zero_of_add_eq_zero_left H) -theorem add_one [rewrite] (n : ℕ) : n + 1 = succ n := +theorem add_one [simp] (n : ℕ) : n + 1 = succ n := !add_zero ▸ !add_succ theorem one_add (n : ℕ) : 1 + n = succ n := @@ -194,20 +194,20 @@ theorem one_add (n : ℕ) : 1 + n = succ n := /- multiplication -/ -theorem mul_zero [rewrite] (n : ℕ) : n * 0 = 0 := +theorem mul_zero [simp] (n : ℕ) : n * 0 = 0 := rfl -theorem mul_succ [rewrite] (n m : ℕ) : n * succ m = n * m + n := +theorem mul_succ [simp] (n m : ℕ) : n * succ m = n * m + n := rfl -- commutativity, distributivity, associativity, identity -theorem zero_mul [rewrite] (n : ℕ) : 0 * n = 0 := +theorem zero_mul [simp] (n : ℕ) : 0 * n = 0 := nat.induction_on n !mul_zero (take m IH, !mul_succ ⬝ !add_zero ⬝ IH) -theorem succ_mul [rewrite] (n m : ℕ) : (succ n) * m = (n * m) + m := +theorem succ_mul [simp] (n m : ℕ) : (succ n) * m = (n * m) + m := nat.induction_on m (!mul_zero ⬝ !mul_zero⁻¹ ⬝ !add_zero⁻¹) (take k IH, calc @@ -219,7 +219,7 @@ nat.induction_on m ... = n * k + n + succ k : add.assoc ... = n * succ k + succ k : mul_succ) -theorem mul.comm [rewrite] (n m : ℕ) : n * m = m * n := +theorem mul.comm [simp] (n m : ℕ) : n * m = m * n := nat.induction_on m (!mul_zero ⬝ !zero_mul⁻¹) (take k IH, calc @@ -250,7 +250,7 @@ calc ... = n * m + k * n : mul.comm ... = n * m + n * k : mul.comm -theorem mul.assoc [rewrite] (n m k : ℕ) : (n * m) * k = n * (m * k) := +theorem mul.assoc [simp] (n m k : ℕ) : (n * m) * k = n * (m * k) := nat.induction_on k (calc (n * m) * 0 = n * (m * 0) : mul_zero) @@ -261,13 +261,13 @@ nat.induction_on k ... = n * (m * l + m) : mul.left_distrib ... = n * (m * succ l) : mul_succ) -theorem mul_one [rewrite] (n : ℕ) : n * 1 = n := +theorem mul_one [simp] (n : ℕ) : n * 1 = n := calc n * 1 = n * 0 + n : mul_succ ... = 0 + n : mul_zero ... = n : zero_add -theorem one_mul [rewrite] (n : ℕ) : 1 * n = n := +theorem one_mul [simp] (n : ℕ) : 1 * n = n := calc 1 * n = n * 1 : mul.comm ... = n : mul_one diff --git a/library/data/nat/order.lean b/library/data/nat/order.lean index abdbc3c23..b818a6718 100644 --- a/library/data/nat/order.lean +++ b/library/data/nat/order.lean @@ -118,7 +118,7 @@ theorem mul_lt_mul_of_pos_right {n m k : ℕ} (H : n < m) (Hk : k > 0) : n * k < definition max (a b : ℕ) : ℕ := if a < b then b else a definition min (a b : ℕ) : ℕ := if a < b then a else b -theorem max_self [rewrite] (a : ℕ) : max a a = a := +theorem max_self [simp] (a : ℕ) : max a a = a := eq.rec_on !if_t_t rfl theorem max_le {n m k : ℕ} (H₁ : n ≤ k) (H₂ : m ≤ k) : max n m ≤ k := @@ -465,32 +465,32 @@ dvd.elim H /- min and max -/ open decidable -theorem le_max_left_iff_true [rewrite] (a b : ℕ) : a ≤ max a b ↔ true := +theorem le_max_left_iff_true [simp] (a b : ℕ) : a ≤ max a b ↔ true := iff_true_intro (le_max_left a b) -theorem le_max_right_iff_true [rewrite] (a b : ℕ) : b ≤ max a b ↔ true := +theorem le_max_right_iff_true [simp] (a b : ℕ) : b ≤ max a b ↔ true := iff_true_intro (le_max_right a b) -theorem min_zero [rewrite] (a : ℕ) : min a 0 = 0 := +theorem min_zero [simp] (a : ℕ) : min a 0 = 0 := by rewrite [min_eq_right !zero_le] -theorem zero_min [rewrite] (a : ℕ) : min 0 a = 0 := +theorem zero_min [simp] (a : ℕ) : min 0 a = 0 := by rewrite [min_eq_left !zero_le] -theorem max_zero [rewrite] (a : ℕ) : max a 0 = a := +theorem max_zero [simp] (a : ℕ) : max a 0 = a := by rewrite [max_eq_left !zero_le] -theorem zero_max [rewrite] (a : ℕ) : max 0 a = a := +theorem zero_max [simp] (a : ℕ) : max 0 a = a := by rewrite [max_eq_right !zero_le] -theorem min_succ_succ [rewrite] (a b : ℕ) : min (succ a) (succ b) = succ (min a b) := +theorem min_succ_succ [simp] (a b : ℕ) : min (succ a) (succ b) = succ (min a b) := by_cases (suppose a < b, by unfold min; rewrite [if_pos this, if_pos (succ_lt_succ this)]) (suppose ¬ a < b, assert h : ¬ succ a < succ b, from assume h, absurd (lt_of_succ_lt_succ h) this, by unfold min; rewrite [if_neg this, if_neg h]) -theorem max_succ_succ [rewrite] (a b : ℕ) : max (succ a) (succ b) = succ (max a b) := +theorem max_succ_succ [simp] (a b : ℕ) : max (succ a) (succ b) = succ (max a b) := by_cases (suppose a < b, by unfold max; rewrite [if_pos this, if_pos (succ_lt_succ this)]) (suppose ¬ a < b, diff --git a/library/init/logic.lean b/library/init/logic.lean index b66783e76..9cad30380 100644 --- a/library/init/logic.lean +++ b/library/init/logic.lean @@ -535,7 +535,7 @@ decidable.rec (λ Hnc : ¬c, eq.refl (@ite c (decidable.inr Hnc) A t e)) H -theorem if_t_t [rewrite] (c : Prop) [H : decidable c] {A : Type} (t : A) : (if c then t else t) = t := +theorem if_t_t [simp] (c : Prop) [H : decidable c] {A : Type} (t : A) : (if c then t else t) = t := decidable.rec (λ Hc : c, eq.refl (@ite c (decidable.inl Hc) A t t)) (λ Hnc : ¬c, eq.refl (@ite c (decidable.inr Hnc) A t t)) diff --git a/library/init/nat.lean b/library/init/nat.lean index 71eb94a67..851ceea0b 100644 --- a/library/init/nat.lean +++ b/library/init/nat.lean @@ -62,10 +62,10 @@ namespace nat theorem pred_le (n : ℕ) : pred n ≤ n := by cases n;all_goals (repeat constructor) - theorem le_succ_iff_true [rewrite] (n : ℕ) : n ≤ succ n ↔ true := + theorem le_succ_iff_true [simp] (n : ℕ) : n ≤ succ n ↔ true := iff_true_intro (le_succ n) - theorem pred_le_iff_true [rewrite] (n : ℕ) : pred n ≤ n ↔ true := + theorem pred_le_iff_true [simp] (n : ℕ) : pred n ≤ n ↔ true := iff_true_intro (pred_le n) theorem le.trans [trans] {n m k : ℕ} (H1 : n ≤ m) (H2 : m ≤ k) : n ≤ k := @@ -92,13 +92,13 @@ namespace nat theorem not_succ_le_self {n : ℕ} : ¬succ n ≤ n := by induction n with n IH;all_goals intros;cases a;apply IH;exact le_of_succ_le_succ a - theorem succ_le_self_iff_false [rewrite] (n : ℕ) : succ n ≤ n ↔ false := + theorem succ_le_self_iff_false [simp] (n : ℕ) : succ n ≤ n ↔ false := iff_false_intro not_succ_le_self theorem zero_le (n : ℕ) : 0 ≤ n := by induction n with n IH;apply le.refl;exact le.step IH - theorem zero_le_iff_true [rewrite] (n : ℕ) : 0 ≤ n ↔ true := + theorem zero_le_iff_true [simp] (n : ℕ) : 0 ≤ n ↔ true := iff_true_intro (zero_le n) theorem lt.step {n m : ℕ} (H : n < m) : n < succ m := @@ -107,7 +107,7 @@ namespace nat theorem zero_lt_succ (n : ℕ) : 0 < succ n := by induction n with n IH;apply le.refl;exact le.step IH - theorem zero_lt_succ_iff_true [rewrite] (n : ℕ) : 0 < succ n ↔ true := + theorem zero_lt_succ_iff_true [simp] (n : ℕ) : 0 < succ n ↔ true := iff_true_intro (zero_lt_succ n) theorem lt.trans [trans] {n m k : ℕ} (H1 : n < m) (H2 : m < k) : n < k := @@ -136,12 +136,12 @@ namespace nat theorem lt.irrefl (n : ℕ) : ¬n < n := not_succ_le_self - theorem lt_self_iff_false [rewrite] (n : ℕ) : n < n ↔ false := + theorem lt_self_iff_false [simp] (n : ℕ) : n < n ↔ false := iff_false_intro (lt.irrefl n) theorem self_lt_succ (n : ℕ) : n < succ n := !le.refl - theorem self_lt_succ_iff_true [rewrite] (n : ℕ) : n < succ n ↔ true := + theorem self_lt_succ_iff_true [simp] (n : ℕ) : n < succ n ↔ true := iff_true_intro (self_lt_succ n) theorem lt.base (n : ℕ) : n < succ n := !le.refl @@ -181,7 +181,7 @@ namespace nat theorem not_lt_zero (a : ℕ) : ¬ a < zero := by intro H; cases H - theorem lt_zero_iff_false [rewrite] (a : ℕ) : a < zero ↔ false := + theorem lt_zero_iff_false [simp] (a : ℕ) : a < zero ↔ false := iff_false_intro (not_lt_zero a) -- less-than is well-founded @@ -246,13 +246,13 @@ namespace nat theorem succ_le_of_lt {a b : ℕ} (h : a < b) : succ a ≤ b := h - theorem succ_sub_succ_eq_sub [rewrite] (a b : ℕ) : succ a - succ b = a - b := + theorem succ_sub_succ_eq_sub [simp] (a b : ℕ) : succ a - succ b = a - b := by induction b with b IH;reflexivity; apply congr (eq.refl pred) IH theorem sub_eq_succ_sub_succ (a b : ℕ) : a - b = succ a - succ b := eq.rec_on (succ_sub_succ_eq_sub a b) rfl - theorem zero_sub_eq_zero [rewrite] (a : ℕ) : zero - a = zero := + theorem zero_sub_eq_zero [simp] (a : ℕ) : zero - a = zero := nat.rec_on a rfl (λ a₁ (ih : zero - a₁ = zero), congr (eq.refl pred) ih) @@ -280,12 +280,12 @@ namespace nat (le.refl a) (λ b₁ ih, le.trans !pred_le ih) - theorem sub_le_iff_true [rewrite] (a b : ℕ) : a - b ≤ a ↔ true := + theorem sub_le_iff_true [simp] (a b : ℕ) : a - b ≤ a ↔ true := iff_true_intro (sub_le a b) theorem sub_lt_succ (a b : ℕ) : a - b < succ a := lt_succ_of_le (sub_le a b) - theorem sub_lt_succ_iff_true [rewrite] (a b : ℕ) : a - b < succ a ↔ true := + theorem sub_lt_succ_iff_true [simp] (a b : ℕ) : a - b < succ a ↔ true := iff_true_intro (sub_lt_succ a b) end nat diff --git a/library/logic/connectives.lean b/library/logic/connectives.lean index 3e697dd24..4c5a35beb 100644 --- a/library/logic/connectives.lean +++ b/library/logic/connectives.lean @@ -61,10 +61,10 @@ have Hnp : ¬a, from assume Hp : a, absurd (or.inl Hp) not_em, absurd (or.inr Hnp) not_em -theorem not_true [rewrite] : ¬ true ↔ false := +theorem not_true [simp] : ¬ true ↔ false := iff.intro (assume H, H trivial) (assume H, false.elim H) -theorem not_false_iff [rewrite] : ¬ false ↔ true := +theorem not_false_iff [simp] : ¬ false ↔ true := iff.intro (assume H, trivial) (assume H H1, H1) theorem not_iff_not (H : a ↔ b) : ¬a ↔ ¬b := @@ -105,19 +105,19 @@ iff.intro obtain Ha Hb Hc, from H, and.intro (and.intro Ha Hb) Hc) -theorem and_true [rewrite] (a : Prop) : a ∧ true ↔ a := +theorem and_true [simp] (a : Prop) : a ∧ true ↔ a := iff.intro (assume H, and.left H) (assume H, and.intro H trivial) -theorem true_and [rewrite] (a : Prop) : true ∧ a ↔ a := +theorem true_and [simp] (a : Prop) : true ∧ a ↔ a := iff.intro (assume H, and.right H) (assume H, and.intro trivial H) -theorem and_false [rewrite] (a : Prop) : a ∧ false ↔ false := +theorem and_false [simp] (a : Prop) : a ∧ false ↔ false := iff.intro (assume H, and.right H) (assume H, false.elim H) -theorem false_and [rewrite] (a : Prop) : false ∧ a ↔ false := +theorem false_and [simp] (a : Prop) : false ∧ a ↔ false := iff.intro (assume H, and.left H) (assume H, false.elim H) -theorem and_self [rewrite] (a : Prop) : a ∧ a ↔ a := +theorem and_self [simp] (a : Prop) : a ∧ a ↔ a := iff.intro (assume H, and.left H) (assume H, and.intro H H) theorem and_imp_eq (a b c : Prop) : (a ∧ b → c) = (a → b → c) := @@ -190,18 +190,18 @@ iff.intro (assume Hb, or.inl (or.inr Hb)) (assume Hc, or.inr Hc))) -theorem or_true [rewrite] (a : Prop) : a ∨ true ↔ true := +theorem or_true [simp] (a : Prop) : a ∨ true ↔ true := iff.intro (assume H, trivial) (assume H, or.inr H) -theorem true_or [rewrite] (a : Prop) : true ∨ a ↔ true := +theorem true_or [simp] (a : Prop) : true ∨ a ↔ true := iff.intro (assume H, trivial) (assume H, or.inl H) -theorem or_false [rewrite] (a : Prop) : a ∨ false ↔ a := +theorem or_false [simp] (a : Prop) : a ∨ false ↔ a := iff.intro (assume H, or.elim H (assume H1 : a, H1) (assume H1 : false, false.elim H1)) (assume H, or.inl H) -theorem false_or [rewrite] (a : Prop) : false ∨ a ↔ a := +theorem false_or [simp] (a : Prop) : false ∨ a ↔ a := iff.intro (assume H, or.elim H (assume H1 : false, false.elim H1) (assume H1 : a, H1)) (assume H, or.inr H) @@ -249,22 +249,22 @@ propext (!or.comm) ▸ propext (!or.comm) ▸ propext (!or.comm) ▸ !or.distrib definition iff.def : (a ↔ b) = ((a → b) ∧ (b → a)) := !eq.refl -theorem iff_true [rewrite] (a : Prop) : (a ↔ true) ↔ a := +theorem iff_true [simp] (a : Prop) : (a ↔ true) ↔ a := iff.intro (assume H, iff.mpr H trivial) (assume H, iff.intro (assume H1, trivial) (assume H1, H)) -theorem true_iff [rewrite] (a : Prop) : (true ↔ a) ↔ a := +theorem true_iff [simp] (a : Prop) : (true ↔ a) ↔ a := iff.intro (assume H, iff.mp H trivial) (assume H, iff.intro (assume H1, H) (assume H1, trivial)) -theorem iff_false [rewrite] (a : Prop) : (a ↔ false) ↔ ¬ a := +theorem iff_false [simp] (a : Prop) : (a ↔ false) ↔ ¬ a := iff.intro (assume H, and.left H) (assume H, and.intro H (assume H1, false.elim H1)) -theorem false_iff [rewrite] (a : Prop) : (false ↔ a) ↔ ¬ a := +theorem false_iff [simp] (a : Prop) : (false ↔ a) ↔ ¬ a := iff.intro (assume H, and.right H) (assume H, and.intro (assume H1, false.elim H1) H) @@ -272,7 +272,7 @@ iff.intro theorem iff_true_of_self (Ha : a) : a ↔ true := iff.intro (assume H, trivial) (assume H, Ha) -theorem iff_self [rewrite] (a : Prop) : (a ↔ a) ↔ true := +theorem iff_self [simp] (a : Prop) : (a ↔ a) ↔ true := iff_true_of_self !iff.refl theorem forall_iff_forall {A : Type} {P Q : A → Prop} (H : ∀a, (P a ↔ Q a)) : (∀a, P a) ↔ ∀a, Q a := @@ -291,10 +291,10 @@ section variables {A : Type} {c₁ c₂ : Prop} - definition if_true [rewrite] (t e : A) : (if true then t else e) = t := + definition if_true [simp] (t e : A) : (if true then t else e) = t := if_pos trivial - definition if_false [rewrite] (t e : A) : (if false then t else e) = e := + definition if_false [simp] (t e : A) : (if false then t else e) = e := if_neg not_false end diff --git a/src/emacs/lean-syntax.el b/src/emacs/lean-syntax.el index 3c9a59a1a..7ece059e5 100644 --- a/src/emacs/lean-syntax.el +++ b/src/emacs/lean-syntax.el @@ -123,7 +123,7 @@ "\[irreducible\]" "\[semireducible\]" "\[quasireducible\]" "\[wf\]" "\[whnf\]" "\[multiple-instances\]" "\[none\]" "\[decls\]" "\[declarations\]" "\[coercions\]" "\[classes\]" - "\[symm\]" "\[subst\]" "\[refl\]" "\[trans\]" "\[rewrite\]" + "\[symm\]" "\[subst\]" "\[refl\]" "\[trans\]" "\[simp\]" "\[notations\]" "\[abbreviations\]" "\[begin-end-hints\]" "\[tactic-hints\]" "\[reduce-hints\]" "\[unfold-hints\]" "\[aliases\]" "\[eqv\]" "\[localrefinfo\]")) . 'font-lock-doc-face) @@ -138,7 +138,7 @@ "apply" "fapply" "eapply" "rename" "intro" "intros" "all_goals" "fold" "focus" "focus_at" "generalize" "generalizes" "clear" "clears" "revert" "reverts" "back" "beta" "done" "exact" "rexact" "refine" "repeat" "whnf" "rotate" "rotate_left" "rotate_right" "inversion" "cases" "rewrite" - "xrewrite" "krewrite" "esimp" "unfold" "change" "check_expr" "contradiction" + "xrewrite" "krewrite" "simp" "esimp" "unfold" "change" "check_expr" "contradiction" "exfalso" "split" "existsi" "constructor" "fconstructor" "left" "right" "injection" "congruence" "reflexivity" "symmetry" "transitivity" "state" "induction" "induction_using" "substvars" "now" "with_options")) diff --git a/src/frontends/lean/builtin_cmds.cpp b/src/frontends/lean/builtin_cmds.cpp index 0dbbfce8d..6d350fb16 100644 --- a/src/frontends/lean/builtin_cmds.cpp +++ b/src/frontends/lean/builtin_cmds.cpp @@ -494,7 +494,7 @@ environment print_cmd(parser & p) { p.next(); p.check_token_next(get_rbracket_tk(), "invalid 'print [recursor]', ']' expected"); print_recursor_info(p); - } else if (p.curr_is_token(get_rewrite_attr_tk())) { + } else if (p.curr_is_token(get_simp_attr_tk())) { p.next(); print_rewrite_sets(p); } else if (print_polymorphic(p)) { diff --git a/src/frontends/lean/decl_attributes.cpp b/src/frontends/lean/decl_attributes.cpp index 5ab4a7c58..63eabb545 100644 --- a/src/frontends/lean/decl_attributes.cpp +++ b/src/frontends/lean/decl_attributes.cpp @@ -39,7 +39,7 @@ decl_attributes::decl_attributes(bool is_abbrev, bool persistent): m_refl = false; m_subst = false; m_recursor = false; - m_rewrite = false; + m_simp = false; } void decl_attributes::parse(buffer const & ns, parser & p) { @@ -135,9 +135,9 @@ void decl_attributes::parse(buffer const & ns, parser & p) { } else if (p.curr_is_token(get_subst_tk())) { p.next(); m_subst = true; - } else if (p.curr_is_token(get_rewrite_attr_tk())) { + } else if (p.curr_is_token(get_simp_attr_tk())) { p.next(); - m_rewrite = true; + m_simp = true; } else if (p.curr_is_token(get_recursor_tk())) { p.next(); if (!p.curr_is_token(get_rbracket_tk())) { @@ -217,7 +217,7 @@ environment decl_attributes::apply(environment env, io_state const & ios, name c env = add_user_recursor(env, d, m_recursor_major_pos, m_persistent); if (m_is_class) env = add_class(env, d, m_persistent); - if (m_rewrite) + if (m_simp) env = add_rewrite_rule(env, d, m_persistent); if (m_has_multiple_instances) env = mark_multiple_instances(env, d, m_persistent); @@ -229,7 +229,7 @@ void decl_attributes::write(serializer & s) const { << m_is_reducible << m_is_irreducible << m_is_semireducible << m_is_quasireducible << m_is_class << m_is_parsing_only << m_has_multiple_instances << m_unfold_full_hint << m_constructor_hint << m_symm << m_trans << m_refl << m_subst << m_recursor - << m_rewrite << m_recursor_major_pos << m_priority; + << m_simp << m_recursor_major_pos << m_priority; write_list(s, m_unfold_hint); } @@ -238,7 +238,7 @@ void decl_attributes::read(deserializer & d) { >> m_is_reducible >> m_is_irreducible >> m_is_semireducible >> m_is_quasireducible >> m_is_class >> m_is_parsing_only >> m_has_multiple_instances >> m_unfold_full_hint >> m_constructor_hint >> m_symm >> m_trans >> m_refl >> m_subst >> m_recursor - >> m_rewrite >> m_recursor_major_pos >> m_priority; + >> m_simp >> m_recursor_major_pos >> m_priority; m_unfold_hint = read_list(d); } } diff --git a/src/frontends/lean/decl_attributes.h b/src/frontends/lean/decl_attributes.h index d9a6d6340..f469920f8 100644 --- a/src/frontends/lean/decl_attributes.h +++ b/src/frontends/lean/decl_attributes.h @@ -29,7 +29,7 @@ class decl_attributes { bool m_refl; bool m_subst; bool m_recursor; - bool m_rewrite; + bool m_simp; optional m_recursor_major_pos; optional m_priority; list m_unfold_hint; diff --git a/src/frontends/lean/token_table.cpp b/src/frontends/lean/token_table.cpp index b70b294c0..26ec1741d 100644 --- a/src/frontends/lean/token_table.cpp +++ b/src/frontends/lean/token_table.cpp @@ -108,7 +108,7 @@ void init_token_table(token_table & t) { "definition", "example", "coercion", "abbreviation", "variables", "parameter", "parameters", "constant", "constants", "[persistent]", "[visible]", "[instance]", "[trans-instance]", "[none]", "[class]", "[coercion]", "[reducible]", "[irreducible]", "[semireducible]", "[quasireducible]", - "[rewrite]", "[parsing-only]", "[multiple-instances]", "[symm]", "[trans]", "[refl]", "[subst]", "[recursor", + "[simp]", "[parsing-only]", "[multiple-instances]", "[symm]", "[trans]", "[refl]", "[subst]", "[recursor", "evaluate", "check", "eval", "[wf]", "[whnf]", "[priority", "[unfold-full]", "[unfold-hints]", "[constructor]", "[unfold", "print", "end", "namespace", "section", "prelude", "help", diff --git a/src/frontends/lean/tokens.cpp b/src/frontends/lean/tokens.cpp index 44c84e80b..b743291bb 100644 --- a/src/frontends/lean/tokens.cpp +++ b/src/frontends/lean/tokens.cpp @@ -114,7 +114,7 @@ static name const * g_symm_tk = nullptr; static name const * g_trans_tk = nullptr; static name const * g_refl_tk = nullptr; static name const * g_subst_tk = nullptr; -static name const * g_rewrite_attr_tk = nullptr; +static name const * g_simp_attr_tk = nullptr; static name const * g_recursor_tk = nullptr; static name const * g_attribute_tk = nullptr; static name const * g_with_tk = nullptr; @@ -261,7 +261,7 @@ void initialize_tokens() { g_trans_tk = new name{"[trans]"}; g_refl_tk = new name{"[refl]"}; g_subst_tk = new name{"[subst]"}; - g_rewrite_attr_tk = new name{"[rewrite]"}; + g_simp_attr_tk = new name{"[simp]"}; g_recursor_tk = new name{"[recursor"}; g_attribute_tk = new name{"attribute"}; g_with_tk = new name{"with"}; @@ -409,7 +409,7 @@ void finalize_tokens() { delete g_trans_tk; delete g_refl_tk; delete g_subst_tk; - delete g_rewrite_attr_tk; + delete g_simp_attr_tk; delete g_recursor_tk; delete g_attribute_tk; delete g_with_tk; @@ -556,7 +556,7 @@ name const & get_symm_tk() { return *g_symm_tk; } name const & get_trans_tk() { return *g_trans_tk; } name const & get_refl_tk() { return *g_refl_tk; } name const & get_subst_tk() { return *g_subst_tk; } -name const & get_rewrite_attr_tk() { return *g_rewrite_attr_tk; } +name const & get_simp_attr_tk() { return *g_simp_attr_tk; } name const & get_recursor_tk() { return *g_recursor_tk; } name const & get_attribute_tk() { return *g_attribute_tk; } name const & get_with_tk() { return *g_with_tk; } diff --git a/src/frontends/lean/tokens.h b/src/frontends/lean/tokens.h index d765a1248..612f9a3fe 100644 --- a/src/frontends/lean/tokens.h +++ b/src/frontends/lean/tokens.h @@ -116,7 +116,7 @@ name const & get_symm_tk(); name const & get_trans_tk(); name const & get_refl_tk(); name const & get_subst_tk(); -name const & get_rewrite_attr_tk(); +name const & get_simp_attr_tk(); name const & get_recursor_tk(); name const & get_attribute_tk(); name const & get_with_tk(); diff --git a/src/frontends/lean/tokens.txt b/src/frontends/lean/tokens.txt index 708fb11fc..c289a8784 100644 --- a/src/frontends/lean/tokens.txt +++ b/src/frontends/lean/tokens.txt @@ -109,7 +109,7 @@ symm [symm] trans [trans] refl [refl] subst [subst] -rewrite_attr [rewrite] +simp_attr [simp] recursor [recursor attribute attribute with with diff --git a/src/library/simplifier/simp_tactic.cpp b/src/library/simplifier/simp_tactic.cpp index c6b69a5cd..a7d5a7a40 100644 --- a/src/library/simplifier/simp_tactic.cpp +++ b/src/library/simplifier/simp_tactic.cpp @@ -114,7 +114,6 @@ expr mk_simp_tactic_expr(buffer const & ls, buffer const & ns, if (pre_tac) { t = mk_app(mk_constant(get_option_some_name()), *pre_tac); } else { - t = mk_constant(get_option_none_name()); } expr l = mk_location_expr(loc); diff --git a/tests/lean/run/rw_set1.lean b/tests/lean/run/rw_set1.lean index 52f57998d..4d69c8611 100644 --- a/tests/lean/run/rw_set1.lean +++ b/tests/lean/run/rw_set1.lean @@ -1,7 +1,7 @@ import data.nat namespace foo - attribute nat.add.assoc [rewrite] + attribute nat.add.assoc [simp] print nat.add.assoc end foo @@ -9,8 +9,8 @@ print nat.add.assoc namespace foo print nat.add.assoc - attribute nat.add.comm [rewrite] + attribute nat.add.comm [simp] open nat print "---------" - print [rewrite] + print [simp] end foo diff --git a/tests/lean/rw_set2.lean b/tests/lean/rw_set2.lean index 0b5522d74..d23b4c089 100644 --- a/tests/lean/rw_set2.lean +++ b/tests/lean/rw_set2.lean @@ -6,7 +6,7 @@ constant g : nat → nat axiom foo : ∀ x, x > 0 → f x = 0 ∧ g x = 1 axiom bla : ∀ x, g x = f x + 1 -attribute foo [rewrite] -attribute bla [rewrite] +attribute foo [simp] +attribute bla [simp] -print [rewrite] +print [simp] diff --git a/tests/lean/rw_set3.lean b/tests/lean/rw_set3.lean index f4ed6923f..f17e7acb8 100644 --- a/tests/lean/rw_set3.lean +++ b/tests/lean/rw_set3.lean @@ -1,5 +1,5 @@ import data.nat -attribute nat.add.comm [rewrite] +attribute nat.add.comm [simp] -print [rewrite] +print [simp]