Given,
t := λ β₁ => ... => βₘ => ∀ α₁ → ∀ α₂ → ... → αₙcorresponding to a match expression returning functions as rhs; andnbArgs ∈ [0..n]corresponding to the number of extra arguments applied to the match expression; and- α'₁, ..., α'ₘ := [ αᵢ | i ∈ [nbArgs, n] ] Return:
- ∀ α'₁ → ∀ α'₂ → ... → α'ₘ Note that the returned type will correspond to αₙ when nbArgs = n.
Equations
Instances For
Given application f x₁ ... xₙ, apply the following normalization rules:
When
f := Blaster.dite' c (fun h : c => t₁) (fun h : ¬ c => t₂)Return Blaster.dite' c (fun h : c => t₁ x₁ ... xₙ) (fun h : ¬ c => t₂ x₁ ... xₙ)When
f := match₁ e₁, ..., eₙ with | p₍₁₎₍₁₎, ..., p₍₁₎₍ₙ₎ => t₁ ... | p₍ₘ₎₍₁₎, ..., p₍ₘ₎₍ₙ₎ => tₘReturn match₁ e₁, ..., eₙ with | p₍₁₎₍₁₎, ..., p₍₁₎₍ₙ₎ => t₁ x₁ ... xₙ ... | p₍ₘ₎₍₁₎, ..., p₍ₘ₎₍ₙ₎ => tₘ x₁ ... xₙ
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Optimize.normChoiceApplication?.mkAppInDIteExpr extra_args ite_cond (Lean.Expr.lam n t body bi) = pure (Lean.Expr.lam n t (Lean.mkAppN body extra_args) bi)
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Optimize.normChoiceApplication?.normDIteApp? f args = pure none
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Apply the following propagation rules on any function application fn e₁ ... eₙ
only when fn := Expr.const n l ∧ n ≠ Blaster.dite' ∧ ¬ isNotFun fn ∧ propagate fn e₁ ... eₙ
When ∃ i ∈ [1..n],
eᵢ := Blaster.dite' c (fun h : c => d₁) (fun h : ¬ c => d₂)∧ ∀ j ∈ [1..n], (i ≠ j → gⱼ = eⱼ) ∧ (i = j → gⱼ = d₁) ∧ (i ≠ j → hⱼ = eⱼ) ∧ (i = j → hⱼ = d₂) ReturnBlaster.dite' c then (fun h : c => fn g₁ ... gₙ) (fun h : ¬ c => fn h₁ ... hₙ)When ∃ i ∈ [1..n], eᵢ := match₂ f₁, ..., fₚ with | p₍₁₎₍₁₎, ..., p₍₁₎₍ₚ₎ => t₁ ... | p₍ₘ₎₍₁₎, ..., p₍ₘ₎₍ₚ₎ => tₘ ∧ ∀ k ∈ [1..m], ∀ j ∈ [1..n], (i ≠ j → g₍ₖ₎₍ⱼ₎ = eⱼ) ∧ (i = j → g₍ₖ₎₍ⱼ₎ = tₖ) Return
match₂ f₁, ..., fₚ with | p₍₁₎₍₁₎, ..., p₍₁₎₍ₚ₎ => fn g₍₁₎₍₁₎, ..., g₍₁₎₍ₙ₎ ... | p₍ₘ₎₍₁₎, ..., p₍ₘ₎₍ₚ₎ => fn g₍ₘ₎₍₁₎, ..., g₍ₘ₎₍ₙ₎
with:
propagate fn e₁ ... eₙ :=
isCtorExpr fn ∨
allExplicitParamsAreCtor fn e₁ ... eₙ (funPropagation := true) ∨
(fn = Eq ∧ n = 3 ∧ (isBoolValue? e₂).isSome )
NOTE: skipPropCheck is set to true only when it is known beforehand that cf
is a recursive function for which allExplicitParamsAreCtor cf cargs (funPropagation := true)
returns true.
NOTE: reorderArgs is set to true only when funPropagation? is called before optimizeApp.
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Optimize.funPropagation? cf cargs skipPropCheck reorderArgs = Blaster.Optimize.withLocalContext (pure none)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Blaster.Optimize.funPropagation?.pushFunInDIteExpr f args idxField ite_cond (Lean.Expr.lam n t body bi) = pure (Lean.Expr.lam n t (Lean.mkAppN f (args.set! idxField body)) bi)
Instances For
Implements dite over ctor rule
Equations
- One or more equations did not get rendered due to their size.
Instances For
Implements match over ctor rule
Equations
- One or more equations did not get rendered due to their size.