@@ -9,6 +9,8 @@ public import Mathlib.Init
99public meta import Lean.Meta.CoeAttr
1010public import Lean.Meta.CoeAttr
1111
12+ import Mathlib.Tactic.TypeStar
13+
1214/-!
1315## `funProp` Meta programming functions like in Lean.Expr.* but for working with bundled morphisms.
1416
@@ -31,6 +33,10 @@ open Lean Meta
3133
3234namespace Meta.FunProp
3335
36+ /-- An abbreviation of `∀ x, p x`. It is used by `fun_prop` to represent Pi types as function
37+ applications and should not occur in any place other than the implementation of `fun_prop`. -/
38+ abbrev Forall {α : Sort *} (p : α → Sort *) := ∀ x, p x
39+
3440namespace Mor
3541
3642/-- Is `name` a coercion from some function space to functions? -/
@@ -136,9 +142,7 @@ where
136142 go (.app (.app c f) x) as
137143 | .app f a, as => go f (as.push { expr := a })
138144 | .forallE x t b bi, _ => do
139- let u ← getLevel t
140- let v ← withLocalDecl x bi t fun x => getLevel (b.instantiate1 x)
141- k (.const `_Forall [u, v]) #[{ expr := t }, { expr := .lam x t b bi }]
145+ go (← mkAppM ``Forall #[.lam x t b bi]) #[]
142146 | f, as => k f as.reverse
143147
144148
@@ -163,10 +167,6 @@ def getAppArgs (e : Expr) : MetaM (Array Arg) := withApp e fun _ xs => return xs
163167
164168/-- `mkAppN f #[a₀, ..., aₙ]` ==> `f a₀ a₁ .. aₙ` where `f` can be bundled morphism. -/
165169def mkAppN (f : Expr) (xs : Array Arg) : Expr :=
166- let f :=
167- if f.isConstOf `_Forall then
168- Expr.mkLambdaForall f.constLevels![0 ]! f.constLevels![1 ]!
169- else f
170170 xs.foldl (init := f) (fun f x =>
171171 match x with
172172 | ⟨x, .none⟩ => (f.app x)
0 commit comments