Skip to content

Instantly share code, notes, and snippets.

@kbuzzard
Created July 3, 2019 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbuzzard/73237dbb64e70c482404d3780a4483c1 to your computer and use it in GitHub Desktop.
Save kbuzzard/73237dbb64e70c482404d3780a4483c1 to your computer and use it in GitHub Desktop.
Structure making for idiots
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