@@ -29,7 +29,7 @@ initialize registerTraceClass `tauto
29
29
def distribNotOnceAt (hypFVar : Expr) (g : MVarId) : MetaM AssertAfterResult := g.withContext do
30
30
let .fvar fvarId := hypFVar | throwError "not fvar {hypFVar}"
31
31
let h ← fvarId.getDecl
32
- let e : Q(Prop ) ← (do guard (← inferType h.type).isProp ; pure h.type)
32
+ let e : Q(Prop ) ← (do guard <| ← Meta.isProp h.type; pure h.type)
33
33
let replace (p : Expr) := g.replace h.fvarId p
34
34
match e with
35
35
| ~q(¬ ($a : Prop ) = $b) => do
@@ -92,25 +92,25 @@ Calls `distribNotAt` on the head of `state.fvars` up to `nIters` times, returnin
92
92
early on failure.
93
93
-/
94
94
partial def distribNotAt (nIters : Nat) (state : DistribNotState) : MetaM DistribNotState :=
95
- match nIters, state.fvars with
96
- | 0 , _ | _, [] => pure state
97
- | n + 1 , fv::fvs => do
98
- try
99
- let result ← distribNotOnceAt fv state.currentGoal
100
- let newFVars := ( mkFVar result.fvarId)::( fvs.map (fun x ↦ result.subst.apply x) )
101
- distribNotAt n ⟨newFVars, result.mvarId⟩
102
- catch _ => pure state
95
+ match nIters, state.fvars with
96
+ | 0 , _ | _, [] => pure state
97
+ | n + 1 , fv::fvs => do
98
+ try
99
+ let result ← distribNotOnceAt fv state.currentGoal
100
+ let newFVars := mkFVar result.fvarId :: fvs.map (fun x ↦ result.subst.apply x)
101
+ distribNotAt n ⟨newFVars, result.mvarId⟩
102
+ catch _ => pure state
103
103
104
104
/--
105
105
For each fvar in `fvars`, calls `distribNotAt` and carries along the resulting
106
106
renamings.
107
107
-/
108
108
partial def distribNotAux (fvars : List Expr) (g : MVarId) : MetaM MVarId :=
109
- match fvars with
110
- | [] => pure g
111
- | _ => do
112
- let result ← distribNotAt 3 ⟨fvars, g⟩
113
- distribNotAux result.fvars.tail! result.currentGoal
109
+ match fvars with
110
+ | [] => pure g
111
+ | _ => do
112
+ let result ← distribNotAt 3 ⟨fvars, g⟩
113
+ distribNotAux result.fvars.tail! result.currentGoal
114
114
115
115
/--
116
116
Tries to apply de-Morgan-like rules on all hypotheses.
@@ -120,7 +120,7 @@ def distribNot : TacticM Unit := withMainContext do
120
120
let mut fvars := []
121
121
for h in ← getLCtx do
122
122
if !h.isImplementationDetail then
123
- fvars := ( mkFVar h.fvarId) :: fvars
123
+ fvars := mkFVar h.fvarId :: fvars
124
124
liftMetaTactic' (distribNotAux fvars)
125
125
126
126
/-- Config for the `tauto` tactic. Currently empty. TODO: add `closer` option. -/
@@ -131,15 +131,17 @@ declare_config_elab elabConfig Config
131
131
132
132
/-- Matches propositions where we want to apply the `constructor` tactic
133
133
in the core loop of `tauto`. -/
134
- def coreConstructorMatcher (e : Q(Prop )) : MetaM Bool := match e with
134
+ def coreConstructorMatcher (e : Q(Prop )) : MetaM Bool :=
135
+ match e with
135
136
| ~q(_ ∧ _) => pure true
136
137
| ~q(_ ↔ _) => pure true
137
138
| ~q(True) => pure true
138
139
| _ => pure false
139
140
140
141
/-- Matches propositions where we want to apply the `cases` tactic
141
142
in the core loop of `tauto`. -/
142
- def casesMatcher (e : Q(Prop )) : MetaM Bool := match e with
143
+ def casesMatcher (e : Q(Prop )) : MetaM Bool :=
144
+ match e with
143
145
| ~q(_ ∧ _) => pure true
144
146
| ~q(_ ∨ _) => pure true
145
147
| ~q(Exists _) => pure true
@@ -179,7 +181,8 @@ def tautoCore : TacticM Unit := do
179
181
180
182
/-- Matches propositions where we want to apply the `constructor` tactic in the
181
183
finishing stage of `tauto`. -/
182
- def finishingConstructorMatcher (e : Q(Prop )) : MetaM Bool := match e with
184
+ def finishingConstructorMatcher (e : Q(Prop )) : MetaM Bool :=
185
+ match e with
183
186
| ~q(_ ∧ _) => pure true
184
187
| ~q(_ ↔ _) => pure true
185
188
| ~q(Exists _) => pure true
0 commit comments