Created
July 3, 2019 13:23
-
-
Save kbuzzard/73237dbb64e70c482404d3780a4483c1 to your computer and use it in GitHub Desktop.
Structure making for idiots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace tactic.interactive | |
open tactic | |
meta def replace_special_names : name → name | |
| `add := `has_add.add | |
| n := n | |
meta def i_checked_all_teh_axioms : tactic unit := | |
do t ← target, | |
env ← get_env, | |
match t with | |
| expr.app (expr.const sn _) e := | |
match env.structure_fields sn with | |
| some l := | |
do n :: _ ← tactic.open_namespaces, | |
let lf := l.map replace_special_names, | |
v ← lf.mmap resolve_name, | |
let s : structure_instance_info := { | |
struct := some sn, | |
field_names := l, | |
field_values := v, | |
}, | |
e ← to_expr $ pexpr.mk_structure_instance s, | |
tactic.exact e | |
| none := fail "goal not a structure" | |
end | |
| _ := fail "unsupported goal" | |
end | |
end tactic.interactive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment