Skip to content

Instantly share code, notes, and snippets.

@ocfnash
Created February 10, 2021 17:33
Show Gist options
  • Save ocfnash/4de274664fd7f0e605050d06abe0a57f to your computer and use it in GitHub Desktop.
Save ocfnash/4de274664fd7f0e605050d06abe0a57f to your computer and use it in GitHub Desktop.
Using `leancrawler` to aid review of https://github.com/leanprover-community/mathlib/pull/6141
from leancrawler import LeanLib, LeanDeclGraph
import re
# lie_data_old = LeanLib.from_yaml('lie_data', '/Users/olivernash/Desktop/mathlib/src/algebra/lie/lie_data_old.yaml')
# lie_data_old.dump('lie_data_old.dump')
lie_data_old = LeanLib.load_dump('lie_data_old.dump')
# lie_data_new = LeanLib.from_yaml('lie_data', '/Users/olivernash/Desktop/mathlib/src/algebra/lie/lie_data_new.yaml')
# lie_data_new.dump('lie_data_new.dump')
lie_data_new = LeanLib.load_dump('lie_data_new.dump')
mangle_type = lambda t: re.sub('_inst_[0-9]+', '_inst_x', t.replace('\n', ' '))
lie_keys_old = {k : mangle_type(v.Type) for (k, v) in lie_data_old.items.items() if 'src/algebra/lie/' in v.filename}
lie_keys_new = {k : mangle_type(v.Type) for (k, v) in lie_data_new.items.items() if 'src/algebra/lie/' in v.filename}
len(lie_keys_old), len(lie_keys_new)
# output:
# (654, 654)
set(lie_keys_old) - set(lie_keys_new)
# output:
# {'lie_submodule.has_bracket'}
set(lie_keys_new) - set(lie_keys_old)
# output:
# {'lie_submodule.ideal_operation'}
lie_keys_old['lie_submodule.has_bracket'] == lie_keys_new['lie_submodule.ideal_operation']
# output:
# True
len(set(lie_keys_old) & set(lie_keys_new))
# output:
# 653
for k in (set(lie_keys_old) & set(lie_keys_new)):
if lie_keys_old[k] != lie_keys_new[k]:
print(k)
print(lie_keys_old[k])
print(lie_keys_new[k])
print()
# output:
# lie_algebra.derived_length_zero
# ∀ (R : Type u) (L : Type v) [_inst_x : comm_ring R] [_inst_x : lie_ring L] [_inst_x : lie_algebra R L] (I : lie_ideal R L) [hI : lie_algebra.is_solvable R ↥I], lie_algebra.derived_length_of_ideal R L I = 0 ↔ I = ⊥
# ∀ {R : Type u} {L : Type v} [_inst_x : comm_ring R] [_inst_x : lie_ring L] [_inst_x : lie_algebra R L] (I : lie_ideal R L) [hI : lie_algebra.is_solvable R ↥I], lie_algebra.derived_length_of_ideal R L I = 0 ↔ I = ⊥
import algebra.lie.deps -- from `leancrawler`
import algebra.lie.abelian
import algebra.lie.basic
import algebra.lie.ideal_operations
import algebra.lie.matrix
import algebra.lie.nilpotent
import algebra.lie.of_associative
import algebra.lie.quotient
import algebra.lie.semisimple
import algebra.lie.solvable
import algebra.lie.subalgebra
import algebra.lie.submodule
run_cmd print_all_content
import algebra.lie.deps -- from `leancrawler`
import algebra.lie.basic
run_cmd print_all_content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment