|
|
@ -11,19 +11,19 @@ def congruenceArg (mvarId: MVarId): MetaM (List MVarId) := mvarId.withContext do
|
|
|
|
let userName := (← mvarId.getDecl).userName
|
|
|
|
let userName := (← mvarId.getDecl).userName
|
|
|
|
|
|
|
|
|
|
|
|
let u ← Meta.mkFreshLevelMVar
|
|
|
|
let u ← Meta.mkFreshLevelMVar
|
|
|
|
let α ← Meta.mkFreshExprMVar (.some $ mkSort u)
|
|
|
|
let α ← Meta.mkFreshExprSyntheticOpaqueMVar (mkSort u)
|
|
|
|
.natural (userName := userName ++ `α)
|
|
|
|
(tag := userName ++ `α)
|
|
|
|
let f ← Meta.mkFreshExprMVar (.some <| .forallE .anonymous α β .default)
|
|
|
|
let f ← Meta.mkFreshExprSyntheticOpaqueMVar (.forallE .anonymous α β .default)
|
|
|
|
.synthetic (userName := userName ++ `f)
|
|
|
|
(tag := userName ++ `f)
|
|
|
|
let a₁ ← Meta.mkFreshExprMVar (.some α)
|
|
|
|
let a₁ ← Meta.mkFreshExprSyntheticOpaqueMVar α
|
|
|
|
.synthetic (userName := userName ++ `a₁)
|
|
|
|
(tag := userName ++ `a₁)
|
|
|
|
let a₂ ← Meta.mkFreshExprMVar (.some α)
|
|
|
|
let a₂ ← Meta.mkFreshExprSyntheticOpaqueMVar α
|
|
|
|
.synthetic (userName := userName ++ `a₂)
|
|
|
|
(tag := userName ++ `a₂)
|
|
|
|
let h ← Meta.mkFreshExprMVar (.some $ ← Meta.mkEq a₁ a₂)
|
|
|
|
let h ← Meta.mkFreshExprSyntheticOpaqueMVar (← Meta.mkEq a₁ a₂)
|
|
|
|
.synthetic (userName := userName ++ `h)
|
|
|
|
(tag := userName ++ `h)
|
|
|
|
let conduitType ← Meta.mkEq (← Meta.mkEq (.app f a₁) (.app f a₂)) target
|
|
|
|
let conduitType ← Meta.mkEq (← Meta.mkEq (.app f a₁) (.app f a₂)) target
|
|
|
|
let conduit ← Meta.mkFreshExprMVar conduitType
|
|
|
|
let conduit ← Meta.mkFreshExprSyntheticOpaqueMVar conduitType
|
|
|
|
.synthetic (userName := userName ++ `conduit)
|
|
|
|
(tag := userName ++ `conduit)
|
|
|
|
mvarId.assign $ ← Meta.mkEqMP conduit (← Meta.mkCongrArg f h)
|
|
|
|
mvarId.assign $ ← Meta.mkEqMP conduit (← Meta.mkCongrArg f h)
|
|
|
|
let result := [α, a₁, a₂, f, h, conduit]
|
|
|
|
let result := [α, a₁, a₂, f, h, conduit]
|
|
|
|
return result.map (·.mvarId!)
|
|
|
|
return result.map (·.mvarId!)
|
|
|
@ -39,20 +39,20 @@ def congruenceFun (mvarId: MVarId): MetaM (List MVarId) := mvarId.withContext do
|
|
|
|
let .some (β, _, _) := (← instantiateMVars target).eq? | throwError "Goal is not an Eq"
|
|
|
|
let .some (β, _, _) := (← instantiateMVars target).eq? | throwError "Goal is not an Eq"
|
|
|
|
let userName := (← mvarId.getDecl).userName
|
|
|
|
let userName := (← mvarId.getDecl).userName
|
|
|
|
let u ← Meta.mkFreshLevelMVar
|
|
|
|
let u ← Meta.mkFreshLevelMVar
|
|
|
|
let α ← Meta.mkFreshExprMVar (.some $ mkSort u)
|
|
|
|
let α ← Meta.mkFreshExprSyntheticOpaqueMVar (mkSort u)
|
|
|
|
.natural (userName := userName ++ `α)
|
|
|
|
(tag := userName ++ `α)
|
|
|
|
let fType := .forallE .anonymous α β .default
|
|
|
|
let fType := .forallE .anonymous α β .default
|
|
|
|
let f₁ ← Meta.mkFreshExprMVar (.some fType)
|
|
|
|
let f₁ ← Meta.mkFreshExprSyntheticOpaqueMVar fType
|
|
|
|
.synthetic (userName := userName ++ `f₁)
|
|
|
|
(tag := userName ++ `f₁)
|
|
|
|
let f₂ ← Meta.mkFreshExprMVar (.some fType)
|
|
|
|
let f₂ ← Meta.mkFreshExprSyntheticOpaqueMVar fType
|
|
|
|
.synthetic (userName := userName ++ `f₂)
|
|
|
|
(tag := userName ++ `f₂)
|
|
|
|
let a ← Meta.mkFreshExprMVar (.some α)
|
|
|
|
let a ← Meta.mkFreshExprSyntheticOpaqueMVar α
|
|
|
|
.synthetic (userName := userName ++ `a)
|
|
|
|
(tag := userName ++ `a)
|
|
|
|
let h ← Meta.mkFreshExprMVar (.some $ ← Meta.mkEq f₁ f₂)
|
|
|
|
let h ← Meta.mkFreshExprSyntheticOpaqueMVar (← Meta.mkEq f₁ f₂)
|
|
|
|
.synthetic (userName := userName ++ `h)
|
|
|
|
(tag := userName ++ `h)
|
|
|
|
let conduitType ← Meta.mkEq (← Meta.mkEq (.app f₁ a) (.app f₂ a)) target
|
|
|
|
let conduitType ← Meta.mkEq (← Meta.mkEq (.app f₁ a) (.app f₂ a)) target
|
|
|
|
let conduit ← Meta.mkFreshExprMVar conduitType
|
|
|
|
let conduit ← Meta.mkFreshExprSyntheticOpaqueMVar conduitType
|
|
|
|
.synthetic (userName := userName ++ `conduit)
|
|
|
|
(tag := userName ++ `conduit)
|
|
|
|
mvarId.assign $ ← Meta.mkEqMP conduit (← Meta.mkCongrFun h a)
|
|
|
|
mvarId.assign $ ← Meta.mkEqMP conduit (← Meta.mkCongrFun h a)
|
|
|
|
let result := [α, f₁, f₂, h, a, conduit]
|
|
|
|
let result := [α, f₁, f₂, h, a, conduit]
|
|
|
|
return result.map (·.mvarId!)
|
|
|
|
return result.map (·.mvarId!)
|
|
|
@ -68,24 +68,24 @@ def congruence (mvarId: MVarId): MetaM (List MVarId) := mvarId.withContext do
|
|
|
|
let .some (β, _, _) := (← instantiateMVars target).eq? | throwError "Goal is not an Eq"
|
|
|
|
let .some (β, _, _) := (← instantiateMVars target).eq? | throwError "Goal is not an Eq"
|
|
|
|
let userName := (← mvarId.getDecl).userName
|
|
|
|
let userName := (← mvarId.getDecl).userName
|
|
|
|
let u ← Meta.mkFreshLevelMVar
|
|
|
|
let u ← Meta.mkFreshLevelMVar
|
|
|
|
let α ← Meta.mkFreshExprMVar (.some $ mkSort u)
|
|
|
|
let α ← Meta.mkFreshExprSyntheticOpaqueMVar (mkSort u)
|
|
|
|
.natural (userName := userName ++ `α)
|
|
|
|
(tag := userName ++ `α)
|
|
|
|
let fType := .forallE .anonymous α β .default
|
|
|
|
let fType := .forallE .anonymous α β .default
|
|
|
|
let f₁ ← Meta.mkFreshExprMVar (.some fType)
|
|
|
|
let f₁ ← Meta.mkFreshExprSyntheticOpaqueMVar fType
|
|
|
|
.synthetic (userName := userName ++ `f₁)
|
|
|
|
(tag := userName ++ `f₁)
|
|
|
|
let f₂ ← Meta.mkFreshExprMVar (.some fType)
|
|
|
|
let f₂ ← Meta.mkFreshExprSyntheticOpaqueMVar fType
|
|
|
|
.synthetic (userName := userName ++ `f₂)
|
|
|
|
(tag := userName ++ `f₂)
|
|
|
|
let a₁ ← Meta.mkFreshExprMVar (.some α)
|
|
|
|
let a₁ ← Meta.mkFreshExprSyntheticOpaqueMVar α
|
|
|
|
.synthetic (userName := userName ++ `a₁)
|
|
|
|
(tag := userName ++ `a₁)
|
|
|
|
let a₂ ← Meta.mkFreshExprMVar (.some α)
|
|
|
|
let a₂ ← Meta.mkFreshExprSyntheticOpaqueMVar α
|
|
|
|
.synthetic (userName := userName ++ `a₂)
|
|
|
|
(tag := userName ++ `a₂)
|
|
|
|
let h₁ ← Meta.mkFreshExprMVar (.some $ ← Meta.mkEq f₁ f₂)
|
|
|
|
let h₁ ← Meta.mkFreshExprSyntheticOpaqueMVar (← Meta.mkEq f₁ f₂)
|
|
|
|
.synthetic (userName := userName ++ `h₁)
|
|
|
|
(tag := userName ++ `h₁)
|
|
|
|
let h₂ ← Meta.mkFreshExprMVar (.some $ ← Meta.mkEq a₁ a₂)
|
|
|
|
let h₂ ← Meta.mkFreshExprSyntheticOpaqueMVar (← Meta.mkEq a₁ a₂)
|
|
|
|
.synthetic (userName := userName ++ `h₂)
|
|
|
|
(tag := userName ++ `h₂)
|
|
|
|
let conduitType ← Meta.mkEq (← Meta.mkEq (.app f₁ a₁) (.app f₂ a₂)) target
|
|
|
|
let conduitType ← Meta.mkEq (← Meta.mkEq (.app f₁ a₁) (.app f₂ a₂)) target
|
|
|
|
let conduit ← Meta.mkFreshExprMVar conduitType
|
|
|
|
let conduit ← Meta.mkFreshExprSyntheticOpaqueMVar conduitType
|
|
|
|
.synthetic (userName := userName ++ `conduit)
|
|
|
|
(tag := userName ++ `conduit)
|
|
|
|
mvarId.assign $ ← Meta.mkEqMP conduit (← Meta.mkCongr h₁ h₂)
|
|
|
|
mvarId.assign $ ← Meta.mkEqMP conduit (← Meta.mkCongr h₁ h₂)
|
|
|
|
let result := [α, f₁, f₂, a₁, a₂, h₁, h₂, conduit]
|
|
|
|
let result := [α, f₁, f₂, a₁, a₂, h₁, h₂, conduit]
|
|
|
|
return result.map (·.mvarId!)
|
|
|
|
return result.map (·.mvarId!)
|
|
|
|