This adds a `test_extern` command. Usage: ``` import Lean.Util.TestExtern test_extern Nat.add 17 37 ``` This: * Checks that the head symbol has an `@[extern]` attribute. * Writes down `t == t'`, where `t` is the term provided, and `t'` is the reference implementation (specifically, `t` with the head symbol unfolded). * Tries to reduce this to `true`, and complains if this fails. Note that the type of the term must have a `BEq` instance for this to work: there's a self-explanatory error message if it isn't available.
29 lines
832 B
Text
29 lines
832 B
Text
/-
|
|
Copyright (c) 2020 Microsoft Corporation. All rights reserved.
|
|
Released under Apache 2.0 license as described in the file LICENSE.
|
|
Authors: Leonardo de Moura
|
|
-/
|
|
import Lean.Util.CollectFVars
|
|
import Lean.Util.CollectLevelParams
|
|
import Lean.Util.CollectMVars
|
|
import Lean.Util.FindMVar
|
|
import Lean.Util.FindLevelMVar
|
|
import Lean.Util.MonadCache
|
|
import Lean.Util.PPExt
|
|
import Lean.Util.Path
|
|
import Lean.Util.Profile
|
|
import Lean.Util.RecDepth
|
|
import Lean.Util.ShareCommon
|
|
import Lean.Util.Sorry
|
|
import Lean.Util.Trace
|
|
import Lean.Util.FindExpr
|
|
import Lean.Util.ReplaceExpr
|
|
import Lean.Util.ForEachExpr
|
|
import Lean.Util.ForEachExprWhere
|
|
import Lean.Util.ReplaceLevel
|
|
import Lean.Util.FoldConsts
|
|
import Lean.Util.SCC
|
|
import Lean.Util.TestExtern
|
|
import Lean.Util.OccursCheck
|
|
import Lean.Util.HasConstCache
|
|
import Lean.Util.FileSetupInfo
|