{{{id=1|
#auto
load('http://dl.dropbox.com/u/789125/PP2012_GRIM_CODE/PP2012_Mesh_functions_beta1.sage')
load('http://dl.dropbox.com/u/789125/PP2012_GRIM_CODE/PP2012_GRIM.sage')
load('http://dl.dropbox.com/u/789125/PP2012_GRIM_CODE/PP2012_pattern_classes.sage')
load('http://dl.dropbox.com/u/789125/PP2012_GRIM_CODE/PP2012_sorting_functions.sage')
///
}}}
{{{id=3|
#
# Finding the good permutations
#
C = 5
#prop = lambda x: is_stack_sortable(x)
prop = lambda x: is_West_2_stack_sortable(x)
#prop = lambda x: is_factorial(x)
#prop = lambda x: has_no_box_in_tableau(x)
A = para_perms_sat_prop(C,prop)
size_of_subdicts(A)
///
Perms of length 1 with this property are 1
Perms of length 2 with this property are 2
Perms of length 3 with this property are 6
Perms of length 4 with this property are 22
Perms of length 5 with this property are 91
}}}
{{{id=4|
%time
# Maximum length of patterns to search for
M = 4
# Maximum length of permutations from A to consider.
N = C
# Initializing a dictionary of good patterns that will
# be learned from A
goodpatts = dict()
SG = parallel_guess(M,N,report=True)
visualize_patts(SG,6)
///
Starting search for allowed patterns of lengths 1...4
Only need to consider patterns of length 4
Now looking at permutations of length
1
2
3
4
5
Done
The number of allowed patterns of length 4 is 23
Getting rid of the unnecessary allowed patterns
The number of allowed patterns of length 4 is now 23
Starting search for forbidden patterns of lengths 1...4
The number of bad patterns of length 1 is 0
The number of bad patterns of length 2 is 0
The number of bad patterns of length 3 is 0
The number of bad patterns of length 4 is 2
Starting search for minimal forbidden patterns
Reducing with ([2, 3, 4, 1], {})
Reducing with ([3, 2, 4, 1], {(1, 4)})
CPU time: 1.78 s, Wall time: 1.77 s
}}}
{{{id=6|
#
# Now seeing whether this actually gives the correct permutations
#
L = C
patterns_suffice(SG,L,A)
///
The patterns correctly describe the good perms of length 1
The patterns correctly describe the good perms of length 2
The patterns correctly describe the good perms of length 3
The patterns correctly describe the good perms of length 4
The patterns correctly describe the good perms of length 5
}}}
{{{id=19|
# More props to play with
#prop = lambda x: has_no_box_in_tableau(x)
#prop = lambda x: has_no_3_2_in_tableau(x)
#prop = lambda x: x.number_of_fixed_points() <= 0
# Skew-merge permutations
#prop = lambda x: is_a_merge_of(x, lambda x: Permutation(x).avoids([2,1]), lambda y: Permutation(y).avoids([1,2]))
# The classes used to get the bound of 16 on Av(1324)
#prop = lambda x: is_a_merge_of(x, lambda x: Permutation(x).avoids([1,3,2]), lambda y: Permutation(y).avoids([2,1,3]))
prop = lambda x: is_a_merge_of(x, lambda x: Permutation(x).avoids([1,3,2]) and Permutation(x).avoids([3,2,1]), lambda y: Permutation(y).avoids([2,1,3]) and Permutation(y).avoids([1,2,3]))
prop = lambda x: Permutation(x).avoids([1,3,2,4]) and not is_a_merge_of(x, lambda x: Permutation(x).avoids([1,2,3]), lambda y: Permutation(y).avoids([2,1,3]) and Permutation(y).avoids([3,2,1]))
prop = lambda x: Permutation(x).avoids([2,1,3]) and Permutation(x).avoids([3,2,1])
///
}}}
{{{id=7|
#
# Pictures from talk
#
show ( MeshPattern ( [2, 4, 1, 3], [(0,1),(0,3),(1,0),(1,1),(1,3),(2,0),(2,1),(2,2),(2,3),(2,4),(3,0),(3,1),(3,2),(3,3),(3,4)] ), axes = False, figsize = [3,3] )
///
}}}
{{{id=8|
show ( MeshPattern ( [3,1,4,2], [] ), axes = False, figsize = [3,3] )
///
}}}
{{{id=20|
# Below are some functions we need
///
}}}
{{{id=9|
#auto
def is_stack_sortable(perm):
return stack_sort(perm) == [1..len(perm)]
def is_West_2_stack_sortable(perm):
return stack_sort(stack_sort(perm)) == [1..len(perm)]
def is_factorial(perm):
return MeshPattern([1,3,2,4],[]).avoided_by(perm) and MeshPattern([2,1,4,3],[(2,2)]).avoided_by(perm)
def has_no_box_in_tableau(perm):
return not any(map(lambda x: x > 1, perm.left_tableau().shape()[1:] ))
def has_no_3_2_in_tableau(perm):
L = perm.left_tableau().shape()
if L[0] < 3:
return True
else:
if len(L) == 1:
return True
else:
if L[1] < 2:
return True
return False
def is_a_merge_of(perm,prop1,prop2):
return subfunc(perm,[],[],prop1,prop2)
def subfunc(inp,partial1,partial2,prop1,prop2):
if inp:
return any( [ subfunc(inp[1:],partial1+[inp[0]],partial2,prop1,prop2), subfunc(inp[1:],partial1,partial2+[inp[0]],prop1,prop2) ] )
else:
return prop1(to_standard(partial1)) and prop2(to_standard(partial2))
///
}}}
{{{id=21|
///
}}