Skip to content

Commit 9af397d

Browse files
committed
Update to v4.26.0-rc2
1 parent e1ef209 commit 9af397d

File tree

20 files changed

+63
-63
lines changed

20 files changed

+63
-63
lines changed

Auto/Embedding/LCtx.lean

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ section push
495495
pushLCtxs (x :: xs) lctx = pushLCtx x (pushLCtxs xs lctx) := by
496496
apply funext; intros n; cases n
497497
case h.zero =>
498-
dsimp [pushLCtxs, pushLCtx, Nat.blt, Nat.ble]; rw [Nat.zero_ble]
498+
dsimp [pushLCtxs, pushLCtx, Nat.blt, Nat.ble]
499499
case h.succ n =>
500500
dsimp [pushLCtxs, pushLCtx, Nat.blt, Nat.ble]; rw [Nat.succ_sub_succ]
501501

@@ -515,7 +515,7 @@ section push
515515

516516
theorem pushLCtxs_cons_zero (xs : List α) (lctx : Nat → α) :
517517
pushLCtxs (x :: xs) lctx 0 = x := by
518-
dsimp [pushLCtxs, Nat.blt, Nat.ble]; rw [Nat.zero_ble]
518+
dsimp [pushLCtxs, Nat.blt, Nat.ble]
519519

520520
theorem pushLCtxs_cons_succ (xs : List α) (lctx : Nat → α) (n : Nat) :
521521
pushLCtxs (x :: xs) lctx (.succ n) = pushLCtxs xs lctx n := by
@@ -612,8 +612,7 @@ section push
612612
apply HEq.funext; intros n; cases n
613613
case zero =>
614614
dsimp [pushLCtxs, pushLCtx, Nat.blt, Nat.ble]
615-
rw [Nat.ble_eq_true_of_le]; rfl
616-
apply Nat.zero_le
615+
rfl
617616
case succ n =>
618617
dsimp [pushLCtxs, pushLCtx, Nat.blt, Nat.ble]
619618
rw [Nat.succ_sub_succ]; rfl
@@ -623,8 +622,7 @@ section push
623622
(xs : HList lctxty tys) {rty : Nat → α} (lctx : ∀ n, lctxty (rty n)) :
624623
HEq (pushLCtxsDep (.cons x xs) lctx 0) x := by
625624
dsimp [pushLCtxs, Nat.blt, Nat.ble];
626-
rw [Nat.ble_eq_true_of_le]; rfl
627-
apply Nat.zero_le
625+
rfl
628626

629627
theorem pushLCtxsDep_cons_succ
630628
{lctxty : α → Sort u} {ty : α} (x : lctxty ty) {tys : List α}
@@ -771,9 +769,7 @@ section push
771769
dsimp at heq; rw [← heq]
772770
rw [HList.ofFun_succ];
773771
congr
774-
case e_3.h => dsimp; rw [pushLCtxs_cons_zero]
775772
case e_4.h => dsimp; rw [pushLCtxs_cons_succ_Fn]; apply List.ofFun_ofPushLCtx; rfl
776-
case e_5 => apply pushLCtxsDep_cons_zero
777773
case e_6 =>
778774
apply HEq.trans _ (ofFun_ofPushLCtxDep rfl xs lctx)
779775
congr

Auto/Embedding/LamBase.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2569,7 +2569,7 @@ theorem LamTerm.maxLooseBVarSucc.spec (m : Nat) :
25692569
let IH' := Nat.pred_le_pred (IH.mp h)
25702570
rw [Nat.pred_succ] at IH'; exact IH'
25712571
case mpr =>
2572-
apply IH.mpr; apply Nat.lt_pred_iff_succ_lt.mp; exact h
2572+
apply IH.mpr; apply Nat.lt_pred_iff.mp; exact h
25732573
| .app _ t₁ t₂ => by
25742574
dsimp [hasLooseBVarGe, maxLooseBVarSucc];
25752575
rw [Bool.or_eq_true]; rw [spec m t₁]; rw [spec m t₂];

Auto/Embedding/LamBitVec.lean

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace BVLems
6666
have hle := of_decide_eq_true hdec
6767
rw [Bool.dite_eq_true (proof:=hle), toNat_zeroExtend']
6868
rw [Nat.mod_eq_of_lt]; rcases a with ⟨⟨a, isLt⟩⟩;
69-
apply Nat.le_trans isLt; apply Nat.pow_le_pow_right (Nat.le_step .refl) hle
69+
apply Nat.le_trans isLt; apply Nat.pow_le_pow_right (Nat.le_succ_of_le .refl) hle
7070

7171
theorem toNat_sub (a b : BitVec n) : (a - b).toNat = (2 ^ n - b.toNat + a.toNat) % (2 ^ n) := rfl
7272

@@ -93,12 +93,12 @@ namespace BVLems
9393
theorem ushiftRight_ge_length_eq_zero (a : BitVec n) (i : Nat) : i ≥ n → a >>> i = 0#n := by
9494
intro h; apply eq_of_val_eq; rw [toNat_ushiftRight, toNat_ofNat]
9595
apply (Nat.le_iff_div_eq_zero (Nat.two_pow_pos _)).mpr
96-
apply Nat.le_trans (toNat_le _) (Nat.pow_le_pow_right (.step .refl) h)
96+
apply Nat.le_trans (toNat_le _) (Nat.pow_le_pow_right (Nat.lt_succ_of_lt .refl) h)
9797

9898
theorem ushiftRight_ge_length_eq_zero' (a : BitVec n) (i : Nat) : i ≥ n → BitVec.ofNat n (a.toNat >>> i) = 0#n := by
9999
intro h; apply congrArg (@BitVec.ofNat n)
100100
rw [Nat.shiftRight_eq_div_pow, Nat.le_iff_div_eq_zero (Nat.two_pow_pos _)]
101-
apply Nat.le_trans (toNat_le _) (Nat.pow_le_pow_right (.step .refl) h)
101+
apply Nat.le_trans (toNat_le _) (Nat.pow_le_pow_right (Nat.lt_succ_of_lt .refl) h)
102102

103103
theorem msb_equiv_lt (a : BitVec n) : !a.msb ↔ a.toNat < 2 ^ (n - 1) := by
104104
dsimp [BitVec.msb, BitVec.getMsbD, BitVec.getLsbD]
@@ -116,32 +116,37 @@ namespace BVLems
116116
case succ n =>
117117
rw [Nat.succ_sub_one, Nat.pow_succ, Nat.mul_comm (m:=2)]
118118
apply Iff.symm; apply Nat.mul_lt_mul_left
119-
exact .step .refl
119+
exact Nat.lt_succ_of_lt .refl
120120

121121
theorem sshiftRight_ge_length_eq_msb (a : BitVec n) (i : Nat) : i ≥ n → a.sshiftRight i =
122122
if a.msb then (1#n).neg else 0#n := by
123123
intro h; simp only [sshiftRight, BitVec.toInt, ← msb_equiv_lt']
124-
cases hmsb : a.msb <;> simp only [Int.shiftRight_def] <;> dsimp
124+
cases hmsb : a.msb <;> simp only [Int.shiftRight_def]
125125
case false =>
126+
dsimp only [Bool.not_false, ↓dreduceIte, Int.ofNat_eq_natCast, Int.natCast_shiftRight, Bool.false_eq_true]
126127
rw [BitVec.ofNat]
127128
apply ushiftRight_ge_length_eq_zero'; exact h
128129
case true =>
129130
rw [← Int.subNatNat_eq_coe, Int.subNatNat_of_lt (toNat_le _)]
130-
simp only [BitVec.ofInt]; dsimp
131+
simp only [BitVec.ofInt]
132+
dsimp only [Bool.not_true, Bool.false_eq_true, ↓dreduceIte,
133+
Nat.pred_eq_sub_one, Int.ofNat_eq_natCast, Int.natCast_shiftRight, Int.natCast_pow,
134+
Int.cast_ofNat_Int, neg_eq]
131135
have hzero : (2 ^ n - BitVec.toNat a - 1) >>> i = 0 := by
132136
rw [Nat.shiftRight_eq_div_pow]; apply (Nat.le_iff_div_eq_zero (Nat.two_pow_pos _)).mpr
133137
rw [Nat.sub_one, Nat.pred_lt_iff_le (Nat.two_pow_pos _)]
134-
apply Nat.le_trans (Nat.sub_le _ _) (Nat.pow_le_pow_right (.step .refl) h)
138+
apply Nat.le_trans (Nat.sub_le _ _) (Nat.pow_le_pow_right (Nat.lt_succ_of_lt .refl) h)
135139
apply eq_of_val_eq; rw [toNat_ofNatLt, hzero]
136140
rw [toNat_neg, Int.mod_def', Int.emod]
137-
rw [Nat.zero_mod, Int.natAbs_natCast, Nat.succ_eq_add_one, Nat.zero_add]
138-
rw [Int.subNatNat_of_sub_eq_zero ((Nat.sub_eq_zero_iff_le).mpr (Nat.two_pow_pos _))]
141+
rw [Nat.zero_mod, Nat.succ_eq_add_one, Nat.zero_add]
142+
rw [Int.subNatNat_of_sub_eq_zero (by grind)]
139143
rw [Int.toNat_natCast, BitVec.toNat_ofNat]
140144
cases n <;> try rfl
141145
case succ n =>
142-
have hlt : 22 ^ Nat.succ n := @Nat.pow_le_pow_right 2 (.step .refl) 1 (.succ n) (Nat.succ_le_succ (Nat.zero_le _))
146+
have hlt : 22 ^ Nat.succ n := @Nat.pow_le_pow_right 2 (Nat.lt_succ_of_lt .refl) 1 (.succ n) (Nat.succ_le_succ (Nat.zero_le _))
143147
rw [Nat.mod_eq_of_lt (a:=1) hlt]
144-
rw [Nat.mod_eq_of_lt]; apply Nat.sub_lt (Nat.le_trans (.step .refl) hlt) .refl
148+
rw [Nat.mod_eq_of_lt (by grind)]
149+
grind
145150

146151
theorem shiftRight_eq_zero_iff (a : BitVec n) (b : Nat) : a >>> b = 0#n ↔ a.toNat < 2 ^ b := by
147152
rw [ushiftRight_def]; rcases a with ⟨⟨a, isLt⟩⟩;
@@ -201,7 +206,7 @@ namespace BVLems
201206

202207
theorem shl_toNat_equiv_short (a : BitVec n) (b : BitVec m) (h : m ≤ n) : a <<< b.toNat = a <<< (zeroExtend n b) := by
203208
apply eq_of_val_eq; rw [toNat_shiftLeft, smtshiftLeft_def, toNat_shiftLeft, toNat_zeroExtend, Nat.mod_eq_of_lt (a:=BitVec.toNat b)]
204-
apply Nat.le_trans (toNat_le _) (Nat.pow_le_pow_right (.step .refl) h)
209+
apply Nat.le_trans (toNat_le _) (Nat.pow_le_pow_right (Nat.lt_succ_of_lt .refl) h)
205210

206211
theorem shl_toNat_equiv_long (a : BitVec n) (b : BitVec m) (h : m > n) : a <<< b.toNat =
207212
if (b >>> (BitVec.ofNat m n)) = 0#m then a <<< (zeroExtend n b) else 0 := by
@@ -244,7 +249,7 @@ namespace BVLems
244249

245250
theorem lshr_toNat_equiv_short (a : BitVec n) (b : BitVec m) (h : m ≤ n) : a >>> b.toNat = a >>> (zeroExtend n b) := by
246251
apply eq_of_val_eq; rw [toNat_ushiftRight, smtushiftRight_def, toNat_ushiftRight, toNat_zeroExtend, Nat.mod_eq_of_lt]
247-
apply Nat.le_trans (toNat_le _) (Nat.pow_le_pow_right (.step .refl) h)
252+
apply Nat.le_trans (toNat_le _) (Nat.pow_le_pow_right (Nat.lt_succ_of_lt .refl) h)
248253

249254
theorem lshr_toNat_equiv_long (a : BitVec n) (b : BitVec m) (h : m > n) : a >>> b.toNat =
250255
if (b >>> (BitVec.ofNat m n)) = 0#m then a >>> (zeroExtend n b) else 0 := by
@@ -289,7 +294,7 @@ namespace BVLems
289294

290295
theorem ashr_toNat_equiv_short (a : BitVec n) (b : BitVec m) (h : m ≤ n) : a.sshiftRight b.toNat = a.sshiftRight (zeroExtend n b).toNat := by
291296
apply eq_of_val_eq; rw [toNat_zeroExtend, Nat.mod_eq_of_lt]
292-
apply Nat.le_trans (toNat_le _) (Nat.pow_le_pow_right (.step .refl) h)
297+
apply Nat.le_trans (toNat_le _) (Nat.pow_le_pow_right (Nat.lt_succ_of_lt .refl) h)
293298

294299
theorem ashr_toNat_equiv_long (a : BitVec n) (b : BitVec m) (h : m > n) : a.sshiftRight b.toNat =
295300
if (b >>> (BitVec.ofNat m n)) = 0#m then a.sshiftRight (zeroExtend n b).toNat else (if a.msb then (1#n).neg else 0#n) := by

Auto/Embedding/LamChecker.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1664,7 +1664,7 @@ theorem EtomStep.eval_correct
16641664
rw [Nat.beq_eq_false_of_ne (Nat.ne_of_lt hlt)]
16651665
case right =>
16661666
rw [LamTerm.maxEVarSucc_mkEq]; dsimp [LamTerm.maxEVarSucc]
1667-
rw [Nat.max_le]; apply And.intro (Nat.le_refl _) (Nat.le_step h₂')
1667+
rw [Nat.max_le]; apply And.intro (Nat.le_refl _) (Nat.le_succ_of_le h₂')
16681668
| false => exact True.intro
16691669
| .none => exact True.intro
16701670

Auto/Embedding/LamConv.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,6 @@ theorem LamWF.interp_instantiate1.{u}
962962
case eqBody => rw [pushLCtxAt_zero]
963963
case eqLarge =>
964964
apply eq_of_heq; apply LamWF.interp_heq <;> try rfl
965-
case h.HLCtxTyEq => rw [pushLCtxAt_zero]
966965
case h.HLCtxTermEq =>
967966
apply HEq.trans (HEq.symm (pushLCtxAtDep_zero _ _)) _
968967
apply pushLCtxAtDep_heq <;> try rfl

Auto/EvaluateAuto/NameArr.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ def Name.uniqRepr (n : Name) : String :=
3636
-/
3737
def Name.parseUniqRepr (n : String) : Name :=
3838
let compParse (s : String) : String ⊕ Nat := Id.run <| do
39-
let s := s.data
39+
let s := s.toList
4040
if s[0]? == '\\' then
4141
if let .some c := s[1]? then
4242
if c.isDigit then
43-
return .inr ((String.toNat? (String.mk (s.drop 1))).getD 0)
43+
return .inr ((String.toNat? (String.ofList (s.drop 1))).getD 0)
4444
let mut ret := ""
4545
let mut escape := false
4646
for c in s do

Auto/EvaluateAuto/OS.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ def EvalProc.create (path : String) (args : Array String) : IO EvalProc :=
1212
IO.Process.spawn {stdin := .piped, stdout := .null, stderr := .null, cmd := path, args := args}
1313

1414
def bashRepr (s : String) :=
15-
"\"" ++ String.join (s.data.map go) ++ "\""
15+
"\"" ++ String.join (s.toList.map go) ++ "\""
1616
where
1717
go : Char → String
1818
| '$' => "\\$"
1919
| '`' => "\\`"
2020
| '\"' => "\\\""
2121
| '\\' => "\\\\"
22-
| c => String.mk [c]
22+
| c => String.ofList [c]
2323

2424
def runLeanFileUsingNewLeanProcess
2525
(leanFile : String) (memoryLimitKb : Nat) (timeLimitS : Nat) :

Auto/IR/SMT.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def SpecConst.toString : SpecConst → String
9999
| .binary bs => bs.foldl (fun acc b => acc.push (if b then '1' else '0')) "#b"
100100
| .num n => ToString.toString (repr n)
101101
where specCharRepr (c : Char) : String :=
102-
"\\u{" ++ String.mk (Nat.toDigits 16 c.toNat) ++ "}"
102+
"\\u{" ++ String.ofList (Nat.toDigits 16 c.toNat) ++ "}"
103103

104104
mutual
105105

Auto/IR/TPTP_TH0.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def transNatConst (nc : NatConst) : String := "t_" ++ nc.reprAux.replace " " "_"
6060
def transIntConst (ic : IntConst) : String := "t_" ++ ic.reprAux
6161

6262
def transString (s : String) : String :=
63-
String.join (s.data.map (fun c => s!"d{c.toNat}"))
63+
String.join (s.toList.map (fun c => s!"d{c.toNat}"))
6464

6565
def transStringConst : StringConst → String
6666
| .strVal s => "t_strVal_" ++ transString s

Auto/Lib/BinTree.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ theorem insert'.correct₁ (bt : BinTree β) (n : Nat) (x : β) : n ≠ 0 → ge
315315
case ind =>
316316
intros n IH bt _
317317
have hne' : (n + 2) / 20 := by
318-
rw [Nat.add_div_right _ (.step .refl)]; intro h; cases h
318+
rw [Nat.add_div_right _ (Nat.lt_succ_of_lt .refl)]; intro h; cases h
319319
let IH' := fun bt => IH bt hne'
320320
rw [get?'_succSucc, insert'.succSucc, left!.eq_def, right!.eq_def]
321321
cases (n + 2) % 2 <;> cases bt <;> dsimp <;> rw [IH']
@@ -349,7 +349,7 @@ theorem insert'.correct₂ (bt : BinTree β) (n₁ n₂ : Nat) (x : β) : n₁
349349
rw [heq, h]
350350
have hmod : ∀ {n n'}, (n % 2) = .succ n' → n % 2 = 1 := by
351351
intros n n' H;
352-
have hle : (n % 2) < 2 := Nat.mod_lt _ (.step .refl)
352+
have hle : (n % 2) < 2 := Nat.mod_lt _ (Nat.lt_succ_of_lt .refl)
353353
revert H hle; cases (n % 2)
354354
case zero => intro contra; cases contra
355355
case succ a =>

0 commit comments

Comments
 (0)